diff options
-rw-r--r-- | .mailmap | 1 | ||||
-rw-r--r-- | Documentation/DocBook/device-drivers.tmpl | 10 | ||||
-rw-r--r-- | Documentation/DocBook/drm.tmpl | 5 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/arm/marvell,kirkwood.txt | 97 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/i2c/trivial-devices.txt | 16 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/net/ethernet.txt | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt | 2 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/serial/efm32-uart.txt | 4 | ||||
-rw-r--r-- | Documentation/devicetree/bindings/vendor-prefixes.txt | 18 | ||||
-rw-r--r-- | Documentation/ja_JP/HOWTO | 2 | ||||
-rw-r--r-- | Documentation/ja_JP/stable_kernel_rules.txt | 6 | ||||
-rw-r--r-- | Documentation/kernel-parameters.txt | 13 | ||||
-rw-r--r-- | Documentation/magic-number.txt | 12 | ||||
-rw-r--r-- | Documentation/serial/00-INDEX | 8 | ||||
-rw-r--r-- | Documentation/serial/digiepca.txt | 98 | ||||
-rw-r--r-- | Documentation/serial/riscom8.txt | 36 | ||||
-rw-r--r-- | Documentation/serial/specialix.txt | 383 | ||||
-rw-r--r-- | Documentation/serial/sx.txt | 294 | ||||
-rw-r--r-- | Documentation/stable_kernel_rules.txt | 2 | ||||
-rw-r--r-- | Documentation/vm/numa_memory_policy.txt | 5 | ||||
-rw-r--r-- | Documentation/zh_CN/HOWTO | 2 | ||||
-rw-r--r-- | Documentation/zh_CN/io_ordering.txt | 67 | ||||
-rw-r--r-- | Documentation/zh_CN/magic-number.txt | 12 | ||||
-rw-r--r-- | Documentation/zh_CN/stable_kernel_rules.txt | 2 | ||||
-rw-r--r-- | MAINTAINERS | 4 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | arch/arc/include/asm/barrier.h | 37 | ||||
-rw-r--r-- | arch/arm/boot/dts/spear320-hmi.dts | 2 | ||||
-rw-r--r-- | arch/arm/configs/bcm_defconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear/headsmp.S | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear/platsmp.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear/time.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/ivt.S | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/vmm_ivt.S | 2 | ||||
-rw-r--r-- | arch/mips/mm/cache.c | 4 | ||||
-rw-r--r-- | arch/parisc/include/asm/shmparam.h | 5 | ||||
-rw-r--r-- | arch/parisc/kernel/cache.c | 3 | ||||
-rw-r--r-- | arch/parisc/kernel/sys_parisc.c | 14 | ||||
-rw-r--r-- | arch/parisc/kernel/syscall_table.S | 2 | ||||
-rw-r--r-- | arch/parisc/lib/memcpy.c | 2 | ||||
-rw-r--r-- | arch/parisc/mm/fault.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/mm/numa.c | 1 | ||||
-rw-r--r-- | arch/s390/include/asm/sigp.h | 19 | ||||
-rw-r--r-- | arch/s390/include/asm/smp.h | 13 | ||||
-rw-r--r-- | arch/s390/include/uapi/asm/unistd.h | 3 | ||||
-rw-r--r-- | arch/s390/kernel/compat_wrapper.c | 3 | ||||
-rw-r--r-- | arch/s390/kernel/dumpstack.c | 8 | ||||
-rw-r--r-- | arch/s390/kernel/ptrace.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 32 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 15 | ||||
-rw-r--r-- | arch/s390/kernel/syscalls.S | 1 | ||||
-rw-r--r-- | arch/s390/lib/uaccess.c | 5 | ||||
-rw-r--r-- | arch/s390/mm/fault.c | 140 | ||||
-rw-r--r-- | arch/x86/Makefile | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_intel.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_rapl.c | 45 | ||||
-rw-r--r-- | arch/x86/kernel/early-quirks.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/kprobes/core.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/reboot.c | 72 | ||||
-rw-r--r-- | arch/x86/kvm/cpuid.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/cpuid.h | 8 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.c | 38 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.h | 44 | ||||
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 11 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 10 | ||||
-rw-r--r-- | arch/x86/syscalls/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/syscalls/syscall_32.tbl | 1 | ||||
-rw-r--r-- | arch/x86/tools/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/xen/smp.c | 3 | ||||
-rw-r--r-- | arch/x86/xen/spinlock.c | 5 | ||||
-rw-r--r-- | arch/x86/xen/xen-asm_32.S | 25 | ||||
-rw-r--r-- | drivers/Makefile | 4 | ||||
-rw-r--r-- | drivers/base/core.c | 33 | ||||
-rw-r--r-- | drivers/base/dd.c | 4 | ||||
-rw-r--r-- | drivers/base/topology.c | 3 | ||||
-rw-r--r-- | drivers/char/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/hw_random/bcm2835-rng.c | 10 | ||||
-rw-r--r-- | drivers/char/ipmi/Kconfig | 12 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_bt_sm.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_kcs_sm.c | 5 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 239 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 145 | ||||
-rw-r--r-- | drivers/char/pcmcia/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/ttyprintk.c | 15 | ||||
-rw-r--r-- | drivers/dma/Kconfig | 2 | ||||
-rw-r--r-- | drivers/dma/edma.c | 6 | ||||
-rw-r--r-- | drivers/dma/fsl-edma.c | 12 | ||||
-rw-r--r-- | drivers/dma/sirf-dma.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-spear-spics.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/ast/ast_post.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_drv.c | 44 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_fbdev.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_drv.c | 42 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_mode.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 370 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_dp_helper.c | 55 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_plane_helper.c | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_probe_helper.c | 426 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 218 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_bios.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_bios.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 100 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fb.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_gem.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_dp.c | 140 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/ci_dpm.c | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/dce6_afmt.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atpx_handler.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_connectors.c | 44 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_family.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_i2c.c | 60 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_kms.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ucode.h | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_vce.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/si.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dpaux.c | 44 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dpaux.h | 1 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/intr_hw.c | 4 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 5 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 5 | ||||
-rw-r--r-- | drivers/hid/hid-microsoft.c | 4 | ||||
-rw-r--r-- | drivers/hid/hid-sensor-hub.c | 7 | ||||
-rw-r--r-- | drivers/hid/hid-sony.c | 2 | ||||
-rw-r--r-- | drivers/hv/connection.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 89 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cq.c | 24 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/device.c | 41 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/mem.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/provider.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/qp.c | 70 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/resource.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb4/t4.h | 72 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_main.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_pcie.c | 55 | ||||
-rw-r--r-- | drivers/iommu/arm-smmu.c | 4 | ||||
-rw-r--r-- | drivers/iommu/dmar.c | 3 | ||||
-rw-r--r-- | drivers/iommu/intel-iommu.c | 10 | ||||
-rw-r--r-- | drivers/irqchip/irq-vic.c | 6 | ||||
-rw-r--r-- | drivers/irqchip/spear-shirq.c | 2 | ||||
-rw-r--r-- | drivers/isdn/icn/icn.c | 11 | ||||
-rw-r--r-- | drivers/mcb/mcb-parse.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 3 | ||||
-rw-r--r-- | drivers/media/platform/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mfd/tps65090.c | 41 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 4 | ||||
-rw-r--r-- | drivers/misc/genwqe/card_base.h | 58 | ||||
-rw-r--r-- | drivers/misc/genwqe/card_ddcb.c | 6 | ||||
-rw-r--r-- | drivers/misc/genwqe/card_dev.c | 44 | ||||
-rw-r--r-- | drivers/misc/genwqe/card_utils.c | 170 | ||||
-rw-r--r-- | drivers/misc/genwqe/genwqe_driver.h | 2 | ||||
-rw-r--r-- | drivers/misc/mei/hw-me-regs.h | 5 | ||||
-rw-r--r-- | drivers/misc/mei/interrupt.c | 3 | ||||
-rw-r--r-- | drivers/misc/mei/main.c | 3 | ||||
-rw-r--r-- | drivers/misc/mei/pci-me.c | 30 | ||||
-rw-r--r-- | drivers/mtd/devices/spear_smi.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/cadence/Kconfig | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/l2t.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/marvell/mvneta.c | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_cq.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 181 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 21 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 31 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ef10.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/enum.h | 23 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/falcon.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/farch.c | 22 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi.c | 55 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/mcdi.h | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/net_driver.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/nic.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/siena.c | 2 | ||||
-rw-r--r-- | drivers/net/ieee802154/at86rf230.c | 10 | ||||
-rw-r--r-- | drivers/net/phy/mdio-gpio.c | 68 | ||||
-rw-r--r-- | drivers/net/vxlan.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/cosa.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/cw1200/debug.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-7000.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/coex.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/rs.c | 261 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/rs.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/sf.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/drv.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rsi/rsi_91x_core.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rsi/rsi_91x_mgmt.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/event.h | 20 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/event.c | 5 | ||||
-rw-r--r-- | drivers/of/base.c | 10 | ||||
-rw-r--r-- | drivers/of/fdt.c | 2 | ||||
-rw-r--r-- | drivers/pci/host/pci-rcar-gen2.c | 8 | ||||
-rw-r--r-- | drivers/pci/host/pci-tegra.c | 7 | ||||
-rw-r--r-- | drivers/pci/host/pcie-designware.c | 20 | ||||
-rw-r--r-- | drivers/pinctrl/Kconfig | 8 | ||||
-rw-r--r-- | drivers/pinctrl/Makefile | 2 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-bcm281xx.c | 1461 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-capri.c | 1454 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-msm.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-msm.h | 1 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 1 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 48 | ||||
-rw-r--r-- | drivers/power/tps65090-charger.c | 11 | ||||
-rw-r--r-- | drivers/pwm/pwm-spear.c | 4 | ||||
-rw-r--r-- | drivers/s390/char/sclp.c | 2 | ||||
-rw-r--r-- | drivers/s390/char/sclp_cmd.c | 2 | ||||
-rw-r--r-- | drivers/s390/char/sclp_vt220.c | 14 | ||||
-rw-r--r-- | drivers/staging/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/comedi/comedi_buf.c | 37 | ||||
-rw-r--r-- | drivers/staging/comedi/comedi_fops.c | 18 | ||||
-rw-r--r-- | drivers/staging/comedi/comedi_internal.h | 2 | ||||
-rw-r--r-- | drivers/staging/goldfish/goldfish_audio.c | 1 | ||||
-rw-r--r-- | drivers/staging/gs_fpgaboot/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/Kconfig | 10 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/Makefile | 38 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/Module.symvers | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/TODO | 13 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/dot11d.c | 189 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/dot11d.h | 71 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211.h | 1496 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c | 240 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h | 86 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | 455 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c | 740 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c | 277 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_module.c | 203 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c | 1486 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 2711 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | 567 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c | 591 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c | 713 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180.h | 640 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_93cx6.h | 54 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_core.c | 3775 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_dm.c | 1139 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_dm.h | 23 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_hw.h | 588 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_rtl8225.h | 34 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_rtl8225z2.c | 811 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_wx.c | 1409 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8180_wx.h | 21 | ||||
-rw-r--r-- | drivers/staging/rtl8187se/r8185b_init.c | 1464 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_recv.c | 19 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 74 | ||||
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_recv.c | 13 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_ieee80211.c | 46 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_p2p.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/core/rtw_wlan_util.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8821ae/base.c | 10 | ||||
-rw-r--r-- | drivers/staging/speakup/main.c | 18 | ||||
-rw-r--r-- | drivers/staging/unisys/uislib/uislib.c | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset.h | 4 | ||||
-rw-r--r-- | drivers/staging/unisys/visorchipset/visorchipset_main.c | 8 | ||||
-rw-r--r-- | drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c | 7 | ||||
-rw-r--r-- | drivers/staging/usbip/vhci_sysfs.c | 2 | ||||
-rw-r--r-- | drivers/staging/vme/devices/vme_user.c | 9 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_def.h | 2 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_struct.h | 2 | ||||
-rw-r--r-- | drivers/staging/xgifb/vgatypes.h | 4 | ||||
-rw-r--r-- | drivers/tty/serial/Kconfig | 1 | ||||
-rw-r--r-- | drivers/tty/serial/amba-pl011.c | 8 | ||||
-rw-r--r-- | drivers/tty/serial/clps711x.c | 20 | ||||
-rw-r--r-- | drivers/tty/serial/efm32-uart.c | 3 | ||||
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 30 | ||||
-rw-r--r-- | drivers/tty/serial/serial_core.c | 5 | ||||
-rw-r--r-- | drivers/tty/serial/st-asc.c | 4 | ||||
-rw-r--r-- | drivers/tty/tty_io.c | 4 | ||||
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 34 | ||||
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-exynos.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-platform.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 23 | ||||
-rw-r--r-- | drivers/usb/host/ohci-jz4740.c | 6 | ||||
-rw-r--r-- | drivers/usb/serial/cp210x.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 33 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio_ids.h | 37 | ||||
-rw-r--r-- | drivers/usb/serial/option.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/pl2303.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/pl2303.h | 5 | ||||
-rw-r--r-- | drivers/usb/serial/sierra.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/usb_wwan.c | 9 | ||||
-rw-r--r-- | drivers/usb/storage/uas.c | 13 | ||||
-rw-r--r-- | drivers/usb/usb-common.c | 2 | ||||
-rw-r--r-- | drivers/uwb/drp.c | 5 | ||||
-rw-r--r-- | drivers/video/Kconfig | 2478 | ||||
-rw-r--r-- | drivers/video/Makefile | 166 | ||||
-rw-r--r-- | drivers/video/console/sticon.c | 2 | ||||
-rw-r--r-- | drivers/video/console/sticore.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/68328fb.c (renamed from drivers/video/68328fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/Kconfig | 2474 | ||||
-rw-r--r-- | drivers/video/fbdev/Makefile | 152 | ||||
-rw-r--r-- | drivers/video/fbdev/acornfb.c (renamed from drivers/video/acornfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/acornfb.h (renamed from drivers/video/acornfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/amba-clcd.c (renamed from drivers/video/amba-clcd.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/amifb.c (renamed from drivers/video/amifb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/arcfb.c (renamed from drivers/video/arcfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/arkfb.c (renamed from drivers/video/arkfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/asiliantfb.c (renamed from drivers/video/asiliantfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb.c (renamed from drivers/video/atafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb.h (renamed from drivers/video/atafb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb_iplan2p2.c (renamed from drivers/video/atafb_iplan2p2.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb_iplan2p4.c (renamed from drivers/video/atafb_iplan2p4.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb_iplan2p8.c (renamed from drivers/video/atafb_iplan2p8.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb_mfb.c (renamed from drivers/video/atafb_mfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atafb_utils.h (renamed from drivers/video/atafb_utils.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/atmel_lcdfb.c (renamed from drivers/video/atmel_lcdfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/Makefile (renamed from drivers/video/aty/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/ati_ids.h (renamed from drivers/video/aty/ati_ids.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/aty128fb.c (renamed from drivers/video/aty/aty128fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/atyfb.h (renamed from drivers/video/aty/atyfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/atyfb_base.c (renamed from drivers/video/aty/atyfb_base.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/mach64_accel.c (renamed from drivers/video/aty/mach64_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/mach64_ct.c (renamed from drivers/video/aty/mach64_ct.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/mach64_cursor.c (renamed from drivers/video/aty/mach64_cursor.c) | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/mach64_gx.c (renamed from drivers/video/aty/mach64_gx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_accel.c (renamed from drivers/video/aty/radeon_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_backlight.c (renamed from drivers/video/aty/radeon_backlight.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_base.c (renamed from drivers/video/aty/radeon_base.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_i2c.c (renamed from drivers/video/aty/radeon_i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_monitor.c (renamed from drivers/video/aty/radeon_monitor.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeon_pm.c (renamed from drivers/video/aty/radeon_pm.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/aty/radeonfb.h (renamed from drivers/video/aty/radeonfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/au1100fb.c (renamed from drivers/video/au1100fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/au1100fb.h (renamed from drivers/video/au1100fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/au1200fb.c (renamed from drivers/video/au1200fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/au1200fb.h (renamed from drivers/video/au1200fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/auo_k1900fb.c (renamed from drivers/video/auo_k1900fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/auo_k1901fb.c (renamed from drivers/video/auo_k1901fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/auo_k190x.c (renamed from drivers/video/auo_k190x.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/auo_k190x.h (renamed from drivers/video/auo_k190x.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bf537-lq035.c (renamed from drivers/video/bf537-lq035.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bf54x-lq043fb.c (renamed from drivers/video/bf54x-lq043fb.c) | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/bfin-lq035q1-fb.c (renamed from drivers/video/bfin-lq035q1-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bfin-t350mcqb-fb.c (renamed from drivers/video/bfin-t350mcqb-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bfin_adv7393fb.c (renamed from drivers/video/bfin_adv7393fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bfin_adv7393fb.h (renamed from drivers/video/bfin_adv7393fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/broadsheetfb.c (renamed from drivers/video/broadsheetfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bt431.h (renamed from drivers/video/bt431.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bt455.h (renamed from drivers/video/bt455.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/bw2.c (renamed from drivers/video/bw2.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/c2p.h (renamed from drivers/video/c2p.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/c2p_core.h (renamed from drivers/video/c2p_core.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/c2p_iplan2.c (renamed from drivers/video/c2p_iplan2.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/c2p_planar.c (renamed from drivers/video/c2p_planar.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/carminefb.c (renamed from drivers/video/carminefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/carminefb.h (renamed from drivers/video/carminefb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/carminefb_regs.h (renamed from drivers/video/carminefb_regs.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cg14.c (renamed from drivers/video/cg14.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cg3.c (renamed from drivers/video/cg3.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cg6.c (renamed from drivers/video/cg6.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/chipsfb.c (renamed from drivers/video/chipsfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cirrusfb.c (renamed from drivers/video/cirrusfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/clps711xfb.c (renamed from drivers/video/clps711xfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cobalt_lcdfb.c (renamed from drivers/video/cobalt_lcdfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/controlfb.c (renamed from drivers/video/controlfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/controlfb.h (renamed from drivers/video/controlfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/Makefile | 16 | ||||
-rw-r--r-- | drivers/video/fbdev/core/cfbcopyarea.c (renamed from drivers/video/cfbcopyarea.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/cfbfillrect.c (renamed from drivers/video/cfbfillrect.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/cfbimgblt.c (renamed from drivers/video/cfbimgblt.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fb_ddc.c (renamed from drivers/video/fb_ddc.c) | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fb_defio.c (renamed from drivers/video/fb_defio.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fb_draw.h (renamed from drivers/video/fb_draw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fb_notify.c (renamed from drivers/video/fb_notify.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fb_sys_fops.c (renamed from drivers/video/fb_sys_fops.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbcmap.c (renamed from drivers/video/fbcmap.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbcvt.c (renamed from drivers/video/fbcvt.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbmem.c (renamed from drivers/video/fbmem.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbmon.c (renamed from drivers/video/fbmon.c) | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/core/fbsysfs.c (renamed from drivers/video/fbsysfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/modedb.c (renamed from drivers/video/modedb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/svgalib.c (renamed from drivers/video/svgalib.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/syscopyarea.c (renamed from drivers/video/syscopyarea.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/sysfillrect.c (renamed from drivers/video/sysfillrect.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/core/sysimgblt.c (renamed from drivers/video/sysimgblt.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cyber2000fb.c (renamed from drivers/video/cyber2000fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/cyber2000fb.h (renamed from drivers/video/cyber2000fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/da8xx-fb.c (renamed from drivers/video/da8xx-fb.c) | 10 | ||||
-rw-r--r-- | drivers/video/fbdev/dnfb.c (renamed from drivers/video/dnfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/edid.h (renamed from drivers/video/edid.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/efifb.c (renamed from drivers/video/efifb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/ep93xx-fb.c (renamed from drivers/video/ep93xx-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/Kconfig (renamed from drivers/video/exynos/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/Makefile (renamed from drivers/video/exynos/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi.c (renamed from drivers/video/exynos/exynos_mipi_dsi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c (renamed from drivers/video/exynos/exynos_mipi_dsi_common.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi_common.h (renamed from drivers/video/exynos/exynos_mipi_dsi_common.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.c (renamed from drivers/video/exynos/exynos_mipi_dsi_lowlevel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.h (renamed from drivers/video/exynos/exynos_mipi_dsi_lowlevel.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/exynos_mipi_dsi_regs.h (renamed from drivers/video/exynos/exynos_mipi_dsi_regs.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/exynos/s6e8ax0.c (renamed from drivers/video/exynos/s6e8ax0.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/fb-puv3.c (renamed from drivers/video/fb-puv3.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/ffb.c (renamed from drivers/video/ffb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/fm2fb.c (renamed from drivers/video/fm2fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/fsl-diu-fb.c (renamed from drivers/video/fsl-diu-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/g364fb.c (renamed from drivers/video/g364fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/gbefb.c (renamed from drivers/video/gbefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/Kconfig (renamed from drivers/video/geode/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/Makefile (renamed from drivers/video/geode/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/display_gx.c (renamed from drivers/video/geode/display_gx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/display_gx1.c (renamed from drivers/video/geode/display_gx1.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/display_gx1.h (renamed from drivers/video/geode/display_gx1.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/geodefb.h (renamed from drivers/video/geode/geodefb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/gx1fb_core.c (renamed from drivers/video/geode/gx1fb_core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/gxfb.h (renamed from drivers/video/geode/gxfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/gxfb_core.c (renamed from drivers/video/geode/gxfb_core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/lxfb.h (renamed from drivers/video/geode/lxfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/lxfb_core.c (renamed from drivers/video/geode/lxfb_core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/lxfb_ops.c (renamed from drivers/video/geode/lxfb_ops.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/suspend_gx.c (renamed from drivers/video/geode/suspend_gx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/video_cs5530.c (renamed from drivers/video/geode/video_cs5530.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/video_cs5530.h (renamed from drivers/video/geode/video_cs5530.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/geode/video_gx.c (renamed from drivers/video/geode/video_gx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/goldfishfb.c (renamed from drivers/video/goldfishfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/grvga.c (renamed from drivers/video/grvga.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/gxt4500.c (renamed from drivers/video/gxt4500.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/hecubafb.c (renamed from drivers/video/hecubafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/hgafb.c (renamed from drivers/video/hgafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/hitfb.c (renamed from drivers/video/hitfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/hpfb.c (renamed from drivers/video/hpfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/hyperv_fb.c (renamed from drivers/video/hyperv_fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i740_reg.h (renamed from drivers/video/i740_reg.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i740fb.c (renamed from drivers/video/i740fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/Makefile (renamed from drivers/video/i810/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810-i2c.c (renamed from drivers/video/i810/i810-i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810.h (renamed from drivers/video/i810/i810.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_accel.c (renamed from drivers/video/i810/i810_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_dvt.c (renamed from drivers/video/i810/i810_dvt.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_gtf.c (renamed from drivers/video/i810/i810_gtf.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_main.c (renamed from drivers/video/i810/i810_main.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_main.h (renamed from drivers/video/i810/i810_main.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/i810/i810_regs.h (renamed from drivers/video/i810/i810_regs.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/igafb.c (renamed from drivers/video/igafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/imsttfb.c (renamed from drivers/video/imsttfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/imxfb.c (renamed from drivers/video/imxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/Makefile (renamed from drivers/video/intelfb/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfb.h (renamed from drivers/video/intelfb/intelfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfb_i2c.c (renamed from drivers/video/intelfb/intelfb_i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfbdrv.c (renamed from drivers/video/intelfb/intelfbdrv.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfbhw.c (renamed from drivers/video/intelfb/intelfbhw.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/intelfb/intelfbhw.h (renamed from drivers/video/intelfb/intelfbhw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/jz4740_fb.c (renamed from drivers/video/jz4740_fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/Makefile (renamed from drivers/video/kyro/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000InitDevice.c (renamed from drivers/video/kyro/STG4000InitDevice.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000Interface.h (renamed from drivers/video/kyro/STG4000Interface.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000OverlayDevice.c (renamed from drivers/video/kyro/STG4000OverlayDevice.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000Ramdac.c (renamed from drivers/video/kyro/STG4000Ramdac.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000Reg.h (renamed from drivers/video/kyro/STG4000Reg.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/STG4000VTG.c (renamed from drivers/video/kyro/STG4000VTG.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/kyro/fbdev.c (renamed from drivers/video/kyro/fbdev.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/leo.c (renamed from drivers/video/leo.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/macfb.c (renamed from drivers/video/macfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/macmodes.c (renamed from drivers/video/macmodes.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/macmodes.h (renamed from drivers/video/macmodes.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/Makefile (renamed from drivers/video/matrox/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/g450_pll.c (renamed from drivers/video/matrox/g450_pll.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/g450_pll.h (renamed from drivers/video/matrox/g450_pll.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/i2c-matroxfb.c (renamed from drivers/video/matrox/i2c-matroxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_DAC1064.c (renamed from drivers/video/matrox/matroxfb_DAC1064.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_DAC1064.h (renamed from drivers/video/matrox/matroxfb_DAC1064.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_Ti3026.c (renamed from drivers/video/matrox/matroxfb_Ti3026.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_Ti3026.h (renamed from drivers/video/matrox/matroxfb_Ti3026.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_accel.c (renamed from drivers/video/matrox/matroxfb_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_accel.h (renamed from drivers/video/matrox/matroxfb_accel.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_base.c (renamed from drivers/video/matrox/matroxfb_base.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_base.h (renamed from drivers/video/matrox/matroxfb_base.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_crtc2.c (renamed from drivers/video/matrox/matroxfb_crtc2.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_crtc2.h (renamed from drivers/video/matrox/matroxfb_crtc2.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_g450.c (renamed from drivers/video/matrox/matroxfb_g450.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_g450.h (renamed from drivers/video/matrox/matroxfb_g450.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_maven.c (renamed from drivers/video/matrox/matroxfb_maven.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_maven.h (renamed from drivers/video/matrox/matroxfb_maven.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_misc.c (renamed from drivers/video/matrox/matroxfb_misc.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/matrox/matroxfb_misc.h (renamed from drivers/video/matrox/matroxfb_misc.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/maxinefb.c (renamed from drivers/video/maxinefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/Makefile (renamed from drivers/video/mb862xx/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xx-i2c.c (renamed from drivers/video/mb862xx/mb862xx-i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xx_reg.h (renamed from drivers/video/mb862xx/mb862xx_reg.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xxfb.h (renamed from drivers/video/mb862xx/mb862xxfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xxfb_accel.c (renamed from drivers/video/mb862xx/mb862xxfb_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xxfb_accel.h (renamed from drivers/video/mb862xx/mb862xxfb_accel.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mb862xx/mb862xxfbdrv.c (renamed from drivers/video/mb862xx/mb862xxfbdrv.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mbx/Makefile (renamed from drivers/video/mbx/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mbx/mbxdebugfs.c (renamed from drivers/video/mbx/mbxdebugfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mbx/mbxfb.c (renamed from drivers/video/mbx/mbxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mbx/reg_bits.h (renamed from drivers/video/mbx/reg_bits.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mbx/regs.h (renamed from drivers/video/mbx/regs.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/metronomefb.c (renamed from drivers/video/metronomefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/Kconfig (renamed from drivers/video/mmp/Kconfig) | 6 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/Makefile (renamed from drivers/video/mmp/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/core.c (renamed from drivers/video/mmp/core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/fb/Kconfig (renamed from drivers/video/mmp/fb/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/fb/Makefile (renamed from drivers/video/mmp/fb/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/fb/mmpfb.c (renamed from drivers/video/mmp/fb/mmpfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/fb/mmpfb.h (renamed from drivers/video/mmp/fb/mmpfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/hw/Kconfig (renamed from drivers/video/mmp/hw/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/hw/Makefile (renamed from drivers/video/mmp/hw/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/hw/mmp_ctrl.c (renamed from drivers/video/mmp/hw/mmp_ctrl.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/hw/mmp_ctrl.h (renamed from drivers/video/mmp/hw/mmp_ctrl.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/hw/mmp_spi.c (renamed from drivers/video/mmp/hw/mmp_spi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/panel/Kconfig (renamed from drivers/video/mmp/panel/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/panel/Makefile (renamed from drivers/video/mmp/panel/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c (renamed from drivers/video/mmp/panel/tpo_tj032md01bw.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/Makefile (renamed from drivers/video/msm/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mddi.c (renamed from drivers/video/msm/mddi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mddi_client_dummy.c (renamed from drivers/video/msm/mddi_client_dummy.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mddi_client_nt35399.c (renamed from drivers/video/msm/mddi_client_nt35399.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mddi_client_toshiba.c (renamed from drivers/video/msm/mddi_client_toshiba.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mddi_hw.h (renamed from drivers/video/msm/mddi_hw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp.c (renamed from drivers/video/msm/mdp.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp_csc_table.h (renamed from drivers/video/msm/mdp_csc_table.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp_hw.h (renamed from drivers/video/msm/mdp_hw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp_ppp.c (renamed from drivers/video/msm/mdp_ppp.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp_scale_tables.c (renamed from drivers/video/msm/mdp_scale_tables.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/mdp_scale_tables.h (renamed from drivers/video/msm/mdp_scale_tables.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/msm/msm_fb.c (renamed from drivers/video/msm/msm_fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mx3fb.c (renamed from drivers/video/mx3fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/mxsfb.c (renamed from drivers/video/mxsfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/n411.c (renamed from drivers/video/n411.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/neofb.c (renamed from drivers/video/neofb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nuc900fb.c (renamed from drivers/video/nuc900fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nuc900fb.h (renamed from drivers/video/nuc900fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/Makefile (renamed from drivers/video/nvidia/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_accel.c (renamed from drivers/video/nvidia/nv_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_backlight.c (renamed from drivers/video/nvidia/nv_backlight.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_dma.h (renamed from drivers/video/nvidia/nv_dma.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_hw.c (renamed from drivers/video/nvidia/nv_hw.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_i2c.c (renamed from drivers/video/nvidia/nv_i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_local.h (renamed from drivers/video/nvidia/nv_local.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_of.c (renamed from drivers/video/nvidia/nv_of.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_proto.h (renamed from drivers/video/nvidia/nv_proto.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_setup.c (renamed from drivers/video/nvidia/nv_setup.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nv_type.h (renamed from drivers/video/nvidia/nv_type.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/nvidia/nvidia.c (renamed from drivers/video/nvidia/nvidia.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/ocfb.c (renamed from drivers/video/ocfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/offb.c (renamed from drivers/video/offb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/Kconfig (renamed from drivers/video/omap/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/Makefile (renamed from drivers/video/omap/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/hwa742.c (renamed from drivers/video/omap/hwa742.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_ams_delta.c (renamed from drivers/video/omap/lcd_ams_delta.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_h3.c (renamed from drivers/video/omap/lcd_h3.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_htcherald.c (renamed from drivers/video/omap/lcd_htcherald.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_inn1510.c (renamed from drivers/video/omap/lcd_inn1510.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_inn1610.c (renamed from drivers/video/omap/lcd_inn1610.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_mipid.c (renamed from drivers/video/omap/lcd_mipid.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_osk.c (renamed from drivers/video/omap/lcd_osk.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_palmte.c (renamed from drivers/video/omap/lcd_palmte.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_palmtt.c (renamed from drivers/video/omap/lcd_palmtt.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_palmz71.c (renamed from drivers/video/omap/lcd_palmz71.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcdc.c (renamed from drivers/video/omap/lcdc.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcdc.h (renamed from drivers/video/omap/lcdc.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/omapfb.h (renamed from drivers/video/omap/omapfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/omapfb_main.c (renamed from drivers/video/omap/omapfb_main.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/sossi.c (renamed from drivers/video/omap/sossi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/Kconfig | 10 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/Makefile (renamed from drivers/video/omap2/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/Kconfig (renamed from drivers/video/omap2/displays-new/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/Makefile (renamed from drivers/video/omap2/displays-new/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c (renamed from drivers/video/omap2/displays-new/connector-analog-tv.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/connector-dvi.c (renamed from drivers/video/omap2/displays-new/connector-dvi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/connector-hdmi.c (renamed from drivers/video/omap2/displays-new/connector-hdmi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c (renamed from drivers/video/omap2/displays-new/encoder-tfp410.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c (renamed from drivers/video/omap2/displays-new/encoder-tpd12s015.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-dpi.c (renamed from drivers/video/omap2/displays-new/panel-dpi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c (renamed from drivers/video/omap2/displays-new/panel-dsi-cm.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c (renamed from drivers/video/omap2/displays-new/panel-lgphilips-lb035q02.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c (renamed from drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c (renamed from drivers/video/omap2/displays-new/panel-sharp-ls037v7dw01.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c (renamed from drivers/video/omap2/displays-new/panel-sony-acx565akm.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c (renamed from drivers/video/omap2/displays-new/panel-tpo-td028ttec1.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c (renamed from drivers/video/omap2/displays-new/panel-tpo-td043mtea1.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/Kconfig (renamed from drivers/video/omap2/dss/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/Makefile (renamed from drivers/video/omap2/dss/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/apply.c (renamed from drivers/video/omap2/dss/apply.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/core.c (renamed from drivers/video/omap2/dss/core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc-compat.c (renamed from drivers/video/omap2/dss/dispc-compat.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc-compat.h (renamed from drivers/video/omap2/dss/dispc-compat.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc.c (renamed from drivers/video/omap2/dss/dispc.c) | 67 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc.h (renamed from drivers/video/omap2/dss/dispc.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc_coefs.c (renamed from drivers/video/omap2/dss/dispc_coefs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/display-sysfs.c (renamed from drivers/video/omap2/dss/display-sysfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/display.c (renamed from drivers/video/omap2/dss/display.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dpi.c (renamed from drivers/video/omap2/dss/dpi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dsi.c (renamed from drivers/video/omap2/dss/dsi.c) | 20 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss-of.c (renamed from drivers/video/omap2/dss/dss-of.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss.c (renamed from drivers/video/omap2/dss/dss.c) | 4 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss.h (renamed from drivers/video/omap2/dss/dss.h) | 6 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss_features.c (renamed from drivers/video/omap2/dss/dss_features.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss_features.h (renamed from drivers/video/omap2/dss/dss_features.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi.h (renamed from drivers/video/omap2/dss/hdmi.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi4.c (renamed from drivers/video/omap2/dss/hdmi4.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi4_core.c (renamed from drivers/video/omap2/dss/hdmi4_core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi4_core.h (renamed from drivers/video/omap2/dss/hdmi4_core.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi_common.c (renamed from drivers/video/omap2/dss/hdmi_common.c) | 8 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi_phy.c (renamed from drivers/video/omap2/dss/hdmi_phy.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi_pll.c (renamed from drivers/video/omap2/dss/hdmi_pll.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi_wp.c (renamed from drivers/video/omap2/dss/hdmi_wp.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/manager-sysfs.c (renamed from drivers/video/omap2/dss/manager-sysfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/manager.c (renamed from drivers/video/omap2/dss/manager.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/output.c (renamed from drivers/video/omap2/dss/output.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/overlay-sysfs.c (renamed from drivers/video/omap2/dss/overlay-sysfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/overlay.c (renamed from drivers/video/omap2/dss/overlay.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/rfbi.c (renamed from drivers/video/omap2/dss/rfbi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/sdi.c (renamed from drivers/video/omap2/dss/sdi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/venc.c (renamed from drivers/video/omap2/dss/venc.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/dss/venc_panel.c (renamed from drivers/video/omap2/dss/venc_panel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/Kconfig (renamed from drivers/video/omap2/omapfb/Kconfig) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/Makefile (renamed from drivers/video/omap2/omapfb/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c (renamed from drivers/video/omap2/omapfb/omapfb-ioctl.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/omapfb-main.c (renamed from drivers/video/omap2/omapfb/omapfb-main.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c (renamed from drivers/video/omap2/omapfb/omapfb-sysfs.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/omapfb/omapfb.h (renamed from drivers/video/omap2/omapfb/omapfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/omap2/vrfb.c (renamed from drivers/video/omap2/vrfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/p9100.c (renamed from drivers/video/p9100.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/platinumfb.c (renamed from drivers/video/platinumfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/platinumfb.h (renamed from drivers/video/platinumfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pm2fb.c (renamed from drivers/video/pm2fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pm3fb.c (renamed from drivers/video/pm3fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pmag-aa-fb.c (renamed from drivers/video/pmag-aa-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pmag-ba-fb.c (renamed from drivers/video/pmag-ba-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pmagb-b-fb.c (renamed from drivers/video/pmagb-b-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/ps3fb.c (renamed from drivers/video/ps3fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pvr2fb.c (renamed from drivers/video/pvr2fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxa168fb.c (renamed from drivers/video/pxa168fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxa168fb.h (renamed from drivers/video/pxa168fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxa3xx-gcu.c (renamed from drivers/video/pxa3xx-gcu.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxa3xx-gcu.h (renamed from drivers/video/pxa3xx-gcu.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxafb.c (renamed from drivers/video/pxafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/pxafb.h (renamed from drivers/video/pxafb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/q40fb.c (renamed from drivers/video/q40fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/Makefile (renamed from drivers/video/riva/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/fbdev.c (renamed from drivers/video/riva/fbdev.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/nv_driver.c (renamed from drivers/video/riva/nv_driver.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/nv_type.h (renamed from drivers/video/riva/nv_type.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/nvreg.h (renamed from drivers/video/riva/nvreg.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/riva_hw.c (renamed from drivers/video/riva/riva_hw.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/riva_hw.h (renamed from drivers/video/riva/riva_hw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/riva_tbl.h (renamed from drivers/video/riva/riva_tbl.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/rivafb-i2c.c (renamed from drivers/video/riva/rivafb-i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/riva/rivafb.h (renamed from drivers/video/riva/rivafb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/s1d13xxxfb.c (renamed from drivers/video/s1d13xxxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/s3c-fb.c (renamed from drivers/video/s3c-fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/s3c2410fb.c (renamed from drivers/video/s3c2410fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/s3c2410fb.h (renamed from drivers/video/s3c2410fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/s3fb.c (renamed from drivers/video/s3fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sa1100fb.c (renamed from drivers/video/sa1100fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sa1100fb.h (renamed from drivers/video/sa1100fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/savage/Makefile (renamed from drivers/video/savage/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/savage/savagefb-i2c.c (renamed from drivers/video/savage/savagefb-i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/savage/savagefb.h (renamed from drivers/video/savage/savagefb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/savage/savagefb_accel.c (renamed from drivers/video/savage/savagefb_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/savage/savagefb_driver.c (renamed from drivers/video/savage/savagefb_driver.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sbuslib.c (renamed from drivers/video/sbuslib.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sbuslib.h (renamed from drivers/video/sbuslib.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh7760fb.c (renamed from drivers/video/sh7760fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mipi_dsi.c (renamed from drivers/video/sh_mipi_dsi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mobile_hdmi.c (renamed from drivers/video/sh_mobile_hdmi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mobile_lcdcfb.c (renamed from drivers/video/sh_mobile_lcdcfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mobile_lcdcfb.h (renamed from drivers/video/sh_mobile_lcdcfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mobile_meram.c (renamed from drivers/video/sh_mobile_meram.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/simplefb.c (renamed from drivers/video/simplefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/300vtbl.h (renamed from drivers/video/sis/300vtbl.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/310vtbl.h (renamed from drivers/video/sis/310vtbl.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/Makefile (renamed from drivers/video/sis/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/init.c (renamed from drivers/video/sis/init.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/init.h (renamed from drivers/video/sis/init.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/init301.c (renamed from drivers/video/sis/init301.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/init301.h (renamed from drivers/video/sis/init301.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/initdef.h (renamed from drivers/video/sis/initdef.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/initextlfb.c (renamed from drivers/video/sis/initextlfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/oem300.h (renamed from drivers/video/sis/oem300.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/oem310.h (renamed from drivers/video/sis/oem310.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/sis.h (renamed from drivers/video/sis/sis.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/sis_accel.c (renamed from drivers/video/sis/sis_accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/sis_accel.h (renamed from drivers/video/sis/sis_accel.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/sis_main.c (renamed from drivers/video/sis/sis_main.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/sis_main.h (renamed from drivers/video/sis/sis_main.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/vgatypes.h (renamed from drivers/video/sis/vgatypes.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sis/vstruct.h (renamed from drivers/video/sis/vstruct.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/skeletonfb.c (renamed from drivers/video/skeletonfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sm501fb.c (renamed from drivers/video/sm501fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/smscufx.c (renamed from drivers/video/smscufx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/ssd1307fb.c (renamed from drivers/video/ssd1307fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sstfb.c (renamed from drivers/video/sstfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sticore.h (renamed from drivers/video/sticore.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/stifb.c (renamed from drivers/video/stifb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sunxvr1000.c (renamed from drivers/video/sunxvr1000.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sunxvr2500.c (renamed from drivers/video/sunxvr2500.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/sunxvr500.c (renamed from drivers/video/sunxvr500.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/tcx.c (renamed from drivers/video/tcx.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/tdfxfb.c (renamed from drivers/video/tdfxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/tgafb.c (renamed from drivers/video/tgafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/tmiofb.c (renamed from drivers/video/tmiofb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/tridentfb.c (renamed from drivers/video/tridentfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/udlfb.c (renamed from drivers/video/udlfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/uvesafb.c (renamed from drivers/video/uvesafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/valkyriefb.c (renamed from drivers/video/valkyriefb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/valkyriefb.h (renamed from drivers/video/valkyriefb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vermilion/Makefile (renamed from drivers/video/vermilion/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vermilion/cr_pll.c (renamed from drivers/video/vermilion/cr_pll.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vermilion/vermilion.c (renamed from drivers/video/vermilion/vermilion.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vermilion/vermilion.h (renamed from drivers/video/vermilion/vermilion.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vesafb.c (renamed from drivers/video/vesafb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vfb.c (renamed from drivers/video/vfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vga16fb.c (renamed from drivers/video/vga16fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/Makefile (renamed from drivers/video/via/Makefile) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/accel.c (renamed from drivers/video/via/accel.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/accel.h (renamed from drivers/video/via/accel.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/chip.h (renamed from drivers/video/via/chip.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/debug.h (renamed from drivers/video/via/debug.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/dvi.c (renamed from drivers/video/via/dvi.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/dvi.h (renamed from drivers/video/via/dvi.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/global.c (renamed from drivers/video/via/global.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/global.h (renamed from drivers/video/via/global.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/hw.c (renamed from drivers/video/via/hw.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/hw.h (renamed from drivers/video/via/hw.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/ioctl.c (renamed from drivers/video/via/ioctl.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/ioctl.h (renamed from drivers/video/via/ioctl.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/lcd.c (renamed from drivers/video/via/lcd.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/lcd.h (renamed from drivers/video/via/lcd.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/share.h (renamed from drivers/video/via/share.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/tblDPASetting.c (renamed from drivers/video/via/tblDPASetting.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/tblDPASetting.h (renamed from drivers/video/via/tblDPASetting.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-core.c (renamed from drivers/video/via/via-core.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.c (renamed from drivers/video/via/via-gpio.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux.c (renamed from drivers/video/via/via_aux.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux.h (renamed from drivers/video/via/via_aux.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_ch7301.c (renamed from drivers/video/via/via_aux_ch7301.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_edid.c (renamed from drivers/video/via/via_aux_edid.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_sii164.c (renamed from drivers/video/via/via_aux_sii164.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1621.c (renamed from drivers/video/via/via_aux_vt1621.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1622.c (renamed from drivers/video/via/via_aux_vt1622.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1625.c (renamed from drivers/video/via/via_aux_vt1625.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1631.c (renamed from drivers/video/via/via_aux_vt1631.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1632.c (renamed from drivers/video/via/via_aux_vt1632.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_aux_vt1636.c (renamed from drivers/video/via/via_aux_vt1636.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_clock.c (renamed from drivers/video/via/via_clock.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_clock.h (renamed from drivers/video/via/via_clock.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_i2c.c (renamed from drivers/video/via/via_i2c.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_modesetting.c (renamed from drivers/video/via/via_modesetting.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_modesetting.h (renamed from drivers/video/via/via_modesetting.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_utility.c (renamed from drivers/video/via/via_utility.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via_utility.h (renamed from drivers/video/via/via_utility.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/viafbdev.c (renamed from drivers/video/via/viafbdev.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/viafbdev.h (renamed from drivers/video/via/viafbdev.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/viamode.c (renamed from drivers/video/via/viamode.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/viamode.h (renamed from drivers/video/via/viamode.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/vt1636.c (renamed from drivers/video/via/vt1636.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/via/vt1636.h (renamed from drivers/video/via/vt1636.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vt8500lcdfb.c (renamed from drivers/video/vt8500lcdfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vt8500lcdfb.h (renamed from drivers/video/vt8500lcdfb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/vt8623fb.c (renamed from drivers/video/vt8623fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/w100fb.c (renamed from drivers/video/w100fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/w100fb.h (renamed from drivers/video/w100fb.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/wm8505fb.c (renamed from drivers/video/wm8505fb.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/wm8505fb_regs.h (renamed from drivers/video/wm8505fb_regs.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/wmt_ge_rops.c (renamed from drivers/video/wmt_ge_rops.c) | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/wmt_ge_rops.h (renamed from drivers/video/wmt_ge_rops.h) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/xen-fbfront.c (renamed from drivers/video/xen-fbfront.c) | 0 | ||||
-rw-r--r-- | drivers/video/fbdev/xilinxfb.c (renamed from drivers/video/xilinxfb.c) | 0 | ||||
-rw-r--r-- | drivers/video/omap2/Kconfig | 10 | ||||
-rw-r--r-- | drivers/vme/bridges/vme_tsi148.c | 22 | ||||
-rw-r--r-- | drivers/w1/w1.c | 32 | ||||
-rw-r--r-- | drivers/w1/w1_netlink.c | 44 | ||||
-rw-r--r-- | drivers/xen/manage.c | 32 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/pciback_ops.c | 3 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/vpci.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 44 | ||||
-rw-r--r-- | firmware/WHENCE | 10 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 14 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 8 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 3 | ||||
-rw-r--r-- | fs/cifs/file.c | 35 | ||||
-rw-r--r-- | fs/cifs/misc.c | 74 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 11 | ||||
-rw-r--r-- | fs/cifs/smb2misc.c | 18 | ||||
-rw-r--r-- | fs/cifs/smb2ops.c | 14 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 2 | ||||
-rw-r--r-- | fs/coredump.c | 7 | ||||
-rw-r--r-- | fs/kernfs/inode.c | 14 | ||||
-rw-r--r-- | fs/super.c | 5 | ||||
-rw-r--r-- | fs/sysfs/file.c | 92 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c | 51 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 17 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 20 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 53 | ||||
-rw-r--r-- | fs/xfs/xfs_trace.h | 1 | ||||
-rw-r--r-- | include/asm-generic/pgtable.h | 31 | ||||
-rw-r--r-- | include/drm/drm_crtc_helper.h | 6 | ||||
-rw-r--r-- | include/drm/drm_dp_helper.h | 4 | ||||
-rw-r--r-- | include/linux/device.h | 11 | ||||
-rw-r--r-- | include/linux/filter.h | 1 | ||||
-rw-r--r-- | include/linux/hyperv.h | 4 | ||||
-rw-r--r-- | include/linux/ipmi.h | 2 | ||||
-rw-r--r-- | include/linux/ipmi_smi.h | 11 | ||||
-rw-r--r-- | include/linux/mdio-gpio.h | 5 | ||||
-rw-r--r-- | include/linux/mfd/tps65090.h | 14 | ||||
-rw-r--r-- | include/linux/mlx5/device.h | 1 | ||||
-rw-r--r-- | include/linux/mlx5/qp.h | 1 | ||||
-rw-r--r-- | include/linux/mtd/spear_smi.h | 2 | ||||
-rw-r--r-- | include/linux/netfilter/nf_conntrack_proto_gre.h | 1 | ||||
-rw-r--r-- | include/linux/of.h | 5 | ||||
-rw-r--r-- | include/linux/phy.h | 3 | ||||
-rw-r--r-- | include/linux/reboot.h | 14 | ||||
-rw-r--r-- | include/linux/sysfs.h | 9 | ||||
-rw-r--r-- | include/linux/wait.h | 14 | ||||
-rw-r--r-- | include/net/dst.h | 14 | ||||
-rw-r--r-- | include/net/flow.h | 10 | ||||
-rw-r--r-- | include/net/inet6_connection_sock.h | 2 | ||||
-rw-r--r-- | include/net/inet_connection_sock.h | 2 | ||||
-rw-r--r-- | include/net/ip.h | 13 | ||||
-rw-r--r-- | include/net/ip6_route.h | 5 | ||||
-rw-r--r-- | include/net/ip_tunnels.h | 2 | ||||
-rw-r--r-- | include/net/ipv6.h | 2 | ||||
-rw-r--r-- | include/net/net_namespace.h | 9 | ||||
-rw-r--r-- | include/net/netfilter/nf_tables_core.h | 10 | ||||
-rw-r--r-- | include/net/sctp/structs.h | 18 | ||||
-rw-r--r-- | include/net/xfrm.h | 6 | ||||
-rw-r--r-- | include/uapi/drm/tegra_drm.h | 1 | ||||
-rw-r--r-- | include/uapi/linux/hyperv.h | 1 | ||||
-rw-r--r-- | init/Kconfig | 24 | ||||
-rw-r--r-- | kernel/locking/mutex-debug.c | 19 | ||||
-rw-r--r-- | kernel/sched/deadline.c | 11 | ||||
-rw-r--r-- | kernel/sched/fair.c | 16 | ||||
-rw-r--r-- | kernel/sched/rt.c | 7 | ||||
-rw-r--r-- | kernel/sched/sched.h | 9 | ||||
-rw-r--r-- | kernel/seccomp.c | 19 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 2 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 5 | ||||
-rw-r--r-- | kernel/trace/trace_functions.c | 16 | ||||
-rw-r--r-- | kernel/trace/trace_uprobe.c | 6 | ||||
-rw-r--r-- | kernel/user_namespace.c | 11 | ||||
-rw-r--r-- | kernel/watchdog.c | 6 | ||||
-rw-r--r-- | lib/Kconfig.debug | 3 | ||||
-rw-r--r-- | mm/filemap.c | 1 | ||||
-rw-r--r-- | mm/huge_memory.c | 13 | ||||
-rw-r--r-- | mm/hugetlb.c | 1 | ||||
-rw-r--r-- | mm/vmscan.c | 2 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 46 | ||||
-rw-r--r-- | net/core/dev.c | 3 | ||||
-rw-r--r-- | net/core/dst.c | 15 | ||||
-rw-r--r-- | net/core/filter.c | 9 | ||||
-rw-r--r-- | net/dccp/output.c | 2 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 16 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 1 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 16 | ||||
-rw-r--r-- | net/ipv4/ip_tunnel.c | 17 | ||||
-rw-r--r-- | net/ipv4/ip_tunnel_core.c | 4 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_rpfilter.c | 5 | ||||
-rw-r--r-- | net/ipv4/ping.c | 15 | ||||
-rw-r--r-- | net/ipv4/route.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 2 | ||||
-rw-r--r-- | net/ipv4/xfrm4_output.c | 2 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 3 | ||||
-rw-r--r-- | net/ipv6/ip6_gre.c | 10 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 8 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 2 | ||||
-rw-r--r-- | net/ipv6/route.c | 19 | ||||
-rw-r--r-- | net/ipv6/sit.c | 22 | ||||
-rw-r--r-- | net/ipv6/xfrm6_output.c | 2 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.c | 4 | ||||
-rw-r--r-- | net/l2tp/l2tp_ip.c | 2 | ||||
-rw-r--r-- | net/mac80211/chan.c | 11 | ||||
-rw-r--r-- | net/mac80211/main.c | 4 | ||||
-rw-r--r-- | net/mac80211/offchannel.c | 1 | ||||
-rw-r--r-- | net/mac80211/status.c | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_pptp.c | 20 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_gre.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_tables_core.c | 3 | ||||
-rw-r--r-- | net/netfilter/nft_cmp.c | 2 | ||||
-rw-r--r-- | net/openvswitch/vport-gre.c | 2 | ||||
-rw-r--r-- | net/sctp/associola.c | 82 | ||||
-rw-r--r-- | net/sctp/auth.c | 17 | ||||
-rw-r--r-- | net/sctp/endpointola.c | 3 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 32 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 8 | ||||
-rw-r--r-- | net/sctp/socket.c | 60 | ||||
-rw-r--r-- | net/sctp/sysctl.c | 36 | ||||
-rw-r--r-- | net/sctp/ulpevent.c | 8 | ||||
-rw-r--r-- | net/socket.c | 4 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 10 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 5 | ||||
-rw-r--r-- | tools/hv/hv_fcopy_daemon.c | 4 | ||||
-rw-r--r-- | tools/lib/lockdep/Makefile | 15 | ||||
-rw-r--r-- | tools/lib/lockdep/uinclude/linux/lockdep.h | 3 | ||||
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 109 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-bench.txt | 22 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 1 | ||||
-rw-r--r-- | tools/perf/Makefile.perf | 4 | ||||
-rw-r--r-- | tools/perf/bench/numa.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-kvm.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 11 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 7 | ||||
-rw-r--r-- | tools/perf/tests/code-reading.c | 1 | ||||
-rw-r--r-- | tools/perf/util/data.c | 9 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 15 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 2 | ||||
-rw-r--r-- | virt/kvm/ioapic.c | 25 |
955 files changed, 9125 insertions, 27671 deletions
@@ -99,6 +99,7 @@ Sachin P Sant <ssant@in.ibm.com> | |||
99 | Sam Ravnborg <sam@mars.ravnborg.org> | 99 | Sam Ravnborg <sam@mars.ravnborg.org> |
100 | Sascha Hauer <s.hauer@pengutronix.de> | 100 | Sascha Hauer <s.hauer@pengutronix.de> |
101 | S.Çağlar Onur <caglar@pardus.org.tr> | 101 | S.Çağlar Onur <caglar@pardus.org.tr> |
102 | Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com> | ||
102 | Simon Kelley <simon@thekelleys.org.uk> | 103 | Simon Kelley <simon@thekelleys.org.uk> |
103 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> | 104 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> |
104 | Stephen Hemminger <shemminger@osdl.org> | 105 | Stephen Hemminger <shemminger@osdl.org> |
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index f5170082bdb3..cc63f30de166 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl | |||
@@ -276,7 +276,7 @@ X!Isound/sound_firmware.c | |||
276 | </para> | 276 | </para> |
277 | 277 | ||
278 | <sect1><title>Frame Buffer Memory</title> | 278 | <sect1><title>Frame Buffer Memory</title> |
279 | !Edrivers/video/fbmem.c | 279 | !Edrivers/video/fbdev/core/fbmem.c |
280 | </sect1> | 280 | </sect1> |
281 | <!-- | 281 | <!-- |
282 | <sect1><title>Frame Buffer Console</title> | 282 | <sect1><title>Frame Buffer Console</title> |
@@ -284,7 +284,7 @@ X!Edrivers/video/console/fbcon.c | |||
284 | </sect1> | 284 | </sect1> |
285 | --> | 285 | --> |
286 | <sect1><title>Frame Buffer Colormap</title> | 286 | <sect1><title>Frame Buffer Colormap</title> |
287 | !Edrivers/video/fbcmap.c | 287 | !Edrivers/video/fbdev/core/fbcmap.c |
288 | </sect1> | 288 | </sect1> |
289 | <!-- FIXME: | 289 | <!-- FIXME: |
290 | drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment | 290 | drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment |
@@ -294,11 +294,11 @@ X!Idrivers/video/fbgen.c | |||
294 | </sect1> | 294 | </sect1> |
295 | KAO --> | 295 | KAO --> |
296 | <sect1><title>Frame Buffer Video Mode Database</title> | 296 | <sect1><title>Frame Buffer Video Mode Database</title> |
297 | !Idrivers/video/modedb.c | 297 | !Idrivers/video/fbdev/core/modedb.c |
298 | !Edrivers/video/modedb.c | 298 | !Edrivers/video/fbdev/core/modedb.c |
299 | </sect1> | 299 | </sect1> |
300 | <sect1><title>Frame Buffer Macintosh Video Mode Database</title> | 300 | <sect1><title>Frame Buffer Macintosh Video Mode Database</title> |
301 | !Edrivers/video/macmodes.c | 301 | !Edrivers/video/fbdev/macmodes.c |
302 | </sect1> | 302 | </sect1> |
303 | <sect1><title>Frame Buffer Fonts</title> | 303 | <sect1><title>Frame Buffer Fonts</title> |
304 | <para> | 304 | <para> |
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 702c4474919c..677a02553ec0 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -2287,6 +2287,11 @@ void intel_crt_init(struct drm_device *dev) | |||
2287 | !Edrivers/gpu/drm/drm_crtc_helper.c | 2287 | !Edrivers/gpu/drm/drm_crtc_helper.c |
2288 | </sect2> | 2288 | </sect2> |
2289 | <sect2> | 2289 | <sect2> |
2290 | <title>Output Probing Helper Functions Reference</title> | ||
2291 | !Pdrivers/gpu/drm/drm_probe_helper.c output probing helper overview | ||
2292 | !Edrivers/gpu/drm/drm_probe_helper.c | ||
2293 | </sect2> | ||
2294 | <sect2> | ||
2290 | <title>fbdev Helper Functions Reference</title> | 2295 | <title>fbdev Helper Functions Reference</title> |
2291 | !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers | 2296 | !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers |
2292 | !Edrivers/gpu/drm/drm_fb_helper.c | 2297 | !Edrivers/gpu/drm/drm_fb_helper.c |
diff --git a/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt b/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt new file mode 100644 index 000000000000..925ecbf6e7b7 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt | |||
@@ -0,0 +1,97 @@ | |||
1 | Marvell Kirkwood SoC Family Device Tree Bindings | ||
2 | ------------------------------------------------ | ||
3 | |||
4 | Boards with a SoC of the Marvell Kirkwook family, eg 88f6281 | ||
5 | |||
6 | * Required root node properties: | ||
7 | compatible: must contain "marvell,kirkwood" | ||
8 | |||
9 | In addition, the above compatible shall be extended with the specific | ||
10 | SoC. Currently known SoC compatibles are: | ||
11 | |||
12 | "marvell,kirkwood-88f6192" | ||
13 | "marvell,kirkwood-88f6281" | ||
14 | "marvell,kirkwood-88f6282" | ||
15 | "marvell,kirkwood-88f6283" | ||
16 | "marvell,kirkwood-88f6702" | ||
17 | "marvell,kirkwood-98DX4122" | ||
18 | |||
19 | And in addition, the compatible shall be extended with the specific | ||
20 | board. Currently known boards are: | ||
21 | |||
22 | "buffalo,lschlv2" | ||
23 | "buffalo,lsxhl" | ||
24 | "buffalo,lsxl" | ||
25 | "dlink,dns-320" | ||
26 | "dlink,dns-320-a1" | ||
27 | "dlink,dns-325" | ||
28 | "dlink,dns-325-a1" | ||
29 | "dlink,dns-kirkwood" | ||
30 | "excito,b3" | ||
31 | "globalscale,dreamplug-003-ds2001" | ||
32 | "globalscale,guruplug" | ||
33 | "globalscale,guruplug-server-plus" | ||
34 | "globalscale,sheevaplug" | ||
35 | "globalscale,sheevaplug" | ||
36 | "globalscale,sheevaplug-esata" | ||
37 | "globalscale,sheevaplug-esata-rev13" | ||
38 | "iom,iconnect" | ||
39 | "iom,iconnect-1.1" | ||
40 | "iom,ix2-200" | ||
41 | "keymile,km_kirkwood" | ||
42 | "lacie,cloudbox" | ||
43 | "lacie,inetspace_v2" | ||
44 | "lacie,laplug" | ||
45 | "lacie,netspace_lite_v2" | ||
46 | "lacie,netspace_max_v2" | ||
47 | "lacie,netspace_mini_v2" | ||
48 | "lacie,netspace_v2" | ||
49 | "marvell,db-88f6281-bp" | ||
50 | "marvell,db-88f6282-bp" | ||
51 | "marvell,mv88f6281gtw-ge" | ||
52 | "marvell,rd88f6281" | ||
53 | "marvell,rd88f6281" | ||
54 | "marvell,rd88f6281-a0" | ||
55 | "marvell,rd88f6281-a1" | ||
56 | "mpl,cec4" | ||
57 | "mpl,cec4-10" | ||
58 | "netgear,readynas" | ||
59 | "netgear,readynas" | ||
60 | "netgear,readynas-duo-v2" | ||
61 | "netgear,readynas-nv+-v2" | ||
62 | "plathome,openblocks-a6" | ||
63 | "plathome,openblocks-a7" | ||
64 | "raidsonic,ib-nas6210" | ||
65 | "raidsonic,ib-nas6210-b" | ||
66 | "raidsonic,ib-nas6220" | ||
67 | "raidsonic,ib-nas6220-b" | ||
68 | "raidsonic,ib-nas62x0" | ||
69 | "seagate,dockstar" | ||
70 | "seagate,goflexnet" | ||
71 | "synology,ds109" | ||
72 | "synology,ds110jv10" | ||
73 | "synology,ds110jv20" | ||
74 | "synology,ds110jv30" | ||
75 | "synology,ds111" | ||
76 | "synology,ds209" | ||
77 | "synology,ds210jv10" | ||
78 | "synology,ds210jv20" | ||
79 | "synology,ds212" | ||
80 | "synology,ds212jv10" | ||
81 | "synology,ds212jv20" | ||
82 | "synology,ds212pv10" | ||
83 | "synology,ds409" | ||
84 | "synology,ds409slim" | ||
85 | "synology,ds410j" | ||
86 | "synology,ds411" | ||
87 | "synology,ds411j" | ||
88 | "synology,ds411slim" | ||
89 | "synology,ds413jv10" | ||
90 | "synology,rs212" | ||
91 | "synology,rs409" | ||
92 | "synology,rs411" | ||
93 | "synology,rs812" | ||
94 | "usi,topkick" | ||
95 | "usi,topkick-1281P2" | ||
96 | "zyxel,nsa310" | ||
97 | "zyxel,nsa310a" | ||
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt index 71724d026ffa..bef86e57c388 100644 --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt | |||
@@ -13,8 +13,22 @@ ad,ad7414 SMBus/I2C Digital Temperature Sensor in 6-Pin SOT with SMBus Alert an | |||
13 | ad,adm9240 ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems | 13 | ad,adm9240 ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems |
14 | adi,adt7461 +/-1C TDM Extended Temp Range I.C | 14 | adi,adt7461 +/-1C TDM Extended Temp Range I.C |
15 | adt7461 +/-1C TDM Extended Temp Range I.C | 15 | adt7461 +/-1C TDM Extended Temp Range I.C |
16 | adi,adt7473 +/-1C TDM Extended Temp Range I.C | ||
17 | adi,adt7475 +/-1C TDM Extended Temp Range I.C | ||
18 | adi,adt7476 +/-1C TDM Extended Temp Range I.C | ||
19 | adi,adt7490 +/-1C TDM Extended Temp Range I.C | ||
16 | at,24c08 i2c serial eeprom (24cxx) | 20 | at,24c08 i2c serial eeprom (24cxx) |
21 | atmel,24c00 i2c serial eeprom (24cxx) | ||
22 | atmel,24c01 i2c serial eeprom (24cxx) | ||
17 | atmel,24c02 i2c serial eeprom (24cxx) | 23 | atmel,24c02 i2c serial eeprom (24cxx) |
24 | atmel,24c04 i2c serial eeprom (24cxx) | ||
25 | atmel,24c16 i2c serial eeprom (24cxx) | ||
26 | atmel,24c32 i2c serial eeprom (24cxx) | ||
27 | atmel,24c64 i2c serial eeprom (24cxx) | ||
28 | atmel,24c128 i2c serial eeprom (24cxx) | ||
29 | atmel,24c256 i2c serial eeprom (24cxx) | ||
30 | atmel,24c512 i2c serial eeprom (24cxx) | ||
31 | atmel,24c1024 i2c serial eeprom (24cxx) | ||
18 | atmel,at97sc3204t i2c trusted platform module (TPM) | 32 | atmel,at97sc3204t i2c trusted platform module (TPM) |
19 | capella,cm32181 CM32181: Ambient Light Sensor | 33 | capella,cm32181 CM32181: Ambient Light Sensor |
20 | catalyst,24c32 i2c serial eeprom | 34 | catalyst,24c32 i2c serial eeprom |
@@ -46,8 +60,10 @@ maxim,ds1050 5 Bit Programmable, Pulse-Width Modulator | |||
46 | maxim,max1237 Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs | 60 | maxim,max1237 Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs |
47 | maxim,max6625 9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface | 61 | maxim,max6625 9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface |
48 | mc,rv3029c2 Real Time Clock Module with I2C-Bus | 62 | mc,rv3029c2 Real Time Clock Module with I2C-Bus |
63 | national,lm63 Temperature sensor with integrated fan control | ||
49 | national,lm75 I2C TEMP SENSOR | 64 | national,lm75 I2C TEMP SENSOR |
50 | national,lm80 Serial Interface ACPI-Compatible Microprocessor System Hardware Monitor | 65 | national,lm80 Serial Interface ACPI-Compatible Microprocessor System Hardware Monitor |
66 | national,lm85 Temperature sensor with integrated fan control | ||
51 | national,lm92 ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface | 67 | national,lm92 ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface |
52 | nuvoton,npct501 i2c trusted platform module (TPM) | 68 | nuvoton,npct501 i2c trusted platform module (TPM) |
53 | nxp,pca9556 Octal SMBus and I2C registered interface | 69 | nxp,pca9556 Octal SMBus and I2C registered interface |
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index 9ecd43d8792c..3fc360523bc9 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt | |||
@@ -10,7 +10,7 @@ The following properties are common to the Ethernet controllers: | |||
10 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than | 10 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than |
11 | the maximum frame size (there's contradiction in ePAPR). | 11 | the maximum frame size (there's contradiction in ePAPR). |
12 | - phy-mode: string, operation mode of the PHY interface; supported values are | 12 | - phy-mode: string, operation mode of the PHY interface; supported values are |
13 | "mii", "gmii", "sgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", | 13 | "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", |
14 | "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto | 14 | "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto |
15 | standard property; | 15 | standard property; |
16 | - phy-connection-type: the same as "phy-mode" property but described in ePAPR; | 16 | - phy-connection-type: the same as "phy-mode" property but described in ePAPR; |
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt index c119debe6bab..67a5db95f189 100644 --- a/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt | |||
@@ -119,7 +119,7 @@ Optional Properties (for HDMI pins): | |||
119 | Example: | 119 | Example: |
120 | // pin controller node | 120 | // pin controller node |
121 | pinctrl@35004800 { | 121 | pinctrl@35004800 { |
122 | compatible = "brcmbcm11351-pinctrl"; | 122 | compatible = "brcm,bcm11351-pinctrl"; |
123 | reg = <0x35004800 0x430>; | 123 | reg = <0x35004800 0x430>; |
124 | 124 | ||
125 | // pin configuration node | 125 | // pin configuration node |
diff --git a/Documentation/devicetree/bindings/serial/efm32-uart.txt b/Documentation/devicetree/bindings/serial/efm32-uart.txt index 1984bdfbd545..3ca01336b837 100644 --- a/Documentation/devicetree/bindings/serial/efm32-uart.txt +++ b/Documentation/devicetree/bindings/serial/efm32-uart.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | * Energymicro efm32 UART | 1 | * Energymicro efm32 UART |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : Should be "efm32,uart" | 4 | - compatible : Should be "energymicro,efm32-uart" |
5 | - reg : Address and length of the register set | 5 | - reg : Address and length of the register set |
6 | - interrupts : Should contain uart interrupt | 6 | - interrupts : Should contain uart interrupt |
7 | 7 | ||
@@ -13,7 +13,7 @@ Optional properties: | |||
13 | Example: | 13 | Example: |
14 | 14 | ||
15 | uart@0x4000c400 { | 15 | uart@0x4000c400 { |
16 | compatible = "efm32,uart"; | 16 | compatible = "energymicro,efm32-uart"; |
17 | reg = <0x4000c400 0x400>; | 17 | reg = <0x4000c400 0x400>; |
18 | interrupts = <15>; | 18 | interrupts = <15>; |
19 | efm32,location = <0>; | 19 | efm32,location = <0>; |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 0f01c9bf19c8..abc308083acb 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -22,6 +22,7 @@ auo AU Optronics Corporation | |||
22 | avago Avago Technologies | 22 | avago Avago Technologies |
23 | bosch Bosch Sensortec GmbH | 23 | bosch Bosch Sensortec GmbH |
24 | brcm Broadcom Corporation | 24 | brcm Broadcom Corporation |
25 | buffalo Buffalo, Inc. | ||
25 | calxeda Calxeda | 26 | calxeda Calxeda |
26 | capella Capella Microsystems, Inc | 27 | capella Capella Microsystems, Inc |
27 | cavium Cavium, Inc. | 28 | cavium Cavium, Inc. |
@@ -33,15 +34,18 @@ cortina Cortina Systems, Inc. | |||
33 | crystalfontz Crystalfontz America, Inc. | 34 | crystalfontz Crystalfontz America, Inc. |
34 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) | 35 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) |
35 | davicom DAVICOM Semiconductor, Inc. | 36 | davicom DAVICOM Semiconductor, Inc. |
36 | dlink D-Link Systems, Inc. | ||
37 | denx Denx Software Engineering | 37 | denx Denx Software Engineering |
38 | digi Digi International Inc. | ||
39 | dlink D-Link Corporation | ||
38 | dmo Data Modul AG | 40 | dmo Data Modul AG |
41 | ebv EBV Elektronik | ||
39 | edt Emerging Display Technologies | 42 | edt Emerging Display Technologies |
40 | emmicro EM Microelectronic | 43 | emmicro EM Microelectronic |
41 | epfl Ecole Polytechnique Fédérale de Lausanne | 44 | epfl Ecole Polytechnique Fédérale de Lausanne |
42 | epson Seiko Epson Corp. | 45 | epson Seiko Epson Corp. |
43 | est ESTeem Wireless Modems | 46 | est ESTeem Wireless Modems |
44 | eukrea Eukréa Electromatique | 47 | eukrea Eukréa Electromatique |
48 | excito Excito | ||
45 | fsl Freescale Semiconductor | 49 | fsl Freescale Semiconductor |
46 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 50 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. |
47 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 51 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. |
@@ -53,13 +57,17 @@ haoyu Haoyu Microelectronic Co. Ltd. | |||
53 | hisilicon Hisilicon Limited. | 57 | hisilicon Hisilicon Limited. |
54 | honeywell Honeywell | 58 | honeywell Honeywell |
55 | hp Hewlett Packard | 59 | hp Hewlett Packard |
60 | i2se I2SE GmbH | ||
56 | ibm International Business Machines (IBM) | 61 | ibm International Business Machines (IBM) |
57 | idt Integrated Device Technologies, Inc. | 62 | idt Integrated Device Technologies, Inc. |
63 | iom Iomega Corporation | ||
58 | img Imagination Technologies Ltd. | 64 | img Imagination Technologies Ltd. |
59 | intel Intel Corporation | 65 | intel Intel Corporation |
60 | intercontrol Inter Control Group | 66 | intercontrol Inter Control Group |
67 | isee ISEE 2007 S.L. | ||
61 | isl Intersil | 68 | isl Intersil |
62 | karo Ka-Ro electronics GmbH | 69 | karo Ka-Ro electronics GmbH |
70 | keymile Keymile GmbH | ||
63 | lacie LaCie | 71 | lacie LaCie |
64 | lantiq Lantiq Semiconductor | 72 | lantiq Lantiq Semiconductor |
65 | lg LG Corporation | 73 | lg LG Corporation |
@@ -70,9 +78,12 @@ maxim Maxim Integrated Products | |||
70 | microchip Microchip Technology Inc. | 78 | microchip Microchip Technology Inc. |
71 | mosaixtech Mosaix Technologies, Inc. | 79 | mosaixtech Mosaix Technologies, Inc. |
72 | moxa Moxa | 80 | moxa Moxa |
81 | mpl MPL AG | ||
82 | mxicy Macronix International Co., Ltd. | ||
73 | national National Semiconductor | 83 | national National Semiconductor |
74 | neonode Neonode Inc. | 84 | neonode Neonode Inc. |
75 | netgear NETGEAR | 85 | netgear NETGEAR |
86 | newhaven Newhaven Display International | ||
76 | nintendo Nintendo | 87 | nintendo Nintendo |
77 | nokia Nokia | 88 | nokia Nokia |
78 | nvidia NVIDIA | 89 | nvidia NVIDIA |
@@ -82,10 +93,12 @@ opencores OpenCores.org | |||
82 | panasonic Panasonic Corporation | 93 | panasonic Panasonic Corporation |
83 | phytec PHYTEC Messtechnik GmbH | 94 | phytec PHYTEC Messtechnik GmbH |
84 | picochip Picochip Ltd | 95 | picochip Picochip Ltd |
96 | plathome Plat'Home Co., Ltd. | ||
85 | powervr PowerVR (deprecated, use img) | 97 | powervr PowerVR (deprecated, use img) |
86 | qca Qualcomm Atheros, Inc. | 98 | qca Qualcomm Atheros, Inc. |
87 | qcom Qualcomm Technologies, Inc | 99 | qcom Qualcomm Technologies, Inc |
88 | qnap QNAP Systems, Inc. | 100 | qnap QNAP Systems, Inc. |
101 | raidsonic RaidSonic Technology GmbH | ||
89 | ralink Mediatek/Ralink Technology Corp. | 102 | ralink Mediatek/Ralink Technology Corp. |
90 | ramtron Ramtron International | 103 | ramtron Ramtron International |
91 | realtek Realtek Semiconductor Corp. | 104 | realtek Realtek Semiconductor Corp. |
@@ -95,6 +108,7 @@ rockchip Fuzhou Rockchip Electronics Co., Ltd | |||
95 | samsung Samsung Semiconductor | 108 | samsung Samsung Semiconductor |
96 | sbs Smart Battery System | 109 | sbs Smart Battery System |
97 | schindler Schindler | 110 | schindler Schindler |
111 | seagate Seagate Technology PLC | ||
98 | sil Silicon Image | 112 | sil Silicon Image |
99 | silabs Silicon Laboratories | 113 | silabs Silicon Laboratories |
100 | simtek | 114 | simtek |
@@ -111,6 +125,7 @@ ti Texas Instruments | |||
111 | tlm Trusted Logic Mobility | 125 | tlm Trusted Logic Mobility |
112 | toshiba Toshiba Corporation | 126 | toshiba Toshiba Corporation |
113 | toumaz Toumaz | 127 | toumaz Toumaz |
128 | usi Universal Scientifc Industrial Co., Ltd. | ||
114 | v3 V3 Semiconductor | 129 | v3 V3 Semiconductor |
115 | via VIA Technologies, Inc. | 130 | via VIA Technologies, Inc. |
116 | voipac Voipac Technologies s.r.o. | 131 | voipac Voipac Technologies s.r.o. |
@@ -119,3 +134,4 @@ wlf Wolfson Microelectronics | |||
119 | wm Wondermedia Technologies, Inc. | 134 | wm Wondermedia Technologies, Inc. |
120 | xes Extreme Engineering Solutions (X-ES) | 135 | xes Extreme Engineering Solutions (X-ES) |
121 | xlnx Xilinx | 136 | xlnx Xilinx |
137 | zyxel ZyXEL Communications Corp. | ||
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index 0091a8215ac1..b61885c35ce1 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO | |||
@@ -315,7 +315,7 @@ Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã | |||
315 | ã‚‚ã—ã€3.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 3.x ㌠| 315 | ã‚‚ã—ã€3.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 3.x ㌠|
316 | 最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ | 316 | 最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ |
317 | 317 | ||
318 | 3.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€å¿… | 318 | 3.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@vger.kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•れã¦ãŠã‚Šã€å¿… |
319 | è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—迫㣠| 319 | è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•れã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—迫㣠|
320 | ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ã‚»ã‚ュリティ関連ã®å•題 | 320 | ãŸå•題ãŒãªã‘れã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚りã¾ã™ã€‚ã‚»ã‚ュリティ関連ã®å•題 |
321 | ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚ | 321 | ã®å ´åˆã¯ã“れã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•れã¾ã™ã€‚ |
diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt index 14265837c4ce..9dbda9b5d21e 100644 --- a/Documentation/ja_JP/stable_kernel_rules.txt +++ b/Documentation/ja_JP/stable_kernel_rules.txt | |||
@@ -50,16 +50,16 @@ linux-2.6.29/Documentation/stable_kernel_rules.txt | |||
50 | 50 | ||
51 | -stable ツリーã«ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹æ‰‹ç¶šã- | 51 | -stable ツリーã«ãƒ‘ッãƒã‚’é€ä»˜ã™ã‚‹æ‰‹ç¶šã- |
52 | 52 | ||
53 | - 上記ã®è¦å‰‡ã«å¾“ã£ã¦ã„ã‚‹ã‹ã‚’確èªã—ãŸå¾Œã«ã€stable@kernel.org ã«ãƒ‘ッム| 53 | - 上記ã®è¦å‰‡ã«å¾“ã£ã¦ã„ã‚‹ã‹ã‚’確èªã—ãŸå¾Œã«ã€stable@vger.kernel.org ã«ãƒ‘ッム|
54 | ã‚’é€ã‚‹ã€‚ | 54 | ã‚’é€ã‚‹ã€‚ |
55 | - é€ä¿¡è€…ã¯ãƒ‘ッãƒãŒã‚ューã«å—ã‘付ã‘られãŸéš›ã«ã¯ ACK ã‚’ã€å´ä¸‹ã•れãŸå ´åˆ | 55 | - é€ä¿¡è€…ã¯ãƒ‘ッãƒãŒã‚ューã«å—ã‘付ã‘られãŸéš›ã«ã¯ ACK ã‚’ã€å´ä¸‹ã•れãŸå ´åˆ |
56 | ã«ã¯ NAK ã‚’å—ã‘å–る。ã“ã®å応ã¯é–‹ç™ºè€…ãŸã¡ã®ã‚¹ã‚±ã‚¸ãƒ¥ãƒ¼ãƒ«ã«ã‚ˆã£ã¦ã€æ•° | 56 | ã«ã¯ NAK ã‚’å—ã‘å–る。ã“ã®å応ã¯é–‹ç™ºè€…ãŸã¡ã®ã‚¹ã‚±ã‚¸ãƒ¥ãƒ¼ãƒ«ã«ã‚ˆã£ã¦ã€æ•° |
57 | æ—¥ã‹ã‹ã‚‹å ´åˆãŒã‚る。 | 57 | æ—¥ã‹ã‹ã‚‹å ´åˆãŒã‚る。 |
58 | - ã‚‚ã—å—ã‘å–られãŸã‚‰ã€ãƒ‘ッãƒã¯ä»–ã®é–‹ç™ºè€…ãŸã¡ã¨é–¢é€£ã™ã‚‹ã‚µãƒ–システム㮠| 58 | - ã‚‚ã—å—ã‘å–られãŸã‚‰ã€ãƒ‘ッãƒã¯ä»–ã®é–‹ç™ºè€…ãŸã¡ã¨é–¢é€£ã™ã‚‹ã‚µãƒ–システム㮠|
59 | メンテナーã«ã‚ˆã‚‹ãƒ¬ãƒ“ューã®ãŸã‚ã« -stable ã‚ューã«è¿½åŠ ã•れる。 | 59 | メンテナーã«ã‚ˆã‚‹ãƒ¬ãƒ“ューã®ãŸã‚ã« -stable ã‚ューã«è¿½åŠ ã•れる。 |
60 | - パッãƒã« stable@kernel.org ã®ã‚¢ãƒ‰ãƒ¬ã‚¹ãŒä»˜åŠ ã•れã¦ã„ã‚‹ã¨ãã«ã¯ã€ãれ | 60 | - パッãƒã« stable@vger.kernel.org ã®ã‚¢ãƒ‰ãƒ¬ã‚¹ãŒä»˜åŠ ã•れã¦ã„ã‚‹ã¨ãã«ã¯ã€ãれ |
61 | ㌠Linus ã®ãƒ„リーã«å…¥ã‚‹æ™‚ã«è‡ªå‹•的㫠stable ãƒãƒ¼ãƒ ã« email ã•れる。 | 61 | ㌠Linus ã®ãƒ„リーã«å…¥ã‚‹æ™‚ã«è‡ªå‹•的㫠stable ãƒãƒ¼ãƒ ã« email ã•れる。 |
62 | - ã‚»ã‚ュリティパッãƒã¯ã“ã®ã‚¨ã‚¤ãƒªã‚¢ã‚¹ (stable@kernel.org) ã«é€ã‚‰ã‚Œã‚‹ã¹ | 62 | - ã‚»ã‚ュリティパッãƒã¯ã“ã®ã‚¨ã‚¤ãƒªã‚¢ã‚¹ (stable@vger.kernel.org) ã«é€ã‚‰ã‚Œã‚‹ã¹ |
63 | ãã§ã¯ãªãã€ä»£ã‚り㫠security@kernel.org ã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã«é€ã‚‰ã‚Œã‚‹ã€‚ | 63 | ãã§ã¯ãªãã€ä»£ã‚り㫠security@kernel.org ã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã«é€ã‚‰ã‚Œã‚‹ã€‚ |
64 | 64 | ||
65 | レビューサイクル- | 65 | レビューサイクル- |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 03e50b4883a8..43842177b771 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -804,13 +804,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
804 | dhash_entries= [KNL] | 804 | dhash_entries= [KNL] |
805 | Set number of hash buckets for dentry cache. | 805 | Set number of hash buckets for dentry cache. |
806 | 806 | ||
807 | digi= [HW,SERIAL] | ||
808 | IO parameters + enable/disable command. | ||
809 | |||
810 | digiepca= [HW,SERIAL] | ||
811 | See drivers/char/README.epca and | ||
812 | Documentation/serial/digiepca.txt. | ||
813 | |||
814 | disable= [IPV6] | 807 | disable= [IPV6] |
815 | See Documentation/networking/ipv6.txt. | 808 | See Documentation/networking/ipv6.txt. |
816 | 809 | ||
@@ -2939,9 +2932,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
2939 | rhash_entries= [KNL,NET] | 2932 | rhash_entries= [KNL,NET] |
2940 | Set number of hash buckets for route cache | 2933 | Set number of hash buckets for route cache |
2941 | 2934 | ||
2942 | riscom8= [HW,SERIAL] | ||
2943 | Format: <io_board1>[,<io_board2>[,...<io_boardN>]] | ||
2944 | |||
2945 | ro [KNL] Mount root device read-only on boot | 2935 | ro [KNL] Mount root device read-only on boot |
2946 | 2936 | ||
2947 | root= [KNL] Root filesystem | 2937 | root= [KNL] Root filesystem |
@@ -3083,9 +3073,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3083 | sonypi.*= [HW] Sony Programmable I/O Control Device driver | 3073 | sonypi.*= [HW] Sony Programmable I/O Control Device driver |
3084 | See Documentation/laptops/sonypi.txt | 3074 | See Documentation/laptops/sonypi.txt |
3085 | 3075 | ||
3086 | specialix= [HW,SERIAL] Specialix multi-serial port adapter | ||
3087 | See Documentation/serial/specialix.txt. | ||
3088 | |||
3089 | spia_io_base= [HW,MTD] | 3076 | spia_io_base= [HW,MTD] |
3090 | spia_fio_base= | 3077 | spia_fio_base= |
3091 | spia_pedr= | 3078 | spia_pedr= |
diff --git a/Documentation/magic-number.txt b/Documentation/magic-number.txt index 76d80a64bbe1..4c8e142db2ef 100644 --- a/Documentation/magic-number.txt +++ b/Documentation/magic-number.txt | |||
@@ -63,8 +63,6 @@ Magic Name Number Structure File | |||
63 | PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h | 63 | PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h |
64 | CMAGIC 0x0111 user include/linux/a.out.h | 64 | CMAGIC 0x0111 user include/linux/a.out.h |
65 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h | 65 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h |
66 | RISCOM8_MAGIC 0x0907 riscom_port drivers/char/riscom8.h | ||
67 | SPECIALIX_MAGIC 0x0907 specialix_port drivers/char/specialix_io8.h | ||
68 | HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c | 66 | HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c |
69 | APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c | 67 | APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c |
70 | CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h | 68 | CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h |
@@ -82,7 +80,6 @@ STRIP_MAGIC 0x5303 strip drivers/net/strip.c | |||
82 | X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h | 80 | X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h |
83 | SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h | 81 | SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h |
84 | AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h | 82 | AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h |
85 | ESP_MAGIC 0x53ee esp_struct drivers/char/esp.h | ||
86 | TTY_MAGIC 0x5401 tty_struct include/linux/tty.h | 83 | TTY_MAGIC 0x5401 tty_struct include/linux/tty.h |
87 | MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c | 84 | MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c |
88 | TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h | 85 | TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h |
@@ -94,13 +91,10 @@ USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c | |||
94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c | 91 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c |
95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h | 92 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h |
96 | CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h | 93 | CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h |
97 | A2232_MAGIC 0x000a2232 gs_port drivers/char/ser_a2232.h | ||
98 | RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h | 94 | RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h |
99 | LSEMAGIC 0x05091998 lse drivers/fc4/fc.c | 95 | LSEMAGIC 0x05091998 lse drivers/fc4/fc.c |
100 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h | 96 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h |
101 | RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c | 97 | RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c |
102 | RIO_MAGIC 0x12345678 gs_port drivers/char/rio/rio_linux.c | ||
103 | SX_MAGIC 0x12345678 gs_port drivers/char/sx.h | ||
104 | NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h | 98 | NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h |
105 | RED_MAGIC2 0x170fc2a5 (any) mm/slab.c | 99 | RED_MAGIC2 0x170fc2a5 (any) mm/slab.c |
106 | BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c | 100 | BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c |
@@ -116,7 +110,6 @@ ISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.h | |||
116 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c | 110 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c |
117 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h | 111 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h |
118 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c | 112 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c |
119 | STLI_BOARDMAGIC 0x4bc6c825 stlibrd include/linux/istallion.h | ||
120 | CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c | 113 | CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c |
121 | SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c | 114 | SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c |
122 | COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c | 115 | COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c |
@@ -127,10 +120,8 @@ SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h | |||
127 | SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c | 120 | SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c |
128 | GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h | 121 | GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h |
129 | RED_MAGIC1 0x5a2cf071 (any) mm/slab.c | 122 | RED_MAGIC1 0x5a2cf071 (any) mm/slab.c |
130 | STL_PORTMAGIC 0x5a7182c9 stlport include/linux/stallion.h | ||
131 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c | 123 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c |
132 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h | 124 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h |
133 | EPCA_MAGIC 0x5c6df104 channel include/linux/epca.h | ||
134 | PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h | 125 | PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h |
135 | KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h | 126 | KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h |
136 | I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c | 127 | I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c |
@@ -142,17 +133,14 @@ SLOT_MAGIC 0x67267322 slot drivers/hotplug/acpiphp.h | |||
142 | LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h | 133 | LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h |
143 | OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h | 134 | OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h |
144 | M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c | 135 | M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c |
145 | STL_PANELMAGIC 0x7ef621a1 stlpanel include/linux/stallion.h | ||
146 | VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c | 136 | VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c |
147 | KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c | 137 | KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c |
148 | PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h | 138 | PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h |
149 | NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h | 139 | NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h |
150 | STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h | ||
151 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h | 140 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h |
152 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h | 141 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h |
153 | CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h | 142 | CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h |
154 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h | 143 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h |
155 | STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h | ||
156 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c | 144 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c |
157 | CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c | 145 | CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c |
158 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c | 146 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c |
diff --git a/Documentation/serial/00-INDEX b/Documentation/serial/00-INDEX index f9c6b5ed03e7..8021a9f29fc5 100644 --- a/Documentation/serial/00-INDEX +++ b/Documentation/serial/00-INDEX | |||
@@ -2,23 +2,15 @@ | |||
2 | - this file. | 2 | - this file. |
3 | README.cycladesZ | 3 | README.cycladesZ |
4 | - info on Cyclades-Z firmware loading. | 4 | - info on Cyclades-Z firmware loading. |
5 | digiepca.txt | ||
6 | - info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards. | ||
7 | driver | 5 | driver |
8 | - intro to the low level serial driver. | 6 | - intro to the low level serial driver. |
9 | moxa-smartio | 7 | moxa-smartio |
10 | - file with info on installing/using Moxa multiport serial driver. | 8 | - file with info on installing/using Moxa multiport serial driver. |
11 | n_gsm.txt | 9 | n_gsm.txt |
12 | - GSM 0710 tty multiplexer howto. | 10 | - GSM 0710 tty multiplexer howto. |
13 | riscom8.txt | ||
14 | - notes on using the RISCom/8 multi-port serial driver. | ||
15 | rocket.txt | 11 | rocket.txt |
16 | - info on the Comtrol RocketPort multiport serial driver. | 12 | - info on the Comtrol RocketPort multiport serial driver. |
17 | serial-rs485.txt | 13 | serial-rs485.txt |
18 | - info about RS485 structures and support in the kernel. | 14 | - info about RS485 structures and support in the kernel. |
19 | specialix.txt | ||
20 | - info on hardware/driver for specialix IO8+ multiport serial card. | ||
21 | sx.txt | ||
22 | - info on the Specialix SX/SI multiport serial driver. | ||
23 | tty.txt | 15 | tty.txt |
24 | - guide to the locking policies of the tty layer. | 16 | - guide to the locking policies of the tty layer. |
diff --git a/Documentation/serial/digiepca.txt b/Documentation/serial/digiepca.txt deleted file mode 100644 index f2560e22f2c9..000000000000 --- a/Documentation/serial/digiepca.txt +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | NOTE: This driver is obsolete. Digi provides a 2.6 driver (dgdm) at | ||
2 | http://www.digi.com for PCI cards. They no longer maintain this driver, | ||
3 | and have no 2.6 driver for ISA cards. | ||
4 | |||
5 | This driver requires a number of user-space tools. They can be acquired from | ||
6 | http://www.digi.com, but only works with 2.4 kernels. | ||
7 | |||
8 | |||
9 | The Digi Intl. epca driver. | ||
10 | ---------------------------- | ||
11 | The Digi Intl. epca driver for Linux supports the following boards: | ||
12 | |||
13 | Digi PC/Xem, PC/Xr, PC/Xe, PC/Xi, PC/Xeve | ||
14 | Digi EISA/Xem, PCI/Xem, PCI/Xr | ||
15 | |||
16 | Limitations: | ||
17 | ------------ | ||
18 | Currently the driver only autoprobes for supported PCI boards. | ||
19 | |||
20 | The Linux MAKEDEV command does not support generating the Digiboard | ||
21 | Devices. Users executing digiConfig to setup EISA and PC series cards | ||
22 | will have their device nodes automatically constructed (cud?? for ~CLOCAL, | ||
23 | and ttyD?? for CLOCAL). Users wishing to boot their board from the LILO | ||
24 | prompt, or those users booting PCI cards may use buildDIGI to construct | ||
25 | the necessary nodes. | ||
26 | |||
27 | Notes: | ||
28 | ------ | ||
29 | This driver may be configured via LILO. For users who have already configured | ||
30 | their driver using digiConfig, configuring from LILO will override previous | ||
31 | settings. Multiple boards may be configured by issuing multiple LILO command | ||
32 | lines. For examples see the bottom of this document. | ||
33 | |||
34 | Device names start at 0 and continue up. Beware of this as previous Digi | ||
35 | drivers started device names with 1. | ||
36 | |||
37 | PCI boards are auto-detected and configured by the driver. PCI boards will | ||
38 | be allocated device numbers (internally) beginning with the lowest PCI slot | ||
39 | first. In other words a PCI card in slot 3 will always have higher device | ||
40 | nodes than a PCI card in slot 1. | ||
41 | |||
42 | LILO config examples: | ||
43 | --------------------- | ||
44 | Using LILO's APPEND command, a string of comma separated identifiers or | ||
45 | integers can be used to configure supported boards. The six values in order | ||
46 | are: | ||
47 | |||
48 | Enable/Disable this card or Override, | ||
49 | Type of card: PC/Xe (AccelePort) (0), PC/Xeve (1), PC/Xem or PC/Xr (2), | ||
50 | EISA/Xem (3), PC/64Xe (4), PC/Xi (5), | ||
51 | Enable/Disable alternate pin arrangement, | ||
52 | Number of ports on this card, | ||
53 | I/O Port where card is configured (in HEX if using string identifiers), | ||
54 | Base of memory window (in HEX if using string identifiers), | ||
55 | |||
56 | NOTE : PCI boards are auto-detected and configured. Do not attempt to | ||
57 | configure PCI boards with the LILO append command. If you wish to override | ||
58 | previous configuration data (As set by digiConfig), but you do not wish to | ||
59 | configure any specific card (Example if there are PCI cards in the system) | ||
60 | the following override command will accomplish this: | ||
61 | -> append="digi=2" | ||
62 | |||
63 | Samples: | ||
64 | append="digiepca=E,PC/Xe,D,16,200,D0000" | ||
65 | or | ||
66 | append="digi=1,0,0,16,512,851968" | ||
67 | |||
68 | Supporting Tools: | ||
69 | ----------------- | ||
70 | Supporting tools include digiDload, digiConfig, buildPCI, and ditty. See | ||
71 | drivers/char/README.epca for more details. Note, | ||
72 | this driver REQUIRES that digiDload be executed prior to it being used. | ||
73 | Failure to do this will result in an ENODEV error. | ||
74 | |||
75 | Documentation: | ||
76 | -------------- | ||
77 | Complete documentation for this product may be found in the tool package. | ||
78 | |||
79 | Sources of information and support: | ||
80 | ----------------------------------- | ||
81 | Digi Intl. support site for this product: | ||
82 | |||
83 | -> http://www.digi.com | ||
84 | |||
85 | Acknowledgments: | ||
86 | ---------------- | ||
87 | Much of this work (And even text) was derived from a similar document | ||
88 | supporting the original public domain DigiBoard driver Copyright (C) | ||
89 | 1994,1995 Troy De Jongh. Many thanks to Christoph Lameter | ||
90 | (christoph@lameter.com) and Mike McLagan (mike.mclagan@linux.org) who authored | ||
91 | and contributed to the original document. | ||
92 | |||
93 | Changelog: | ||
94 | ---------- | ||
95 | 10-29-04: Update status of driver, remove dead links in document | ||
96 | James Nelson <james4765@gmail.com> | ||
97 | |||
98 | 2000 (?) Original Document | ||
diff --git a/Documentation/serial/riscom8.txt b/Documentation/serial/riscom8.txt deleted file mode 100644 index 14f61fdad7ca..000000000000 --- a/Documentation/serial/riscom8.txt +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | * NOTE - this is an unmaintained driver. The original author cannot be located. | ||
2 | |||
3 | SDL Communications is now SBS Technologies, and does not have any | ||
4 | information on these ancient ISA cards on their website. | ||
5 | |||
6 | James Nelson <james4765@gmail.com> - 12-12-2004 | ||
7 | |||
8 | This is the README for RISCom/8 multi-port serial driver | ||
9 | (C) 1994-1996 D.Gorodchanin | ||
10 | See file LICENSE for terms and conditions. | ||
11 | |||
12 | NOTE: English is not my native language. | ||
13 | I'm sorry for any mistakes in this text. | ||
14 | |||
15 | Misc. notes for RISCom/8 serial driver, in no particular order :) | ||
16 | |||
17 | 1) This driver can support up to 4 boards at time. | ||
18 | Use string "riscom8=0xXXX,0xXXX,0xXXX,0xXXX" at LILO prompt, for | ||
19 | setting I/O base addresses for boards. If you compile driver | ||
20 | as module use modprobe options "iobase=0xXXX iobase1=0xXXX iobase2=..." | ||
21 | |||
22 | 2) The driver partially supports famous 'setserial' program, you can use almost | ||
23 | any of its options, excluding port & irq settings. | ||
24 | |||
25 | 3) There are some misc. defines at the beginning of riscom8.c, please read the | ||
26 | comments and try to change some of them in case of problems. | ||
27 | |||
28 | 4) I consider the current state of the driver as BETA. | ||
29 | |||
30 | 5) SDL Communications WWW page is http://www.sdlcomm.com. | ||
31 | |||
32 | 6) You can use the MAKEDEV program to create RISCom/8 /dev/ttyL* entries. | ||
33 | |||
34 | 7) Minor numbers for first board are 0-7, for second 8-15, etc. | ||
35 | |||
36 | 22 Apr 1996. | ||
diff --git a/Documentation/serial/specialix.txt b/Documentation/serial/specialix.txt deleted file mode 100644 index 6eb6f3a3331c..000000000000 --- a/Documentation/serial/specialix.txt +++ /dev/null | |||
@@ -1,383 +0,0 @@ | |||
1 | |||
2 | specialix.txt -- specialix IO8+ multiport serial driver readme. | ||
3 | |||
4 | |||
5 | |||
6 | Copyright (C) 1997 Roger Wolff (R.E.Wolff@BitWizard.nl) | ||
7 | |||
8 | Specialix pays for the development and support of this driver. | ||
9 | Please DO contact io8-linux@specialix.co.uk if you require | ||
10 | support. | ||
11 | |||
12 | This driver was developed in the BitWizard linux device | ||
13 | driver service. If you require a linux device driver for your | ||
14 | product, please contact devices@BitWizard.nl for a quote. | ||
15 | |||
16 | This code is firmly based on the riscom/8 serial driver, | ||
17 | written by Dmitry Gorodchanin. The specialix IO8+ card | ||
18 | programming information was obtained from the CL-CD1865 Data | ||
19 | Book, and Specialix document number 6200059: IO8+ Hardware | ||
20 | Functional Specification, augmented by document number 6200088: | ||
21 | Merak Hardware Functional Specification. (IO8+/PCI is also | ||
22 | called Merak) | ||
23 | |||
24 | |||
25 | This program is free software; you can redistribute it and/or | ||
26 | modify it under the terms of the GNU General Public License as | ||
27 | published by the Free Software Foundation; either version 2 of | ||
28 | the License, or (at your option) any later version. | ||
29 | |||
30 | This program is distributed in the hope that it will be | ||
31 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
32 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
33 | PURPOSE. See the GNU General Public License for more details. | ||
34 | |||
35 | You should have received a copy of the GNU General Public | ||
36 | License along with this program; if not, write to the Free | ||
37 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | ||
38 | USA. | ||
39 | |||
40 | |||
41 | Intro | ||
42 | ===== | ||
43 | |||
44 | |||
45 | This file contains some random information, that I like to have online | ||
46 | instead of in a manual that can get lost. Ever misplace your Linux | ||
47 | kernel sources? And the manual of one of the boards in your computer? | ||
48 | |||
49 | |||
50 | Addresses and interrupts | ||
51 | ======================== | ||
52 | |||
53 | Address dip switch settings: | ||
54 | The dip switch sets bits 2-9 of the IO address. | ||
55 | |||
56 | 9 8 7 6 5 4 3 2 | ||
57 | +-----------------+ | ||
58 | 0 | X X X X X X X | | ||
59 | | | = IoBase = 0x100 | ||
60 | 1 | X | | ||
61 | +-----------------+ ------ RS232 connectors ----> | ||
62 | |||
63 | | | | | ||
64 | edge connector | ||
65 | | | | | ||
66 | V V V | ||
67 | |||
68 | Base address 0x100 caused a conflict in one of my computers once. I | ||
69 | haven't the foggiest why. My Specialix card is now at 0x180. My | ||
70 | other computer runs just fine with the Specialix card at 0x100.... | ||
71 | The card occupies 4 addresses, but actually only two are really used. | ||
72 | |||
73 | The PCI version doesn't have any dip switches. The BIOS assigns | ||
74 | an IO address. | ||
75 | |||
76 | The driver now still autoprobes at 0x100, 0x180, 0x250 and 0x260. If | ||
77 | that causes trouble for you, please report that. I'll remove | ||
78 | autoprobing then. | ||
79 | |||
80 | The driver will tell the card what IRQ to use, so you don't have to | ||
81 | change any jumpers to change the IRQ. Just use a command line | ||
82 | argument (irq=xx) to the insmod program to set the interrupt. | ||
83 | |||
84 | The BIOS assigns the IRQ on the PCI version. You have no say in what | ||
85 | IRQ to use in that case. | ||
86 | |||
87 | If your specialix cards are not at the default locations, you can use | ||
88 | the kernel command line argument "specialix=io0,irq0,io1,irq1...". | ||
89 | Here "io0" is the io address for the first card, and "irq0" is the | ||
90 | irq line that the first card should use. And so on. | ||
91 | |||
92 | Examples. | ||
93 | |||
94 | You use the driver as a module and have three cards at 0x100, 0x250 | ||
95 | and 0x180. And some way or another you want them detected in that | ||
96 | order. Moreover irq 12 is taken (e.g. by your PS/2 mouse). | ||
97 | |||
98 | insmod specialix.o iobase=0x100,0x250,0x180 irq=9,11,15 | ||
99 | |||
100 | The same three cards, but now in the kernel would require you to | ||
101 | add | ||
102 | |||
103 | specialix=0x100,9,0x250,11,0x180,15 | ||
104 | |||
105 | to the command line. This would become | ||
106 | |||
107 | append="specialix=0x100,9,0x250,11,0x180,15" | ||
108 | |||
109 | in your /etc/lilo.conf file if you use lilo. | ||
110 | |||
111 | The Specialix driver is slightly odd: It allows you to have the second | ||
112 | or third card detected without having a first card. This has | ||
113 | advantages and disadvantages. A slot that isn't filled by an ISA card, | ||
114 | might be filled if a PCI card is detected. Thus if you have an ISA | ||
115 | card at 0x250 and a PCI card, you would get: | ||
116 | |||
117 | sx0: specialix IO8+ Board at 0x100 not found. | ||
118 | sx1: specialix IO8+ Board at 0x180 not found. | ||
119 | sx2: specialix IO8+ board detected at 0x250, IRQ 12, CD1865 Rev. B. | ||
120 | sx3: specialix IO8+ Board at 0x260 not found. | ||
121 | sx0: specialix IO8+ board detected at 0xd800, IRQ 9, CD1865 Rev. B. | ||
122 | |||
123 | This would happen if you don't give any probe hints to the driver. | ||
124 | If you would specify: | ||
125 | |||
126 | specialix=0x250,11 | ||
127 | |||
128 | you'd get the following messages: | ||
129 | |||
130 | sx0: specialix IO8+ board detected at 0x250, IRQ 11, CD1865 Rev. B. | ||
131 | sx1: specialix IO8+ board detected at 0xd800, IRQ 9, CD1865 Rev. B. | ||
132 | |||
133 | ISA probing is aborted after the IO address you gave is exhausted, and | ||
134 | the PCI card is now detected as the second card. The ISA card is now | ||
135 | also forced to IRQ11.... | ||
136 | |||
137 | |||
138 | Baud rates | ||
139 | ========== | ||
140 | |||
141 | The rev 1.2 and below boards use a CL-CD1864. These chips can only | ||
142 | do 64kbit. The rev 1.3 and newer boards use a CL-CD1865. These chips | ||
143 | are officially capable of 115k2. | ||
144 | |||
145 | The Specialix card uses a 25MHz crystal (in times two mode, which in | ||
146 | fact is a divided by two mode). This is not enough to reach the rated | ||
147 | 115k2 on all ports at the same time. With this clock rate you can only | ||
148 | do 37% of this rate. This means that at 115k2 on all ports you are | ||
149 | going to lose characters (The chip cannot handle that many incoming | ||
150 | bits at this clock rate.) (Yes, you read that correctly: there is a | ||
151 | limit to the number of -=bits=- per second that the chip can handle.) | ||
152 | |||
153 | If you near the "limit" you will first start to see a graceful | ||
154 | degradation in that the chip cannot keep the transmitter busy at all | ||
155 | times. However with a central clock this slow, you can also get it to | ||
156 | miss incoming characters. The driver will print a warning message when | ||
157 | you are outside the official specs. The messages usually show up in | ||
158 | the file /var/log/messages . | ||
159 | |||
160 | The specialix card cannot reliably do 115k2. If you use it, you have | ||
161 | to do "extensive testing" (*) to verify if it actually works. | ||
162 | |||
163 | When "mgetty" communicates with my modem at 115k2 it reports: | ||
164 | got: +++[0d]ATQ0V1H0[0d][0d][8a]O[cb][0d][8a] | ||
165 | ^^^^ ^^^^ ^^^^ | ||
166 | |||
167 | The three characters that have the "^^^" under them have suffered a | ||
168 | bit error in the highest bit. In conclusion: I've tested it, and found | ||
169 | that it simply DOESN'T work for me. I also suspect that this is also | ||
170 | caused by the baud rate being just a little bit out of tune. | ||
171 | |||
172 | I upgraded the crystal to 66Mhz on one of my Specialix cards. Works | ||
173 | great! Contact me for details. (Voids warranty, requires a steady hand | ||
174 | and more such restrictions....) | ||
175 | |||
176 | |||
177 | (*) Cirrus logic CD1864 databook, page 40. | ||
178 | |||
179 | |||
180 | Cables for the Specialix IO8+ | ||
181 | ============================= | ||
182 | |||
183 | The pinout of the connectors on the IO8+ is: | ||
184 | |||
185 | pin short direction long name | ||
186 | name | ||
187 | Pin 1 DCD input Data Carrier Detect | ||
188 | Pin 2 RXD input Receive | ||
189 | Pin 3 DTR/RTS output Data Terminal Ready/Ready To Send | ||
190 | Pin 4 GND - Ground | ||
191 | Pin 5 TXD output Transmit | ||
192 | Pin 6 CTS input Clear To Send | ||
193 | |||
194 | |||
195 | -- 6 5 4 3 2 1 -- | ||
196 | | | | ||
197 | | | | ||
198 | | | | ||
199 | | | | ||
200 | +----- -----+ | ||
201 | |__________| | ||
202 | clip | ||
203 | |||
204 | Front view of an RJ12 connector. Cable moves "into" the paper. | ||
205 | (the plug is ready to plug into your mouth this way...) | ||
206 | |||
207 | |||
208 | NULL cable. I don't know who is going to use these except for | ||
209 | testing purposes, but I tested the cards with this cable. (It | ||
210 | took quite a while to figure out, so I'm not going to delete | ||
211 | it. So there! :-) | ||
212 | |||
213 | |||
214 | This end goes This end needs | ||
215 | straight into the some twists in | ||
216 | RJ12 plug. the wiring. | ||
217 | IO8+ RJ12 IO8+ RJ12 | ||
218 | 1 DCD white - | ||
219 | - - 1 DCD | ||
220 | 2 RXD black 5 TXD | ||
221 | 3 DTR/RTS red 6 CTS | ||
222 | 4 GND green 4 GND | ||
223 | 5 TXD yellow 2 RXD | ||
224 | 6 CTS blue 3 DTR/RTS | ||
225 | |||
226 | |||
227 | Same NULL cable, but now sorted on the second column. | ||
228 | |||
229 | 1 DCD white - | ||
230 | - - 1 DCD | ||
231 | 5 TXD yellow 2 RXD | ||
232 | 6 CTS blue 3 DTR/RTS | ||
233 | 4 GND green 4 GND | ||
234 | 2 RXD black 5 TXD | ||
235 | 3 DTR/RTS red 6 CTS | ||
236 | |||
237 | |||
238 | |||
239 | This is a modem cable usable for hardware handshaking: | ||
240 | RJ12 DB25 DB9 | ||
241 | 1 DCD white 8 DCD 1 DCD | ||
242 | 2 RXD black 3 RXD 2 RXD | ||
243 | 3 DTR/RTS red 4 RTS 7 RTS | ||
244 | 4 GND green 7 GND 5 GND | ||
245 | 5 TXD yellow 2 TXD 3 TXD | ||
246 | 6 CTS blue 5 CTS 8 CTS | ||
247 | +---- 6 DSR 6 DSR | ||
248 | +---- 20 DTR 4 DTR | ||
249 | |||
250 | This is a modem cable usable for software handshaking: | ||
251 | It allows you to reset the modem using the DTR ioctls. | ||
252 | I (REW) have never tested this, "but xxxxxxxxxxxxx | ||
253 | says that it works." If you test this, please | ||
254 | tell me and I'll fill in your name on the xxx's. | ||
255 | |||
256 | RJ12 DB25 DB9 | ||
257 | 1 DCD white 8 DCD 1 DCD | ||
258 | 2 RXD black 3 RXD 2 RXD | ||
259 | 3 DTR/RTS red 20 DTR 4 DTR | ||
260 | 4 GND green 7 GND 5 GND | ||
261 | 5 TXD yellow 2 TXD 3 TXD | ||
262 | 6 CTS blue 5 CTS 8 CTS | ||
263 | +---- 6 DSR 6 DSR | ||
264 | +---- 4 RTS 7 RTS | ||
265 | |||
266 | I bought a 6 wire flat cable. It was colored as indicated. | ||
267 | Check that yours is the same before you trust me on this. | ||
268 | |||
269 | |||
270 | Hardware handshaking issues. | ||
271 | ============================ | ||
272 | |||
273 | The driver can be told to operate in two different ways. The default | ||
274 | behaviour is specialix.sx_rtscts = 0 where the pin behaves as DTR when | ||
275 | hardware handshaking is off. It behaves as the RTS hardware | ||
276 | handshaking signal when hardware handshaking is selected. | ||
277 | |||
278 | When you use this, you have to use the appropriate cable. The | ||
279 | cable will either be compatible with hardware handshaking or with | ||
280 | software handshaking. So switching on the fly is not really an | ||
281 | option. | ||
282 | |||
283 | I actually prefer to use the "specialix.sx_rtscts=1" option. | ||
284 | This makes the DTR/RTS pin always an RTS pin, and ioctls to | ||
285 | change DTR are always ignored. I have a cable that is configured | ||
286 | for this. | ||
287 | |||
288 | |||
289 | Ports and devices | ||
290 | ================= | ||
291 | |||
292 | Port 0 is the one furthest from the card-edge connector. | ||
293 | |||
294 | Devices: | ||
295 | |||
296 | You should make the devices as follows: | ||
297 | |||
298 | bash | ||
299 | cd /dev | ||
300 | for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \ | ||
301 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ||
302 | do | ||
303 | echo -n "$i " | ||
304 | mknod /dev/ttyW$i c 75 $i | ||
305 | mknod /dev/cuw$i c 76 $i | ||
306 | done | ||
307 | echo "" | ||
308 | |||
309 | If your system doesn't come with these devices preinstalled, bug your | ||
310 | linux-vendor about this. They have had ample time to get this | ||
311 | implemented by now. | ||
312 | |||
313 | You cannot have more than 4 boards in one computer. The card only | ||
314 | supports 4 different interrupts. If you really want this, contact me | ||
315 | about this and I'll give you a few tips (requires soldering iron).... | ||
316 | |||
317 | If you have enough PCI slots, you can probably use more than 4 PCI | ||
318 | versions of the card though.... | ||
319 | |||
320 | The PCI version of the card cannot adhere to the mechanical part of | ||
321 | the PCI spec because the 8 serial connectors are simply too large. If | ||
322 | it doesn't fit in your computer, bring back the card. | ||
323 | |||
324 | |||
325 | ------------------------------------------------------------------------ | ||
326 | |||
327 | |||
328 | Fixed bugs and restrictions: | ||
329 | - During initialization, interrupts are blindly turned on. | ||
330 | Having a shadow variable would cause an extra memory | ||
331 | access on every IO instruction. | ||
332 | - The interrupt (on the card) should be disabled when we | ||
333 | don't allocate the Linux end of the interrupt. This allows | ||
334 | a different driver/card to use it while all ports are not in | ||
335 | use..... (a la standard serial port) | ||
336 | == An extra _off variant of the sx_in and sx_out macros are | ||
337 | now available. They don't set the interrupt enable bit. | ||
338 | These are used during initialization. Normal operation uses | ||
339 | the old variant which enables the interrupt line. | ||
340 | - RTS/DTR issue needs to be implemented according to | ||
341 | specialix' spec. | ||
342 | I kind of like the "determinism" of the current | ||
343 | implementation. Compile time flag? | ||
344 | == Ok. Compile time flag! Default is how Specialix likes it. | ||
345 | == Now a config time flag! Gets saved in your config file. Neat! | ||
346 | - Can you set the IO address from the lilo command line? | ||
347 | If you need this, bug me about it, I'll make it. | ||
348 | == Hah! No bugging needed. Fixed! :-) | ||
349 | - Cirrus logic hasn't gotten back to me yet why the CD1865 can | ||
350 | and the CD1864 can't do 115k2. I suspect that this is | ||
351 | because the CD1864 is not rated for 33MHz operation. | ||
352 | Therefore the CD1864 versions of the card can't do 115k2 on | ||
353 | all ports just like the CD1865 versions. The driver does | ||
354 | not block 115k2 on CD1864 cards. | ||
355 | == I called the Cirrus Logic representative here in Holland. | ||
356 | The CD1864 databook is identical to the CD1865 databook, | ||
357 | except for an extra warning at the end. Similar Bit errors | ||
358 | have been observed in testing at 115k2 on both an 1865 and | ||
359 | a 1864 chip. I see no reason why I would prohibit 115k2 on | ||
360 | 1864 chips and not do it on 1865 chips. Actually there is | ||
361 | reason to prohibit it on BOTH chips. I print a warning. | ||
362 | If you use 115k2, you're on your own. | ||
363 | - A spiky CD may send spurious HUPs. Also in CLOCAL??? | ||
364 | -- A fix for this turned out to be counter productive. | ||
365 | Different fix? Current behaviour is acceptable? | ||
366 | -- Maybe the current implementation is correct. If anybody | ||
367 | gets bitten by this, please report, and it will get fixed. | ||
368 | |||
369 | -- Testing revealed that when in CLOCAL, the problem doesn't | ||
370 | occur. As warned for in the CD1865 manual, the chip may | ||
371 | send modem intr's on a spike. We could filter those out, | ||
372 | but that would be a cludge anyway (You'd still risk getting | ||
373 | a spurious HUP when two spikes occur.)..... | ||
374 | |||
375 | |||
376 | |||
377 | Bugs & restrictions: | ||
378 | - This is a difficult card to autoprobe. | ||
379 | You have to WRITE to the address register to even | ||
380 | read-probe a CD186x register. Disable autodetection? | ||
381 | -- Specialix: any suggestions? | ||
382 | |||
383 | |||
diff --git a/Documentation/serial/sx.txt b/Documentation/serial/sx.txt deleted file mode 100644 index cb4efa0fb5cc..000000000000 --- a/Documentation/serial/sx.txt +++ /dev/null | |||
@@ -1,294 +0,0 @@ | |||
1 | |||
2 | sx.txt -- specialix SX/SI multiport serial driver readme. | ||
3 | |||
4 | |||
5 | |||
6 | Copyright (C) 1997 Roger Wolff (R.E.Wolff@BitWizard.nl) | ||
7 | |||
8 | Specialix pays for the development and support of this driver. | ||
9 | Please DO contact support@specialix.co.uk if you require | ||
10 | support. | ||
11 | |||
12 | This driver was developed in the BitWizard linux device | ||
13 | driver service. If you require a linux device driver for your | ||
14 | product, please contact devices@BitWizard.nl for a quote. | ||
15 | |||
16 | (History) | ||
17 | There used to be an SI driver by Simon Allan. This is a complete | ||
18 | rewrite from scratch. Just a few lines-of-code have been snatched. | ||
19 | |||
20 | (Sources) | ||
21 | Specialix document number 6210028: SX Host Card and Download Code | ||
22 | Software Functional Specification. | ||
23 | |||
24 | (Copying) | ||
25 | This program is free software; you can redistribute it and/or | ||
26 | modify it under the terms of the GNU General Public License as | ||
27 | published by the Free Software Foundation; either version 2 of | ||
28 | the License, or (at your option) any later version. | ||
29 | |||
30 | This program is distributed in the hope that it will be | ||
31 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
32 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
33 | PURPOSE. See the GNU General Public License for more details. | ||
34 | |||
35 | You should have received a copy of the GNU General Public | ||
36 | License along with this program; if not, write to the Free | ||
37 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | ||
38 | USA. | ||
39 | |||
40 | (Addendum) | ||
41 | I'd appreciate it that if you have fixes, that you send them | ||
42 | to me first. | ||
43 | |||
44 | |||
45 | Introduction | ||
46 | ============ | ||
47 | |||
48 | This file contains some random information, that I like to have online | ||
49 | instead of in a manual that can get lost. Ever misplace your Linux | ||
50 | kernel sources? And the manual of one of the boards in your computer? | ||
51 | |||
52 | |||
53 | Theory of operation | ||
54 | =================== | ||
55 | |||
56 | An important thing to know is that the driver itself doesn't have the | ||
57 | firmware for the card. This means that you need the separate package | ||
58 | "sx_firmware". For now you can get the source at | ||
59 | |||
60 | ftp://ftp.bitwizard.nl/specialix/sx_firmware_<version>.tgz | ||
61 | |||
62 | The firmware load needs a "misc" device, so you'll need to enable the | ||
63 | "Support for user misc device modules" in your kernel configuration. | ||
64 | The misc device needs to be called "/dev/specialix_sxctl". It needs | ||
65 | misc major 10, and minor number 167 (assigned by HPA). The section | ||
66 | on creating device files below also creates this device. | ||
67 | |||
68 | After loading the sx.o module into your kernel, the driver will report | ||
69 | the number of cards detected, but because it doesn't have any | ||
70 | firmware, it will not be able to determine the number of ports. Only | ||
71 | when you then run "sx_firmware" will the firmware be downloaded and | ||
72 | the rest of the driver initialized. At that time the sx_firmware | ||
73 | program will report the number of ports installed. | ||
74 | |||
75 | In contrast with many other multi port serial cards, some of the data | ||
76 | structures are only allocated when the card knows the number of ports | ||
77 | that are connected. This means we won't waste memory for 120 port | ||
78 | descriptor structures when you only have 8 ports. If you experience | ||
79 | problems due to this, please report them: I haven't seen any. | ||
80 | |||
81 | |||
82 | Interrupts | ||
83 | ========== | ||
84 | |||
85 | A multi port serial card, would generate a horrendous amount of | ||
86 | interrupts if it would interrupt the CPU for every received | ||
87 | character. Even more than 10 years ago, the trick not to use | ||
88 | interrupts but to poll the serial cards was invented. | ||
89 | |||
90 | The SX card allow us to do this two ways. First the card limits its | ||
91 | own interrupt rate to a rate that won't overwhelm the CPU. Secondly, | ||
92 | we could forget about the cards interrupt completely and use the | ||
93 | internal timer for this purpose. | ||
94 | |||
95 | Polling the card can take up to a few percent of your CPU. Using the | ||
96 | interrupts would be better if you have most of the ports idle. Using | ||
97 | timer-based polling is better if your card almost always has work to | ||
98 | do. You save the separate interrupt in that case. | ||
99 | |||
100 | In any case, it doesn't really matter all that much. | ||
101 | |||
102 | The most common problem with interrupts is that for ISA cards in a PCI | ||
103 | system the BIOS has to be told to configure that interrupt as "legacy | ||
104 | ISA". Otherwise the card can pull on the interrupt line all it wants | ||
105 | but the CPU won't see this. | ||
106 | |||
107 | If you can't get the interrupt to work, remember that polling mode is | ||
108 | more efficient (provided you actually use the card intensively). | ||
109 | |||
110 | |||
111 | Allowed Configurations | ||
112 | ====================== | ||
113 | |||
114 | Some configurations are disallowed. Even though at a glance they might | ||
115 | seem to work, they are known to lockup the bus between the host card | ||
116 | and the device concentrators. You should respect the drivers decision | ||
117 | not to support certain configurations. It's there for a reason. | ||
118 | |||
119 | Warning: Seriously technical stuff ahead. Executive summary: Don't use | ||
120 | SX cards except configured at a 64k boundary. Skip the next paragraph. | ||
121 | |||
122 | The SX cards can theoretically be placed at a 32k boundary. So for | ||
123 | instance you can put an SX card at 0xc8000-0xd7fff. This is not a | ||
124 | "recommended configuration". ISA cards have to tell the bus controller | ||
125 | how they like their timing. Due to timing issues they have to do this | ||
126 | based on which 64k window the address falls into. This means that the | ||
127 | 32k window below and above the SX card have to use exactly the same | ||
128 | timing as the SX card. That reportedly works for other SX cards. But | ||
129 | you're still left with two useless 32k windows that should not be used | ||
130 | by anybody else. | ||
131 | |||
132 | |||
133 | Configuring the driver | ||
134 | ====================== | ||
135 | |||
136 | PCI cards are always detected. The driver auto-probes for ISA cards at | ||
137 | some sensible addresses. Please report if the auto-probe causes trouble | ||
138 | in your system, or when a card isn't detected. | ||
139 | |||
140 | I'm afraid I haven't implemented "kernel command line parameters" yet. | ||
141 | This means that if the default doesn't work for you, you shouldn't use | ||
142 | the compiled-into-the-kernel version of the driver. Use a module | ||
143 | instead. If you convince me that you need this, I'll make it for | ||
144 | you. Deal? | ||
145 | |||
146 | I'm afraid that the module parameters are a bit clumsy. If you have a | ||
147 | better idea, please tell me. | ||
148 | |||
149 | You can specify several parameters: | ||
150 | |||
151 | sx_poll: number of jiffies between timer-based polls. | ||
152 | |||
153 | Set this to "0" to disable timer based polls. | ||
154 | Initialization of cards without a working interrupt | ||
155 | will fail. | ||
156 | |||
157 | Set this to "1" if you want a polling driver. | ||
158 | (on Intel: 100 polls per second). If you don't use | ||
159 | fast baud rates, you might consider a value like "5". | ||
160 | (If you don't know how to do the math, use 1). | ||
161 | |||
162 | sx_slowpoll: Number of jiffies between timer-based polls. | ||
163 | Set this to "100" to poll once a second. | ||
164 | This should get the card out of a stall if the driver | ||
165 | ever misses an interrupt. I've never seen this happen, | ||
166 | and if it does, that's a bug. Tell me. | ||
167 | |||
168 | sx_maxints: Number of interrupts to request from the card. | ||
169 | The card normally limits interrupts to about 100 per | ||
170 | second to offload the host CPU. You can increase this | ||
171 | number to reduce latency on the card a little. | ||
172 | Note that if you give a very high number you can overload | ||
173 | your CPU as well as the CPU on the host card. This setting | ||
174 | is inaccurate and not recommended for SI cards (But it | ||
175 | works). | ||
176 | |||
177 | sx_irqmask: The mask of allowable IRQs to use. I suggest you set | ||
178 | this to 0 (disable IRQs all together) and use polling if | ||
179 | the assignment of IRQs becomes problematic. This is defined | ||
180 | as the sum of (1 << irq) 's that you want to allow. So | ||
181 | sx_irqmask of 8 (1 << 3) specifies that only irq 3 may | ||
182 | be used by the SX driver. If you want to specify to the | ||
183 | driver: "Either irq 11 or 12 is ok for you to use", then | ||
184 | specify (1 << 11) | (1 << 12) = 0x1800 . | ||
185 | |||
186 | sx_debug: You can enable different sorts of debug traces with this. | ||
187 | At "-1" all debugging traces are active. You'll get several | ||
188 | times more debugging output than you'll get characters | ||
189 | transmitted. | ||
190 | |||
191 | |||
192 | Baud rates | ||
193 | ========== | ||
194 | |||
195 | Theoretically new SXDCs should be capable of more than 460k | ||
196 | baud. However the line drivers usually give up before that. Also the | ||
197 | CPU on the card may not be able to handle 8 channels going at full | ||
198 | blast at that speed. Moreover, the buffers are not large enough to | ||
199 | allow operation with 100 interrupts per second. You'll have to realize | ||
200 | that the card has a 256 byte buffer, so you'll have to increase the | ||
201 | number of interrupts per second if you have more than 256*100 bytes | ||
202 | per second to transmit. If you do any performance testing in this | ||
203 | area, I'd be glad to hear from you... | ||
204 | |||
205 | (Psst Linux users..... I think the Linux driver is more efficient than | ||
206 | the driver for other OSes. If you can and want to benchmark them | ||
207 | against each other, be my guest, and report your findings...... :-) | ||
208 | |||
209 | |||
210 | Ports and devices | ||
211 | ================= | ||
212 | |||
213 | Port 0 is the top connector on the module closest to the host | ||
214 | card. Oh, the ports on the SXDCs and TAs are labelled from 1 to 8 | ||
215 | instead of from 0 to 7, as they are numbered by linux. I'm stubborn in | ||
216 | this: I know for sure that I wouldn't be able to calculate which port | ||
217 | is which anymore if I would change that.... | ||
218 | |||
219 | |||
220 | Devices: | ||
221 | |||
222 | You should make the device files as follows: | ||
223 | |||
224 | #!/bin/sh | ||
225 | # (I recommend that you cut-and-paste this into a file and run that) | ||
226 | cd /dev | ||
227 | t=0 | ||
228 | mknod specialix_sxctl c 10 167 | ||
229 | while [ $t -lt 64 ] | ||
230 | do | ||
231 | echo -n "$t " | ||
232 | mknod ttyX$t c 32 $t | ||
233 | mknod cux$t c 33 $t | ||
234 | t=`expr $t + 1` | ||
235 | done | ||
236 | echo "" | ||
237 | rm /etc/psdevtab | ||
238 | ps > /dev/null | ||
239 | |||
240 | |||
241 | This creates 64 devices. If you have more, increase the constant on | ||
242 | the line with "while". The devices start at 0, as is customary on | ||
243 | Linux. Specialix seems to like starting the numbering at 1. | ||
244 | |||
245 | If your system doesn't come with these devices pre-installed, bug your | ||
246 | linux-vendor about this. They should have these devices | ||
247 | "pre-installed" before the new millennium. The "ps" stuff at the end | ||
248 | is to "tell" ps that the new devices exist. | ||
249 | |||
250 | Officially the maximum number of cards per computer is 4. This driver | ||
251 | however supports as many cards in one machine as you want. You'll run | ||
252 | out of interrupts after a few, but you can switch to polled operation | ||
253 | then. At about 256 ports (More than 8 cards), we run out of minor | ||
254 | device numbers. Sorry. I suggest you buy a second computer.... (Or | ||
255 | switch to RIO). | ||
256 | |||
257 | ------------------------------------------------------------------------ | ||
258 | |||
259 | |||
260 | Fixed bugs and restrictions: | ||
261 | - Hangup processing. | ||
262 | -- Done. | ||
263 | |||
264 | - the write path in generic_serial (lockup / oops). | ||
265 | -- Done (Ugly: not the way I want it. Copied from serial.c). | ||
266 | |||
267 | - write buffer isn't flushed at close. | ||
268 | -- Done. I still seem to lose a few chars at close. | ||
269 | Sorry. I think that this is a firmware issue. (-> Specialix) | ||
270 | |||
271 | - drain hardware before changing termios | ||
272 | - Change debug on the fly. | ||
273 | - ISA free irq -1. (no firmware loaded). | ||
274 | - adding c8000 as a probe address. Added warning. | ||
275 | - Add a RAMtest for the RAM on the card.c | ||
276 | - Crash when opening a port "way" of the number of allowed ports. | ||
277 | (for example opening port 60 when there are only 24 ports attached) | ||
278 | - Sometimes the use-count strays a bit. After a few hours of | ||
279 | testing the use count is sometimes "3". If you are not like | ||
280 | me and can remember what you did to get it that way, I'd | ||
281 | appreciate an Email. Possibly fixed. Tell me if anyone still | ||
282 | sees this. | ||
283 | - TAs don't work right if you don't connect all the modem control | ||
284 | signals. SXDCs do. T225 firmware problem -> Specialix. | ||
285 | (Mostly fixed now, I think. Tell me if you encounter this!) | ||
286 | |||
287 | Bugs & restrictions: | ||
288 | |||
289 | - Arbitrary baud rates. Requires firmware update. (-> Specialix) | ||
290 | |||
291 | - Low latency (mostly firmware, -> Specialix) | ||
292 | |||
293 | |||
294 | |||
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt index b0714d8f678a..cbc2f03056bd 100644 --- a/Documentation/stable_kernel_rules.txt +++ b/Documentation/stable_kernel_rules.txt | |||
@@ -39,7 +39,7 @@ Procedure for submitting patches to the -stable tree: | |||
39 | the stable tree without anything else needing to be done by the author | 39 | the stable tree without anything else needing to be done by the author |
40 | or subsystem maintainer. | 40 | or subsystem maintainer. |
41 | - If the patch requires other patches as prerequisites which can be | 41 | - If the patch requires other patches as prerequisites which can be |
42 | cherry-picked than this can be specified in the following format in | 42 | cherry-picked, then this can be specified in the following format in |
43 | the sign-off area: | 43 | the sign-off area: |
44 | 44 | ||
45 | Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle | 45 | Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle |
diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt index 4e7da6543424..badb0507608f 100644 --- a/Documentation/vm/numa_memory_policy.txt +++ b/Documentation/vm/numa_memory_policy.txt | |||
@@ -174,7 +174,6 @@ Components of Memory Policies | |||
174 | allocation fails, the kernel will search other nodes, in order of | 174 | allocation fails, the kernel will search other nodes, in order of |
175 | increasing distance from the preferred node based on information | 175 | increasing distance from the preferred node based on information |
176 | provided by the platform firmware. | 176 | provided by the platform firmware. |
177 | containing the cpu where the allocation takes place. | ||
178 | 177 | ||
179 | Internally, the Preferred policy uses a single node--the | 178 | Internally, the Preferred policy uses a single node--the |
180 | preferred_node member of struct mempolicy. When the internal | 179 | preferred_node member of struct mempolicy. When the internal |
@@ -275,9 +274,9 @@ Components of Memory Policies | |||
275 | For example, consider a task that is attached to a cpuset with | 274 | For example, consider a task that is attached to a cpuset with |
276 | mems 2-5 that sets an Interleave policy over the same set with | 275 | mems 2-5 that sets an Interleave policy over the same set with |
277 | MPOL_F_RELATIVE_NODES. If the cpuset's mems change to 3-7, the | 276 | MPOL_F_RELATIVE_NODES. If the cpuset's mems change to 3-7, the |
278 | interleave now occurs over nodes 3,5-6. If the cpuset's mems | 277 | interleave now occurs over nodes 3,5-7. If the cpuset's mems |
279 | then change to 0,2-3,5, then the interleave occurs over nodes | 278 | then change to 0,2-3,5, then the interleave occurs over nodes |
280 | 0,3,5. | 279 | 0,2-3,5. |
281 | 280 | ||
282 | Thanks to the consistent remapping, applications preparing | 281 | Thanks to the consistent remapping, applications preparing |
283 | nodemasks to specify memory policies using this flag should | 282 | nodemasks to specify memory policies using this flag should |
diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO index 6c914aa87e71..54ea24ff63c7 100644 --- a/Documentation/zh_CN/HOWTO +++ b/Documentation/zh_CN/HOWTO | |||
@@ -237,7 +237,7 @@ kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开å‘éµå¾ª | |||
237 | 如果没有2.6.x.yç‰ˆæœ¬å†…æ ¸å˜åœ¨ï¼Œé‚£ä¹ˆæœ€æ–°çš„2.6.xç‰ˆæœ¬å†…æ ¸å°±ç›¸å½“äºŽæ˜¯å½“å‰çš„稳定 | 237 | 如果没有2.6.x.yç‰ˆæœ¬å†…æ ¸å˜åœ¨ï¼Œé‚£ä¹ˆæœ€æ–°çš„2.6.xç‰ˆæœ¬å†…æ ¸å°±ç›¸å½“äºŽæ˜¯å½“å‰çš„稳定 |
238 | ç‰ˆå†…æ ¸ã€‚ | 238 | ç‰ˆå†…æ ¸ã€‚ |
239 | 239 | ||
240 | 2.6.x.y版本由“稳定版â€å°ç»„(邮件地å€<stable@kernel.org>ï¼‰ç»´æŠ¤ï¼Œä¸€èˆ¬éš”å‘¨å‘ | 240 | 2.6.x.y版本由“稳定版â€å°ç»„(邮件地å€<stable@vger.kernel.org>ï¼‰ç»´æŠ¤ï¼Œä¸€èˆ¬éš”å‘¨å‘ |
241 | 布新版本。 | 241 | 布新版本。 |
242 | 242 | ||
243 | å†…æ ¸æºç ä¸çš„Documentation/stable_kernel_rules.txt文件具体æè¿°äº†å¯è¢«ç¨³å®š | 243 | å†…æ ¸æºç ä¸çš„Documentation/stable_kernel_rules.txt文件具体æè¿°äº†å¯è¢«ç¨³å®š |
diff --git a/Documentation/zh_CN/io_ordering.txt b/Documentation/zh_CN/io_ordering.txt new file mode 100644 index 000000000000..e592daf4e014 --- /dev/null +++ b/Documentation/zh_CN/io_ordering.txt | |||
@@ -0,0 +1,67 @@ | |||
1 | Chinese translated version of Documentation/io_orderings.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: Lin Yongting <linyongting@gmail.com> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/io_ordering.txt çš„ä¸æ–‡ç¿»è¯‘ | ||
12 | |||
13 | 如果想评论或更新本文的内容,请直接è”ç³»åŽŸæ–‡æ¡£çš„ç»´æŠ¤è€…ã€‚å¦‚æžœä½ ä½¿ç”¨è‹±æ–‡ | ||
14 | äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘䏿–‡ç‰ˆç»´æŠ¤è€…求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 | ||
15 | 译å˜åœ¨é—®é¢˜ï¼Œè¯·è”ç³»ä¸æ–‡ç‰ˆç»´æŠ¤è€…。 | ||
16 | |||
17 | 䏿–‡ç‰ˆç»´æŠ¤è€…: æž—æ°¸å¬ Lin Yongting <linyongting@gmail.com> | ||
18 | 䏿–‡ç‰ˆç¿»è¯‘者: æž—æ°¸å¬ Lin Yongting <linyongting@gmail.com> | ||
19 | 䏿–‡ç‰ˆæ ¡è¯‘者: æž—æ°¸å¬ Lin Yongting <linyongting@gmail.com> | ||
20 | |||
21 | |||
22 | ä»¥ä¸‹ä¸ºæ£æ–‡ | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | 在æŸäº›å¹³å°ä¸Šï¼Œæ‰€è°“çš„å†…å˜æ˜ å°„I/O是弱顺åºã€‚在这些平å°ä¸Šï¼Œé©±åЍ开å‘者有责任 | ||
26 | ä¿è¯I/Oå†…å˜æ˜ 射地å€çš„写æ“作按程åºå›¾æ„的顺åºè¾¾åˆ°è®¾å¤‡ã€‚通常读å–一个“安全†| ||
27 | 设备寄å˜å™¨æˆ–桥寄å˜å™¨ï¼Œè§¦å‘IO芯片清刷未处ç†çš„写æ“ä½œåˆ°è¾¾è®¾å¤‡åŽæ‰å¤„ç†è¯»æ“作, | ||
28 | 而达到ä¿è¯ç›®çš„。驱动程åºé€šå¸¸åœ¨spinlockä¿æŠ¤çš„ä¸´ç•ŒåŒºé€€å‡ºä¹‹å‰ä½¿ç”¨è¿™ç§æŠ€æœ¯ã€‚ | ||
29 | 这也å¯ä»¥ä¿è¯åŽé¢çš„写æ“作åªåœ¨å‰é¢çš„写æ“作之åŽåˆ°è¾¾è®¾å¤‡ï¼ˆè¿™éžå¸¸ç±»ä¼¼äºŽå†…å˜ | ||
30 | å±éšœæ“ä½œï¼Œmb(),ä¸è¿‡ä»…适用于I/O)。 | ||
31 | |||
32 | å‡è®¾ä¸€ä¸ªè®¾å¤‡é©±åŠ¨ç¨‹çš„å…·ä½“ä¾‹å: | ||
33 | |||
34 | ... | ||
35 | CPU A: spin_lock_irqsave(&dev_lock, flags) | ||
36 | CPU A: val = readl(my_status); | ||
37 | CPU A: ... | ||
38 | CPU A: writel(newval, ring_ptr); | ||
39 | CPU A: spin_unlock_irqrestore(&dev_lock, flags) | ||
40 | ... | ||
41 | CPU B: spin_lock_irqsave(&dev_lock, flags) | ||
42 | CPU B: val = readl(my_status); | ||
43 | CPU B: ... | ||
44 | CPU B: writel(newval2, ring_ptr); | ||
45 | CPU B: spin_unlock_irqrestore(&dev_lock, flags) | ||
46 | ... | ||
47 | |||
48 | 上述例åä¸ï¼Œè®¾å¤‡å¯èƒ½ä¼šå…ˆæŽ¥æ”¶åˆ°newval2çš„å€¼ï¼Œç„¶åŽæŽ¥æ”¶åˆ°newval的值,问题就 | ||
49 | å‘生了。ä¸è¿‡å¾ˆå®¹æ˜“é€šè¿‡ä¸‹é¢æ–¹æ³•æ¥ä¿®å¤ï¼š | ||
50 | |||
51 | ... | ||
52 | CPU A: spin_lock_irqsave(&dev_lock, flags) | ||
53 | CPU A: val = readl(my_status); | ||
54 | CPU A: ... | ||
55 | CPU A: writel(newval, ring_ptr); | ||
56 | CPU A: (void)readl(safe_register); /* é…置寄å˜å™¨ï¼Ÿ*/ | ||
57 | CPU A: spin_unlock_irqrestore(&dev_lock, flags) | ||
58 | ... | ||
59 | CPU B: spin_lock_irqsave(&dev_lock, flags) | ||
60 | CPU B: val = readl(my_status); | ||
61 | CPU B: ... | ||
62 | CPU B: writel(newval2, ring_ptr); | ||
63 | CPU B: (void)readl(safe_register); /* é…置寄å˜å™¨ï¼Ÿ*/ | ||
64 | CPU B: spin_unlock_irqrestore(&dev_lock, flags) | ||
65 | |||
66 | 在解决方案ä¸ï¼Œè¯»å–safe_register寄å˜å™¨ï¼Œè§¦å‘IO芯片清刷未处ç†çš„写æ“作, | ||
67 | å†å¤„ç†åŽé¢çš„读æ“作,防æ¢å¼•呿•°æ®ä¸ä¸€è‡´é—®é¢˜ã€‚ | ||
diff --git a/Documentation/zh_CN/magic-number.txt b/Documentation/zh_CN/magic-number.txt index 2ebe539f5450..dfb72a5c63e9 100644 --- a/Documentation/zh_CN/magic-number.txt +++ b/Documentation/zh_CN/magic-number.txt | |||
@@ -63,8 +63,6 @@ struct tty_ldisc { | |||
63 | PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h | 63 | PG_MAGIC 'P' pg_{read,write}_hdr include/linux/pg.h |
64 | CMAGIC 0x0111 user include/linux/a.out.h | 64 | CMAGIC 0x0111 user include/linux/a.out.h |
65 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h | 65 | MKISS_DRIVER_MAGIC 0x04bf mkiss_channel drivers/net/mkiss.h |
66 | RISCOM8_MAGIC 0x0907 riscom_port drivers/char/riscom8.h | ||
67 | SPECIALIX_MAGIC 0x0907 specialix_port drivers/char/specialix_io8.h | ||
68 | HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c | 66 | HDLC_MAGIC 0x239e n_hdlc drivers/char/n_hdlc.c |
69 | APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c | 67 | APM_BIOS_MAGIC 0x4101 apm_user arch/x86/kernel/apm_32.c |
70 | CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h | 68 | CYCLADES_MAGIC 0x4359 cyclades_port include/linux/cyclades.h |
@@ -82,7 +80,6 @@ STRIP_MAGIC 0x5303 strip drivers/net/strip.c | |||
82 | X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h | 80 | X25_ASY_MAGIC 0x5303 x25_asy drivers/net/x25_asy.h |
83 | SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h | 81 | SIXPACK_MAGIC 0x5304 sixpack drivers/net/hamradio/6pack.h |
84 | AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h | 82 | AX25_MAGIC 0x5316 ax_disp drivers/net/mkiss.h |
85 | ESP_MAGIC 0x53ee esp_struct drivers/char/esp.h | ||
86 | TTY_MAGIC 0x5401 tty_struct include/linux/tty.h | 83 | TTY_MAGIC 0x5401 tty_struct include/linux/tty.h |
87 | MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c | 84 | MGSL_MAGIC 0x5401 mgsl_info drivers/char/synclink.c |
88 | TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h | 85 | TTY_DRIVER_MAGIC 0x5402 tty_driver include/linux/tty_driver.h |
@@ -94,13 +91,10 @@ USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth drivers/usb/class/bluetty.c | |||
94 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c | 91 | RFCOMM_TTY_MAGIC 0x6d02 net/bluetooth/rfcomm/tty.c |
95 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h | 92 | USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port drivers/usb/serial/usb-serial.h |
96 | CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h | 93 | CG_MAGIC 0x00090255 ufs_cylinder_group include/linux/ufs_fs.h |
97 | A2232_MAGIC 0x000a2232 gs_port drivers/char/ser_a2232.h | ||
98 | RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h | 94 | RPORT_MAGIC 0x00525001 r_port drivers/char/rocket_int.h |
99 | LSEMAGIC 0x05091998 lse drivers/fc4/fc.c | 95 | LSEMAGIC 0x05091998 lse drivers/fc4/fc.c |
100 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h | 96 | GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str drivers/scsi/gdth_ioctl.h |
101 | RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c | 97 | RIEBL_MAGIC 0x09051990 drivers/net/atarilance.c |
102 | RIO_MAGIC 0x12345678 gs_port drivers/char/rio/rio_linux.c | ||
103 | SX_MAGIC 0x12345678 gs_port drivers/char/sx.h | ||
104 | NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h | 98 | NBD_REQUEST_MAGIC 0x12560953 nbd_request include/linux/nbd.h |
105 | RED_MAGIC2 0x170fc2a5 (any) mm/slab.c | 99 | RED_MAGIC2 0x170fc2a5 (any) mm/slab.c |
106 | BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c | 100 | BAYCOM_MAGIC 0x19730510 baycom_state drivers/net/baycom_epp.c |
@@ -116,7 +110,6 @@ ISDN_ASYNC_MAGIC 0x49344C01 modem_info include/linux/isdn.h | |||
116 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c | 110 | CTC_ASYNC_MAGIC 0x49344C01 ctc_tty_info drivers/s390/net/ctctty.c |
117 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h | 111 | ISDN_NET_MAGIC 0x49344C02 isdn_net_local_s drivers/isdn/i4l/isdn_net_lib.h |
118 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c | 112 | SAVEKMSG_MAGIC2 0x4B4D5347 savekmsg arch/*/amiga/config.c |
119 | STLI_BOARDMAGIC 0x4bc6c825 stlibrd include/linux/istallion.h | ||
120 | CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c | 113 | CS_STATE_MAGIC 0x4c4f4749 cs_state sound/oss/cs46xx.c |
121 | SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c | 114 | SLAB_C_MAGIC 0x4f17a36d kmem_cache mm/slab.c |
122 | COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c | 115 | COW_MAGIC 0x4f4f4f4d cow_header_v1 arch/um/drivers/ubd_user.c |
@@ -127,10 +120,8 @@ SCC_MAGIC 0x52696368 gs_port drivers/char/scc.h | |||
127 | SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c | 120 | SAVEKMSG_MAGIC1 0x53415645 savekmsg arch/*/amiga/config.c |
128 | GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h | 121 | GDA_MAGIC 0x58464552 gda arch/mips/include/asm/sn/gda.h |
129 | RED_MAGIC1 0x5a2cf071 (any) mm/slab.c | 122 | RED_MAGIC1 0x5a2cf071 (any) mm/slab.c |
130 | STL_PORTMAGIC 0x5a7182c9 stlport include/linux/stallion.h | ||
131 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c | 123 | EEPROM_MAGIC_VALUE 0x5ab478d2 lanai_dev drivers/atm/lanai.c |
132 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h | 124 | HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state include/linux/hdlcdrv.h |
133 | EPCA_MAGIC 0x5c6df104 channel include/linux/epca.h | ||
134 | PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h | 125 | PCXX_MAGIC 0x5c6df104 channel drivers/char/pcxx.h |
135 | KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h | 126 | KV_MAGIC 0x5f4b565f kernel_vars_s arch/mips/include/asm/sn/klkernvars.h |
136 | I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c | 127 | I810_STATE_MAGIC 0x63657373 i810_state sound/oss/i810_audio.c |
@@ -142,17 +133,14 @@ SLOT_MAGIC 0x67267322 slot drivers/hotplug/acpiphp.h | |||
142 | LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h | 133 | LO_MAGIC 0x68797548 nbd_device include/linux/nbd.h |
143 | OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h | 134 | OPROFILE_MAGIC 0x6f70726f super_block drivers/oprofile/oprofilefs.h |
144 | M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c | 135 | M3_STATE_MAGIC 0x734d724d m3_state sound/oss/maestro3.c |
145 | STL_PANELMAGIC 0x7ef621a1 stlpanel include/linux/stallion.h | ||
146 | VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c | 136 | VMALLOC_MAGIC 0x87654320 snd_alloc_track sound/core/memory.c |
147 | KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c | 137 | KMALLOC_MAGIC 0x87654321 snd_alloc_track sound/core/memory.c |
148 | PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h | 138 | PWC_MAGIC 0x89DC10AB pwc_device drivers/usb/media/pwc.h |
149 | NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h | 139 | NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h |
150 | STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h | ||
151 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h | 140 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h |
152 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h | 141 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h |
153 | CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h | 142 | CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h |
154 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h | 143 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h |
155 | STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h | ||
156 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c | 144 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c |
157 | CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c | 145 | CCB_MAGIC 0xf2691ad2 ccb drivers/scsi/ncr53c8xx.c |
158 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c | 146 | QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry drivers/scsi/arm/queue.c |
diff --git a/Documentation/zh_CN/stable_kernel_rules.txt b/Documentation/zh_CN/stable_kernel_rules.txt index b5b9b0ab02fd..26ea5ed7cd9c 100644 --- a/Documentation/zh_CN/stable_kernel_rules.txt +++ b/Documentation/zh_CN/stable_kernel_rules.txt | |||
@@ -42,7 +42,7 @@ Documentation/stable_kernel_rules.txt çš„ä¸æ–‡ç¿»è¯‘ | |||
42 | 42 | ||
43 | å‘ç¨³å®šç‰ˆä»£ç æ ‘æäº¤è¡¥ä¸çš„过程: | 43 | å‘ç¨³å®šç‰ˆä»£ç æ ‘æäº¤è¡¥ä¸çš„过程: |
44 | 44 | ||
45 | - 在确认了补ä¸ç¬¦åˆä»¥ä¸Šçš„规则åŽï¼Œå°†è¡¥ä¸å‘é€åˆ°stable@kernel.org。 | 45 | - 在确认了补ä¸ç¬¦åˆä»¥ä¸Šçš„规则åŽï¼Œå°†è¡¥ä¸å‘é€åˆ°stable@vger.kernel.org。 |
46 | - 如果补ä¸è¢«æŽ¥å—到队列里,å‘é€è€…会收到一个ACK回å¤ï¼Œå¦‚果没有被接å—,收 | 46 | - 如果补ä¸è¢«æŽ¥å—到队列里,å‘é€è€…会收到一个ACK回å¤ï¼Œå¦‚果没有被接å—,收 |
47 | 到的是NAK回å¤ã€‚回å¤éœ€è¦å‡ 天的时间,这å–决于开å‘者的时间安排。 | 47 | 到的是NAK回å¤ã€‚回å¤éœ€è¦å‡ 天的时间,这å–决于开å‘者的时间安排。 |
48 | - 被接å—的补ä¸ä¼šè¢«åŠ åˆ°ç¨³å®šç‰ˆæœ¬é˜Ÿåˆ—é‡Œï¼Œç‰å¾…å…¶ä»–å¼€å‘者的审查。 | 48 | - 被接å—的补ä¸ä¼šè¢«åŠ åˆ°ç¨³å®šç‰ˆæœ¬é˜Ÿåˆ—é‡Œï¼Œç‰å¾…å…¶ä»–å¼€å‘者的审查。 |
diff --git a/MAINTAINERS b/MAINTAINERS index 6dc67b1fdb50..e67ea2442041 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6782,7 +6782,7 @@ PERFORMANCE EVENTS SUBSYSTEM | |||
6782 | M: Peter Zijlstra <a.p.zijlstra@chello.nl> | 6782 | M: Peter Zijlstra <a.p.zijlstra@chello.nl> |
6783 | M: Paul Mackerras <paulus@samba.org> | 6783 | M: Paul Mackerras <paulus@samba.org> |
6784 | M: Ingo Molnar <mingo@redhat.com> | 6784 | M: Ingo Molnar <mingo@redhat.com> |
6785 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 6785 | M: Arnaldo Carvalho de Melo <acme@kernel.org> |
6786 | L: linux-kernel@vger.kernel.org | 6786 | L: linux-kernel@vger.kernel.org |
6787 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core | 6787 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core |
6788 | S: Supported | 6788 | S: Supported |
@@ -8315,7 +8315,7 @@ F: include/linux/compiler.h | |||
8315 | 8315 | ||
8316 | SPEAR PLATFORM SUPPORT | 8316 | SPEAR PLATFORM SUPPORT |
8317 | M: Viresh Kumar <viresh.linux@gmail.com> | 8317 | M: Viresh Kumar <viresh.linux@gmail.com> |
8318 | M: Shiraz Hashim <shiraz.hashim@st.com> | 8318 | M: Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
8319 | L: spear-devel@list.st.com | 8319 | L: spear-devel@list.st.com |
8320 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 8320 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
8321 | W: http://www.st.com/spear | 8321 | W: http://www.st.com/spear |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 15 | 2 | PATCHLEVEL = 15 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc2 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/include/asm/barrier.h b/arch/arc/include/asm/barrier.h deleted file mode 100644 index c32245c3d1e9..000000000000 --- a/arch/arc/include/asm/barrier.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_BARRIER_H | ||
10 | #define __ASM_BARRIER_H | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | /* TODO-vineetg: Need to see what this does, don't we need sync anywhere */ | ||
15 | #define mb() __asm__ __volatile__ ("" : : : "memory") | ||
16 | #define rmb() mb() | ||
17 | #define wmb() mb() | ||
18 | #define set_mb(var, value) do { var = value; mb(); } while (0) | ||
19 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
20 | #define read_barrier_depends() mb() | ||
21 | |||
22 | /* TODO-vineetg verify the correctness of macros here */ | ||
23 | #ifdef CONFIG_SMP | ||
24 | #define smp_mb() mb() | ||
25 | #define smp_rmb() rmb() | ||
26 | #define smp_wmb() wmb() | ||
27 | #else | ||
28 | #define smp_mb() barrier() | ||
29 | #define smp_rmb() barrier() | ||
30 | #define smp_wmb() barrier() | ||
31 | #endif | ||
32 | |||
33 | #define smp_read_barrier_depends() do { } while (0) | ||
34 | |||
35 | #endif | ||
36 | |||
37 | #endif | ||
diff --git a/arch/arm/boot/dts/spear320-hmi.dts b/arch/arm/boot/dts/spear320-hmi.dts index 3075d2d3a8be..0aa6fef5ce22 100644 --- a/arch/arm/boot/dts/spear320-hmi.dts +++ b/arch/arm/boot/dts/spear320-hmi.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * DTS file for SPEAr320 Evaluation Baord | 2 | * DTS file for SPEAr320 Evaluation Baord |
3 | * | 3 | * |
4 | * Copyright 2012 Shiraz Hashim <shiraz.hashim@st.com> | 4 | * Copyright 2012 Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
5 | * | 5 | * |
6 | * The code contained herein is licensed under the GNU General Public | 6 | * The code contained herein is licensed under the GNU General Public |
7 | * License. You may obtain a copy of the GNU General Public License | 7 | * License. You may obtain a copy of the GNU General Public License |
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig index 01004640ee4d..3df3f3a79ef4 100644 --- a/arch/arm/configs/bcm_defconfig +++ b/arch/arm/configs/bcm_defconfig | |||
@@ -132,7 +132,7 @@ CONFIG_CRC_ITU_T=y | |||
132 | CONFIG_CRC7=y | 132 | CONFIG_CRC7=y |
133 | CONFIG_XZ_DEC=y | 133 | CONFIG_XZ_DEC=y |
134 | CONFIG_AVERAGE=y | 134 | CONFIG_AVERAGE=y |
135 | CONFIG_PINCTRL_CAPRI=y | 135 | CONFIG_PINCTRL_BCM281XX=y |
136 | CONFIG_WATCHDOG=y | 136 | CONFIG_WATCHDOG=y |
137 | CONFIG_BCM_KONA_WDT=y | 137 | CONFIG_BCM_KONA_WDT=y |
138 | CONFIG_BCM_KONA_WDT_DEBUG=y | 138 | CONFIG_BCM_KONA_WDT_DEBUG=y |
diff --git a/arch/arm/mach-spear/headsmp.S b/arch/arm/mach-spear/headsmp.S index ed85473a047f..c52192dc3d9f 100644 --- a/arch/arm/mach-spear/headsmp.S +++ b/arch/arm/mach-spear/headsmp.S | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Picked from realview | 4 | * Picked from realview |
5 | * Copyright (c) 2012 ST Microelectronics Limited | 5 | * Copyright (c) 2012 ST Microelectronics Limited |
6 | * Shiraz Hashim <shiraz.hashim@st.com> | 6 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c index 5c4a19887b2b..c19751fff2c6 100644 --- a/arch/arm/mach-spear/platsmp.c +++ b/arch/arm/mach-spear/platsmp.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * based upon linux/arch/arm/mach-realview/platsmp.c | 4 | * based upon linux/arch/arm/mach-realview/platsmp.c |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics Ltd. | 6 | * Copyright (C) 2012 ST Microelectronics Ltd. |
7 | * Shiraz Hashim <shiraz.hashim@st.com> | 7 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c index 218ba5b67d92..64790353951f 100644 --- a/arch/arm/mach-spear/time.c +++ b/arch/arm/mach-spear/time.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * arch/arm/plat-spear/time.c | 2 | * arch/arm/plat-spear/time.c |
3 | * | 3 | * |
4 | * Copyright (C) 2010 ST Microelectronics | 4 | * Copyright (C) 2010 ST Microelectronics |
5 | * Shiraz Hashim<shiraz.hashim@st.com> | 5 | * Shiraz Hashim<shiraz.linux.kernel@gmail.com> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index e6f80fcf013b..a4acddad0c78 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S | |||
@@ -259,7 +259,7 @@ start_ap: | |||
259 | * Switch into virtual mode: | 259 | * Switch into virtual mode: |
260 | */ | 260 | */ |
261 | movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \ | 261 | movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \ |
262 | |IA64_PSR_DI|IA64_PSR_AC) | 262 | |IA64_PSR_DI) |
263 | ;; | 263 | ;; |
264 | mov cr.ipsr=r16 | 264 | mov cr.ipsr=r16 |
265 | movl r17=1f | 265 | movl r17=1f |
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S index 689ffcaa284e..18e794a57248 100644 --- a/arch/ia64/kernel/ivt.S +++ b/arch/ia64/kernel/ivt.S | |||
@@ -58,7 +58,7 @@ | |||
58 | #include <asm/unistd.h> | 58 | #include <asm/unistd.h> |
59 | #include <asm/errno.h> | 59 | #include <asm/errno.h> |
60 | 60 | ||
61 | #if 1 | 61 | #if 0 |
62 | # define PSR_DEFAULT_BITS psr.ac | 62 | # define PSR_DEFAULT_BITS psr.ac |
63 | #else | 63 | #else |
64 | # define PSR_DEFAULT_BITS 0 | 64 | # define PSR_DEFAULT_BITS 0 |
diff --git a/arch/ia64/kvm/vmm_ivt.S b/arch/ia64/kvm/vmm_ivt.S index 24018484c6e9..397e34a63e18 100644 --- a/arch/ia64/kvm/vmm_ivt.S +++ b/arch/ia64/kvm/vmm_ivt.S | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "kvm_minstate.h" | 64 | #include "kvm_minstate.h" |
65 | #include "vti.h" | 65 | #include "vti.h" |
66 | 66 | ||
67 | #if 1 | 67 | #if 0 |
68 | # define PSR_DEFAULT_BITS psr.ac | 68 | # define PSR_DEFAULT_BITS psr.ac |
69 | #else | 69 | #else |
70 | # define PSR_DEFAULT_BITS 0 | 70 | # define PSR_DEFAULT_BITS 0 |
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index e422b38d3113..9e67cdea3c74 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
@@ -29,15 +29,15 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start, | |||
29 | void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, | 29 | void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, |
30 | unsigned long pfn); | 30 | unsigned long pfn); |
31 | void (*flush_icache_range)(unsigned long start, unsigned long end); | 31 | void (*flush_icache_range)(unsigned long start, unsigned long end); |
32 | EXPORT_SYMBOL_GPL(flush_icache_range); | ||
32 | void (*local_flush_icache_range)(unsigned long start, unsigned long end); | 33 | void (*local_flush_icache_range)(unsigned long start, unsigned long end); |
33 | 34 | ||
34 | void (*__flush_cache_vmap)(void); | 35 | void (*__flush_cache_vmap)(void); |
35 | void (*__flush_cache_vunmap)(void); | 36 | void (*__flush_cache_vunmap)(void); |
36 | 37 | ||
37 | void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); | 38 | void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); |
38 | void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size); | ||
39 | |||
40 | EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range); | 39 | EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range); |
40 | void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size); | ||
41 | 41 | ||
42 | /* MIPS specific cache operations */ | 42 | /* MIPS specific cache operations */ |
43 | void (*flush_cache_sigtramp)(unsigned long addr); | 43 | void (*flush_cache_sigtramp)(unsigned long addr); |
diff --git a/arch/parisc/include/asm/shmparam.h b/arch/parisc/include/asm/shmparam.h index 628ddc22faa8..afe1300ab667 100644 --- a/arch/parisc/include/asm/shmparam.h +++ b/arch/parisc/include/asm/shmparam.h | |||
@@ -1,8 +1,7 @@ | |||
1 | #ifndef _ASMPARISC_SHMPARAM_H | 1 | #ifndef _ASMPARISC_SHMPARAM_H |
2 | #define _ASMPARISC_SHMPARAM_H | 2 | #define _ASMPARISC_SHMPARAM_H |
3 | 3 | ||
4 | #define __ARCH_FORCE_SHMLBA 1 | 4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ |
5 | 5 | #define SHM_COLOUR 0x00400000 /* shared mappings colouring */ | |
6 | #define SHMLBA 0x00400000 /* attach addr needs to be 4 Mb aligned */ | ||
7 | 6 | ||
8 | #endif /* _ASMPARISC_SHMPARAM_H */ | 7 | #endif /* _ASMPARISC_SHMPARAM_H */ |
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index a6ffc775a9f8..f6448c7c62b5 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
@@ -323,7 +323,8 @@ void flush_dcache_page(struct page *page) | |||
323 | * specifically accesses it, of course) */ | 323 | * specifically accesses it, of course) */ |
324 | 324 | ||
325 | flush_tlb_page(mpnt, addr); | 325 | flush_tlb_page(mpnt, addr); |
326 | if (old_addr == 0 || (old_addr & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) { | 326 | if (old_addr == 0 || (old_addr & (SHM_COLOUR - 1)) |
327 | != (addr & (SHM_COLOUR - 1))) { | ||
327 | __flush_cache_page(mpnt, addr, page_to_phys(page)); | 328 | __flush_cache_page(mpnt, addr, page_to_phys(page)); |
328 | if (old_addr) | 329 | if (old_addr) |
329 | printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? (char *)mpnt->vm_file->f_path.dentry->d_name.name : "(null)"); | 330 | printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? (char *)mpnt->vm_file->f_path.dentry->d_name.name : "(null)"); |
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index b7cadc4a06cd..31ffa9b55322 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static int get_offset(unsigned int last_mmap) | 46 | static int get_offset(unsigned int last_mmap) |
47 | { | 47 | { |
48 | return (last_mmap & (SHMLBA-1)) >> PAGE_SHIFT; | 48 | return (last_mmap & (SHM_COLOUR-1)) >> PAGE_SHIFT; |
49 | } | 49 | } |
50 | 50 | ||
51 | static unsigned long shared_align_offset(unsigned int last_mmap, | 51 | static unsigned long shared_align_offset(unsigned int last_mmap, |
@@ -57,8 +57,8 @@ static unsigned long shared_align_offset(unsigned int last_mmap, | |||
57 | static inline unsigned long COLOR_ALIGN(unsigned long addr, | 57 | static inline unsigned long COLOR_ALIGN(unsigned long addr, |
58 | unsigned int last_mmap, unsigned long pgoff) | 58 | unsigned int last_mmap, unsigned long pgoff) |
59 | { | 59 | { |
60 | unsigned long base = (addr+SHMLBA-1) & ~(SHMLBA-1); | 60 | unsigned long base = (addr+SHM_COLOUR-1) & ~(SHM_COLOUR-1); |
61 | unsigned long off = (SHMLBA-1) & | 61 | unsigned long off = (SHM_COLOUR-1) & |
62 | (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT); | 62 | (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT); |
63 | 63 | ||
64 | return base + off; | 64 | return base + off; |
@@ -101,7 +101,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
101 | if (flags & MAP_FIXED) { | 101 | if (flags & MAP_FIXED) { |
102 | if ((flags & MAP_SHARED) && last_mmap && | 102 | if ((flags & MAP_SHARED) && last_mmap && |
103 | (addr - shared_align_offset(last_mmap, pgoff)) | 103 | (addr - shared_align_offset(last_mmap, pgoff)) |
104 | & (SHMLBA - 1)) | 104 | & (SHM_COLOUR - 1)) |
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | goto found_addr; | 106 | goto found_addr; |
107 | } | 107 | } |
@@ -122,7 +122,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
122 | info.length = len; | 122 | info.length = len; |
123 | info.low_limit = mm->mmap_legacy_base; | 123 | info.low_limit = mm->mmap_legacy_base; |
124 | info.high_limit = mmap_upper_limit(); | 124 | info.high_limit = mmap_upper_limit(); |
125 | info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0; | 125 | info.align_mask = last_mmap ? (PAGE_MASK & (SHM_COLOUR - 1)) : 0; |
126 | info.align_offset = shared_align_offset(last_mmap, pgoff); | 126 | info.align_offset = shared_align_offset(last_mmap, pgoff); |
127 | addr = vm_unmapped_area(&info); | 127 | addr = vm_unmapped_area(&info); |
128 | 128 | ||
@@ -161,7 +161,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
161 | if (flags & MAP_FIXED) { | 161 | if (flags & MAP_FIXED) { |
162 | if ((flags & MAP_SHARED) && last_mmap && | 162 | if ((flags & MAP_SHARED) && last_mmap && |
163 | (addr - shared_align_offset(last_mmap, pgoff)) | 163 | (addr - shared_align_offset(last_mmap, pgoff)) |
164 | & (SHMLBA - 1)) | 164 | & (SHM_COLOUR - 1)) |
165 | return -EINVAL; | 165 | return -EINVAL; |
166 | goto found_addr; | 166 | goto found_addr; |
167 | } | 167 | } |
@@ -182,7 +182,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
182 | info.length = len; | 182 | info.length = len; |
183 | info.low_limit = PAGE_SIZE; | 183 | info.low_limit = PAGE_SIZE; |
184 | info.high_limit = mm->mmap_base; | 184 | info.high_limit = mm->mmap_base; |
185 | info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0; | 185 | info.align_mask = last_mmap ? (PAGE_MASK & (SHM_COLOUR - 1)) : 0; |
186 | info.align_offset = shared_align_offset(last_mmap, pgoff); | 186 | info.align_offset = shared_align_offset(last_mmap, pgoff); |
187 | addr = vm_unmapped_area(&info); | 187 | addr = vm_unmapped_area(&info); |
188 | if (!(addr & ~PAGE_MASK)) | 188 | if (!(addr & ~PAGE_MASK)) |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 80e5dd248934..83ead0ea127d 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -392,7 +392,7 @@ | |||
392 | ENTRY_COMP(vmsplice) | 392 | ENTRY_COMP(vmsplice) |
393 | ENTRY_COMP(move_pages) /* 295 */ | 393 | ENTRY_COMP(move_pages) /* 295 */ |
394 | ENTRY_SAME(getcpu) | 394 | ENTRY_SAME(getcpu) |
395 | ENTRY_SAME(epoll_pwait) | 395 | ENTRY_COMP(epoll_pwait) |
396 | ENTRY_COMP(statfs64) | 396 | ENTRY_COMP(statfs64) |
397 | ENTRY_COMP(fstatfs64) | 397 | ENTRY_COMP(fstatfs64) |
398 | ENTRY_COMP(kexec_load) /* 300 */ | 398 | ENTRY_COMP(kexec_load) /* 300 */ |
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c index 413dc1769299..b2b441b32341 100644 --- a/arch/parisc/lib/memcpy.c +++ b/arch/parisc/lib/memcpy.c | |||
@@ -470,7 +470,7 @@ static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len) | |||
470 | return 0; | 470 | return 0; |
471 | 471 | ||
472 | /* if a load or store fault occured we can get the faulty addr */ | 472 | /* if a load or store fault occured we can get the faulty addr */ |
473 | d = &__get_cpu_var(exception_data); | 473 | d = this_cpu_ptr(&exception_data); |
474 | fault_addr = d->fault_addr; | 474 | fault_addr = d->fault_addr; |
475 | 475 | ||
476 | /* error in load or store? */ | 476 | /* error in load or store? */ |
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 9d08c71a967e..747550762f3c 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -151,7 +151,7 @@ int fixup_exception(struct pt_regs *regs) | |||
151 | fix = search_exception_tables(regs->iaoq[0]); | 151 | fix = search_exception_tables(regs->iaoq[0]); |
152 | if (fix) { | 152 | if (fix) { |
153 | struct exception_data *d; | 153 | struct exception_data *d; |
154 | d = &__get_cpu_var(exception_data); | 154 | d = this_cpu_ptr(&exception_data); |
155 | d->fault_ip = regs->iaoq[0]; | 155 | d->fault_ip = regs->iaoq[0]; |
156 | d->fault_space = regs->isr; | 156 | d->fault_space = regs->isr; |
157 | d->fault_addr = regs->ior; | 157 | d->fault_addr = regs->ior; |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 2a4779091a58..155013da27e0 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -208,7 +208,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
208 | unsigned long in_devfn) | 208 | unsigned long in_devfn) |
209 | { | 209 | { |
210 | struct pci_controller* hose; | 210 | struct pci_controller* hose; |
211 | struct pci_bus *bus = NULL; | 211 | struct pci_bus *tmp_bus, *bus = NULL; |
212 | struct device_node *hose_node; | 212 | struct device_node *hose_node; |
213 | 213 | ||
214 | /* Argh ! Please forgive me for that hack, but that's the | 214 | /* Argh ! Please forgive me for that hack, but that's the |
@@ -229,10 +229,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
229 | * used on pre-domains setup. We return the first match | 229 | * used on pre-domains setup. We return the first match |
230 | */ | 230 | */ |
231 | 231 | ||
232 | list_for_each_entry(bus, &pci_root_buses, node) { | 232 | list_for_each_entry(tmp_bus, &pci_root_buses, node) { |
233 | if (in_bus >= bus->number && in_bus <= bus->busn_res.end) | 233 | if (in_bus >= tmp_bus->number && |
234 | in_bus <= tmp_bus->busn_res.end) { | ||
235 | bus = tmp_bus; | ||
234 | break; | 236 | break; |
235 | bus = NULL; | 237 | } |
236 | } | 238 | } |
237 | if (bus == NULL || bus->dev.of_node == NULL) | 239 | if (bus == NULL || bus->dev.of_node == NULL) |
238 | return -ENODEV; | 240 | return -ENODEV; |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 4ebbb9e99286..3b181b22cd46 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -232,6 +232,7 @@ int __node_distance(int a, int b) | |||
232 | 232 | ||
233 | return distance; | 233 | return distance; |
234 | } | 234 | } |
235 | EXPORT_SYMBOL(__node_distance); | ||
235 | 236 | ||
236 | static void initialize_distance_lookup_table(int nid, | 237 | static void initialize_distance_lookup_table(int nid, |
237 | const __be32 *associativity) | 238 | const __be32 *associativity) |
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h index d091aa1aaf11..bf9c823d4020 100644 --- a/arch/s390/include/asm/sigp.h +++ b/arch/s390/include/asm/sigp.h | |||
@@ -31,4 +31,23 @@ | |||
31 | #define SIGP_STATUS_INCORRECT_STATE 0x00000200UL | 31 | #define SIGP_STATUS_INCORRECT_STATE 0x00000200UL |
32 | #define SIGP_STATUS_NOT_RUNNING 0x00000400UL | 32 | #define SIGP_STATUS_NOT_RUNNING 0x00000400UL |
33 | 33 | ||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | static inline int __pcpu_sigp(u16 addr, u8 order, u32 parm, u32 *status) | ||
37 | { | ||
38 | register unsigned int reg1 asm ("1") = parm; | ||
39 | int cc; | ||
40 | |||
41 | asm volatile( | ||
42 | " sigp %1,%2,0(%3)\n" | ||
43 | " ipm %0\n" | ||
44 | " srl %0,28\n" | ||
45 | : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc"); | ||
46 | if (status && cc == 1) | ||
47 | *status = reg1; | ||
48 | return cc; | ||
49 | } | ||
50 | |||
51 | #endif /* __ASSEMBLY__ */ | ||
52 | |||
34 | #endif /* __S390_ASM_SIGP_H */ | 53 | #endif /* __S390_ASM_SIGP_H */ |
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index 160779394096..21703f85b48d 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #ifndef __ASM_SMP_H | 7 | #ifndef __ASM_SMP_H |
8 | #define __ASM_SMP_H | 8 | #define __ASM_SMP_H |
9 | 9 | ||
10 | #include <asm/sigp.h> | ||
11 | |||
10 | #ifdef CONFIG_SMP | 12 | #ifdef CONFIG_SMP |
11 | 13 | ||
12 | #include <asm/lowcore.h> | 14 | #include <asm/lowcore.h> |
@@ -50,9 +52,18 @@ static inline int smp_store_status(int cpu) { return 0; } | |||
50 | static inline int smp_vcpu_scheduled(int cpu) { return 1; } | 52 | static inline int smp_vcpu_scheduled(int cpu) { return 1; } |
51 | static inline void smp_yield_cpu(int cpu) { } | 53 | static inline void smp_yield_cpu(int cpu) { } |
52 | static inline void smp_yield(void) { } | 54 | static inline void smp_yield(void) { } |
53 | static inline void smp_stop_cpu(void) { } | ||
54 | static inline void smp_fill_possible_mask(void) { } | 55 | static inline void smp_fill_possible_mask(void) { } |
55 | 56 | ||
57 | static inline void smp_stop_cpu(void) | ||
58 | { | ||
59 | u16 pcpu = stap(); | ||
60 | |||
61 | for (;;) { | ||
62 | __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL); | ||
63 | cpu_relax(); | ||
64 | } | ||
65 | } | ||
66 | |||
56 | #endif /* CONFIG_SMP */ | 67 | #endif /* CONFIG_SMP */ |
57 | 68 | ||
58 | #ifdef CONFIG_HOTPLUG_CPU | 69 | #ifdef CONFIG_HOTPLUG_CPU |
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h index 5eb5c9ddb120..3802d2d3a18d 100644 --- a/arch/s390/include/uapi/asm/unistd.h +++ b/arch/s390/include/uapi/asm/unistd.h | |||
@@ -282,7 +282,8 @@ | |||
282 | #define __NR_finit_module 344 | 282 | #define __NR_finit_module 344 |
283 | #define __NR_sched_setattr 345 | 283 | #define __NR_sched_setattr 345 |
284 | #define __NR_sched_getattr 346 | 284 | #define __NR_sched_getattr 346 |
285 | #define NR_syscalls 345 | 285 | #define __NR_renameat2 347 |
286 | #define NR_syscalls 348 | ||
286 | 287 | ||
287 | /* | 288 | /* |
288 | * There are some system calls that are not present on 64 bit, some | 289 | * There are some system calls that are not present on 64 bit, some |
diff --git a/arch/s390/kernel/compat_wrapper.c b/arch/s390/kernel/compat_wrapper.c index 824c39dfddfc..45cdb37aa6f8 100644 --- a/arch/s390/kernel/compat_wrapper.c +++ b/arch/s390/kernel/compat_wrapper.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Compat sytem call wrappers. | 2 | * Compat system call wrappers. |
3 | * | 3 | * |
4 | * Copyright IBM Corp. 2014 | 4 | * Copyright IBM Corp. 2014 |
5 | */ | 5 | */ |
@@ -213,3 +213,4 @@ COMPAT_SYSCALL_WRAP5(kcmp, pid_t, pid1, pid_t, pid2, int, type, unsigned long, i | |||
213 | COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, flags); | 213 | COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, flags); |
214 | COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); | 214 | COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); |
215 | COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); | 215 | COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); |
216 | COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags); | ||
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c index e6af9406987c..acb412442e5e 100644 --- a/arch/s390/kernel/dumpstack.c +++ b/arch/s390/kernel/dumpstack.c | |||
@@ -144,10 +144,10 @@ void show_registers(struct pt_regs *regs) | |||
144 | char *mode; | 144 | char *mode; |
145 | 145 | ||
146 | mode = user_mode(regs) ? "User" : "Krnl"; | 146 | mode = user_mode(regs) ? "User" : "Krnl"; |
147 | printk("%s PSW : %p %p (%pSR)\n", | 147 | printk("%s PSW : %p %p", mode, (void *)regs->psw.mask, (void *)regs->psw.addr); |
148 | mode, (void *) regs->psw.mask, | 148 | if (!user_mode(regs)) |
149 | (void *) regs->psw.addr, | 149 | printk(" (%pSR)", (void *)regs->psw.addr); |
150 | (void *) regs->psw.addr); | 150 | printk("\n"); |
151 | printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x " | 151 | printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x " |
152 | "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER), | 152 | "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER), |
153 | mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO), | 153 | mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO), |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 4ac8fafec95f..1c82619eb4f7 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -64,7 +64,7 @@ void update_cr_regs(struct task_struct *task) | |||
64 | if (task->thread.per_flags & PER_FLAG_NO_TE) | 64 | if (task->thread.per_flags & PER_FLAG_NO_TE) |
65 | cr_new &= ~(1UL << 55); | 65 | cr_new &= ~(1UL << 55); |
66 | if (cr_new != cr) | 66 | if (cr_new != cr) |
67 | __ctl_load(cr, 0, 0); | 67 | __ctl_load(cr_new, 0, 0); |
68 | /* Set or clear transaction execution TDC bits 62 and 63. */ | 68 | /* Set or clear transaction execution TDC bits 62 and 63. */ |
69 | __ctl_store(cr, 2, 2); | 69 | __ctl_store(cr, 2, 2); |
70 | cr_new = cr & ~3UL; | 70 | cr_new = cr & ~3UL; |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f70f2489fa5f..88d1ca81e2dd 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -1027,3 +1027,35 @@ void __init setup_arch(char **cmdline_p) | |||
1027 | /* Setup zfcpdump support */ | 1027 | /* Setup zfcpdump support */ |
1028 | setup_zfcpdump(); | 1028 | setup_zfcpdump(); |
1029 | } | 1029 | } |
1030 | |||
1031 | #ifdef CONFIG_32BIT | ||
1032 | static int no_removal_warning __initdata; | ||
1033 | |||
1034 | static int __init parse_no_removal_warning(char *str) | ||
1035 | { | ||
1036 | no_removal_warning = 1; | ||
1037 | return 0; | ||
1038 | } | ||
1039 | __setup("no_removal_warning", parse_no_removal_warning); | ||
1040 | |||
1041 | static int __init removal_warning(void) | ||
1042 | { | ||
1043 | if (no_removal_warning) | ||
1044 | return 0; | ||
1045 | printk(KERN_ALERT "\n\n"); | ||
1046 | printk(KERN_CONT "Warning - you are using a 31 bit kernel!\n\n"); | ||
1047 | printk(KERN_CONT "We plan to remove 31 bit kernel support from the kernel sources in March 2015.\n"); | ||
1048 | printk(KERN_CONT "Currently we assume that nobody is using the 31 bit kernel on old 31 bit\n"); | ||
1049 | printk(KERN_CONT "hardware anymore. If you think that the code should not be removed and also\n"); | ||
1050 | printk(KERN_CONT "future versions of the Linux kernel should be able to run in 31 bit mode\n"); | ||
1051 | printk(KERN_CONT "please let us know. Please write to:\n"); | ||
1052 | printk(KERN_CONT "linux390@de.ibm.com (mail address) and/or\n"); | ||
1053 | printk(KERN_CONT "linux-s390@vger.kernel.org (mailing list).\n\n"); | ||
1054 | printk(KERN_CONT "Thank you!\n\n"); | ||
1055 | printk(KERN_CONT "If this kernel runs on a 64 bit machine you may consider using a 64 bit kernel.\n"); | ||
1056 | printk(KERN_CONT "This message can be disabled with the \"no_removal_warning\" kernel parameter.\n"); | ||
1057 | schedule_timeout_uninterruptible(300 * HZ); | ||
1058 | return 0; | ||
1059 | } | ||
1060 | early_initcall(removal_warning); | ||
1061 | #endif | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 512ce1cde2a4..86e65ec3422b 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -82,21 +82,6 @@ DEFINE_MUTEX(smp_cpu_state_mutex); | |||
82 | /* | 82 | /* |
83 | * Signal processor helper functions. | 83 | * Signal processor helper functions. |
84 | */ | 84 | */ |
85 | static inline int __pcpu_sigp(u16 addr, u8 order, u32 parm, u32 *status) | ||
86 | { | ||
87 | register unsigned int reg1 asm ("1") = parm; | ||
88 | int cc; | ||
89 | |||
90 | asm volatile( | ||
91 | " sigp %1,%2,0(%3)\n" | ||
92 | " ipm %0\n" | ||
93 | " srl %0,28\n" | ||
94 | : "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc"); | ||
95 | if (status && cc == 1) | ||
96 | *status = reg1; | ||
97 | return cc; | ||
98 | } | ||
99 | |||
100 | static inline int __pcpu_sigp_relax(u16 addr, u8 order, u32 parm, u32 *status) | 85 | static inline int __pcpu_sigp_relax(u16 addr, u8 order, u32 parm, u32 *status) |
101 | { | 86 | { |
102 | int cc; | 87 | int cc; |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 542ef488bac1..fe5cdf29a001 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -355,3 +355,4 @@ SYSCALL(sys_kcmp,sys_kcmp,compat_sys_kcmp) | |||
355 | SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module) | 355 | SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module) |
356 | SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ | 356 | SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ |
357 | SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) | 357 | SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) |
358 | SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2) | ||
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index 23f866b4c7f1..7416efe8eae4 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c | |||
@@ -338,9 +338,6 @@ static inline unsigned long strnlen_user_srst(const char __user *src, | |||
338 | register unsigned long reg0 asm("0") = 0; | 338 | register unsigned long reg0 asm("0") = 0; |
339 | unsigned long tmp1, tmp2; | 339 | unsigned long tmp1, tmp2; |
340 | 340 | ||
341 | if (unlikely(!size)) | ||
342 | return 0; | ||
343 | update_primary_asce(current); | ||
344 | asm volatile( | 341 | asm volatile( |
345 | " la %2,0(%1)\n" | 342 | " la %2,0(%1)\n" |
346 | " la %3,0(%0,%1)\n" | 343 | " la %3,0(%0,%1)\n" |
@@ -359,6 +356,8 @@ static inline unsigned long strnlen_user_srst(const char __user *src, | |||
359 | 356 | ||
360 | unsigned long __strnlen_user(const char __user *src, unsigned long size) | 357 | unsigned long __strnlen_user(const char __user *src, unsigned long size) |
361 | { | 358 | { |
359 | if (unlikely(!size)) | ||
360 | return 0; | ||
362 | update_primary_asce(current); | 361 | update_primary_asce(current); |
363 | return strnlen_user_srst(src, size); | 362 | return strnlen_user_srst(src, size); |
364 | } | 363 | } |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 19f623f1f21c..2f51a998a67e 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -126,6 +126,133 @@ static inline int user_space_fault(struct pt_regs *regs) | |||
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
128 | 128 | ||
129 | static int bad_address(void *p) | ||
130 | { | ||
131 | unsigned long dummy; | ||
132 | |||
133 | return probe_kernel_address((unsigned long *)p, dummy); | ||
134 | } | ||
135 | |||
136 | #ifdef CONFIG_64BIT | ||
137 | static void dump_pagetable(unsigned long asce, unsigned long address) | ||
138 | { | ||
139 | unsigned long *table = __va(asce & PAGE_MASK); | ||
140 | |||
141 | pr_alert("AS:%016lx ", asce); | ||
142 | switch (asce & _ASCE_TYPE_MASK) { | ||
143 | case _ASCE_TYPE_REGION1: | ||
144 | table = table + ((address >> 53) & 0x7ff); | ||
145 | if (bad_address(table)) | ||
146 | goto bad; | ||
147 | pr_cont("R1:%016lx ", *table); | ||
148 | if (*table & _REGION_ENTRY_INVALID) | ||
149 | goto out; | ||
150 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
151 | /* fallthrough */ | ||
152 | case _ASCE_TYPE_REGION2: | ||
153 | table = table + ((address >> 42) & 0x7ff); | ||
154 | if (bad_address(table)) | ||
155 | goto bad; | ||
156 | pr_cont("R2:%016lx ", *table); | ||
157 | if (*table & _REGION_ENTRY_INVALID) | ||
158 | goto out; | ||
159 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
160 | /* fallthrough */ | ||
161 | case _ASCE_TYPE_REGION3: | ||
162 | table = table + ((address >> 31) & 0x7ff); | ||
163 | if (bad_address(table)) | ||
164 | goto bad; | ||
165 | pr_cont("R3:%016lx ", *table); | ||
166 | if (*table & (_REGION_ENTRY_INVALID | _REGION3_ENTRY_LARGE)) | ||
167 | goto out; | ||
168 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
169 | /* fallthrough */ | ||
170 | case _ASCE_TYPE_SEGMENT: | ||
171 | table = table + ((address >> 20) & 0x7ff); | ||
172 | if (bad_address(table)) | ||
173 | goto bad; | ||
174 | pr_cont(KERN_CONT "S:%016lx ", *table); | ||
175 | if (*table & (_SEGMENT_ENTRY_INVALID | _SEGMENT_ENTRY_LARGE)) | ||
176 | goto out; | ||
177 | table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN); | ||
178 | } | ||
179 | table = table + ((address >> 12) & 0xff); | ||
180 | if (bad_address(table)) | ||
181 | goto bad; | ||
182 | pr_cont("P:%016lx ", *table); | ||
183 | out: | ||
184 | pr_cont("\n"); | ||
185 | return; | ||
186 | bad: | ||
187 | pr_cont("BAD\n"); | ||
188 | } | ||
189 | |||
190 | #else /* CONFIG_64BIT */ | ||
191 | |||
192 | static void dump_pagetable(unsigned long asce, unsigned long address) | ||
193 | { | ||
194 | unsigned long *table = __va(asce & PAGE_MASK); | ||
195 | |||
196 | pr_alert("AS:%08lx ", asce); | ||
197 | table = table + ((address >> 20) & 0x7ff); | ||
198 | if (bad_address(table)) | ||
199 | goto bad; | ||
200 | pr_cont("S:%08lx ", *table); | ||
201 | if (*table & _SEGMENT_ENTRY_INVALID) | ||
202 | goto out; | ||
203 | table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN); | ||
204 | table = table + ((address >> 12) & 0xff); | ||
205 | if (bad_address(table)) | ||
206 | goto bad; | ||
207 | pr_cont("P:%08lx ", *table); | ||
208 | out: | ||
209 | pr_cont("\n"); | ||
210 | return; | ||
211 | bad: | ||
212 | pr_cont("BAD\n"); | ||
213 | } | ||
214 | |||
215 | #endif /* CONFIG_64BIT */ | ||
216 | |||
217 | static void dump_fault_info(struct pt_regs *regs) | ||
218 | { | ||
219 | unsigned long asce; | ||
220 | |||
221 | pr_alert("Fault in "); | ||
222 | switch (regs->int_parm_long & 3) { | ||
223 | case 3: | ||
224 | pr_cont("home space "); | ||
225 | break; | ||
226 | case 2: | ||
227 | pr_cont("secondary space "); | ||
228 | break; | ||
229 | case 1: | ||
230 | pr_cont("access register "); | ||
231 | break; | ||
232 | case 0: | ||
233 | pr_cont("primary space "); | ||
234 | break; | ||
235 | } | ||
236 | pr_cont("mode while using "); | ||
237 | if (!user_space_fault(regs)) { | ||
238 | asce = S390_lowcore.kernel_asce; | ||
239 | pr_cont("kernel "); | ||
240 | } | ||
241 | #ifdef CONFIG_PGSTE | ||
242 | else if ((current->flags & PF_VCPU) && S390_lowcore.gmap) { | ||
243 | struct gmap *gmap = (struct gmap *)S390_lowcore.gmap; | ||
244 | asce = gmap->asce; | ||
245 | pr_cont("gmap "); | ||
246 | } | ||
247 | #endif | ||
248 | else { | ||
249 | asce = S390_lowcore.user_asce; | ||
250 | pr_cont("user "); | ||
251 | } | ||
252 | pr_cont("ASCE.\n"); | ||
253 | dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK); | ||
254 | } | ||
255 | |||
129 | static inline void report_user_fault(struct pt_regs *regs, long signr) | 256 | static inline void report_user_fault(struct pt_regs *regs, long signr) |
130 | { | 257 | { |
131 | if ((task_pid_nr(current) > 1) && !show_unhandled_signals) | 258 | if ((task_pid_nr(current) > 1) && !show_unhandled_signals) |
@@ -138,8 +265,9 @@ static inline void report_user_fault(struct pt_regs *regs, long signr) | |||
138 | regs->int_code); | 265 | regs->int_code); |
139 | print_vma_addr(KERN_CONT "in ", regs->psw.addr & PSW_ADDR_INSN); | 266 | print_vma_addr(KERN_CONT "in ", regs->psw.addr & PSW_ADDR_INSN); |
140 | printk(KERN_CONT "\n"); | 267 | printk(KERN_CONT "\n"); |
141 | printk(KERN_ALERT "failing address: %lX\n", | 268 | printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n", |
142 | regs->int_parm_long & __FAIL_ADDR_MASK); | 269 | regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); |
270 | dump_fault_info(regs); | ||
143 | show_regs(regs); | 271 | show_regs(regs); |
144 | } | 272 | } |
145 | 273 | ||
@@ -177,11 +305,13 @@ static noinline void do_no_context(struct pt_regs *regs) | |||
177 | address = regs->int_parm_long & __FAIL_ADDR_MASK; | 305 | address = regs->int_parm_long & __FAIL_ADDR_MASK; |
178 | if (!user_space_fault(regs)) | 306 | if (!user_space_fault(regs)) |
179 | printk(KERN_ALERT "Unable to handle kernel pointer dereference" | 307 | printk(KERN_ALERT "Unable to handle kernel pointer dereference" |
180 | " at virtual kernel address %p\n", (void *)address); | 308 | " in virtual kernel address space\n"); |
181 | else | 309 | else |
182 | printk(KERN_ALERT "Unable to handle kernel paging request" | 310 | printk(KERN_ALERT "Unable to handle kernel paging request" |
183 | " at virtual user address %p\n", (void *)address); | 311 | " in virtual user address space\n"); |
184 | 312 | printk(KERN_ALERT "failing address: %016lx TEID: %016lx\n", | |
313 | regs->int_parm_long & __FAIL_ADDR_MASK, regs->int_parm_long); | ||
314 | dump_fault_info(regs); | ||
185 | die(regs, "Oops"); | 315 | die(regs, "Oops"); |
186 | do_exit(SIGKILL); | 316 | do_exit(SIGKILL); |
187 | } | 317 | } |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 602f57e590b5..d1b7c377a234 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -250,8 +250,8 @@ archclean: | |||
250 | PHONY += kvmconfig | 250 | PHONY += kvmconfig |
251 | kvmconfig: | 251 | kvmconfig: |
252 | $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target)) | 252 | $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target)) |
253 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config arch/x86/configs/kvm_guest.config | 253 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(srctree)/arch/x86/configs/kvm_guest.config |
254 | $(Q)yes "" | $(MAKE) oldconfig | 254 | $(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig |
255 | 255 | ||
256 | define archhelp | 256 | define archhelp |
257 | echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' | 257 | echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index fcaf9c961265..7de069afb382 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -60,7 +60,7 @@ | |||
60 | | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ | 60 | | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ |
61 | | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ | 61 | | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ |
62 | | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ | 62 | | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ |
63 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) | 63 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE | X86_CR4_SMAP)) |
64 | 64 | ||
65 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) | 65 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) |
66 | 66 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index eeee23ff75ef..68317c80de7f 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -598,7 +598,6 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) | |||
598 | { | 598 | { |
599 | struct mce m; | 599 | struct mce m; |
600 | int i; | 600 | int i; |
601 | unsigned long *v; | ||
602 | 601 | ||
603 | this_cpu_inc(mce_poll_count); | 602 | this_cpu_inc(mce_poll_count); |
604 | 603 | ||
@@ -618,8 +617,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b) | |||
618 | if (!(m.status & MCI_STATUS_VAL)) | 617 | if (!(m.status & MCI_STATUS_VAL)) |
619 | continue; | 618 | continue; |
620 | 619 | ||
621 | v = &get_cpu_var(mce_polled_error); | 620 | this_cpu_write(mce_polled_error, 1); |
622 | set_bit(0, v); | ||
623 | /* | 621 | /* |
624 | * Uncorrected or signalled events are handled by the exception | 622 | * Uncorrected or signalled events are handled by the exception |
625 | * handler when it is enabled, so don't process those here. | 623 | * handler when it is enabled, so don't process those here. |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c index 3bdb95ae8c43..9a316b21df8b 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c | |||
@@ -42,7 +42,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned); | |||
42 | * cmci_discover_lock protects against parallel discovery attempts | 42 | * cmci_discover_lock protects against parallel discovery attempts |
43 | * which could race against each other. | 43 | * which could race against each other. |
44 | */ | 44 | */ |
45 | static DEFINE_RAW_SPINLOCK(cmci_discover_lock); | 45 | static DEFINE_SPINLOCK(cmci_discover_lock); |
46 | 46 | ||
47 | #define CMCI_THRESHOLD 1 | 47 | #define CMCI_THRESHOLD 1 |
48 | #define CMCI_POLL_INTERVAL (30 * HZ) | 48 | #define CMCI_POLL_INTERVAL (30 * HZ) |
@@ -144,14 +144,14 @@ static void cmci_storm_disable_banks(void) | |||
144 | int bank; | 144 | int bank; |
145 | u64 val; | 145 | u64 val; |
146 | 146 | ||
147 | raw_spin_lock_irqsave(&cmci_discover_lock, flags); | 147 | spin_lock_irqsave(&cmci_discover_lock, flags); |
148 | owned = __get_cpu_var(mce_banks_owned); | 148 | owned = __get_cpu_var(mce_banks_owned); |
149 | for_each_set_bit(bank, owned, MAX_NR_BANKS) { | 149 | for_each_set_bit(bank, owned, MAX_NR_BANKS) { |
150 | rdmsrl(MSR_IA32_MCx_CTL2(bank), val); | 150 | rdmsrl(MSR_IA32_MCx_CTL2(bank), val); |
151 | val &= ~MCI_CTL2_CMCI_EN; | 151 | val &= ~MCI_CTL2_CMCI_EN; |
152 | wrmsrl(MSR_IA32_MCx_CTL2(bank), val); | 152 | wrmsrl(MSR_IA32_MCx_CTL2(bank), val); |
153 | } | 153 | } |
154 | raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); | 154 | spin_unlock_irqrestore(&cmci_discover_lock, flags); |
155 | } | 155 | } |
156 | 156 | ||
157 | static bool cmci_storm_detect(void) | 157 | static bool cmci_storm_detect(void) |
@@ -211,7 +211,7 @@ static void cmci_discover(int banks) | |||
211 | int i; | 211 | int i; |
212 | int bios_wrong_thresh = 0; | 212 | int bios_wrong_thresh = 0; |
213 | 213 | ||
214 | raw_spin_lock_irqsave(&cmci_discover_lock, flags); | 214 | spin_lock_irqsave(&cmci_discover_lock, flags); |
215 | for (i = 0; i < banks; i++) { | 215 | for (i = 0; i < banks; i++) { |
216 | u64 val; | 216 | u64 val; |
217 | int bios_zero_thresh = 0; | 217 | int bios_zero_thresh = 0; |
@@ -266,7 +266,7 @@ static void cmci_discover(int banks) | |||
266 | WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); | 266 | WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); | 269 | spin_unlock_irqrestore(&cmci_discover_lock, flags); |
270 | if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) { | 270 | if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) { |
271 | pr_info_once( | 271 | pr_info_once( |
272 | "bios_cmci_threshold: Some banks do not have valid thresholds set\n"); | 272 | "bios_cmci_threshold: Some banks do not have valid thresholds set\n"); |
@@ -316,10 +316,10 @@ void cmci_clear(void) | |||
316 | 316 | ||
317 | if (!cmci_supported(&banks)) | 317 | if (!cmci_supported(&banks)) |
318 | return; | 318 | return; |
319 | raw_spin_lock_irqsave(&cmci_discover_lock, flags); | 319 | spin_lock_irqsave(&cmci_discover_lock, flags); |
320 | for (i = 0; i < banks; i++) | 320 | for (i = 0; i < banks; i++) |
321 | __cmci_disable_bank(i); | 321 | __cmci_disable_bank(i); |
322 | raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); | 322 | spin_unlock_irqrestore(&cmci_discover_lock, flags); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void cmci_rediscover_work_func(void *arg) | 325 | static void cmci_rediscover_work_func(void *arg) |
@@ -360,9 +360,9 @@ void cmci_disable_bank(int bank) | |||
360 | if (!cmci_supported(&banks)) | 360 | if (!cmci_supported(&banks)) |
361 | return; | 361 | return; |
362 | 362 | ||
363 | raw_spin_lock_irqsave(&cmci_discover_lock, flags); | 363 | spin_lock_irqsave(&cmci_discover_lock, flags); |
364 | __cmci_disable_bank(bank); | 364 | __cmci_disable_bank(bank); |
365 | raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); | 365 | spin_unlock_irqrestore(&cmci_discover_lock, flags); |
366 | } | 366 | } |
367 | 367 | ||
368 | static void intel_init_cmci(void) | 368 | static void intel_init_cmci(void) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index 059218ed5208..7c87424d4140 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | |||
@@ -59,7 +59,7 @@ | |||
59 | #define INTEL_RAPL_PKG 0x2 /* pseudo-encoding */ | 59 | #define INTEL_RAPL_PKG 0x2 /* pseudo-encoding */ |
60 | #define RAPL_IDX_RAM_NRG_STAT 2 /* DRAM */ | 60 | #define RAPL_IDX_RAM_NRG_STAT 2 /* DRAM */ |
61 | #define INTEL_RAPL_RAM 0x3 /* pseudo-encoding */ | 61 | #define INTEL_RAPL_RAM 0x3 /* pseudo-encoding */ |
62 | #define RAPL_IDX_PP1_NRG_STAT 3 /* DRAM */ | 62 | #define RAPL_IDX_PP1_NRG_STAT 3 /* gpu */ |
63 | #define INTEL_RAPL_PP1 0x4 /* pseudo-encoding */ | 63 | #define INTEL_RAPL_PP1 0x4 /* pseudo-encoding */ |
64 | 64 | ||
65 | /* Clients have PP0, PKG */ | 65 | /* Clients have PP0, PKG */ |
@@ -72,6 +72,12 @@ | |||
72 | 1<<RAPL_IDX_PKG_NRG_STAT|\ | 72 | 1<<RAPL_IDX_PKG_NRG_STAT|\ |
73 | 1<<RAPL_IDX_RAM_NRG_STAT) | 73 | 1<<RAPL_IDX_RAM_NRG_STAT) |
74 | 74 | ||
75 | /* Servers have PP0, PKG, RAM, PP1 */ | ||
76 | #define RAPL_IDX_HSW (1<<RAPL_IDX_PP0_NRG_STAT|\ | ||
77 | 1<<RAPL_IDX_PKG_NRG_STAT|\ | ||
78 | 1<<RAPL_IDX_RAM_NRG_STAT|\ | ||
79 | 1<<RAPL_IDX_PP1_NRG_STAT) | ||
80 | |||
75 | /* | 81 | /* |
76 | * event code: LSB 8 bits, passed in attr->config | 82 | * event code: LSB 8 bits, passed in attr->config |
77 | * any other bit is reserved | 83 | * any other bit is reserved |
@@ -425,6 +431,24 @@ static struct attribute *rapl_events_cln_attr[] = { | |||
425 | NULL, | 431 | NULL, |
426 | }; | 432 | }; |
427 | 433 | ||
434 | static struct attribute *rapl_events_hsw_attr[] = { | ||
435 | EVENT_PTR(rapl_cores), | ||
436 | EVENT_PTR(rapl_pkg), | ||
437 | EVENT_PTR(rapl_gpu), | ||
438 | EVENT_PTR(rapl_ram), | ||
439 | |||
440 | EVENT_PTR(rapl_cores_unit), | ||
441 | EVENT_PTR(rapl_pkg_unit), | ||
442 | EVENT_PTR(rapl_gpu_unit), | ||
443 | EVENT_PTR(rapl_ram_unit), | ||
444 | |||
445 | EVENT_PTR(rapl_cores_scale), | ||
446 | EVENT_PTR(rapl_pkg_scale), | ||
447 | EVENT_PTR(rapl_gpu_scale), | ||
448 | EVENT_PTR(rapl_ram_scale), | ||
449 | NULL, | ||
450 | }; | ||
451 | |||
428 | static struct attribute_group rapl_pmu_events_group = { | 452 | static struct attribute_group rapl_pmu_events_group = { |
429 | .name = "events", | 453 | .name = "events", |
430 | .attrs = NULL, /* patched at runtime */ | 454 | .attrs = NULL, /* patched at runtime */ |
@@ -511,6 +535,7 @@ static int rapl_cpu_prepare(int cpu) | |||
511 | struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); | 535 | struct rapl_pmu *pmu = per_cpu(rapl_pmu, cpu); |
512 | int phys_id = topology_physical_package_id(cpu); | 536 | int phys_id = topology_physical_package_id(cpu); |
513 | u64 ms; | 537 | u64 ms; |
538 | u64 msr_rapl_power_unit_bits; | ||
514 | 539 | ||
515 | if (pmu) | 540 | if (pmu) |
516 | return 0; | 541 | return 0; |
@@ -518,6 +543,9 @@ static int rapl_cpu_prepare(int cpu) | |||
518 | if (phys_id < 0) | 543 | if (phys_id < 0) |
519 | return -1; | 544 | return -1; |
520 | 545 | ||
546 | if (!rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) | ||
547 | return -1; | ||
548 | |||
521 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); | 549 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); |
522 | if (!pmu) | 550 | if (!pmu) |
523 | return -1; | 551 | return -1; |
@@ -531,8 +559,7 @@ static int rapl_cpu_prepare(int cpu) | |||
531 | * | 559 | * |
532 | * we cache in local PMU instance | 560 | * we cache in local PMU instance |
533 | */ | 561 | */ |
534 | rdmsrl(MSR_RAPL_POWER_UNIT, pmu->hw_unit); | 562 | pmu->hw_unit = (msr_rapl_power_unit_bits >> 8) & 0x1FULL; |
535 | pmu->hw_unit = (pmu->hw_unit >> 8) & 0x1FULL; | ||
536 | pmu->pmu = &rapl_pmu_class; | 563 | pmu->pmu = &rapl_pmu_class; |
537 | 564 | ||
538 | /* | 565 | /* |
@@ -631,11 +658,14 @@ static int __init rapl_pmu_init(void) | |||
631 | switch (boot_cpu_data.x86_model) { | 658 | switch (boot_cpu_data.x86_model) { |
632 | case 42: /* Sandy Bridge */ | 659 | case 42: /* Sandy Bridge */ |
633 | case 58: /* Ivy Bridge */ | 660 | case 58: /* Ivy Bridge */ |
634 | case 60: /* Haswell */ | ||
635 | case 69: /* Haswell-Celeron */ | ||
636 | rapl_cntr_mask = RAPL_IDX_CLN; | 661 | rapl_cntr_mask = RAPL_IDX_CLN; |
637 | rapl_pmu_events_group.attrs = rapl_events_cln_attr; | 662 | rapl_pmu_events_group.attrs = rapl_events_cln_attr; |
638 | break; | 663 | break; |
664 | case 60: /* Haswell */ | ||
665 | case 69: /* Haswell-Celeron */ | ||
666 | rapl_cntr_mask = RAPL_IDX_HSW; | ||
667 | rapl_pmu_events_group.attrs = rapl_events_hsw_attr; | ||
668 | break; | ||
639 | case 45: /* Sandy Bridge-EP */ | 669 | case 45: /* Sandy Bridge-EP */ |
640 | case 62: /* IvyTown */ | 670 | case 62: /* IvyTown */ |
641 | rapl_cntr_mask = RAPL_IDX_SRV; | 671 | rapl_cntr_mask = RAPL_IDX_SRV; |
@@ -650,7 +680,9 @@ static int __init rapl_pmu_init(void) | |||
650 | cpu_notifier_register_begin(); | 680 | cpu_notifier_register_begin(); |
651 | 681 | ||
652 | for_each_online_cpu(cpu) { | 682 | for_each_online_cpu(cpu) { |
653 | rapl_cpu_prepare(cpu); | 683 | ret = rapl_cpu_prepare(cpu); |
684 | if (ret) | ||
685 | goto out; | ||
654 | rapl_cpu_init(cpu); | 686 | rapl_cpu_init(cpu); |
655 | } | 687 | } |
656 | 688 | ||
@@ -673,6 +705,7 @@ static int __init rapl_pmu_init(void) | |||
673 | hweight32(rapl_cntr_mask), | 705 | hweight32(rapl_cntr_mask), |
674 | ktime_to_ms(pmu->timer_interval)); | 706 | ktime_to_ms(pmu->timer_interval)); |
675 | 707 | ||
708 | out: | ||
676 | cpu_notifier_register_done(); | 709 | cpu_notifier_register_done(); |
677 | 710 | ||
678 | return 0; | 711 | return 0; |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index b0cc3809723d..6e2537c32190 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -240,7 +240,7 @@ static u32 __init intel_stolen_base(int num, int slot, int func, size_t stolen_s | |||
240 | return base; | 240 | return base; |
241 | } | 241 | } |
242 | 242 | ||
243 | #define KB(x) ((x) * 1024) | 243 | #define KB(x) ((x) * 1024UL) |
244 | #define MB(x) (KB (KB (x))) | 244 | #define MB(x) (KB (KB (x))) |
245 | #define GB(x) (MB (KB (x))) | 245 | #define GB(x) (MB (KB (x))) |
246 | 246 | ||
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 79a3f9682871..61b17dc2c277 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -897,9 +897,10 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
897 | struct kprobe *cur = kprobe_running(); | 897 | struct kprobe *cur = kprobe_running(); |
898 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 898 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
899 | 899 | ||
900 | switch (kcb->kprobe_status) { | 900 | if (unlikely(regs->ip == (unsigned long)cur->ainsn.insn)) { |
901 | case KPROBE_HIT_SS: | 901 | /* This must happen on single-stepping */ |
902 | case KPROBE_REENTER: | 902 | WARN_ON(kcb->kprobe_status != KPROBE_HIT_SS && |
903 | kcb->kprobe_status != KPROBE_REENTER); | ||
903 | /* | 904 | /* |
904 | * We are here because the instruction being single | 905 | * We are here because the instruction being single |
905 | * stepped caused a page fault. We reset the current | 906 | * stepped caused a page fault. We reset the current |
@@ -914,9 +915,8 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
914 | else | 915 | else |
915 | reset_current_kprobe(); | 916 | reset_current_kprobe(); |
916 | preempt_enable_no_resched(); | 917 | preempt_enable_no_resched(); |
917 | break; | 918 | } else if (kcb->kprobe_status == KPROBE_HIT_ACTIVE || |
918 | case KPROBE_HIT_ACTIVE: | 919 | kcb->kprobe_status == KPROBE_HIT_SSDONE) { |
919 | case KPROBE_HIT_SSDONE: | ||
920 | /* | 920 | /* |
921 | * We increment the nmissed count for accounting, | 921 | * We increment the nmissed count for accounting, |
922 | * we can also use npre/npostfault count for accounting | 922 | * we can also use npre/npostfault count for accounting |
@@ -945,10 +945,8 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
945 | * fixup routine could not handle it, | 945 | * fixup routine could not handle it, |
946 | * Let do_page_fault() fix it. | 946 | * Let do_page_fault() fix it. |
947 | */ | 947 | */ |
948 | break; | ||
949 | default: | ||
950 | break; | ||
951 | } | 948 | } |
949 | |||
952 | return 0; | 950 | return 0; |
953 | } | 951 | } |
954 | 952 | ||
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 654b46574b91..3399d3a99730 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -114,8 +114,8 @@ EXPORT_SYMBOL(machine_real_restart); | |||
114 | */ | 114 | */ |
115 | static int __init set_pci_reboot(const struct dmi_system_id *d) | 115 | static int __init set_pci_reboot(const struct dmi_system_id *d) |
116 | { | 116 | { |
117 | if (reboot_type != BOOT_CF9) { | 117 | if (reboot_type != BOOT_CF9_FORCE) { |
118 | reboot_type = BOOT_CF9; | 118 | reboot_type = BOOT_CF9_FORCE; |
119 | pr_info("%s series board detected. Selecting %s-method for reboots.\n", | 119 | pr_info("%s series board detected. Selecting %s-method for reboots.\n", |
120 | d->ident, "PCI"); | 120 | d->ident, "PCI"); |
121 | } | 121 | } |
@@ -458,20 +458,23 @@ void __attribute__((weak)) mach_reboot_fixups(void) | |||
458 | } | 458 | } |
459 | 459 | ||
460 | /* | 460 | /* |
461 | * Windows compatible x86 hardware expects the following on reboot: | 461 | * To the best of our knowledge Windows compatible x86 hardware expects |
462 | * the following on reboot: | ||
462 | * | 463 | * |
463 | * 1) If the FADT has the ACPI reboot register flag set, try it | 464 | * 1) If the FADT has the ACPI reboot register flag set, try it |
464 | * 2) If still alive, write to the keyboard controller | 465 | * 2) If still alive, write to the keyboard controller |
465 | * 3) If still alive, write to the ACPI reboot register again | 466 | * 3) If still alive, write to the ACPI reboot register again |
466 | * 4) If still alive, write to the keyboard controller again | 467 | * 4) If still alive, write to the keyboard controller again |
467 | * 5) If still alive, call the EFI runtime service to reboot | 468 | * 5) If still alive, call the EFI runtime service to reboot |
468 | * 6) If still alive, write to the PCI IO port 0xCF9 to reboot | 469 | * 6) If no EFI runtime service, call the BIOS to do a reboot |
469 | * 7) If still alive, inform BIOS to do a proper reboot | ||
470 | * | 470 | * |
471 | * If the machine is still alive at this stage, it gives up. We default to | 471 | * We default to following the same pattern. We also have |
472 | * following the same pattern, except that if we're still alive after (7) we'll | 472 | * two other reboot methods: 'triple fault' and 'PCI', which |
473 | * try to force a triple fault and then cycle between hitting the keyboard | 473 | * can be triggered via the reboot= kernel boot option or |
474 | * controller and doing that | 474 | * via quirks. |
475 | * | ||
476 | * This means that this function can never return, it can misbehave | ||
477 | * by not rebooting properly and hanging. | ||
475 | */ | 478 | */ |
476 | static void native_machine_emergency_restart(void) | 479 | static void native_machine_emergency_restart(void) |
477 | { | 480 | { |
@@ -492,6 +495,11 @@ static void native_machine_emergency_restart(void) | |||
492 | for (;;) { | 495 | for (;;) { |
493 | /* Could also try the reset bit in the Hammer NB */ | 496 | /* Could also try the reset bit in the Hammer NB */ |
494 | switch (reboot_type) { | 497 | switch (reboot_type) { |
498 | case BOOT_ACPI: | ||
499 | acpi_reboot(); | ||
500 | reboot_type = BOOT_KBD; | ||
501 | break; | ||
502 | |||
495 | case BOOT_KBD: | 503 | case BOOT_KBD: |
496 | mach_reboot_fixups(); /* For board specific fixups */ | 504 | mach_reboot_fixups(); /* For board specific fixups */ |
497 | 505 | ||
@@ -509,43 +517,29 @@ static void native_machine_emergency_restart(void) | |||
509 | } | 517 | } |
510 | break; | 518 | break; |
511 | 519 | ||
512 | case BOOT_TRIPLE: | ||
513 | load_idt(&no_idt); | ||
514 | __asm__ __volatile__("int3"); | ||
515 | |||
516 | /* We're probably dead after this, but... */ | ||
517 | reboot_type = BOOT_KBD; | ||
518 | break; | ||
519 | |||
520 | case BOOT_BIOS: | ||
521 | machine_real_restart(MRR_BIOS); | ||
522 | |||
523 | /* We're probably dead after this, but... */ | ||
524 | reboot_type = BOOT_TRIPLE; | ||
525 | break; | ||
526 | |||
527 | case BOOT_ACPI: | ||
528 | acpi_reboot(); | ||
529 | reboot_type = BOOT_KBD; | ||
530 | break; | ||
531 | |||
532 | case BOOT_EFI: | 520 | case BOOT_EFI: |
533 | if (efi_enabled(EFI_RUNTIME_SERVICES)) | 521 | if (efi_enabled(EFI_RUNTIME_SERVICES)) |
534 | efi.reset_system(reboot_mode == REBOOT_WARM ? | 522 | efi.reset_system(reboot_mode == REBOOT_WARM ? |
535 | EFI_RESET_WARM : | 523 | EFI_RESET_WARM : |
536 | EFI_RESET_COLD, | 524 | EFI_RESET_COLD, |
537 | EFI_SUCCESS, 0, NULL); | 525 | EFI_SUCCESS, 0, NULL); |
538 | reboot_type = BOOT_CF9_COND; | 526 | reboot_type = BOOT_BIOS; |
527 | break; | ||
528 | |||
529 | case BOOT_BIOS: | ||
530 | machine_real_restart(MRR_BIOS); | ||
531 | |||
532 | /* We're probably dead after this, but... */ | ||
533 | reboot_type = BOOT_CF9_SAFE; | ||
539 | break; | 534 | break; |
540 | 535 | ||
541 | case BOOT_CF9: | 536 | case BOOT_CF9_FORCE: |
542 | port_cf9_safe = true; | 537 | port_cf9_safe = true; |
543 | /* Fall through */ | 538 | /* Fall through */ |
544 | 539 | ||
545 | case BOOT_CF9_COND: | 540 | case BOOT_CF9_SAFE: |
546 | if (port_cf9_safe) { | 541 | if (port_cf9_safe) { |
547 | u8 reboot_code = reboot_mode == REBOOT_WARM ? | 542 | u8 reboot_code = reboot_mode == REBOOT_WARM ? 0x06 : 0x0E; |
548 | 0x06 : 0x0E; | ||
549 | u8 cf9 = inb(0xcf9) & ~reboot_code; | 543 | u8 cf9 = inb(0xcf9) & ~reboot_code; |
550 | outb(cf9|2, 0xcf9); /* Request hard reset */ | 544 | outb(cf9|2, 0xcf9); /* Request hard reset */ |
551 | udelay(50); | 545 | udelay(50); |
@@ -553,7 +547,15 @@ static void native_machine_emergency_restart(void) | |||
553 | outb(cf9|reboot_code, 0xcf9); | 547 | outb(cf9|reboot_code, 0xcf9); |
554 | udelay(50); | 548 | udelay(50); |
555 | } | 549 | } |
556 | reboot_type = BOOT_BIOS; | 550 | reboot_type = BOOT_TRIPLE; |
551 | break; | ||
552 | |||
553 | case BOOT_TRIPLE: | ||
554 | load_idt(&no_idt); | ||
555 | __asm__ __volatile__("int3"); | ||
556 | |||
557 | /* We're probably dead after this, but... */ | ||
558 | reboot_type = BOOT_KBD; | ||
557 | break; | 559 | break; |
558 | } | 560 | } |
559 | } | 561 | } |
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index bea60671ef8a..f47a104a749c 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -308,7 +308,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
308 | const u32 kvm_supported_word9_x86_features = | 308 | const u32 kvm_supported_word9_x86_features = |
309 | F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | | 309 | F(FSGSBASE) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | |
310 | F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | f_mpx | F(RDSEED) | | 310 | F(BMI2) | F(ERMS) | f_invpcid | F(RTM) | f_mpx | F(RDSEED) | |
311 | F(ADX); | 311 | F(ADX) | F(SMAP); |
312 | 312 | ||
313 | /* all calls to cpuid_count() should be made on the same cpu */ | 313 | /* all calls to cpuid_count() should be made on the same cpu */ |
314 | get_cpu(); | 314 | get_cpu(); |
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h index a2a1bb7ed8c1..eeecbed26ac7 100644 --- a/arch/x86/kvm/cpuid.h +++ b/arch/x86/kvm/cpuid.h | |||
@@ -48,6 +48,14 @@ static inline bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu) | |||
48 | return best && (best->ebx & bit(X86_FEATURE_SMEP)); | 48 | return best && (best->ebx & bit(X86_FEATURE_SMEP)); |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline bool guest_cpuid_has_smap(struct kvm_vcpu *vcpu) | ||
52 | { | ||
53 | struct kvm_cpuid_entry2 *best; | ||
54 | |||
55 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | ||
56 | return best && (best->ebx & bit(X86_FEATURE_SMAP)); | ||
57 | } | ||
58 | |||
51 | static inline bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu) | 59 | static inline bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu) |
52 | { | 60 | { |
53 | struct kvm_cpuid_entry2 *best; | 61 | struct kvm_cpuid_entry2 *best; |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index f5704d9e5ddc..813d31038b93 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -3601,20 +3601,27 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu, | |||
3601 | } | 3601 | } |
3602 | } | 3602 | } |
3603 | 3603 | ||
3604 | static void update_permission_bitmask(struct kvm_vcpu *vcpu, | 3604 | void update_permission_bitmask(struct kvm_vcpu *vcpu, |
3605 | struct kvm_mmu *mmu, bool ept) | 3605 | struct kvm_mmu *mmu, bool ept) |
3606 | { | 3606 | { |
3607 | unsigned bit, byte, pfec; | 3607 | unsigned bit, byte, pfec; |
3608 | u8 map; | 3608 | u8 map; |
3609 | bool fault, x, w, u, wf, uf, ff, smep; | 3609 | bool fault, x, w, u, wf, uf, ff, smapf, cr4_smap, cr4_smep, smap = 0; |
3610 | 3610 | ||
3611 | smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); | 3611 | cr4_smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); |
3612 | cr4_smap = kvm_read_cr4_bits(vcpu, X86_CR4_SMAP); | ||
3612 | for (byte = 0; byte < ARRAY_SIZE(mmu->permissions); ++byte) { | 3613 | for (byte = 0; byte < ARRAY_SIZE(mmu->permissions); ++byte) { |
3613 | pfec = byte << 1; | 3614 | pfec = byte << 1; |
3614 | map = 0; | 3615 | map = 0; |
3615 | wf = pfec & PFERR_WRITE_MASK; | 3616 | wf = pfec & PFERR_WRITE_MASK; |
3616 | uf = pfec & PFERR_USER_MASK; | 3617 | uf = pfec & PFERR_USER_MASK; |
3617 | ff = pfec & PFERR_FETCH_MASK; | 3618 | ff = pfec & PFERR_FETCH_MASK; |
3619 | /* | ||
3620 | * PFERR_RSVD_MASK bit is set in PFEC if the access is not | ||
3621 | * subject to SMAP restrictions, and cleared otherwise. The | ||
3622 | * bit is only meaningful if the SMAP bit is set in CR4. | ||
3623 | */ | ||
3624 | smapf = !(pfec & PFERR_RSVD_MASK); | ||
3618 | for (bit = 0; bit < 8; ++bit) { | 3625 | for (bit = 0; bit < 8; ++bit) { |
3619 | x = bit & ACC_EXEC_MASK; | 3626 | x = bit & ACC_EXEC_MASK; |
3620 | w = bit & ACC_WRITE_MASK; | 3627 | w = bit & ACC_WRITE_MASK; |
@@ -3626,12 +3633,33 @@ static void update_permission_bitmask(struct kvm_vcpu *vcpu, | |||
3626 | /* Allow supervisor writes if !cr0.wp */ | 3633 | /* Allow supervisor writes if !cr0.wp */ |
3627 | w |= !is_write_protection(vcpu) && !uf; | 3634 | w |= !is_write_protection(vcpu) && !uf; |
3628 | /* Disallow supervisor fetches of user code if cr4.smep */ | 3635 | /* Disallow supervisor fetches of user code if cr4.smep */ |
3629 | x &= !(smep && u && !uf); | 3636 | x &= !(cr4_smep && u && !uf); |
3637 | |||
3638 | /* | ||
3639 | * SMAP:kernel-mode data accesses from user-mode | ||
3640 | * mappings should fault. A fault is considered | ||
3641 | * as a SMAP violation if all of the following | ||
3642 | * conditions are ture: | ||
3643 | * - X86_CR4_SMAP is set in CR4 | ||
3644 | * - An user page is accessed | ||
3645 | * - Page fault in kernel mode | ||
3646 | * - if CPL = 3 or X86_EFLAGS_AC is clear | ||
3647 | * | ||
3648 | * Here, we cover the first three conditions. | ||
3649 | * The fourth is computed dynamically in | ||
3650 | * permission_fault() and is in smapf. | ||
3651 | * | ||
3652 | * Also, SMAP does not affect instruction | ||
3653 | * fetches, add the !ff check here to make it | ||
3654 | * clearer. | ||
3655 | */ | ||
3656 | smap = cr4_smap && u && !uf && !ff; | ||
3630 | } else | 3657 | } else |
3631 | /* Not really needed: no U/S accesses on ept */ | 3658 | /* Not really needed: no U/S accesses on ept */ |
3632 | u = 1; | 3659 | u = 1; |
3633 | 3660 | ||
3634 | fault = (ff && !x) || (uf && !u) || (wf && !w); | 3661 | fault = (ff && !x) || (uf && !u) || (wf && !w) || |
3662 | (smapf && smap); | ||
3635 | map |= fault << bit; | 3663 | map |= fault << bit; |
3636 | } | 3664 | } |
3637 | mmu->permissions[byte] = map; | 3665 | mmu->permissions[byte] = map; |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 292615274358..3842e70bdb7c 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -44,11 +44,17 @@ | |||
44 | #define PT_DIRECTORY_LEVEL 2 | 44 | #define PT_DIRECTORY_LEVEL 2 |
45 | #define PT_PAGE_TABLE_LEVEL 1 | 45 | #define PT_PAGE_TABLE_LEVEL 1 |
46 | 46 | ||
47 | #define PFERR_PRESENT_MASK (1U << 0) | 47 | #define PFERR_PRESENT_BIT 0 |
48 | #define PFERR_WRITE_MASK (1U << 1) | 48 | #define PFERR_WRITE_BIT 1 |
49 | #define PFERR_USER_MASK (1U << 2) | 49 | #define PFERR_USER_BIT 2 |
50 | #define PFERR_RSVD_MASK (1U << 3) | 50 | #define PFERR_RSVD_BIT 3 |
51 | #define PFERR_FETCH_MASK (1U << 4) | 51 | #define PFERR_FETCH_BIT 4 |
52 | |||
53 | #define PFERR_PRESENT_MASK (1U << PFERR_PRESENT_BIT) | ||
54 | #define PFERR_WRITE_MASK (1U << PFERR_WRITE_BIT) | ||
55 | #define PFERR_USER_MASK (1U << PFERR_USER_BIT) | ||
56 | #define PFERR_RSVD_MASK (1U << PFERR_RSVD_BIT) | ||
57 | #define PFERR_FETCH_MASK (1U << PFERR_FETCH_BIT) | ||
52 | 58 | ||
53 | int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); | 59 | int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); |
54 | void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask); | 60 | void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask); |
@@ -73,6 +79,8 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); | |||
73 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context); | 79 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context); |
74 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context, | 80 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context, |
75 | bool execonly); | 81 | bool execonly); |
82 | void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | ||
83 | bool ept); | ||
76 | 84 | ||
77 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) | 85 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) |
78 | { | 86 | { |
@@ -110,10 +118,30 @@ static inline bool is_write_protection(struct kvm_vcpu *vcpu) | |||
110 | * Will a fault with a given page-fault error code (pfec) cause a permission | 118 | * Will a fault with a given page-fault error code (pfec) cause a permission |
111 | * fault with the given access (in ACC_* format)? | 119 | * fault with the given access (in ACC_* format)? |
112 | */ | 120 | */ |
113 | static inline bool permission_fault(struct kvm_mmu *mmu, unsigned pte_access, | 121 | static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
114 | unsigned pfec) | 122 | unsigned pte_access, unsigned pfec) |
115 | { | 123 | { |
116 | return (mmu->permissions[pfec >> 1] >> pte_access) & 1; | 124 | int cpl = kvm_x86_ops->get_cpl(vcpu); |
125 | unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); | ||
126 | |||
127 | /* | ||
128 | * If CPL < 3, SMAP prevention are disabled if EFLAGS.AC = 1. | ||
129 | * | ||
130 | * If CPL = 3, SMAP applies to all supervisor-mode data accesses | ||
131 | * (these are implicit supervisor accesses) regardless of the value | ||
132 | * of EFLAGS.AC. | ||
133 | * | ||
134 | * This computes (cpl < 3) && (rflags & X86_EFLAGS_AC), leaving | ||
135 | * the result in X86_EFLAGS_AC. We then insert it in place of | ||
136 | * the PFERR_RSVD_MASK bit; this bit will always be zero in pfec, | ||
137 | * but it will be one in index if SMAP checks are being overridden. | ||
138 | * It is important to keep this branchless. | ||
139 | */ | ||
140 | unsigned long smap = (cpl - 3) & (rflags & X86_EFLAGS_AC); | ||
141 | int index = (pfec >> 1) + | ||
142 | (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); | ||
143 | |||
144 | return (mmu->permissions[index] >> pte_access) & 1; | ||
117 | } | 145 | } |
118 | 146 | ||
119 | void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm); | 147 | void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm); |
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index b1e6c1bf68d3..123efd3ec29f 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -353,7 +353,7 @@ retry_walk: | |||
353 | walker->ptes[walker->level - 1] = pte; | 353 | walker->ptes[walker->level - 1] = pte; |
354 | } while (!is_last_gpte(mmu, walker->level, pte)); | 354 | } while (!is_last_gpte(mmu, walker->level, pte)); |
355 | 355 | ||
356 | if (unlikely(permission_fault(mmu, pte_access, access))) { | 356 | if (unlikely(permission_fault(vcpu, mmu, pte_access, access))) { |
357 | errcode |= PFERR_PRESENT_MASK; | 357 | errcode |= PFERR_PRESENT_MASK; |
358 | goto error; | 358 | goto error; |
359 | } | 359 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1320e0f8e611..1f68c5831924 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3484,13 +3484,14 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
3484 | hw_cr4 &= ~X86_CR4_PAE; | 3484 | hw_cr4 &= ~X86_CR4_PAE; |
3485 | hw_cr4 |= X86_CR4_PSE; | 3485 | hw_cr4 |= X86_CR4_PSE; |
3486 | /* | 3486 | /* |
3487 | * SMEP is disabled if CPU is in non-paging mode in | 3487 | * SMEP/SMAP is disabled if CPU is in non-paging mode |
3488 | * hardware. However KVM always uses paging mode to | 3488 | * in hardware. However KVM always uses paging mode to |
3489 | * emulate guest non-paging mode with TDP. | 3489 | * emulate guest non-paging mode with TDP. |
3490 | * To emulate this behavior, SMEP needs to be manually | 3490 | * To emulate this behavior, SMEP/SMAP needs to be |
3491 | * disabled when guest switches to non-paging mode. | 3491 | * manually disabled when guest switches to non-paging |
3492 | * mode. | ||
3492 | */ | 3493 | */ |
3493 | hw_cr4 &= ~X86_CR4_SMEP; | 3494 | hw_cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP); |
3494 | } else if (!(cr4 & X86_CR4_PAE)) { | 3495 | } else if (!(cr4 & X86_CR4_PAE)) { |
3495 | hw_cr4 &= ~X86_CR4_PAE; | 3496 | hw_cr4 &= ~X86_CR4_PAE; |
3496 | } | 3497 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9d1b5cd4d34c..8b8fc0b792ba 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -652,6 +652,9 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
652 | if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) | 652 | if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) |
653 | return 1; | 653 | return 1; |
654 | 654 | ||
655 | if (!guest_cpuid_has_smap(vcpu) && (cr4 & X86_CR4_SMAP)) | ||
656 | return 1; | ||
657 | |||
655 | if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_FSGSBASE)) | 658 | if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_FSGSBASE)) |
656 | return 1; | 659 | return 1; |
657 | 660 | ||
@@ -680,6 +683,9 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
680 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) | 683 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) |
681 | kvm_mmu_reset_context(vcpu); | 684 | kvm_mmu_reset_context(vcpu); |
682 | 685 | ||
686 | if ((cr4 ^ old_cr4) & X86_CR4_SMAP) | ||
687 | update_permission_bitmask(vcpu, vcpu->arch.walk_mmu, false); | ||
688 | |||
683 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) | 689 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) |
684 | kvm_update_cpuid(vcpu); | 690 | kvm_update_cpuid(vcpu); |
685 | 691 | ||
@@ -1117,7 +1123,6 @@ static inline u64 get_kernel_ns(void) | |||
1117 | { | 1123 | { |
1118 | struct timespec ts; | 1124 | struct timespec ts; |
1119 | 1125 | ||
1120 | WARN_ON(preemptible()); | ||
1121 | ktime_get_ts(&ts); | 1126 | ktime_get_ts(&ts); |
1122 | monotonic_to_bootbased(&ts); | 1127 | monotonic_to_bootbased(&ts); |
1123 | return timespec_to_ns(&ts); | 1128 | return timespec_to_ns(&ts); |
@@ -4164,7 +4169,8 @@ static int vcpu_mmio_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva, | |||
4164 | | (write ? PFERR_WRITE_MASK : 0); | 4169 | | (write ? PFERR_WRITE_MASK : 0); |
4165 | 4170 | ||
4166 | if (vcpu_match_mmio_gva(vcpu, gva) | 4171 | if (vcpu_match_mmio_gva(vcpu, gva) |
4167 | && !permission_fault(vcpu->arch.walk_mmu, vcpu->arch.access, access)) { | 4172 | && !permission_fault(vcpu, vcpu->arch.walk_mmu, |
4173 | vcpu->arch.access, access)) { | ||
4168 | *gpa = vcpu->arch.mmio_gfn << PAGE_SHIFT | | 4174 | *gpa = vcpu->arch.mmio_gfn << PAGE_SHIFT | |
4169 | (gva & (PAGE_SIZE - 1)); | 4175 | (gva & (PAGE_SIZE - 1)); |
4170 | trace_vcpu_match_mmio(gva, *gpa, write, false); | 4176 | trace_vcpu_match_mmio(gva, *gpa, write, false); |
diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile index f325af26107c..3323c2745248 100644 --- a/arch/x86/syscalls/Makefile +++ b/arch/x86/syscalls/Makefile | |||
@@ -54,5 +54,7 @@ syshdr-$(CONFIG_X86_64) += syscalls_64.h | |||
54 | 54 | ||
55 | targets += $(uapisyshdr-y) $(syshdr-y) | 55 | targets += $(uapisyshdr-y) $(syshdr-y) |
56 | 56 | ||
57 | PHONY += all | ||
57 | all: $(addprefix $(uapi)/,$(uapisyshdr-y)) | 58 | all: $(addprefix $(uapi)/,$(uapisyshdr-y)) |
58 | all: $(addprefix $(out)/,$(syshdr-y)) | 59 | all: $(addprefix $(out)/,$(syshdr-y)) |
60 | @: | ||
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index 96bc506ac6de..d6b867921612 100644 --- a/arch/x86/syscalls/syscall_32.tbl +++ b/arch/x86/syscalls/syscall_32.tbl | |||
@@ -359,3 +359,4 @@ | |||
359 | 350 i386 finit_module sys_finit_module | 359 | 350 i386 finit_module sys_finit_module |
360 | 351 i386 sched_setattr sys_sched_setattr | 360 | 351 i386 sched_setattr sys_sched_setattr |
361 | 352 i386 sched_getattr sys_sched_getattr | 361 | 352 i386 sched_getattr sys_sched_getattr |
362 | 353 i386 renameat2 sys_renameat2 | ||
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile index e8120346903b..604a37efd4d5 100644 --- a/arch/x86/tools/Makefile +++ b/arch/x86/tools/Makefile | |||
@@ -40,4 +40,6 @@ $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/ina | |||
40 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | 40 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
41 | hostprogs-y += relocs | 41 | hostprogs-y += relocs |
42 | relocs-objs := relocs_32.o relocs_64.o relocs_common.o | 42 | relocs-objs := relocs_32.o relocs_64.o relocs_common.o |
43 | PHONY += relocs | ||
43 | relocs: $(obj)/relocs | 44 | relocs: $(obj)/relocs |
45 | @: | ||
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index a18eadd8bb40..7005974c3ff3 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -441,10 +441,11 @@ static int xen_cpu_up(unsigned int cpu, struct task_struct *idle) | |||
441 | irq_ctx_init(cpu); | 441 | irq_ctx_init(cpu); |
442 | #else | 442 | #else |
443 | clear_tsk_thread_flag(idle, TIF_FORK); | 443 | clear_tsk_thread_flag(idle, TIF_FORK); |
444 | #endif | ||
444 | per_cpu(kernel_stack, cpu) = | 445 | per_cpu(kernel_stack, cpu) = |
445 | (unsigned long)task_stack_page(idle) - | 446 | (unsigned long)task_stack_page(idle) - |
446 | KERNEL_STACK_OFFSET + THREAD_SIZE; | 447 | KERNEL_STACK_OFFSET + THREAD_SIZE; |
447 | #endif | 448 | |
448 | xen_setup_runstate_info(cpu); | 449 | xen_setup_runstate_info(cpu); |
449 | xen_setup_timer(cpu); | 450 | xen_setup_timer(cpu); |
450 | xen_init_lock_cpu(cpu); | 451 | xen_init_lock_cpu(cpu); |
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c index 4d3acc34a998..0ba5f3b967f0 100644 --- a/arch/x86/xen/spinlock.c +++ b/arch/x86/xen/spinlock.c | |||
@@ -274,7 +274,7 @@ void __init xen_init_spinlocks(void) | |||
274 | printk(KERN_DEBUG "xen: PV spinlocks disabled\n"); | 274 | printk(KERN_DEBUG "xen: PV spinlocks disabled\n"); |
275 | return; | 275 | return; |
276 | } | 276 | } |
277 | 277 | printk(KERN_DEBUG "xen: PV spinlocks enabled\n"); | |
278 | pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning); | 278 | pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning); |
279 | pv_lock_ops.unlock_kick = xen_unlock_kick; | 279 | pv_lock_ops.unlock_kick = xen_unlock_kick; |
280 | } | 280 | } |
@@ -290,6 +290,9 @@ static __init int xen_init_spinlocks_jump(void) | |||
290 | if (!xen_pvspin) | 290 | if (!xen_pvspin) |
291 | return 0; | 291 | return 0; |
292 | 292 | ||
293 | if (!xen_domain()) | ||
294 | return 0; | ||
295 | |||
293 | static_key_slow_inc(¶virt_ticketlocks_enabled); | 296 | static_key_slow_inc(¶virt_ticketlocks_enabled); |
294 | return 0; | 297 | return 0; |
295 | } | 298 | } |
diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S index 33ca6e42a4ca..fd92a64d748e 100644 --- a/arch/x86/xen/xen-asm_32.S +++ b/arch/x86/xen/xen-asm_32.S | |||
@@ -75,6 +75,17 @@ ENDPROC(xen_sysexit) | |||
75 | * stack state in whatever form its in, we keep things simple by only | 75 | * stack state in whatever form its in, we keep things simple by only |
76 | * using a single register which is pushed/popped on the stack. | 76 | * using a single register which is pushed/popped on the stack. |
77 | */ | 77 | */ |
78 | |||
79 | .macro POP_FS | ||
80 | 1: | ||
81 | popw %fs | ||
82 | .pushsection .fixup, "ax" | ||
83 | 2: movw $0, (%esp) | ||
84 | jmp 1b | ||
85 | .popsection | ||
86 | _ASM_EXTABLE(1b,2b) | ||
87 | .endm | ||
88 | |||
78 | ENTRY(xen_iret) | 89 | ENTRY(xen_iret) |
79 | /* test eflags for special cases */ | 90 | /* test eflags for special cases */ |
80 | testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp) | 91 | testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp) |
@@ -83,15 +94,13 @@ ENTRY(xen_iret) | |||
83 | push %eax | 94 | push %eax |
84 | ESP_OFFSET=4 # bytes pushed onto stack | 95 | ESP_OFFSET=4 # bytes pushed onto stack |
85 | 96 | ||
86 | /* | 97 | /* Store vcpu_info pointer for easy access */ |
87 | * Store vcpu_info pointer for easy access. Do it this way to | ||
88 | * avoid having to reload %fs | ||
89 | */ | ||
90 | #ifdef CONFIG_SMP | 98 | #ifdef CONFIG_SMP |
91 | GET_THREAD_INFO(%eax) | 99 | pushw %fs |
92 | movl %ss:TI_cpu(%eax), %eax | 100 | movl $(__KERNEL_PERCPU), %eax |
93 | movl %ss:__per_cpu_offset(,%eax,4), %eax | 101 | movl %eax, %fs |
94 | mov %ss:xen_vcpu(%eax), %eax | 102 | movl %fs:xen_vcpu, %eax |
103 | POP_FS | ||
95 | #else | 104 | #else |
96 | movl %ss:xen_vcpu, %eax | 105 | movl %ss:xen_vcpu, %eax |
97 | #endif | 106 | #endif |
diff --git a/drivers/Makefile b/drivers/Makefile index e3ced91b1784..d05d81b19b50 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -53,8 +53,8 @@ obj-y += gpu/ | |||
53 | obj-$(CONFIG_CONNECTOR) += connector/ | 53 | obj-$(CONFIG_CONNECTOR) += connector/ |
54 | 54 | ||
55 | # i810fb and intelfb depend on char/agp/ | 55 | # i810fb and intelfb depend on char/agp/ |
56 | obj-$(CONFIG_FB_I810) += video/i810/ | 56 | obj-$(CONFIG_FB_I810) += video/fbdev/i810/ |
57 | obj-$(CONFIG_FB_INTEL) += video/intelfb/ | 57 | obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ |
58 | 58 | ||
59 | obj-$(CONFIG_PARPORT) += parport/ | 59 | obj-$(CONFIG_PARPORT) += parport/ |
60 | obj-y += base/ block/ misc/ mfd/ nfc/ | 60 | obj-y += base/ block/ misc/ mfd/ nfc/ |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 0dd65281cc65..20da3ad1696b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -614,39 +614,6 @@ void device_remove_bin_file(struct device *dev, | |||
614 | } | 614 | } |
615 | EXPORT_SYMBOL_GPL(device_remove_bin_file); | 615 | EXPORT_SYMBOL_GPL(device_remove_bin_file); |
616 | 616 | ||
617 | /** | ||
618 | * device_schedule_callback_owner - helper to schedule a callback for a device | ||
619 | * @dev: device. | ||
620 | * @func: callback function to invoke later. | ||
621 | * @owner: module owning the callback routine | ||
622 | * | ||
623 | * Attribute methods must not unregister themselves or their parent device | ||
624 | * (which would amount to the same thing). Attempts to do so will deadlock, | ||
625 | * since unregistration is mutually exclusive with driver callbacks. | ||
626 | * | ||
627 | * Instead methods can call this routine, which will attempt to allocate | ||
628 | * and schedule a workqueue request to call back @func with @dev as its | ||
629 | * argument in the workqueue's process context. @dev will be pinned until | ||
630 | * @func returns. | ||
631 | * | ||
632 | * This routine is usually called via the inline device_schedule_callback(), | ||
633 | * which automatically sets @owner to THIS_MODULE. | ||
634 | * | ||
635 | * Returns 0 if the request was submitted, -ENOMEM if storage could not | ||
636 | * be allocated, -ENODEV if a reference to @owner isn't available. | ||
637 | * | ||
638 | * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an | ||
639 | * underlying sysfs routine (since it is intended for use by attribute | ||
640 | * methods), and if sysfs isn't available you'll get nothing but -ENOSYS. | ||
641 | */ | ||
642 | int device_schedule_callback_owner(struct device *dev, | ||
643 | void (*func)(struct device *), struct module *owner) | ||
644 | { | ||
645 | return sysfs_schedule_callback(&dev->kobj, | ||
646 | (void (*)(void *)) func, dev, owner); | ||
647 | } | ||
648 | EXPORT_SYMBOL_GPL(device_schedule_callback_owner); | ||
649 | |||
650 | static void klist_children_get(struct klist_node *n) | 617 | static void klist_children_get(struct klist_node *n) |
651 | { | 618 | { |
652 | struct device_private *p = to_device_private_parent(n); | 619 | struct device_private *p = to_device_private_parent(n); |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 06051767393f..8986b9f22781 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -187,8 +187,8 @@ static void driver_bound(struct device *dev) | |||
187 | return; | 187 | return; |
188 | } | 188 | } |
189 | 189 | ||
190 | pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev), | 190 | pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->driver->name, |
191 | __func__, dev->driver->name); | 191 | __func__, dev_name(dev)); |
192 | 192 | ||
193 | klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices); | 193 | klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices); |
194 | 194 | ||
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index bbcbd3c43926..be7c1fb7c0c9 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -39,8 +39,7 @@ | |||
39 | static ssize_t show_##name(struct device *dev, \ | 39 | static ssize_t show_##name(struct device *dev, \ |
40 | struct device_attribute *attr, char *buf) \ | 40 | struct device_attribute *attr, char *buf) \ |
41 | { \ | 41 | { \ |
42 | unsigned int cpu = dev->id; \ | 42 | return sprintf(buf, "%d\n", topology_##name(dev->id)); \ |
43 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ | ||
44 | } | 43 | } |
45 | 44 | ||
46 | #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \ | 45 | #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) || \ |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index fbae63e3d304..6e9f74a5c095 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -40,7 +40,7 @@ config SGI_MBCS | |||
40 | source "drivers/tty/serial/Kconfig" | 40 | source "drivers/tty/serial/Kconfig" |
41 | 41 | ||
42 | config TTY_PRINTK | 42 | config TTY_PRINTK |
43 | bool "TTY driver to output user messages via printk" | 43 | tristate "TTY driver to output user messages via printk" |
44 | depends on EXPERT && TTY | 44 | depends on EXPERT && TTY |
45 | default n | 45 | default n |
46 | ---help--- | 46 | ---help--- |
diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c index 8c3b255e629a..e900961cdd2e 100644 --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c | |||
@@ -61,18 +61,18 @@ static int bcm2835_rng_probe(struct platform_device *pdev) | |||
61 | } | 61 | } |
62 | bcm2835_rng_ops.priv = (unsigned long)rng_base; | 62 | bcm2835_rng_ops.priv = (unsigned long)rng_base; |
63 | 63 | ||
64 | /* set warm-up count & enable */ | ||
65 | __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); | ||
66 | __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); | ||
67 | |||
64 | /* register driver */ | 68 | /* register driver */ |
65 | err = hwrng_register(&bcm2835_rng_ops); | 69 | err = hwrng_register(&bcm2835_rng_ops); |
66 | if (err) { | 70 | if (err) { |
67 | dev_err(dev, "hwrng registration failed\n"); | 71 | dev_err(dev, "hwrng registration failed\n"); |
68 | iounmap(rng_base); | 72 | iounmap(rng_base); |
69 | } else { | 73 | } else |
70 | dev_info(dev, "hwrng registered\n"); | 74 | dev_info(dev, "hwrng registered\n"); |
71 | 75 | ||
72 | /* set warm-up count & enable */ | ||
73 | __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS); | ||
74 | __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL); | ||
75 | } | ||
76 | return err; | 76 | return err; |
77 | } | 77 | } |
78 | 78 | ||
diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig index 0baa8fab4ea7..db1c9b7adaa6 100644 --- a/drivers/char/ipmi/Kconfig +++ b/drivers/char/ipmi/Kconfig | |||
@@ -50,6 +50,18 @@ config IPMI_SI | |||
50 | Currently, only KCS and SMIC are supported. If | 50 | Currently, only KCS and SMIC are supported. If |
51 | you are using IPMI, you should probably say "y" here. | 51 | you are using IPMI, you should probably say "y" here. |
52 | 52 | ||
53 | config IPMI_SI_PROBE_DEFAULTS | ||
54 | bool 'Probe for all possible IPMI system interfaces by default' | ||
55 | default n | ||
56 | depends on IPMI_SI | ||
57 | help | ||
58 | Modern systems will usually expose IPMI interfaces via a discoverable | ||
59 | firmware mechanism such as ACPI or DMI. Older systems do not, and so | ||
60 | the driver is forced to probe hardware manually. This may cause boot | ||
61 | delays. Say "n" here to disable this manual probing. IPMI will then | ||
62 | only be available on older systems if the "ipmi_si_intf.trydefaults=1" | ||
63 | boot argument is passed. | ||
64 | |||
53 | config IPMI_WATCHDOG | 65 | config IPMI_WATCHDOG |
54 | tristate 'IPMI Watchdog Timer' | 66 | tristate 'IPMI Watchdog Timer' |
55 | help | 67 | help |
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index f5e4cd7617f6..61e71616689b 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -352,7 +352,7 @@ static inline void write_all_bytes(struct si_sm_data *bt) | |||
352 | 352 | ||
353 | static inline int read_all_bytes(struct si_sm_data *bt) | 353 | static inline int read_all_bytes(struct si_sm_data *bt) |
354 | { | 354 | { |
355 | unsigned char i; | 355 | unsigned int i; |
356 | 356 | ||
357 | /* | 357 | /* |
358 | * length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode. | 358 | * length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode. |
diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index 6a4bdc18955a..8c25f596808a 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c | |||
@@ -251,8 +251,9 @@ static inline int check_obf(struct si_sm_data *kcs, unsigned char status, | |||
251 | if (!GET_STATUS_OBF(status)) { | 251 | if (!GET_STATUS_OBF(status)) { |
252 | kcs->obf_timeout -= time; | 252 | kcs->obf_timeout -= time; |
253 | if (kcs->obf_timeout < 0) { | 253 | if (kcs->obf_timeout < 0) { |
254 | start_error_recovery(kcs, "OBF not ready in time"); | 254 | kcs->obf_timeout = OBF_RETRY_TIMEOUT; |
255 | return 1; | 255 | start_error_recovery(kcs, "OBF not ready in time"); |
256 | return 1; | ||
256 | } | 257 | } |
257 | return 0; | 258 | return 0; |
258 | } | 259 | } |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index ec4e10fcf1a5..e6db9381b2c7 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -55,6 +55,7 @@ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); | |||
55 | static int ipmi_init_msghandler(void); | 55 | static int ipmi_init_msghandler(void); |
56 | static void smi_recv_tasklet(unsigned long); | 56 | static void smi_recv_tasklet(unsigned long); |
57 | static void handle_new_recv_msgs(ipmi_smi_t intf); | 57 | static void handle_new_recv_msgs(ipmi_smi_t intf); |
58 | static void need_waiter(ipmi_smi_t intf); | ||
58 | 59 | ||
59 | static int initialized; | 60 | static int initialized; |
60 | 61 | ||
@@ -73,14 +74,28 @@ static struct proc_dir_entry *proc_ipmi_root; | |||
73 | */ | 74 | */ |
74 | #define MAX_MSG_TIMEOUT 60000 | 75 | #define MAX_MSG_TIMEOUT 60000 |
75 | 76 | ||
77 | /* Call every ~1000 ms. */ | ||
78 | #define IPMI_TIMEOUT_TIME 1000 | ||
79 | |||
80 | /* How many jiffies does it take to get to the timeout time. */ | ||
81 | #define IPMI_TIMEOUT_JIFFIES ((IPMI_TIMEOUT_TIME * HZ) / 1000) | ||
82 | |||
83 | /* | ||
84 | * Request events from the queue every second (this is the number of | ||
85 | * IPMI_TIMEOUT_TIMES between event requests). Hopefully, in the | ||
86 | * future, IPMI will add a way to know immediately if an event is in | ||
87 | * the queue and this silliness can go away. | ||
88 | */ | ||
89 | #define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME)) | ||
90 | |||
76 | /* | 91 | /* |
77 | * The main "user" data structure. | 92 | * The main "user" data structure. |
78 | */ | 93 | */ |
79 | struct ipmi_user { | 94 | struct ipmi_user { |
80 | struct list_head link; | 95 | struct list_head link; |
81 | 96 | ||
82 | /* Set to "0" when the user is destroyed. */ | 97 | /* Set to false when the user is destroyed. */ |
83 | int valid; | 98 | bool valid; |
84 | 99 | ||
85 | struct kref refcount; | 100 | struct kref refcount; |
86 | 101 | ||
@@ -92,7 +107,7 @@ struct ipmi_user { | |||
92 | ipmi_smi_t intf; | 107 | ipmi_smi_t intf; |
93 | 108 | ||
94 | /* Does this interface receive IPMI events? */ | 109 | /* Does this interface receive IPMI events? */ |
95 | int gets_events; | 110 | bool gets_events; |
96 | }; | 111 | }; |
97 | 112 | ||
98 | struct cmd_rcvr { | 113 | struct cmd_rcvr { |
@@ -383,6 +398,9 @@ struct ipmi_smi { | |||
383 | unsigned int waiting_events_count; /* How many events in queue? */ | 398 | unsigned int waiting_events_count; /* How many events in queue? */ |
384 | char delivering_events; | 399 | char delivering_events; |
385 | char event_msg_printed; | 400 | char event_msg_printed; |
401 | atomic_t event_waiters; | ||
402 | unsigned int ticks_to_req_ev; | ||
403 | int last_needs_timer; | ||
386 | 404 | ||
387 | /* | 405 | /* |
388 | * The event receiver for my BMC, only really used at panic | 406 | * The event receiver for my BMC, only really used at panic |
@@ -395,7 +413,7 @@ struct ipmi_smi { | |||
395 | 413 | ||
396 | /* For handling of maintenance mode. */ | 414 | /* For handling of maintenance mode. */ |
397 | int maintenance_mode; | 415 | int maintenance_mode; |
398 | int maintenance_mode_enable; | 416 | bool maintenance_mode_enable; |
399 | int auto_maintenance_timeout; | 417 | int auto_maintenance_timeout; |
400 | spinlock_t maintenance_mode_lock; /* Used in a timer... */ | 418 | spinlock_t maintenance_mode_lock; /* Used in a timer... */ |
401 | 419 | ||
@@ -451,7 +469,6 @@ static DEFINE_MUTEX(ipmi_interfaces_mutex); | |||
451 | static LIST_HEAD(smi_watchers); | 469 | static LIST_HEAD(smi_watchers); |
452 | static DEFINE_MUTEX(smi_watchers_mutex); | 470 | static DEFINE_MUTEX(smi_watchers_mutex); |
453 | 471 | ||
454 | |||
455 | #define ipmi_inc_stat(intf, stat) \ | 472 | #define ipmi_inc_stat(intf, stat) \ |
456 | atomic_inc(&(intf)->stats[IPMI_STAT_ ## stat]) | 473 | atomic_inc(&(intf)->stats[IPMI_STAT_ ## stat]) |
457 | #define ipmi_get_stat(intf, stat) \ | 474 | #define ipmi_get_stat(intf, stat) \ |
@@ -772,6 +789,7 @@ static int intf_next_seq(ipmi_smi_t intf, | |||
772 | *seq = i; | 789 | *seq = i; |
773 | *seqid = intf->seq_table[i].seqid; | 790 | *seqid = intf->seq_table[i].seqid; |
774 | intf->curr_seq = (i+1)%IPMI_IPMB_NUM_SEQ; | 791 | intf->curr_seq = (i+1)%IPMI_IPMB_NUM_SEQ; |
792 | need_waiter(intf); | ||
775 | } else { | 793 | } else { |
776 | rv = -EAGAIN; | 794 | rv = -EAGAIN; |
777 | } | 795 | } |
@@ -941,7 +959,7 @@ int ipmi_create_user(unsigned int if_num, | |||
941 | new_user->handler = handler; | 959 | new_user->handler = handler; |
942 | new_user->handler_data = handler_data; | 960 | new_user->handler_data = handler_data; |
943 | new_user->intf = intf; | 961 | new_user->intf = intf; |
944 | new_user->gets_events = 0; | 962 | new_user->gets_events = false; |
945 | 963 | ||
946 | if (!try_module_get(intf->handlers->owner)) { | 964 | if (!try_module_get(intf->handlers->owner)) { |
947 | rv = -ENODEV; | 965 | rv = -ENODEV; |
@@ -962,10 +980,15 @@ int ipmi_create_user(unsigned int if_num, | |||
962 | */ | 980 | */ |
963 | mutex_unlock(&ipmi_interfaces_mutex); | 981 | mutex_unlock(&ipmi_interfaces_mutex); |
964 | 982 | ||
965 | new_user->valid = 1; | 983 | new_user->valid = true; |
966 | spin_lock_irqsave(&intf->seq_lock, flags); | 984 | spin_lock_irqsave(&intf->seq_lock, flags); |
967 | list_add_rcu(&new_user->link, &intf->users); | 985 | list_add_rcu(&new_user->link, &intf->users); |
968 | spin_unlock_irqrestore(&intf->seq_lock, flags); | 986 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
987 | if (handler->ipmi_watchdog_pretimeout) { | ||
988 | /* User wants pretimeouts, so make sure to watch for them. */ | ||
989 | if (atomic_inc_return(&intf->event_waiters) == 1) | ||
990 | need_waiter(intf); | ||
991 | } | ||
969 | *user = new_user; | 992 | *user = new_user; |
970 | return 0; | 993 | return 0; |
971 | 994 | ||
@@ -1019,7 +1042,13 @@ int ipmi_destroy_user(ipmi_user_t user) | |||
1019 | struct cmd_rcvr *rcvr; | 1042 | struct cmd_rcvr *rcvr; |
1020 | struct cmd_rcvr *rcvrs = NULL; | 1043 | struct cmd_rcvr *rcvrs = NULL; |
1021 | 1044 | ||
1022 | user->valid = 0; | 1045 | user->valid = false; |
1046 | |||
1047 | if (user->handler->ipmi_watchdog_pretimeout) | ||
1048 | atomic_dec(&intf->event_waiters); | ||
1049 | |||
1050 | if (user->gets_events) | ||
1051 | atomic_dec(&intf->event_waiters); | ||
1023 | 1052 | ||
1024 | /* Remove the user from the interface's sequence table. */ | 1053 | /* Remove the user from the interface's sequence table. */ |
1025 | spin_lock_irqsave(&intf->seq_lock, flags); | 1054 | spin_lock_irqsave(&intf->seq_lock, flags); |
@@ -1155,25 +1184,23 @@ int ipmi_set_maintenance_mode(ipmi_user_t user, int mode) | |||
1155 | if (intf->maintenance_mode != mode) { | 1184 | if (intf->maintenance_mode != mode) { |
1156 | switch (mode) { | 1185 | switch (mode) { |
1157 | case IPMI_MAINTENANCE_MODE_AUTO: | 1186 | case IPMI_MAINTENANCE_MODE_AUTO: |
1158 | intf->maintenance_mode = mode; | ||
1159 | intf->maintenance_mode_enable | 1187 | intf->maintenance_mode_enable |
1160 | = (intf->auto_maintenance_timeout > 0); | 1188 | = (intf->auto_maintenance_timeout > 0); |
1161 | break; | 1189 | break; |
1162 | 1190 | ||
1163 | case IPMI_MAINTENANCE_MODE_OFF: | 1191 | case IPMI_MAINTENANCE_MODE_OFF: |
1164 | intf->maintenance_mode = mode; | 1192 | intf->maintenance_mode_enable = false; |
1165 | intf->maintenance_mode_enable = 0; | ||
1166 | break; | 1193 | break; |
1167 | 1194 | ||
1168 | case IPMI_MAINTENANCE_MODE_ON: | 1195 | case IPMI_MAINTENANCE_MODE_ON: |
1169 | intf->maintenance_mode = mode; | 1196 | intf->maintenance_mode_enable = true; |
1170 | intf->maintenance_mode_enable = 1; | ||
1171 | break; | 1197 | break; |
1172 | 1198 | ||
1173 | default: | 1199 | default: |
1174 | rv = -EINVAL; | 1200 | rv = -EINVAL; |
1175 | goto out_unlock; | 1201 | goto out_unlock; |
1176 | } | 1202 | } |
1203 | intf->maintenance_mode = mode; | ||
1177 | 1204 | ||
1178 | maintenance_mode_update(intf); | 1205 | maintenance_mode_update(intf); |
1179 | } | 1206 | } |
@@ -1184,7 +1211,7 @@ int ipmi_set_maintenance_mode(ipmi_user_t user, int mode) | |||
1184 | } | 1211 | } |
1185 | EXPORT_SYMBOL(ipmi_set_maintenance_mode); | 1212 | EXPORT_SYMBOL(ipmi_set_maintenance_mode); |
1186 | 1213 | ||
1187 | int ipmi_set_gets_events(ipmi_user_t user, int val) | 1214 | int ipmi_set_gets_events(ipmi_user_t user, bool val) |
1188 | { | 1215 | { |
1189 | unsigned long flags; | 1216 | unsigned long flags; |
1190 | ipmi_smi_t intf = user->intf; | 1217 | ipmi_smi_t intf = user->intf; |
@@ -1194,8 +1221,18 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) | |||
1194 | INIT_LIST_HEAD(&msgs); | 1221 | INIT_LIST_HEAD(&msgs); |
1195 | 1222 | ||
1196 | spin_lock_irqsave(&intf->events_lock, flags); | 1223 | spin_lock_irqsave(&intf->events_lock, flags); |
1224 | if (user->gets_events == val) | ||
1225 | goto out; | ||
1226 | |||
1197 | user->gets_events = val; | 1227 | user->gets_events = val; |
1198 | 1228 | ||
1229 | if (val) { | ||
1230 | if (atomic_inc_return(&intf->event_waiters) == 1) | ||
1231 | need_waiter(intf); | ||
1232 | } else { | ||
1233 | atomic_dec(&intf->event_waiters); | ||
1234 | } | ||
1235 | |||
1199 | if (intf->delivering_events) | 1236 | if (intf->delivering_events) |
1200 | /* | 1237 | /* |
1201 | * Another thread is delivering events for this, so | 1238 | * Another thread is delivering events for this, so |
@@ -1289,6 +1326,9 @@ int ipmi_register_for_cmd(ipmi_user_t user, | |||
1289 | goto out_unlock; | 1326 | goto out_unlock; |
1290 | } | 1327 | } |
1291 | 1328 | ||
1329 | if (atomic_inc_return(&intf->event_waiters) == 1) | ||
1330 | need_waiter(intf); | ||
1331 | |||
1292 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); | 1332 | list_add_rcu(&rcvr->link, &intf->cmd_rcvrs); |
1293 | 1333 | ||
1294 | out_unlock: | 1334 | out_unlock: |
@@ -1330,6 +1370,7 @@ int ipmi_unregister_for_cmd(ipmi_user_t user, | |||
1330 | mutex_unlock(&intf->cmd_rcvrs_mutex); | 1370 | mutex_unlock(&intf->cmd_rcvrs_mutex); |
1331 | synchronize_rcu(); | 1371 | synchronize_rcu(); |
1332 | while (rcvrs) { | 1372 | while (rcvrs) { |
1373 | atomic_dec(&intf->event_waiters); | ||
1333 | rcvr = rcvrs; | 1374 | rcvr = rcvrs; |
1334 | rcvrs = rcvr->next; | 1375 | rcvrs = rcvr->next; |
1335 | kfree(rcvr); | 1376 | kfree(rcvr); |
@@ -1535,7 +1576,7 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1535 | = IPMI_MAINTENANCE_MODE_TIMEOUT; | 1576 | = IPMI_MAINTENANCE_MODE_TIMEOUT; |
1536 | if (!intf->maintenance_mode | 1577 | if (!intf->maintenance_mode |
1537 | && !intf->maintenance_mode_enable) { | 1578 | && !intf->maintenance_mode_enable) { |
1538 | intf->maintenance_mode_enable = 1; | 1579 | intf->maintenance_mode_enable = true; |
1539 | maintenance_mode_update(intf); | 1580 | maintenance_mode_update(intf); |
1540 | } | 1581 | } |
1541 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, | 1582 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, |
@@ -2876,6 +2917,8 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, | |||
2876 | (unsigned long) intf); | 2917 | (unsigned long) intf); |
2877 | atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0); | 2918 | atomic_set(&intf->watchdog_pretimeouts_to_deliver, 0); |
2878 | spin_lock_init(&intf->events_lock); | 2919 | spin_lock_init(&intf->events_lock); |
2920 | atomic_set(&intf->event_waiters, 0); | ||
2921 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | ||
2879 | INIT_LIST_HEAD(&intf->waiting_events); | 2922 | INIT_LIST_HEAD(&intf->waiting_events); |
2880 | intf->waiting_events_count = 0; | 2923 | intf->waiting_events_count = 0; |
2881 | mutex_init(&intf->cmd_rcvrs_mutex); | 2924 | mutex_init(&intf->cmd_rcvrs_mutex); |
@@ -3965,7 +4008,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg, | |||
3965 | 4008 | ||
3966 | static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | 4009 | static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, |
3967 | struct list_head *timeouts, long timeout_period, | 4010 | struct list_head *timeouts, long timeout_period, |
3968 | int slot, unsigned long *flags) | 4011 | int slot, unsigned long *flags, |
4012 | unsigned int *waiting_msgs) | ||
3969 | { | 4013 | { |
3970 | struct ipmi_recv_msg *msg; | 4014 | struct ipmi_recv_msg *msg; |
3971 | struct ipmi_smi_handlers *handlers; | 4015 | struct ipmi_smi_handlers *handlers; |
@@ -3977,8 +4021,10 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3977 | return; | 4021 | return; |
3978 | 4022 | ||
3979 | ent->timeout -= timeout_period; | 4023 | ent->timeout -= timeout_period; |
3980 | if (ent->timeout > 0) | 4024 | if (ent->timeout > 0) { |
4025 | (*waiting_msgs)++; | ||
3981 | return; | 4026 | return; |
4027 | } | ||
3982 | 4028 | ||
3983 | if (ent->retries_left == 0) { | 4029 | if (ent->retries_left == 0) { |
3984 | /* The message has used all its retries. */ | 4030 | /* The message has used all its retries. */ |
@@ -3995,6 +4041,8 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3995 | struct ipmi_smi_msg *smi_msg; | 4041 | struct ipmi_smi_msg *smi_msg; |
3996 | /* More retries, send again. */ | 4042 | /* More retries, send again. */ |
3997 | 4043 | ||
4044 | (*waiting_msgs)++; | ||
4045 | |||
3998 | /* | 4046 | /* |
3999 | * Start with the max timer, set to normal timer after | 4047 | * Start with the max timer, set to normal timer after |
4000 | * the message is sent. | 4048 | * the message is sent. |
@@ -4040,117 +4088,118 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
4040 | } | 4088 | } |
4041 | } | 4089 | } |
4042 | 4090 | ||
4043 | static void ipmi_timeout_handler(long timeout_period) | 4091 | static unsigned int ipmi_timeout_handler(ipmi_smi_t intf, long timeout_period) |
4044 | { | 4092 | { |
4045 | ipmi_smi_t intf; | ||
4046 | struct list_head timeouts; | 4093 | struct list_head timeouts; |
4047 | struct ipmi_recv_msg *msg, *msg2; | 4094 | struct ipmi_recv_msg *msg, *msg2; |
4048 | unsigned long flags; | 4095 | unsigned long flags; |
4049 | int i; | 4096 | int i; |
4097 | unsigned int waiting_msgs = 0; | ||
4050 | 4098 | ||
4051 | rcu_read_lock(); | 4099 | /* |
4052 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { | 4100 | * Go through the seq table and find any messages that |
4053 | tasklet_schedule(&intf->recv_tasklet); | 4101 | * have timed out, putting them in the timeouts |
4054 | 4102 | * list. | |
4055 | /* | 4103 | */ |
4056 | * Go through the seq table and find any messages that | 4104 | INIT_LIST_HEAD(&timeouts); |
4057 | * have timed out, putting them in the timeouts | 4105 | spin_lock_irqsave(&intf->seq_lock, flags); |
4058 | * list. | 4106 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) |
4059 | */ | 4107 | check_msg_timeout(intf, &(intf->seq_table[i]), |
4060 | INIT_LIST_HEAD(&timeouts); | 4108 | &timeouts, timeout_period, i, |
4061 | spin_lock_irqsave(&intf->seq_lock, flags); | 4109 | &flags, &waiting_msgs); |
4062 | for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) | 4110 | spin_unlock_irqrestore(&intf->seq_lock, flags); |
4063 | check_msg_timeout(intf, &(intf->seq_table[i]), | ||
4064 | &timeouts, timeout_period, i, | ||
4065 | &flags); | ||
4066 | spin_unlock_irqrestore(&intf->seq_lock, flags); | ||
4067 | 4111 | ||
4068 | list_for_each_entry_safe(msg, msg2, &timeouts, link) | 4112 | list_for_each_entry_safe(msg, msg2, &timeouts, link) |
4069 | deliver_err_response(msg, IPMI_TIMEOUT_COMPLETION_CODE); | 4113 | deliver_err_response(msg, IPMI_TIMEOUT_COMPLETION_CODE); |
4070 | 4114 | ||
4071 | /* | 4115 | /* |
4072 | * Maintenance mode handling. Check the timeout | 4116 | * Maintenance mode handling. Check the timeout |
4073 | * optimistically before we claim the lock. It may | 4117 | * optimistically before we claim the lock. It may |
4074 | * mean a timeout gets missed occasionally, but that | 4118 | * mean a timeout gets missed occasionally, but that |
4075 | * only means the timeout gets extended by one period | 4119 | * only means the timeout gets extended by one period |
4076 | * in that case. No big deal, and it avoids the lock | 4120 | * in that case. No big deal, and it avoids the lock |
4077 | * most of the time. | 4121 | * most of the time. |
4078 | */ | 4122 | */ |
4123 | if (intf->auto_maintenance_timeout > 0) { | ||
4124 | spin_lock_irqsave(&intf->maintenance_mode_lock, flags); | ||
4079 | if (intf->auto_maintenance_timeout > 0) { | 4125 | if (intf->auto_maintenance_timeout > 0) { |
4080 | spin_lock_irqsave(&intf->maintenance_mode_lock, flags); | 4126 | intf->auto_maintenance_timeout |
4081 | if (intf->auto_maintenance_timeout > 0) { | 4127 | -= timeout_period; |
4082 | intf->auto_maintenance_timeout | 4128 | if (!intf->maintenance_mode |
4083 | -= timeout_period; | 4129 | && (intf->auto_maintenance_timeout <= 0)) { |
4084 | if (!intf->maintenance_mode | 4130 | intf->maintenance_mode_enable = false; |
4085 | && (intf->auto_maintenance_timeout <= 0)) { | 4131 | maintenance_mode_update(intf); |
4086 | intf->maintenance_mode_enable = 0; | ||
4087 | maintenance_mode_update(intf); | ||
4088 | } | ||
4089 | } | 4132 | } |
4090 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, | ||
4091 | flags); | ||
4092 | } | 4133 | } |
4134 | spin_unlock_irqrestore(&intf->maintenance_mode_lock, | ||
4135 | flags); | ||
4093 | } | 4136 | } |
4094 | rcu_read_unlock(); | 4137 | |
4138 | tasklet_schedule(&intf->recv_tasklet); | ||
4139 | |||
4140 | return waiting_msgs; | ||
4095 | } | 4141 | } |
4096 | 4142 | ||
4097 | static void ipmi_request_event(void) | 4143 | static void ipmi_request_event(ipmi_smi_t intf) |
4098 | { | 4144 | { |
4099 | ipmi_smi_t intf; | ||
4100 | struct ipmi_smi_handlers *handlers; | 4145 | struct ipmi_smi_handlers *handlers; |
4101 | 4146 | ||
4102 | rcu_read_lock(); | 4147 | /* No event requests when in maintenance mode. */ |
4103 | /* | 4148 | if (intf->maintenance_mode_enable) |
4104 | * Called from the timer, no need to check if handlers is | 4149 | return; |
4105 | * valid. | ||
4106 | */ | ||
4107 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { | ||
4108 | /* No event requests when in maintenance mode. */ | ||
4109 | if (intf->maintenance_mode_enable) | ||
4110 | continue; | ||
4111 | 4150 | ||
4112 | handlers = intf->handlers; | 4151 | handlers = intf->handlers; |
4113 | if (handlers) | 4152 | if (handlers) |
4114 | handlers->request_events(intf->send_info); | 4153 | handlers->request_events(intf->send_info); |
4115 | } | ||
4116 | rcu_read_unlock(); | ||
4117 | } | 4154 | } |
4118 | 4155 | ||
4119 | static struct timer_list ipmi_timer; | 4156 | static struct timer_list ipmi_timer; |
4120 | 4157 | ||
4121 | /* Call every ~1000 ms. */ | ||
4122 | #define IPMI_TIMEOUT_TIME 1000 | ||
4123 | |||
4124 | /* How many jiffies does it take to get to the timeout time. */ | ||
4125 | #define IPMI_TIMEOUT_JIFFIES ((IPMI_TIMEOUT_TIME * HZ) / 1000) | ||
4126 | |||
4127 | /* | ||
4128 | * Request events from the queue every second (this is the number of | ||
4129 | * IPMI_TIMEOUT_TIMES between event requests). Hopefully, in the | ||
4130 | * future, IPMI will add a way to know immediately if an event is in | ||
4131 | * the queue and this silliness can go away. | ||
4132 | */ | ||
4133 | #define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME)) | ||
4134 | |||
4135 | static atomic_t stop_operation; | 4158 | static atomic_t stop_operation; |
4136 | static unsigned int ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | ||
4137 | 4159 | ||
4138 | static void ipmi_timeout(unsigned long data) | 4160 | static void ipmi_timeout(unsigned long data) |
4139 | { | 4161 | { |
4162 | ipmi_smi_t intf; | ||
4163 | int nt = 0; | ||
4164 | |||
4140 | if (atomic_read(&stop_operation)) | 4165 | if (atomic_read(&stop_operation)) |
4141 | return; | 4166 | return; |
4142 | 4167 | ||
4143 | ticks_to_req_ev--; | 4168 | rcu_read_lock(); |
4144 | if (ticks_to_req_ev == 0) { | 4169 | list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { |
4145 | ipmi_request_event(); | 4170 | int lnt = 0; |
4146 | ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | 4171 | |
4147 | } | 4172 | if (atomic_read(&intf->event_waiters)) { |
4173 | intf->ticks_to_req_ev--; | ||
4174 | if (intf->ticks_to_req_ev == 0) { | ||
4175 | ipmi_request_event(intf); | ||
4176 | intf->ticks_to_req_ev = IPMI_REQUEST_EV_TIME; | ||
4177 | } | ||
4178 | lnt++; | ||
4179 | } | ||
4148 | 4180 | ||
4149 | ipmi_timeout_handler(IPMI_TIMEOUT_TIME); | 4181 | lnt += ipmi_timeout_handler(intf, IPMI_TIMEOUT_TIME); |
4150 | 4182 | ||
4151 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | 4183 | lnt = !!lnt; |
4184 | if (lnt != intf->last_needs_timer && | ||
4185 | intf->handlers->set_need_watch) | ||
4186 | intf->handlers->set_need_watch(intf->send_info, lnt); | ||
4187 | intf->last_needs_timer = lnt; | ||
4188 | |||
4189 | nt += lnt; | ||
4190 | } | ||
4191 | rcu_read_unlock(); | ||
4192 | |||
4193 | if (nt) | ||
4194 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | ||
4152 | } | 4195 | } |
4153 | 4196 | ||
4197 | static void need_waiter(ipmi_smi_t intf) | ||
4198 | { | ||
4199 | /* Racy, but worst case we start the timer twice. */ | ||
4200 | if (!timer_pending(&ipmi_timer)) | ||
4201 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | ||
4202 | } | ||
4154 | 4203 | ||
4155 | static atomic_t smi_msg_inuse_count = ATOMIC_INIT(0); | 4204 | static atomic_t smi_msg_inuse_count = ATOMIC_INIT(0); |
4156 | static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0); | 4205 | static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0); |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b7efd3c1a882..1c4bb4f6ce93 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -217,7 +217,7 @@ struct smi_info { | |||
217 | unsigned char msg_flags; | 217 | unsigned char msg_flags; |
218 | 218 | ||
219 | /* Does the BMC have an event buffer? */ | 219 | /* Does the BMC have an event buffer? */ |
220 | char has_event_buffer; | 220 | bool has_event_buffer; |
221 | 221 | ||
222 | /* | 222 | /* |
223 | * If set to true, this will request events the next time the | 223 | * If set to true, this will request events the next time the |
@@ -230,7 +230,7 @@ struct smi_info { | |||
230 | * call. Generally used after a panic to make sure stuff goes | 230 | * call. Generally used after a panic to make sure stuff goes |
231 | * out. | 231 | * out. |
232 | */ | 232 | */ |
233 | int run_to_completion; | 233 | bool run_to_completion; |
234 | 234 | ||
235 | /* The I/O port of an SI interface. */ | 235 | /* The I/O port of an SI interface. */ |
236 | int port; | 236 | int port; |
@@ -248,19 +248,25 @@ struct smi_info { | |||
248 | /* The timer for this si. */ | 248 | /* The timer for this si. */ |
249 | struct timer_list si_timer; | 249 | struct timer_list si_timer; |
250 | 250 | ||
251 | /* This flag is set, if the timer is running (timer_pending() isn't enough) */ | ||
252 | bool timer_running; | ||
253 | |||
251 | /* The time (in jiffies) the last timeout occurred at. */ | 254 | /* The time (in jiffies) the last timeout occurred at. */ |
252 | unsigned long last_timeout_jiffies; | 255 | unsigned long last_timeout_jiffies; |
253 | 256 | ||
254 | /* Used to gracefully stop the timer without race conditions. */ | 257 | /* Used to gracefully stop the timer without race conditions. */ |
255 | atomic_t stop_operation; | 258 | atomic_t stop_operation; |
256 | 259 | ||
260 | /* Are we waiting for the events, pretimeouts, received msgs? */ | ||
261 | atomic_t need_watch; | ||
262 | |||
257 | /* | 263 | /* |
258 | * The driver will disable interrupts when it gets into a | 264 | * The driver will disable interrupts when it gets into a |
259 | * situation where it cannot handle messages due to lack of | 265 | * situation where it cannot handle messages due to lack of |
260 | * memory. Once that situation clears up, it will re-enable | 266 | * memory. Once that situation clears up, it will re-enable |
261 | * interrupts. | 267 | * interrupts. |
262 | */ | 268 | */ |
263 | int interrupt_disabled; | 269 | bool interrupt_disabled; |
264 | 270 | ||
265 | /* From the get device id response... */ | 271 | /* From the get device id response... */ |
266 | struct ipmi_device_id device_id; | 272 | struct ipmi_device_id device_id; |
@@ -273,7 +279,7 @@ struct smi_info { | |||
273 | * True if we allocated the device, false if it came from | 279 | * True if we allocated the device, false if it came from |
274 | * someplace else (like PCI). | 280 | * someplace else (like PCI). |
275 | */ | 281 | */ |
276 | int dev_registered; | 282 | bool dev_registered; |
277 | 283 | ||
278 | /* Slave address, could be reported from DMI. */ | 284 | /* Slave address, could be reported from DMI. */ |
279 | unsigned char slave_addr; | 285 | unsigned char slave_addr; |
@@ -297,19 +303,19 @@ struct smi_info { | |||
297 | static int force_kipmid[SI_MAX_PARMS]; | 303 | static int force_kipmid[SI_MAX_PARMS]; |
298 | static int num_force_kipmid; | 304 | static int num_force_kipmid; |
299 | #ifdef CONFIG_PCI | 305 | #ifdef CONFIG_PCI |
300 | static int pci_registered; | 306 | static bool pci_registered; |
301 | #endif | 307 | #endif |
302 | #ifdef CONFIG_ACPI | 308 | #ifdef CONFIG_ACPI |
303 | static int pnp_registered; | 309 | static bool pnp_registered; |
304 | #endif | 310 | #endif |
305 | #ifdef CONFIG_PARISC | 311 | #ifdef CONFIG_PARISC |
306 | static int parisc_registered; | 312 | static bool parisc_registered; |
307 | #endif | 313 | #endif |
308 | 314 | ||
309 | static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; | 315 | static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; |
310 | static int num_max_busy_us; | 316 | static int num_max_busy_us; |
311 | 317 | ||
312 | static int unload_when_empty = 1; | 318 | static bool unload_when_empty = true; |
313 | 319 | ||
314 | static int add_smi(struct smi_info *smi); | 320 | static int add_smi(struct smi_info *smi); |
315 | static int try_smi_init(struct smi_info *smi); | 321 | static int try_smi_init(struct smi_info *smi); |
@@ -434,6 +440,13 @@ static void start_clear_flags(struct smi_info *smi_info) | |||
434 | smi_info->si_state = SI_CLEARING_FLAGS; | 440 | smi_info->si_state = SI_CLEARING_FLAGS; |
435 | } | 441 | } |
436 | 442 | ||
443 | static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) | ||
444 | { | ||
445 | smi_info->last_timeout_jiffies = jiffies; | ||
446 | mod_timer(&smi_info->si_timer, new_val); | ||
447 | smi_info->timer_running = true; | ||
448 | } | ||
449 | |||
437 | /* | 450 | /* |
438 | * When we have a situtaion where we run out of memory and cannot | 451 | * When we have a situtaion where we run out of memory and cannot |
439 | * allocate messages, we just leave them in the BMC and run the system | 452 | * allocate messages, we just leave them in the BMC and run the system |
@@ -444,10 +457,9 @@ static inline void disable_si_irq(struct smi_info *smi_info) | |||
444 | { | 457 | { |
445 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { | 458 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { |
446 | start_disable_irq(smi_info); | 459 | start_disable_irq(smi_info); |
447 | smi_info->interrupt_disabled = 1; | 460 | smi_info->interrupt_disabled = true; |
448 | if (!atomic_read(&smi_info->stop_operation)) | 461 | if (!atomic_read(&smi_info->stop_operation)) |
449 | mod_timer(&smi_info->si_timer, | 462 | smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); |
450 | jiffies + SI_TIMEOUT_JIFFIES); | ||
451 | } | 463 | } |
452 | } | 464 | } |
453 | 465 | ||
@@ -455,7 +467,7 @@ static inline void enable_si_irq(struct smi_info *smi_info) | |||
455 | { | 467 | { |
456 | if ((smi_info->irq) && (smi_info->interrupt_disabled)) { | 468 | if ((smi_info->irq) && (smi_info->interrupt_disabled)) { |
457 | start_enable_irq(smi_info); | 469 | start_enable_irq(smi_info); |
458 | smi_info->interrupt_disabled = 0; | 470 | smi_info->interrupt_disabled = false; |
459 | } | 471 | } |
460 | } | 472 | } |
461 | 473 | ||
@@ -700,7 +712,7 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
700 | dev_warn(smi_info->dev, | 712 | dev_warn(smi_info->dev, |
701 | "Maybe ok, but ipmi might run very slowly.\n"); | 713 | "Maybe ok, but ipmi might run very slowly.\n"); |
702 | } else | 714 | } else |
703 | smi_info->interrupt_disabled = 0; | 715 | smi_info->interrupt_disabled = false; |
704 | smi_info->si_state = SI_NORMAL; | 716 | smi_info->si_state = SI_NORMAL; |
705 | break; | 717 | break; |
706 | } | 718 | } |
@@ -853,6 +865,19 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, | |||
853 | return si_sm_result; | 865 | return si_sm_result; |
854 | } | 866 | } |
855 | 867 | ||
868 | static void check_start_timer_thread(struct smi_info *smi_info) | ||
869 | { | ||
870 | if (smi_info->si_state == SI_NORMAL && smi_info->curr_msg == NULL) { | ||
871 | smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); | ||
872 | |||
873 | if (smi_info->thread) | ||
874 | wake_up_process(smi_info->thread); | ||
875 | |||
876 | start_next_msg(smi_info); | ||
877 | smi_event_handler(smi_info, 0); | ||
878 | } | ||
879 | } | ||
880 | |||
856 | static void sender(void *send_info, | 881 | static void sender(void *send_info, |
857 | struct ipmi_smi_msg *msg, | 882 | struct ipmi_smi_msg *msg, |
858 | int priority) | 883 | int priority) |
@@ -906,27 +931,11 @@ static void sender(void *send_info, | |||
906 | else | 931 | else |
907 | list_add_tail(&msg->link, &smi_info->xmit_msgs); | 932 | list_add_tail(&msg->link, &smi_info->xmit_msgs); |
908 | 933 | ||
909 | if (smi_info->si_state == SI_NORMAL && smi_info->curr_msg == NULL) { | 934 | check_start_timer_thread(smi_info); |
910 | /* | ||
911 | * last_timeout_jiffies is updated here to avoid | ||
912 | * smi_timeout() handler passing very large time_diff | ||
913 | * value to smi_event_handler() that causes | ||
914 | * the send command to abort. | ||
915 | */ | ||
916 | smi_info->last_timeout_jiffies = jiffies; | ||
917 | |||
918 | mod_timer(&smi_info->si_timer, jiffies + SI_TIMEOUT_JIFFIES); | ||
919 | |||
920 | if (smi_info->thread) | ||
921 | wake_up_process(smi_info->thread); | ||
922 | |||
923 | start_next_msg(smi_info); | ||
924 | smi_event_handler(smi_info, 0); | ||
925 | } | ||
926 | spin_unlock_irqrestore(&smi_info->si_lock, flags); | 935 | spin_unlock_irqrestore(&smi_info->si_lock, flags); |
927 | } | 936 | } |
928 | 937 | ||
929 | static void set_run_to_completion(void *send_info, int i_run_to_completion) | 938 | static void set_run_to_completion(void *send_info, bool i_run_to_completion) |
930 | { | 939 | { |
931 | struct smi_info *smi_info = send_info; | 940 | struct smi_info *smi_info = send_info; |
932 | enum si_sm_result result; | 941 | enum si_sm_result result; |
@@ -1004,6 +1013,17 @@ static int ipmi_thread(void *data) | |||
1004 | 1013 | ||
1005 | spin_lock_irqsave(&(smi_info->si_lock), flags); | 1014 | spin_lock_irqsave(&(smi_info->si_lock), flags); |
1006 | smi_result = smi_event_handler(smi_info, 0); | 1015 | smi_result = smi_event_handler(smi_info, 0); |
1016 | |||
1017 | /* | ||
1018 | * If the driver is doing something, there is a possible | ||
1019 | * race with the timer. If the timer handler see idle, | ||
1020 | * and the thread here sees something else, the timer | ||
1021 | * handler won't restart the timer even though it is | ||
1022 | * required. So start it here if necessary. | ||
1023 | */ | ||
1024 | if (smi_result != SI_SM_IDLE && !smi_info->timer_running) | ||
1025 | smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); | ||
1026 | |||
1007 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); | 1027 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
1008 | busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, | 1028 | busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, |
1009 | &busy_until); | 1029 | &busy_until); |
@@ -1011,9 +1031,15 @@ static int ipmi_thread(void *data) | |||
1011 | ; /* do nothing */ | 1031 | ; /* do nothing */ |
1012 | else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) | 1032 | else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) |
1013 | schedule(); | 1033 | schedule(); |
1014 | else if (smi_result == SI_SM_IDLE) | 1034 | else if (smi_result == SI_SM_IDLE) { |
1015 | schedule_timeout_interruptible(100); | 1035 | if (atomic_read(&smi_info->need_watch)) { |
1016 | else | 1036 | schedule_timeout_interruptible(100); |
1037 | } else { | ||
1038 | /* Wait to be woken up when we are needed. */ | ||
1039 | __set_current_state(TASK_INTERRUPTIBLE); | ||
1040 | schedule(); | ||
1041 | } | ||
1042 | } else | ||
1017 | schedule_timeout_interruptible(1); | 1043 | schedule_timeout_interruptible(1); |
1018 | } | 1044 | } |
1019 | return 0; | 1045 | return 0; |
@@ -1024,7 +1050,7 @@ static void poll(void *send_info) | |||
1024 | { | 1050 | { |
1025 | struct smi_info *smi_info = send_info; | 1051 | struct smi_info *smi_info = send_info; |
1026 | unsigned long flags = 0; | 1052 | unsigned long flags = 0; |
1027 | int run_to_completion = smi_info->run_to_completion; | 1053 | bool run_to_completion = smi_info->run_to_completion; |
1028 | 1054 | ||
1029 | /* | 1055 | /* |
1030 | * Make sure there is some delay in the poll loop so we can | 1056 | * Make sure there is some delay in the poll loop so we can |
@@ -1049,6 +1075,17 @@ static void request_events(void *send_info) | |||
1049 | atomic_set(&smi_info->req_events, 1); | 1075 | atomic_set(&smi_info->req_events, 1); |
1050 | } | 1076 | } |
1051 | 1077 | ||
1078 | static void set_need_watch(void *send_info, bool enable) | ||
1079 | { | ||
1080 | struct smi_info *smi_info = send_info; | ||
1081 | unsigned long flags; | ||
1082 | |||
1083 | atomic_set(&smi_info->need_watch, enable); | ||
1084 | spin_lock_irqsave(&smi_info->si_lock, flags); | ||
1085 | check_start_timer_thread(smi_info); | ||
1086 | spin_unlock_irqrestore(&smi_info->si_lock, flags); | ||
1087 | } | ||
1088 | |||
1052 | static int initialized; | 1089 | static int initialized; |
1053 | 1090 | ||
1054 | static void smi_timeout(unsigned long data) | 1091 | static void smi_timeout(unsigned long data) |
@@ -1073,10 +1110,6 @@ static void smi_timeout(unsigned long data) | |||
1073 | * SI_USEC_PER_JIFFY); | 1110 | * SI_USEC_PER_JIFFY); |
1074 | smi_result = smi_event_handler(smi_info, time_diff); | 1111 | smi_result = smi_event_handler(smi_info, time_diff); |
1075 | 1112 | ||
1076 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); | ||
1077 | |||
1078 | smi_info->last_timeout_jiffies = jiffies_now; | ||
1079 | |||
1080 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { | 1113 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { |
1081 | /* Running with interrupts, only do long timeouts. */ | 1114 | /* Running with interrupts, only do long timeouts. */ |
1082 | timeout = jiffies + SI_TIMEOUT_JIFFIES; | 1115 | timeout = jiffies + SI_TIMEOUT_JIFFIES; |
@@ -1098,7 +1131,10 @@ static void smi_timeout(unsigned long data) | |||
1098 | 1131 | ||
1099 | do_mod_timer: | 1132 | do_mod_timer: |
1100 | if (smi_result != SI_SM_IDLE) | 1133 | if (smi_result != SI_SM_IDLE) |
1101 | mod_timer(&(smi_info->si_timer), timeout); | 1134 | smi_mod_timer(smi_info, timeout); |
1135 | else | ||
1136 | smi_info->timer_running = false; | ||
1137 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); | ||
1102 | } | 1138 | } |
1103 | 1139 | ||
1104 | static irqreturn_t si_irq_handler(int irq, void *data) | 1140 | static irqreturn_t si_irq_handler(int irq, void *data) |
@@ -1146,8 +1182,7 @@ static int smi_start_processing(void *send_info, | |||
1146 | 1182 | ||
1147 | /* Set up the timer that drives the interface. */ | 1183 | /* Set up the timer that drives the interface. */ |
1148 | setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); | 1184 | setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); |
1149 | new_smi->last_timeout_jiffies = jiffies; | 1185 | smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES); |
1150 | mod_timer(&new_smi->si_timer, jiffies + SI_TIMEOUT_JIFFIES); | ||
1151 | 1186 | ||
1152 | /* | 1187 | /* |
1153 | * Check if the user forcefully enabled the daemon. | 1188 | * Check if the user forcefully enabled the daemon. |
@@ -1188,7 +1223,7 @@ static int get_smi_info(void *send_info, struct ipmi_smi_info *data) | |||
1188 | return 0; | 1223 | return 0; |
1189 | } | 1224 | } |
1190 | 1225 | ||
1191 | static void set_maintenance_mode(void *send_info, int enable) | 1226 | static void set_maintenance_mode(void *send_info, bool enable) |
1192 | { | 1227 | { |
1193 | struct smi_info *smi_info = send_info; | 1228 | struct smi_info *smi_info = send_info; |
1194 | 1229 | ||
@@ -1202,6 +1237,7 @@ static struct ipmi_smi_handlers handlers = { | |||
1202 | .get_smi_info = get_smi_info, | 1237 | .get_smi_info = get_smi_info, |
1203 | .sender = sender, | 1238 | .sender = sender, |
1204 | .request_events = request_events, | 1239 | .request_events = request_events, |
1240 | .set_need_watch = set_need_watch, | ||
1205 | .set_maintenance_mode = set_maintenance_mode, | 1241 | .set_maintenance_mode = set_maintenance_mode, |
1206 | .set_run_to_completion = set_run_to_completion, | 1242 | .set_run_to_completion = set_run_to_completion, |
1207 | .poll = poll, | 1243 | .poll = poll, |
@@ -1229,7 +1265,7 @@ static bool si_tryplatform = 1; | |||
1229 | #ifdef CONFIG_PCI | 1265 | #ifdef CONFIG_PCI |
1230 | static bool si_trypci = 1; | 1266 | static bool si_trypci = 1; |
1231 | #endif | 1267 | #endif |
1232 | static bool si_trydefaults = 1; | 1268 | static bool si_trydefaults = IS_ENABLED(CONFIG_IPMI_SI_PROBE_DEFAULTS); |
1233 | static char *si_type[SI_MAX_PARMS]; | 1269 | static char *si_type[SI_MAX_PARMS]; |
1234 | #define MAX_SI_TYPE_STR 30 | 1270 | #define MAX_SI_TYPE_STR 30 |
1235 | static char si_type_str[MAX_SI_TYPE_STR]; | 1271 | static char si_type_str[MAX_SI_TYPE_STR]; |
@@ -1328,7 +1364,7 @@ module_param_array(force_kipmid, int, &num_force_kipmid, 0); | |||
1328 | MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or" | 1364 | MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or" |
1329 | " disabled(0). Normally the IPMI driver auto-detects" | 1365 | " disabled(0). Normally the IPMI driver auto-detects" |
1330 | " this, but the value may be overridden by this parm."); | 1366 | " this, but the value may be overridden by this parm."); |
1331 | module_param(unload_when_empty, int, 0); | 1367 | module_param(unload_when_empty, bool, 0); |
1332 | MODULE_PARM_DESC(unload_when_empty, "Unload the module if no interfaces are" | 1368 | MODULE_PARM_DESC(unload_when_empty, "Unload the module if no interfaces are" |
1333 | " specified or found, default is 1. Setting to 0" | 1369 | " specified or found, default is 1. Setting to 0" |
1334 | " is useful for hot add of devices using hotmod."); | 1370 | " is useful for hot add of devices using hotmod."); |
@@ -3336,18 +3372,19 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3336 | INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs)); | 3372 | INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs)); |
3337 | new_smi->curr_msg = NULL; | 3373 | new_smi->curr_msg = NULL; |
3338 | atomic_set(&new_smi->req_events, 0); | 3374 | atomic_set(&new_smi->req_events, 0); |
3339 | new_smi->run_to_completion = 0; | 3375 | new_smi->run_to_completion = false; |
3340 | for (i = 0; i < SI_NUM_STATS; i++) | 3376 | for (i = 0; i < SI_NUM_STATS; i++) |
3341 | atomic_set(&new_smi->stats[i], 0); | 3377 | atomic_set(&new_smi->stats[i], 0); |
3342 | 3378 | ||
3343 | new_smi->interrupt_disabled = 1; | 3379 | new_smi->interrupt_disabled = true; |
3344 | atomic_set(&new_smi->stop_operation, 0); | 3380 | atomic_set(&new_smi->stop_operation, 0); |
3381 | atomic_set(&new_smi->need_watch, 0); | ||
3345 | new_smi->intf_num = smi_num; | 3382 | new_smi->intf_num = smi_num; |
3346 | smi_num++; | 3383 | smi_num++; |
3347 | 3384 | ||
3348 | rv = try_enable_event_buffer(new_smi); | 3385 | rv = try_enable_event_buffer(new_smi); |
3349 | if (rv == 0) | 3386 | if (rv == 0) |
3350 | new_smi->has_event_buffer = 1; | 3387 | new_smi->has_event_buffer = true; |
3351 | 3388 | ||
3352 | /* | 3389 | /* |
3353 | * Start clearing the flags before we enable interrupts or the | 3390 | * Start clearing the flags before we enable interrupts or the |
@@ -3381,7 +3418,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3381 | rv); | 3418 | rv); |
3382 | goto out_err; | 3419 | goto out_err; |
3383 | } | 3420 | } |
3384 | new_smi->dev_registered = 1; | 3421 | new_smi->dev_registered = true; |
3385 | } | 3422 | } |
3386 | 3423 | ||
3387 | rv = ipmi_register_smi(&handlers, | 3424 | rv = ipmi_register_smi(&handlers, |
@@ -3430,7 +3467,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3430 | wait_for_timer_and_thread(new_smi); | 3467 | wait_for_timer_and_thread(new_smi); |
3431 | 3468 | ||
3432 | out_err: | 3469 | out_err: |
3433 | new_smi->interrupt_disabled = 1; | 3470 | new_smi->interrupt_disabled = true; |
3434 | 3471 | ||
3435 | if (new_smi->intf) { | 3472 | if (new_smi->intf) { |
3436 | ipmi_unregister_smi(new_smi->intf); | 3473 | ipmi_unregister_smi(new_smi->intf); |
@@ -3466,7 +3503,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3466 | 3503 | ||
3467 | if (new_smi->dev_registered) { | 3504 | if (new_smi->dev_registered) { |
3468 | platform_device_unregister(new_smi->pdev); | 3505 | platform_device_unregister(new_smi->pdev); |
3469 | new_smi->dev_registered = 0; | 3506 | new_smi->dev_registered = false; |
3470 | } | 3507 | } |
3471 | 3508 | ||
3472 | return rv; | 3509 | return rv; |
@@ -3521,14 +3558,14 @@ static int init_ipmi_si(void) | |||
3521 | printk(KERN_ERR PFX "Unable to register " | 3558 | printk(KERN_ERR PFX "Unable to register " |
3522 | "PCI driver: %d\n", rv); | 3559 | "PCI driver: %d\n", rv); |
3523 | else | 3560 | else |
3524 | pci_registered = 1; | 3561 | pci_registered = true; |
3525 | } | 3562 | } |
3526 | #endif | 3563 | #endif |
3527 | 3564 | ||
3528 | #ifdef CONFIG_ACPI | 3565 | #ifdef CONFIG_ACPI |
3529 | if (si_tryacpi) { | 3566 | if (si_tryacpi) { |
3530 | pnp_register_driver(&ipmi_pnp_driver); | 3567 | pnp_register_driver(&ipmi_pnp_driver); |
3531 | pnp_registered = 1; | 3568 | pnp_registered = true; |
3532 | } | 3569 | } |
3533 | #endif | 3570 | #endif |
3534 | 3571 | ||
@@ -3544,7 +3581,7 @@ static int init_ipmi_si(void) | |||
3544 | 3581 | ||
3545 | #ifdef CONFIG_PARISC | 3582 | #ifdef CONFIG_PARISC |
3546 | register_parisc_driver(&ipmi_parisc_driver); | 3583 | register_parisc_driver(&ipmi_parisc_driver); |
3547 | parisc_registered = 1; | 3584 | parisc_registered = true; |
3548 | /* poking PC IO addresses will crash machine, don't do it */ | 3585 | /* poking PC IO addresses will crash machine, don't do it */ |
3549 | si_trydefaults = 0; | 3586 | si_trydefaults = 0; |
3550 | #endif | 3587 | #endif |
diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig index b27f5342fe76..8d3dfb0c8a26 100644 --- a/drivers/char/pcmcia/Kconfig +++ b/drivers/char/pcmcia/Kconfig | |||
@@ -15,7 +15,7 @@ config SYNCLINK_CS | |||
15 | 15 | ||
16 | This driver may be built as a module ( = code which can be | 16 | This driver may be built as a module ( = code which can be |
17 | inserted in and removed from the running kernel whenever you want). | 17 | inserted in and removed from the running kernel whenever you want). |
18 | The module will be called synclinkmp. If you want to do that, say M | 18 | The module will be called synclink_cs. If you want to do that, say M |
19 | here. | 19 | here. |
20 | 20 | ||
21 | config CARDMAN_4000 | 21 | config CARDMAN_4000 |
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index daea84c41743..a15ce4ef39cd 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/serial.h> | 18 | #include <linux/serial.h> |
19 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
20 | #include <linux/export.h> | 20 | #include <linux/module.h> |
21 | 21 | ||
22 | struct ttyprintk_port { | 22 | struct ttyprintk_port { |
23 | struct tty_port port; | 23 | struct tty_port port; |
@@ -210,10 +210,19 @@ static int __init ttyprintk_init(void) | |||
210 | return 0; | 210 | return 0; |
211 | 211 | ||
212 | error: | 212 | error: |
213 | tty_unregister_driver(ttyprintk_driver); | ||
214 | put_tty_driver(ttyprintk_driver); | 213 | put_tty_driver(ttyprintk_driver); |
215 | tty_port_destroy(&tpk_port.port); | 214 | tty_port_destroy(&tpk_port.port); |
216 | ttyprintk_driver = NULL; | ||
217 | return ret; | 215 | return ret; |
218 | } | 216 | } |
217 | |||
218 | static void __exit ttyprintk_exit(void) | ||
219 | { | ||
220 | tty_unregister_driver(ttyprintk_driver); | ||
221 | put_tty_driver(ttyprintk_driver); | ||
222 | tty_port_destroy(&tpk_port.port); | ||
223 | } | ||
224 | |||
219 | device_initcall(ttyprintk_init); | 225 | device_initcall(ttyprintk_init); |
226 | module_exit(ttyprintk_exit); | ||
227 | |||
228 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index ba06d1d2f99e..5c5863842de9 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -197,7 +197,7 @@ config AMCC_PPC440SPE_ADMA | |||
197 | 197 | ||
198 | config TIMB_DMA | 198 | config TIMB_DMA |
199 | tristate "Timberdale FPGA DMA support" | 199 | tristate "Timberdale FPGA DMA support" |
200 | depends on MFD_TIMBERDALE || HAS_IOMEM | 200 | depends on MFD_TIMBERDALE |
201 | select DMA_ENGINE | 201 | select DMA_ENGINE |
202 | help | 202 | help |
203 | Enable support for the Timberdale FPGA DMA engine. | 203 | Enable support for the Timberdale FPGA DMA engine. |
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index cd04eb7b182e..926360c2db6a 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -182,11 +182,13 @@ static void edma_execute(struct edma_chan *echan) | |||
182 | echan->ecc->dummy_slot); | 182 | echan->ecc->dummy_slot); |
183 | } | 183 | } |
184 | 184 | ||
185 | edma_resume(echan->ch_num); | ||
186 | |||
187 | if (edesc->processed <= MAX_NR_SG) { | 185 | if (edesc->processed <= MAX_NR_SG) { |
188 | dev_dbg(dev, "first transfer starting %d\n", echan->ch_num); | 186 | dev_dbg(dev, "first transfer starting %d\n", echan->ch_num); |
189 | edma_start(echan->ch_num); | 187 | edma_start(echan->ch_num); |
188 | } else { | ||
189 | dev_dbg(dev, "chan: %d: completed %d elements, resuming\n", | ||
190 | echan->ch_num, edesc->processed); | ||
191 | edma_resume(echan->ch_num); | ||
190 | } | 192 | } |
191 | 193 | ||
192 | /* | 194 | /* |
diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c index 381e793184ba..b396a7fb53ab 100644 --- a/drivers/dma/fsl-edma.c +++ b/drivers/dma/fsl-edma.c | |||
@@ -968,7 +968,17 @@ static struct platform_driver fsl_edma_driver = { | |||
968 | .remove = fsl_edma_remove, | 968 | .remove = fsl_edma_remove, |
969 | }; | 969 | }; |
970 | 970 | ||
971 | module_platform_driver(fsl_edma_driver); | 971 | static int __init fsl_edma_init(void) |
972 | { | ||
973 | return platform_driver_register(&fsl_edma_driver); | ||
974 | } | ||
975 | subsys_initcall(fsl_edma_init); | ||
976 | |||
977 | static void __exit fsl_edma_exit(void) | ||
978 | { | ||
979 | platform_driver_unregister(&fsl_edma_driver); | ||
980 | } | ||
981 | module_exit(fsl_edma_exit); | ||
972 | 982 | ||
973 | MODULE_ALIAS("platform:fsl-edma"); | 983 | MODULE_ALIAS("platform:fsl-edma"); |
974 | MODULE_DESCRIPTION("Freescale eDMA engine driver"); | 984 | MODULE_DESCRIPTION("Freescale eDMA engine driver"); |
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index a1bd8298d55f..03f7820fa333 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c | |||
@@ -666,7 +666,7 @@ static struct dma_chan *of_dma_sirfsoc_xlate(struct of_phandle_args *dma_spec, | |||
666 | struct sirfsoc_dma *sdma = ofdma->of_dma_data; | 666 | struct sirfsoc_dma *sdma = ofdma->of_dma_data; |
667 | unsigned int request = dma_spec->args[0]; | 667 | unsigned int request = dma_spec->args[0]; |
668 | 668 | ||
669 | if (request > SIRFSOC_DMA_CHANNELS) | 669 | if (request >= SIRFSOC_DMA_CHANNELS) |
670 | return NULL; | 670 | return NULL; |
671 | 671 | ||
672 | return dma_get_slave_channel(&sdma->channels[request].chan); | 672 | return dma_get_slave_channel(&sdma->channels[request].chan); |
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c index e9a0415834ea..30bcc539425d 100644 --- a/drivers/gpio/gpio-spear-spics.c +++ b/drivers/gpio/gpio-spear-spics.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SPEAr platform SPI chipselect abstraction over gpiolib | 2 | * SPEAr platform SPI chipselect abstraction over gpiolib |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Shiraz Hashim <shiraz.hashim@st.com> | 5 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -205,6 +205,6 @@ static int __init spics_gpio_init(void) | |||
205 | } | 205 | } |
206 | subsys_initcall(spics_gpio_init); | 206 | subsys_initcall(spics_gpio_init); |
207 | 207 | ||
208 | MODULE_AUTHOR("Shiraz Hashim <shiraz.hashim@st.com>"); | 208 | MODULE_AUTHOR("Shiraz Hashim <shiraz.linux.kernel@gmail.com>"); |
209 | MODULE_DESCRIPTION("ST Microlectronics SPEAr SPI Chip Select Abstraction"); | 209 | MODULE_DESCRIPTION("ST Microlectronics SPEAr SPI Chip Select Abstraction"); |
210 | MODULE_LICENSE("GPL"); | 210 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 9d25dbbe6771..48e38ba22783 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile | |||
@@ -23,7 +23,7 @@ drm-$(CONFIG_DRM_PANEL) += drm_panel.o | |||
23 | 23 | ||
24 | drm-usb-y := drm_usb.o | 24 | drm-usb-y := drm_usb.o |
25 | 25 | ||
26 | drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o | 26 | drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o |
27 | drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o | 27 | drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o |
28 | drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o | 28 | drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o |
29 | drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o | 29 | drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o |
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c index 977cfb35837a..635f6ffc27c2 100644 --- a/drivers/gpu/drm/ast/ast_post.c +++ b/drivers/gpu/drm/ast/ast_post.c | |||
@@ -572,7 +572,7 @@ static u32 cbr_scan2(struct ast_private *ast) | |||
572 | for (loop = 0; loop < CBR_PASSNUM2; loop++) { | 572 | for (loop = 0; loop < CBR_PASSNUM2; loop++) { |
573 | if ((data = cbr_test2(ast)) != 0) { | 573 | if ((data = cbr_test2(ast)) != 0) { |
574 | data2 &= data; | 574 | data2 &= data; |
575 | if (!data) | 575 | if (!data2) |
576 | return 0; | 576 | return 0; |
577 | break; | 577 | break; |
578 | } | 578 | } |
diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h index 741965c001a6..7eb52dd44b01 100644 --- a/drivers/gpu/drm/bochs/bochs.h +++ b/drivers/gpu/drm/bochs/bochs.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/io.h> | 1 | #include <linux/io.h> |
2 | #include <linux/fb.h> | 2 | #include <linux/fb.h> |
3 | #include <linux/console.h> | ||
3 | 4 | ||
4 | #include <drm/drmP.h> | 5 | #include <drm/drmP.h> |
5 | #include <drm/drm_crtc.h> | 6 | #include <drm/drm_crtc.h> |
@@ -87,8 +88,6 @@ struct bochs_device { | |||
87 | struct bochs_framebuffer gfb; | 88 | struct bochs_framebuffer gfb; |
88 | struct drm_fb_helper helper; | 89 | struct drm_fb_helper helper; |
89 | int size; | 90 | int size; |
90 | int x1, y1, x2, y2; /* dirty rect */ | ||
91 | spinlock_t dirty_lock; | ||
92 | bool initialized; | 91 | bool initialized; |
93 | } fb; | 92 | } fb; |
94 | }; | 93 | }; |
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index 395bba261c9a..9c13df29fd20 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c | |||
@@ -95,6 +95,49 @@ static struct drm_driver bochs_driver = { | |||
95 | }; | 95 | }; |
96 | 96 | ||
97 | /* ---------------------------------------------------------------------- */ | 97 | /* ---------------------------------------------------------------------- */ |
98 | /* pm interface */ | ||
99 | |||
100 | static int bochs_pm_suspend(struct device *dev) | ||
101 | { | ||
102 | struct pci_dev *pdev = to_pci_dev(dev); | ||
103 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
104 | struct bochs_device *bochs = drm_dev->dev_private; | ||
105 | |||
106 | drm_kms_helper_poll_disable(drm_dev); | ||
107 | |||
108 | if (bochs->fb.initialized) { | ||
109 | console_lock(); | ||
110 | fb_set_suspend(bochs->fb.helper.fbdev, 1); | ||
111 | console_unlock(); | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static int bochs_pm_resume(struct device *dev) | ||
118 | { | ||
119 | struct pci_dev *pdev = to_pci_dev(dev); | ||
120 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
121 | struct bochs_device *bochs = drm_dev->dev_private; | ||
122 | |||
123 | drm_helper_resume_force_mode(drm_dev); | ||
124 | |||
125 | if (bochs->fb.initialized) { | ||
126 | console_lock(); | ||
127 | fb_set_suspend(bochs->fb.helper.fbdev, 0); | ||
128 | console_unlock(); | ||
129 | } | ||
130 | |||
131 | drm_kms_helper_poll_enable(drm_dev); | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static const struct dev_pm_ops bochs_pm_ops = { | ||
136 | SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, | ||
137 | bochs_pm_resume) | ||
138 | }; | ||
139 | |||
140 | /* ---------------------------------------------------------------------- */ | ||
98 | /* pci interface */ | 141 | /* pci interface */ |
99 | 142 | ||
100 | static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) | 143 | static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) |
@@ -155,6 +198,7 @@ static struct pci_driver bochs_pci_driver = { | |||
155 | .id_table = bochs_pci_tbl, | 198 | .id_table = bochs_pci_tbl, |
156 | .probe = bochs_pci_probe, | 199 | .probe = bochs_pci_probe, |
157 | .remove = bochs_pci_remove, | 200 | .remove = bochs_pci_remove, |
201 | .driver.pm = &bochs_pm_ops, | ||
158 | }; | 202 | }; |
159 | 203 | ||
160 | /* ---------------------------------------------------------------------- */ | 204 | /* ---------------------------------------------------------------------- */ |
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c index 4da5206b7cc9..561b84474122 100644 --- a/drivers/gpu/drm/bochs/bochs_fbdev.c +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c | |||
@@ -190,7 +190,6 @@ int bochs_fbdev_init(struct bochs_device *bochs) | |||
190 | int ret; | 190 | int ret; |
191 | 191 | ||
192 | bochs->fb.helper.funcs = &bochs_fb_helper_funcs; | 192 | bochs->fb.helper.funcs = &bochs_fb_helper_funcs; |
193 | spin_lock_init(&bochs->fb.dirty_lock); | ||
194 | 193 | ||
195 | ret = drm_fb_helper_init(bochs->dev, &bochs->fb.helper, | 194 | ret = drm_fb_helper_init(bochs->dev, &bochs->fb.helper, |
196 | 1, 1); | 195 | 1, 1); |
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 953fc8aea69c..08ce520f61a5 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/console.h> | 12 | #include <linux/console.h> |
13 | #include <drm/drmP.h> | 13 | #include <drm/drmP.h> |
14 | #include <drm/drm_crtc_helper.h> | ||
14 | 15 | ||
15 | #include "cirrus_drv.h" | 16 | #include "cirrus_drv.h" |
16 | 17 | ||
@@ -75,6 +76,41 @@ static void cirrus_pci_remove(struct pci_dev *pdev) | |||
75 | drm_put_dev(dev); | 76 | drm_put_dev(dev); |
76 | } | 77 | } |
77 | 78 | ||
79 | static int cirrus_pm_suspend(struct device *dev) | ||
80 | { | ||
81 | struct pci_dev *pdev = to_pci_dev(dev); | ||
82 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
83 | struct cirrus_device *cdev = drm_dev->dev_private; | ||
84 | |||
85 | drm_kms_helper_poll_disable(drm_dev); | ||
86 | |||
87 | if (cdev->mode_info.gfbdev) { | ||
88 | console_lock(); | ||
89 | fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 1); | ||
90 | console_unlock(); | ||
91 | } | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static int cirrus_pm_resume(struct device *dev) | ||
97 | { | ||
98 | struct pci_dev *pdev = to_pci_dev(dev); | ||
99 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
100 | struct cirrus_device *cdev = drm_dev->dev_private; | ||
101 | |||
102 | drm_helper_resume_force_mode(drm_dev); | ||
103 | |||
104 | if (cdev->mode_info.gfbdev) { | ||
105 | console_lock(); | ||
106 | fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 0); | ||
107 | console_unlock(); | ||
108 | } | ||
109 | |||
110 | drm_kms_helper_poll_enable(drm_dev); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
78 | static const struct file_operations cirrus_driver_fops = { | 114 | static const struct file_operations cirrus_driver_fops = { |
79 | .owner = THIS_MODULE, | 115 | .owner = THIS_MODULE, |
80 | .open = drm_open, | 116 | .open = drm_open, |
@@ -103,11 +139,17 @@ static struct drm_driver driver = { | |||
103 | .dumb_destroy = drm_gem_dumb_destroy, | 139 | .dumb_destroy = drm_gem_dumb_destroy, |
104 | }; | 140 | }; |
105 | 141 | ||
142 | static const struct dev_pm_ops cirrus_pm_ops = { | ||
143 | SET_SYSTEM_SLEEP_PM_OPS(cirrus_pm_suspend, | ||
144 | cirrus_pm_resume) | ||
145 | }; | ||
146 | |||
106 | static struct pci_driver cirrus_pci_driver = { | 147 | static struct pci_driver cirrus_pci_driver = { |
107 | .name = DRIVER_NAME, | 148 | .name = DRIVER_NAME, |
108 | .id_table = pciidlist, | 149 | .id_table = pciidlist, |
109 | .probe = cirrus_pci_probe, | 150 | .probe = cirrus_pci_probe, |
110 | .remove = cirrus_pci_remove, | 151 | .remove = cirrus_pci_remove, |
152 | .driver.pm = &cirrus_pm_ops, | ||
111 | }; | 153 | }; |
112 | 154 | ||
113 | static int __init cirrus_init(void) | 155 | static int __init cirrus_init(void) |
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index 2d64aea83df2..f59433b7610c 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -308,6 +308,9 @@ static int cirrus_crtc_mode_set(struct drm_crtc *crtc, | |||
308 | 308 | ||
309 | WREG_HDR(hdr); | 309 | WREG_HDR(hdr); |
310 | cirrus_crtc_do_set_base(crtc, old_fb, x, y, 0); | 310 | cirrus_crtc_do_set_base(crtc, old_fb, x, y, 0); |
311 | |||
312 | /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ | ||
313 | outb(0x20, 0x3c0); | ||
311 | return 0; | 314 | return 0; |
312 | } | 315 | } |
313 | 316 | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index c43825e8f5c1..df281b54db01 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -72,147 +72,6 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev) | |||
72 | } | 72 | } |
73 | EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head); | 73 | EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head); |
74 | 74 | ||
75 | static bool drm_kms_helper_poll = true; | ||
76 | module_param_named(poll, drm_kms_helper_poll, bool, 0600); | ||
77 | |||
78 | static void drm_mode_validate_flag(struct drm_connector *connector, | ||
79 | int flags) | ||
80 | { | ||
81 | struct drm_display_mode *mode; | ||
82 | |||
83 | if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE | | ||
84 | DRM_MODE_FLAG_3D_MASK)) | ||
85 | return; | ||
86 | |||
87 | list_for_each_entry(mode, &connector->modes, head) { | ||
88 | if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && | ||
89 | !(flags & DRM_MODE_FLAG_INTERLACE)) | ||
90 | mode->status = MODE_NO_INTERLACE; | ||
91 | if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) && | ||
92 | !(flags & DRM_MODE_FLAG_DBLSCAN)) | ||
93 | mode->status = MODE_NO_DBLESCAN; | ||
94 | if ((mode->flags & DRM_MODE_FLAG_3D_MASK) && | ||
95 | !(flags & DRM_MODE_FLAG_3D_MASK)) | ||
96 | mode->status = MODE_NO_STEREO; | ||
97 | } | ||
98 | |||
99 | return; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * drm_helper_probe_single_connector_modes - get complete set of display modes | ||
104 | * @connector: connector to probe | ||
105 | * @maxX: max width for modes | ||
106 | * @maxY: max height for modes | ||
107 | * | ||
108 | * Based on the helper callbacks implemented by @connector try to detect all | ||
109 | * valid modes. Modes will first be added to the connector's probed_modes list, | ||
110 | * then culled (based on validity and the @maxX, @maxY parameters) and put into | ||
111 | * the normal modes list. | ||
112 | * | ||
113 | * Intended to be use as a generic implementation of the ->fill_modes() | ||
114 | * @connector vfunc for drivers that use the crtc helpers for output mode | ||
115 | * filtering and detection. | ||
116 | * | ||
117 | * Returns: | ||
118 | * The number of modes found on @connector. | ||
119 | */ | ||
120 | int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | ||
121 | uint32_t maxX, uint32_t maxY) | ||
122 | { | ||
123 | struct drm_device *dev = connector->dev; | ||
124 | struct drm_display_mode *mode; | ||
125 | struct drm_connector_helper_funcs *connector_funcs = | ||
126 | connector->helper_private; | ||
127 | int count = 0; | ||
128 | int mode_flags = 0; | ||
129 | bool verbose_prune = true; | ||
130 | |||
131 | WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); | ||
132 | |||
133 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, | ||
134 | drm_get_connector_name(connector)); | ||
135 | /* set all modes to the unverified state */ | ||
136 | list_for_each_entry(mode, &connector->modes, head) | ||
137 | mode->status = MODE_UNVERIFIED; | ||
138 | |||
139 | if (connector->force) { | ||
140 | if (connector->force == DRM_FORCE_ON) | ||
141 | connector->status = connector_status_connected; | ||
142 | else | ||
143 | connector->status = connector_status_disconnected; | ||
144 | if (connector->funcs->force) | ||
145 | connector->funcs->force(connector); | ||
146 | } else { | ||
147 | connector->status = connector->funcs->detect(connector, true); | ||
148 | } | ||
149 | |||
150 | /* Re-enable polling in case the global poll config changed. */ | ||
151 | if (drm_kms_helper_poll != dev->mode_config.poll_running) | ||
152 | drm_kms_helper_poll_enable(dev); | ||
153 | |||
154 | dev->mode_config.poll_running = drm_kms_helper_poll; | ||
155 | |||
156 | if (connector->status == connector_status_disconnected) { | ||
157 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", | ||
158 | connector->base.id, drm_get_connector_name(connector)); | ||
159 | drm_mode_connector_update_edid_property(connector, NULL); | ||
160 | verbose_prune = false; | ||
161 | goto prune; | ||
162 | } | ||
163 | |||
164 | #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE | ||
165 | count = drm_load_edid_firmware(connector); | ||
166 | if (count == 0) | ||
167 | #endif | ||
168 | count = (*connector_funcs->get_modes)(connector); | ||
169 | |||
170 | if (count == 0 && connector->status == connector_status_connected) | ||
171 | count = drm_add_modes_noedid(connector, 1024, 768); | ||
172 | if (count == 0) | ||
173 | goto prune; | ||
174 | |||
175 | drm_mode_connector_list_update(connector); | ||
176 | |||
177 | if (maxX && maxY) | ||
178 | drm_mode_validate_size(dev, &connector->modes, maxX, maxY); | ||
179 | |||
180 | if (connector->interlace_allowed) | ||
181 | mode_flags |= DRM_MODE_FLAG_INTERLACE; | ||
182 | if (connector->doublescan_allowed) | ||
183 | mode_flags |= DRM_MODE_FLAG_DBLSCAN; | ||
184 | if (connector->stereo_allowed) | ||
185 | mode_flags |= DRM_MODE_FLAG_3D_MASK; | ||
186 | drm_mode_validate_flag(connector, mode_flags); | ||
187 | |||
188 | list_for_each_entry(mode, &connector->modes, head) { | ||
189 | if (mode->status == MODE_OK) | ||
190 | mode->status = connector_funcs->mode_valid(connector, | ||
191 | mode); | ||
192 | } | ||
193 | |||
194 | prune: | ||
195 | drm_mode_prune_invalid(dev, &connector->modes, verbose_prune); | ||
196 | |||
197 | if (list_empty(&connector->modes)) | ||
198 | return 0; | ||
199 | |||
200 | list_for_each_entry(mode, &connector->modes, head) | ||
201 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
202 | |||
203 | drm_mode_sort(&connector->modes); | ||
204 | |||
205 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, | ||
206 | drm_get_connector_name(connector)); | ||
207 | list_for_each_entry(mode, &connector->modes, head) { | ||
208 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); | ||
209 | drm_mode_debug_printmodeline(mode); | ||
210 | } | ||
211 | |||
212 | return count; | ||
213 | } | ||
214 | EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); | ||
215 | |||
216 | /** | 75 | /** |
217 | * drm_helper_encoder_in_use - check if a given encoder is in use | 76 | * drm_helper_encoder_in_use - check if a given encoder is in use |
218 | * @encoder: encoder to check | 77 | * @encoder: encoder to check |
@@ -1020,232 +879,3 @@ void drm_helper_resume_force_mode(struct drm_device *dev) | |||
1020 | drm_modeset_unlock_all(dev); | 879 | drm_modeset_unlock_all(dev); |
1021 | } | 880 | } |
1022 | EXPORT_SYMBOL(drm_helper_resume_force_mode); | 881 | EXPORT_SYMBOL(drm_helper_resume_force_mode); |
1023 | |||
1024 | /** | ||
1025 | * drm_kms_helper_hotplug_event - fire off KMS hotplug events | ||
1026 | * @dev: drm_device whose connector state changed | ||
1027 | * | ||
1028 | * This function fires off the uevent for userspace and also calls the | ||
1029 | * output_poll_changed function, which is most commonly used to inform the fbdev | ||
1030 | * emulation code and allow it to update the fbcon output configuration. | ||
1031 | * | ||
1032 | * Drivers should call this from their hotplug handling code when a change is | ||
1033 | * detected. Note that this function does not do any output detection of its | ||
1034 | * own, like drm_helper_hpd_irq_event() does - this is assumed to be done by the | ||
1035 | * driver already. | ||
1036 | * | ||
1037 | * This function must be called from process context with no mode | ||
1038 | * setting locks held. | ||
1039 | */ | ||
1040 | void drm_kms_helper_hotplug_event(struct drm_device *dev) | ||
1041 | { | ||
1042 | /* send a uevent + call fbdev */ | ||
1043 | drm_sysfs_hotplug_event(dev); | ||
1044 | if (dev->mode_config.funcs->output_poll_changed) | ||
1045 | dev->mode_config.funcs->output_poll_changed(dev); | ||
1046 | } | ||
1047 | EXPORT_SYMBOL(drm_kms_helper_hotplug_event); | ||
1048 | |||
1049 | #define DRM_OUTPUT_POLL_PERIOD (10*HZ) | ||
1050 | static void output_poll_execute(struct work_struct *work) | ||
1051 | { | ||
1052 | struct delayed_work *delayed_work = to_delayed_work(work); | ||
1053 | struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); | ||
1054 | struct drm_connector *connector; | ||
1055 | enum drm_connector_status old_status; | ||
1056 | bool repoll = false, changed = false; | ||
1057 | |||
1058 | if (!drm_kms_helper_poll) | ||
1059 | return; | ||
1060 | |||
1061 | mutex_lock(&dev->mode_config.mutex); | ||
1062 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
1063 | |||
1064 | /* Ignore forced connectors. */ | ||
1065 | if (connector->force) | ||
1066 | continue; | ||
1067 | |||
1068 | /* Ignore HPD capable connectors and connectors where we don't | ||
1069 | * want any hotplug detection at all for polling. */ | ||
1070 | if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) | ||
1071 | continue; | ||
1072 | |||
1073 | repoll = true; | ||
1074 | |||
1075 | old_status = connector->status; | ||
1076 | /* if we are connected and don't want to poll for disconnect | ||
1077 | skip it */ | ||
1078 | if (old_status == connector_status_connected && | ||
1079 | !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) | ||
1080 | continue; | ||
1081 | |||
1082 | connector->status = connector->funcs->detect(connector, false); | ||
1083 | if (old_status != connector->status) { | ||
1084 | const char *old, *new; | ||
1085 | |||
1086 | old = drm_get_connector_status_name(old_status); | ||
1087 | new = drm_get_connector_status_name(connector->status); | ||
1088 | |||
1089 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " | ||
1090 | "status updated from %s to %s\n", | ||
1091 | connector->base.id, | ||
1092 | drm_get_connector_name(connector), | ||
1093 | old, new); | ||
1094 | |||
1095 | changed = true; | ||
1096 | } | ||
1097 | } | ||
1098 | |||
1099 | mutex_unlock(&dev->mode_config.mutex); | ||
1100 | |||
1101 | if (changed) | ||
1102 | drm_kms_helper_hotplug_event(dev); | ||
1103 | |||
1104 | if (repoll) | ||
1105 | schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); | ||
1106 | } | ||
1107 | |||
1108 | /** | ||
1109 | * drm_kms_helper_poll_disable - disable output polling | ||
1110 | * @dev: drm_device | ||
1111 | * | ||
1112 | * This function disables the output polling work. | ||
1113 | * | ||
1114 | * Drivers can call this helper from their device suspend implementation. It is | ||
1115 | * not an error to call this even when output polling isn't enabled or arlready | ||
1116 | * disabled. | ||
1117 | */ | ||
1118 | void drm_kms_helper_poll_disable(struct drm_device *dev) | ||
1119 | { | ||
1120 | if (!dev->mode_config.poll_enabled) | ||
1121 | return; | ||
1122 | cancel_delayed_work_sync(&dev->mode_config.output_poll_work); | ||
1123 | } | ||
1124 | EXPORT_SYMBOL(drm_kms_helper_poll_disable); | ||
1125 | |||
1126 | /** | ||
1127 | * drm_kms_helper_poll_enable - re-enable output polling. | ||
1128 | * @dev: drm_device | ||
1129 | * | ||
1130 | * This function re-enables the output polling work. | ||
1131 | * | ||
1132 | * Drivers can call this helper from their device resume implementation. It is | ||
1133 | * an error to call this when the output polling support has not yet been set | ||
1134 | * up. | ||
1135 | */ | ||
1136 | void drm_kms_helper_poll_enable(struct drm_device *dev) | ||
1137 | { | ||
1138 | bool poll = false; | ||
1139 | struct drm_connector *connector; | ||
1140 | |||
1141 | if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) | ||
1142 | return; | ||
1143 | |||
1144 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
1145 | if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | | ||
1146 | DRM_CONNECTOR_POLL_DISCONNECT)) | ||
1147 | poll = true; | ||
1148 | } | ||
1149 | |||
1150 | if (poll) | ||
1151 | schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); | ||
1152 | } | ||
1153 | EXPORT_SYMBOL(drm_kms_helper_poll_enable); | ||
1154 | |||
1155 | /** | ||
1156 | * drm_kms_helper_poll_init - initialize and enable output polling | ||
1157 | * @dev: drm_device | ||
1158 | * | ||
1159 | * This function intializes and then also enables output polling support for | ||
1160 | * @dev. Drivers which do not have reliable hotplug support in hardware can use | ||
1161 | * this helper infrastructure to regularly poll such connectors for changes in | ||
1162 | * their connection state. | ||
1163 | * | ||
1164 | * Drivers can control which connectors are polled by setting the | ||
1165 | * DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags. On | ||
1166 | * connectors where probing live outputs can result in visual distortion drivers | ||
1167 | * should not set the DRM_CONNECTOR_POLL_DISCONNECT flag to avoid this. | ||
1168 | * Connectors which have no flag or only DRM_CONNECTOR_POLL_HPD set are | ||
1169 | * completely ignored by the polling logic. | ||
1170 | * | ||
1171 | * Note that a connector can be both polled and probed from the hotplug handler, | ||
1172 | * in case the hotplug interrupt is known to be unreliable. | ||
1173 | */ | ||
1174 | void drm_kms_helper_poll_init(struct drm_device *dev) | ||
1175 | { | ||
1176 | INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); | ||
1177 | dev->mode_config.poll_enabled = true; | ||
1178 | |||
1179 | drm_kms_helper_poll_enable(dev); | ||
1180 | } | ||
1181 | EXPORT_SYMBOL(drm_kms_helper_poll_init); | ||
1182 | |||
1183 | /** | ||
1184 | * drm_kms_helper_poll_fini - disable output polling and clean it up | ||
1185 | * @dev: drm_device | ||
1186 | */ | ||
1187 | void drm_kms_helper_poll_fini(struct drm_device *dev) | ||
1188 | { | ||
1189 | drm_kms_helper_poll_disable(dev); | ||
1190 | } | ||
1191 | EXPORT_SYMBOL(drm_kms_helper_poll_fini); | ||
1192 | |||
1193 | /** | ||
1194 | * drm_helper_hpd_irq_event - hotplug processing | ||
1195 | * @dev: drm_device | ||
1196 | * | ||
1197 | * Drivers can use this helper function to run a detect cycle on all connectors | ||
1198 | * which have the DRM_CONNECTOR_POLL_HPD flag set in their &polled member. All | ||
1199 | * other connectors are ignored, which is useful to avoid reprobing fixed | ||
1200 | * panels. | ||
1201 | * | ||
1202 | * This helper function is useful for drivers which can't or don't track hotplug | ||
1203 | * interrupts for each connector. | ||
1204 | * | ||
1205 | * Drivers which support hotplug interrupts for each connector individually and | ||
1206 | * which have a more fine-grained detect logic should bypass this code and | ||
1207 | * directly call drm_kms_helper_hotplug_event() in case the connector state | ||
1208 | * changed. | ||
1209 | * | ||
1210 | * This function must be called from process context with no mode | ||
1211 | * setting locks held. | ||
1212 | * | ||
1213 | * Note that a connector can be both polled and probed from the hotplug handler, | ||
1214 | * in case the hotplug interrupt is known to be unreliable. | ||
1215 | */ | ||
1216 | bool drm_helper_hpd_irq_event(struct drm_device *dev) | ||
1217 | { | ||
1218 | struct drm_connector *connector; | ||
1219 | enum drm_connector_status old_status; | ||
1220 | bool changed = false; | ||
1221 | |||
1222 | if (!dev->mode_config.poll_enabled) | ||
1223 | return false; | ||
1224 | |||
1225 | mutex_lock(&dev->mode_config.mutex); | ||
1226 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
1227 | |||
1228 | /* Only handle HPD capable connectors. */ | ||
1229 | if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) | ||
1230 | continue; | ||
1231 | |||
1232 | old_status = connector->status; | ||
1233 | |||
1234 | connector->status = connector->funcs->detect(connector, false); | ||
1235 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", | ||
1236 | connector->base.id, | ||
1237 | drm_get_connector_name(connector), | ||
1238 | drm_get_connector_status_name(old_status), | ||
1239 | drm_get_connector_status_name(connector->status)); | ||
1240 | if (old_status != connector->status) | ||
1241 | changed = true; | ||
1242 | } | ||
1243 | |||
1244 | mutex_unlock(&dev->mode_config.mutex); | ||
1245 | |||
1246 | if (changed) | ||
1247 | drm_kms_helper_hotplug_event(dev); | ||
1248 | |||
1249 | return changed; | ||
1250 | } | ||
1251 | EXPORT_SYMBOL(drm_helper_hpd_irq_event); | ||
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 27671489477d..4b6e6f3ba0a1 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c | |||
@@ -577,7 +577,9 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter) | |||
577 | 577 | ||
578 | /* | 578 | /* |
579 | * Transfer a single I2C-over-AUX message and handle various error conditions, | 579 | * Transfer a single I2C-over-AUX message and handle various error conditions, |
580 | * retrying the transaction as appropriate. | 580 | * retrying the transaction as appropriate. It is assumed that the |
581 | * aux->transfer function does not modify anything in the msg other than the | ||
582 | * reply field. | ||
581 | */ | 583 | */ |
582 | static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | 584 | static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) |
583 | { | 585 | { |
@@ -665,11 +667,26 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, | |||
665 | { | 667 | { |
666 | struct drm_dp_aux *aux = adapter->algo_data; | 668 | struct drm_dp_aux *aux = adapter->algo_data; |
667 | unsigned int i, j; | 669 | unsigned int i, j; |
670 | struct drm_dp_aux_msg msg; | ||
671 | int err = 0; | ||
668 | 672 | ||
669 | for (i = 0; i < num; i++) { | 673 | memset(&msg, 0, sizeof(msg)); |
670 | struct drm_dp_aux_msg msg; | ||
671 | int err; | ||
672 | 674 | ||
675 | for (i = 0; i < num; i++) { | ||
676 | msg.address = msgs[i].addr; | ||
677 | msg.request = (msgs[i].flags & I2C_M_RD) ? | ||
678 | DP_AUX_I2C_READ : | ||
679 | DP_AUX_I2C_WRITE; | ||
680 | msg.request |= DP_AUX_I2C_MOT; | ||
681 | /* Send a bare address packet to start the transaction. | ||
682 | * Zero sized messages specify an address only (bare | ||
683 | * address) transaction. | ||
684 | */ | ||
685 | msg.buffer = NULL; | ||
686 | msg.size = 0; | ||
687 | err = drm_dp_i2c_do_msg(aux, &msg); | ||
688 | if (err < 0) | ||
689 | break; | ||
673 | /* | 690 | /* |
674 | * Many hardware implementations support FIFOs larger than a | 691 | * Many hardware implementations support FIFOs larger than a |
675 | * single byte, but it has been empirically determined that | 692 | * single byte, but it has been empirically determined that |
@@ -678,30 +695,28 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, | |||
678 | * transferred byte-by-byte. | 695 | * transferred byte-by-byte. |
679 | */ | 696 | */ |
680 | for (j = 0; j < msgs[i].len; j++) { | 697 | for (j = 0; j < msgs[i].len; j++) { |
681 | memset(&msg, 0, sizeof(msg)); | ||
682 | msg.address = msgs[i].addr; | ||
683 | |||
684 | msg.request = (msgs[i].flags & I2C_M_RD) ? | ||
685 | DP_AUX_I2C_READ : | ||
686 | DP_AUX_I2C_WRITE; | ||
687 | |||
688 | /* | ||
689 | * All messages except the last one are middle-of- | ||
690 | * transfer messages. | ||
691 | */ | ||
692 | if ((i < num - 1) || (j < msgs[i].len - 1)) | ||
693 | msg.request |= DP_AUX_I2C_MOT; | ||
694 | |||
695 | msg.buffer = msgs[i].buf + j; | 698 | msg.buffer = msgs[i].buf + j; |
696 | msg.size = 1; | 699 | msg.size = 1; |
697 | 700 | ||
698 | err = drm_dp_i2c_do_msg(aux, &msg); | 701 | err = drm_dp_i2c_do_msg(aux, &msg); |
699 | if (err < 0) | 702 | if (err < 0) |
700 | return err; | 703 | break; |
701 | } | 704 | } |
705 | if (err < 0) | ||
706 | break; | ||
702 | } | 707 | } |
708 | if (err >= 0) | ||
709 | err = num; | ||
710 | /* Send a bare address packet to close out the transaction. | ||
711 | * Zero sized messages specify an address only (bare | ||
712 | * address) transaction. | ||
713 | */ | ||
714 | msg.request &= ~DP_AUX_I2C_MOT; | ||
715 | msg.buffer = NULL; | ||
716 | msg.size = 0; | ||
717 | (void)drm_dp_i2c_do_msg(aux, &msg); | ||
703 | 718 | ||
704 | return num; | 719 | return err; |
705 | } | 720 | } |
706 | 721 | ||
707 | static const struct i2c_algorithm drm_dp_i2c_algo = { | 722 | static const struct i2c_algorithm drm_dp_i2c_algo = { |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 71e2d3fcd6ee..04a209e2b66d 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -207,8 +207,6 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | WARN(1, "no hole found for node 0x%lx + 0x%lx\n", | ||
211 | node->start, node->size); | ||
212 | return -ENOSPC; | 210 | return -ENOSPC; |
213 | } | 211 | } |
214 | EXPORT_SYMBOL(drm_mm_reserve_node); | 212 | EXPORT_SYMBOL(drm_mm_reserve_node); |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index e768d35ff22e..d2b1c03b3d71 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
@@ -203,9 +203,9 @@ EXPORT_SYMBOL(drm_primary_helper_update); | |||
203 | * | 203 | * |
204 | * Provides a default plane disable handler for primary planes. This is handler | 204 | * Provides a default plane disable handler for primary planes. This is handler |
205 | * is called in response to a userspace SetPlane operation on the plane with a | 205 | * is called in response to a userspace SetPlane operation on the plane with a |
206 | * NULL framebuffer parameter. We call the driver's modeset handler with a NULL | 206 | * NULL framebuffer parameter. It unconditionally fails the disable call with |
207 | * framebuffer to disable the CRTC if no other planes are currently enabled. | 207 | * -EINVAL the only way to disable the primary plane without driver support is |
208 | * If other planes are still enabled on the same CRTC, we return -EBUSY. | 208 | * to disable the entier CRTC. Which does not match the plane ->disable hook. |
209 | * | 209 | * |
210 | * Note that some hardware may be able to disable the primary plane without | 210 | * Note that some hardware may be able to disable the primary plane without |
211 | * disabling the whole CRTC. Drivers for such hardware should provide their | 211 | * disabling the whole CRTC. Drivers for such hardware should provide their |
@@ -214,34 +214,11 @@ EXPORT_SYMBOL(drm_primary_helper_update); | |||
214 | * disabled primary plane). | 214 | * disabled primary plane). |
215 | * | 215 | * |
216 | * RETURNS: | 216 | * RETURNS: |
217 | * Zero on success, error code on failure | 217 | * Unconditionally returns -EINVAL. |
218 | */ | 218 | */ |
219 | int drm_primary_helper_disable(struct drm_plane *plane) | 219 | int drm_primary_helper_disable(struct drm_plane *plane) |
220 | { | 220 | { |
221 | struct drm_plane *p; | 221 | return -EINVAL; |
222 | struct drm_mode_set set = { | ||
223 | .crtc = plane->crtc, | ||
224 | .fb = NULL, | ||
225 | }; | ||
226 | |||
227 | if (plane->crtc == NULL || plane->fb == NULL) | ||
228 | /* Already disabled */ | ||
229 | return 0; | ||
230 | |||
231 | list_for_each_entry(p, &plane->dev->mode_config.plane_list, head) | ||
232 | if (p != plane && p->fb) { | ||
233 | DRM_DEBUG_KMS("Cannot disable primary plane while other planes are still active on CRTC.\n"); | ||
234 | return -EBUSY; | ||
235 | } | ||
236 | |||
237 | /* | ||
238 | * N.B. We call set_config() directly here rather than | ||
239 | * drm_mode_set_config_internal() since drm_mode_setplane() already | ||
240 | * handles the basic refcounting and we don't need the special | ||
241 | * cross-CRTC refcounting (no chance of stealing connectors from | ||
242 | * other CRTC's with this update). | ||
243 | */ | ||
244 | return plane->crtc->funcs->set_config(&set); | ||
245 | } | 222 | } |
246 | EXPORT_SYMBOL(drm_primary_helper_disable); | 223 | EXPORT_SYMBOL(drm_primary_helper_disable); |
247 | 224 | ||
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c new file mode 100644 index 000000000000..e70f54d4a581 --- /dev/null +++ b/drivers/gpu/drm/drm_probe_helper.c | |||
@@ -0,0 +1,426 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006-2008 Intel Corporation | ||
3 | * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> | ||
4 | * | ||
5 | * DRM core CRTC related functions | ||
6 | * | ||
7 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
8 | * documentation for any purpose is hereby granted without fee, provided that | ||
9 | * the above copyright notice appear in all copies and that both that copyright | ||
10 | * notice and this permission notice appear in supporting documentation, and | ||
11 | * that the name of the copyright holders not be used in advertising or | ||
12 | * publicity pertaining to distribution of the software without specific, | ||
13 | * written prior permission. The copyright holders make no representations | ||
14 | * about the suitability of this software for any purpose. It is provided "as | ||
15 | * is" without express or implied warranty. | ||
16 | * | ||
17 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
18 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
19 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
20 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
21 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
22 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||
23 | * OF THIS SOFTWARE. | ||
24 | * | ||
25 | * Authors: | ||
26 | * Keith Packard | ||
27 | * Eric Anholt <eric@anholt.net> | ||
28 | * Dave Airlie <airlied@linux.ie> | ||
29 | * Jesse Barnes <jesse.barnes@intel.com> | ||
30 | */ | ||
31 | |||
32 | #include <linux/export.h> | ||
33 | #include <linux/moduleparam.h> | ||
34 | |||
35 | #include <drm/drmP.h> | ||
36 | #include <drm/drm_crtc.h> | ||
37 | #include <drm/drm_fourcc.h> | ||
38 | #include <drm/drm_crtc_helper.h> | ||
39 | #include <drm/drm_fb_helper.h> | ||
40 | #include <drm/drm_edid.h> | ||
41 | |||
42 | /** | ||
43 | * DOC: output probing helper overview | ||
44 | * | ||
45 | * This library provides some helper code for output probing. It provides an | ||
46 | * implementation of the core connector->fill_modes interface with | ||
47 | * drm_helper_probe_single_connector_modes. | ||
48 | * | ||
49 | * It also provides support for polling connectors with a work item and for | ||
50 | * generic hotplug interrupt handling where the driver doesn't or cannot keep | ||
51 | * track of a per-connector hpd interrupt. | ||
52 | * | ||
53 | * This helper library can be used independently of the modeset helper library. | ||
54 | * Drivers can also overwrite different parts e.g. use their own hotplug | ||
55 | * handling code to avoid probing unrelated outputs. | ||
56 | */ | ||
57 | |||
58 | static bool drm_kms_helper_poll = true; | ||
59 | module_param_named(poll, drm_kms_helper_poll, bool, 0600); | ||
60 | |||
61 | static void drm_mode_validate_flag(struct drm_connector *connector, | ||
62 | int flags) | ||
63 | { | ||
64 | struct drm_display_mode *mode; | ||
65 | |||
66 | if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE | | ||
67 | DRM_MODE_FLAG_3D_MASK)) | ||
68 | return; | ||
69 | |||
70 | list_for_each_entry(mode, &connector->modes, head) { | ||
71 | if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && | ||
72 | !(flags & DRM_MODE_FLAG_INTERLACE)) | ||
73 | mode->status = MODE_NO_INTERLACE; | ||
74 | if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) && | ||
75 | !(flags & DRM_MODE_FLAG_DBLSCAN)) | ||
76 | mode->status = MODE_NO_DBLESCAN; | ||
77 | if ((mode->flags & DRM_MODE_FLAG_3D_MASK) && | ||
78 | !(flags & DRM_MODE_FLAG_3D_MASK)) | ||
79 | mode->status = MODE_NO_STEREO; | ||
80 | } | ||
81 | |||
82 | return; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * drm_helper_probe_single_connector_modes - get complete set of display modes | ||
87 | * @connector: connector to probe | ||
88 | * @maxX: max width for modes | ||
89 | * @maxY: max height for modes | ||
90 | * | ||
91 | * Based on the helper callbacks implemented by @connector try to detect all | ||
92 | * valid modes. Modes will first be added to the connector's probed_modes list, | ||
93 | * then culled (based on validity and the @maxX, @maxY parameters) and put into | ||
94 | * the normal modes list. | ||
95 | * | ||
96 | * Intended to be use as a generic implementation of the ->fill_modes() | ||
97 | * @connector vfunc for drivers that use the crtc helpers for output mode | ||
98 | * filtering and detection. | ||
99 | * | ||
100 | * Returns: | ||
101 | * The number of modes found on @connector. | ||
102 | */ | ||
103 | int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | ||
104 | uint32_t maxX, uint32_t maxY) | ||
105 | { | ||
106 | struct drm_device *dev = connector->dev; | ||
107 | struct drm_display_mode *mode; | ||
108 | struct drm_connector_helper_funcs *connector_funcs = | ||
109 | connector->helper_private; | ||
110 | int count = 0; | ||
111 | int mode_flags = 0; | ||
112 | bool verbose_prune = true; | ||
113 | |||
114 | WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); | ||
115 | |||
116 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, | ||
117 | drm_get_connector_name(connector)); | ||
118 | /* set all modes to the unverified state */ | ||
119 | list_for_each_entry(mode, &connector->modes, head) | ||
120 | mode->status = MODE_UNVERIFIED; | ||
121 | |||
122 | if (connector->force) { | ||
123 | if (connector->force == DRM_FORCE_ON) | ||
124 | connector->status = connector_status_connected; | ||
125 | else | ||
126 | connector->status = connector_status_disconnected; | ||
127 | if (connector->funcs->force) | ||
128 | connector->funcs->force(connector); | ||
129 | } else { | ||
130 | connector->status = connector->funcs->detect(connector, true); | ||
131 | } | ||
132 | |||
133 | /* Re-enable polling in case the global poll config changed. */ | ||
134 | if (drm_kms_helper_poll != dev->mode_config.poll_running) | ||
135 | drm_kms_helper_poll_enable(dev); | ||
136 | |||
137 | dev->mode_config.poll_running = drm_kms_helper_poll; | ||
138 | |||
139 | if (connector->status == connector_status_disconnected) { | ||
140 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", | ||
141 | connector->base.id, drm_get_connector_name(connector)); | ||
142 | drm_mode_connector_update_edid_property(connector, NULL); | ||
143 | verbose_prune = false; | ||
144 | goto prune; | ||
145 | } | ||
146 | |||
147 | #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE | ||
148 | count = drm_load_edid_firmware(connector); | ||
149 | if (count == 0) | ||
150 | #endif | ||
151 | count = (*connector_funcs->get_modes)(connector); | ||
152 | |||
153 | if (count == 0 && connector->status == connector_status_connected) | ||
154 | count = drm_add_modes_noedid(connector, 1024, 768); | ||
155 | if (count == 0) | ||
156 | goto prune; | ||
157 | |||
158 | drm_mode_connector_list_update(connector); | ||
159 | |||
160 | if (maxX && maxY) | ||
161 | drm_mode_validate_size(dev, &connector->modes, maxX, maxY); | ||
162 | |||
163 | if (connector->interlace_allowed) | ||
164 | mode_flags |= DRM_MODE_FLAG_INTERLACE; | ||
165 | if (connector->doublescan_allowed) | ||
166 | mode_flags |= DRM_MODE_FLAG_DBLSCAN; | ||
167 | if (connector->stereo_allowed) | ||
168 | mode_flags |= DRM_MODE_FLAG_3D_MASK; | ||
169 | drm_mode_validate_flag(connector, mode_flags); | ||
170 | |||
171 | list_for_each_entry(mode, &connector->modes, head) { | ||
172 | if (mode->status == MODE_OK) | ||
173 | mode->status = connector_funcs->mode_valid(connector, | ||
174 | mode); | ||
175 | } | ||
176 | |||
177 | prune: | ||
178 | drm_mode_prune_invalid(dev, &connector->modes, verbose_prune); | ||
179 | |||
180 | if (list_empty(&connector->modes)) | ||
181 | return 0; | ||
182 | |||
183 | list_for_each_entry(mode, &connector->modes, head) | ||
184 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
185 | |||
186 | drm_mode_sort(&connector->modes); | ||
187 | |||
188 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id, | ||
189 | drm_get_connector_name(connector)); | ||
190 | list_for_each_entry(mode, &connector->modes, head) { | ||
191 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); | ||
192 | drm_mode_debug_printmodeline(mode); | ||
193 | } | ||
194 | |||
195 | return count; | ||
196 | } | ||
197 | EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); | ||
198 | |||
199 | /** | ||
200 | * drm_kms_helper_hotplug_event - fire off KMS hotplug events | ||
201 | * @dev: drm_device whose connector state changed | ||
202 | * | ||
203 | * This function fires off the uevent for userspace and also calls the | ||
204 | * output_poll_changed function, which is most commonly used to inform the fbdev | ||
205 | * emulation code and allow it to update the fbcon output configuration. | ||
206 | * | ||
207 | * Drivers should call this from their hotplug handling code when a change is | ||
208 | * detected. Note that this function does not do any output detection of its | ||
209 | * own, like drm_helper_hpd_irq_event() does - this is assumed to be done by the | ||
210 | * driver already. | ||
211 | * | ||
212 | * This function must be called from process context with no mode | ||
213 | * setting locks held. | ||
214 | */ | ||
215 | void drm_kms_helper_hotplug_event(struct drm_device *dev) | ||
216 | { | ||
217 | /* send a uevent + call fbdev */ | ||
218 | drm_sysfs_hotplug_event(dev); | ||
219 | if (dev->mode_config.funcs->output_poll_changed) | ||
220 | dev->mode_config.funcs->output_poll_changed(dev); | ||
221 | } | ||
222 | EXPORT_SYMBOL(drm_kms_helper_hotplug_event); | ||
223 | |||
224 | #define DRM_OUTPUT_POLL_PERIOD (10*HZ) | ||
225 | static void output_poll_execute(struct work_struct *work) | ||
226 | { | ||
227 | struct delayed_work *delayed_work = to_delayed_work(work); | ||
228 | struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); | ||
229 | struct drm_connector *connector; | ||
230 | enum drm_connector_status old_status; | ||
231 | bool repoll = false, changed = false; | ||
232 | |||
233 | if (!drm_kms_helper_poll) | ||
234 | return; | ||
235 | |||
236 | mutex_lock(&dev->mode_config.mutex); | ||
237 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
238 | |||
239 | /* Ignore forced connectors. */ | ||
240 | if (connector->force) | ||
241 | continue; | ||
242 | |||
243 | /* Ignore HPD capable connectors and connectors where we don't | ||
244 | * want any hotplug detection at all for polling. */ | ||
245 | if (!connector->polled || connector->polled == DRM_CONNECTOR_POLL_HPD) | ||
246 | continue; | ||
247 | |||
248 | repoll = true; | ||
249 | |||
250 | old_status = connector->status; | ||
251 | /* if we are connected and don't want to poll for disconnect | ||
252 | skip it */ | ||
253 | if (old_status == connector_status_connected && | ||
254 | !(connector->polled & DRM_CONNECTOR_POLL_DISCONNECT)) | ||
255 | continue; | ||
256 | |||
257 | connector->status = connector->funcs->detect(connector, false); | ||
258 | if (old_status != connector->status) { | ||
259 | const char *old, *new; | ||
260 | |||
261 | old = drm_get_connector_status_name(old_status); | ||
262 | new = drm_get_connector_status_name(connector->status); | ||
263 | |||
264 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " | ||
265 | "status updated from %s to %s\n", | ||
266 | connector->base.id, | ||
267 | drm_get_connector_name(connector), | ||
268 | old, new); | ||
269 | |||
270 | changed = true; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | mutex_unlock(&dev->mode_config.mutex); | ||
275 | |||
276 | if (changed) | ||
277 | drm_kms_helper_hotplug_event(dev); | ||
278 | |||
279 | if (repoll) | ||
280 | schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * drm_kms_helper_poll_disable - disable output polling | ||
285 | * @dev: drm_device | ||
286 | * | ||
287 | * This function disables the output polling work. | ||
288 | * | ||
289 | * Drivers can call this helper from their device suspend implementation. It is | ||
290 | * not an error to call this even when output polling isn't enabled or arlready | ||
291 | * disabled. | ||
292 | */ | ||
293 | void drm_kms_helper_poll_disable(struct drm_device *dev) | ||
294 | { | ||
295 | if (!dev->mode_config.poll_enabled) | ||
296 | return; | ||
297 | cancel_delayed_work_sync(&dev->mode_config.output_poll_work); | ||
298 | } | ||
299 | EXPORT_SYMBOL(drm_kms_helper_poll_disable); | ||
300 | |||
301 | /** | ||
302 | * drm_kms_helper_poll_enable - re-enable output polling. | ||
303 | * @dev: drm_device | ||
304 | * | ||
305 | * This function re-enables the output polling work. | ||
306 | * | ||
307 | * Drivers can call this helper from their device resume implementation. It is | ||
308 | * an error to call this when the output polling support has not yet been set | ||
309 | * up. | ||
310 | */ | ||
311 | void drm_kms_helper_poll_enable(struct drm_device *dev) | ||
312 | { | ||
313 | bool poll = false; | ||
314 | struct drm_connector *connector; | ||
315 | |||
316 | if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) | ||
317 | return; | ||
318 | |||
319 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
320 | if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | | ||
321 | DRM_CONNECTOR_POLL_DISCONNECT)) | ||
322 | poll = true; | ||
323 | } | ||
324 | |||
325 | if (poll) | ||
326 | schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); | ||
327 | } | ||
328 | EXPORT_SYMBOL(drm_kms_helper_poll_enable); | ||
329 | |||
330 | /** | ||
331 | * drm_kms_helper_poll_init - initialize and enable output polling | ||
332 | * @dev: drm_device | ||
333 | * | ||
334 | * This function intializes and then also enables output polling support for | ||
335 | * @dev. Drivers which do not have reliable hotplug support in hardware can use | ||
336 | * this helper infrastructure to regularly poll such connectors for changes in | ||
337 | * their connection state. | ||
338 | * | ||
339 | * Drivers can control which connectors are polled by setting the | ||
340 | * DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags. On | ||
341 | * connectors where probing live outputs can result in visual distortion drivers | ||
342 | * should not set the DRM_CONNECTOR_POLL_DISCONNECT flag to avoid this. | ||
343 | * Connectors which have no flag or only DRM_CONNECTOR_POLL_HPD set are | ||
344 | * completely ignored by the polling logic. | ||
345 | * | ||
346 | * Note that a connector can be both polled and probed from the hotplug handler, | ||
347 | * in case the hotplug interrupt is known to be unreliable. | ||
348 | */ | ||
349 | void drm_kms_helper_poll_init(struct drm_device *dev) | ||
350 | { | ||
351 | INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); | ||
352 | dev->mode_config.poll_enabled = true; | ||
353 | |||
354 | drm_kms_helper_poll_enable(dev); | ||
355 | } | ||
356 | EXPORT_SYMBOL(drm_kms_helper_poll_init); | ||
357 | |||
358 | /** | ||
359 | * drm_kms_helper_poll_fini - disable output polling and clean it up | ||
360 | * @dev: drm_device | ||
361 | */ | ||
362 | void drm_kms_helper_poll_fini(struct drm_device *dev) | ||
363 | { | ||
364 | drm_kms_helper_poll_disable(dev); | ||
365 | } | ||
366 | EXPORT_SYMBOL(drm_kms_helper_poll_fini); | ||
367 | |||
368 | /** | ||
369 | * drm_helper_hpd_irq_event - hotplug processing | ||
370 | * @dev: drm_device | ||
371 | * | ||
372 | * Drivers can use this helper function to run a detect cycle on all connectors | ||
373 | * which have the DRM_CONNECTOR_POLL_HPD flag set in their &polled member. All | ||
374 | * other connectors are ignored, which is useful to avoid reprobing fixed | ||
375 | * panels. | ||
376 | * | ||
377 | * This helper function is useful for drivers which can't or don't track hotplug | ||
378 | * interrupts for each connector. | ||
379 | * | ||
380 | * Drivers which support hotplug interrupts for each connector individually and | ||
381 | * which have a more fine-grained detect logic should bypass this code and | ||
382 | * directly call drm_kms_helper_hotplug_event() in case the connector state | ||
383 | * changed. | ||
384 | * | ||
385 | * This function must be called from process context with no mode | ||
386 | * setting locks held. | ||
387 | * | ||
388 | * Note that a connector can be both polled and probed from the hotplug handler, | ||
389 | * in case the hotplug interrupt is known to be unreliable. | ||
390 | */ | ||
391 | bool drm_helper_hpd_irq_event(struct drm_device *dev) | ||
392 | { | ||
393 | struct drm_connector *connector; | ||
394 | enum drm_connector_status old_status; | ||
395 | bool changed = false; | ||
396 | |||
397 | if (!dev->mode_config.poll_enabled) | ||
398 | return false; | ||
399 | |||
400 | mutex_lock(&dev->mode_config.mutex); | ||
401 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
402 | |||
403 | /* Only handle HPD capable connectors. */ | ||
404 | if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) | ||
405 | continue; | ||
406 | |||
407 | old_status = connector->status; | ||
408 | |||
409 | connector->status = connector->funcs->detect(connector, false); | ||
410 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", | ||
411 | connector->base.id, | ||
412 | drm_get_connector_name(connector), | ||
413 | drm_get_connector_status_name(old_status), | ||
414 | drm_get_connector_status_name(connector->status)); | ||
415 | if (old_status != connector->status) | ||
416 | changed = true; | ||
417 | } | ||
418 | |||
419 | mutex_unlock(&dev->mode_config.mutex); | ||
420 | |||
421 | if (changed) | ||
422 | drm_kms_helper_hotplug_event(dev); | ||
423 | |||
424 | return changed; | ||
425 | } | ||
426 | EXPORT_SYMBOL(drm_helper_hpd_irq_event); | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 0905cd915589..ec82f6bff122 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1308,6 +1308,7 @@ struct intel_vbt_data { | |||
1308 | 1308 | ||
1309 | struct { | 1309 | struct { |
1310 | u16 pwm_freq_hz; | 1310 | u16 pwm_freq_hz; |
1311 | bool present; | ||
1311 | bool active_low_pwm; | 1312 | bool active_low_pwm; |
1312 | } backlight; | 1313 | } backlight; |
1313 | 1314 | ||
@@ -2431,20 +2432,18 @@ int i915_gem_context_open(struct drm_device *dev, struct drm_file *file); | |||
2431 | int i915_gem_context_enable(struct drm_i915_private *dev_priv); | 2432 | int i915_gem_context_enable(struct drm_i915_private *dev_priv); |
2432 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); | 2433 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); |
2433 | int i915_switch_context(struct intel_ring_buffer *ring, | 2434 | int i915_switch_context(struct intel_ring_buffer *ring, |
2434 | struct drm_file *file, struct i915_hw_context *to); | 2435 | struct i915_hw_context *to); |
2435 | struct i915_hw_context * | 2436 | struct i915_hw_context * |
2436 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); | 2437 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); |
2437 | void i915_gem_context_free(struct kref *ctx_ref); | 2438 | void i915_gem_context_free(struct kref *ctx_ref); |
2438 | static inline void i915_gem_context_reference(struct i915_hw_context *ctx) | 2439 | static inline void i915_gem_context_reference(struct i915_hw_context *ctx) |
2439 | { | 2440 | { |
2440 | if (ctx->obj && HAS_HW_CONTEXTS(ctx->obj->base.dev)) | 2441 | kref_get(&ctx->ref); |
2441 | kref_get(&ctx->ref); | ||
2442 | } | 2442 | } |
2443 | 2443 | ||
2444 | static inline void i915_gem_context_unreference(struct i915_hw_context *ctx) | 2444 | static inline void i915_gem_context_unreference(struct i915_hw_context *ctx) |
2445 | { | 2445 | { |
2446 | if (ctx->obj && HAS_HW_CONTEXTS(ctx->obj->base.dev)) | 2446 | kref_put(&ctx->ref, i915_gem_context_free); |
2447 | kref_put(&ctx->ref, i915_gem_context_free); | ||
2448 | } | 2447 | } |
2449 | 2448 | ||
2450 | static inline bool i915_gem_context_is_default(const struct i915_hw_context *c) | 2449 | static inline bool i915_gem_context_is_default(const struct i915_hw_context *c) |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6370a761d137..2871ce75f438 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2790,7 +2790,7 @@ int i915_gpu_idle(struct drm_device *dev) | |||
2790 | 2790 | ||
2791 | /* Flush everything onto the inactive list. */ | 2791 | /* Flush everything onto the inactive list. */ |
2792 | for_each_ring(ring, dev_priv, i) { | 2792 | for_each_ring(ring, dev_priv, i) { |
2793 | ret = i915_switch_context(ring, NULL, ring->default_context); | 2793 | ret = i915_switch_context(ring, ring->default_context); |
2794 | if (ret) | 2794 | if (ret) |
2795 | return ret; | 2795 | return ret; |
2796 | 2796 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 6043062ffce7..d72db15afa02 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -96,9 +96,6 @@ | |||
96 | #define GEN6_CONTEXT_ALIGN (64<<10) | 96 | #define GEN6_CONTEXT_ALIGN (64<<10) |
97 | #define GEN7_CONTEXT_ALIGN 4096 | 97 | #define GEN7_CONTEXT_ALIGN 4096 |
98 | 98 | ||
99 | static int do_switch(struct intel_ring_buffer *ring, | ||
100 | struct i915_hw_context *to); | ||
101 | |||
102 | static void do_ppgtt_cleanup(struct i915_hw_ppgtt *ppgtt) | 99 | static void do_ppgtt_cleanup(struct i915_hw_ppgtt *ppgtt) |
103 | { | 100 | { |
104 | struct drm_device *dev = ppgtt->base.dev; | 101 | struct drm_device *dev = ppgtt->base.dev; |
@@ -185,13 +182,15 @@ void i915_gem_context_free(struct kref *ctx_ref) | |||
185 | typeof(*ctx), ref); | 182 | typeof(*ctx), ref); |
186 | struct i915_hw_ppgtt *ppgtt = NULL; | 183 | struct i915_hw_ppgtt *ppgtt = NULL; |
187 | 184 | ||
188 | /* We refcount even the aliasing PPGTT to keep the code symmetric */ | 185 | if (ctx->obj) { |
189 | if (USES_PPGTT(ctx->obj->base.dev)) | 186 | /* We refcount even the aliasing PPGTT to keep the code symmetric */ |
190 | ppgtt = ctx_to_ppgtt(ctx); | 187 | if (USES_PPGTT(ctx->obj->base.dev)) |
188 | ppgtt = ctx_to_ppgtt(ctx); | ||
191 | 189 | ||
192 | /* XXX: Free up the object before tearing down the address space, in | 190 | /* XXX: Free up the object before tearing down the address space, in |
193 | * case we're bound in the PPGTT */ | 191 | * case we're bound in the PPGTT */ |
194 | drm_gem_object_unreference(&ctx->obj->base); | 192 | drm_gem_object_unreference(&ctx->obj->base); |
193 | } | ||
195 | 194 | ||
196 | if (ppgtt) | 195 | if (ppgtt) |
197 | kref_put(&ppgtt->ref, ppgtt_release); | 196 | kref_put(&ppgtt->ref, ppgtt_release); |
@@ -232,32 +231,32 @@ __create_hw_context(struct drm_device *dev, | |||
232 | return ERR_PTR(-ENOMEM); | 231 | return ERR_PTR(-ENOMEM); |
233 | 232 | ||
234 | kref_init(&ctx->ref); | 233 | kref_init(&ctx->ref); |
235 | ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); | 234 | list_add_tail(&ctx->link, &dev_priv->context_list); |
236 | INIT_LIST_HEAD(&ctx->link); | ||
237 | if (ctx->obj == NULL) { | ||
238 | kfree(ctx); | ||
239 | DRM_DEBUG_DRIVER("Context object allocated failed\n"); | ||
240 | return ERR_PTR(-ENOMEM); | ||
241 | } | ||
242 | 235 | ||
243 | if (INTEL_INFO(dev)->gen >= 7) { | 236 | if (dev_priv->hw_context_size) { |
244 | ret = i915_gem_object_set_cache_level(ctx->obj, | 237 | ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); |
245 | I915_CACHE_L3_LLC); | 238 | if (ctx->obj == NULL) { |
246 | /* Failure shouldn't ever happen this early */ | 239 | ret = -ENOMEM; |
247 | if (WARN_ON(ret)) | ||
248 | goto err_out; | 240 | goto err_out; |
249 | } | 241 | } |
250 | 242 | ||
251 | list_add_tail(&ctx->link, &dev_priv->context_list); | 243 | if (INTEL_INFO(dev)->gen >= 7) { |
244 | ret = i915_gem_object_set_cache_level(ctx->obj, | ||
245 | I915_CACHE_L3_LLC); | ||
246 | /* Failure shouldn't ever happen this early */ | ||
247 | if (WARN_ON(ret)) | ||
248 | goto err_out; | ||
249 | } | ||
250 | } | ||
252 | 251 | ||
253 | /* Default context will never have a file_priv */ | 252 | /* Default context will never have a file_priv */ |
254 | if (file_priv == NULL) | 253 | if (file_priv != NULL) { |
255 | return ctx; | 254 | ret = idr_alloc(&file_priv->context_idr, ctx, |
256 | 255 | DEFAULT_CONTEXT_ID, 0, GFP_KERNEL); | |
257 | ret = idr_alloc(&file_priv->context_idr, ctx, DEFAULT_CONTEXT_ID, 0, | 256 | if (ret < 0) |
258 | GFP_KERNEL); | 257 | goto err_out; |
259 | if (ret < 0) | 258 | } else |
260 | goto err_out; | 259 | ret = DEFAULT_CONTEXT_ID; |
261 | 260 | ||
262 | ctx->file_priv = file_priv; | 261 | ctx->file_priv = file_priv; |
263 | ctx->id = ret; | 262 | ctx->id = ret; |
@@ -294,7 +293,7 @@ i915_gem_create_context(struct drm_device *dev, | |||
294 | if (IS_ERR(ctx)) | 293 | if (IS_ERR(ctx)) |
295 | return ctx; | 294 | return ctx; |
296 | 295 | ||
297 | if (is_global_default_ctx) { | 296 | if (is_global_default_ctx && ctx->obj) { |
298 | /* We may need to do things with the shrinker which | 297 | /* We may need to do things with the shrinker which |
299 | * require us to immediately switch back to the default | 298 | * require us to immediately switch back to the default |
300 | * context. This can cause a problem as pinning the | 299 | * context. This can cause a problem as pinning the |
@@ -342,7 +341,7 @@ i915_gem_create_context(struct drm_device *dev, | |||
342 | return ctx; | 341 | return ctx; |
343 | 342 | ||
344 | err_unpin: | 343 | err_unpin: |
345 | if (is_global_default_ctx) | 344 | if (is_global_default_ctx && ctx->obj) |
346 | i915_gem_object_ggtt_unpin(ctx->obj); | 345 | i915_gem_object_ggtt_unpin(ctx->obj); |
347 | err_destroy: | 346 | err_destroy: |
348 | i915_gem_context_unreference(ctx); | 347 | i915_gem_context_unreference(ctx); |
@@ -352,32 +351,22 @@ err_destroy: | |||
352 | void i915_gem_context_reset(struct drm_device *dev) | 351 | void i915_gem_context_reset(struct drm_device *dev) |
353 | { | 352 | { |
354 | struct drm_i915_private *dev_priv = dev->dev_private; | 353 | struct drm_i915_private *dev_priv = dev->dev_private; |
355 | struct intel_ring_buffer *ring; | ||
356 | int i; | 354 | int i; |
357 | 355 | ||
358 | if (!HAS_HW_CONTEXTS(dev)) | ||
359 | return; | ||
360 | |||
361 | /* Prevent the hardware from restoring the last context (which hung) on | 356 | /* Prevent the hardware from restoring the last context (which hung) on |
362 | * the next switch */ | 357 | * the next switch */ |
363 | for (i = 0; i < I915_NUM_RINGS; i++) { | 358 | for (i = 0; i < I915_NUM_RINGS; i++) { |
364 | struct i915_hw_context *dctx; | 359 | struct intel_ring_buffer *ring = &dev_priv->ring[i]; |
365 | if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) | 360 | struct i915_hw_context *dctx = ring->default_context; |
366 | continue; | ||
367 | 361 | ||
368 | /* Do a fake switch to the default context */ | 362 | /* Do a fake switch to the default context */ |
369 | ring = &dev_priv->ring[i]; | 363 | if (ring->last_context == dctx) |
370 | dctx = ring->default_context; | ||
371 | if (WARN_ON(!dctx)) | ||
372 | continue; | 364 | continue; |
373 | 365 | ||
374 | if (!ring->last_context) | 366 | if (!ring->last_context) |
375 | continue; | 367 | continue; |
376 | 368 | ||
377 | if (ring->last_context == dctx) | 369 | if (dctx->obj && i == RCS) { |
378 | continue; | ||
379 | |||
380 | if (i == RCS) { | ||
381 | WARN_ON(i915_gem_obj_ggtt_pin(dctx->obj, | 370 | WARN_ON(i915_gem_obj_ggtt_pin(dctx->obj, |
382 | get_context_alignment(dev), 0)); | 371 | get_context_alignment(dev), 0)); |
383 | /* Fake a finish/inactive */ | 372 | /* Fake a finish/inactive */ |
@@ -394,44 +383,35 @@ void i915_gem_context_reset(struct drm_device *dev) | |||
394 | int i915_gem_context_init(struct drm_device *dev) | 383 | int i915_gem_context_init(struct drm_device *dev) |
395 | { | 384 | { |
396 | struct drm_i915_private *dev_priv = dev->dev_private; | 385 | struct drm_i915_private *dev_priv = dev->dev_private; |
397 | struct intel_ring_buffer *ring; | 386 | struct i915_hw_context *ctx; |
398 | int i; | 387 | int i; |
399 | 388 | ||
400 | if (!HAS_HW_CONTEXTS(dev)) | ||
401 | return 0; | ||
402 | |||
403 | /* Init should only be called once per module load. Eventually the | 389 | /* Init should only be called once per module load. Eventually the |
404 | * restriction on the context_disabled check can be loosened. */ | 390 | * restriction on the context_disabled check can be loosened. */ |
405 | if (WARN_ON(dev_priv->ring[RCS].default_context)) | 391 | if (WARN_ON(dev_priv->ring[RCS].default_context)) |
406 | return 0; | 392 | return 0; |
407 | 393 | ||
408 | dev_priv->hw_context_size = round_up(get_context_size(dev), 4096); | 394 | if (HAS_HW_CONTEXTS(dev)) { |
409 | 395 | dev_priv->hw_context_size = round_up(get_context_size(dev), 4096); | |
410 | if (dev_priv->hw_context_size > (1<<20)) { | 396 | if (dev_priv->hw_context_size > (1<<20)) { |
411 | DRM_DEBUG_DRIVER("Disabling HW Contexts; invalid size\n"); | 397 | DRM_DEBUG_DRIVER("Disabling HW Contexts; invalid size %d\n", |
412 | return -E2BIG; | 398 | dev_priv->hw_context_size); |
399 | dev_priv->hw_context_size = 0; | ||
400 | } | ||
413 | } | 401 | } |
414 | 402 | ||
415 | dev_priv->ring[RCS].default_context = | 403 | ctx = i915_gem_create_context(dev, NULL, USES_PPGTT(dev)); |
416 | i915_gem_create_context(dev, NULL, USES_PPGTT(dev)); | 404 | if (IS_ERR(ctx)) { |
417 | 405 | DRM_ERROR("Failed to create default global context (error %ld)\n", | |
418 | if (IS_ERR_OR_NULL(dev_priv->ring[RCS].default_context)) { | 406 | PTR_ERR(ctx)); |
419 | DRM_DEBUG_DRIVER("Disabling HW Contexts; create failed %ld\n", | 407 | return PTR_ERR(ctx); |
420 | PTR_ERR(dev_priv->ring[RCS].default_context)); | ||
421 | return PTR_ERR(dev_priv->ring[RCS].default_context); | ||
422 | } | 408 | } |
423 | 409 | ||
424 | for (i = RCS + 1; i < I915_NUM_RINGS; i++) { | 410 | /* NB: RCS will hold a ref for all rings */ |
425 | if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) | 411 | for (i = 0; i < I915_NUM_RINGS; i++) |
426 | continue; | 412 | dev_priv->ring[i].default_context = ctx; |
427 | |||
428 | ring = &dev_priv->ring[i]; | ||
429 | 413 | ||
430 | /* NB: RCS will hold a ref for all rings */ | 414 | DRM_DEBUG_DRIVER("%s context support initialized\n", dev_priv->hw_context_size ? "HW" : "fake"); |
431 | ring->default_context = dev_priv->ring[RCS].default_context; | ||
432 | } | ||
433 | |||
434 | DRM_DEBUG_DRIVER("HW context support initialized\n"); | ||
435 | return 0; | 415 | return 0; |
436 | } | 416 | } |
437 | 417 | ||
@@ -441,33 +421,30 @@ void i915_gem_context_fini(struct drm_device *dev) | |||
441 | struct i915_hw_context *dctx = dev_priv->ring[RCS].default_context; | 421 | struct i915_hw_context *dctx = dev_priv->ring[RCS].default_context; |
442 | int i; | 422 | int i; |
443 | 423 | ||
444 | if (!HAS_HW_CONTEXTS(dev)) | 424 | if (dctx->obj) { |
445 | return; | 425 | /* The only known way to stop the gpu from accessing the hw context is |
446 | 426 | * to reset it. Do this as the very last operation to avoid confusing | |
447 | /* The only known way to stop the gpu from accessing the hw context is | 427 | * other code, leading to spurious errors. */ |
448 | * to reset it. Do this as the very last operation to avoid confusing | 428 | intel_gpu_reset(dev); |
449 | * other code, leading to spurious errors. */ | 429 | |
450 | intel_gpu_reset(dev); | 430 | /* When default context is created and switched to, base object refcount |
451 | 431 | * will be 2 (+1 from object creation and +1 from do_switch()). | |
452 | /* When default context is created and switched to, base object refcount | 432 | * i915_gem_context_fini() will be called after gpu_idle() has switched |
453 | * will be 2 (+1 from object creation and +1 from do_switch()). | 433 | * to default context. So we need to unreference the base object once |
454 | * i915_gem_context_fini() will be called after gpu_idle() has switched | 434 | * to offset the do_switch part, so that i915_gem_context_unreference() |
455 | * to default context. So we need to unreference the base object once | 435 | * can then free the base object correctly. */ |
456 | * to offset the do_switch part, so that i915_gem_context_unreference() | 436 | WARN_ON(!dev_priv->ring[RCS].last_context); |
457 | * can then free the base object correctly. */ | 437 | if (dev_priv->ring[RCS].last_context == dctx) { |
458 | WARN_ON(!dev_priv->ring[RCS].last_context); | 438 | /* Fake switch to NULL context */ |
459 | if (dev_priv->ring[RCS].last_context == dctx) { | 439 | WARN_ON(dctx->obj->active); |
460 | /* Fake switch to NULL context */ | 440 | i915_gem_object_ggtt_unpin(dctx->obj); |
461 | WARN_ON(dctx->obj->active); | 441 | i915_gem_context_unreference(dctx); |
462 | i915_gem_object_ggtt_unpin(dctx->obj); | 442 | dev_priv->ring[RCS].last_context = NULL; |
463 | i915_gem_context_unreference(dctx); | 443 | } |
464 | dev_priv->ring[RCS].last_context = NULL; | ||
465 | } | 444 | } |
466 | 445 | ||
467 | for (i = 0; i < I915_NUM_RINGS; i++) { | 446 | for (i = 0; i < I915_NUM_RINGS; i++) { |
468 | struct intel_ring_buffer *ring = &dev_priv->ring[i]; | 447 | struct intel_ring_buffer *ring = &dev_priv->ring[i]; |
469 | if (!(INTEL_INFO(dev)->ring_mask & (1<<i))) | ||
470 | continue; | ||
471 | 448 | ||
472 | if (ring->last_context) | 449 | if (ring->last_context) |
473 | i915_gem_context_unreference(ring->last_context); | 450 | i915_gem_context_unreference(ring->last_context); |
@@ -478,7 +455,6 @@ void i915_gem_context_fini(struct drm_device *dev) | |||
478 | 455 | ||
479 | i915_gem_object_ggtt_unpin(dctx->obj); | 456 | i915_gem_object_ggtt_unpin(dctx->obj); |
480 | i915_gem_context_unreference(dctx); | 457 | i915_gem_context_unreference(dctx); |
481 | dev_priv->mm.aliasing_ppgtt = NULL; | ||
482 | } | 458 | } |
483 | 459 | ||
484 | int i915_gem_context_enable(struct drm_i915_private *dev_priv) | 460 | int i915_gem_context_enable(struct drm_i915_private *dev_priv) |
@@ -486,9 +462,6 @@ int i915_gem_context_enable(struct drm_i915_private *dev_priv) | |||
486 | struct intel_ring_buffer *ring; | 462 | struct intel_ring_buffer *ring; |
487 | int ret, i; | 463 | int ret, i; |
488 | 464 | ||
489 | if (!HAS_HW_CONTEXTS(dev_priv->dev)) | ||
490 | return 0; | ||
491 | |||
492 | /* This is the only place the aliasing PPGTT gets enabled, which means | 465 | /* This is the only place the aliasing PPGTT gets enabled, which means |
493 | * it has to happen before we bail on reset */ | 466 | * it has to happen before we bail on reset */ |
494 | if (dev_priv->mm.aliasing_ppgtt) { | 467 | if (dev_priv->mm.aliasing_ppgtt) { |
@@ -503,7 +476,7 @@ int i915_gem_context_enable(struct drm_i915_private *dev_priv) | |||
503 | BUG_ON(!dev_priv->ring[RCS].default_context); | 476 | BUG_ON(!dev_priv->ring[RCS].default_context); |
504 | 477 | ||
505 | for_each_ring(ring, dev_priv, i) { | 478 | for_each_ring(ring, dev_priv, i) { |
506 | ret = do_switch(ring, ring->default_context); | 479 | ret = i915_switch_context(ring, ring->default_context); |
507 | if (ret) | 480 | if (ret) |
508 | return ret; | 481 | return ret; |
509 | } | 482 | } |
@@ -526,19 +499,6 @@ static int context_idr_cleanup(int id, void *p, void *data) | |||
526 | int i915_gem_context_open(struct drm_device *dev, struct drm_file *file) | 499 | int i915_gem_context_open(struct drm_device *dev, struct drm_file *file) |
527 | { | 500 | { |
528 | struct drm_i915_file_private *file_priv = file->driver_priv; | 501 | struct drm_i915_file_private *file_priv = file->driver_priv; |
529 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
530 | |||
531 | if (!HAS_HW_CONTEXTS(dev)) { | ||
532 | /* Cheat for hang stats */ | ||
533 | file_priv->private_default_ctx = | ||
534 | kzalloc(sizeof(struct i915_hw_context), GFP_KERNEL); | ||
535 | |||
536 | if (file_priv->private_default_ctx == NULL) | ||
537 | return -ENOMEM; | ||
538 | |||
539 | file_priv->private_default_ctx->vm = &dev_priv->gtt.base; | ||
540 | return 0; | ||
541 | } | ||
542 | 502 | ||
543 | idr_init(&file_priv->context_idr); | 503 | idr_init(&file_priv->context_idr); |
544 | 504 | ||
@@ -559,14 +519,10 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) | |||
559 | { | 519 | { |
560 | struct drm_i915_file_private *file_priv = file->driver_priv; | 520 | struct drm_i915_file_private *file_priv = file->driver_priv; |
561 | 521 | ||
562 | if (!HAS_HW_CONTEXTS(dev)) { | ||
563 | kfree(file_priv->private_default_ctx); | ||
564 | return; | ||
565 | } | ||
566 | |||
567 | idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); | 522 | idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL); |
568 | i915_gem_context_unreference(file_priv->private_default_ctx); | ||
569 | idr_destroy(&file_priv->context_idr); | 523 | idr_destroy(&file_priv->context_idr); |
524 | |||
525 | i915_gem_context_unreference(file_priv->private_default_ctx); | ||
570 | } | 526 | } |
571 | 527 | ||
572 | struct i915_hw_context * | 528 | struct i915_hw_context * |
@@ -574,9 +530,6 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id) | |||
574 | { | 530 | { |
575 | struct i915_hw_context *ctx; | 531 | struct i915_hw_context *ctx; |
576 | 532 | ||
577 | if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev)) | ||
578 | return file_priv->private_default_ctx; | ||
579 | |||
580 | ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id); | 533 | ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id); |
581 | if (!ctx) | 534 | if (!ctx) |
582 | return ERR_PTR(-ENOENT); | 535 | return ERR_PTR(-ENOENT); |
@@ -758,7 +711,6 @@ unpin_out: | |||
758 | /** | 711 | /** |
759 | * i915_switch_context() - perform a GPU context switch. | 712 | * i915_switch_context() - perform a GPU context switch. |
760 | * @ring: ring for which we'll execute the context switch | 713 | * @ring: ring for which we'll execute the context switch |
761 | * @file_priv: file_priv associated with the context, may be NULL | ||
762 | * @to: the context to switch to | 714 | * @to: the context to switch to |
763 | * | 715 | * |
764 | * The context life cycle is simple. The context refcount is incremented and | 716 | * The context life cycle is simple. The context refcount is incremented and |
@@ -767,24 +719,30 @@ unpin_out: | |||
767 | * object while letting the normal object tracking destroy the backing BO. | 719 | * object while letting the normal object tracking destroy the backing BO. |
768 | */ | 720 | */ |
769 | int i915_switch_context(struct intel_ring_buffer *ring, | 721 | int i915_switch_context(struct intel_ring_buffer *ring, |
770 | struct drm_file *file, | ||
771 | struct i915_hw_context *to) | 722 | struct i915_hw_context *to) |
772 | { | 723 | { |
773 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | 724 | struct drm_i915_private *dev_priv = ring->dev->dev_private; |
774 | 725 | ||
775 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); | 726 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); |
776 | 727 | ||
777 | BUG_ON(file && to == NULL); | 728 | if (to->obj == NULL) { /* We have the fake context */ |
778 | 729 | if (to != ring->last_context) { | |
779 | /* We have the fake context */ | 730 | i915_gem_context_reference(to); |
780 | if (!HAS_HW_CONTEXTS(ring->dev)) { | 731 | if (ring->last_context) |
781 | ring->last_context = to; | 732 | i915_gem_context_unreference(ring->last_context); |
733 | ring->last_context = to; | ||
734 | } | ||
782 | return 0; | 735 | return 0; |
783 | } | 736 | } |
784 | 737 | ||
785 | return do_switch(ring, to); | 738 | return do_switch(ring, to); |
786 | } | 739 | } |
787 | 740 | ||
741 | static bool hw_context_enabled(struct drm_device *dev) | ||
742 | { | ||
743 | return to_i915(dev)->hw_context_size; | ||
744 | } | ||
745 | |||
788 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, | 746 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, |
789 | struct drm_file *file) | 747 | struct drm_file *file) |
790 | { | 748 | { |
@@ -793,7 +751,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, | |||
793 | struct i915_hw_context *ctx; | 751 | struct i915_hw_context *ctx; |
794 | int ret; | 752 | int ret; |
795 | 753 | ||
796 | if (!HAS_HW_CONTEXTS(dev)) | 754 | if (!hw_context_enabled(dev)) |
797 | return -ENODEV; | 755 | return -ENODEV; |
798 | 756 | ||
799 | ret = i915_mutex_lock_interruptible(dev); | 757 | ret = i915_mutex_lock_interruptible(dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 7447160155a3..2c9d9cbaf653 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1221,7 +1221,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1221 | if (ret) | 1221 | if (ret) |
1222 | goto err; | 1222 | goto err; |
1223 | 1223 | ||
1224 | ret = i915_switch_context(ring, file, ctx); | 1224 | ret = i915_switch_context(ring, ctx); |
1225 | if (ret) | 1225 | if (ret) |
1226 | goto err; | 1226 | goto err; |
1227 | 1227 | ||
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 4867f4cc0938..fa486c5fbb02 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -287,6 +287,9 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
287 | const struct bdb_lfp_backlight_data *backlight_data; | 287 | const struct bdb_lfp_backlight_data *backlight_data; |
288 | const struct bdb_lfp_backlight_data_entry *entry; | 288 | const struct bdb_lfp_backlight_data_entry *entry; |
289 | 289 | ||
290 | /* Err to enabling backlight if no backlight block. */ | ||
291 | dev_priv->vbt.backlight.present = true; | ||
292 | |||
290 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); | 293 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); |
291 | if (!backlight_data) | 294 | if (!backlight_data) |
292 | return; | 295 | return; |
@@ -299,6 +302,13 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
299 | 302 | ||
300 | entry = &backlight_data->data[panel_type]; | 303 | entry = &backlight_data->data[panel_type]; |
301 | 304 | ||
305 | dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM; | ||
306 | if (!dev_priv->vbt.backlight.present) { | ||
307 | DRM_DEBUG_KMS("PWM backlight not present in VBT (type %u)\n", | ||
308 | entry->type); | ||
309 | return; | ||
310 | } | ||
311 | |||
302 | dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; | 312 | dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; |
303 | dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm; | 313 | dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm; |
304 | DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, " | 314 | DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, " |
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h index 83b7629e4367..f27f7b282465 100644 --- a/drivers/gpu/drm/i915/intel_bios.h +++ b/drivers/gpu/drm/i915/intel_bios.h | |||
@@ -374,6 +374,9 @@ struct bdb_lvds_lfp_data { | |||
374 | struct bdb_lvds_lfp_data_entry data[16]; | 374 | struct bdb_lvds_lfp_data_entry data[16]; |
375 | } __packed; | 375 | } __packed; |
376 | 376 | ||
377 | #define BDB_BACKLIGHT_TYPE_NONE 0 | ||
378 | #define BDB_BACKLIGHT_TYPE_PWM 2 | ||
379 | |||
377 | struct bdb_lfp_backlight_data_entry { | 380 | struct bdb_lfp_backlight_data_entry { |
378 | u8 type:2; | 381 | u8 type:2; |
379 | u8 active_low_pwm:1; | 382 | u8 active_low_pwm:1; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a0dad1a2f819..d2a55884ad52 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -575,7 +575,8 @@ out: | |||
575 | return ret; | 575 | return ret; |
576 | } | 576 | } |
577 | 577 | ||
578 | #define HEADER_SIZE 4 | 578 | #define BARE_ADDRESS_SIZE 3 |
579 | #define HEADER_SIZE (BARE_ADDRESS_SIZE + 1) | ||
579 | static ssize_t | 580 | static ssize_t |
580 | intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | 581 | intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) |
581 | { | 582 | { |
@@ -592,7 +593,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
592 | switch (msg->request & ~DP_AUX_I2C_MOT) { | 593 | switch (msg->request & ~DP_AUX_I2C_MOT) { |
593 | case DP_AUX_NATIVE_WRITE: | 594 | case DP_AUX_NATIVE_WRITE: |
594 | case DP_AUX_I2C_WRITE: | 595 | case DP_AUX_I2C_WRITE: |
595 | txsize = HEADER_SIZE + msg->size; | 596 | txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE; |
596 | rxsize = 1; | 597 | rxsize = 1; |
597 | 598 | ||
598 | if (WARN_ON(txsize > 20)) | 599 | if (WARN_ON(txsize > 20)) |
@@ -611,7 +612,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
611 | 612 | ||
612 | case DP_AUX_NATIVE_READ: | 613 | case DP_AUX_NATIVE_READ: |
613 | case DP_AUX_I2C_READ: | 614 | case DP_AUX_I2C_READ: |
614 | txsize = HEADER_SIZE; | 615 | txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE; |
615 | rxsize = msg->size + 1; | 616 | rxsize = msg->size + 1; |
616 | 617 | ||
617 | if (WARN_ON(rxsize > 20)) | 618 | if (WARN_ON(rxsize > 20)) |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index cb058408c70e..0eead16aeda7 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -1065,6 +1065,11 @@ int intel_panel_setup_backlight(struct drm_connector *connector) | |||
1065 | unsigned long flags; | 1065 | unsigned long flags; |
1066 | int ret; | 1066 | int ret; |
1067 | 1067 | ||
1068 | if (!dev_priv->vbt.backlight.present) { | ||
1069 | DRM_DEBUG_KMS("native backlight control not available per VBT\n"); | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1068 | /* set level and max in panel struct */ | 1073 | /* set level and max in panel struct */ |
1069 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); | 1074 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); |
1070 | ret = dev_priv->display.setup_backlight(intel_connector); | 1075 | ret = dev_priv->display.setup_backlight(intel_connector); |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 5874716774a7..19e94c3edc19 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -1545,6 +1545,16 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1545 | 1545 | ||
1546 | DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); | 1546 | DRM_DEBUG_KMS("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); |
1547 | 1547 | ||
1548 | if (IS_I915GM(dev) && enabled) { | ||
1549 | struct intel_framebuffer *fb; | ||
1550 | |||
1551 | fb = to_intel_framebuffer(enabled->primary->fb); | ||
1552 | |||
1553 | /* self-refresh seems busted with untiled */ | ||
1554 | if (fb->obj->tiling_mode == I915_TILING_NONE) | ||
1555 | enabled = NULL; | ||
1556 | } | ||
1557 | |||
1548 | /* | 1558 | /* |
1549 | * Overlay gets an aggressive default since video jitter is bad. | 1559 | * Overlay gets an aggressive default since video jitter is bad. |
1550 | */ | 1560 | */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index e9df94f96d78..fb0b6b2d1427 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -109,7 +109,7 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios) | |||
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | addr = (u64)(addr >> 8) << 8; | 112 | addr = (addr & 0xffffff00) << 8; |
113 | if (!addr) { | 113 | if (!addr) { |
114 | addr = (u64)nv_rd32(bios, 0x001700) << 16; | 114 | addr = (u64)nv_rd32(bios, 0x001700) << 16; |
115 | addr += 0xf0000; | 115 | addr += 0xf0000; |
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 355157e4f78d..e3c47a8005ff 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -33,6 +33,7 @@ struct omap_crtc { | |||
33 | int pipe; | 33 | int pipe; |
34 | enum omap_channel channel; | 34 | enum omap_channel channel; |
35 | struct omap_overlay_manager_info info; | 35 | struct omap_overlay_manager_info info; |
36 | struct drm_encoder *current_encoder; | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * Temporary: eventually this will go away, but it is needed | 39 | * Temporary: eventually this will go away, but it is needed |
@@ -120,13 +121,25 @@ static void omap_crtc_start_update(struct omap_overlay_manager *mgr) | |||
120 | { | 121 | { |
121 | } | 122 | } |
122 | 123 | ||
124 | static void set_enabled(struct drm_crtc *crtc, bool enable); | ||
125 | |||
123 | static int omap_crtc_enable(struct omap_overlay_manager *mgr) | 126 | static int omap_crtc_enable(struct omap_overlay_manager *mgr) |
124 | { | 127 | { |
128 | struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; | ||
129 | |||
130 | dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); | ||
131 | dispc_mgr_set_timings(omap_crtc->channel, | ||
132 | &omap_crtc->timings); | ||
133 | set_enabled(&omap_crtc->base, true); | ||
134 | |||
125 | return 0; | 135 | return 0; |
126 | } | 136 | } |
127 | 137 | ||
128 | static void omap_crtc_disable(struct omap_overlay_manager *mgr) | 138 | static void omap_crtc_disable(struct omap_overlay_manager *mgr) |
129 | { | 139 | { |
140 | struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; | ||
141 | |||
142 | set_enabled(&omap_crtc->base, false); | ||
130 | } | 143 | } |
131 | 144 | ||
132 | static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, | 145 | static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, |
@@ -184,7 +197,6 @@ static void omap_crtc_destroy(struct drm_crtc *crtc) | |||
184 | WARN_ON(omap_crtc->apply_irq.registered); | 197 | WARN_ON(omap_crtc->apply_irq.registered); |
185 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); | 198 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); |
186 | 199 | ||
187 | omap_crtc->plane->funcs->destroy(omap_crtc->plane); | ||
188 | drm_crtc_cleanup(crtc); | 200 | drm_crtc_cleanup(crtc); |
189 | 201 | ||
190 | kfree(omap_crtc); | 202 | kfree(omap_crtc); |
@@ -338,17 +350,23 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, | |||
338 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | 350 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); |
339 | struct drm_plane *primary = crtc->primary; | 351 | struct drm_plane *primary = crtc->primary; |
340 | struct drm_gem_object *bo; | 352 | struct drm_gem_object *bo; |
353 | unsigned long flags; | ||
341 | 354 | ||
342 | DBG("%d -> %d (event=%p)", primary->fb ? primary->fb->base.id : -1, | 355 | DBG("%d -> %d (event=%p)", primary->fb ? primary->fb->base.id : -1, |
343 | fb->base.id, event); | 356 | fb->base.id, event); |
344 | 357 | ||
358 | spin_lock_irqsave(&dev->event_lock, flags); | ||
359 | |||
345 | if (omap_crtc->old_fb) { | 360 | if (omap_crtc->old_fb) { |
361 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
346 | dev_err(dev->dev, "already a pending flip\n"); | 362 | dev_err(dev->dev, "already a pending flip\n"); |
347 | return -EINVAL; | 363 | return -EINVAL; |
348 | } | 364 | } |
349 | 365 | ||
350 | omap_crtc->event = event; | 366 | omap_crtc->event = event; |
351 | primary->fb = fb; | 367 | omap_crtc->old_fb = primary->fb = fb; |
368 | |||
369 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
352 | 370 | ||
353 | /* | 371 | /* |
354 | * Hold a reference temporarily until the crtc is updated | 372 | * Hold a reference temporarily until the crtc is updated |
@@ -528,38 +546,46 @@ static void set_enabled(struct drm_crtc *crtc, bool enable) | |||
528 | struct drm_device *dev = crtc->dev; | 546 | struct drm_device *dev = crtc->dev; |
529 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | 547 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); |
530 | enum omap_channel channel = omap_crtc->channel; | 548 | enum omap_channel channel = omap_crtc->channel; |
531 | struct omap_irq_wait *wait = NULL; | 549 | struct omap_irq_wait *wait; |
550 | u32 framedone_irq, vsync_irq; | ||
551 | int ret; | ||
532 | 552 | ||
533 | if (dispc_mgr_is_enabled(channel) == enable) | 553 | if (dispc_mgr_is_enabled(channel) == enable) |
534 | return; | 554 | return; |
535 | 555 | ||
536 | /* ignore sync-lost irqs during enable/disable */ | 556 | /* |
557 | * Digit output produces some sync lost interrupts during the first | ||
558 | * frame when enabling, so we need to ignore those. | ||
559 | */ | ||
537 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); | 560 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); |
538 | 561 | ||
539 | if (dispc_mgr_get_framedone_irq(channel)) { | 562 | framedone_irq = dispc_mgr_get_framedone_irq(channel); |
540 | if (!enable) { | 563 | vsync_irq = dispc_mgr_get_vsync_irq(channel); |
541 | wait = omap_irq_wait_init(dev, | 564 | |
542 | dispc_mgr_get_framedone_irq(channel), 1); | 565 | if (enable) { |
543 | } | 566 | wait = omap_irq_wait_init(dev, vsync_irq, 1); |
544 | } else { | 567 | } else { |
545 | /* | 568 | /* |
546 | * When we disable digit output, we need to wait until fields | 569 | * When we disable the digit output, we need to wait for |
547 | * are done. Otherwise the DSS is still working, and turning | 570 | * FRAMEDONE to know that DISPC has finished with the output. |
548 | * off the clocks prevents DSS from going to OFF mode. And when | 571 | * |
549 | * enabling, we need to wait for the extra sync losts | 572 | * OMAP2/3 does not have FRAMEDONE irq for digit output, and in |
573 | * that case we need to use vsync interrupt, and wait for both | ||
574 | * even and odd frames. | ||
550 | */ | 575 | */ |
551 | wait = omap_irq_wait_init(dev, | 576 | |
552 | dispc_mgr_get_vsync_irq(channel), 2); | 577 | if (framedone_irq) |
578 | wait = omap_irq_wait_init(dev, framedone_irq, 1); | ||
579 | else | ||
580 | wait = omap_irq_wait_init(dev, vsync_irq, 2); | ||
553 | } | 581 | } |
554 | 582 | ||
555 | dispc_mgr_enable(channel, enable); | 583 | dispc_mgr_enable(channel, enable); |
556 | 584 | ||
557 | if (wait) { | 585 | ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); |
558 | int ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); | 586 | if (ret) { |
559 | if (ret) { | 587 | dev_err(dev->dev, "%s: timeout waiting for %s\n", |
560 | dev_err(dev->dev, "%s: timeout waiting for %s\n", | 588 | omap_crtc->name, enable ? "enable" : "disable"); |
561 | omap_crtc->name, enable ? "enable" : "disable"); | ||
562 | } | ||
563 | } | 589 | } |
564 | 590 | ||
565 | omap_irq_register(crtc->dev, &omap_crtc->error_irq); | 591 | omap_irq_register(crtc->dev, &omap_crtc->error_irq); |
@@ -586,8 +612,12 @@ static void omap_crtc_pre_apply(struct omap_drm_apply *apply) | |||
586 | } | 612 | } |
587 | } | 613 | } |
588 | 614 | ||
615 | if (omap_crtc->current_encoder && encoder != omap_crtc->current_encoder) | ||
616 | omap_encoder_set_enabled(omap_crtc->current_encoder, false); | ||
617 | |||
618 | omap_crtc->current_encoder = encoder; | ||
619 | |||
589 | if (!omap_crtc->enabled) { | 620 | if (!omap_crtc->enabled) { |
590 | set_enabled(&omap_crtc->base, false); | ||
591 | if (encoder) | 621 | if (encoder) |
592 | omap_encoder_set_enabled(encoder, false); | 622 | omap_encoder_set_enabled(encoder, false); |
593 | } else { | 623 | } else { |
@@ -596,13 +626,7 @@ static void omap_crtc_pre_apply(struct omap_drm_apply *apply) | |||
596 | omap_encoder_update(encoder, omap_crtc->mgr, | 626 | omap_encoder_update(encoder, omap_crtc->mgr, |
597 | &omap_crtc->timings); | 627 | &omap_crtc->timings); |
598 | omap_encoder_set_enabled(encoder, true); | 628 | omap_encoder_set_enabled(encoder, true); |
599 | omap_crtc->full_update = false; | ||
600 | } | 629 | } |
601 | |||
602 | dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); | ||
603 | dispc_mgr_set_timings(omap_crtc->channel, | ||
604 | &omap_crtc->timings); | ||
605 | set_enabled(&omap_crtc->base, true); | ||
606 | } | 630 | } |
607 | 631 | ||
608 | omap_crtc->full_update = false; | 632 | omap_crtc->full_update = false; |
@@ -613,10 +637,30 @@ static void omap_crtc_post_apply(struct omap_drm_apply *apply) | |||
613 | /* nothing needed for post-apply */ | 637 | /* nothing needed for post-apply */ |
614 | } | 638 | } |
615 | 639 | ||
640 | void omap_crtc_flush(struct drm_crtc *crtc) | ||
641 | { | ||
642 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
643 | int loops = 0; | ||
644 | |||
645 | while (!list_empty(&omap_crtc->pending_applies) || | ||
646 | !list_empty(&omap_crtc->queued_applies) || | ||
647 | omap_crtc->event || omap_crtc->old_fb) { | ||
648 | |||
649 | if (++loops > 10) { | ||
650 | dev_err(crtc->dev->dev, | ||
651 | "omap_crtc_flush() timeout\n"); | ||
652 | break; | ||
653 | } | ||
654 | |||
655 | schedule_timeout_uninterruptible(msecs_to_jiffies(20)); | ||
656 | } | ||
657 | } | ||
658 | |||
616 | static const char *channel_names[] = { | 659 | static const char *channel_names[] = { |
617 | [OMAP_DSS_CHANNEL_LCD] = "lcd", | 660 | [OMAP_DSS_CHANNEL_LCD] = "lcd", |
618 | [OMAP_DSS_CHANNEL_DIGIT] = "tv", | 661 | [OMAP_DSS_CHANNEL_DIGIT] = "tv", |
619 | [OMAP_DSS_CHANNEL_LCD2] = "lcd2", | 662 | [OMAP_DSS_CHANNEL_LCD2] = "lcd2", |
663 | [OMAP_DSS_CHANNEL_LCD3] = "lcd3", | ||
620 | }; | 664 | }; |
621 | 665 | ||
622 | void omap_crtc_pre_init(void) | 666 | void omap_crtc_pre_init(void) |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index bf39fcc49e0f..c8270e4b26f3 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -513,12 +513,18 @@ static int dev_load(struct drm_device *dev, unsigned long flags) | |||
513 | static int dev_unload(struct drm_device *dev) | 513 | static int dev_unload(struct drm_device *dev) |
514 | { | 514 | { |
515 | struct omap_drm_private *priv = dev->dev_private; | 515 | struct omap_drm_private *priv = dev->dev_private; |
516 | int i; | ||
516 | 517 | ||
517 | DBG("unload: dev=%p", dev); | 518 | DBG("unload: dev=%p", dev); |
518 | 519 | ||
519 | drm_kms_helper_poll_fini(dev); | 520 | drm_kms_helper_poll_fini(dev); |
520 | 521 | ||
521 | omap_fbdev_free(dev); | 522 | omap_fbdev_free(dev); |
523 | |||
524 | /* flush crtcs so the fbs get released */ | ||
525 | for (i = 0; i < priv->num_crtcs; i++) | ||
526 | omap_crtc_flush(priv->crtcs[i]); | ||
527 | |||
522 | omap_modeset_free(dev); | 528 | omap_modeset_free(dev); |
523 | omap_gem_deinit(dev); | 529 | omap_gem_deinit(dev); |
524 | 530 | ||
@@ -696,10 +702,11 @@ static int pdev_remove(struct platform_device *device) | |||
696 | { | 702 | { |
697 | DBG(""); | 703 | DBG(""); |
698 | 704 | ||
705 | drm_put_dev(platform_get_drvdata(device)); | ||
706 | |||
699 | omap_disconnect_dssdevs(); | 707 | omap_disconnect_dssdevs(); |
700 | omap_crtc_pre_uninit(); | 708 | omap_crtc_pre_uninit(); |
701 | 709 | ||
702 | drm_put_dev(platform_get_drvdata(device)); | ||
703 | return 0; | 710 | return 0; |
704 | } | 711 | } |
705 | 712 | ||
@@ -726,18 +733,33 @@ static struct platform_driver pdev = { | |||
726 | 733 | ||
727 | static int __init omap_drm_init(void) | 734 | static int __init omap_drm_init(void) |
728 | { | 735 | { |
736 | int r; | ||
737 | |||
729 | DBG("init"); | 738 | DBG("init"); |
730 | if (platform_driver_register(&omap_dmm_driver)) { | 739 | |
731 | /* we can continue on without DMM.. so not fatal */ | 740 | r = platform_driver_register(&omap_dmm_driver); |
732 | dev_err(NULL, "DMM registration failed\n"); | 741 | if (r) { |
742 | pr_err("DMM driver registration failed\n"); | ||
743 | return r; | ||
744 | } | ||
745 | |||
746 | r = platform_driver_register(&pdev); | ||
747 | if (r) { | ||
748 | pr_err("omapdrm driver registration failed\n"); | ||
749 | platform_driver_unregister(&omap_dmm_driver); | ||
750 | return r; | ||
733 | } | 751 | } |
734 | return platform_driver_register(&pdev); | 752 | |
753 | return 0; | ||
735 | } | 754 | } |
736 | 755 | ||
737 | static void __exit omap_drm_fini(void) | 756 | static void __exit omap_drm_fini(void) |
738 | { | 757 | { |
739 | DBG("fini"); | 758 | DBG("fini"); |
759 | |||
740 | platform_driver_unregister(&pdev); | 760 | platform_driver_unregister(&pdev); |
761 | |||
762 | platform_driver_unregister(&omap_dmm_driver); | ||
741 | } | 763 | } |
742 | 764 | ||
743 | /* need late_initcall() so we load after dss_driver's are loaded */ | 765 | /* need late_initcall() so we load after dss_driver's are loaded */ |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 428b2981fd68..284b80fc3c54 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
@@ -163,6 +163,7 @@ void omap_crtc_pre_init(void); | |||
163 | void omap_crtc_pre_uninit(void); | 163 | void omap_crtc_pre_uninit(void); |
164 | struct drm_crtc *omap_crtc_init(struct drm_device *dev, | 164 | struct drm_crtc *omap_crtc_init(struct drm_device *dev, |
165 | struct drm_plane *plane, enum omap_channel channel, int id); | 165 | struct drm_plane *plane, enum omap_channel channel, int id); |
166 | void omap_crtc_flush(struct drm_crtc *crtc); | ||
166 | 167 | ||
167 | struct drm_plane *omap_plane_init(struct drm_device *dev, | 168 | struct drm_plane *omap_plane_init(struct drm_device *dev, |
168 | int plane_id, bool private_plane); | 169 | int plane_id, bool private_plane); |
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index d2b8c49bfb4a..8b019602ffe6 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c | |||
@@ -218,6 +218,20 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
218 | info->rotation_type = OMAP_DSS_ROT_TILER; | 218 | info->rotation_type = OMAP_DSS_ROT_TILER; |
219 | info->screen_width = omap_gem_tiled_stride(plane->bo, orient); | 219 | info->screen_width = omap_gem_tiled_stride(plane->bo, orient); |
220 | } else { | 220 | } else { |
221 | switch (win->rotation & 0xf) { | ||
222 | case 0: | ||
223 | case BIT(DRM_ROTATE_0): | ||
224 | /* OK */ | ||
225 | break; | ||
226 | |||
227 | default: | ||
228 | dev_warn(fb->dev->dev, | ||
229 | "rotation '%d' ignored for non-tiled fb\n", | ||
230 | win->rotation); | ||
231 | win->rotation = 0; | ||
232 | break; | ||
233 | } | ||
234 | |||
221 | info->paddr = get_linear_addr(plane, format, 0, x, y); | 235 | info->paddr = get_linear_addr(plane, format, 0, x, y); |
222 | info->rotation_type = OMAP_DSS_ROT_DMA; | 236 | info->rotation_type = OMAP_DSS_ROT_DMA; |
223 | info->screen_width = plane->pitch; | 237 | info->screen_width = plane->pitch; |
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 002988d09021..1388ca7f87e8 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c | |||
@@ -371,6 +371,9 @@ void omap_fbdev_free(struct drm_device *dev) | |||
371 | 371 | ||
372 | fbdev = to_omap_fbdev(priv->fbdev); | 372 | fbdev = to_omap_fbdev(priv->fbdev); |
373 | 373 | ||
374 | /* release the ref taken in omap_fbdev_create() */ | ||
375 | omap_gem_put_paddr(fbdev->bo); | ||
376 | |||
374 | /* this will free the backing object */ | 377 | /* this will free the backing object */ |
375 | if (fbdev->fb) { | 378 | if (fbdev->fb) { |
376 | drm_framebuffer_unregister_private(fbdev->fb); | 379 | drm_framebuffer_unregister_private(fbdev->fb); |
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index c8d972763889..95dbce286a41 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c | |||
@@ -980,12 +980,9 @@ int omap_gem_resume(struct device *dev) | |||
980 | #ifdef CONFIG_DEBUG_FS | 980 | #ifdef CONFIG_DEBUG_FS |
981 | void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | 981 | void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m) |
982 | { | 982 | { |
983 | struct drm_device *dev = obj->dev; | ||
984 | struct omap_gem_object *omap_obj = to_omap_bo(obj); | 983 | struct omap_gem_object *omap_obj = to_omap_bo(obj); |
985 | uint64_t off; | 984 | uint64_t off; |
986 | 985 | ||
987 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | ||
988 | |||
989 | off = drm_vma_node_start(&obj->vma_node); | 986 | off = drm_vma_node_start(&obj->vma_node); |
990 | 987 | ||
991 | seq_printf(m, "%08x: %2d (%2d) %08llx %08Zx (%2d) %p %4d", | 988 | seq_printf(m, "%08x: %2d (%2d) %08llx %08Zx (%2d) %p %4d", |
@@ -1050,10 +1047,10 @@ static inline bool is_waiting(struct omap_gem_sync_waiter *waiter) | |||
1050 | { | 1047 | { |
1051 | struct omap_gem_object *omap_obj = waiter->omap_obj; | 1048 | struct omap_gem_object *omap_obj = waiter->omap_obj; |
1052 | if ((waiter->op & OMAP_GEM_READ) && | 1049 | if ((waiter->op & OMAP_GEM_READ) && |
1053 | (omap_obj->sync->read_complete < waiter->read_target)) | 1050 | (omap_obj->sync->write_complete < waiter->write_target)) |
1054 | return true; | 1051 | return true; |
1055 | if ((waiter->op & OMAP_GEM_WRITE) && | 1052 | if ((waiter->op & OMAP_GEM_WRITE) && |
1056 | (omap_obj->sync->write_complete < waiter->write_target)) | 1053 | (omap_obj->sync->read_complete < waiter->read_target)) |
1057 | return true; | 1054 | return true; |
1058 | return false; | 1055 | return false; |
1059 | } | 1056 | } |
@@ -1229,6 +1226,8 @@ int omap_gem_op_async(struct drm_gem_object *obj, enum omap_gem_op op, | |||
1229 | } | 1226 | } |
1230 | 1227 | ||
1231 | spin_unlock(&sync_lock); | 1228 | spin_unlock(&sync_lock); |
1229 | |||
1230 | kfree(waiter); | ||
1232 | } | 1231 | } |
1233 | 1232 | ||
1234 | /* no waiting.. */ | 1233 | /* no waiting.. */ |
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 046d5e660c04..3cf31ee59aac 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -225,6 +225,11 @@ int omap_plane_mode_set(struct drm_plane *plane, | |||
225 | omap_plane->apply_done_cb.arg = arg; | 225 | omap_plane->apply_done_cb.arg = arg; |
226 | } | 226 | } |
227 | 227 | ||
228 | if (plane->fb) | ||
229 | drm_framebuffer_unreference(plane->fb); | ||
230 | |||
231 | drm_framebuffer_reference(fb); | ||
232 | |||
228 | plane->fb = fb; | 233 | plane->fb = fb; |
229 | plane->crtc = crtc; | 234 | plane->crtc = crtc; |
230 | 235 | ||
@@ -241,10 +246,13 @@ static int omap_plane_update(struct drm_plane *plane, | |||
241 | struct omap_plane *omap_plane = to_omap_plane(plane); | 246 | struct omap_plane *omap_plane = to_omap_plane(plane); |
242 | omap_plane->enabled = true; | 247 | omap_plane->enabled = true; |
243 | 248 | ||
244 | if (plane->fb) | 249 | /* omap_plane_mode_set() takes adjusted src */ |
245 | drm_framebuffer_unreference(plane->fb); | 250 | switch (omap_plane->win.rotation & 0xf) { |
246 | 251 | case BIT(DRM_ROTATE_90): | |
247 | drm_framebuffer_reference(fb); | 252 | case BIT(DRM_ROTATE_270): |
253 | swap(src_w, src_h); | ||
254 | break; | ||
255 | } | ||
248 | 256 | ||
249 | return omap_plane_mode_set(plane, crtc, fb, | 257 | return omap_plane_mode_set(plane, crtc, fb, |
250 | crtc_x, crtc_y, crtc_w, crtc_h, | 258 | crtc_x, crtc_y, crtc_w, crtc_h, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 8b0ab170cef9..15936524f226 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -142,7 +142,8 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
142 | return recv_bytes; | 142 | return recv_bytes; |
143 | } | 143 | } |
144 | 144 | ||
145 | #define HEADER_SIZE 4 | 145 | #define BARE_ADDRESS_SIZE 3 |
146 | #define HEADER_SIZE (BARE_ADDRESS_SIZE + 1) | ||
146 | 147 | ||
147 | static ssize_t | 148 | static ssize_t |
148 | radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | 149 | radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) |
@@ -160,13 +161,19 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
160 | tx_buf[0] = msg->address & 0xff; | 161 | tx_buf[0] = msg->address & 0xff; |
161 | tx_buf[1] = msg->address >> 8; | 162 | tx_buf[1] = msg->address >> 8; |
162 | tx_buf[2] = msg->request << 4; | 163 | tx_buf[2] = msg->request << 4; |
163 | tx_buf[3] = msg->size - 1; | 164 | tx_buf[3] = msg->size ? (msg->size - 1) : 0; |
164 | 165 | ||
165 | switch (msg->request & ~DP_AUX_I2C_MOT) { | 166 | switch (msg->request & ~DP_AUX_I2C_MOT) { |
166 | case DP_AUX_NATIVE_WRITE: | 167 | case DP_AUX_NATIVE_WRITE: |
167 | case DP_AUX_I2C_WRITE: | 168 | case DP_AUX_I2C_WRITE: |
169 | /* tx_size needs to be 4 even for bare address packets since the atom | ||
170 | * table needs the info in tx_buf[3]. | ||
171 | */ | ||
168 | tx_size = HEADER_SIZE + msg->size; | 172 | tx_size = HEADER_SIZE + msg->size; |
169 | tx_buf[3] |= tx_size << 4; | 173 | if (msg->size == 0) |
174 | tx_buf[3] |= BARE_ADDRESS_SIZE << 4; | ||
175 | else | ||
176 | tx_buf[3] |= tx_size << 4; | ||
170 | memcpy(tx_buf + HEADER_SIZE, msg->buffer, msg->size); | 177 | memcpy(tx_buf + HEADER_SIZE, msg->buffer, msg->size); |
171 | ret = radeon_process_aux_ch(chan, | 178 | ret = radeon_process_aux_ch(chan, |
172 | tx_buf, tx_size, NULL, 0, delay, &ack); | 179 | tx_buf, tx_size, NULL, 0, delay, &ack); |
@@ -176,8 +183,14 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
176 | break; | 183 | break; |
177 | case DP_AUX_NATIVE_READ: | 184 | case DP_AUX_NATIVE_READ: |
178 | case DP_AUX_I2C_READ: | 185 | case DP_AUX_I2C_READ: |
186 | /* tx_size needs to be 4 even for bare address packets since the atom | ||
187 | * table needs the info in tx_buf[3]. | ||
188 | */ | ||
179 | tx_size = HEADER_SIZE; | 189 | tx_size = HEADER_SIZE; |
180 | tx_buf[3] |= tx_size << 4; | 190 | if (msg->size == 0) |
191 | tx_buf[3] |= BARE_ADDRESS_SIZE << 4; | ||
192 | else | ||
193 | tx_buf[3] |= tx_size << 4; | ||
181 | ret = radeon_process_aux_ch(chan, | 194 | ret = radeon_process_aux_ch(chan, |
182 | tx_buf, tx_size, msg->buffer, msg->size, delay, &ack); | 195 | tx_buf, tx_size, msg->buffer, msg->size, delay, &ack); |
183 | break; | 196 | break; |
@@ -186,7 +199,7 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
186 | break; | 199 | break; |
187 | } | 200 | } |
188 | 201 | ||
189 | if (ret > 0) | 202 | if (ret >= 0) |
190 | msg->reply = ack >> 4; | 203 | msg->reply = ack >> 4; |
191 | 204 | ||
192 | return ret; | 205 | return ret; |
@@ -194,98 +207,15 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
194 | 207 | ||
195 | void radeon_dp_aux_init(struct radeon_connector *radeon_connector) | 208 | void radeon_dp_aux_init(struct radeon_connector *radeon_connector) |
196 | { | 209 | { |
197 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | ||
198 | |||
199 | dig_connector->dp_i2c_bus->aux.dev = radeon_connector->base.kdev; | ||
200 | dig_connector->dp_i2c_bus->aux.transfer = radeon_dp_aux_transfer; | ||
201 | } | ||
202 | |||
203 | int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | ||
204 | u8 write_byte, u8 *read_byte) | ||
205 | { | ||
206 | struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data; | ||
207 | struct radeon_i2c_chan *auxch = i2c_get_adapdata(adapter); | ||
208 | u16 address = algo_data->address; | ||
209 | u8 msg[5]; | ||
210 | u8 reply[2]; | ||
211 | unsigned retry; | ||
212 | int msg_bytes; | ||
213 | int reply_bytes = 1; | ||
214 | int ret; | 210 | int ret; |
215 | u8 ack; | ||
216 | |||
217 | /* Set up the address */ | ||
218 | msg[0] = address; | ||
219 | msg[1] = address >> 8; | ||
220 | |||
221 | /* Set up the command byte */ | ||
222 | if (mode & MODE_I2C_READ) { | ||
223 | msg[2] = DP_AUX_I2C_READ << 4; | ||
224 | msg_bytes = 4; | ||
225 | msg[3] = msg_bytes << 4; | ||
226 | } else { | ||
227 | msg[2] = DP_AUX_I2C_WRITE << 4; | ||
228 | msg_bytes = 5; | ||
229 | msg[3] = msg_bytes << 4; | ||
230 | msg[4] = write_byte; | ||
231 | } | ||
232 | |||
233 | /* special handling for start/stop */ | ||
234 | if (mode & (MODE_I2C_START | MODE_I2C_STOP)) | ||
235 | msg[3] = 3 << 4; | ||
236 | |||
237 | /* Set MOT bit for all but stop */ | ||
238 | if ((mode & MODE_I2C_STOP) == 0) | ||
239 | msg[2] |= DP_AUX_I2C_MOT << 4; | ||
240 | |||
241 | for (retry = 0; retry < 7; retry++) { | ||
242 | ret = radeon_process_aux_ch(auxch, | ||
243 | msg, msg_bytes, reply, reply_bytes, 0, &ack); | ||
244 | if (ret == -EBUSY) | ||
245 | continue; | ||
246 | else if (ret < 0) { | ||
247 | DRM_DEBUG_KMS("aux_ch failed %d\n", ret); | ||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | switch ((ack >> 4) & DP_AUX_NATIVE_REPLY_MASK) { | ||
252 | case DP_AUX_NATIVE_REPLY_ACK: | ||
253 | /* I2C-over-AUX Reply field is only valid | ||
254 | * when paired with AUX ACK. | ||
255 | */ | ||
256 | break; | ||
257 | case DP_AUX_NATIVE_REPLY_NACK: | ||
258 | DRM_DEBUG_KMS("aux_ch native nack\n"); | ||
259 | return -EREMOTEIO; | ||
260 | case DP_AUX_NATIVE_REPLY_DEFER: | ||
261 | DRM_DEBUG_KMS("aux_ch native defer\n"); | ||
262 | usleep_range(500, 600); | ||
263 | continue; | ||
264 | default: | ||
265 | DRM_ERROR("aux_ch invalid native reply 0x%02x\n", ack); | ||
266 | return -EREMOTEIO; | ||
267 | } | ||
268 | 211 | ||
269 | switch ((ack >> 4) & DP_AUX_I2C_REPLY_MASK) { | 212 | radeon_connector->ddc_bus->aux.dev = radeon_connector->base.kdev; |
270 | case DP_AUX_I2C_REPLY_ACK: | 213 | radeon_connector->ddc_bus->aux.transfer = radeon_dp_aux_transfer; |
271 | if (mode == MODE_I2C_READ) | 214 | ret = drm_dp_aux_register_i2c_bus(&radeon_connector->ddc_bus->aux); |
272 | *read_byte = reply[0]; | 215 | if (!ret) |
273 | return ret; | 216 | radeon_connector->ddc_bus->has_aux = true; |
274 | case DP_AUX_I2C_REPLY_NACK: | ||
275 | DRM_DEBUG_KMS("aux_i2c nack\n"); | ||
276 | return -EREMOTEIO; | ||
277 | case DP_AUX_I2C_REPLY_DEFER: | ||
278 | DRM_DEBUG_KMS("aux_i2c defer\n"); | ||
279 | usleep_range(400, 500); | ||
280 | break; | ||
281 | default: | ||
282 | DRM_ERROR("aux_i2c invalid reply 0x%02x\n", ack); | ||
283 | return -EREMOTEIO; | ||
284 | } | ||
285 | } | ||
286 | 217 | ||
287 | DRM_DEBUG_KMS("aux i2c too many retries, giving up\n"); | 218 | WARN(ret, "drm_dp_aux_register_i2c_bus() failed with error %d\n", ret); |
288 | return -EREMOTEIO; | ||
289 | } | 219 | } |
290 | 220 | ||
291 | /***** general DP utility functions *****/ | 221 | /***** general DP utility functions *****/ |
@@ -420,12 +350,11 @@ static u8 radeon_dp_encoder_service(struct radeon_device *rdev, | |||
420 | 350 | ||
421 | u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector) | 351 | u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector) |
422 | { | 352 | { |
423 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | ||
424 | struct drm_device *dev = radeon_connector->base.dev; | 353 | struct drm_device *dev = radeon_connector->base.dev; |
425 | struct radeon_device *rdev = dev->dev_private; | 354 | struct radeon_device *rdev = dev->dev_private; |
426 | 355 | ||
427 | return radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_GET_SINK_TYPE, 0, | 356 | return radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_GET_SINK_TYPE, 0, |
428 | dig_connector->dp_i2c_bus->rec.i2c_id, 0); | 357 | radeon_connector->ddc_bus->rec.i2c_id, 0); |
429 | } | 358 | } |
430 | 359 | ||
431 | static void radeon_dp_probe_oui(struct radeon_connector *radeon_connector) | 360 | static void radeon_dp_probe_oui(struct radeon_connector *radeon_connector) |
@@ -436,11 +365,11 @@ static void radeon_dp_probe_oui(struct radeon_connector *radeon_connector) | |||
436 | if (!(dig_connector->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) | 365 | if (!(dig_connector->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) |
437 | return; | 366 | return; |
438 | 367 | ||
439 | if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_SINK_OUI, buf, 3)) | 368 | if (drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_SINK_OUI, buf, 3)) |
440 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", | 369 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", |
441 | buf[0], buf[1], buf[2]); | 370 | buf[0], buf[1], buf[2]); |
442 | 371 | ||
443 | if (drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_BRANCH_OUI, buf, 3)) | 372 | if (drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_BRANCH_OUI, buf, 3)) |
444 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", | 373 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", |
445 | buf[0], buf[1], buf[2]); | 374 | buf[0], buf[1], buf[2]); |
446 | } | 375 | } |
@@ -451,7 +380,7 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
451 | u8 msg[DP_DPCD_SIZE]; | 380 | u8 msg[DP_DPCD_SIZE]; |
452 | int ret, i; | 381 | int ret, i; |
453 | 382 | ||
454 | ret = drm_dp_dpcd_read(&dig_connector->dp_i2c_bus->aux, DP_DPCD_REV, msg, | 383 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
455 | DP_DPCD_SIZE); | 384 | DP_DPCD_SIZE); |
456 | if (ret > 0) { | 385 | if (ret > 0) { |
457 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 386 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
@@ -489,7 +418,7 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder, | |||
489 | 418 | ||
490 | if (dp_bridge != ENCODER_OBJECT_ID_NONE) { | 419 | if (dp_bridge != ENCODER_OBJECT_ID_NONE) { |
491 | /* DP bridge chips */ | 420 | /* DP bridge chips */ |
492 | drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, | 421 | drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, |
493 | DP_EDP_CONFIGURATION_CAP, &tmp); | 422 | DP_EDP_CONFIGURATION_CAP, &tmp); |
494 | if (tmp & 1) | 423 | if (tmp & 1) |
495 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 424 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
@@ -500,7 +429,7 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder, | |||
500 | panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; | 429 | panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; |
501 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 430 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
502 | /* eDP */ | 431 | /* eDP */ |
503 | drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, | 432 | drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, |
504 | DP_EDP_CONFIGURATION_CAP, &tmp); | 433 | DP_EDP_CONFIGURATION_CAP, &tmp); |
505 | if (tmp & 1) | 434 | if (tmp & 1) |
506 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 435 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
@@ -554,7 +483,8 @@ bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector) | |||
554 | u8 link_status[DP_LINK_STATUS_SIZE]; | 483 | u8 link_status[DP_LINK_STATUS_SIZE]; |
555 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 484 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
556 | 485 | ||
557 | if (drm_dp_dpcd_read_link_status(&dig->dp_i2c_bus->aux, link_status) <= 0) | 486 | if (drm_dp_dpcd_read_link_status(&radeon_connector->ddc_bus->aux, link_status) |
487 | <= 0) | ||
558 | return false; | 488 | return false; |
559 | if (drm_dp_channel_eq_ok(link_status, dig->dp_lane_count)) | 489 | if (drm_dp_channel_eq_ok(link_status, dig->dp_lane_count)) |
560 | return false; | 490 | return false; |
@@ -574,7 +504,7 @@ void radeon_dp_set_rx_power_state(struct drm_connector *connector, | |||
574 | 504 | ||
575 | /* power up/down the sink */ | 505 | /* power up/down the sink */ |
576 | if (dig_connector->dpcd[0] >= 0x11) { | 506 | if (dig_connector->dpcd[0] >= 0x11) { |
577 | drm_dp_dpcd_writeb(&dig_connector->dp_i2c_bus->aux, | 507 | drm_dp_dpcd_writeb(&radeon_connector->ddc_bus->aux, |
578 | DP_SET_POWER, power_state); | 508 | DP_SET_POWER, power_state); |
579 | usleep_range(1000, 2000); | 509 | usleep_range(1000, 2000); |
580 | } | 510 | } |
@@ -878,7 +808,7 @@ void radeon_dp_link_train(struct drm_encoder *encoder, | |||
878 | else | 808 | else |
879 | dp_info.enc_id |= ATOM_DP_CONFIG_LINK_A; | 809 | dp_info.enc_id |= ATOM_DP_CONFIG_LINK_A; |
880 | 810 | ||
881 | drm_dp_dpcd_readb(&dig_connector->dp_i2c_bus->aux, DP_MAX_LANE_COUNT, &tmp); | 811 | drm_dp_dpcd_readb(&radeon_connector->ddc_bus->aux, DP_MAX_LANE_COUNT, &tmp); |
882 | if (ASIC_IS_DCE5(rdev) && (tmp & DP_TPS3_SUPPORTED)) | 812 | if (ASIC_IS_DCE5(rdev) && (tmp & DP_TPS3_SUPPORTED)) |
883 | dp_info.tp3_supported = true; | 813 | dp_info.tp3_supported = true; |
884 | else | 814 | else |
@@ -890,7 +820,7 @@ void radeon_dp_link_train(struct drm_encoder *encoder, | |||
890 | dp_info.connector = connector; | 820 | dp_info.connector = connector; |
891 | dp_info.dp_lane_count = dig_connector->dp_lane_count; | 821 | dp_info.dp_lane_count = dig_connector->dp_lane_count; |
892 | dp_info.dp_clock = dig_connector->dp_clock; | 822 | dp_info.dp_clock = dig_connector->dp_clock; |
893 | dp_info.aux = &dig_connector->dp_i2c_bus->aux; | 823 | dp_info.aux = &radeon_connector->ddc_bus->aux; |
894 | 824 | ||
895 | if (radeon_dp_link_train_init(&dp_info)) | 825 | if (radeon_dp_link_train_init(&dp_info)) |
896 | goto done; | 826 | goto done; |
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index cad89a977527..10dae4106c08 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -21,8 +21,10 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/firmware.h> | ||
24 | #include "drmP.h" | 25 | #include "drmP.h" |
25 | #include "radeon.h" | 26 | #include "radeon.h" |
27 | #include "radeon_ucode.h" | ||
26 | #include "cikd.h" | 28 | #include "cikd.h" |
27 | #include "r600_dpm.h" | 29 | #include "r600_dpm.h" |
28 | #include "ci_dpm.h" | 30 | #include "ci_dpm.h" |
@@ -202,24 +204,29 @@ static void ci_initialize_powertune_defaults(struct radeon_device *rdev) | |||
202 | struct ci_power_info *pi = ci_get_pi(rdev); | 204 | struct ci_power_info *pi = ci_get_pi(rdev); |
203 | 205 | ||
204 | switch (rdev->pdev->device) { | 206 | switch (rdev->pdev->device) { |
207 | case 0x6649: | ||
205 | case 0x6650: | 208 | case 0x6650: |
209 | case 0x6651: | ||
206 | case 0x6658: | 210 | case 0x6658: |
207 | case 0x665C: | 211 | case 0x665C: |
212 | case 0x665D: | ||
208 | default: | 213 | default: |
209 | pi->powertune_defaults = &defaults_bonaire_xt; | 214 | pi->powertune_defaults = &defaults_bonaire_xt; |
210 | break; | 215 | break; |
211 | case 0x6651: | ||
212 | case 0x665D: | ||
213 | pi->powertune_defaults = &defaults_bonaire_pro; | ||
214 | break; | ||
215 | case 0x6640: | 216 | case 0x6640: |
216 | pi->powertune_defaults = &defaults_saturn_xt; | ||
217 | break; | ||
218 | case 0x6641: | 217 | case 0x6641: |
219 | pi->powertune_defaults = &defaults_saturn_pro; | 218 | case 0x6646: |
219 | case 0x6647: | ||
220 | pi->powertune_defaults = &defaults_saturn_xt; | ||
220 | break; | 221 | break; |
221 | case 0x67B8: | 222 | case 0x67B8: |
222 | case 0x67B0: | 223 | case 0x67B0: |
224 | pi->powertune_defaults = &defaults_hawaii_xt; | ||
225 | break; | ||
226 | case 0x67BA: | ||
227 | case 0x67B1: | ||
228 | pi->powertune_defaults = &defaults_hawaii_pro; | ||
229 | break; | ||
223 | case 0x67A0: | 230 | case 0x67A0: |
224 | case 0x67A1: | 231 | case 0x67A1: |
225 | case 0x67A2: | 232 | case 0x67A2: |
@@ -228,11 +235,7 @@ static void ci_initialize_powertune_defaults(struct radeon_device *rdev) | |||
228 | case 0x67AA: | 235 | case 0x67AA: |
229 | case 0x67B9: | 236 | case 0x67B9: |
230 | case 0x67BE: | 237 | case 0x67BE: |
231 | pi->powertune_defaults = &defaults_hawaii_xt; | 238 | pi->powertune_defaults = &defaults_bonaire_xt; |
232 | break; | ||
233 | case 0x67BA: | ||
234 | case 0x67B1: | ||
235 | pi->powertune_defaults = &defaults_hawaii_pro; | ||
236 | break; | 239 | break; |
237 | } | 240 | } |
238 | 241 | ||
@@ -5146,6 +5149,12 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5146 | pi->mclk_dpm_key_disabled = 0; | 5149 | pi->mclk_dpm_key_disabled = 0; |
5147 | pi->pcie_dpm_key_disabled = 0; | 5150 | pi->pcie_dpm_key_disabled = 0; |
5148 | 5151 | ||
5152 | /* mclk dpm is unstable on some R7 260X cards with the old mc ucode */ | ||
5153 | if ((rdev->pdev->device == 0x6658) && | ||
5154 | (rdev->mc_fw->size == (BONAIRE_MC_UCODE_SIZE * 4))) { | ||
5155 | pi->mclk_dpm_key_disabled = 1; | ||
5156 | } | ||
5157 | |||
5149 | pi->caps_sclk_ds = true; | 5158 | pi->caps_sclk_ds = true; |
5150 | 5159 | ||
5151 | pi->mclk_strobe_mode_threshold = 40000; | 5160 | pi->mclk_strobe_mode_threshold = 40000; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 745143c2358f..199eb194716f 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -38,6 +38,7 @@ MODULE_FIRMWARE("radeon/BONAIRE_me.bin"); | |||
38 | MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); | 38 | MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); |
39 | MODULE_FIRMWARE("radeon/BONAIRE_mec.bin"); | 39 | MODULE_FIRMWARE("radeon/BONAIRE_mec.bin"); |
40 | MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); | 40 | MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); |
41 | MODULE_FIRMWARE("radeon/BONAIRE_mc2.bin"); | ||
41 | MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); | 42 | MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); |
42 | MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); | 43 | MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); |
43 | MODULE_FIRMWARE("radeon/BONAIRE_smc.bin"); | 44 | MODULE_FIRMWARE("radeon/BONAIRE_smc.bin"); |
@@ -46,6 +47,7 @@ MODULE_FIRMWARE("radeon/HAWAII_me.bin"); | |||
46 | MODULE_FIRMWARE("radeon/HAWAII_ce.bin"); | 47 | MODULE_FIRMWARE("radeon/HAWAII_ce.bin"); |
47 | MODULE_FIRMWARE("radeon/HAWAII_mec.bin"); | 48 | MODULE_FIRMWARE("radeon/HAWAII_mec.bin"); |
48 | MODULE_FIRMWARE("radeon/HAWAII_mc.bin"); | 49 | MODULE_FIRMWARE("radeon/HAWAII_mc.bin"); |
50 | MODULE_FIRMWARE("radeon/HAWAII_mc2.bin"); | ||
49 | MODULE_FIRMWARE("radeon/HAWAII_rlc.bin"); | 51 | MODULE_FIRMWARE("radeon/HAWAII_rlc.bin"); |
50 | MODULE_FIRMWARE("radeon/HAWAII_sdma.bin"); | 52 | MODULE_FIRMWARE("radeon/HAWAII_sdma.bin"); |
51 | MODULE_FIRMWARE("radeon/HAWAII_smc.bin"); | 53 | MODULE_FIRMWARE("radeon/HAWAII_smc.bin"); |
@@ -1703,20 +1705,20 @@ int ci_mc_load_microcode(struct radeon_device *rdev) | |||
1703 | const __be32 *fw_data; | 1705 | const __be32 *fw_data; |
1704 | u32 running, blackout = 0; | 1706 | u32 running, blackout = 0; |
1705 | u32 *io_mc_regs; | 1707 | u32 *io_mc_regs; |
1706 | int i, ucode_size, regs_size; | 1708 | int i, regs_size, ucode_size; |
1707 | 1709 | ||
1708 | if (!rdev->mc_fw) | 1710 | if (!rdev->mc_fw) |
1709 | return -EINVAL; | 1711 | return -EINVAL; |
1710 | 1712 | ||
1713 | ucode_size = rdev->mc_fw->size / 4; | ||
1714 | |||
1711 | switch (rdev->family) { | 1715 | switch (rdev->family) { |
1712 | case CHIP_BONAIRE: | 1716 | case CHIP_BONAIRE: |
1713 | io_mc_regs = (u32 *)&bonaire_io_mc_regs; | 1717 | io_mc_regs = (u32 *)&bonaire_io_mc_regs; |
1714 | ucode_size = CIK_MC_UCODE_SIZE; | ||
1715 | regs_size = BONAIRE_IO_MC_REGS_SIZE; | 1718 | regs_size = BONAIRE_IO_MC_REGS_SIZE; |
1716 | break; | 1719 | break; |
1717 | case CHIP_HAWAII: | 1720 | case CHIP_HAWAII: |
1718 | io_mc_regs = (u32 *)&hawaii_io_mc_regs; | 1721 | io_mc_regs = (u32 *)&hawaii_io_mc_regs; |
1719 | ucode_size = HAWAII_MC_UCODE_SIZE; | ||
1720 | regs_size = HAWAII_IO_MC_REGS_SIZE; | 1722 | regs_size = HAWAII_IO_MC_REGS_SIZE; |
1721 | break; | 1723 | break; |
1722 | default: | 1724 | default: |
@@ -1783,7 +1785,7 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1783 | const char *chip_name; | 1785 | const char *chip_name; |
1784 | size_t pfp_req_size, me_req_size, ce_req_size, | 1786 | size_t pfp_req_size, me_req_size, ce_req_size, |
1785 | mec_req_size, rlc_req_size, mc_req_size = 0, | 1787 | mec_req_size, rlc_req_size, mc_req_size = 0, |
1786 | sdma_req_size, smc_req_size = 0; | 1788 | sdma_req_size, smc_req_size = 0, mc2_req_size = 0; |
1787 | char fw_name[30]; | 1789 | char fw_name[30]; |
1788 | int err; | 1790 | int err; |
1789 | 1791 | ||
@@ -1797,7 +1799,8 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1797 | ce_req_size = CIK_CE_UCODE_SIZE * 4; | 1799 | ce_req_size = CIK_CE_UCODE_SIZE * 4; |
1798 | mec_req_size = CIK_MEC_UCODE_SIZE * 4; | 1800 | mec_req_size = CIK_MEC_UCODE_SIZE * 4; |
1799 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; | 1801 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; |
1800 | mc_req_size = CIK_MC_UCODE_SIZE * 4; | 1802 | mc_req_size = BONAIRE_MC_UCODE_SIZE * 4; |
1803 | mc2_req_size = BONAIRE_MC2_UCODE_SIZE * 4; | ||
1801 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; | 1804 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; |
1802 | smc_req_size = ALIGN(BONAIRE_SMC_UCODE_SIZE, 4); | 1805 | smc_req_size = ALIGN(BONAIRE_SMC_UCODE_SIZE, 4); |
1803 | break; | 1806 | break; |
@@ -1809,6 +1812,7 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1809 | mec_req_size = CIK_MEC_UCODE_SIZE * 4; | 1812 | mec_req_size = CIK_MEC_UCODE_SIZE * 4; |
1810 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; | 1813 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; |
1811 | mc_req_size = HAWAII_MC_UCODE_SIZE * 4; | 1814 | mc_req_size = HAWAII_MC_UCODE_SIZE * 4; |
1815 | mc2_req_size = HAWAII_MC2_UCODE_SIZE * 4; | ||
1812 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; | 1816 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; |
1813 | smc_req_size = ALIGN(HAWAII_SMC_UCODE_SIZE, 4); | 1817 | smc_req_size = ALIGN(HAWAII_SMC_UCODE_SIZE, 4); |
1814 | break; | 1818 | break; |
@@ -1904,16 +1908,22 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1904 | 1908 | ||
1905 | /* No SMC, MC ucode on APUs */ | 1909 | /* No SMC, MC ucode on APUs */ |
1906 | if (!(rdev->flags & RADEON_IS_IGP)) { | 1910 | if (!(rdev->flags & RADEON_IS_IGP)) { |
1907 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); | 1911 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); |
1908 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); | 1912 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
1909 | if (err) | 1913 | if (err) { |
1910 | goto out; | 1914 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
1911 | if (rdev->mc_fw->size != mc_req_size) { | 1915 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
1916 | if (err) | ||
1917 | goto out; | ||
1918 | } | ||
1919 | if ((rdev->mc_fw->size != mc_req_size) && | ||
1920 | (rdev->mc_fw->size != mc2_req_size)){ | ||
1912 | printk(KERN_ERR | 1921 | printk(KERN_ERR |
1913 | "cik_mc: Bogus length %zu in firmware \"%s\"\n", | 1922 | "cik_mc: Bogus length %zu in firmware \"%s\"\n", |
1914 | rdev->mc_fw->size, fw_name); | 1923 | rdev->mc_fw->size, fw_name); |
1915 | err = -EINVAL; | 1924 | err = -EINVAL; |
1916 | } | 1925 | } |
1926 | DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); | ||
1917 | 1927 | ||
1918 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 1928 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
1919 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 1929 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 94e858751994..0a65dc7e93e7 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -309,11 +309,17 @@ int dce6_audio_init(struct radeon_device *rdev) | |||
309 | 309 | ||
310 | rdev->audio.enabled = true; | 310 | rdev->audio.enabled = true; |
311 | 311 | ||
312 | if (ASIC_IS_DCE8(rdev)) | 312 | if (ASIC_IS_DCE81(rdev)) /* KV: 4 streams, 7 endpoints */ |
313 | rdev->audio.num_pins = 7; | ||
314 | else if (ASIC_IS_DCE83(rdev)) /* KB: 2 streams, 3 endpoints */ | ||
315 | rdev->audio.num_pins = 3; | ||
316 | else if (ASIC_IS_DCE8(rdev)) /* BN/HW: 6 streams, 7 endpoints */ | ||
317 | rdev->audio.num_pins = 7; | ||
318 | else if (ASIC_IS_DCE61(rdev)) /* TN: 4 streams, 6 endpoints */ | ||
313 | rdev->audio.num_pins = 6; | 319 | rdev->audio.num_pins = 6; |
314 | else if (ASIC_IS_DCE61(rdev)) | 320 | else if (ASIC_IS_DCE64(rdev)) /* OL: 2 streams, 2 endpoints */ |
315 | rdev->audio.num_pins = 4; | 321 | rdev->audio.num_pins = 2; |
316 | else | 322 | else /* SI: 6 streams, 6 endpoints */ |
317 | rdev->audio.num_pins = 6; | 323 | rdev->audio.num_pins = 6; |
318 | 324 | ||
319 | for (i = 0; i < rdev->audio.num_pins; i++) { | 325 | for (i = 0; i < rdev->audio.num_pins; i++) { |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index f21db7a0b34d..b58e1afdda76 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -739,7 +739,7 @@ union radeon_irq_stat_regs { | |||
739 | struct cik_irq_stat_regs cik; | 739 | struct cik_irq_stat_regs cik; |
740 | }; | 740 | }; |
741 | 741 | ||
742 | #define RADEON_MAX_HPD_PINS 6 | 742 | #define RADEON_MAX_HPD_PINS 7 |
743 | #define RADEON_MAX_CRTCS 6 | 743 | #define RADEON_MAX_CRTCS 6 |
744 | #define RADEON_MAX_AFMT_BLOCKS 7 | 744 | #define RADEON_MAX_AFMT_BLOCKS 7 |
745 | 745 | ||
@@ -2321,6 +2321,7 @@ struct radeon_device { | |||
2321 | bool have_disp_power_ref; | 2321 | bool have_disp_power_ref; |
2322 | }; | 2322 | }; |
2323 | 2323 | ||
2324 | bool radeon_is_px(struct drm_device *dev); | ||
2324 | int radeon_device_init(struct radeon_device *rdev, | 2325 | int radeon_device_init(struct radeon_device *rdev, |
2325 | struct drm_device *ddev, | 2326 | struct drm_device *ddev, |
2326 | struct pci_dev *pdev, | 2327 | struct pci_dev *pdev, |
@@ -2631,6 +2632,9 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); | |||
2631 | #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) | 2632 | #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) |
2632 | #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN)) | 2633 | #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN)) |
2633 | #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE)) | 2634 | #define ASIC_IS_DCE8(rdev) ((rdev->family >= CHIP_BONAIRE)) |
2635 | #define ASIC_IS_DCE81(rdev) ((rdev->family == CHIP_KAVERI)) | ||
2636 | #define ASIC_IS_DCE82(rdev) ((rdev->family == CHIP_BONAIRE)) | ||
2637 | #define ASIC_IS_DCE83(rdev) ((rdev->family == CHIP_KABINI)) | ||
2634 | 2638 | ||
2635 | #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \ | 2639 | #define ASIC_IS_LOMBOK(rdev) ((rdev->ddev->pdev->device == 0x6849) || \ |
2636 | (rdev->ddev->pdev->device == 0x6850) || \ | 2640 | (rdev->ddev->pdev->device == 0x6850) || \ |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index fa9a9c02751e..dedea72f48c4 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -59,7 +59,7 @@ struct atpx_mux { | |||
59 | u16 mux; | 59 | u16 mux; |
60 | } __packed; | 60 | } __packed; |
61 | 61 | ||
62 | bool radeon_is_px(void) { | 62 | bool radeon_has_atpx(void) { |
63 | return radeon_atpx_priv.atpx_detected; | 63 | return radeon_atpx_priv.atpx_detected; |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index c566b486ca08..ea50e0ae7bf7 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1261,21 +1261,6 @@ static const struct drm_connector_funcs radeon_dvi_connector_funcs = { | |||
1261 | .force = radeon_dvi_force, | 1261 | .force = radeon_dvi_force, |
1262 | }; | 1262 | }; |
1263 | 1263 | ||
1264 | static void radeon_dp_connector_destroy(struct drm_connector *connector) | ||
1265 | { | ||
1266 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
1267 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | ||
1268 | |||
1269 | if (radeon_connector->edid) | ||
1270 | kfree(radeon_connector->edid); | ||
1271 | if (radeon_dig_connector->dp_i2c_bus) | ||
1272 | radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus); | ||
1273 | kfree(radeon_connector->con_priv); | ||
1274 | drm_sysfs_connector_remove(connector); | ||
1275 | drm_connector_cleanup(connector); | ||
1276 | kfree(connector); | ||
1277 | } | ||
1278 | |||
1279 | static int radeon_dp_get_modes(struct drm_connector *connector) | 1264 | static int radeon_dp_get_modes(struct drm_connector *connector) |
1280 | { | 1265 | { |
1281 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1266 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
@@ -1553,7 +1538,7 @@ static const struct drm_connector_funcs radeon_dp_connector_funcs = { | |||
1553 | .detect = radeon_dp_detect, | 1538 | .detect = radeon_dp_detect, |
1554 | .fill_modes = drm_helper_probe_single_connector_modes, | 1539 | .fill_modes = drm_helper_probe_single_connector_modes, |
1555 | .set_property = radeon_connector_set_property, | 1540 | .set_property = radeon_connector_set_property, |
1556 | .destroy = radeon_dp_connector_destroy, | 1541 | .destroy = radeon_connector_destroy, |
1557 | .force = radeon_dvi_force, | 1542 | .force = radeon_dvi_force, |
1558 | }; | 1543 | }; |
1559 | 1544 | ||
@@ -1562,7 +1547,7 @@ static const struct drm_connector_funcs radeon_edp_connector_funcs = { | |||
1562 | .detect = radeon_dp_detect, | 1547 | .detect = radeon_dp_detect, |
1563 | .fill_modes = drm_helper_probe_single_connector_modes, | 1548 | .fill_modes = drm_helper_probe_single_connector_modes, |
1564 | .set_property = radeon_lvds_set_property, | 1549 | .set_property = radeon_lvds_set_property, |
1565 | .destroy = radeon_dp_connector_destroy, | 1550 | .destroy = radeon_connector_destroy, |
1566 | .force = radeon_dvi_force, | 1551 | .force = radeon_dvi_force, |
1567 | }; | 1552 | }; |
1568 | 1553 | ||
@@ -1571,7 +1556,7 @@ static const struct drm_connector_funcs radeon_lvds_bridge_connector_funcs = { | |||
1571 | .detect = radeon_dp_detect, | 1556 | .detect = radeon_dp_detect, |
1572 | .fill_modes = drm_helper_probe_single_connector_modes, | 1557 | .fill_modes = drm_helper_probe_single_connector_modes, |
1573 | .set_property = radeon_lvds_set_property, | 1558 | .set_property = radeon_lvds_set_property, |
1574 | .destroy = radeon_dp_connector_destroy, | 1559 | .destroy = radeon_connector_destroy, |
1575 | .force = radeon_dvi_force, | 1560 | .force = radeon_dvi_force, |
1576 | }; | 1561 | }; |
1577 | 1562 | ||
@@ -1668,17 +1653,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1668 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 1653 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
1669 | radeon_connector->con_priv = radeon_dig_connector; | 1654 | radeon_connector->con_priv = radeon_dig_connector; |
1670 | if (i2c_bus->valid) { | 1655 | if (i2c_bus->valid) { |
1671 | /* add DP i2c bus */ | 1656 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1672 | if (connector_type == DRM_MODE_CONNECTOR_eDP) | 1657 | if (radeon_connector->ddc_bus) |
1673 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); | ||
1674 | else | ||
1675 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | ||
1676 | if (radeon_dig_connector->dp_i2c_bus) | ||
1677 | has_aux = true; | 1658 | has_aux = true; |
1678 | else | 1659 | else |
1679 | DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); | ||
1680 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | ||
1681 | if (!radeon_connector->ddc_bus) | ||
1682 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); | 1660 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1683 | } | 1661 | } |
1684 | switch (connector_type) { | 1662 | switch (connector_type) { |
@@ -1893,10 +1871,6 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1893 | drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); | 1871 | drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); |
1894 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); | 1872 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); |
1895 | if (i2c_bus->valid) { | 1873 | if (i2c_bus->valid) { |
1896 | /* add DP i2c bus */ | ||
1897 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | ||
1898 | if (!radeon_dig_connector->dp_i2c_bus) | ||
1899 | DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); | ||
1900 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1874 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1901 | if (radeon_connector->ddc_bus) | 1875 | if (radeon_connector->ddc_bus) |
1902 | has_aux = true; | 1876 | has_aux = true; |
@@ -1942,14 +1916,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1942 | drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type); | 1916 | drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type); |
1943 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); | 1917 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); |
1944 | if (i2c_bus->valid) { | 1918 | if (i2c_bus->valid) { |
1945 | /* add DP i2c bus */ | 1919 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1946 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); | 1920 | if (radeon_connector->ddc_bus) |
1947 | if (radeon_dig_connector->dp_i2c_bus) | ||
1948 | has_aux = true; | 1921 | has_aux = true; |
1949 | else | 1922 | else |
1950 | DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); | ||
1951 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | ||
1952 | if (!radeon_connector->ddc_bus) | ||
1953 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); | 1923 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1954 | } | 1924 | } |
1955 | drm_object_attach_property(&radeon_connector->base.base, | 1925 | drm_object_attach_property(&radeon_connector->base.base, |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 835516d2d257..511fe26198e4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -102,11 +102,14 @@ static const char radeon_family_name[][16] = { | |||
102 | "LAST", | 102 | "LAST", |
103 | }; | 103 | }; |
104 | 104 | ||
105 | #if defined(CONFIG_VGA_SWITCHEROO) | 105 | bool radeon_is_px(struct drm_device *dev) |
106 | bool radeon_is_px(void); | 106 | { |
107 | #else | 107 | struct radeon_device *rdev = dev->dev_private; |
108 | static inline bool radeon_is_px(void) { return false; } | 108 | |
109 | #endif | 109 | if (rdev->flags & RADEON_IS_PX) |
110 | return true; | ||
111 | return false; | ||
112 | } | ||
110 | 113 | ||
111 | /** | 114 | /** |
112 | * radeon_program_register_sequence - program an array of registers. | 115 | * radeon_program_register_sequence - program an array of registers. |
@@ -1082,7 +1085,7 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero | |||
1082 | { | 1085 | { |
1083 | struct drm_device *dev = pci_get_drvdata(pdev); | 1086 | struct drm_device *dev = pci_get_drvdata(pdev); |
1084 | 1087 | ||
1085 | if (radeon_is_px() && state == VGA_SWITCHEROO_OFF) | 1088 | if (radeon_is_px(dev) && state == VGA_SWITCHEROO_OFF) |
1086 | return; | 1089 | return; |
1087 | 1090 | ||
1088 | if (state == VGA_SWITCHEROO_ON) { | 1091 | if (state == VGA_SWITCHEROO_ON) { |
@@ -1301,9 +1304,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1301 | * ignore it */ | 1304 | * ignore it */ |
1302 | vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); | 1305 | vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); |
1303 | 1306 | ||
1304 | if (radeon_runtime_pm == 1) | 1307 | if (rdev->flags & RADEON_IS_PX) |
1305 | runtime = true; | ||
1306 | if ((radeon_runtime_pm == -1) && radeon_is_px()) | ||
1307 | runtime = true; | 1308 | runtime = true; |
1308 | vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); | 1309 | vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); |
1309 | if (runtime) | 1310 | if (runtime) |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 386cfa4c194d..2f7cbb901fb1 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -759,19 +759,18 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
759 | 759 | ||
760 | if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != | 760 | if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != |
761 | ENCODER_OBJECT_ID_NONE) { | 761 | ENCODER_OBJECT_ID_NONE) { |
762 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 762 | if (radeon_connector->ddc_bus->has_aux) |
763 | |||
764 | if (dig->dp_i2c_bus) | ||
765 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, | 763 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
766 | &dig->dp_i2c_bus->adapter); | 764 | &radeon_connector->ddc_bus->aux.ddc); |
767 | } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | 765 | } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
768 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | 766 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { |
769 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 767 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
770 | 768 | ||
771 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || | 769 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || |
772 | dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus) | 770 | dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && |
771 | radeon_connector->ddc_bus->has_aux) | ||
773 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, | 772 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
774 | &dig->dp_i2c_bus->adapter); | 773 | &radeon_connector->ddc_bus->aux.ddc); |
775 | else if (radeon_connector->ddc_bus && !radeon_connector->edid) | 774 | else if (radeon_connector->ddc_bus && !radeon_connector->edid) |
776 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, | 775 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
777 | &radeon_connector->ddc_bus->adapter); | 776 | &radeon_connector->ddc_bus->adapter); |
@@ -865,7 +864,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
865 | unsigned post_div_min, post_div_max, post_div; | 864 | unsigned post_div_min, post_div_max, post_div; |
866 | unsigned ref_div_min, ref_div_max, ref_div; | 865 | unsigned ref_div_min, ref_div_max, ref_div; |
867 | unsigned post_div_best, diff_best; | 866 | unsigned post_div_best, diff_best; |
868 | unsigned nom, den, tmp; | 867 | unsigned nom, den; |
869 | 868 | ||
870 | /* determine allowed feedback divider range */ | 869 | /* determine allowed feedback divider range */ |
871 | fb_div_min = pll->min_feedback_div; | 870 | fb_div_min = pll->min_feedback_div; |
@@ -937,23 +936,27 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
937 | } | 936 | } |
938 | post_div = post_div_best; | 937 | post_div = post_div_best; |
939 | 938 | ||
939 | /* limit reference * post divider to a maximum */ | ||
940 | ref_div_max = min(210 / post_div, ref_div_max); | ||
941 | |||
940 | /* get matching reference and feedback divider */ | 942 | /* get matching reference and feedback divider */ |
941 | ref_div = max(den / post_div, 1u); | 943 | ref_div = max(DIV_ROUND_CLOSEST(den, post_div), 1u); |
942 | fb_div = nom; | 944 | fb_div = DIV_ROUND_CLOSEST(nom * ref_div * post_div, den); |
943 | 945 | ||
944 | /* we're almost done, but reference and feedback | 946 | /* we're almost done, but reference and feedback |
945 | divider might be to large now */ | 947 | divider might be to large now */ |
946 | 948 | ||
947 | tmp = ref_div; | 949 | nom = fb_div; |
950 | den = ref_div; | ||
948 | 951 | ||
949 | if (fb_div > fb_div_max) { | 952 | if (fb_div > fb_div_max) { |
950 | ref_div = ref_div * fb_div_max / fb_div; | 953 | ref_div = DIV_ROUND_CLOSEST(den * fb_div_max, nom); |
951 | fb_div = fb_div_max; | 954 | fb_div = fb_div_max; |
952 | } | 955 | } |
953 | 956 | ||
954 | if (ref_div > ref_div_max) { | 957 | if (ref_div > ref_div_max) { |
955 | ref_div = ref_div_max; | 958 | ref_div = ref_div_max; |
956 | fb_div = nom * ref_div_max / tmp; | 959 | fb_div = DIV_ROUND_CLOSEST(nom * ref_div_max, den); |
957 | } | 960 | } |
958 | 961 | ||
959 | /* reduce the numbers to a simpler ratio once more */ | 962 | /* reduce the numbers to a simpler ratio once more */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index d0eba48dd74e..c00a2f585185 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -115,6 +115,7 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, | |||
115 | unsigned int flags, | 115 | unsigned int flags, |
116 | int *vpos, int *hpos, ktime_t *stime, | 116 | int *vpos, int *hpos, ktime_t *stime, |
117 | ktime_t *etime); | 117 | ktime_t *etime); |
118 | extern bool radeon_is_px(struct drm_device *dev); | ||
118 | extern const struct drm_ioctl_desc radeon_ioctls_kms[]; | 119 | extern const struct drm_ioctl_desc radeon_ioctls_kms[]; |
119 | extern int radeon_max_kms_ioctl; | 120 | extern int radeon_max_kms_ioctl; |
120 | int radeon_mmap(struct file *filp, struct vm_area_struct *vma); | 121 | int radeon_mmap(struct file *filp, struct vm_area_struct *vma); |
@@ -144,11 +145,9 @@ void radeon_debugfs_cleanup(struct drm_minor *minor); | |||
144 | #if defined(CONFIG_VGA_SWITCHEROO) | 145 | #if defined(CONFIG_VGA_SWITCHEROO) |
145 | void radeon_register_atpx_handler(void); | 146 | void radeon_register_atpx_handler(void); |
146 | void radeon_unregister_atpx_handler(void); | 147 | void radeon_unregister_atpx_handler(void); |
147 | bool radeon_is_px(void); | ||
148 | #else | 148 | #else |
149 | static inline void radeon_register_atpx_handler(void) {} | 149 | static inline void radeon_register_atpx_handler(void) {} |
150 | static inline void radeon_unregister_atpx_handler(void) {} | 150 | static inline void radeon_unregister_atpx_handler(void) {} |
151 | static inline bool radeon_is_px(void) { return false; } | ||
152 | #endif | 151 | #endif |
153 | 152 | ||
154 | int radeon_no_wb; | 153 | int radeon_no_wb; |
@@ -186,7 +185,7 @@ module_param_named(dynclks, radeon_dynclks, int, 0444); | |||
186 | MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx"); | 185 | MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx"); |
187 | module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444); | 186 | module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444); |
188 | 187 | ||
189 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing"); | 188 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
190 | module_param_named(vramlimit, radeon_vram_limit, int, 0600); | 189 | module_param_named(vramlimit, radeon_vram_limit, int, 0600); |
191 | 190 | ||
192 | MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)"); | 191 | MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)"); |
@@ -405,12 +404,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev) | |||
405 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 404 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
406 | int ret; | 405 | int ret; |
407 | 406 | ||
408 | if (radeon_runtime_pm == 0) { | 407 | if (!radeon_is_px(drm_dev)) { |
409 | pm_runtime_forbid(dev); | ||
410 | return -EBUSY; | ||
411 | } | ||
412 | |||
413 | if (radeon_runtime_pm == -1 && !radeon_is_px()) { | ||
414 | pm_runtime_forbid(dev); | 408 | pm_runtime_forbid(dev); |
415 | return -EBUSY; | 409 | return -EBUSY; |
416 | } | 410 | } |
@@ -434,10 +428,7 @@ static int radeon_pmops_runtime_resume(struct device *dev) | |||
434 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 428 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
435 | int ret; | 429 | int ret; |
436 | 430 | ||
437 | if (radeon_runtime_pm == 0) | 431 | if (!radeon_is_px(drm_dev)) |
438 | return -EINVAL; | ||
439 | |||
440 | if (radeon_runtime_pm == -1 && !radeon_is_px()) | ||
441 | return -EINVAL; | 432 | return -EINVAL; |
442 | 433 | ||
443 | drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; | 434 | drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; |
@@ -462,14 +453,7 @@ static int radeon_pmops_runtime_idle(struct device *dev) | |||
462 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 453 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
463 | struct drm_crtc *crtc; | 454 | struct drm_crtc *crtc; |
464 | 455 | ||
465 | if (radeon_runtime_pm == 0) { | 456 | if (!radeon_is_px(drm_dev)) { |
466 | pm_runtime_forbid(dev); | ||
467 | return -EBUSY; | ||
468 | } | ||
469 | |||
470 | /* are we PX enabled? */ | ||
471 | if (radeon_runtime_pm == -1 && !radeon_is_px()) { | ||
472 | DRM_DEBUG_DRIVER("failing to power off - not px\n"); | ||
473 | pm_runtime_forbid(dev); | 457 | pm_runtime_forbid(dev); |
474 | return -EBUSY; | 458 | return -EBUSY; |
475 | } | 459 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h index 614ad549297f..9da5da4ffd17 100644 --- a/drivers/gpu/drm/radeon/radeon_family.h +++ b/drivers/gpu/drm/radeon/radeon_family.h | |||
@@ -115,6 +115,7 @@ enum radeon_chip_flags { | |||
115 | RADEON_NEW_MEMMAP = 0x00400000UL, | 115 | RADEON_NEW_MEMMAP = 0x00400000UL, |
116 | RADEON_IS_PCI = 0x00800000UL, | 116 | RADEON_IS_PCI = 0x00800000UL, |
117 | RADEON_IS_IGPGART = 0x01000000UL, | 117 | RADEON_IS_IGPGART = 0x01000000UL, |
118 | RADEON_IS_PX = 0x02000000UL, | ||
118 | }; | 119 | }; |
119 | 120 | ||
120 | #endif | 121 | #endif |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index e24ca6ab96de..7b944142a9fd 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -64,8 +64,7 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux) | |||
64 | radeon_router_select_ddc_port(radeon_connector); | 64 | radeon_router_select_ddc_port(radeon_connector); |
65 | 65 | ||
66 | if (use_aux) { | 66 | if (use_aux) { |
67 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 67 | ret = i2c_transfer(&radeon_connector->ddc_bus->aux.ddc, msgs, 2); |
68 | ret = i2c_transfer(&dig->dp_i2c_bus->adapter, msgs, 2); | ||
69 | } else { | 68 | } else { |
70 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); | 69 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
71 | } | 70 | } |
@@ -950,16 +949,16 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
950 | /* set the radeon bit adapter */ | 949 | /* set the radeon bit adapter */ |
951 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | 950 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
952 | "Radeon i2c bit bus %s", name); | 951 | "Radeon i2c bit bus %s", name); |
953 | i2c->adapter.algo_data = &i2c->algo.bit; | 952 | i2c->adapter.algo_data = &i2c->bit; |
954 | i2c->algo.bit.pre_xfer = pre_xfer; | 953 | i2c->bit.pre_xfer = pre_xfer; |
955 | i2c->algo.bit.post_xfer = post_xfer; | 954 | i2c->bit.post_xfer = post_xfer; |
956 | i2c->algo.bit.setsda = set_data; | 955 | i2c->bit.setsda = set_data; |
957 | i2c->algo.bit.setscl = set_clock; | 956 | i2c->bit.setscl = set_clock; |
958 | i2c->algo.bit.getsda = get_data; | 957 | i2c->bit.getsda = get_data; |
959 | i2c->algo.bit.getscl = get_clock; | 958 | i2c->bit.getscl = get_clock; |
960 | i2c->algo.bit.udelay = 10; | 959 | i2c->bit.udelay = 10; |
961 | i2c->algo.bit.timeout = usecs_to_jiffies(2200); /* from VESA */ | 960 | i2c->bit.timeout = usecs_to_jiffies(2200); /* from VESA */ |
962 | i2c->algo.bit.data = i2c; | 961 | i2c->bit.data = i2c; |
963 | ret = i2c_bit_add_bus(&i2c->adapter); | 962 | ret = i2c_bit_add_bus(&i2c->adapter); |
964 | if (ret) { | 963 | if (ret) { |
965 | DRM_ERROR("Failed to register bit i2c %s\n", name); | 964 | DRM_ERROR("Failed to register bit i2c %s\n", name); |
@@ -974,46 +973,13 @@ out_free: | |||
974 | 973 | ||
975 | } | 974 | } |
976 | 975 | ||
977 | struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | ||
978 | struct radeon_i2c_bus_rec *rec, | ||
979 | const char *name) | ||
980 | { | ||
981 | struct radeon_i2c_chan *i2c; | ||
982 | int ret; | ||
983 | |||
984 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); | ||
985 | if (i2c == NULL) | ||
986 | return NULL; | ||
987 | |||
988 | i2c->rec = *rec; | ||
989 | i2c->adapter.owner = THIS_MODULE; | ||
990 | i2c->adapter.class = I2C_CLASS_DDC; | ||
991 | i2c->adapter.dev.parent = &dev->pdev->dev; | ||
992 | i2c->dev = dev; | ||
993 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | ||
994 | "Radeon aux bus %s", name); | ||
995 | i2c_set_adapdata(&i2c->adapter, i2c); | ||
996 | i2c->adapter.algo_data = &i2c->algo.dp; | ||
997 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; | ||
998 | i2c->algo.dp.address = 0; | ||
999 | ret = i2c_dp_aux_add_bus(&i2c->adapter); | ||
1000 | if (ret) { | ||
1001 | DRM_INFO("Failed to register i2c %s\n", name); | ||
1002 | goto out_free; | ||
1003 | } | ||
1004 | |||
1005 | return i2c; | ||
1006 | out_free: | ||
1007 | kfree(i2c); | ||
1008 | return NULL; | ||
1009 | |||
1010 | } | ||
1011 | |||
1012 | void radeon_i2c_destroy(struct radeon_i2c_chan *i2c) | 976 | void radeon_i2c_destroy(struct radeon_i2c_chan *i2c) |
1013 | { | 977 | { |
1014 | if (!i2c) | 978 | if (!i2c) |
1015 | return; | 979 | return; |
1016 | i2c_del_adapter(&i2c->adapter); | 980 | i2c_del_adapter(&i2c->adapter); |
981 | if (i2c->has_aux) | ||
982 | drm_dp_aux_unregister_i2c_bus(&i2c->aux); | ||
1017 | kfree(i2c); | 983 | kfree(i2c); |
1018 | } | 984 | } |
1019 | 985 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 3e49342a20e6..fb3d13f693dd 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -35,9 +35,9 @@ | |||
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | 36 | ||
37 | #if defined(CONFIG_VGA_SWITCHEROO) | 37 | #if defined(CONFIG_VGA_SWITCHEROO) |
38 | bool radeon_is_px(void); | 38 | bool radeon_has_atpx(void); |
39 | #else | 39 | #else |
40 | static inline bool radeon_is_px(void) { return false; } | 40 | static inline bool radeon_has_atpx(void) { return false; } |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /** | 43 | /** |
@@ -107,6 +107,13 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) | |||
107 | flags |= RADEON_IS_PCI; | 107 | flags |= RADEON_IS_PCI; |
108 | } | 108 | } |
109 | 109 | ||
110 | if (radeon_runtime_pm == 1) | ||
111 | flags |= RADEON_IS_PX; | ||
112 | else if ((radeon_runtime_pm == -1) && | ||
113 | radeon_has_atpx() && | ||
114 | ((flags & RADEON_IS_IGP) == 0)) | ||
115 | flags |= RADEON_IS_PX; | ||
116 | |||
110 | /* radeon_device_init should report only fatal error | 117 | /* radeon_device_init should report only fatal error |
111 | * like memory allocation failure or iomapping failure, | 118 | * like memory allocation failure or iomapping failure, |
112 | * or memory manager initialization failure, it must | 119 | * or memory manager initialization failure, it must |
@@ -137,8 +144,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) | |||
137 | "Error during ACPI methods call\n"); | 144 | "Error during ACPI methods call\n"); |
138 | } | 145 | } |
139 | 146 | ||
140 | if ((radeon_runtime_pm == 1) || | 147 | if (radeon_is_px(dev)) { |
141 | ((radeon_runtime_pm == -1) && radeon_is_px())) { | ||
142 | pm_runtime_use_autosuspend(dev->dev); | 148 | pm_runtime_use_autosuspend(dev->dev); |
143 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); | 149 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); |
144 | pm_runtime_set_active(dev->dev); | 150 | pm_runtime_set_active(dev->dev); |
@@ -568,12 +574,17 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
568 | } | 574 | } |
569 | 575 | ||
570 | r = radeon_vm_init(rdev, &fpriv->vm); | 576 | r = radeon_vm_init(rdev, &fpriv->vm); |
571 | if (r) | 577 | if (r) { |
578 | kfree(fpriv); | ||
572 | return r; | 579 | return r; |
580 | } | ||
573 | 581 | ||
574 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | 582 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
575 | if (r) | 583 | if (r) { |
584 | radeon_vm_fini(rdev, &fpriv->vm); | ||
585 | kfree(fpriv); | ||
576 | return r; | 586 | return r; |
587 | } | ||
577 | 588 | ||
578 | /* map the ib pool buffer read only into | 589 | /* map the ib pool buffer read only into |
579 | * virtual address space */ | 590 | * virtual address space */ |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 832d9fa1a4c4..6ddf31a2d34e 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -187,12 +187,10 @@ struct radeon_pll { | |||
187 | struct radeon_i2c_chan { | 187 | struct radeon_i2c_chan { |
188 | struct i2c_adapter adapter; | 188 | struct i2c_adapter adapter; |
189 | struct drm_device *dev; | 189 | struct drm_device *dev; |
190 | union { | 190 | struct i2c_algo_bit_data bit; |
191 | struct i2c_algo_bit_data bit; | ||
192 | struct i2c_algo_dp_aux_data dp; | ||
193 | } algo; | ||
194 | struct radeon_i2c_bus_rec rec; | 191 | struct radeon_i2c_bus_rec rec; |
195 | struct drm_dp_aux aux; | 192 | struct drm_dp_aux aux; |
193 | bool has_aux; | ||
196 | }; | 194 | }; |
197 | 195 | ||
198 | /* mostly for macs, but really any system without connector tables */ | 196 | /* mostly for macs, but really any system without connector tables */ |
@@ -440,7 +438,6 @@ struct radeon_encoder { | |||
440 | struct radeon_connector_atom_dig { | 438 | struct radeon_connector_atom_dig { |
441 | uint32_t igp_lane_info; | 439 | uint32_t igp_lane_info; |
442 | /* displayport */ | 440 | /* displayport */ |
443 | struct radeon_i2c_chan *dp_i2c_bus; | ||
444 | u8 dpcd[DP_RECEIVER_CAP_SIZE]; | 441 | u8 dpcd[DP_RECEIVER_CAP_SIZE]; |
445 | u8 dp_sink_type; | 442 | u8 dp_sink_type; |
446 | int dp_clock; | 443 | int dp_clock; |
@@ -702,8 +699,6 @@ extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | |||
702 | uint8_t lane_set); | 699 | uint8_t lane_set); |
703 | extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); | 700 | extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); |
704 | extern struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder); | 701 | extern struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder); |
705 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | ||
706 | u8 write_byte, u8 *read_byte); | ||
707 | void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); | 702 | void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); |
708 | 703 | ||
709 | extern void radeon_i2c_init(struct radeon_device *rdev); | 704 | extern void radeon_i2c_init(struct radeon_device *rdev); |
@@ -715,9 +710,6 @@ extern void radeon_i2c_add(struct radeon_device *rdev, | |||
715 | const char *name); | 710 | const char *name); |
716 | extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, | 711 | extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, |
717 | struct radeon_i2c_bus_rec *i2c_bus); | 712 | struct radeon_i2c_bus_rec *i2c_bus); |
718 | extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | ||
719 | struct radeon_i2c_bus_rec *rec, | ||
720 | const char *name); | ||
721 | extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | 713 | extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, |
722 | struct radeon_i2c_bus_rec *rec, | 714 | struct radeon_i2c_bus_rec *rec, |
723 | const char *name); | 715 | const char *name); |
diff --git a/drivers/gpu/drm/radeon/radeon_ucode.h b/drivers/gpu/drm/radeon/radeon_ucode.h index a77cd274dfc3..58d12938c0b8 100644 --- a/drivers/gpu/drm/radeon/radeon_ucode.h +++ b/drivers/gpu/drm/radeon/radeon_ucode.h | |||
@@ -57,9 +57,14 @@ | |||
57 | #define BTC_MC_UCODE_SIZE 6024 | 57 | #define BTC_MC_UCODE_SIZE 6024 |
58 | #define CAYMAN_MC_UCODE_SIZE 6037 | 58 | #define CAYMAN_MC_UCODE_SIZE 6037 |
59 | #define SI_MC_UCODE_SIZE 7769 | 59 | #define SI_MC_UCODE_SIZE 7769 |
60 | #define TAHITI_MC_UCODE_SIZE 7808 | ||
61 | #define PITCAIRN_MC_UCODE_SIZE 7775 | ||
62 | #define VERDE_MC_UCODE_SIZE 7875 | ||
60 | #define OLAND_MC_UCODE_SIZE 7863 | 63 | #define OLAND_MC_UCODE_SIZE 7863 |
61 | #define CIK_MC_UCODE_SIZE 7866 | 64 | #define BONAIRE_MC_UCODE_SIZE 7866 |
65 | #define BONAIRE_MC2_UCODE_SIZE 7948 | ||
62 | #define HAWAII_MC_UCODE_SIZE 7933 | 66 | #define HAWAII_MC_UCODE_SIZE 7933 |
67 | #define HAWAII_MC2_UCODE_SIZE 8091 | ||
63 | 68 | ||
64 | /* SDMA */ | 69 | /* SDMA */ |
65 | #define CIK_SDMA_UCODE_SIZE 1050 | 70 | #define CIK_SDMA_UCODE_SIZE 1050 |
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c index 76e9904bc537..ced53dd03e7c 100644 --- a/drivers/gpu/drm/radeon/radeon_vce.c +++ b/drivers/gpu/drm/radeon/radeon_vce.c | |||
@@ -613,7 +613,7 @@ void radeon_vce_fence_emit(struct radeon_device *rdev, | |||
613 | struct radeon_fence *fence) | 613 | struct radeon_fence *fence) |
614 | { | 614 | { |
615 | struct radeon_ring *ring = &rdev->ring[fence->ring]; | 615 | struct radeon_ring *ring = &rdev->ring[fence->ring]; |
616 | uint32_t addr = rdev->fence_drv[fence->ring].gpu_addr; | 616 | uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr; |
617 | 617 | ||
618 | radeon_ring_write(ring, VCE_CMD_FENCE); | 618 | radeon_ring_write(ring, VCE_CMD_FENCE); |
619 | radeon_ring_write(ring, addr); | 619 | radeon_ring_write(ring, addr); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index d589475fe9e6..ac708e006180 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -39,30 +39,35 @@ MODULE_FIRMWARE("radeon/TAHITI_pfp.bin"); | |||
39 | MODULE_FIRMWARE("radeon/TAHITI_me.bin"); | 39 | MODULE_FIRMWARE("radeon/TAHITI_me.bin"); |
40 | MODULE_FIRMWARE("radeon/TAHITI_ce.bin"); | 40 | MODULE_FIRMWARE("radeon/TAHITI_ce.bin"); |
41 | MODULE_FIRMWARE("radeon/TAHITI_mc.bin"); | 41 | MODULE_FIRMWARE("radeon/TAHITI_mc.bin"); |
42 | MODULE_FIRMWARE("radeon/TAHITI_mc2.bin"); | ||
42 | MODULE_FIRMWARE("radeon/TAHITI_rlc.bin"); | 43 | MODULE_FIRMWARE("radeon/TAHITI_rlc.bin"); |
43 | MODULE_FIRMWARE("radeon/TAHITI_smc.bin"); | 44 | MODULE_FIRMWARE("radeon/TAHITI_smc.bin"); |
44 | MODULE_FIRMWARE("radeon/PITCAIRN_pfp.bin"); | 45 | MODULE_FIRMWARE("radeon/PITCAIRN_pfp.bin"); |
45 | MODULE_FIRMWARE("radeon/PITCAIRN_me.bin"); | 46 | MODULE_FIRMWARE("radeon/PITCAIRN_me.bin"); |
46 | MODULE_FIRMWARE("radeon/PITCAIRN_ce.bin"); | 47 | MODULE_FIRMWARE("radeon/PITCAIRN_ce.bin"); |
47 | MODULE_FIRMWARE("radeon/PITCAIRN_mc.bin"); | 48 | MODULE_FIRMWARE("radeon/PITCAIRN_mc.bin"); |
49 | MODULE_FIRMWARE("radeon/PITCAIRN_mc2.bin"); | ||
48 | MODULE_FIRMWARE("radeon/PITCAIRN_rlc.bin"); | 50 | MODULE_FIRMWARE("radeon/PITCAIRN_rlc.bin"); |
49 | MODULE_FIRMWARE("radeon/PITCAIRN_smc.bin"); | 51 | MODULE_FIRMWARE("radeon/PITCAIRN_smc.bin"); |
50 | MODULE_FIRMWARE("radeon/VERDE_pfp.bin"); | 52 | MODULE_FIRMWARE("radeon/VERDE_pfp.bin"); |
51 | MODULE_FIRMWARE("radeon/VERDE_me.bin"); | 53 | MODULE_FIRMWARE("radeon/VERDE_me.bin"); |
52 | MODULE_FIRMWARE("radeon/VERDE_ce.bin"); | 54 | MODULE_FIRMWARE("radeon/VERDE_ce.bin"); |
53 | MODULE_FIRMWARE("radeon/VERDE_mc.bin"); | 55 | MODULE_FIRMWARE("radeon/VERDE_mc.bin"); |
56 | MODULE_FIRMWARE("radeon/VERDE_mc2.bin"); | ||
54 | MODULE_FIRMWARE("radeon/VERDE_rlc.bin"); | 57 | MODULE_FIRMWARE("radeon/VERDE_rlc.bin"); |
55 | MODULE_FIRMWARE("radeon/VERDE_smc.bin"); | 58 | MODULE_FIRMWARE("radeon/VERDE_smc.bin"); |
56 | MODULE_FIRMWARE("radeon/OLAND_pfp.bin"); | 59 | MODULE_FIRMWARE("radeon/OLAND_pfp.bin"); |
57 | MODULE_FIRMWARE("radeon/OLAND_me.bin"); | 60 | MODULE_FIRMWARE("radeon/OLAND_me.bin"); |
58 | MODULE_FIRMWARE("radeon/OLAND_ce.bin"); | 61 | MODULE_FIRMWARE("radeon/OLAND_ce.bin"); |
59 | MODULE_FIRMWARE("radeon/OLAND_mc.bin"); | 62 | MODULE_FIRMWARE("radeon/OLAND_mc.bin"); |
63 | MODULE_FIRMWARE("radeon/OLAND_mc2.bin"); | ||
60 | MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); | 64 | MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); |
61 | MODULE_FIRMWARE("radeon/OLAND_smc.bin"); | 65 | MODULE_FIRMWARE("radeon/OLAND_smc.bin"); |
62 | MODULE_FIRMWARE("radeon/HAINAN_pfp.bin"); | 66 | MODULE_FIRMWARE("radeon/HAINAN_pfp.bin"); |
63 | MODULE_FIRMWARE("radeon/HAINAN_me.bin"); | 67 | MODULE_FIRMWARE("radeon/HAINAN_me.bin"); |
64 | MODULE_FIRMWARE("radeon/HAINAN_ce.bin"); | 68 | MODULE_FIRMWARE("radeon/HAINAN_ce.bin"); |
65 | MODULE_FIRMWARE("radeon/HAINAN_mc.bin"); | 69 | MODULE_FIRMWARE("radeon/HAINAN_mc.bin"); |
70 | MODULE_FIRMWARE("radeon/HAINAN_mc2.bin"); | ||
66 | MODULE_FIRMWARE("radeon/HAINAN_rlc.bin"); | 71 | MODULE_FIRMWARE("radeon/HAINAN_rlc.bin"); |
67 | MODULE_FIRMWARE("radeon/HAINAN_smc.bin"); | 72 | MODULE_FIRMWARE("radeon/HAINAN_smc.bin"); |
68 | 73 | ||
@@ -1467,36 +1472,33 @@ int si_mc_load_microcode(struct radeon_device *rdev) | |||
1467 | const __be32 *fw_data; | 1472 | const __be32 *fw_data; |
1468 | u32 running, blackout = 0; | 1473 | u32 running, blackout = 0; |
1469 | u32 *io_mc_regs; | 1474 | u32 *io_mc_regs; |
1470 | int i, ucode_size, regs_size; | 1475 | int i, regs_size, ucode_size; |
1471 | 1476 | ||
1472 | if (!rdev->mc_fw) | 1477 | if (!rdev->mc_fw) |
1473 | return -EINVAL; | 1478 | return -EINVAL; |
1474 | 1479 | ||
1480 | ucode_size = rdev->mc_fw->size / 4; | ||
1481 | |||
1475 | switch (rdev->family) { | 1482 | switch (rdev->family) { |
1476 | case CHIP_TAHITI: | 1483 | case CHIP_TAHITI: |
1477 | io_mc_regs = (u32 *)&tahiti_io_mc_regs; | 1484 | io_mc_regs = (u32 *)&tahiti_io_mc_regs; |
1478 | ucode_size = SI_MC_UCODE_SIZE; | ||
1479 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1485 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1480 | break; | 1486 | break; |
1481 | case CHIP_PITCAIRN: | 1487 | case CHIP_PITCAIRN: |
1482 | io_mc_regs = (u32 *)&pitcairn_io_mc_regs; | 1488 | io_mc_regs = (u32 *)&pitcairn_io_mc_regs; |
1483 | ucode_size = SI_MC_UCODE_SIZE; | ||
1484 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1489 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1485 | break; | 1490 | break; |
1486 | case CHIP_VERDE: | 1491 | case CHIP_VERDE: |
1487 | default: | 1492 | default: |
1488 | io_mc_regs = (u32 *)&verde_io_mc_regs; | 1493 | io_mc_regs = (u32 *)&verde_io_mc_regs; |
1489 | ucode_size = SI_MC_UCODE_SIZE; | ||
1490 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1494 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1491 | break; | 1495 | break; |
1492 | case CHIP_OLAND: | 1496 | case CHIP_OLAND: |
1493 | io_mc_regs = (u32 *)&oland_io_mc_regs; | 1497 | io_mc_regs = (u32 *)&oland_io_mc_regs; |
1494 | ucode_size = OLAND_MC_UCODE_SIZE; | ||
1495 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1498 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1496 | break; | 1499 | break; |
1497 | case CHIP_HAINAN: | 1500 | case CHIP_HAINAN: |
1498 | io_mc_regs = (u32 *)&hainan_io_mc_regs; | 1501 | io_mc_regs = (u32 *)&hainan_io_mc_regs; |
1499 | ucode_size = OLAND_MC_UCODE_SIZE; | ||
1500 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1502 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1501 | break; | 1503 | break; |
1502 | } | 1504 | } |
@@ -1552,7 +1554,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1552 | const char *chip_name; | 1554 | const char *chip_name; |
1553 | const char *rlc_chip_name; | 1555 | const char *rlc_chip_name; |
1554 | size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; | 1556 | size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; |
1555 | size_t smc_req_size; | 1557 | size_t smc_req_size, mc2_req_size; |
1556 | char fw_name[30]; | 1558 | char fw_name[30]; |
1557 | int err; | 1559 | int err; |
1558 | 1560 | ||
@@ -1567,6 +1569,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1567 | ce_req_size = SI_CE_UCODE_SIZE * 4; | 1569 | ce_req_size = SI_CE_UCODE_SIZE * 4; |
1568 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1570 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1569 | mc_req_size = SI_MC_UCODE_SIZE * 4; | 1571 | mc_req_size = SI_MC_UCODE_SIZE * 4; |
1572 | mc2_req_size = TAHITI_MC_UCODE_SIZE * 4; | ||
1570 | smc_req_size = ALIGN(TAHITI_SMC_UCODE_SIZE, 4); | 1573 | smc_req_size = ALIGN(TAHITI_SMC_UCODE_SIZE, 4); |
1571 | break; | 1574 | break; |
1572 | case CHIP_PITCAIRN: | 1575 | case CHIP_PITCAIRN: |
@@ -1577,6 +1580,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1577 | ce_req_size = SI_CE_UCODE_SIZE * 4; | 1580 | ce_req_size = SI_CE_UCODE_SIZE * 4; |
1578 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1581 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1579 | mc_req_size = SI_MC_UCODE_SIZE * 4; | 1582 | mc_req_size = SI_MC_UCODE_SIZE * 4; |
1583 | mc2_req_size = PITCAIRN_MC_UCODE_SIZE * 4; | ||
1580 | smc_req_size = ALIGN(PITCAIRN_SMC_UCODE_SIZE, 4); | 1584 | smc_req_size = ALIGN(PITCAIRN_SMC_UCODE_SIZE, 4); |
1581 | break; | 1585 | break; |
1582 | case CHIP_VERDE: | 1586 | case CHIP_VERDE: |
@@ -1587,6 +1591,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1587 | ce_req_size = SI_CE_UCODE_SIZE * 4; | 1591 | ce_req_size = SI_CE_UCODE_SIZE * 4; |
1588 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1592 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1589 | mc_req_size = SI_MC_UCODE_SIZE * 4; | 1593 | mc_req_size = SI_MC_UCODE_SIZE * 4; |
1594 | mc2_req_size = VERDE_MC_UCODE_SIZE * 4; | ||
1590 | smc_req_size = ALIGN(VERDE_SMC_UCODE_SIZE, 4); | 1595 | smc_req_size = ALIGN(VERDE_SMC_UCODE_SIZE, 4); |
1591 | break; | 1596 | break; |
1592 | case CHIP_OLAND: | 1597 | case CHIP_OLAND: |
@@ -1596,7 +1601,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1596 | me_req_size = SI_PM4_UCODE_SIZE * 4; | 1601 | me_req_size = SI_PM4_UCODE_SIZE * 4; |
1597 | ce_req_size = SI_CE_UCODE_SIZE * 4; | 1602 | ce_req_size = SI_CE_UCODE_SIZE * 4; |
1598 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1603 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1599 | mc_req_size = OLAND_MC_UCODE_SIZE * 4; | 1604 | mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; |
1600 | smc_req_size = ALIGN(OLAND_SMC_UCODE_SIZE, 4); | 1605 | smc_req_size = ALIGN(OLAND_SMC_UCODE_SIZE, 4); |
1601 | break; | 1606 | break; |
1602 | case CHIP_HAINAN: | 1607 | case CHIP_HAINAN: |
@@ -1606,7 +1611,7 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1606 | me_req_size = SI_PM4_UCODE_SIZE * 4; | 1611 | me_req_size = SI_PM4_UCODE_SIZE * 4; |
1607 | ce_req_size = SI_CE_UCODE_SIZE * 4; | 1612 | ce_req_size = SI_CE_UCODE_SIZE * 4; |
1608 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1613 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1609 | mc_req_size = OLAND_MC_UCODE_SIZE * 4; | 1614 | mc_req_size = mc2_req_size = OLAND_MC_UCODE_SIZE * 4; |
1610 | smc_req_size = ALIGN(HAINAN_SMC_UCODE_SIZE, 4); | 1615 | smc_req_size = ALIGN(HAINAN_SMC_UCODE_SIZE, 4); |
1611 | break; | 1616 | break; |
1612 | default: BUG(); | 1617 | default: BUG(); |
@@ -1659,16 +1664,22 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1659 | err = -EINVAL; | 1664 | err = -EINVAL; |
1660 | } | 1665 | } |
1661 | 1666 | ||
1662 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); | 1667 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc2.bin", chip_name); |
1663 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); | 1668 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
1664 | if (err) | 1669 | if (err) { |
1665 | goto out; | 1670 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
1666 | if (rdev->mc_fw->size != mc_req_size) { | 1671 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
1672 | if (err) | ||
1673 | goto out; | ||
1674 | } | ||
1675 | if ((rdev->mc_fw->size != mc_req_size) && | ||
1676 | (rdev->mc_fw->size != mc2_req_size)) { | ||
1667 | printk(KERN_ERR | 1677 | printk(KERN_ERR |
1668 | "si_mc: Bogus length %zu in firmware \"%s\"\n", | 1678 | "si_mc: Bogus length %zu in firmware \"%s\"\n", |
1669 | rdev->mc_fw->size, fw_name); | 1679 | rdev->mc_fw->size, fw_name); |
1670 | err = -EINVAL; | 1680 | err = -EINVAL; |
1671 | } | 1681 | } |
1682 | DRM_INFO("%s: %zu bytes\n", fw_name, rdev->mc_fw->size); | ||
1672 | 1683 | ||
1673 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 1684 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
1674 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 1685 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index d536ed381fbd..005c19bd92df 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c | |||
@@ -99,55 +99,73 @@ static void tegra_dpaux_read_fifo(struct tegra_dpaux *dpaux, u8 *buffer, | |||
99 | static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux, | 99 | static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux, |
100 | struct drm_dp_aux_msg *msg) | 100 | struct drm_dp_aux_msg *msg) |
101 | { | 101 | { |
102 | unsigned long value = DPAUX_DP_AUXCTL_TRANSACTREQ; | ||
103 | unsigned long timeout = msecs_to_jiffies(250); | 102 | unsigned long timeout = msecs_to_jiffies(250); |
104 | struct tegra_dpaux *dpaux = to_dpaux(aux); | 103 | struct tegra_dpaux *dpaux = to_dpaux(aux); |
105 | unsigned long status; | 104 | unsigned long status; |
106 | ssize_t ret = 0; | 105 | ssize_t ret = 0; |
106 | u32 value; | ||
107 | 107 | ||
108 | if (msg->size < 1 || msg->size > 16) | 108 | /* Tegra has 4x4 byte DP AUX transmit and receive FIFOs. */ |
109 | if (msg->size > 16) | ||
109 | return -EINVAL; | 110 | return -EINVAL; |
110 | 111 | ||
111 | tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR); | 112 | /* |
113 | * Allow zero-sized messages only for I2C, in which case they specify | ||
114 | * address-only transactions. | ||
115 | */ | ||
116 | if (msg->size < 1) { | ||
117 | switch (msg->request & ~DP_AUX_I2C_MOT) { | ||
118 | case DP_AUX_I2C_WRITE: | ||
119 | case DP_AUX_I2C_READ: | ||
120 | value = DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY; | ||
121 | break; | ||
122 | |||
123 | default: | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | } else { | ||
127 | /* For non-zero-sized messages, set the CMDLEN field. */ | ||
128 | value = DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1); | ||
129 | } | ||
112 | 130 | ||
113 | switch (msg->request & ~DP_AUX_I2C_MOT) { | 131 | switch (msg->request & ~DP_AUX_I2C_MOT) { |
114 | case DP_AUX_I2C_WRITE: | 132 | case DP_AUX_I2C_WRITE: |
115 | if (msg->request & DP_AUX_I2C_MOT) | 133 | if (msg->request & DP_AUX_I2C_MOT) |
116 | value = DPAUX_DP_AUXCTL_CMD_MOT_WR; | 134 | value |= DPAUX_DP_AUXCTL_CMD_MOT_WR; |
117 | else | 135 | else |
118 | value = DPAUX_DP_AUXCTL_CMD_I2C_WR; | 136 | value |= DPAUX_DP_AUXCTL_CMD_I2C_WR; |
119 | 137 | ||
120 | break; | 138 | break; |
121 | 139 | ||
122 | case DP_AUX_I2C_READ: | 140 | case DP_AUX_I2C_READ: |
123 | if (msg->request & DP_AUX_I2C_MOT) | 141 | if (msg->request & DP_AUX_I2C_MOT) |
124 | value = DPAUX_DP_AUXCTL_CMD_MOT_RD; | 142 | value |= DPAUX_DP_AUXCTL_CMD_MOT_RD; |
125 | else | 143 | else |
126 | value = DPAUX_DP_AUXCTL_CMD_I2C_RD; | 144 | value |= DPAUX_DP_AUXCTL_CMD_I2C_RD; |
127 | 145 | ||
128 | break; | 146 | break; |
129 | 147 | ||
130 | case DP_AUX_I2C_STATUS: | 148 | case DP_AUX_I2C_STATUS: |
131 | if (msg->request & DP_AUX_I2C_MOT) | 149 | if (msg->request & DP_AUX_I2C_MOT) |
132 | value = DPAUX_DP_AUXCTL_CMD_MOT_RQ; | 150 | value |= DPAUX_DP_AUXCTL_CMD_MOT_RQ; |
133 | else | 151 | else |
134 | value = DPAUX_DP_AUXCTL_CMD_I2C_RQ; | 152 | value |= DPAUX_DP_AUXCTL_CMD_I2C_RQ; |
135 | 153 | ||
136 | break; | 154 | break; |
137 | 155 | ||
138 | case DP_AUX_NATIVE_WRITE: | 156 | case DP_AUX_NATIVE_WRITE: |
139 | value = DPAUX_DP_AUXCTL_CMD_AUX_WR; | 157 | value |= DPAUX_DP_AUXCTL_CMD_AUX_WR; |
140 | break; | 158 | break; |
141 | 159 | ||
142 | case DP_AUX_NATIVE_READ: | 160 | case DP_AUX_NATIVE_READ: |
143 | value = DPAUX_DP_AUXCTL_CMD_AUX_RD; | 161 | value |= DPAUX_DP_AUXCTL_CMD_AUX_RD; |
144 | break; | 162 | break; |
145 | 163 | ||
146 | default: | 164 | default: |
147 | return -EINVAL; | 165 | return -EINVAL; |
148 | } | 166 | } |
149 | 167 | ||
150 | value |= DPAUX_DP_AUXCTL_CMDLEN(msg->size - 1); | 168 | tegra_dpaux_writel(dpaux, msg->address, DPAUX_DP_AUXADDR); |
151 | tegra_dpaux_writel(dpaux, value, DPAUX_DP_AUXCTL); | 169 | tegra_dpaux_writel(dpaux, value, DPAUX_DP_AUXCTL); |
152 | 170 | ||
153 | if ((msg->request & DP_AUX_I2C_READ) == 0) { | 171 | if ((msg->request & DP_AUX_I2C_READ) == 0) { |
@@ -198,7 +216,7 @@ static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux, | |||
198 | break; | 216 | break; |
199 | } | 217 | } |
200 | 218 | ||
201 | if (msg->reply == DP_AUX_NATIVE_REPLY_ACK) { | 219 | if ((msg->size > 0) && (msg->reply == DP_AUX_NATIVE_REPLY_ACK)) { |
202 | if (msg->request & DP_AUX_I2C_READ) { | 220 | if (msg->request & DP_AUX_I2C_READ) { |
203 | size_t count = value & DPAUX_DP_AUXSTAT_REPLY_MASK; | 221 | size_t count = value & DPAUX_DP_AUXSTAT_REPLY_MASK; |
204 | 222 | ||
diff --git a/drivers/gpu/drm/tegra/dpaux.h b/drivers/gpu/drm/tegra/dpaux.h index 4f5bf10fdff9..806e245ca787 100644 --- a/drivers/gpu/drm/tegra/dpaux.h +++ b/drivers/gpu/drm/tegra/dpaux.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define DPAUX_DP_AUXCTL_CMD_I2C_RQ (2 << 12) | 32 | #define DPAUX_DP_AUXCTL_CMD_I2C_RQ (2 << 12) |
33 | #define DPAUX_DP_AUXCTL_CMD_I2C_RD (1 << 12) | 33 | #define DPAUX_DP_AUXCTL_CMD_I2C_RD (1 << 12) |
34 | #define DPAUX_DP_AUXCTL_CMD_I2C_WR (0 << 12) | 34 | #define DPAUX_DP_AUXCTL_CMD_I2C_WR (0 << 12) |
35 | #define DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY (1 << 8) | ||
35 | #define DPAUX_DP_AUXCTL_CMDLEN(x) ((x) & 0xff) | 36 | #define DPAUX_DP_AUXCTL_CMDLEN(x) ((x) & 0xff) |
36 | 37 | ||
37 | #define DPAUX_DP_AUXSTAT 0x31 | 38 | #define DPAUX_DP_AUXSTAT 0x31 |
diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c index db9017adfe2b..498b37e39058 100644 --- a/drivers/gpu/host1x/hw/intr_hw.c +++ b/drivers/gpu/host1x/hw/intr_hw.c | |||
@@ -47,7 +47,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id) | |||
47 | unsigned long reg; | 47 | unsigned long reg; |
48 | int i, id; | 48 | int i, id; |
49 | 49 | ||
50 | for (i = 0; i <= BIT_WORD(host->info->nb_pts); i++) { | 50 | for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { |
51 | reg = host1x_sync_readl(host, | 51 | reg = host1x_sync_readl(host, |
52 | HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(i)); | 52 | HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(i)); |
53 | for_each_set_bit(id, ®, BITS_PER_LONG) { | 53 | for_each_set_bit(id, ®, BITS_PER_LONG) { |
@@ -64,7 +64,7 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) | |||
64 | { | 64 | { |
65 | u32 i; | 65 | u32 i; |
66 | 66 | ||
67 | for (i = 0; i <= BIT_WORD(host->info->nb_pts); ++i) { | 67 | for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { |
68 | host1x_sync_writel(host, 0xffffffffu, | 68 | host1x_sync_writel(host, 0xffffffffu, |
69 | HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(i)); | 69 | HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(i)); |
70 | host1x_sync_writel(host, 0xffffffffu, | 70 | host1x_sync_writel(host, 0xffffffffu, |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 9e8064205bc7..10a2c0866459 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -718,6 +718,9 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) | |||
718 | case HID_MAIN_ITEM_TAG_END_COLLECTION: | 718 | case HID_MAIN_ITEM_TAG_END_COLLECTION: |
719 | break; | 719 | break; |
720 | case HID_MAIN_ITEM_TAG_INPUT: | 720 | case HID_MAIN_ITEM_TAG_INPUT: |
721 | /* ignore constant inputs, they will be ignored by hid-input */ | ||
722 | if (data & HID_MAIN_ITEM_CONSTANT) | ||
723 | break; | ||
721 | for (i = 0; i < parser->local.usage_index; i++) | 724 | for (i = 0; i < parser->local.usage_index; i++) |
722 | hid_scan_input_usage(parser, parser->local.usage[i]); | 725 | hid_scan_input_usage(parser, parser->local.usage[i]); |
723 | break; | 726 | break; |
@@ -1821,8 +1824,6 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1821 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1824 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1822 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | 1825 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
1823 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | 1826 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
1824 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2) }, | ||
1825 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2) }, | ||
1826 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, | 1827 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, |
1827 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | 1828 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
1828 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, | 1829 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index bd221263c739..c8af7202c28d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -455,7 +455,8 @@ | |||
455 | 455 | ||
456 | #define USB_VENDOR_ID_INTEL_0 0x8086 | 456 | #define USB_VENDOR_ID_INTEL_0 0x8086 |
457 | #define USB_VENDOR_ID_INTEL_1 0x8087 | 457 | #define USB_VENDOR_ID_INTEL_1 0x8087 |
458 | #define USB_DEVICE_ID_INTEL_HID_SENSOR 0x09fa | 458 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_0 0x09fa |
459 | #define USB_DEVICE_ID_INTEL_HID_SENSOR_1 0x0a04 | ||
459 | 460 | ||
460 | #define USB_VENDOR_ID_STM_0 0x0483 | 461 | #define USB_VENDOR_ID_STM_0 0x0483 |
461 | #define USB_DEVICE_ID_STM_HID_SENSOR 0x91d1 | 462 | #define USB_DEVICE_ID_STM_HID_SENSOR 0x91d1 |
@@ -629,8 +630,6 @@ | |||
629 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | 630 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 |
630 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 | 631 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 |
631 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c | 632 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c |
632 | #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 | ||
633 | #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 | ||
634 | 633 | ||
635 | #define USB_VENDOR_ID_MOJO 0x8282 | 634 | #define USB_VENDOR_ID_MOJO 0x8282 |
636 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 | 635 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 |
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 6fd58175a291..8ba17a946f2a 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -274,10 +274,6 @@ static const struct hid_device_id ms_devices[] = { | |||
274 | .driver_data = MS_NOGET }, | 274 | .driver_data = MS_NOGET }, |
275 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), | 275 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), |
276 | .driver_data = MS_DUPLICATE_USAGES }, | 276 | .driver_data = MS_DUPLICATE_USAGES }, |
277 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), | ||
278 | .driver_data = 0 }, | ||
279 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), | ||
280 | .driver_data = 0 }, | ||
281 | 277 | ||
282 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), | 278 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), |
283 | .driver_data = MS_PRESENTER }, | 279 | .driver_data = MS_PRESENTER }, |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 5182031f7b52..af8244b1c1f4 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -697,10 +697,13 @@ static void sensor_hub_remove(struct hid_device *hdev) | |||
697 | 697 | ||
698 | static const struct hid_device_id sensor_hub_devices[] = { | 698 | static const struct hid_device_id sensor_hub_devices[] = { |
699 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_0, | 699 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_0, |
700 | USB_DEVICE_ID_INTEL_HID_SENSOR), | 700 | USB_DEVICE_ID_INTEL_HID_SENSOR_0), |
701 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, | 701 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, |
702 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, | 702 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, |
703 | USB_DEVICE_ID_INTEL_HID_SENSOR), | 703 | USB_DEVICE_ID_INTEL_HID_SENSOR_0), |
704 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, | ||
705 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, | ||
706 | USB_DEVICE_ID_INTEL_HID_SENSOR_1), | ||
704 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, | 707 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, |
705 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_STM_0, | 708 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_STM_0, |
706 | USB_DEVICE_ID_STM_HID_SENSOR), | 709 | USB_DEVICE_ID_STM_HID_SENSOR), |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 69204afea7a4..908de2789219 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -1721,8 +1721,6 @@ static void sony_remove(struct hid_device *hdev) | |||
1721 | if (sc->quirks & SONY_LED_SUPPORT) | 1721 | if (sc->quirks & SONY_LED_SUPPORT) |
1722 | sony_leds_remove(hdev); | 1722 | sony_leds_remove(hdev); |
1723 | 1723 | ||
1724 | if (sc->worker_initialized) | ||
1725 | cancel_work_sync(&sc->state_worker); | ||
1726 | if (sc->quirks & SONY_BATTERY_SUPPORT) { | 1724 | if (sc->quirks & SONY_BATTERY_SUPPORT) { |
1727 | hid_hw_close(hdev); | 1725 | hid_hw_close(hdev); |
1728 | sony_battery_remove(sc); | 1726 | sony_battery_remove(sc); |
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index f2d7bf90c9fe..2e7801af466e 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c | |||
@@ -55,6 +55,9 @@ static __u32 vmbus_get_next_version(__u32 current_version) | |||
55 | case (VERSION_WIN8): | 55 | case (VERSION_WIN8): |
56 | return VERSION_WIN7; | 56 | return VERSION_WIN7; |
57 | 57 | ||
58 | case (VERSION_WIN8_1): | ||
59 | return VERSION_WIN8; | ||
60 | |||
58 | case (VERSION_WS2008): | 61 | case (VERSION_WS2008): |
59 | default: | 62 | default: |
60 | return VERSION_INVAL; | 63 | return VERSION_INVAL; |
@@ -77,7 +80,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, | |||
77 | msg->interrupt_page = virt_to_phys(vmbus_connection.int_page); | 80 | msg->interrupt_page = virt_to_phys(vmbus_connection.int_page); |
78 | msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]); | 81 | msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]); |
79 | msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]); | 82 | msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]); |
80 | if (version == VERSION_WIN8) | 83 | if (version == VERSION_WIN8_1) |
81 | msg->target_vcpu = hv_context.vp_index[smp_processor_id()]; | 84 | msg->target_vcpu = hv_context.vp_index[smp_processor_id()]; |
82 | 85 | ||
83 | /* | 86 | /* |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 02436d5d0dab..185452abf32c 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -173,12 +173,15 @@ static void start_ep_timer(struct c4iw_ep *ep) | |||
173 | add_timer(&ep->timer); | 173 | add_timer(&ep->timer); |
174 | } | 174 | } |
175 | 175 | ||
176 | static void stop_ep_timer(struct c4iw_ep *ep) | 176 | static int stop_ep_timer(struct c4iw_ep *ep) |
177 | { | 177 | { |
178 | PDBG("%s ep %p stopping\n", __func__, ep); | 178 | PDBG("%s ep %p stopping\n", __func__, ep); |
179 | del_timer_sync(&ep->timer); | 179 | del_timer_sync(&ep->timer); |
180 | if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) | 180 | if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { |
181 | c4iw_put_ep(&ep->com); | 181 | c4iw_put_ep(&ep->com); |
182 | return 0; | ||
183 | } | ||
184 | return 1; | ||
182 | } | 185 | } |
183 | 186 | ||
184 | static int c4iw_l2t_send(struct c4iw_rdev *rdev, struct sk_buff *skb, | 187 | static int c4iw_l2t_send(struct c4iw_rdev *rdev, struct sk_buff *skb, |
@@ -1165,12 +1168,11 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1165 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1168 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
1166 | 1169 | ||
1167 | /* | 1170 | /* |
1168 | * Stop mpa timer. If it expired, then the state has | 1171 | * Stop mpa timer. If it expired, then |
1169 | * changed and we bail since ep_timeout already aborted | 1172 | * we ignore the MPA reply. process_timeout() |
1170 | * the connection. | 1173 | * will abort the connection. |
1171 | */ | 1174 | */ |
1172 | stop_ep_timer(ep); | 1175 | if (stop_ep_timer(ep)) |
1173 | if (ep->com.state != MPA_REQ_SENT) | ||
1174 | return; | 1176 | return; |
1175 | 1177 | ||
1176 | /* | 1178 | /* |
@@ -1375,15 +1377,12 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1375 | 1377 | ||
1376 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1378 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
1377 | 1379 | ||
1378 | if (ep->com.state != MPA_REQ_WAIT) | ||
1379 | return; | ||
1380 | |||
1381 | /* | 1380 | /* |
1382 | * If we get more than the supported amount of private data | 1381 | * If we get more than the supported amount of private data |
1383 | * then we must fail this connection. | 1382 | * then we must fail this connection. |
1384 | */ | 1383 | */ |
1385 | if (ep->mpa_pkt_len + skb->len > sizeof(ep->mpa_pkt)) { | 1384 | if (ep->mpa_pkt_len + skb->len > sizeof(ep->mpa_pkt)) { |
1386 | stop_ep_timer(ep); | 1385 | (void)stop_ep_timer(ep); |
1387 | abort_connection(ep, skb, GFP_KERNEL); | 1386 | abort_connection(ep, skb, GFP_KERNEL); |
1388 | return; | 1387 | return; |
1389 | } | 1388 | } |
@@ -1413,13 +1412,13 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1413 | if (mpa->revision > mpa_rev) { | 1412 | if (mpa->revision > mpa_rev) { |
1414 | printk(KERN_ERR MOD "%s MPA version mismatch. Local = %d," | 1413 | printk(KERN_ERR MOD "%s MPA version mismatch. Local = %d," |
1415 | " Received = %d\n", __func__, mpa_rev, mpa->revision); | 1414 | " Received = %d\n", __func__, mpa_rev, mpa->revision); |
1416 | stop_ep_timer(ep); | 1415 | (void)stop_ep_timer(ep); |
1417 | abort_connection(ep, skb, GFP_KERNEL); | 1416 | abort_connection(ep, skb, GFP_KERNEL); |
1418 | return; | 1417 | return; |
1419 | } | 1418 | } |
1420 | 1419 | ||
1421 | if (memcmp(mpa->key, MPA_KEY_REQ, sizeof(mpa->key))) { | 1420 | if (memcmp(mpa->key, MPA_KEY_REQ, sizeof(mpa->key))) { |
1422 | stop_ep_timer(ep); | 1421 | (void)stop_ep_timer(ep); |
1423 | abort_connection(ep, skb, GFP_KERNEL); | 1422 | abort_connection(ep, skb, GFP_KERNEL); |
1424 | return; | 1423 | return; |
1425 | } | 1424 | } |
@@ -1430,7 +1429,7 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1430 | * Fail if there's too much private data. | 1429 | * Fail if there's too much private data. |
1431 | */ | 1430 | */ |
1432 | if (plen > MPA_MAX_PRIVATE_DATA) { | 1431 | if (plen > MPA_MAX_PRIVATE_DATA) { |
1433 | stop_ep_timer(ep); | 1432 | (void)stop_ep_timer(ep); |
1434 | abort_connection(ep, skb, GFP_KERNEL); | 1433 | abort_connection(ep, skb, GFP_KERNEL); |
1435 | return; | 1434 | return; |
1436 | } | 1435 | } |
@@ -1439,7 +1438,7 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1439 | * If plen does not account for pkt size | 1438 | * If plen does not account for pkt size |
1440 | */ | 1439 | */ |
1441 | if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) { | 1440 | if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) { |
1442 | stop_ep_timer(ep); | 1441 | (void)stop_ep_timer(ep); |
1443 | abort_connection(ep, skb, GFP_KERNEL); | 1442 | abort_connection(ep, skb, GFP_KERNEL); |
1444 | return; | 1443 | return; |
1445 | } | 1444 | } |
@@ -1496,18 +1495,24 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1496 | ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version, | 1495 | ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version, |
1497 | ep->mpa_attr.p2p_type); | 1496 | ep->mpa_attr.p2p_type); |
1498 | 1497 | ||
1499 | __state_set(&ep->com, MPA_REQ_RCVD); | 1498 | /* |
1500 | stop_ep_timer(ep); | 1499 | * If the endpoint timer already expired, then we ignore |
1501 | 1500 | * the start request. process_timeout() will abort | |
1502 | /* drive upcall */ | 1501 | * the connection. |
1503 | mutex_lock(&ep->parent_ep->com.mutex); | 1502 | */ |
1504 | if (ep->parent_ep->com.state != DEAD) { | 1503 | if (!stop_ep_timer(ep)) { |
1505 | if (connect_request_upcall(ep)) | 1504 | __state_set(&ep->com, MPA_REQ_RCVD); |
1505 | |||
1506 | /* drive upcall */ | ||
1507 | mutex_lock(&ep->parent_ep->com.mutex); | ||
1508 | if (ep->parent_ep->com.state != DEAD) { | ||
1509 | if (connect_request_upcall(ep)) | ||
1510 | abort_connection(ep, skb, GFP_KERNEL); | ||
1511 | } else { | ||
1506 | abort_connection(ep, skb, GFP_KERNEL); | 1512 | abort_connection(ep, skb, GFP_KERNEL); |
1507 | } else { | 1513 | } |
1508 | abort_connection(ep, skb, GFP_KERNEL); | 1514 | mutex_unlock(&ep->parent_ep->com.mutex); |
1509 | } | 1515 | } |
1510 | mutex_unlock(&ep->parent_ep->com.mutex); | ||
1511 | return; | 1516 | return; |
1512 | } | 1517 | } |
1513 | 1518 | ||
@@ -2265,7 +2270,7 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2265 | disconnect = 0; | 2270 | disconnect = 0; |
2266 | break; | 2271 | break; |
2267 | case MORIBUND: | 2272 | case MORIBUND: |
2268 | stop_ep_timer(ep); | 2273 | (void)stop_ep_timer(ep); |
2269 | if (ep->com.cm_id && ep->com.qp) { | 2274 | if (ep->com.cm_id && ep->com.qp) { |
2270 | attrs.next_state = C4IW_QP_STATE_IDLE; | 2275 | attrs.next_state = C4IW_QP_STATE_IDLE; |
2271 | c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 2276 | c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
@@ -2325,10 +2330,10 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2325 | case CONNECTING: | 2330 | case CONNECTING: |
2326 | break; | 2331 | break; |
2327 | case MPA_REQ_WAIT: | 2332 | case MPA_REQ_WAIT: |
2328 | stop_ep_timer(ep); | 2333 | (void)stop_ep_timer(ep); |
2329 | break; | 2334 | break; |
2330 | case MPA_REQ_SENT: | 2335 | case MPA_REQ_SENT: |
2331 | stop_ep_timer(ep); | 2336 | (void)stop_ep_timer(ep); |
2332 | if (mpa_rev == 1 || (mpa_rev == 2 && ep->tried_with_mpa_v1)) | 2337 | if (mpa_rev == 1 || (mpa_rev == 2 && ep->tried_with_mpa_v1)) |
2333 | connect_reply_upcall(ep, -ECONNRESET); | 2338 | connect_reply_upcall(ep, -ECONNRESET); |
2334 | else { | 2339 | else { |
@@ -2433,7 +2438,7 @@ static int close_con_rpl(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2433 | __state_set(&ep->com, MORIBUND); | 2438 | __state_set(&ep->com, MORIBUND); |
2434 | break; | 2439 | break; |
2435 | case MORIBUND: | 2440 | case MORIBUND: |
2436 | stop_ep_timer(ep); | 2441 | (void)stop_ep_timer(ep); |
2437 | if ((ep->com.cm_id) && (ep->com.qp)) { | 2442 | if ((ep->com.cm_id) && (ep->com.qp)) { |
2438 | attrs.next_state = C4IW_QP_STATE_IDLE; | 2443 | attrs.next_state = C4IW_QP_STATE_IDLE; |
2439 | c4iw_modify_qp(ep->com.qp->rhp, | 2444 | c4iw_modify_qp(ep->com.qp->rhp, |
@@ -3028,7 +3033,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) | |||
3028 | if (!test_and_set_bit(CLOSE_SENT, &ep->com.flags)) { | 3033 | if (!test_and_set_bit(CLOSE_SENT, &ep->com.flags)) { |
3029 | close = 1; | 3034 | close = 1; |
3030 | if (abrupt) { | 3035 | if (abrupt) { |
3031 | stop_ep_timer(ep); | 3036 | (void)stop_ep_timer(ep); |
3032 | ep->com.state = ABORTING; | 3037 | ep->com.state = ABORTING; |
3033 | } else | 3038 | } else |
3034 | ep->com.state = MORIBUND; | 3039 | ep->com.state = MORIBUND; |
@@ -3462,6 +3467,16 @@ static void process_timeout(struct c4iw_ep *ep) | |||
3462 | __state_set(&ep->com, ABORTING); | 3467 | __state_set(&ep->com, ABORTING); |
3463 | close_complete_upcall(ep, -ETIMEDOUT); | 3468 | close_complete_upcall(ep, -ETIMEDOUT); |
3464 | break; | 3469 | break; |
3470 | case ABORTING: | ||
3471 | case DEAD: | ||
3472 | |||
3473 | /* | ||
3474 | * These states are expected if the ep timed out at the same | ||
3475 | * time as another thread was calling stop_ep_timer(). | ||
3476 | * So we silently do nothing for these states. | ||
3477 | */ | ||
3478 | abort = 0; | ||
3479 | break; | ||
3465 | default: | 3480 | default: |
3466 | WARN(1, "%s unexpected state ep %p tid %u state %u\n", | 3481 | WARN(1, "%s unexpected state ep %p tid %u state %u\n", |
3467 | __func__, ep, ep->hwtid, ep->com.state); | 3482 | __func__, ep, ep->hwtid, ep->com.state); |
@@ -3483,6 +3498,8 @@ static void process_timedout_eps(void) | |||
3483 | 3498 | ||
3484 | tmp = timeout_list.next; | 3499 | tmp = timeout_list.next; |
3485 | list_del(tmp); | 3500 | list_del(tmp); |
3501 | tmp->next = NULL; | ||
3502 | tmp->prev = NULL; | ||
3486 | spin_unlock_irq(&timeout_lock); | 3503 | spin_unlock_irq(&timeout_lock); |
3487 | ep = list_entry(tmp, struct c4iw_ep, entry); | 3504 | ep = list_entry(tmp, struct c4iw_ep, entry); |
3488 | process_timeout(ep); | 3505 | process_timeout(ep); |
@@ -3499,6 +3516,7 @@ static void process_work(struct work_struct *work) | |||
3499 | unsigned int opcode; | 3516 | unsigned int opcode; |
3500 | int ret; | 3517 | int ret; |
3501 | 3518 | ||
3519 | process_timedout_eps(); | ||
3502 | while ((skb = skb_dequeue(&rxq))) { | 3520 | while ((skb = skb_dequeue(&rxq))) { |
3503 | rpl = cplhdr(skb); | 3521 | rpl = cplhdr(skb); |
3504 | dev = *((struct c4iw_dev **) (skb->cb + sizeof(void *))); | 3522 | dev = *((struct c4iw_dev **) (skb->cb + sizeof(void *))); |
@@ -3508,8 +3526,8 @@ static void process_work(struct work_struct *work) | |||
3508 | ret = work_handlers[opcode](dev, skb); | 3526 | ret = work_handlers[opcode](dev, skb); |
3509 | if (!ret) | 3527 | if (!ret) |
3510 | kfree_skb(skb); | 3528 | kfree_skb(skb); |
3529 | process_timedout_eps(); | ||
3511 | } | 3530 | } |
3512 | process_timedout_eps(); | ||
3513 | } | 3531 | } |
3514 | 3532 | ||
3515 | static DECLARE_WORK(skb_work, process_work); | 3533 | static DECLARE_WORK(skb_work, process_work); |
@@ -3521,8 +3539,13 @@ static void ep_timeout(unsigned long arg) | |||
3521 | 3539 | ||
3522 | spin_lock(&timeout_lock); | 3540 | spin_lock(&timeout_lock); |
3523 | if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { | 3541 | if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { |
3524 | list_add_tail(&ep->entry, &timeout_list); | 3542 | /* |
3525 | kickit = 1; | 3543 | * Only insert if it is not already on the list. |
3544 | */ | ||
3545 | if (!ep->entry.next) { | ||
3546 | list_add_tail(&ep->entry, &timeout_list); | ||
3547 | kickit = 1; | ||
3548 | } | ||
3526 | } | 3549 | } |
3527 | spin_unlock(&timeout_lock); | 3550 | spin_unlock(&timeout_lock); |
3528 | if (kickit) | 3551 | if (kickit) |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index ce468e542428..cfaa56ada189 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
@@ -235,27 +235,21 @@ int c4iw_flush_sq(struct c4iw_qp *qhp) | |||
235 | struct t4_cq *cq = &chp->cq; | 235 | struct t4_cq *cq = &chp->cq; |
236 | int idx; | 236 | int idx; |
237 | struct t4_swsqe *swsqe; | 237 | struct t4_swsqe *swsqe; |
238 | int error = (qhp->attr.state != C4IW_QP_STATE_CLOSING && | ||
239 | qhp->attr.state != C4IW_QP_STATE_IDLE); | ||
240 | 238 | ||
241 | if (wq->sq.flush_cidx == -1) | 239 | if (wq->sq.flush_cidx == -1) |
242 | wq->sq.flush_cidx = wq->sq.cidx; | 240 | wq->sq.flush_cidx = wq->sq.cidx; |
243 | idx = wq->sq.flush_cidx; | 241 | idx = wq->sq.flush_cidx; |
244 | BUG_ON(idx >= wq->sq.size); | 242 | BUG_ON(idx >= wq->sq.size); |
245 | while (idx != wq->sq.pidx) { | 243 | while (idx != wq->sq.pidx) { |
246 | if (error) { | 244 | swsqe = &wq->sq.sw_sq[idx]; |
247 | swsqe = &wq->sq.sw_sq[idx]; | 245 | BUG_ON(swsqe->flushed); |
248 | BUG_ON(swsqe->flushed); | 246 | swsqe->flushed = 1; |
249 | swsqe->flushed = 1; | 247 | insert_sq_cqe(wq, cq, swsqe); |
250 | insert_sq_cqe(wq, cq, swsqe); | 248 | if (wq->sq.oldest_read == swsqe) { |
251 | if (wq->sq.oldest_read == swsqe) { | 249 | BUG_ON(swsqe->opcode != FW_RI_READ_REQ); |
252 | BUG_ON(swsqe->opcode != FW_RI_READ_REQ); | 250 | advance_oldest_read(wq); |
253 | advance_oldest_read(wq); | ||
254 | } | ||
255 | flushed++; | ||
256 | } else { | ||
257 | t4_sq_consume(wq); | ||
258 | } | 251 | } |
252 | flushed++; | ||
259 | if (++idx == wq->sq.size) | 253 | if (++idx == wq->sq.size) |
260 | idx = 0; | 254 | idx = 0; |
261 | } | 255 | } |
@@ -678,7 +672,7 @@ skip_cqe: | |||
678 | static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) | 672 | static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) |
679 | { | 673 | { |
680 | struct c4iw_qp *qhp = NULL; | 674 | struct c4iw_qp *qhp = NULL; |
681 | struct t4_cqe cqe = {0, 0}, *rd_cqe; | 675 | struct t4_cqe uninitialized_var(cqe), *rd_cqe; |
682 | struct t4_wq *wq; | 676 | struct t4_wq *wq; |
683 | u32 credit = 0; | 677 | u32 credit = 0; |
684 | u8 cqe_flushed; | 678 | u8 cqe_flushed; |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 9489a388376c..f4fa50a609e2 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
@@ -682,7 +682,10 @@ static void c4iw_dealloc(struct uld_ctx *ctx) | |||
682 | idr_destroy(&ctx->dev->hwtid_idr); | 682 | idr_destroy(&ctx->dev->hwtid_idr); |
683 | idr_destroy(&ctx->dev->stid_idr); | 683 | idr_destroy(&ctx->dev->stid_idr); |
684 | idr_destroy(&ctx->dev->atid_idr); | 684 | idr_destroy(&ctx->dev->atid_idr); |
685 | iounmap(ctx->dev->rdev.oc_mw_kva); | 685 | if (ctx->dev->rdev.bar2_kva) |
686 | iounmap(ctx->dev->rdev.bar2_kva); | ||
687 | if (ctx->dev->rdev.oc_mw_kva) | ||
688 | iounmap(ctx->dev->rdev.oc_mw_kva); | ||
686 | ib_dealloc_device(&ctx->dev->ibdev); | 689 | ib_dealloc_device(&ctx->dev->ibdev); |
687 | ctx->dev = NULL; | 690 | ctx->dev = NULL; |
688 | } | 691 | } |
@@ -722,11 +725,31 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
722 | } | 725 | } |
723 | devp->rdev.lldi = *infop; | 726 | devp->rdev.lldi = *infop; |
724 | 727 | ||
725 | devp->rdev.oc_mw_pa = pci_resource_start(devp->rdev.lldi.pdev, 2) + | 728 | /* |
726 | (pci_resource_len(devp->rdev.lldi.pdev, 2) - | 729 | * For T5 devices, we map all of BAR2 with WC. |
727 | roundup_pow_of_two(devp->rdev.lldi.vr->ocq.size)); | 730 | * For T4 devices with onchip qp mem, we map only that part |
728 | devp->rdev.oc_mw_kva = ioremap_wc(devp->rdev.oc_mw_pa, | 731 | * of BAR2 with WC. |
729 | devp->rdev.lldi.vr->ocq.size); | 732 | */ |
733 | devp->rdev.bar2_pa = pci_resource_start(devp->rdev.lldi.pdev, 2); | ||
734 | if (is_t5(devp->rdev.lldi.adapter_type)) { | ||
735 | devp->rdev.bar2_kva = ioremap_wc(devp->rdev.bar2_pa, | ||
736 | pci_resource_len(devp->rdev.lldi.pdev, 2)); | ||
737 | if (!devp->rdev.bar2_kva) { | ||
738 | pr_err(MOD "Unable to ioremap BAR2\n"); | ||
739 | return ERR_PTR(-EINVAL); | ||
740 | } | ||
741 | } else if (ocqp_supported(infop)) { | ||
742 | devp->rdev.oc_mw_pa = | ||
743 | pci_resource_start(devp->rdev.lldi.pdev, 2) + | ||
744 | pci_resource_len(devp->rdev.lldi.pdev, 2) - | ||
745 | roundup_pow_of_two(devp->rdev.lldi.vr->ocq.size); | ||
746 | devp->rdev.oc_mw_kva = ioremap_wc(devp->rdev.oc_mw_pa, | ||
747 | devp->rdev.lldi.vr->ocq.size); | ||
748 | if (!devp->rdev.oc_mw_kva) { | ||
749 | pr_err(MOD "Unable to ioremap onchip mem\n"); | ||
750 | return ERR_PTR(-EINVAL); | ||
751 | } | ||
752 | } | ||
730 | 753 | ||
731 | PDBG(KERN_INFO MOD "ocq memory: " | 754 | PDBG(KERN_INFO MOD "ocq memory: " |
732 | "hw_start 0x%x size %u mw_pa 0x%lx mw_kva %p\n", | 755 | "hw_start 0x%x size %u mw_pa 0x%lx mw_kva %p\n", |
@@ -1003,9 +1026,11 @@ static int enable_qp_db(int id, void *p, void *data) | |||
1003 | static void resume_rc_qp(struct c4iw_qp *qp) | 1026 | static void resume_rc_qp(struct c4iw_qp *qp) |
1004 | { | 1027 | { |
1005 | spin_lock(&qp->lock); | 1028 | spin_lock(&qp->lock); |
1006 | t4_ring_sq_db(&qp->wq, qp->wq.sq.wq_pidx_inc); | 1029 | t4_ring_sq_db(&qp->wq, qp->wq.sq.wq_pidx_inc, |
1030 | is_t5(qp->rhp->rdev.lldi.adapter_type), NULL); | ||
1007 | qp->wq.sq.wq_pidx_inc = 0; | 1031 | qp->wq.sq.wq_pidx_inc = 0; |
1008 | t4_ring_rq_db(&qp->wq, qp->wq.rq.wq_pidx_inc); | 1032 | t4_ring_rq_db(&qp->wq, qp->wq.rq.wq_pidx_inc, |
1033 | is_t5(qp->rhp->rdev.lldi.adapter_type), NULL); | ||
1009 | qp->wq.rq.wq_pidx_inc = 0; | 1034 | qp->wq.rq.wq_pidx_inc = 0; |
1010 | spin_unlock(&qp->lock); | 1035 | spin_unlock(&qp->lock); |
1011 | } | 1036 | } |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index e872203c5424..7b8c5806a09d 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -149,6 +149,8 @@ struct c4iw_rdev { | |||
149 | struct gen_pool *ocqp_pool; | 149 | struct gen_pool *ocqp_pool; |
150 | u32 flags; | 150 | u32 flags; |
151 | struct cxgb4_lld_info lldi; | 151 | struct cxgb4_lld_info lldi; |
152 | unsigned long bar2_pa; | ||
153 | void __iomem *bar2_kva; | ||
152 | unsigned long oc_mw_pa; | 154 | unsigned long oc_mw_pa; |
153 | void __iomem *oc_mw_kva; | 155 | void __iomem *oc_mw_kva; |
154 | struct c4iw_stats stats; | 156 | struct c4iw_stats stats; |
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index f9ca072a99ed..ec7a2988a703 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -259,8 +259,12 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, | |||
259 | 259 | ||
260 | if ((!reset_tpt_entry) && (*stag == T4_STAG_UNSET)) { | 260 | if ((!reset_tpt_entry) && (*stag == T4_STAG_UNSET)) { |
261 | stag_idx = c4iw_get_resource(&rdev->resource.tpt_table); | 261 | stag_idx = c4iw_get_resource(&rdev->resource.tpt_table); |
262 | if (!stag_idx) | 262 | if (!stag_idx) { |
263 | mutex_lock(&rdev->stats.lock); | ||
264 | rdev->stats.stag.fail++; | ||
265 | mutex_unlock(&rdev->stats.lock); | ||
263 | return -ENOMEM; | 266 | return -ENOMEM; |
267 | } | ||
264 | mutex_lock(&rdev->stats.lock); | 268 | mutex_lock(&rdev->stats.lock); |
265 | rdev->stats.stag.cur += 32; | 269 | rdev->stats.stag.cur += 32; |
266 | if (rdev->stats.stag.cur > rdev->stats.stag.max) | 270 | if (rdev->stats.stag.cur > rdev->stats.stag.max) |
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 79429256023a..a94a3e12c349 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c | |||
@@ -328,7 +328,7 @@ static int c4iw_query_device(struct ib_device *ibdev, | |||
328 | props->max_mr = c4iw_num_stags(&dev->rdev); | 328 | props->max_mr = c4iw_num_stags(&dev->rdev); |
329 | props->max_pd = T4_MAX_NUM_PD; | 329 | props->max_pd = T4_MAX_NUM_PD; |
330 | props->local_ca_ack_delay = 0; | 330 | props->local_ca_ack_delay = 0; |
331 | props->max_fast_reg_page_list_len = T4_MAX_FR_DEPTH; | 331 | props->max_fast_reg_page_list_len = t4_max_fr_depth(use_dsgl); |
332 | 332 | ||
333 | return 0; | 333 | return 0; |
334 | } | 334 | } |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index cb76eb5eee1f..7b5114cb486f 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -212,13 +212,23 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
212 | 212 | ||
213 | wq->db = rdev->lldi.db_reg; | 213 | wq->db = rdev->lldi.db_reg; |
214 | wq->gts = rdev->lldi.gts_reg; | 214 | wq->gts = rdev->lldi.gts_reg; |
215 | if (user) { | 215 | if (user || is_t5(rdev->lldi.adapter_type)) { |
216 | wq->sq.udb = (u64)pci_resource_start(rdev->lldi.pdev, 2) + | 216 | u32 off; |
217 | (wq->sq.qid << rdev->qpshift); | 217 | |
218 | wq->sq.udb &= PAGE_MASK; | 218 | off = (wq->sq.qid << rdev->qpshift) & PAGE_MASK; |
219 | wq->rq.udb = (u64)pci_resource_start(rdev->lldi.pdev, 2) + | 219 | if (user) { |
220 | (wq->rq.qid << rdev->qpshift); | 220 | wq->sq.udb = (u64 __iomem *)(rdev->bar2_pa + off); |
221 | wq->rq.udb &= PAGE_MASK; | 221 | } else { |
222 | off += 128 * (wq->sq.qid & rdev->qpmask) + 8; | ||
223 | wq->sq.udb = (u64 __iomem *)(rdev->bar2_kva + off); | ||
224 | } | ||
225 | off = (wq->rq.qid << rdev->qpshift) & PAGE_MASK; | ||
226 | if (user) { | ||
227 | wq->rq.udb = (u64 __iomem *)(rdev->bar2_pa + off); | ||
228 | } else { | ||
229 | off += 128 * (wq->rq.qid & rdev->qpmask) + 8; | ||
230 | wq->rq.udb = (u64 __iomem *)(rdev->bar2_kva + off); | ||
231 | } | ||
222 | } | 232 | } |
223 | wq->rdev = rdev; | 233 | wq->rdev = rdev; |
224 | wq->rq.msn = 1; | 234 | wq->rq.msn = 1; |
@@ -299,9 +309,10 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, | |||
299 | if (ret) | 309 | if (ret) |
300 | goto free_dma; | 310 | goto free_dma; |
301 | 311 | ||
302 | PDBG("%s sqid 0x%x rqid 0x%x kdb 0x%p squdb 0x%llx rqudb 0x%llx\n", | 312 | PDBG("%s sqid 0x%x rqid 0x%x kdb 0x%p squdb 0x%lx rqudb 0x%lx\n", |
303 | __func__, wq->sq.qid, wq->rq.qid, wq->db, | 313 | __func__, wq->sq.qid, wq->rq.qid, wq->db, |
304 | (unsigned long long)wq->sq.udb, (unsigned long long)wq->rq.udb); | 314 | (__force unsigned long) wq->sq.udb, |
315 | (__force unsigned long) wq->rq.udb); | ||
305 | 316 | ||
306 | return 0; | 317 | return 0; |
307 | free_dma: | 318 | free_dma: |
@@ -425,6 +436,8 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, | |||
425 | default: | 436 | default: |
426 | return -EINVAL; | 437 | return -EINVAL; |
427 | } | 438 | } |
439 | wqe->send.r3 = 0; | ||
440 | wqe->send.r4 = 0; | ||
428 | 441 | ||
429 | plen = 0; | 442 | plen = 0; |
430 | if (wr->num_sge) { | 443 | if (wr->num_sge) { |
@@ -555,7 +568,8 @@ static int build_fastreg(struct t4_sq *sq, union t4_wr *wqe, | |||
555 | int pbllen = roundup(wr->wr.fast_reg.page_list_len * sizeof(u64), 32); | 568 | int pbllen = roundup(wr->wr.fast_reg.page_list_len * sizeof(u64), 32); |
556 | int rem; | 569 | int rem; |
557 | 570 | ||
558 | if (wr->wr.fast_reg.page_list_len > T4_MAX_FR_DEPTH) | 571 | if (wr->wr.fast_reg.page_list_len > |
572 | t4_max_fr_depth(use_dsgl)) | ||
559 | return -EINVAL; | 573 | return -EINVAL; |
560 | 574 | ||
561 | wqe->fr.qpbinde_to_dcacpu = 0; | 575 | wqe->fr.qpbinde_to_dcacpu = 0; |
@@ -650,9 +664,10 @@ static int ring_kernel_sq_db(struct c4iw_qp *qhp, u16 inc) | |||
650 | 664 | ||
651 | spin_lock_irqsave(&qhp->rhp->lock, flags); | 665 | spin_lock_irqsave(&qhp->rhp->lock, flags); |
652 | spin_lock(&qhp->lock); | 666 | spin_lock(&qhp->lock); |
653 | if (qhp->rhp->db_state == NORMAL) { | 667 | if (qhp->rhp->db_state == NORMAL) |
654 | t4_ring_sq_db(&qhp->wq, inc); | 668 | t4_ring_sq_db(&qhp->wq, inc, |
655 | } else { | 669 | is_t5(qhp->rhp->rdev.lldi.adapter_type), NULL); |
670 | else { | ||
656 | add_to_fc_list(&qhp->rhp->db_fc_list, &qhp->db_fc_entry); | 671 | add_to_fc_list(&qhp->rhp->db_fc_list, &qhp->db_fc_entry); |
657 | qhp->wq.sq.wq_pidx_inc += inc; | 672 | qhp->wq.sq.wq_pidx_inc += inc; |
658 | } | 673 | } |
@@ -667,9 +682,10 @@ static int ring_kernel_rq_db(struct c4iw_qp *qhp, u16 inc) | |||
667 | 682 | ||
668 | spin_lock_irqsave(&qhp->rhp->lock, flags); | 683 | spin_lock_irqsave(&qhp->rhp->lock, flags); |
669 | spin_lock(&qhp->lock); | 684 | spin_lock(&qhp->lock); |
670 | if (qhp->rhp->db_state == NORMAL) { | 685 | if (qhp->rhp->db_state == NORMAL) |
671 | t4_ring_rq_db(&qhp->wq, inc); | 686 | t4_ring_rq_db(&qhp->wq, inc, |
672 | } else { | 687 | is_t5(qhp->rhp->rdev.lldi.adapter_type), NULL); |
688 | else { | ||
673 | add_to_fc_list(&qhp->rhp->db_fc_list, &qhp->db_fc_entry); | 689 | add_to_fc_list(&qhp->rhp->db_fc_list, &qhp->db_fc_entry); |
674 | qhp->wq.rq.wq_pidx_inc += inc; | 690 | qhp->wq.rq.wq_pidx_inc += inc; |
675 | } | 691 | } |
@@ -686,7 +702,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
686 | enum fw_wr_opcodes fw_opcode = 0; | 702 | enum fw_wr_opcodes fw_opcode = 0; |
687 | enum fw_ri_wr_flags fw_flags; | 703 | enum fw_ri_wr_flags fw_flags; |
688 | struct c4iw_qp *qhp; | 704 | struct c4iw_qp *qhp; |
689 | union t4_wr *wqe; | 705 | union t4_wr *wqe = NULL; |
690 | u32 num_wrs; | 706 | u32 num_wrs; |
691 | struct t4_swsqe *swsqe; | 707 | struct t4_swsqe *swsqe; |
692 | unsigned long flag; | 708 | unsigned long flag; |
@@ -792,7 +808,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
792 | idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE); | 808 | idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE); |
793 | } | 809 | } |
794 | if (!qhp->rhp->rdev.status_page->db_off) { | 810 | if (!qhp->rhp->rdev.status_page->db_off) { |
795 | t4_ring_sq_db(&qhp->wq, idx); | 811 | t4_ring_sq_db(&qhp->wq, idx, |
812 | is_t5(qhp->rhp->rdev.lldi.adapter_type), wqe); | ||
796 | spin_unlock_irqrestore(&qhp->lock, flag); | 813 | spin_unlock_irqrestore(&qhp->lock, flag); |
797 | } else { | 814 | } else { |
798 | spin_unlock_irqrestore(&qhp->lock, flag); | 815 | spin_unlock_irqrestore(&qhp->lock, flag); |
@@ -806,7 +823,7 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
806 | { | 823 | { |
807 | int err = 0; | 824 | int err = 0; |
808 | struct c4iw_qp *qhp; | 825 | struct c4iw_qp *qhp; |
809 | union t4_recv_wr *wqe; | 826 | union t4_recv_wr *wqe = NULL; |
810 | u32 num_wrs; | 827 | u32 num_wrs; |
811 | u8 len16 = 0; | 828 | u8 len16 = 0; |
812 | unsigned long flag; | 829 | unsigned long flag; |
@@ -858,7 +875,8 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
858 | num_wrs--; | 875 | num_wrs--; |
859 | } | 876 | } |
860 | if (!qhp->rhp->rdev.status_page->db_off) { | 877 | if (!qhp->rhp->rdev.status_page->db_off) { |
861 | t4_ring_rq_db(&qhp->wq, idx); | 878 | t4_ring_rq_db(&qhp->wq, idx, |
879 | is_t5(qhp->rhp->rdev.lldi.adapter_type), wqe); | ||
862 | spin_unlock_irqrestore(&qhp->lock, flag); | 880 | spin_unlock_irqrestore(&qhp->lock, flag); |
863 | } else { | 881 | } else { |
864 | spin_unlock_irqrestore(&qhp->lock, flag); | 882 | spin_unlock_irqrestore(&qhp->lock, flag); |
@@ -1352,6 +1370,7 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1352 | switch (attrs->next_state) { | 1370 | switch (attrs->next_state) { |
1353 | case C4IW_QP_STATE_CLOSING: | 1371 | case C4IW_QP_STATE_CLOSING: |
1354 | BUG_ON(atomic_read(&qhp->ep->com.kref.refcount) < 2); | 1372 | BUG_ON(atomic_read(&qhp->ep->com.kref.refcount) < 2); |
1373 | t4_set_wq_in_error(&qhp->wq); | ||
1355 | set_state(qhp, C4IW_QP_STATE_CLOSING); | 1374 | set_state(qhp, C4IW_QP_STATE_CLOSING); |
1356 | ep = qhp->ep; | 1375 | ep = qhp->ep; |
1357 | if (!internal) { | 1376 | if (!internal) { |
@@ -1359,18 +1378,18 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1359 | disconnect = 1; | 1378 | disconnect = 1; |
1360 | c4iw_get_ep(&qhp->ep->com); | 1379 | c4iw_get_ep(&qhp->ep->com); |
1361 | } | 1380 | } |
1362 | t4_set_wq_in_error(&qhp->wq); | ||
1363 | ret = rdma_fini(rhp, qhp, ep); | 1381 | ret = rdma_fini(rhp, qhp, ep); |
1364 | if (ret) | 1382 | if (ret) |
1365 | goto err; | 1383 | goto err; |
1366 | break; | 1384 | break; |
1367 | case C4IW_QP_STATE_TERMINATE: | 1385 | case C4IW_QP_STATE_TERMINATE: |
1386 | t4_set_wq_in_error(&qhp->wq); | ||
1368 | set_state(qhp, C4IW_QP_STATE_TERMINATE); | 1387 | set_state(qhp, C4IW_QP_STATE_TERMINATE); |
1369 | qhp->attr.layer_etype = attrs->layer_etype; | 1388 | qhp->attr.layer_etype = attrs->layer_etype; |
1370 | qhp->attr.ecode = attrs->ecode; | 1389 | qhp->attr.ecode = attrs->ecode; |
1371 | t4_set_wq_in_error(&qhp->wq); | ||
1372 | ep = qhp->ep; | 1390 | ep = qhp->ep; |
1373 | disconnect = 1; | 1391 | disconnect = 1; |
1392 | c4iw_get_ep(&qhp->ep->com); | ||
1374 | if (!internal) | 1393 | if (!internal) |
1375 | terminate = 1; | 1394 | terminate = 1; |
1376 | else { | 1395 | else { |
@@ -1378,11 +1397,10 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1378 | if (ret) | 1397 | if (ret) |
1379 | goto err; | 1398 | goto err; |
1380 | } | 1399 | } |
1381 | c4iw_get_ep(&qhp->ep->com); | ||
1382 | break; | 1400 | break; |
1383 | case C4IW_QP_STATE_ERROR: | 1401 | case C4IW_QP_STATE_ERROR: |
1384 | set_state(qhp, C4IW_QP_STATE_ERROR); | ||
1385 | t4_set_wq_in_error(&qhp->wq); | 1402 | t4_set_wq_in_error(&qhp->wq); |
1403 | set_state(qhp, C4IW_QP_STATE_ERROR); | ||
1386 | if (!internal) { | 1404 | if (!internal) { |
1387 | abort = 1; | 1405 | abort = 1; |
1388 | disconnect = 1; | 1406 | disconnect = 1; |
@@ -1677,11 +1695,11 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, | |||
1677 | mm2->len = PAGE_ALIGN(qhp->wq.rq.memsize); | 1695 | mm2->len = PAGE_ALIGN(qhp->wq.rq.memsize); |
1678 | insert_mmap(ucontext, mm2); | 1696 | insert_mmap(ucontext, mm2); |
1679 | mm3->key = uresp.sq_db_gts_key; | 1697 | mm3->key = uresp.sq_db_gts_key; |
1680 | mm3->addr = qhp->wq.sq.udb; | 1698 | mm3->addr = (__force unsigned long) qhp->wq.sq.udb; |
1681 | mm3->len = PAGE_SIZE; | 1699 | mm3->len = PAGE_SIZE; |
1682 | insert_mmap(ucontext, mm3); | 1700 | insert_mmap(ucontext, mm3); |
1683 | mm4->key = uresp.rq_db_gts_key; | 1701 | mm4->key = uresp.rq_db_gts_key; |
1684 | mm4->addr = qhp->wq.rq.udb; | 1702 | mm4->addr = (__force unsigned long) qhp->wq.rq.udb; |
1685 | mm4->len = PAGE_SIZE; | 1703 | mm4->len = PAGE_SIZE; |
1686 | insert_mmap(ucontext, mm4); | 1704 | insert_mmap(ucontext, mm4); |
1687 | if (mm5) { | 1705 | if (mm5) { |
diff --git a/drivers/infiniband/hw/cxgb4/resource.c b/drivers/infiniband/hw/cxgb4/resource.c index cdef4d7fb6d8..67df71a7012e 100644 --- a/drivers/infiniband/hw/cxgb4/resource.c +++ b/drivers/infiniband/hw/cxgb4/resource.c | |||
@@ -179,8 +179,12 @@ u32 c4iw_get_qpid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx) | |||
179 | kfree(entry); | 179 | kfree(entry); |
180 | } else { | 180 | } else { |
181 | qid = c4iw_get_resource(&rdev->resource.qid_table); | 181 | qid = c4iw_get_resource(&rdev->resource.qid_table); |
182 | if (!qid) | 182 | if (!qid) { |
183 | mutex_lock(&rdev->stats.lock); | ||
184 | rdev->stats.qid.fail++; | ||
185 | mutex_unlock(&rdev->stats.lock); | ||
183 | goto out; | 186 | goto out; |
187 | } | ||
184 | mutex_lock(&rdev->stats.lock); | 188 | mutex_lock(&rdev->stats.lock); |
185 | rdev->stats.qid.cur += rdev->qpmask + 1; | 189 | rdev->stats.qid.cur += rdev->qpmask + 1; |
186 | mutex_unlock(&rdev->stats.lock); | 190 | mutex_unlock(&rdev->stats.lock); |
@@ -322,8 +326,8 @@ u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size) | |||
322 | unsigned long addr = gen_pool_alloc(rdev->rqt_pool, size << 6); | 326 | unsigned long addr = gen_pool_alloc(rdev->rqt_pool, size << 6); |
323 | PDBG("%s addr 0x%x size %d\n", __func__, (u32)addr, size << 6); | 327 | PDBG("%s addr 0x%x size %d\n", __func__, (u32)addr, size << 6); |
324 | if (!addr) | 328 | if (!addr) |
325 | printk_ratelimited(KERN_WARNING MOD "%s: Out of RQT memory\n", | 329 | pr_warn_ratelimited(MOD "%s: Out of RQT memory\n", |
326 | pci_name(rdev->lldi.pdev)); | 330 | pci_name(rdev->lldi.pdev)); |
327 | mutex_lock(&rdev->stats.lock); | 331 | mutex_lock(&rdev->stats.lock); |
328 | if (addr) { | 332 | if (addr) { |
329 | rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT); | 333 | rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT); |
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h index eeca8b1e6376..2178f3198410 100644 --- a/drivers/infiniband/hw/cxgb4/t4.h +++ b/drivers/infiniband/hw/cxgb4/t4.h | |||
@@ -84,7 +84,14 @@ struct t4_status_page { | |||
84 | sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge)) | 84 | sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge)) |
85 | #define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \ | 85 | #define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \ |
86 | sizeof(struct fw_ri_immd)) & ~31UL) | 86 | sizeof(struct fw_ri_immd)) & ~31UL) |
87 | #define T4_MAX_FR_DEPTH (1024 / sizeof(u64)) | 87 | #define T4_MAX_FR_IMMD_DEPTH (T4_MAX_FR_IMMD / sizeof(u64)) |
88 | #define T4_MAX_FR_DSGL 1024 | ||
89 | #define T4_MAX_FR_DSGL_DEPTH (T4_MAX_FR_DSGL / sizeof(u64)) | ||
90 | |||
91 | static inline int t4_max_fr_depth(int use_dsgl) | ||
92 | { | ||
93 | return use_dsgl ? T4_MAX_FR_DSGL_DEPTH : T4_MAX_FR_IMMD_DEPTH; | ||
94 | } | ||
88 | 95 | ||
89 | #define T4_RQ_NUM_SLOTS 2 | 96 | #define T4_RQ_NUM_SLOTS 2 |
90 | #define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS) | 97 | #define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS) |
@@ -292,7 +299,7 @@ struct t4_sq { | |||
292 | unsigned long phys_addr; | 299 | unsigned long phys_addr; |
293 | struct t4_swsqe *sw_sq; | 300 | struct t4_swsqe *sw_sq; |
294 | struct t4_swsqe *oldest_read; | 301 | struct t4_swsqe *oldest_read; |
295 | u64 udb; | 302 | u64 __iomem *udb; |
296 | size_t memsize; | 303 | size_t memsize; |
297 | u32 qid; | 304 | u32 qid; |
298 | u16 in_use; | 305 | u16 in_use; |
@@ -314,7 +321,7 @@ struct t4_rq { | |||
314 | dma_addr_t dma_addr; | 321 | dma_addr_t dma_addr; |
315 | DEFINE_DMA_UNMAP_ADDR(mapping); | 322 | DEFINE_DMA_UNMAP_ADDR(mapping); |
316 | struct t4_swrqe *sw_rq; | 323 | struct t4_swrqe *sw_rq; |
317 | u64 udb; | 324 | u64 __iomem *udb; |
318 | size_t memsize; | 325 | size_t memsize; |
319 | u32 qid; | 326 | u32 qid; |
320 | u32 msn; | 327 | u32 msn; |
@@ -435,15 +442,67 @@ static inline u16 t4_sq_wq_size(struct t4_wq *wq) | |||
435 | return wq->sq.size * T4_SQ_NUM_SLOTS; | 442 | return wq->sq.size * T4_SQ_NUM_SLOTS; |
436 | } | 443 | } |
437 | 444 | ||
438 | static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc) | 445 | /* This function copies 64 byte coalesced work request to memory |
446 | * mapped BAR2 space. For coalesced WRs, the SGE fetches data | ||
447 | * from the FIFO instead of from Host. | ||
448 | */ | ||
449 | static inline void pio_copy(u64 __iomem *dst, u64 *src) | ||
450 | { | ||
451 | int count = 8; | ||
452 | |||
453 | while (count) { | ||
454 | writeq(*src, dst); | ||
455 | src++; | ||
456 | dst++; | ||
457 | count--; | ||
458 | } | ||
459 | } | ||
460 | |||
461 | static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, u8 t5, | ||
462 | union t4_wr *wqe) | ||
439 | { | 463 | { |
464 | |||
465 | /* Flush host queue memory writes. */ | ||
440 | wmb(); | 466 | wmb(); |
467 | if (t5) { | ||
468 | if (inc == 1 && wqe) { | ||
469 | PDBG("%s: WC wq->sq.pidx = %d\n", | ||
470 | __func__, wq->sq.pidx); | ||
471 | pio_copy(wq->sq.udb + 7, (void *)wqe); | ||
472 | } else { | ||
473 | PDBG("%s: DB wq->sq.pidx = %d\n", | ||
474 | __func__, wq->sq.pidx); | ||
475 | writel(PIDX_T5(inc), wq->sq.udb); | ||
476 | } | ||
477 | |||
478 | /* Flush user doorbell area writes. */ | ||
479 | wmb(); | ||
480 | return; | ||
481 | } | ||
441 | writel(QID(wq->sq.qid) | PIDX(inc), wq->db); | 482 | writel(QID(wq->sq.qid) | PIDX(inc), wq->db); |
442 | } | 483 | } |
443 | 484 | ||
444 | static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc) | 485 | static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, |
486 | union t4_recv_wr *wqe) | ||
445 | { | 487 | { |
488 | |||
489 | /* Flush host queue memory writes. */ | ||
446 | wmb(); | 490 | wmb(); |
491 | if (t5) { | ||
492 | if (inc == 1 && wqe) { | ||
493 | PDBG("%s: WC wq->rq.pidx = %d\n", | ||
494 | __func__, wq->rq.pidx); | ||
495 | pio_copy(wq->rq.udb + 7, (void *)wqe); | ||
496 | } else { | ||
497 | PDBG("%s: DB wq->rq.pidx = %d\n", | ||
498 | __func__, wq->rq.pidx); | ||
499 | writel(PIDX_T5(inc), wq->rq.udb); | ||
500 | } | ||
501 | |||
502 | /* Flush user doorbell area writes. */ | ||
503 | wmb(); | ||
504 | return; | ||
505 | } | ||
447 | writel(QID(wq->rq.qid) | PIDX(inc), wq->db); | 506 | writel(QID(wq->rq.qid) | PIDX(inc), wq->db); |
448 | } | 507 | } |
449 | 508 | ||
@@ -568,6 +627,9 @@ static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe) | |||
568 | printk(KERN_ERR MOD "cq overflow cqid %u\n", cq->cqid); | 627 | printk(KERN_ERR MOD "cq overflow cqid %u\n", cq->cqid); |
569 | BUG_ON(1); | 628 | BUG_ON(1); |
570 | } else if (t4_valid_cqe(cq, &cq->queue[cq->cidx])) { | 629 | } else if (t4_valid_cqe(cq, &cq->queue[cq->cidx])) { |
630 | |||
631 | /* Ensure CQE is flushed to memory */ | ||
632 | rmb(); | ||
571 | *cqe = &cq->queue[cq->cidx]; | 633 | *cqe = &cq->queue[cq->cidx]; |
572 | ret = 0; | 634 | ret = 0; |
573 | } else | 635 | } else |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index fa6dc870adae..364d4b6937f5 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -282,6 +282,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, | |||
282 | props->sig_guard_cap = IB_GUARD_T10DIF_CRC | | 282 | props->sig_guard_cap = IB_GUARD_T10DIF_CRC | |
283 | IB_GUARD_T10DIF_CSUM; | 283 | IB_GUARD_T10DIF_CSUM; |
284 | } | 284 | } |
285 | if (flags & MLX5_DEV_CAP_FLAG_BLOCK_MCAST) | ||
286 | props->device_cap_flags |= IB_DEVICE_BLOCK_MULTICAST_LOOPBACK; | ||
285 | 287 | ||
286 | props->vendor_id = be32_to_cpup((__be32 *)(out_mad->data + 36)) & | 288 | props->vendor_id = be32_to_cpup((__be32 *)(out_mad->data + 36)) & |
287 | 0xffffff; | 289 | 0xffffff; |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index ae788d27b93f..dc930ed21eca 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -807,6 +807,15 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, | |||
807 | spin_lock_init(&qp->sq.lock); | 807 | spin_lock_init(&qp->sq.lock); |
808 | spin_lock_init(&qp->rq.lock); | 808 | spin_lock_init(&qp->rq.lock); |
809 | 809 | ||
810 | if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) { | ||
811 | if (!(dev->mdev.caps.flags & MLX5_DEV_CAP_FLAG_BLOCK_MCAST)) { | ||
812 | mlx5_ib_dbg(dev, "block multicast loopback isn't supported\n"); | ||
813 | return -EINVAL; | ||
814 | } else { | ||
815 | qp->flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK; | ||
816 | } | ||
817 | } | ||
818 | |||
810 | if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) | 819 | if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) |
811 | qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE; | 820 | qp->sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE; |
812 | 821 | ||
@@ -878,6 +887,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, | |||
878 | if (qp->wq_sig) | 887 | if (qp->wq_sig) |
879 | in->ctx.flags_pd |= cpu_to_be32(MLX5_QP_ENABLE_SIG); | 888 | in->ctx.flags_pd |= cpu_to_be32(MLX5_QP_ENABLE_SIG); |
880 | 889 | ||
890 | if (qp->flags & MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK) | ||
891 | in->ctx.flags_pd |= cpu_to_be32(MLX5_QP_BLOCK_MCAST); | ||
892 | |||
881 | if (qp->scat_cqe && is_connected(init_attr->qp_type)) { | 893 | if (qp->scat_cqe && is_connected(init_attr->qp_type)) { |
882 | int rcqe_sz; | 894 | int rcqe_sz; |
883 | int scqe_sz; | 895 | int scqe_sz; |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 87897b95666d..ded76c101dde 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -858,13 +858,9 @@ static int mthca_enable_msi_x(struct mthca_dev *mdev) | |||
858 | entries[1].entry = 1; | 858 | entries[1].entry = 1; |
859 | entries[2].entry = 2; | 859 | entries[2].entry = 2; |
860 | 860 | ||
861 | err = pci_enable_msix(mdev->pdev, entries, ARRAY_SIZE(entries)); | 861 | err = pci_enable_msix_exact(mdev->pdev, entries, ARRAY_SIZE(entries)); |
862 | if (err) { | 862 | if (err) |
863 | if (err > 0) | ||
864 | mthca_info(mdev, "Only %d MSI-X vectors available, " | ||
865 | "not using MSI-X\n", err); | ||
866 | return err; | 863 | return err; |
867 | } | ||
868 | 864 | ||
869 | mdev->eq_table.eq[MTHCA_EQ_COMP ].msi_x_vector = entries[0].vector; | 865 | mdev->eq_table.eq[MTHCA_EQ_COMP ].msi_x_vector = entries[0].vector; |
870 | mdev->eq_table.eq[MTHCA_EQ_ASYNC].msi_x_vector = entries[1].vector; | 866 | mdev->eq_table.eq[MTHCA_EQ_ASYNC].msi_x_vector = entries[1].vector; |
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c index c8d9c4ab142b..61a0046efb76 100644 --- a/drivers/infiniband/hw/qib/qib_pcie.c +++ b/drivers/infiniband/hw/qib/qib_pcie.c | |||
@@ -197,46 +197,47 @@ static void qib_msix_setup(struct qib_devdata *dd, int pos, u32 *msixcnt, | |||
197 | struct qib_msix_entry *qib_msix_entry) | 197 | struct qib_msix_entry *qib_msix_entry) |
198 | { | 198 | { |
199 | int ret; | 199 | int ret; |
200 | u32 tabsize = 0; | 200 | int nvec = *msixcnt; |
201 | u16 msix_flags; | ||
202 | struct msix_entry *msix_entry; | 201 | struct msix_entry *msix_entry; |
203 | int i; | 202 | int i; |
204 | 203 | ||
204 | ret = pci_msix_vec_count(dd->pcidev); | ||
205 | if (ret < 0) | ||
206 | goto do_intx; | ||
207 | |||
208 | nvec = min(nvec, ret); | ||
209 | |||
205 | /* We can't pass qib_msix_entry array to qib_msix_setup | 210 | /* We can't pass qib_msix_entry array to qib_msix_setup |
206 | * so use a dummy msix_entry array and copy the allocated | 211 | * so use a dummy msix_entry array and copy the allocated |
207 | * irq back to the qib_msix_entry array. */ | 212 | * irq back to the qib_msix_entry array. */ |
208 | msix_entry = kmalloc(*msixcnt * sizeof(*msix_entry), GFP_KERNEL); | 213 | msix_entry = kmalloc(nvec * sizeof(*msix_entry), GFP_KERNEL); |
209 | if (!msix_entry) { | 214 | if (!msix_entry) |
210 | ret = -ENOMEM; | ||
211 | goto do_intx; | 215 | goto do_intx; |
212 | } | 216 | |
213 | for (i = 0; i < *msixcnt; i++) | 217 | for (i = 0; i < nvec; i++) |
214 | msix_entry[i] = qib_msix_entry[i].msix; | 218 | msix_entry[i] = qib_msix_entry[i].msix; |
215 | 219 | ||
216 | pci_read_config_word(dd->pcidev, pos + PCI_MSIX_FLAGS, &msix_flags); | 220 | ret = pci_enable_msix_range(dd->pcidev, msix_entry, 1, nvec); |
217 | tabsize = 1 + (msix_flags & PCI_MSIX_FLAGS_QSIZE); | 221 | if (ret < 0) |
218 | if (tabsize > *msixcnt) | 222 | goto free_msix_entry; |
219 | tabsize = *msixcnt; | 223 | else |
220 | ret = pci_enable_msix(dd->pcidev, msix_entry, tabsize); | 224 | nvec = ret; |
221 | if (ret > 0) { | 225 | |
222 | tabsize = ret; | 226 | for (i = 0; i < nvec; i++) |
223 | ret = pci_enable_msix(dd->pcidev, msix_entry, tabsize); | ||
224 | } | ||
225 | do_intx: | ||
226 | if (ret) { | ||
227 | qib_dev_err(dd, | ||
228 | "pci_enable_msix %d vectors failed: %d, falling back to INTx\n", | ||
229 | tabsize, ret); | ||
230 | tabsize = 0; | ||
231 | } | ||
232 | for (i = 0; i < tabsize; i++) | ||
233 | qib_msix_entry[i].msix = msix_entry[i]; | 227 | qib_msix_entry[i].msix = msix_entry[i]; |
228 | |||
234 | kfree(msix_entry); | 229 | kfree(msix_entry); |
235 | *msixcnt = tabsize; | 230 | *msixcnt = nvec; |
231 | return; | ||
236 | 232 | ||
237 | if (ret) | 233 | free_msix_entry: |
238 | qib_enable_intx(dd->pcidev); | 234 | kfree(msix_entry); |
239 | 235 | ||
236 | do_intx: | ||
237 | qib_dev_err(dd, "pci_enable_msix_range %d vectors failed: %d, " | ||
238 | "falling back to INTx\n", nvec, ret); | ||
239 | *msixcnt = 0; | ||
240 | qib_enable_intx(dd->pcidev); | ||
240 | } | 241 | } |
241 | 242 | ||
242 | /** | 243 | /** |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 8b89e33a89fe..647c3c7fd742 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -1381,7 +1381,7 @@ static int arm_smmu_alloc_init_pmd(struct arm_smmu_device *smmu, pud_t *pud, | |||
1381 | 1381 | ||
1382 | do { | 1382 | do { |
1383 | next = pmd_addr_end(addr, end); | 1383 | next = pmd_addr_end(addr, end); |
1384 | ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, end, pfn, | 1384 | ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, next, pfn, |
1385 | prot, stage); | 1385 | prot, stage); |
1386 | phys += next - addr; | 1386 | phys += next - addr; |
1387 | } while (pmd++, addr = next, addr < end); | 1387 | } while (pmd++, addr = next, addr < end); |
@@ -1499,7 +1499,7 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, | |||
1499 | 1499 | ||
1500 | ret = arm_smmu_handle_mapping(smmu_domain, iova, 0, size, 0); | 1500 | ret = arm_smmu_handle_mapping(smmu_domain, iova, 0, size, 0); |
1501 | arm_smmu_tlb_inv_context(&smmu_domain->root_cfg); | 1501 | arm_smmu_tlb_inv_context(&smmu_domain->root_cfg); |
1502 | return ret ? ret : size; | 1502 | return ret ? 0 : size; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, | 1505 | static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index f445c10df8df..39f8b717fe84 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -152,7 +152,8 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event) | |||
152 | info->seg = pci_domain_nr(dev->bus); | 152 | info->seg = pci_domain_nr(dev->bus); |
153 | info->level = level; | 153 | info->level = level; |
154 | if (event == BUS_NOTIFY_ADD_DEVICE) { | 154 | if (event == BUS_NOTIFY_ADD_DEVICE) { |
155 | for (tmp = dev, level--; tmp; tmp = tmp->bus->self) { | 155 | for (tmp = dev; tmp; tmp = tmp->bus->self) { |
156 | level--; | ||
156 | info->path[level].device = PCI_SLOT(tmp->devfn); | 157 | info->path[level].device = PCI_SLOT(tmp->devfn); |
157 | info->path[level].function = PCI_FUNC(tmp->devfn); | 158 | info->path[level].function = PCI_FUNC(tmp->devfn); |
158 | if (pci_is_root_bus(tmp->bus)) | 159 | if (pci_is_root_bus(tmp->bus)) |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 69fa7da5e48b..f256ffc02e29 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1009,11 +1009,13 @@ static struct page *dma_pte_list_pagetables(struct dmar_domain *domain, | |||
1009 | if (level == 1) | 1009 | if (level == 1) |
1010 | return freelist; | 1010 | return freelist; |
1011 | 1011 | ||
1012 | for (pte = page_address(pg); !first_pte_in_page(pte); pte++) { | 1012 | pte = page_address(pg); |
1013 | do { | ||
1013 | if (dma_pte_present(pte) && !dma_pte_superpage(pte)) | 1014 | if (dma_pte_present(pte) && !dma_pte_superpage(pte)) |
1014 | freelist = dma_pte_list_pagetables(domain, level - 1, | 1015 | freelist = dma_pte_list_pagetables(domain, level - 1, |
1015 | pte, freelist); | 1016 | pte, freelist); |
1016 | } | 1017 | pte++; |
1018 | } while (!first_pte_in_page(pte)); | ||
1017 | 1019 | ||
1018 | return freelist; | 1020 | return freelist; |
1019 | } | 1021 | } |
@@ -2235,7 +2237,9 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) | |||
2235 | bridge_devfn = dev_tmp->devfn; | 2237 | bridge_devfn = dev_tmp->devfn; |
2236 | } | 2238 | } |
2237 | spin_lock_irqsave(&device_domain_lock, flags); | 2239 | spin_lock_irqsave(&device_domain_lock, flags); |
2238 | info = dmar_search_domain_by_dev_info(segment, bus, devfn); | 2240 | info = dmar_search_domain_by_dev_info(segment, |
2241 | bridge_bus, | ||
2242 | bridge_devfn); | ||
2239 | if (info) { | 2243 | if (info) { |
2240 | iommu = info->iommu; | 2244 | iommu = info->iommu; |
2241 | domain = info->domain; | 2245 | domain = info->domain; |
diff --git a/drivers/irqchip/irq-vic.c b/drivers/irqchip/irq-vic.c index 37dab0b472cd..7d35287f9e90 100644 --- a/drivers/irqchip/irq-vic.c +++ b/drivers/irqchip/irq-vic.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/irqchip/chained_irq.h> | ||
27 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
28 | #include <linux/of.h> | 29 | #include <linux/of.h> |
29 | #include <linux/of_address.h> | 30 | #include <linux/of_address.h> |
@@ -228,12 +229,17 @@ static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs) | |||
228 | static void vic_handle_irq_cascaded(unsigned int irq, struct irq_desc *desc) | 229 | static void vic_handle_irq_cascaded(unsigned int irq, struct irq_desc *desc) |
229 | { | 230 | { |
230 | u32 stat, hwirq; | 231 | u32 stat, hwirq; |
232 | struct irq_chip *host_chip = irq_desc_get_chip(desc); | ||
231 | struct vic_device *vic = irq_desc_get_handler_data(desc); | 233 | struct vic_device *vic = irq_desc_get_handler_data(desc); |
232 | 234 | ||
235 | chained_irq_enter(host_chip, desc); | ||
236 | |||
233 | while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) { | 237 | while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) { |
234 | hwirq = ffs(stat) - 1; | 238 | hwirq = ffs(stat) - 1; |
235 | generic_handle_irq(irq_find_mapping(vic->domain, hwirq)); | 239 | generic_handle_irq(irq_find_mapping(vic->domain, hwirq)); |
236 | } | 240 | } |
241 | |||
242 | chained_irq_exit(host_chip, desc); | ||
237 | } | 243 | } |
238 | 244 | ||
239 | /* | 245 | /* |
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 8527743b5cef..3fdda3a40269 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Viresh Kumar <viresh.linux@gmail.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
6 | * | 6 | * |
7 | * Copyright (C) 2012 ST Microelectronics | 7 | * Copyright (C) 2012 ST Microelectronics |
8 | * Shiraz Hashim <shiraz.hashim@st.com> | 8 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
9 | * | 9 | * |
10 | * This file is licensed under the terms of the GNU General Public | 10 | * This file is licensed under the terms of the GNU General Public |
11 | * License version 2. This program is licensed "as is" without any | 11 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index 53d487f0c79d..6a7447c304ac 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
@@ -1155,7 +1155,7 @@ icn_command(isdn_ctrl *c, icn_card *card) | |||
1155 | ulong a; | 1155 | ulong a; |
1156 | ulong flags; | 1156 | ulong flags; |
1157 | int i; | 1157 | int i; |
1158 | char cbuf[60]; | 1158 | char cbuf[80]; |
1159 | isdn_ctrl cmd; | 1159 | isdn_ctrl cmd; |
1160 | icn_cdef cdef; | 1160 | icn_cdef cdef; |
1161 | char __user *arg; | 1161 | char __user *arg; |
@@ -1309,7 +1309,6 @@ icn_command(isdn_ctrl *c, icn_card *card) | |||
1309 | break; | 1309 | break; |
1310 | if ((c->arg & 255) < ICN_BCH) { | 1310 | if ((c->arg & 255) < ICN_BCH) { |
1311 | char *p; | 1311 | char *p; |
1312 | char dial[50]; | ||
1313 | char dcode[4]; | 1312 | char dcode[4]; |
1314 | 1313 | ||
1315 | a = c->arg; | 1314 | a = c->arg; |
@@ -1321,10 +1320,10 @@ icn_command(isdn_ctrl *c, icn_card *card) | |||
1321 | } else | 1320 | } else |
1322 | /* Normal Dial */ | 1321 | /* Normal Dial */ |
1323 | strcpy(dcode, "CAL"); | 1322 | strcpy(dcode, "CAL"); |
1324 | strcpy(dial, p); | 1323 | snprintf(cbuf, sizeof(cbuf), |
1325 | sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), | 1324 | "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), |
1326 | dcode, dial, c->parm.setup.si1, | 1325 | dcode, p, c->parm.setup.si1, |
1327 | c->parm.setup.si2, c->parm.setup.eazmsn); | 1326 | c->parm.setup.si2, c->parm.setup.eazmsn); |
1328 | i = icn_writecmd(cbuf, strlen(cbuf), 0, card); | 1327 | i = icn_writecmd(cbuf, strlen(cbuf), 0, card); |
1329 | } | 1328 | } |
1330 | break; | 1329 | break; |
diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c index d1278b5f3028..004926955263 100644 --- a/drivers/mcb/mcb-parse.c +++ b/drivers/mcb/mcb-parse.c | |||
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase, | |||
141 | default: | 141 | default: |
142 | pr_err("Invalid chameleon descriptor type 0x%x\n", | 142 | pr_err("Invalid chameleon descriptor type 0x%x\n", |
143 | dtype); | 143 | dtype); |
144 | kfree(header); | ||
144 | return -EINVAL; | 145 | return -EINVAL; |
145 | } | 146 | } |
146 | num_cells++; | 147 | num_cells++; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 25247a852912..ad1b9bea446e 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4370,8 +4370,7 @@ static struct stripe_head *__get_priority_stripe(struct r5conf *conf, int group) | |||
4370 | sh->group = NULL; | 4370 | sh->group = NULL; |
4371 | } | 4371 | } |
4372 | list_del_init(&sh->lru); | 4372 | list_del_init(&sh->lru); |
4373 | atomic_inc(&sh->count); | 4373 | BUG_ON(atomic_inc_return(&sh->count) != 1); |
4374 | BUG_ON(atomic_read(&sh->count) != 1); | ||
4375 | return sh; | 4374 | return sh; |
4376 | } | 4375 | } |
4377 | 4376 | ||
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index c137abfa0c54..20f1655e6d75 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -56,7 +56,7 @@ config VIDEO_VIU | |||
56 | 56 | ||
57 | config VIDEO_TIMBERDALE | 57 | config VIDEO_TIMBERDALE |
58 | tristate "Support for timberdale Video In/LogiWIN" | 58 | tristate "Support for timberdale Video In/LogiWIN" |
59 | depends on VIDEO_V4L2 && I2C && DMADEVICES | 59 | depends on MFD_TIMBERDALE && VIDEO_V4L2 && I2C && DMADEVICES |
60 | select DMA_ENGINE | 60 | select DMA_ENGINE |
61 | select TIMB_DMA | 61 | select TIMB_DMA |
62 | select VIDEO_ADV7180 | 62 | select VIDEO_ADV7180 |
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c index ba1a25d758c1..1c3e6e2efe41 100644 --- a/drivers/mfd/tps65090.c +++ b/drivers/mfd/tps65090.c | |||
@@ -32,14 +32,6 @@ | |||
32 | #define NUM_INT_REG 2 | 32 | #define NUM_INT_REG 2 |
33 | #define TOTAL_NUM_REG 0x18 | 33 | #define TOTAL_NUM_REG 0x18 |
34 | 34 | ||
35 | /* interrupt status registers */ | ||
36 | #define TPS65090_INT_STS 0x0 | ||
37 | #define TPS65090_INT_STS2 0x1 | ||
38 | |||
39 | /* interrupt mask registers */ | ||
40 | #define TPS65090_INT_MSK 0x2 | ||
41 | #define TPS65090_INT_MSK2 0x3 | ||
42 | |||
43 | #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1 | 35 | #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1 |
44 | #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2 | 36 | #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2 |
45 | #define TPS65090_INT1_MASK_BAT_STATUS_CHANGE 3 | 37 | #define TPS65090_INT1_MASK_BAT_STATUS_CHANGE 3 |
@@ -64,11 +56,16 @@ static struct resource charger_resources[] = { | |||
64 | } | 56 | } |
65 | }; | 57 | }; |
66 | 58 | ||
67 | static const struct mfd_cell tps65090s[] = { | 59 | enum tps65090_cells { |
68 | { | 60 | PMIC = 0, |
61 | CHARGER = 1, | ||
62 | }; | ||
63 | |||
64 | static struct mfd_cell tps65090s[] = { | ||
65 | [PMIC] = { | ||
69 | .name = "tps65090-pmic", | 66 | .name = "tps65090-pmic", |
70 | }, | 67 | }, |
71 | { | 68 | [CHARGER] = { |
72 | .name = "tps65090-charger", | 69 | .name = "tps65090-charger", |
73 | .num_resources = ARRAY_SIZE(charger_resources), | 70 | .num_resources = ARRAY_SIZE(charger_resources), |
74 | .resources = &charger_resources[0], | 71 | .resources = &charger_resources[0], |
@@ -139,17 +136,26 @@ static struct regmap_irq_chip tps65090_irq_chip = { | |||
139 | .irqs = tps65090_irqs, | 136 | .irqs = tps65090_irqs, |
140 | .num_irqs = ARRAY_SIZE(tps65090_irqs), | 137 | .num_irqs = ARRAY_SIZE(tps65090_irqs), |
141 | .num_regs = NUM_INT_REG, | 138 | .num_regs = NUM_INT_REG, |
142 | .status_base = TPS65090_INT_STS, | 139 | .status_base = TPS65090_REG_INTR_STS, |
143 | .mask_base = TPS65090_INT_MSK, | 140 | .mask_base = TPS65090_REG_INTR_MASK, |
144 | .mask_invert = true, | 141 | .mask_invert = true, |
145 | }; | 142 | }; |
146 | 143 | ||
147 | static bool is_volatile_reg(struct device *dev, unsigned int reg) | 144 | static bool is_volatile_reg(struct device *dev, unsigned int reg) |
148 | { | 145 | { |
149 | if ((reg == TPS65090_INT_STS) || (reg == TPS65090_INT_STS2)) | 146 | /* Nearly all registers have status bits mixed in, except a few */ |
150 | return true; | 147 | switch (reg) { |
151 | else | 148 | case TPS65090_REG_INTR_MASK: |
149 | case TPS65090_REG_INTR_MASK2: | ||
150 | case TPS65090_REG_CG_CTRL0: | ||
151 | case TPS65090_REG_CG_CTRL1: | ||
152 | case TPS65090_REG_CG_CTRL2: | ||
153 | case TPS65090_REG_CG_CTRL3: | ||
154 | case TPS65090_REG_CG_CTRL4: | ||
155 | case TPS65090_REG_CG_CTRL5: | ||
152 | return false; | 156 | return false; |
157 | } | ||
158 | return true; | ||
153 | } | 159 | } |
154 | 160 | ||
155 | static const struct regmap_config tps65090_regmap_config = { | 161 | static const struct regmap_config tps65090_regmap_config = { |
@@ -211,6 +217,9 @@ static int tps65090_i2c_probe(struct i2c_client *client, | |||
211 | "IRQ init failed with err: %d\n", ret); | 217 | "IRQ init failed with err: %d\n", ret); |
212 | return ret; | 218 | return ret; |
213 | } | 219 | } |
220 | } else { | ||
221 | /* Don't tell children they have an IRQ that'll never fire */ | ||
222 | tps65090s[CHARGER].num_resources = 0; | ||
214 | } | 223 | } |
215 | 224 | ||
216 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, | 225 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 1cb74085e410..8baff0effc7d 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -300,8 +300,8 @@ config SGI_GRU_DEBUG | |||
300 | depends on SGI_GRU | 300 | depends on SGI_GRU |
301 | default n | 301 | default n |
302 | ---help--- | 302 | ---help--- |
303 | This option enables addition debugging code for the SGI GRU driver. If | 303 | This option enables additional debugging code for the SGI GRU driver. |
304 | you are unsure, say N. | 304 | If you are unsure, say N. |
305 | 305 | ||
306 | config APDS9802ALS | 306 | config APDS9802ALS |
307 | tristate "Medfield Avago APDS9802 ALS Sensor module" | 307 | tristate "Medfield Avago APDS9802 ALS Sensor module" |
diff --git a/drivers/misc/genwqe/card_base.h b/drivers/misc/genwqe/card_base.h index 5e4dbd21f89a..0e608a288603 100644 --- a/drivers/misc/genwqe/card_base.h +++ b/drivers/misc/genwqe/card_base.h | |||
@@ -337,6 +337,44 @@ enum genwqe_requ_state { | |||
337 | }; | 337 | }; |
338 | 338 | ||
339 | /** | 339 | /** |
340 | * struct genwqe_sgl - Scatter gather list describing user-space memory | ||
341 | * @sgl: scatter gather list needs to be 128 byte aligned | ||
342 | * @sgl_dma_addr: dma address of sgl | ||
343 | * @sgl_size: size of area used for sgl | ||
344 | * @user_addr: user-space address of memory area | ||
345 | * @user_size: size of user-space memory area | ||
346 | * @page: buffer for partial pages if needed | ||
347 | * @page_dma_addr: dma address partial pages | ||
348 | */ | ||
349 | struct genwqe_sgl { | ||
350 | dma_addr_t sgl_dma_addr; | ||
351 | struct sg_entry *sgl; | ||
352 | size_t sgl_size; /* size of sgl */ | ||
353 | |||
354 | void __user *user_addr; /* user-space base-address */ | ||
355 | size_t user_size; /* size of memory area */ | ||
356 | |||
357 | unsigned long nr_pages; | ||
358 | unsigned long fpage_offs; | ||
359 | size_t fpage_size; | ||
360 | size_t lpage_size; | ||
361 | |||
362 | void *fpage; | ||
363 | dma_addr_t fpage_dma_addr; | ||
364 | |||
365 | void *lpage; | ||
366 | dma_addr_t lpage_dma_addr; | ||
367 | }; | ||
368 | |||
369 | int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, | ||
370 | void __user *user_addr, size_t user_size); | ||
371 | |||
372 | int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, | ||
373 | dma_addr_t *dma_list); | ||
374 | |||
375 | int genwqe_free_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl); | ||
376 | |||
377 | /** | ||
340 | * struct ddcb_requ - Kernel internal representation of the DDCB request | 378 | * struct ddcb_requ - Kernel internal representation of the DDCB request |
341 | * @cmd: User space representation of the DDCB execution request | 379 | * @cmd: User space representation of the DDCB execution request |
342 | */ | 380 | */ |
@@ -347,9 +385,7 @@ struct ddcb_requ { | |||
347 | struct ddcb_queue *queue; /* associated queue */ | 385 | struct ddcb_queue *queue; /* associated queue */ |
348 | 386 | ||
349 | struct dma_mapping dma_mappings[DDCB_FIXUPS]; | 387 | struct dma_mapping dma_mappings[DDCB_FIXUPS]; |
350 | struct sg_entry *sgl[DDCB_FIXUPS]; | 388 | struct genwqe_sgl sgls[DDCB_FIXUPS]; |
351 | dma_addr_t sgl_dma_addr[DDCB_FIXUPS]; | ||
352 | size_t sgl_size[DDCB_FIXUPS]; | ||
353 | 389 | ||
354 | /* kernel/user shared content */ | 390 | /* kernel/user shared content */ |
355 | struct genwqe_ddcb_cmd cmd; /* ddcb_no for this request */ | 391 | struct genwqe_ddcb_cmd cmd; /* ddcb_no for this request */ |
@@ -453,22 +489,6 @@ int genwqe_user_vmap(struct genwqe_dev *cd, struct dma_mapping *m, | |||
453 | int genwqe_user_vunmap(struct genwqe_dev *cd, struct dma_mapping *m, | 489 | int genwqe_user_vunmap(struct genwqe_dev *cd, struct dma_mapping *m, |
454 | struct ddcb_requ *req); | 490 | struct ddcb_requ *req); |
455 | 491 | ||
456 | struct sg_entry *genwqe_alloc_sgl(struct genwqe_dev *cd, int num_pages, | ||
457 | dma_addr_t *dma_addr, size_t *sgl_size); | ||
458 | |||
459 | void genwqe_free_sgl(struct genwqe_dev *cd, struct sg_entry *sg_list, | ||
460 | dma_addr_t dma_addr, size_t size); | ||
461 | |||
462 | int genwqe_setup_sgl(struct genwqe_dev *cd, | ||
463 | unsigned long offs, | ||
464 | unsigned long size, | ||
465 | struct sg_entry *sgl, /* genwqe sgl */ | ||
466 | dma_addr_t dma_addr, size_t sgl_size, | ||
467 | dma_addr_t *dma_list, int page_offs, int num_pages); | ||
468 | |||
469 | int genwqe_check_sgl(struct genwqe_dev *cd, struct sg_entry *sg_list, | ||
470 | int size); | ||
471 | |||
472 | static inline bool dma_mapping_used(struct dma_mapping *m) | 492 | static inline bool dma_mapping_used(struct dma_mapping *m) |
473 | { | 493 | { |
474 | if (!m) | 494 | if (!m) |
diff --git a/drivers/misc/genwqe/card_ddcb.c b/drivers/misc/genwqe/card_ddcb.c index 6f1acc0ccf88..c8046db2d5a2 100644 --- a/drivers/misc/genwqe/card_ddcb.c +++ b/drivers/misc/genwqe/card_ddcb.c | |||
@@ -305,6 +305,8 @@ static int enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue, | |||
305 | break; | 305 | break; |
306 | 306 | ||
307 | new = (old | DDCB_NEXT_BE32); | 307 | new = (old | DDCB_NEXT_BE32); |
308 | |||
309 | wmb(); | ||
308 | icrc_hsi_shi = cmpxchg(&prev_ddcb->icrc_hsi_shi_32, old, new); | 310 | icrc_hsi_shi = cmpxchg(&prev_ddcb->icrc_hsi_shi_32, old, new); |
309 | 311 | ||
310 | if (icrc_hsi_shi == old) | 312 | if (icrc_hsi_shi == old) |
@@ -314,6 +316,8 @@ static int enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue, | |||
314 | /* Queue must be re-started by updating QUEUE_OFFSET */ | 316 | /* Queue must be re-started by updating QUEUE_OFFSET */ |
315 | ddcb_mark_tapped(pddcb); | 317 | ddcb_mark_tapped(pddcb); |
316 | num = (u64)ddcb_no << 8; | 318 | num = (u64)ddcb_no << 8; |
319 | |||
320 | wmb(); | ||
317 | __genwqe_writeq(cd, queue->IO_QUEUE_OFFSET, num); /* start queue */ | 321 | __genwqe_writeq(cd, queue->IO_QUEUE_OFFSET, num); /* start queue */ |
318 | 322 | ||
319 | return RET_DDCB_TAPPED; | 323 | return RET_DDCB_TAPPED; |
@@ -1306,7 +1310,7 @@ static int queue_wake_up_all(struct genwqe_dev *cd) | |||
1306 | */ | 1310 | */ |
1307 | int genwqe_finish_queue(struct genwqe_dev *cd) | 1311 | int genwqe_finish_queue(struct genwqe_dev *cd) |
1308 | { | 1312 | { |
1309 | int i, rc, in_flight; | 1313 | int i, rc = 0, in_flight; |
1310 | int waitmax = genwqe_ddcb_software_timeout; | 1314 | int waitmax = genwqe_ddcb_software_timeout; |
1311 | struct pci_dev *pci_dev = cd->pci_dev; | 1315 | struct pci_dev *pci_dev = cd->pci_dev; |
1312 | struct ddcb_queue *queue = &cd->queue; | 1316 | struct ddcb_queue *queue = &cd->queue; |
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 2c2c9cc75231..1d2f163a1906 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c | |||
@@ -531,7 +531,9 @@ static int do_flash_update(struct genwqe_file *cfile, | |||
531 | case '1': | 531 | case '1': |
532 | cmdopts = 0x1C; | 532 | cmdopts = 0x1C; |
533 | break; /* download/erase_first/part_1 */ | 533 | break; /* download/erase_first/part_1 */ |
534 | case 'v': /* cmdopts = 0x0c (VPD) */ | 534 | case 'v': |
535 | cmdopts = 0x0C; | ||
536 | break; /* download/erase_first/vpd */ | ||
535 | default: | 537 | default: |
536 | return -EINVAL; | 538 | return -EINVAL; |
537 | } | 539 | } |
@@ -665,6 +667,8 @@ static int do_flash_read(struct genwqe_file *cfile, | |||
665 | cmdopts = 0x1A; | 667 | cmdopts = 0x1A; |
666 | break; /* upload/part_1 */ | 668 | break; /* upload/part_1 */ |
667 | case 'v': | 669 | case 'v': |
670 | cmdopts = 0x0A; | ||
671 | break; /* upload/vpd */ | ||
668 | default: | 672 | default: |
669 | return -EINVAL; | 673 | return -EINVAL; |
670 | } | 674 | } |
@@ -836,15 +840,8 @@ static int ddcb_cmd_cleanup(struct genwqe_file *cfile, struct ddcb_requ *req) | |||
836 | __genwqe_del_mapping(cfile, dma_map); | 840 | __genwqe_del_mapping(cfile, dma_map); |
837 | genwqe_user_vunmap(cd, dma_map, req); | 841 | genwqe_user_vunmap(cd, dma_map, req); |
838 | } | 842 | } |
839 | if (req->sgl[i] != NULL) { | 843 | if (req->sgls[i].sgl != NULL) |
840 | genwqe_free_sgl(cd, req->sgl[i], | 844 | genwqe_free_sync_sgl(cd, &req->sgls[i]); |
841 | req->sgl_dma_addr[i], | ||
842 | req->sgl_size[i]); | ||
843 | req->sgl[i] = NULL; | ||
844 | req->sgl_dma_addr[i] = 0x0; | ||
845 | req->sgl_size[i] = 0; | ||
846 | } | ||
847 | |||
848 | } | 845 | } |
849 | return 0; | 846 | return 0; |
850 | } | 847 | } |
@@ -913,7 +910,7 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req) | |||
913 | 910 | ||
914 | case ATS_TYPE_SGL_RDWR: | 911 | case ATS_TYPE_SGL_RDWR: |
915 | case ATS_TYPE_SGL_RD: { | 912 | case ATS_TYPE_SGL_RD: { |
916 | int page_offs, nr_pages, offs; | 913 | int page_offs; |
917 | 914 | ||
918 | u_addr = be64_to_cpu(*((__be64 *) | 915 | u_addr = be64_to_cpu(*((__be64 *) |
919 | &cmd->asiv[asiv_offs])); | 916 | &cmd->asiv[asiv_offs])); |
@@ -951,27 +948,18 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req) | |||
951 | page_offs = 0; | 948 | page_offs = 0; |
952 | } | 949 | } |
953 | 950 | ||
954 | offs = offset_in_page(u_addr); | ||
955 | nr_pages = DIV_ROUND_UP(offs + u_size, PAGE_SIZE); | ||
956 | |||
957 | /* create genwqe style scatter gather list */ | 951 | /* create genwqe style scatter gather list */ |
958 | req->sgl[i] = genwqe_alloc_sgl(cd, m->nr_pages, | 952 | rc = genwqe_alloc_sync_sgl(cd, &req->sgls[i], |
959 | &req->sgl_dma_addr[i], | 953 | (void __user *)u_addr, |
960 | &req->sgl_size[i]); | 954 | u_size); |
961 | if (req->sgl[i] == NULL) { | 955 | if (rc != 0) |
962 | rc = -ENOMEM; | ||
963 | goto err_out; | 956 | goto err_out; |
964 | } | 957 | |
965 | genwqe_setup_sgl(cd, offs, u_size, | 958 | genwqe_setup_sgl(cd, &req->sgls[i], |
966 | req->sgl[i], | 959 | &m->dma_list[page_offs]); |
967 | req->sgl_dma_addr[i], | ||
968 | req->sgl_size[i], | ||
969 | m->dma_list, | ||
970 | page_offs, | ||
971 | nr_pages); | ||
972 | 960 | ||
973 | *((__be64 *)&cmd->asiv[asiv_offs]) = | 961 | *((__be64 *)&cmd->asiv[asiv_offs]) = |
974 | cpu_to_be64(req->sgl_dma_addr[i]); | 962 | cpu_to_be64(req->sgls[i].sgl_dma_addr); |
975 | 963 | ||
976 | break; | 964 | break; |
977 | } | 965 | } |
diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c index 6b1a6ef9f1a8..d049d271699c 100644 --- a/drivers/misc/genwqe/card_utils.c +++ b/drivers/misc/genwqe/card_utils.c | |||
@@ -275,67 +275,107 @@ static int genwqe_sgl_size(int num_pages) | |||
275 | return roundup(len, PAGE_SIZE); | 275 | return roundup(len, PAGE_SIZE); |
276 | } | 276 | } |
277 | 277 | ||
278 | struct sg_entry *genwqe_alloc_sgl(struct genwqe_dev *cd, int num_pages, | 278 | /** |
279 | dma_addr_t *dma_addr, size_t *sgl_size) | 279 | * genwqe_alloc_sync_sgl() - Allocate memory for sgl and overlapping pages |
280 | * | ||
281 | * Allocates memory for sgl and overlapping pages. Pages which might | ||
282 | * overlap other user-space memory blocks are being cached for DMAs, | ||
283 | * such that we do not run into syncronization issues. Data is copied | ||
284 | * from user-space into the cached pages. | ||
285 | */ | ||
286 | int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, | ||
287 | void __user *user_addr, size_t user_size) | ||
280 | { | 288 | { |
289 | int rc; | ||
281 | struct pci_dev *pci_dev = cd->pci_dev; | 290 | struct pci_dev *pci_dev = cd->pci_dev; |
282 | struct sg_entry *sgl; | ||
283 | 291 | ||
284 | *sgl_size = genwqe_sgl_size(num_pages); | 292 | sgl->fpage_offs = offset_in_page((unsigned long)user_addr); |
285 | if (get_order(*sgl_size) > MAX_ORDER) { | 293 | sgl->fpage_size = min_t(size_t, PAGE_SIZE-sgl->fpage_offs, user_size); |
294 | sgl->nr_pages = DIV_ROUND_UP(sgl->fpage_offs + user_size, PAGE_SIZE); | ||
295 | sgl->lpage_size = (user_size - sgl->fpage_size) % PAGE_SIZE; | ||
296 | |||
297 | dev_dbg(&pci_dev->dev, "[%s] uaddr=%p usize=%8ld nr_pages=%ld " | ||
298 | "fpage_offs=%lx fpage_size=%ld lpage_size=%ld\n", | ||
299 | __func__, user_addr, user_size, sgl->nr_pages, | ||
300 | sgl->fpage_offs, sgl->fpage_size, sgl->lpage_size); | ||
301 | |||
302 | sgl->user_addr = user_addr; | ||
303 | sgl->user_size = user_size; | ||
304 | sgl->sgl_size = genwqe_sgl_size(sgl->nr_pages); | ||
305 | |||
306 | if (get_order(sgl->sgl_size) > MAX_ORDER) { | ||
286 | dev_err(&pci_dev->dev, | 307 | dev_err(&pci_dev->dev, |
287 | "[%s] err: too much memory requested!\n", __func__); | 308 | "[%s] err: too much memory requested!\n", __func__); |
288 | return NULL; | 309 | return -ENOMEM; |
289 | } | 310 | } |
290 | 311 | ||
291 | sgl = __genwqe_alloc_consistent(cd, *sgl_size, dma_addr); | 312 | sgl->sgl = __genwqe_alloc_consistent(cd, sgl->sgl_size, |
292 | if (sgl == NULL) { | 313 | &sgl->sgl_dma_addr); |
314 | if (sgl->sgl == NULL) { | ||
293 | dev_err(&pci_dev->dev, | 315 | dev_err(&pci_dev->dev, |
294 | "[%s] err: no memory available!\n", __func__); | 316 | "[%s] err: no memory available!\n", __func__); |
295 | return NULL; | 317 | return -ENOMEM; |
296 | } | 318 | } |
297 | 319 | ||
298 | return sgl; | 320 | /* Only use buffering on incomplete pages */ |
321 | if ((sgl->fpage_size != 0) && (sgl->fpage_size != PAGE_SIZE)) { | ||
322 | sgl->fpage = __genwqe_alloc_consistent(cd, PAGE_SIZE, | ||
323 | &sgl->fpage_dma_addr); | ||
324 | if (sgl->fpage == NULL) | ||
325 | goto err_out; | ||
326 | |||
327 | /* Sync with user memory */ | ||
328 | if (copy_from_user(sgl->fpage + sgl->fpage_offs, | ||
329 | user_addr, sgl->fpage_size)) { | ||
330 | rc = -EFAULT; | ||
331 | goto err_out; | ||
332 | } | ||
333 | } | ||
334 | if (sgl->lpage_size != 0) { | ||
335 | sgl->lpage = __genwqe_alloc_consistent(cd, PAGE_SIZE, | ||
336 | &sgl->lpage_dma_addr); | ||
337 | if (sgl->lpage == NULL) | ||
338 | goto err_out1; | ||
339 | |||
340 | /* Sync with user memory */ | ||
341 | if (copy_from_user(sgl->lpage, user_addr + user_size - | ||
342 | sgl->lpage_size, sgl->lpage_size)) { | ||
343 | rc = -EFAULT; | ||
344 | goto err_out1; | ||
345 | } | ||
346 | } | ||
347 | return 0; | ||
348 | |||
349 | err_out1: | ||
350 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->fpage, | ||
351 | sgl->fpage_dma_addr); | ||
352 | err_out: | ||
353 | __genwqe_free_consistent(cd, sgl->sgl_size, sgl->sgl, | ||
354 | sgl->sgl_dma_addr); | ||
355 | return -ENOMEM; | ||
299 | } | 356 | } |
300 | 357 | ||
301 | int genwqe_setup_sgl(struct genwqe_dev *cd, | 358 | int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
302 | unsigned long offs, | 359 | dma_addr_t *dma_list) |
303 | unsigned long size, | ||
304 | struct sg_entry *sgl, | ||
305 | dma_addr_t dma_addr, size_t sgl_size, | ||
306 | dma_addr_t *dma_list, int page_offs, int num_pages) | ||
307 | { | 360 | { |
308 | int i = 0, j = 0, p; | 361 | int i = 0, j = 0, p; |
309 | unsigned long dma_offs, map_offs; | 362 | unsigned long dma_offs, map_offs; |
310 | struct pci_dev *pci_dev = cd->pci_dev; | ||
311 | dma_addr_t prev_daddr = 0; | 363 | dma_addr_t prev_daddr = 0; |
312 | struct sg_entry *s, *last_s = NULL; | 364 | struct sg_entry *s, *last_s = NULL; |
313 | 365 | size_t size = sgl->user_size; | |
314 | /* sanity checks */ | ||
315 | if (offs > PAGE_SIZE) { | ||
316 | dev_err(&pci_dev->dev, | ||
317 | "[%s] too large start offs %08lx\n", __func__, offs); | ||
318 | return -EFAULT; | ||
319 | } | ||
320 | if (sgl_size < genwqe_sgl_size(num_pages)) { | ||
321 | dev_err(&pci_dev->dev, | ||
322 | "[%s] sgl_size too small %08lx for %d pages\n", | ||
323 | __func__, sgl_size, num_pages); | ||
324 | return -EFAULT; | ||
325 | } | ||
326 | 366 | ||
327 | dma_offs = 128; /* next block if needed/dma_offset */ | 367 | dma_offs = 128; /* next block if needed/dma_offset */ |
328 | map_offs = offs; /* offset in first page */ | 368 | map_offs = sgl->fpage_offs; /* offset in first page */ |
329 | 369 | ||
330 | s = &sgl[0]; /* first set of 8 entries */ | 370 | s = &sgl->sgl[0]; /* first set of 8 entries */ |
331 | p = 0; /* page */ | 371 | p = 0; /* page */ |
332 | while (p < num_pages) { | 372 | while (p < sgl->nr_pages) { |
333 | dma_addr_t daddr; | 373 | dma_addr_t daddr; |
334 | unsigned int size_to_map; | 374 | unsigned int size_to_map; |
335 | 375 | ||
336 | /* always write the chaining entry, cleanup is done later */ | 376 | /* always write the chaining entry, cleanup is done later */ |
337 | j = 0; | 377 | j = 0; |
338 | s[j].target_addr = cpu_to_be64(dma_addr + dma_offs); | 378 | s[j].target_addr = cpu_to_be64(sgl->sgl_dma_addr + dma_offs); |
339 | s[j].len = cpu_to_be32(128); | 379 | s[j].len = cpu_to_be32(128); |
340 | s[j].flags = cpu_to_be32(SG_CHAINED); | 380 | s[j].flags = cpu_to_be32(SG_CHAINED); |
341 | j++; | 381 | j++; |
@@ -343,7 +383,17 @@ int genwqe_setup_sgl(struct genwqe_dev *cd, | |||
343 | while (j < 8) { | 383 | while (j < 8) { |
344 | /* DMA mapping for requested page, offs, size */ | 384 | /* DMA mapping for requested page, offs, size */ |
345 | size_to_map = min(size, PAGE_SIZE - map_offs); | 385 | size_to_map = min(size, PAGE_SIZE - map_offs); |
346 | daddr = dma_list[page_offs + p] + map_offs; | 386 | |
387 | if ((p == 0) && (sgl->fpage != NULL)) { | ||
388 | daddr = sgl->fpage_dma_addr + map_offs; | ||
389 | |||
390 | } else if ((p == sgl->nr_pages - 1) && | ||
391 | (sgl->lpage != NULL)) { | ||
392 | daddr = sgl->lpage_dma_addr; | ||
393 | } else { | ||
394 | daddr = dma_list[p] + map_offs; | ||
395 | } | ||
396 | |||
347 | size -= size_to_map; | 397 | size -= size_to_map; |
348 | map_offs = 0; | 398 | map_offs = 0; |
349 | 399 | ||
@@ -358,7 +408,7 @@ int genwqe_setup_sgl(struct genwqe_dev *cd, | |||
358 | size_to_map); | 408 | size_to_map); |
359 | 409 | ||
360 | p++; /* process next page */ | 410 | p++; /* process next page */ |
361 | if (p == num_pages) | 411 | if (p == sgl->nr_pages) |
362 | goto fixup; /* nothing to do */ | 412 | goto fixup; /* nothing to do */ |
363 | 413 | ||
364 | prev_daddr = daddr + size_to_map; | 414 | prev_daddr = daddr + size_to_map; |
@@ -374,7 +424,7 @@ int genwqe_setup_sgl(struct genwqe_dev *cd, | |||
374 | j++; | 424 | j++; |
375 | 425 | ||
376 | p++; /* process next page */ | 426 | p++; /* process next page */ |
377 | if (p == num_pages) | 427 | if (p == sgl->nr_pages) |
378 | goto fixup; /* nothing to do */ | 428 | goto fixup; /* nothing to do */ |
379 | } | 429 | } |
380 | dma_offs += 128; | 430 | dma_offs += 128; |
@@ -395,10 +445,50 @@ int genwqe_setup_sgl(struct genwqe_dev *cd, | |||
395 | return 0; | 445 | return 0; |
396 | } | 446 | } |
397 | 447 | ||
398 | void genwqe_free_sgl(struct genwqe_dev *cd, struct sg_entry *sg_list, | 448 | /** |
399 | dma_addr_t dma_addr, size_t size) | 449 | * genwqe_free_sync_sgl() - Free memory for sgl and overlapping pages |
450 | * | ||
451 | * After the DMA transfer has been completed we free the memory for | ||
452 | * the sgl and the cached pages. Data is being transfered from cached | ||
453 | * pages into user-space buffers. | ||
454 | */ | ||
455 | int genwqe_free_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl) | ||
400 | { | 456 | { |
401 | __genwqe_free_consistent(cd, size, sg_list, dma_addr); | 457 | int rc; |
458 | struct pci_dev *pci_dev = cd->pci_dev; | ||
459 | |||
460 | if (sgl->fpage) { | ||
461 | if (copy_to_user(sgl->user_addr, sgl->fpage + sgl->fpage_offs, | ||
462 | sgl->fpage_size)) { | ||
463 | dev_err(&pci_dev->dev, "[%s] err: copying fpage!\n", | ||
464 | __func__); | ||
465 | rc = -EFAULT; | ||
466 | } | ||
467 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->fpage, | ||
468 | sgl->fpage_dma_addr); | ||
469 | sgl->fpage = NULL; | ||
470 | sgl->fpage_dma_addr = 0; | ||
471 | } | ||
472 | if (sgl->lpage) { | ||
473 | if (copy_to_user(sgl->user_addr + sgl->user_size - | ||
474 | sgl->lpage_size, sgl->lpage, | ||
475 | sgl->lpage_size)) { | ||
476 | dev_err(&pci_dev->dev, "[%s] err: copying lpage!\n", | ||
477 | __func__); | ||
478 | rc = -EFAULT; | ||
479 | } | ||
480 | __genwqe_free_consistent(cd, PAGE_SIZE, sgl->lpage, | ||
481 | sgl->lpage_dma_addr); | ||
482 | sgl->lpage = NULL; | ||
483 | sgl->lpage_dma_addr = 0; | ||
484 | } | ||
485 | __genwqe_free_consistent(cd, sgl->sgl_size, sgl->sgl, | ||
486 | sgl->sgl_dma_addr); | ||
487 | |||
488 | sgl->sgl = NULL; | ||
489 | sgl->sgl_dma_addr = 0x0; | ||
490 | sgl->sgl_size = 0; | ||
491 | return rc; | ||
402 | } | 492 | } |
403 | 493 | ||
404 | /** | 494 | /** |
diff --git a/drivers/misc/genwqe/genwqe_driver.h b/drivers/misc/genwqe/genwqe_driver.h index 46e916b36c70..cd5263163a6e 100644 --- a/drivers/misc/genwqe/genwqe_driver.h +++ b/drivers/misc/genwqe/genwqe_driver.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <asm/byteorder.h> | 36 | #include <asm/byteorder.h> |
37 | #include <linux/genwqe/genwqe_card.h> | 37 | #include <linux/genwqe/genwqe_card.h> |
38 | 38 | ||
39 | #define DRV_VERS_STRING "2.0.0" | 39 | #define DRV_VERS_STRING "2.0.15" |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Static minor number assignement, until we decide/implement | 42 | * Static minor number assignement, until we decide/implement |
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h index 66f411a6e8ea..cabc04383685 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h | |||
@@ -115,6 +115,11 @@ | |||
115 | #define MEI_DEV_ID_LPT_HR 0x8CBA /* Lynx Point H Refresh */ | 115 | #define MEI_DEV_ID_LPT_HR 0x8CBA /* Lynx Point H Refresh */ |
116 | 116 | ||
117 | #define MEI_DEV_ID_WPT_LP 0x9CBA /* Wildcat Point LP */ | 117 | #define MEI_DEV_ID_WPT_LP 0x9CBA /* Wildcat Point LP */ |
118 | |||
119 | /* Host Firmware Status Registers in PCI Config Space */ | ||
120 | #define PCI_CFG_HFS_1 0x40 | ||
121 | #define PCI_CFG_HFS_2 0x48 | ||
122 | |||
118 | /* | 123 | /* |
119 | * MEI HW Section | 124 | * MEI HW Section |
120 | */ | 125 | */ |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 29b5af8efb71..4e3cba6da3f5 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -455,8 +455,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) | |||
455 | 455 | ||
456 | cl->status = 0; | 456 | cl->status = 0; |
457 | list_del(&cb->list); | 457 | list_del(&cb->list); |
458 | if (MEI_WRITING == cl->writing_state && | 458 | if (cb->fop_type == MEI_FOP_WRITE && |
459 | cb->fop_type == MEI_FOP_WRITE && | ||
460 | cl != &dev->iamthif_cl) { | 459 | cl != &dev->iamthif_cl) { |
461 | cl_dbg(dev, cl, "MEI WRITE COMPLETE\n"); | 460 | cl_dbg(dev, cl, "MEI WRITE COMPLETE\n"); |
462 | cl->writing_state = MEI_WRITE_COMPLETE; | 461 | cl->writing_state = MEI_WRITE_COMPLETE; |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index b35594dbf52f..147413145c97 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -644,8 +644,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) | |||
644 | goto out; | 644 | goto out; |
645 | } | 645 | } |
646 | 646 | ||
647 | if (MEI_WRITE_COMPLETE == cl->writing_state) | 647 | mask |= (POLLIN | POLLRDNORM); |
648 | mask |= (POLLIN | POLLRDNORM); | ||
649 | 648 | ||
650 | out: | 649 | out: |
651 | mutex_unlock(&dev->device_lock); | 650 | mutex_unlock(&dev->device_lock); |
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index 1c8fd3a3e135..95889e2e31ff 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -97,15 +97,31 @@ static bool mei_me_quirk_probe(struct pci_dev *pdev, | |||
97 | const struct pci_device_id *ent) | 97 | const struct pci_device_id *ent) |
98 | { | 98 | { |
99 | u32 reg; | 99 | u32 reg; |
100 | if (ent->device == MEI_DEV_ID_PBG_1) { | 100 | /* Cougar Point || Patsburg */ |
101 | pci_read_config_dword(pdev, 0x48, ®); | 101 | if (ent->device == MEI_DEV_ID_CPT_1 || |
102 | /* make sure that bit 9 is up and bit 10 is down */ | 102 | ent->device == MEI_DEV_ID_PBG_1) { |
103 | if ((reg & 0x600) == 0x200) { | 103 | pci_read_config_dword(pdev, PCI_CFG_HFS_2, ®); |
104 | dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n"); | 104 | /* make sure that bit 9 (NM) is up and bit 10 (DM) is down */ |
105 | return false; | 105 | if ((reg & 0x600) == 0x200) |
106 | } | 106 | goto no_mei; |
107 | } | 107 | } |
108 | |||
109 | /* Lynx Point */ | ||
110 | if (ent->device == MEI_DEV_ID_LPT_H || | ||
111 | ent->device == MEI_DEV_ID_LPT_W || | ||
112 | ent->device == MEI_DEV_ID_LPT_HR) { | ||
113 | /* Read ME FW Status check for SPS Firmware */ | ||
114 | pci_read_config_dword(pdev, PCI_CFG_HFS_1, ®); | ||
115 | /* if bits [19:16] = 15, running SPS Firmware */ | ||
116 | if ((reg & 0xf0000) == 0xf0000) | ||
117 | goto no_mei; | ||
118 | } | ||
119 | |||
108 | return true; | 120 | return true; |
121 | |||
122 | no_mei: | ||
123 | dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n"); | ||
124 | return false; | ||
109 | } | 125 | } |
110 | /** | 126 | /** |
111 | * mei_probe - Device Initialization Routine | 127 | * mei_probe - Device Initialization Routine |
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 363da96e6891..c4176b0f382d 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * Copyright © 2010 STMicroelectronics. | 7 | * Copyright © 2010 STMicroelectronics. |
8 | * Ashish Priyadarshi | 8 | * Ashish Priyadarshi |
9 | * Shiraz Hashim <shiraz.hashim@st.com> | 9 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
10 | * | 10 | * |
11 | * This file is licensed under the terms of the GNU General Public | 11 | * This file is licensed under the terms of the GNU General Public |
12 | * License version 2. This program is licensed "as is" without any | 12 | * License version 2. This program is licensed "as is" without any |
@@ -1089,5 +1089,5 @@ static struct platform_driver spear_smi_driver = { | |||
1089 | module_platform_driver(spear_smi_driver); | 1089 | module_platform_driver(spear_smi_driver); |
1090 | 1090 | ||
1091 | MODULE_LICENSE("GPL"); | 1091 | MODULE_LICENSE("GPL"); |
1092 | MODULE_AUTHOR("Ashish Priyadarshi, Shiraz Hashim <shiraz.hashim@st.com>"); | 1092 | MODULE_AUTHOR("Ashish Priyadarshi, Shiraz Hashim <shiraz.linux.kernel@gmail.com>"); |
1093 | MODULE_DESCRIPTION("MTD SMI driver for serial nor flash chips"); | 1093 | MODULE_DESCRIPTION("MTD SMI driver for serial nor flash chips"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index a8efb18e42fa..0ab83708b6a1 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -8627,6 +8627,7 @@ bnx2_remove_one(struct pci_dev *pdev) | |||
8627 | pci_disable_device(pdev); | 8627 | pci_disable_device(pdev); |
8628 | } | 8628 | } |
8629 | 8629 | ||
8630 | #ifdef CONFIG_PM_SLEEP | ||
8630 | static int | 8631 | static int |
8631 | bnx2_suspend(struct device *device) | 8632 | bnx2_suspend(struct device *device) |
8632 | { | 8633 | { |
@@ -8665,7 +8666,6 @@ bnx2_resume(struct device *device) | |||
8665 | return 0; | 8666 | return 0; |
8666 | } | 8667 | } |
8667 | 8668 | ||
8668 | #ifdef CONFIG_PM_SLEEP | ||
8669 | static SIMPLE_DEV_PM_OPS(bnx2_pm_ops, bnx2_suspend, bnx2_resume); | 8669 | static SIMPLE_DEV_PM_OPS(bnx2_pm_ops, bnx2_suspend, bnx2_resume); |
8670 | #define BNX2_PM_OPS (&bnx2_pm_ops) | 8670 | #define BNX2_PM_OPS (&bnx2_pm_ops) |
8671 | 8671 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index b9f7022f4e81..e5d95c5ce1ad 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -12286,7 +12286,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e | |||
12286 | if (tg3_flag(tp, MAX_RXPEND_64) && | 12286 | if (tg3_flag(tp, MAX_RXPEND_64) && |
12287 | tp->rx_pending > 63) | 12287 | tp->rx_pending > 63) |
12288 | tp->rx_pending = 63; | 12288 | tp->rx_pending = 63; |
12289 | tp->rx_jumbo_pending = ering->rx_jumbo_pending; | 12289 | |
12290 | if (tg3_flag(tp, JUMBO_RING_ENABLE)) | ||
12291 | tp->rx_jumbo_pending = ering->rx_jumbo_pending; | ||
12290 | 12292 | ||
12291 | for (i = 0; i < tp->irq_max; i++) | 12293 | for (i = 0; i < tp->irq_max; i++) |
12292 | tp->napi[i].tx_pending = ering->tx_pending; | 12294 | tp->napi[i].tx_pending = ering->tx_pending; |
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig index 751d5c7b312d..7e49c43b7af3 100644 --- a/drivers/net/ethernet/cadence/Kconfig +++ b/drivers/net/ethernet/cadence/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config NET_CADENCE | 5 | config NET_CADENCE |
6 | bool "Cadence devices" | 6 | bool "Cadence devices" |
7 | depends on HAS_IOMEM | 7 | depends on HAS_IOMEM && (ARM || AVR32 || COMPILE_TEST) |
8 | default y | 8 | default y |
9 | ---help--- | 9 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y. | 10 | If you have a network (Ethernet) card belonging to this class, say Y. |
@@ -22,7 +22,7 @@ if NET_CADENCE | |||
22 | 22 | ||
23 | config ARM_AT91_ETHER | 23 | config ARM_AT91_ETHER |
24 | tristate "AT91RM9200 Ethernet support" | 24 | tristate "AT91RM9200 Ethernet support" |
25 | depends on HAS_DMA | 25 | depends on HAS_DMA && (ARCH_AT91RM9200 || COMPILE_TEST) |
26 | select MACB | 26 | select MACB |
27 | ---help--- | 27 | ---help--- |
28 | If you wish to compile a kernel for the AT91RM9200 and enable | 28 | If you wish to compile a kernel for the AT91RM9200 and enable |
@@ -30,7 +30,7 @@ config ARM_AT91_ETHER | |||
30 | 30 | ||
31 | config MACB | 31 | config MACB |
32 | tristate "Cadence MACB/GEM support" | 32 | tristate "Cadence MACB/GEM support" |
33 | depends on HAS_DMA | 33 | depends on HAS_DMA && (PLATFORM_AT32AP || ARCH_AT91 || ARCH_PICOXCELL || ARCH_ZYNQ || COMPILE_TEST) |
34 | select PHYLIB | 34 | select PHYLIB |
35 | ---help--- | 35 | ---help--- |
36 | The Cadence MACB ethernet interface is found on many Atmel AT32 and | 36 | The Cadence MACB ethernet interface is found on many Atmel AT32 and |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c index 81e8402a74b4..8a96572fdde0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c +++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c | |||
@@ -154,7 +154,7 @@ static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync) | |||
154 | req->params = htons(L2T_W_PORT(e->lport) | L2T_W_NOREPLY(!sync)); | 154 | req->params = htons(L2T_W_PORT(e->lport) | L2T_W_NOREPLY(!sync)); |
155 | req->l2t_idx = htons(e->idx); | 155 | req->l2t_idx = htons(e->idx); |
156 | req->vlan = htons(e->vlan); | 156 | req->vlan = htons(e->vlan); |
157 | if (e->neigh) | 157 | if (e->neigh && !(e->neigh->dev->flags & IFF_LOOPBACK)) |
158 | memcpy(e->dmac, e->neigh->ha, sizeof(e->dmac)); | 158 | memcpy(e->dmac, e->neigh->ha, sizeof(e->dmac)); |
159 | memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); | 159 | memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac)); |
160 | 160 | ||
@@ -394,6 +394,8 @@ struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh, | |||
394 | if (e) { | 394 | if (e) { |
395 | spin_lock(&e->lock); /* avoid race with t4_l2t_free */ | 395 | spin_lock(&e->lock); /* avoid race with t4_l2t_free */ |
396 | e->state = L2T_STATE_RESOLVING; | 396 | e->state = L2T_STATE_RESOLVING; |
397 | if (neigh->dev->flags & IFF_LOOPBACK) | ||
398 | memcpy(e->dmac, physdev->dev_addr, sizeof(e->dmac)); | ||
397 | memcpy(e->addr, addr, addr_len); | 399 | memcpy(e->addr, addr, addr_len); |
398 | e->ifindex = ifidx; | 400 | e->ifindex = ifidx; |
399 | e->hash = hash; | 401 | e->hash = hash; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index fb2fe65903c2..bba67681aeaa 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -682,7 +682,7 @@ enum { | |||
682 | SF_RD_ID = 0x9f, /* read ID */ | 682 | SF_RD_ID = 0x9f, /* read ID */ |
683 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ | 683 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ |
684 | 684 | ||
685 | FW_MAX_SIZE = 512 * 1024, | 685 | FW_MAX_SIZE = 16 * SF_SEC_SIZE, |
686 | }; | 686 | }; |
687 | 687 | ||
688 | /** | 688 | /** |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 8ccaa2520dc3..97db5a7179df 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -374,6 +374,7 @@ enum vf_state { | |||
374 | #define BE_FLAGS_NAPI_ENABLED (1 << 9) | 374 | #define BE_FLAGS_NAPI_ENABLED (1 << 9) |
375 | #define BE_FLAGS_QNQ_ASYNC_EVT_RCVD (1 << 11) | 375 | #define BE_FLAGS_QNQ_ASYNC_EVT_RCVD (1 << 11) |
376 | #define BE_FLAGS_VXLAN_OFFLOADS (1 << 12) | 376 | #define BE_FLAGS_VXLAN_OFFLOADS (1 << 12) |
377 | #define BE_FLAGS_SETUP_DONE (1 << 13) | ||
377 | 378 | ||
378 | #define BE_UC_PMAC_COUNT 30 | 379 | #define BE_UC_PMAC_COUNT 30 |
379 | #define BE_VF_UC_PMAC_COUNT 2 | 380 | #define BE_VF_UC_PMAC_COUNT 2 |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 3e6df47b6973..a18645407d21 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -2033,11 +2033,13 @@ static void be_tx_compl_clean(struct be_adapter *adapter) | |||
2033 | bool dummy_wrb; | 2033 | bool dummy_wrb; |
2034 | int i, pending_txqs; | 2034 | int i, pending_txqs; |
2035 | 2035 | ||
2036 | /* Wait for a max of 200ms for all the tx-completions to arrive. */ | 2036 | /* Stop polling for compls when HW has been silent for 10ms */ |
2037 | do { | 2037 | do { |
2038 | pending_txqs = adapter->num_tx_qs; | 2038 | pending_txqs = adapter->num_tx_qs; |
2039 | 2039 | ||
2040 | for_all_tx_queues(adapter, txo, i) { | 2040 | for_all_tx_queues(adapter, txo, i) { |
2041 | cmpl = 0; | ||
2042 | num_wrbs = 0; | ||
2041 | txq = &txo->q; | 2043 | txq = &txo->q; |
2042 | while ((txcp = be_tx_compl_get(&txo->cq))) { | 2044 | while ((txcp = be_tx_compl_get(&txo->cq))) { |
2043 | end_idx = | 2045 | end_idx = |
@@ -2050,14 +2052,13 @@ static void be_tx_compl_clean(struct be_adapter *adapter) | |||
2050 | if (cmpl) { | 2052 | if (cmpl) { |
2051 | be_cq_notify(adapter, txo->cq.id, false, cmpl); | 2053 | be_cq_notify(adapter, txo->cq.id, false, cmpl); |
2052 | atomic_sub(num_wrbs, &txq->used); | 2054 | atomic_sub(num_wrbs, &txq->used); |
2053 | cmpl = 0; | 2055 | timeo = 0; |
2054 | num_wrbs = 0; | ||
2055 | } | 2056 | } |
2056 | if (atomic_read(&txq->used) == 0) | 2057 | if (atomic_read(&txq->used) == 0) |
2057 | pending_txqs--; | 2058 | pending_txqs--; |
2058 | } | 2059 | } |
2059 | 2060 | ||
2060 | if (pending_txqs == 0 || ++timeo > 200) | 2061 | if (pending_txqs == 0 || ++timeo > 10 || be_hw_error(adapter)) |
2061 | break; | 2062 | break; |
2062 | 2063 | ||
2063 | mdelay(1); | 2064 | mdelay(1); |
@@ -2725,6 +2726,12 @@ static int be_close(struct net_device *netdev) | |||
2725 | struct be_eq_obj *eqo; | 2726 | struct be_eq_obj *eqo; |
2726 | int i; | 2727 | int i; |
2727 | 2728 | ||
2729 | /* This protection is needed as be_close() may be called even when the | ||
2730 | * adapter is in cleared state (after eeh perm failure) | ||
2731 | */ | ||
2732 | if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) | ||
2733 | return 0; | ||
2734 | |||
2728 | be_roce_dev_close(adapter); | 2735 | be_roce_dev_close(adapter); |
2729 | 2736 | ||
2730 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { | 2737 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { |
@@ -3055,6 +3062,7 @@ static int be_clear(struct be_adapter *adapter) | |||
3055 | be_clear_queues(adapter); | 3062 | be_clear_queues(adapter); |
3056 | 3063 | ||
3057 | be_msix_disable(adapter); | 3064 | be_msix_disable(adapter); |
3065 | adapter->flags &= ~BE_FLAGS_SETUP_DONE; | ||
3058 | return 0; | 3066 | return 0; |
3059 | } | 3067 | } |
3060 | 3068 | ||
@@ -3559,6 +3567,7 @@ static int be_setup(struct be_adapter *adapter) | |||
3559 | adapter->phy.fc_autoneg = 1; | 3567 | adapter->phy.fc_autoneg = 1; |
3560 | 3568 | ||
3561 | be_schedule_worker(adapter); | 3569 | be_schedule_worker(adapter); |
3570 | adapter->flags |= BE_FLAGS_SETUP_DONE; | ||
3562 | return 0; | 3571 | return 0; |
3563 | err: | 3572 | err: |
3564 | be_clear(adapter); | 3573 | be_clear(adapter); |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index d04b1c3c9b85..14786c8bf99e 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -91,7 +91,7 @@ | |||
91 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c | 91 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c |
92 | #define MVNETA_SERDES_CFG 0x24A0 | 92 | #define MVNETA_SERDES_CFG 0x24A0 |
93 | #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 | 93 | #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 |
94 | #define MVNETA_RGMII_SERDES_PROTO 0x0667 | 94 | #define MVNETA_QSGMII_SERDES_PROTO 0x0667 |
95 | #define MVNETA_TYPE_PRIO 0x24bc | 95 | #define MVNETA_TYPE_PRIO 0x24bc |
96 | #define MVNETA_FORCE_UNI BIT(21) | 96 | #define MVNETA_FORCE_UNI BIT(21) |
97 | #define MVNETA_TXQ_CMD_1 0x24e4 | 97 | #define MVNETA_TXQ_CMD_1 0x24e4 |
@@ -2721,29 +2721,44 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp, | |||
2721 | } | 2721 | } |
2722 | 2722 | ||
2723 | /* Power up the port */ | 2723 | /* Power up the port */ |
2724 | static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) | 2724 | static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) |
2725 | { | 2725 | { |
2726 | u32 val; | 2726 | u32 ctrl; |
2727 | 2727 | ||
2728 | /* MAC Cause register should be cleared */ | 2728 | /* MAC Cause register should be cleared */ |
2729 | mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); | 2729 | mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); |
2730 | 2730 | ||
2731 | if (phy_mode == PHY_INTERFACE_MODE_SGMII) | 2731 | ctrl = mvreg_read(pp, MVNETA_GMAC_CTRL_2); |
2732 | mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); | ||
2733 | else | ||
2734 | mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO); | ||
2735 | 2732 | ||
2736 | val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); | 2733 | /* Even though it might look weird, when we're configured in |
2737 | 2734 | * SGMII or QSGMII mode, the RGMII bit needs to be set. | |
2738 | val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; | 2735 | */ |
2736 | switch(phy_mode) { | ||
2737 | case PHY_INTERFACE_MODE_QSGMII: | ||
2738 | mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO); | ||
2739 | ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; | ||
2740 | break; | ||
2741 | case PHY_INTERFACE_MODE_SGMII: | ||
2742 | mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); | ||
2743 | ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; | ||
2744 | break; | ||
2745 | case PHY_INTERFACE_MODE_RGMII: | ||
2746 | case PHY_INTERFACE_MODE_RGMII_ID: | ||
2747 | ctrl |= MVNETA_GMAC2_PORT_RGMII; | ||
2748 | break; | ||
2749 | default: | ||
2750 | return -EINVAL; | ||
2751 | } | ||
2739 | 2752 | ||
2740 | /* Cancel Port Reset */ | 2753 | /* Cancel Port Reset */ |
2741 | val &= ~MVNETA_GMAC2_PORT_RESET; | 2754 | ctrl &= ~MVNETA_GMAC2_PORT_RESET; |
2742 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); | 2755 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl); |
2743 | 2756 | ||
2744 | while ((mvreg_read(pp, MVNETA_GMAC_CTRL_2) & | 2757 | while ((mvreg_read(pp, MVNETA_GMAC_CTRL_2) & |
2745 | MVNETA_GMAC2_PORT_RESET) != 0) | 2758 | MVNETA_GMAC2_PORT_RESET) != 0) |
2746 | continue; | 2759 | continue; |
2760 | |||
2761 | return 0; | ||
2747 | } | 2762 | } |
2748 | 2763 | ||
2749 | /* Device initialization routine */ | 2764 | /* Device initialization routine */ |
@@ -2854,7 +2869,12 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2854 | dev_err(&pdev->dev, "can't init eth hal\n"); | 2869 | dev_err(&pdev->dev, "can't init eth hal\n"); |
2855 | goto err_free_stats; | 2870 | goto err_free_stats; |
2856 | } | 2871 | } |
2857 | mvneta_port_power_up(pp, phy_mode); | 2872 | |
2873 | err = mvneta_port_power_up(pp, phy_mode); | ||
2874 | if (err < 0) { | ||
2875 | dev_err(&pdev->dev, "can't power up port\n"); | ||
2876 | goto err_deinit; | ||
2877 | } | ||
2858 | 2878 | ||
2859 | dram_target_info = mv_mbus_dram_info(); | 2879 | dram_target_info = mv_mbus_dram_info(); |
2860 | if (dram_target_info) | 2880 | if (dram_target_info) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c index 70e95324a97d..c2cd8d31bcad 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c | |||
@@ -66,7 +66,6 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv, | |||
66 | 66 | ||
67 | cq->ring = ring; | 67 | cq->ring = ring; |
68 | cq->is_tx = mode; | 68 | cq->is_tx = mode; |
69 | spin_lock_init(&cq->lock); | ||
70 | 69 | ||
71 | /* Allocate HW buffers on provided NUMA node. | 70 | /* Allocate HW buffers on provided NUMA node. |
72 | * dev->numa_node is used in mtt range allocation flow. | 71 | * dev->numa_node is used in mtt range allocation flow. |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f085c2df5e69..7e4b1720c3d1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1304,15 +1304,11 @@ static void mlx4_en_netpoll(struct net_device *dev) | |||
1304 | { | 1304 | { |
1305 | struct mlx4_en_priv *priv = netdev_priv(dev); | 1305 | struct mlx4_en_priv *priv = netdev_priv(dev); |
1306 | struct mlx4_en_cq *cq; | 1306 | struct mlx4_en_cq *cq; |
1307 | unsigned long flags; | ||
1308 | int i; | 1307 | int i; |
1309 | 1308 | ||
1310 | for (i = 0; i < priv->rx_ring_num; i++) { | 1309 | for (i = 0; i < priv->rx_ring_num; i++) { |
1311 | cq = priv->rx_cq[i]; | 1310 | cq = priv->rx_cq[i]; |
1312 | spin_lock_irqsave(&cq->lock, flags); | 1311 | napi_schedule(&cq->napi); |
1313 | napi_synchronize(&cq->napi); | ||
1314 | mlx4_en_process_rx_cq(dev, cq, 0); | ||
1315 | spin_unlock_irqrestore(&cq->lock, flags); | ||
1316 | } | 1312 | } |
1317 | } | 1313 | } |
1318 | #endif | 1314 | #endif |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index f0ae95f66ceb..cef267e24f9c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2301,13 +2301,8 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) | |||
2301 | /* Allow large DMA segments, up to the firmware limit of 1 GB */ | 2301 | /* Allow large DMA segments, up to the firmware limit of 1 GB */ |
2302 | dma_set_max_seg_size(&pdev->dev, 1024 * 1024 * 1024); | 2302 | dma_set_max_seg_size(&pdev->dev, 1024 * 1024 * 1024); |
2303 | 2303 | ||
2304 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 2304 | dev = pci_get_drvdata(pdev); |
2305 | if (!priv) { | 2305 | priv = mlx4_priv(dev); |
2306 | err = -ENOMEM; | ||
2307 | goto err_release_regions; | ||
2308 | } | ||
2309 | |||
2310 | dev = &priv->dev; | ||
2311 | dev->pdev = pdev; | 2306 | dev->pdev = pdev; |
2312 | INIT_LIST_HEAD(&priv->ctx_list); | 2307 | INIT_LIST_HEAD(&priv->ctx_list); |
2313 | spin_lock_init(&priv->ctx_lock); | 2308 | spin_lock_init(&priv->ctx_lock); |
@@ -2374,10 +2369,10 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) | |||
2374 | } else { | 2369 | } else { |
2375 | atomic_inc(&pf_loading); | 2370 | atomic_inc(&pf_loading); |
2376 | err = pci_enable_sriov(pdev, total_vfs); | 2371 | err = pci_enable_sriov(pdev, total_vfs); |
2377 | atomic_dec(&pf_loading); | ||
2378 | if (err) { | 2372 | if (err) { |
2379 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", | 2373 | mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", |
2380 | err); | 2374 | err); |
2375 | atomic_dec(&pf_loading); | ||
2381 | err = 0; | 2376 | err = 0; |
2382 | } else { | 2377 | } else { |
2383 | mlx4_warn(dev, "Running in master mode\n"); | 2378 | mlx4_warn(dev, "Running in master mode\n"); |
@@ -2535,8 +2530,10 @@ slave_start: | |||
2535 | mlx4_sense_init(dev); | 2530 | mlx4_sense_init(dev); |
2536 | mlx4_start_sense(dev); | 2531 | mlx4_start_sense(dev); |
2537 | 2532 | ||
2538 | priv->pci_dev_data = pci_dev_data; | 2533 | priv->removed = 0; |
2539 | pci_set_drvdata(pdev, dev); | 2534 | |
2535 | if (mlx4_is_master(dev) && dev->num_vfs) | ||
2536 | atomic_dec(&pf_loading); | ||
2540 | 2537 | ||
2541 | return 0; | 2538 | return 0; |
2542 | 2539 | ||
@@ -2588,6 +2585,9 @@ err_rel_own: | |||
2588 | if (!mlx4_is_slave(dev)) | 2585 | if (!mlx4_is_slave(dev)) |
2589 | mlx4_free_ownership(dev); | 2586 | mlx4_free_ownership(dev); |
2590 | 2587 | ||
2588 | if (mlx4_is_master(dev) && dev->num_vfs) | ||
2589 | atomic_dec(&pf_loading); | ||
2590 | |||
2591 | kfree(priv->dev.dev_vfs); | 2591 | kfree(priv->dev.dev_vfs); |
2592 | 2592 | ||
2593 | err_free_dev: | 2593 | err_free_dev: |
@@ -2604,85 +2604,110 @@ err_disable_pdev: | |||
2604 | 2604 | ||
2605 | static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 2605 | static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
2606 | { | 2606 | { |
2607 | struct mlx4_priv *priv; | ||
2608 | struct mlx4_dev *dev; | ||
2609 | |||
2607 | printk_once(KERN_INFO "%s", mlx4_version); | 2610 | printk_once(KERN_INFO "%s", mlx4_version); |
2608 | 2611 | ||
2612 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
2613 | if (!priv) | ||
2614 | return -ENOMEM; | ||
2615 | |||
2616 | dev = &priv->dev; | ||
2617 | pci_set_drvdata(pdev, dev); | ||
2618 | priv->pci_dev_data = id->driver_data; | ||
2619 | |||
2609 | return __mlx4_init_one(pdev, id->driver_data); | 2620 | return __mlx4_init_one(pdev, id->driver_data); |
2610 | } | 2621 | } |
2611 | 2622 | ||
2612 | static void mlx4_remove_one(struct pci_dev *pdev) | 2623 | static void __mlx4_remove_one(struct pci_dev *pdev) |
2613 | { | 2624 | { |
2614 | struct mlx4_dev *dev = pci_get_drvdata(pdev); | 2625 | struct mlx4_dev *dev = pci_get_drvdata(pdev); |
2615 | struct mlx4_priv *priv = mlx4_priv(dev); | 2626 | struct mlx4_priv *priv = mlx4_priv(dev); |
2627 | int pci_dev_data; | ||
2616 | int p; | 2628 | int p; |
2617 | 2629 | ||
2618 | if (dev) { | 2630 | if (priv->removed) |
2619 | /* in SRIOV it is not allowed to unload the pf's | 2631 | return; |
2620 | * driver while there are alive vf's */ | ||
2621 | if (mlx4_is_master(dev)) { | ||
2622 | if (mlx4_how_many_lives_vf(dev)) | ||
2623 | printk(KERN_ERR "Removing PF when there are assigned VF's !!!\n"); | ||
2624 | } | ||
2625 | mlx4_stop_sense(dev); | ||
2626 | mlx4_unregister_device(dev); | ||
2627 | 2632 | ||
2628 | for (p = 1; p <= dev->caps.num_ports; p++) { | 2633 | pci_dev_data = priv->pci_dev_data; |
2629 | mlx4_cleanup_port_info(&priv->port[p]); | ||
2630 | mlx4_CLOSE_PORT(dev, p); | ||
2631 | } | ||
2632 | 2634 | ||
2633 | if (mlx4_is_master(dev)) | 2635 | /* in SRIOV it is not allowed to unload the pf's |
2634 | mlx4_free_resource_tracker(dev, | 2636 | * driver while there are alive vf's */ |
2635 | RES_TR_FREE_SLAVES_ONLY); | 2637 | if (mlx4_is_master(dev) && mlx4_how_many_lives_vf(dev)) |
2636 | 2638 | printk(KERN_ERR "Removing PF when there are assigned VF's !!!\n"); | |
2637 | mlx4_cleanup_counters_table(dev); | 2639 | mlx4_stop_sense(dev); |
2638 | mlx4_cleanup_qp_table(dev); | 2640 | mlx4_unregister_device(dev); |
2639 | mlx4_cleanup_srq_table(dev); | ||
2640 | mlx4_cleanup_cq_table(dev); | ||
2641 | mlx4_cmd_use_polling(dev); | ||
2642 | mlx4_cleanup_eq_table(dev); | ||
2643 | mlx4_cleanup_mcg_table(dev); | ||
2644 | mlx4_cleanup_mr_table(dev); | ||
2645 | mlx4_cleanup_xrcd_table(dev); | ||
2646 | mlx4_cleanup_pd_table(dev); | ||
2647 | 2641 | ||
2648 | if (mlx4_is_master(dev)) | 2642 | for (p = 1; p <= dev->caps.num_ports; p++) { |
2649 | mlx4_free_resource_tracker(dev, | 2643 | mlx4_cleanup_port_info(&priv->port[p]); |
2650 | RES_TR_FREE_STRUCTS_ONLY); | 2644 | mlx4_CLOSE_PORT(dev, p); |
2651 | 2645 | } | |
2652 | iounmap(priv->kar); | ||
2653 | mlx4_uar_free(dev, &priv->driver_uar); | ||
2654 | mlx4_cleanup_uar_table(dev); | ||
2655 | if (!mlx4_is_slave(dev)) | ||
2656 | mlx4_clear_steering(dev); | ||
2657 | mlx4_free_eq_table(dev); | ||
2658 | if (mlx4_is_master(dev)) | ||
2659 | mlx4_multi_func_cleanup(dev); | ||
2660 | mlx4_close_hca(dev); | ||
2661 | if (mlx4_is_slave(dev)) | ||
2662 | mlx4_multi_func_cleanup(dev); | ||
2663 | mlx4_cmd_cleanup(dev); | ||
2664 | |||
2665 | if (dev->flags & MLX4_FLAG_MSI_X) | ||
2666 | pci_disable_msix(pdev); | ||
2667 | if (dev->flags & MLX4_FLAG_SRIOV) { | ||
2668 | mlx4_warn(dev, "Disabling SR-IOV\n"); | ||
2669 | pci_disable_sriov(pdev); | ||
2670 | } | ||
2671 | 2646 | ||
2672 | if (!mlx4_is_slave(dev)) | 2647 | if (mlx4_is_master(dev)) |
2673 | mlx4_free_ownership(dev); | 2648 | mlx4_free_resource_tracker(dev, |
2649 | RES_TR_FREE_SLAVES_ONLY); | ||
2674 | 2650 | ||
2675 | kfree(dev->caps.qp0_tunnel); | 2651 | mlx4_cleanup_counters_table(dev); |
2676 | kfree(dev->caps.qp0_proxy); | 2652 | mlx4_cleanup_qp_table(dev); |
2677 | kfree(dev->caps.qp1_tunnel); | 2653 | mlx4_cleanup_srq_table(dev); |
2678 | kfree(dev->caps.qp1_proxy); | 2654 | mlx4_cleanup_cq_table(dev); |
2679 | kfree(dev->dev_vfs); | 2655 | mlx4_cmd_use_polling(dev); |
2656 | mlx4_cleanup_eq_table(dev); | ||
2657 | mlx4_cleanup_mcg_table(dev); | ||
2658 | mlx4_cleanup_mr_table(dev); | ||
2659 | mlx4_cleanup_xrcd_table(dev); | ||
2660 | mlx4_cleanup_pd_table(dev); | ||
2680 | 2661 | ||
2681 | kfree(priv); | 2662 | if (mlx4_is_master(dev)) |
2682 | pci_release_regions(pdev); | 2663 | mlx4_free_resource_tracker(dev, |
2683 | pci_disable_device(pdev); | 2664 | RES_TR_FREE_STRUCTS_ONLY); |
2684 | pci_set_drvdata(pdev, NULL); | 2665 | |
2666 | iounmap(priv->kar); | ||
2667 | mlx4_uar_free(dev, &priv->driver_uar); | ||
2668 | mlx4_cleanup_uar_table(dev); | ||
2669 | if (!mlx4_is_slave(dev)) | ||
2670 | mlx4_clear_steering(dev); | ||
2671 | mlx4_free_eq_table(dev); | ||
2672 | if (mlx4_is_master(dev)) | ||
2673 | mlx4_multi_func_cleanup(dev); | ||
2674 | mlx4_close_hca(dev); | ||
2675 | if (mlx4_is_slave(dev)) | ||
2676 | mlx4_multi_func_cleanup(dev); | ||
2677 | mlx4_cmd_cleanup(dev); | ||
2678 | |||
2679 | if (dev->flags & MLX4_FLAG_MSI_X) | ||
2680 | pci_disable_msix(pdev); | ||
2681 | if (dev->flags & MLX4_FLAG_SRIOV) { | ||
2682 | mlx4_warn(dev, "Disabling SR-IOV\n"); | ||
2683 | pci_disable_sriov(pdev); | ||
2684 | dev->num_vfs = 0; | ||
2685 | } | 2685 | } |
2686 | |||
2687 | if (!mlx4_is_slave(dev)) | ||
2688 | mlx4_free_ownership(dev); | ||
2689 | |||
2690 | kfree(dev->caps.qp0_tunnel); | ||
2691 | kfree(dev->caps.qp0_proxy); | ||
2692 | kfree(dev->caps.qp1_tunnel); | ||
2693 | kfree(dev->caps.qp1_proxy); | ||
2694 | kfree(dev->dev_vfs); | ||
2695 | |||
2696 | pci_release_regions(pdev); | ||
2697 | pci_disable_device(pdev); | ||
2698 | memset(priv, 0, sizeof(*priv)); | ||
2699 | priv->pci_dev_data = pci_dev_data; | ||
2700 | priv->removed = 1; | ||
2701 | } | ||
2702 | |||
2703 | static void mlx4_remove_one(struct pci_dev *pdev) | ||
2704 | { | ||
2705 | struct mlx4_dev *dev = pci_get_drvdata(pdev); | ||
2706 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
2707 | |||
2708 | __mlx4_remove_one(pdev); | ||
2709 | kfree(priv); | ||
2710 | pci_set_drvdata(pdev, NULL); | ||
2686 | } | 2711 | } |
2687 | 2712 | ||
2688 | int mlx4_restart_one(struct pci_dev *pdev) | 2713 | int mlx4_restart_one(struct pci_dev *pdev) |
@@ -2692,7 +2717,7 @@ int mlx4_restart_one(struct pci_dev *pdev) | |||
2692 | int pci_dev_data; | 2717 | int pci_dev_data; |
2693 | 2718 | ||
2694 | pci_dev_data = priv->pci_dev_data; | 2719 | pci_dev_data = priv->pci_dev_data; |
2695 | mlx4_remove_one(pdev); | 2720 | __mlx4_remove_one(pdev); |
2696 | return __mlx4_init_one(pdev, pci_dev_data); | 2721 | return __mlx4_init_one(pdev, pci_dev_data); |
2697 | } | 2722 | } |
2698 | 2723 | ||
@@ -2747,7 +2772,7 @@ MODULE_DEVICE_TABLE(pci, mlx4_pci_table); | |||
2747 | static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev, | 2772 | static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev, |
2748 | pci_channel_state_t state) | 2773 | pci_channel_state_t state) |
2749 | { | 2774 | { |
2750 | mlx4_remove_one(pdev); | 2775 | __mlx4_remove_one(pdev); |
2751 | 2776 | ||
2752 | return state == pci_channel_io_perm_failure ? | 2777 | return state == pci_channel_io_perm_failure ? |
2753 | PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; | 2778 | PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; |
@@ -2755,11 +2780,11 @@ static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev, | |||
2755 | 2780 | ||
2756 | static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) | 2781 | static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) |
2757 | { | 2782 | { |
2758 | const struct pci_device_id *id; | 2783 | struct mlx4_dev *dev = pci_get_drvdata(pdev); |
2759 | int ret; | 2784 | struct mlx4_priv *priv = mlx4_priv(dev); |
2785 | int ret; | ||
2760 | 2786 | ||
2761 | id = pci_match_id(mlx4_pci_table, pdev); | 2787 | ret = __mlx4_init_one(pdev, priv->pci_dev_data); |
2762 | ret = __mlx4_init_one(pdev, id->driver_data); | ||
2763 | 2788 | ||
2764 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; | 2789 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
2765 | } | 2790 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index cf8be41abb36..f9c465101963 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -800,6 +800,7 @@ struct mlx4_priv { | |||
800 | spinlock_t ctx_lock; | 800 | spinlock_t ctx_lock; |
801 | 801 | ||
802 | int pci_dev_data; | 802 | int pci_dev_data; |
803 | int removed; | ||
803 | 804 | ||
804 | struct list_head pgdir_list; | 805 | struct list_head pgdir_list; |
805 | struct mutex pgdir_mutex; | 806 | struct mutex pgdir_mutex; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 7a733c287744..04d9b6fe3e80 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -319,7 +319,6 @@ struct mlx4_en_cq { | |||
319 | struct mlx4_cq mcq; | 319 | struct mlx4_cq mcq; |
320 | struct mlx4_hwq_resources wqres; | 320 | struct mlx4_hwq_resources wqres; |
321 | int ring; | 321 | int ring; |
322 | spinlock_t lock; | ||
323 | struct net_device *dev; | 322 | struct net_device *dev; |
324 | struct napi_struct napi; | 323 | struct napi_struct napi; |
325 | int size; | 324 | int size; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index b48737dcd3c5..ba20c721ee97 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -2139,8 +2139,6 @@ static int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter) | |||
2139 | ahw->max_mac_filters = nic_info.max_mac_filters; | 2139 | ahw->max_mac_filters = nic_info.max_mac_filters; |
2140 | ahw->max_mtu = nic_info.max_mtu; | 2140 | ahw->max_mtu = nic_info.max_mtu; |
2141 | 2141 | ||
2142 | adapter->max_tx_rings = ahw->max_tx_ques; | ||
2143 | adapter->max_sds_rings = ahw->max_rx_ques; | ||
2144 | /* eSwitch capability indicates vNIC mode. | 2142 | /* eSwitch capability indicates vNIC mode. |
2145 | * vNIC and SRIOV are mutually exclusive operational modes. | 2143 | * vNIC and SRIOV are mutually exclusive operational modes. |
2146 | * If SR-IOV capability is detected, SR-IOV physical function | 2144 | * If SR-IOV capability is detected, SR-IOV physical function |
@@ -2161,6 +2159,7 @@ static int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter) | |||
2161 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) | 2159 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) |
2162 | { | 2160 | { |
2163 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 2161 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
2162 | u16 max_sds_rings, max_tx_rings; | ||
2164 | int ret; | 2163 | int ret; |
2165 | 2164 | ||
2166 | ret = qlcnic_83xx_get_nic_configuration(adapter); | 2165 | ret = qlcnic_83xx_get_nic_configuration(adapter); |
@@ -2173,18 +2172,21 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) | |||
2173 | if (qlcnic_83xx_config_vnic_opmode(adapter)) | 2172 | if (qlcnic_83xx_config_vnic_opmode(adapter)) |
2174 | return -EIO; | 2173 | return -EIO; |
2175 | 2174 | ||
2176 | adapter->max_sds_rings = QLCNIC_MAX_VNIC_SDS_RINGS; | 2175 | max_sds_rings = QLCNIC_MAX_VNIC_SDS_RINGS; |
2177 | adapter->max_tx_rings = QLCNIC_MAX_VNIC_TX_RINGS; | 2176 | max_tx_rings = QLCNIC_MAX_VNIC_TX_RINGS; |
2178 | } else if (ret == QLC_83XX_DEFAULT_OPMODE) { | 2177 | } else if (ret == QLC_83XX_DEFAULT_OPMODE) { |
2179 | ahw->nic_mode = QLCNIC_DEFAULT_MODE; | 2178 | ahw->nic_mode = QLCNIC_DEFAULT_MODE; |
2180 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; | 2179 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; |
2181 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; | 2180 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; |
2182 | adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS; | 2181 | max_sds_rings = QLCNIC_MAX_SDS_RINGS; |
2183 | adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS; | 2182 | max_tx_rings = QLCNIC_MAX_TX_RINGS; |
2184 | } else { | 2183 | } else { |
2185 | return -EIO; | 2184 | return -EIO; |
2186 | } | 2185 | } |
2187 | 2186 | ||
2187 | adapter->max_sds_rings = min(ahw->max_rx_ques, max_sds_rings); | ||
2188 | adapter->max_tx_rings = min(ahw->max_tx_ques, max_tx_rings); | ||
2189 | |||
2188 | return 0; | 2190 | return 0; |
2189 | } | 2191 | } |
2190 | 2192 | ||
@@ -2348,15 +2350,16 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2348 | goto disable_intr; | 2350 | goto disable_intr; |
2349 | } | 2351 | } |
2350 | 2352 | ||
2353 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2354 | |||
2351 | err = qlcnic_83xx_setup_mbx_intr(adapter); | 2355 | err = qlcnic_83xx_setup_mbx_intr(adapter); |
2352 | if (err) | 2356 | if (err) |
2353 | goto disable_mbx_intr; | 2357 | goto disable_mbx_intr; |
2354 | 2358 | ||
2355 | qlcnic_83xx_clear_function_resources(adapter); | 2359 | qlcnic_83xx_clear_function_resources(adapter); |
2356 | 2360 | qlcnic_dcb_enable(adapter->dcb); | |
2357 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2358 | |||
2359 | qlcnic_83xx_initialize_nic(adapter, 1); | 2361 | qlcnic_83xx_initialize_nic(adapter, 1); |
2362 | qlcnic_dcb_get_info(adapter->dcb); | ||
2360 | 2363 | ||
2361 | /* Configure default, SR-IOV or Virtual NIC mode of operation */ | 2364 | /* Configure default, SR-IOV or Virtual NIC mode of operation */ |
2362 | err = qlcnic_83xx_configure_opmode(adapter); | 2365 | err = qlcnic_83xx_configure_opmode(adapter); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 64dcbf33d8f0..c1e11f5715b0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -883,8 +883,6 @@ int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter, | |||
883 | npar_info->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques); | 883 | npar_info->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques); |
884 | npar_info->capabilities = le32_to_cpu(nic_info->capabilities); | 884 | npar_info->capabilities = le32_to_cpu(nic_info->capabilities); |
885 | npar_info->max_mtu = le16_to_cpu(nic_info->max_mtu); | 885 | npar_info->max_mtu = le16_to_cpu(nic_info->max_mtu); |
886 | adapter->max_tx_rings = npar_info->max_tx_ques; | ||
887 | adapter->max_sds_rings = npar_info->max_rx_ques; | ||
888 | } | 886 | } |
889 | 887 | ||
890 | qlcnic_free_mbx_args(&cmd); | 888 | qlcnic_free_mbx_args(&cmd); |
@@ -1356,6 +1354,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, | |||
1356 | arg2 &= ~BIT_3; | 1354 | arg2 &= ~BIT_3; |
1357 | break; | 1355 | break; |
1358 | case QLCNIC_ADD_VLAN: | 1356 | case QLCNIC_ADD_VLAN: |
1357 | arg1 &= ~(0x0ffff << 16); | ||
1359 | arg1 |= (BIT_2 | BIT_5); | 1358 | arg1 |= (BIT_2 | BIT_5); |
1360 | arg1 |= (esw_cfg->vlan_id << 16); | 1359 | arg1 |= (esw_cfg->vlan_id << 16); |
1361 | break; | 1360 | break; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c index 7d4f54912bad..a51fe18f09a8 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | |||
@@ -330,8 +330,6 @@ static int __qlcnic_dcb_attach(struct qlcnic_dcb *dcb) | |||
330 | goto out_free_cfg; | 330 | goto out_free_cfg; |
331 | } | 331 | } |
332 | 332 | ||
333 | qlcnic_dcb_get_info(dcb); | ||
334 | |||
335 | return 0; | 333 | return 0; |
336 | out_free_cfg: | 334 | out_free_cfg: |
337 | kfree(dcb->cfg); | 335 | kfree(dcb->cfg); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 309d05640883..dbf75393f758 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -670,7 +670,7 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter *adapter) | |||
670 | else | 670 | else |
671 | num_msix += adapter->drv_tx_rings; | 671 | num_msix += adapter->drv_tx_rings; |
672 | 672 | ||
673 | if (adapter->drv_rss_rings > 0) | 673 | if (adapter->drv_rss_rings > 0) |
674 | num_msix += adapter->drv_rss_rings; | 674 | num_msix += adapter->drv_rss_rings; |
675 | else | 675 | else |
676 | num_msix += adapter->drv_sds_rings; | 676 | num_msix += adapter->drv_sds_rings; |
@@ -686,19 +686,15 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter *adapter) | |||
686 | return -ENOMEM; | 686 | return -ENOMEM; |
687 | } | 687 | } |
688 | 688 | ||
689 | restore: | ||
690 | for (vector = 0; vector < num_msix; vector++) | 689 | for (vector = 0; vector < num_msix; vector++) |
691 | adapter->msix_entries[vector].entry = vector; | 690 | adapter->msix_entries[vector].entry = vector; |
692 | 691 | ||
692 | restore: | ||
693 | err = pci_enable_msix(pdev, adapter->msix_entries, num_msix); | 693 | err = pci_enable_msix(pdev, adapter->msix_entries, num_msix); |
694 | if (err == 0) { | 694 | if (err > 0) { |
695 | adapter->ahw->num_msix = num_msix; | 695 | if (!adapter->drv_tss_rings && !adapter->drv_rss_rings) |
696 | if (adapter->drv_tss_rings > 0) | 696 | return -ENOSPC; |
697 | adapter->drv_tx_rings = adapter->drv_tss_rings; | ||
698 | 697 | ||
699 | if (adapter->drv_rss_rings > 0) | ||
700 | adapter->drv_sds_rings = adapter->drv_rss_rings; | ||
701 | } else { | ||
702 | netdev_info(adapter->netdev, | 698 | netdev_info(adapter->netdev, |
703 | "Unable to allocate %d MSI-X vectors, Available vectors %d\n", | 699 | "Unable to allocate %d MSI-X vectors, Available vectors %d\n", |
704 | num_msix, err); | 700 | num_msix, err); |
@@ -716,12 +712,20 @@ restore: | |||
716 | "Restoring %d Tx, %d SDS rings for total %d vectors.\n", | 712 | "Restoring %d Tx, %d SDS rings for total %d vectors.\n", |
717 | adapter->drv_tx_rings, adapter->drv_sds_rings, | 713 | adapter->drv_tx_rings, adapter->drv_sds_rings, |
718 | num_msix); | 714 | num_msix); |
719 | goto restore; | ||
720 | 715 | ||
721 | err = -EIO; | 716 | goto restore; |
717 | } else if (err < 0) { | ||
718 | return err; | ||
722 | } | 719 | } |
723 | 720 | ||
724 | return err; | 721 | adapter->ahw->num_msix = num_msix; |
722 | if (adapter->drv_tss_rings > 0) | ||
723 | adapter->drv_tx_rings = adapter->drv_tss_rings; | ||
724 | |||
725 | if (adapter->drv_rss_rings > 0) | ||
726 | adapter->drv_sds_rings = adapter->drv_rss_rings; | ||
727 | |||
728 | return 0; | ||
725 | } | 729 | } |
726 | 730 | ||
727 | int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) | 731 | int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) |
@@ -2528,8 +2532,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2528 | goto err_out_free_hw; | 2532 | goto err_out_free_hw; |
2529 | } | 2533 | } |
2530 | 2534 | ||
2531 | qlcnic_dcb_enable(adapter->dcb); | ||
2532 | |||
2533 | if (qlcnic_read_mac_addr(adapter)) | 2535 | if (qlcnic_read_mac_addr(adapter)) |
2534 | dev_warn(&pdev->dev, "failed to read mac addr\n"); | 2536 | dev_warn(&pdev->dev, "failed to read mac addr\n"); |
2535 | 2537 | ||
@@ -2549,7 +2551,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2549 | "Device does not support MSI interrupts\n"); | 2551 | "Device does not support MSI interrupts\n"); |
2550 | 2552 | ||
2551 | if (qlcnic_82xx_check(adapter)) { | 2553 | if (qlcnic_82xx_check(adapter)) { |
2554 | qlcnic_dcb_enable(adapter->dcb); | ||
2555 | qlcnic_dcb_get_info(adapter->dcb); | ||
2552 | err = qlcnic_setup_intr(adapter); | 2556 | err = qlcnic_setup_intr(adapter); |
2557 | |||
2553 | if (err) { | 2558 | if (err) { |
2554 | dev_err(&pdev->dev, "Failed to setup interrupt\n"); | 2559 | dev_err(&pdev->dev, "Failed to setup interrupt\n"); |
2555 | goto err_out_disable_msi; | 2560 | goto err_out_disable_msi; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 14f748cbf0de..280137991544 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -461,6 +461,16 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter) | |||
461 | { | 461 | { |
462 | struct net_device *netdev = adapter->netdev; | 462 | struct net_device *netdev = adapter->netdev; |
463 | 463 | ||
464 | if (pci_vfs_assigned(adapter->pdev)) { | ||
465 | netdev_err(adapter->netdev, | ||
466 | "SR-IOV VFs belonging to port %d are assigned to VMs. SR-IOV can not be disabled on this port\n", | ||
467 | adapter->portnum); | ||
468 | netdev_info(adapter->netdev, | ||
469 | "Please detach SR-IOV VFs belonging to port %d from VMs, and then try to disable SR-IOV on this port\n", | ||
470 | adapter->portnum); | ||
471 | return -EPERM; | ||
472 | } | ||
473 | |||
464 | rtnl_lock(); | 474 | rtnl_lock(); |
465 | if (netif_running(netdev)) | 475 | if (netif_running(netdev)) |
466 | __qlcnic_down(adapter, netdev); | 476 | __qlcnic_down(adapter, netdev); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 448d156c3d08..cd346e27f2e1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -354,7 +354,7 @@ int qlcnic_is_valid_nic_func(struct qlcnic_adapter *adapter, u8 pci_func) | |||
354 | { | 354 | { |
355 | int i; | 355 | int i; |
356 | 356 | ||
357 | for (i = 0; i < adapter->ahw->max_vnic_func; i++) { | 357 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { |
358 | if (adapter->npars[i].pci_func == pci_func) | 358 | if (adapter->npars[i].pci_func == pci_func) |
359 | return i; | 359 | return i; |
360 | } | 360 | } |
@@ -720,6 +720,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, | |||
720 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); | 720 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); |
721 | struct qlcnic_npar_func_cfg *np_cfg; | 721 | struct qlcnic_npar_func_cfg *np_cfg; |
722 | struct qlcnic_info nic_info; | 722 | struct qlcnic_info nic_info; |
723 | u8 pci_func; | ||
723 | int i, ret; | 724 | int i, ret; |
724 | u32 count; | 725 | u32 count; |
725 | 726 | ||
@@ -729,26 +730,28 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file, | |||
729 | 730 | ||
730 | count = size / sizeof(struct qlcnic_npar_func_cfg); | 731 | count = size / sizeof(struct qlcnic_npar_func_cfg); |
731 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { | 732 | for (i = 0; i < adapter->ahw->total_nic_func; i++) { |
732 | if (qlcnic_is_valid_nic_func(adapter, i) < 0) | ||
733 | continue; | ||
734 | if (adapter->npars[i].pci_func >= count) { | 733 | if (adapter->npars[i].pci_func >= count) { |
735 | dev_dbg(dev, "%s: Total nic functions[%d], App sent function count[%d]\n", | 734 | dev_dbg(dev, "%s: Total nic functions[%d], App sent function count[%d]\n", |
736 | __func__, adapter->ahw->total_nic_func, count); | 735 | __func__, adapter->ahw->total_nic_func, count); |
737 | continue; | 736 | continue; |
738 | } | 737 | } |
739 | ret = qlcnic_get_nic_info(adapter, &nic_info, i); | ||
740 | if (ret) | ||
741 | return ret; | ||
742 | if (!adapter->npars[i].eswitch_status) | 738 | if (!adapter->npars[i].eswitch_status) |
743 | continue; | 739 | continue; |
744 | np_cfg[i].pci_func = i; | 740 | pci_func = adapter->npars[i].pci_func; |
745 | np_cfg[i].op_mode = (u8)nic_info.op_mode; | 741 | if (qlcnic_is_valid_nic_func(adapter, pci_func) < 0) |
746 | np_cfg[i].port_num = nic_info.phys_port; | 742 | continue; |
747 | np_cfg[i].fw_capab = nic_info.capabilities; | 743 | ret = qlcnic_get_nic_info(adapter, &nic_info, pci_func); |
748 | np_cfg[i].min_bw = nic_info.min_tx_bw; | 744 | if (ret) |
749 | np_cfg[i].max_bw = nic_info.max_tx_bw; | 745 | return ret; |
750 | np_cfg[i].max_tx_queues = nic_info.max_tx_ques; | 746 | |
751 | np_cfg[i].max_rx_queues = nic_info.max_rx_ques; | 747 | np_cfg[pci_func].pci_func = pci_func; |
748 | np_cfg[pci_func].op_mode = (u8)nic_info.op_mode; | ||
749 | np_cfg[pci_func].port_num = nic_info.phys_port; | ||
750 | np_cfg[pci_func].fw_capab = nic_info.capabilities; | ||
751 | np_cfg[pci_func].min_bw = nic_info.min_tx_bw; | ||
752 | np_cfg[pci_func].max_bw = nic_info.max_tx_bw; | ||
753 | np_cfg[pci_func].max_tx_queues = nic_info.max_tx_ques; | ||
754 | np_cfg[pci_func].max_rx_queues = nic_info.max_rx_ques; | ||
752 | } | 755 | } |
753 | return size; | 756 | return size; |
754 | } | 757 | } |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 21c20ea0dad0..b5ed30a39144 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -738,8 +738,11 @@ static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) | |||
738 | /* If it was a port reset, trigger reallocation of MC resources. | 738 | /* If it was a port reset, trigger reallocation of MC resources. |
739 | * Note that on an MC reset nothing needs to be done now because we'll | 739 | * Note that on an MC reset nothing needs to be done now because we'll |
740 | * detect the MC reset later and handle it then. | 740 | * detect the MC reset later and handle it then. |
741 | * For an FLR, we never get an MC reset event, but the MC has reset all | ||
742 | * resources assigned to us, so we have to trigger reallocation now. | ||
741 | */ | 743 | */ |
742 | if (reset_type == RESET_TYPE_ALL && !rc) | 744 | if ((reset_type == RESET_TYPE_ALL || |
745 | reset_type == RESET_TYPE_MCDI_TIMEOUT) && !rc) | ||
743 | efx_ef10_reset_mc_allocations(efx); | 746 | efx_ef10_reset_mc_allocations(efx); |
744 | return rc; | 747 | return rc; |
745 | } | 748 | } |
@@ -2141,6 +2144,11 @@ static int efx_ef10_fini_dmaq(struct efx_nic *efx) | |||
2141 | return 0; | 2144 | return 0; |
2142 | } | 2145 | } |
2143 | 2146 | ||
2147 | static void efx_ef10_prepare_flr(struct efx_nic *efx) | ||
2148 | { | ||
2149 | atomic_set(&efx->active_queues, 0); | ||
2150 | } | ||
2151 | |||
2144 | static bool efx_ef10_filter_equal(const struct efx_filter_spec *left, | 2152 | static bool efx_ef10_filter_equal(const struct efx_filter_spec *left, |
2145 | const struct efx_filter_spec *right) | 2153 | const struct efx_filter_spec *right) |
2146 | { | 2154 | { |
@@ -3603,6 +3611,8 @@ const struct efx_nic_type efx_hunt_a0_nic_type = { | |||
3603 | .probe_port = efx_mcdi_port_probe, | 3611 | .probe_port = efx_mcdi_port_probe, |
3604 | .remove_port = efx_mcdi_port_remove, | 3612 | .remove_port = efx_mcdi_port_remove, |
3605 | .fini_dmaq = efx_ef10_fini_dmaq, | 3613 | .fini_dmaq = efx_ef10_fini_dmaq, |
3614 | .prepare_flr = efx_ef10_prepare_flr, | ||
3615 | .finish_flr = efx_port_dummy_op_void, | ||
3606 | .describe_stats = efx_ef10_describe_stats, | 3616 | .describe_stats = efx_ef10_describe_stats, |
3607 | .update_stats = efx_ef10_update_stats, | 3617 | .update_stats = efx_ef10_update_stats, |
3608 | .start_stats = efx_mcdi_mac_start_stats, | 3618 | .start_stats = efx_mcdi_mac_start_stats, |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 57b971e5e6b2..63d595fd3cc5 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -76,6 +76,7 @@ const char *const efx_reset_type_names[] = { | |||
76 | [RESET_TYPE_RECOVER_OR_ALL] = "RECOVER_OR_ALL", | 76 | [RESET_TYPE_RECOVER_OR_ALL] = "RECOVER_OR_ALL", |
77 | [RESET_TYPE_WORLD] = "WORLD", | 77 | [RESET_TYPE_WORLD] = "WORLD", |
78 | [RESET_TYPE_RECOVER_OR_DISABLE] = "RECOVER_OR_DISABLE", | 78 | [RESET_TYPE_RECOVER_OR_DISABLE] = "RECOVER_OR_DISABLE", |
79 | [RESET_TYPE_MC_BIST] = "MC_BIST", | ||
79 | [RESET_TYPE_DISABLE] = "DISABLE", | 80 | [RESET_TYPE_DISABLE] = "DISABLE", |
80 | [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG", | 81 | [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG", |
81 | [RESET_TYPE_INT_ERROR] = "INT_ERROR", | 82 | [RESET_TYPE_INT_ERROR] = "INT_ERROR", |
@@ -83,7 +84,7 @@ const char *const efx_reset_type_names[] = { | |||
83 | [RESET_TYPE_DMA_ERROR] = "DMA_ERROR", | 84 | [RESET_TYPE_DMA_ERROR] = "DMA_ERROR", |
84 | [RESET_TYPE_TX_SKIP] = "TX_SKIP", | 85 | [RESET_TYPE_TX_SKIP] = "TX_SKIP", |
85 | [RESET_TYPE_MC_FAILURE] = "MC_FAILURE", | 86 | [RESET_TYPE_MC_FAILURE] = "MC_FAILURE", |
86 | [RESET_TYPE_MC_BIST] = "MC_BIST", | 87 | [RESET_TYPE_MCDI_TIMEOUT] = "MCDI_TIMEOUT (FLR)", |
87 | }; | 88 | }; |
88 | 89 | ||
89 | /* Reset workqueue. If any NIC has a hardware failure then a reset will be | 90 | /* Reset workqueue. If any NIC has a hardware failure then a reset will be |
@@ -1739,7 +1740,8 @@ static void efx_start_all(struct efx_nic *efx) | |||
1739 | 1740 | ||
1740 | /* Check that it is appropriate to restart the interface. All | 1741 | /* Check that it is appropriate to restart the interface. All |
1741 | * of these flags are safe to read under just the rtnl lock */ | 1742 | * of these flags are safe to read under just the rtnl lock */ |
1742 | if (efx->port_enabled || !netif_running(efx->net_dev)) | 1743 | if (efx->port_enabled || !netif_running(efx->net_dev) || |
1744 | efx->reset_pending) | ||
1743 | return; | 1745 | return; |
1744 | 1746 | ||
1745 | efx_start_port(efx); | 1747 | efx_start_port(efx); |
@@ -2334,6 +2336,9 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method) | |||
2334 | { | 2336 | { |
2335 | EFX_ASSERT_RESET_SERIALISED(efx); | 2337 | EFX_ASSERT_RESET_SERIALISED(efx); |
2336 | 2338 | ||
2339 | if (method == RESET_TYPE_MCDI_TIMEOUT) | ||
2340 | efx->type->prepare_flr(efx); | ||
2341 | |||
2337 | efx_stop_all(efx); | 2342 | efx_stop_all(efx); |
2338 | efx_disable_interrupts(efx); | 2343 | efx_disable_interrupts(efx); |
2339 | 2344 | ||
@@ -2354,6 +2359,10 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) | |||
2354 | 2359 | ||
2355 | EFX_ASSERT_RESET_SERIALISED(efx); | 2360 | EFX_ASSERT_RESET_SERIALISED(efx); |
2356 | 2361 | ||
2362 | if (method == RESET_TYPE_MCDI_TIMEOUT) | ||
2363 | efx->type->finish_flr(efx); | ||
2364 | |||
2365 | /* Ensure that SRAM is initialised even if we're disabling the device */ | ||
2357 | rc = efx->type->init(efx); | 2366 | rc = efx->type->init(efx); |
2358 | if (rc) { | 2367 | if (rc) { |
2359 | netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n"); | 2368 | netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n"); |
@@ -2417,7 +2426,10 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) | |||
2417 | /* Clear flags for the scopes we covered. We assume the NIC and | 2426 | /* Clear flags for the scopes we covered. We assume the NIC and |
2418 | * driver are now quiescent so that there is no race here. | 2427 | * driver are now quiescent so that there is no race here. |
2419 | */ | 2428 | */ |
2420 | efx->reset_pending &= -(1 << (method + 1)); | 2429 | if (method < RESET_TYPE_MAX_METHOD) |
2430 | efx->reset_pending &= -(1 << (method + 1)); | ||
2431 | else /* it doesn't fit into the well-ordered scope hierarchy */ | ||
2432 | __clear_bit(method, &efx->reset_pending); | ||
2421 | 2433 | ||
2422 | /* Reinitialise bus-mastering, which may have been turned off before | 2434 | /* Reinitialise bus-mastering, which may have been turned off before |
2423 | * the reset was scheduled. This is still appropriate, even in the | 2435 | * the reset was scheduled. This is still appropriate, even in the |
@@ -2546,6 +2558,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) | |||
2546 | case RESET_TYPE_DISABLE: | 2558 | case RESET_TYPE_DISABLE: |
2547 | case RESET_TYPE_RECOVER_OR_DISABLE: | 2559 | case RESET_TYPE_RECOVER_OR_DISABLE: |
2548 | case RESET_TYPE_MC_BIST: | 2560 | case RESET_TYPE_MC_BIST: |
2561 | case RESET_TYPE_MCDI_TIMEOUT: | ||
2549 | method = type; | 2562 | method = type; |
2550 | netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n", | 2563 | netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n", |
2551 | RESET_TYPE(method)); | 2564 | RESET_TYPE(method)); |
diff --git a/drivers/net/ethernet/sfc/enum.h b/drivers/net/ethernet/sfc/enum.h index 75ef7ef6450b..d1dbb5fb31bb 100644 --- a/drivers/net/ethernet/sfc/enum.h +++ b/drivers/net/ethernet/sfc/enum.h | |||
@@ -143,6 +143,7 @@ enum efx_loopback_mode { | |||
143 | * @RESET_TYPE_WORLD: Reset as much as possible | 143 | * @RESET_TYPE_WORLD: Reset as much as possible |
144 | * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if | 144 | * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if |
145 | * unsuccessful. | 145 | * unsuccessful. |
146 | * @RESET_TYPE_MC_BIST: MC entering BIST mode. | ||
146 | * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled | 147 | * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled |
147 | * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog | 148 | * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog |
148 | * @RESET_TYPE_INT_ERROR: reset due to internal error | 149 | * @RESET_TYPE_INT_ERROR: reset due to internal error |
@@ -150,14 +151,16 @@ enum efx_loopback_mode { | |||
150 | * @RESET_TYPE_DMA_ERROR: DMA error | 151 | * @RESET_TYPE_DMA_ERROR: DMA error |
151 | * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors | 152 | * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors |
152 | * @RESET_TYPE_MC_FAILURE: MC reboot/assertion | 153 | * @RESET_TYPE_MC_FAILURE: MC reboot/assertion |
154 | * @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout. | ||
153 | */ | 155 | */ |
154 | enum reset_type { | 156 | enum reset_type { |
155 | RESET_TYPE_INVISIBLE = 0, | 157 | RESET_TYPE_INVISIBLE, |
156 | RESET_TYPE_RECOVER_OR_ALL = 1, | 158 | RESET_TYPE_RECOVER_OR_ALL, |
157 | RESET_TYPE_ALL = 2, | 159 | RESET_TYPE_ALL, |
158 | RESET_TYPE_WORLD = 3, | 160 | RESET_TYPE_WORLD, |
159 | RESET_TYPE_RECOVER_OR_DISABLE = 4, | 161 | RESET_TYPE_RECOVER_OR_DISABLE, |
160 | RESET_TYPE_DISABLE = 5, | 162 | RESET_TYPE_MC_BIST, |
163 | RESET_TYPE_DISABLE, | ||
161 | RESET_TYPE_MAX_METHOD, | 164 | RESET_TYPE_MAX_METHOD, |
162 | RESET_TYPE_TX_WATCHDOG, | 165 | RESET_TYPE_TX_WATCHDOG, |
163 | RESET_TYPE_INT_ERROR, | 166 | RESET_TYPE_INT_ERROR, |
@@ -165,7 +168,13 @@ enum reset_type { | |||
165 | RESET_TYPE_DMA_ERROR, | 168 | RESET_TYPE_DMA_ERROR, |
166 | RESET_TYPE_TX_SKIP, | 169 | RESET_TYPE_TX_SKIP, |
167 | RESET_TYPE_MC_FAILURE, | 170 | RESET_TYPE_MC_FAILURE, |
168 | RESET_TYPE_MC_BIST, | 171 | /* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but |
172 | * it doesn't fit the scope hierarchy (not well-ordered by inclusion). | ||
173 | * We encode this by having its enum value be greater than | ||
174 | * RESET_TYPE_MAX_METHOD. This also prevents issuing it with | ||
175 | * efx_ioctl_reset. | ||
176 | */ | ||
177 | RESET_TYPE_MCDI_TIMEOUT, | ||
169 | RESET_TYPE_MAX, | 178 | RESET_TYPE_MAX, |
170 | }; | 179 | }; |
171 | 180 | ||
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c index 8ec20b713cc6..fae25a418647 100644 --- a/drivers/net/ethernet/sfc/falcon.c +++ b/drivers/net/ethernet/sfc/falcon.c | |||
@@ -2696,6 +2696,8 @@ const struct efx_nic_type falcon_a1_nic_type = { | |||
2696 | .fini_dmaq = efx_farch_fini_dmaq, | 2696 | .fini_dmaq = efx_farch_fini_dmaq, |
2697 | .prepare_flush = falcon_prepare_flush, | 2697 | .prepare_flush = falcon_prepare_flush, |
2698 | .finish_flush = efx_port_dummy_op_void, | 2698 | .finish_flush = efx_port_dummy_op_void, |
2699 | .prepare_flr = efx_port_dummy_op_void, | ||
2700 | .finish_flr = efx_farch_finish_flr, | ||
2699 | .describe_stats = falcon_describe_nic_stats, | 2701 | .describe_stats = falcon_describe_nic_stats, |
2700 | .update_stats = falcon_update_nic_stats, | 2702 | .update_stats = falcon_update_nic_stats, |
2701 | .start_stats = falcon_start_nic_stats, | 2703 | .start_stats = falcon_start_nic_stats, |
@@ -2790,6 +2792,8 @@ const struct efx_nic_type falcon_b0_nic_type = { | |||
2790 | .fini_dmaq = efx_farch_fini_dmaq, | 2792 | .fini_dmaq = efx_farch_fini_dmaq, |
2791 | .prepare_flush = falcon_prepare_flush, | 2793 | .prepare_flush = falcon_prepare_flush, |
2792 | .finish_flush = efx_port_dummy_op_void, | 2794 | .finish_flush = efx_port_dummy_op_void, |
2795 | .prepare_flr = efx_port_dummy_op_void, | ||
2796 | .finish_flr = efx_farch_finish_flr, | ||
2793 | .describe_stats = falcon_describe_nic_stats, | 2797 | .describe_stats = falcon_describe_nic_stats, |
2794 | .update_stats = falcon_update_nic_stats, | 2798 | .update_stats = falcon_update_nic_stats, |
2795 | .start_stats = falcon_start_nic_stats, | 2799 | .start_stats = falcon_start_nic_stats, |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index a08761360cdf..0537381cd2f6 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
@@ -741,6 +741,28 @@ int efx_farch_fini_dmaq(struct efx_nic *efx) | |||
741 | return rc; | 741 | return rc; |
742 | } | 742 | } |
743 | 743 | ||
744 | /* Reset queue and flush accounting after FLR | ||
745 | * | ||
746 | * One possible cause of FLR recovery is that DMA may be failing (eg. if bus | ||
747 | * mastering was disabled), in which case we don't receive (RXQ) flush | ||
748 | * completion events. This means that efx->rxq_flush_outstanding remained at 4 | ||
749 | * after the FLR; also, efx->active_queues was non-zero (as no flush completion | ||
750 | * events were received, and we didn't go through efx_check_tx_flush_complete()) | ||
751 | * If we don't fix this up, on the next call to efx_realloc_channels() we won't | ||
752 | * flush any RX queues because efx->rxq_flush_outstanding is at the limit of 4 | ||
753 | * for batched flush requests; and the efx->active_queues gets messed up because | ||
754 | * we keep incrementing for the newly initialised queues, but it never went to | ||
755 | * zero previously. Then we get a timeout every time we try to restart the | ||
756 | * queues, as it doesn't go back to zero when we should be flushing the queues. | ||
757 | */ | ||
758 | void efx_farch_finish_flr(struct efx_nic *efx) | ||
759 | { | ||
760 | atomic_set(&efx->rxq_flush_pending, 0); | ||
761 | atomic_set(&efx->rxq_flush_outstanding, 0); | ||
762 | atomic_set(&efx->active_queues, 0); | ||
763 | } | ||
764 | |||
765 | |||
744 | /************************************************************************** | 766 | /************************************************************************** |
745 | * | 767 | * |
746 | * Event queue processing | 768 | * Event queue processing |
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 7bd4b14bf3b3..5239cf9bdc56 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c | |||
@@ -52,12 +52,7 @@ static void efx_mcdi_timeout_async(unsigned long context); | |||
52 | static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, | 52 | static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, |
53 | bool *was_attached_out); | 53 | bool *was_attached_out); |
54 | static bool efx_mcdi_poll_once(struct efx_nic *efx); | 54 | static bool efx_mcdi_poll_once(struct efx_nic *efx); |
55 | 55 | static void efx_mcdi_abandon(struct efx_nic *efx); | |
56 | static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) | ||
57 | { | ||
58 | EFX_BUG_ON_PARANOID(!efx->mcdi); | ||
59 | return &efx->mcdi->iface; | ||
60 | } | ||
61 | 56 | ||
62 | int efx_mcdi_init(struct efx_nic *efx) | 57 | int efx_mcdi_init(struct efx_nic *efx) |
63 | { | 58 | { |
@@ -558,6 +553,8 @@ static int _efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, | |||
558 | rc = 0; | 553 | rc = 0; |
559 | } | 554 | } |
560 | 555 | ||
556 | efx_mcdi_abandon(efx); | ||
557 | |||
561 | /* Close the race with efx_mcdi_ev_cpl() executing just too late | 558 | /* Close the race with efx_mcdi_ev_cpl() executing just too late |
562 | * and completing a request we've just cancelled, by ensuring | 559 | * and completing a request we've just cancelled, by ensuring |
563 | * that the seqno check therein fails. | 560 | * that the seqno check therein fails. |
@@ -672,6 +669,9 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, | |||
672 | if (efx->mc_bist_for_other_fn) | 669 | if (efx->mc_bist_for_other_fn) |
673 | return -ENETDOWN; | 670 | return -ENETDOWN; |
674 | 671 | ||
672 | if (mcdi->mode == MCDI_MODE_FAIL) | ||
673 | return -ENETDOWN; | ||
674 | |||
675 | efx_mcdi_acquire_sync(mcdi); | 675 | efx_mcdi_acquire_sync(mcdi); |
676 | efx_mcdi_send_request(efx, cmd, inbuf, inlen); | 676 | efx_mcdi_send_request(efx, cmd, inbuf, inlen); |
677 | return 0; | 677 | return 0; |
@@ -812,7 +812,11 @@ void efx_mcdi_mode_poll(struct efx_nic *efx) | |||
812 | return; | 812 | return; |
813 | 813 | ||
814 | mcdi = efx_mcdi(efx); | 814 | mcdi = efx_mcdi(efx); |
815 | if (mcdi->mode == MCDI_MODE_POLL) | 815 | /* If already in polling mode, nothing to do. |
816 | * If in fail-fast state, don't switch to polled completion. | ||
817 | * FLR recovery will do that later. | ||
818 | */ | ||
819 | if (mcdi->mode == MCDI_MODE_POLL || mcdi->mode == MCDI_MODE_FAIL) | ||
816 | return; | 820 | return; |
817 | 821 | ||
818 | /* We can switch from event completion to polled completion, because | 822 | /* We can switch from event completion to polled completion, because |
@@ -841,8 +845,8 @@ void efx_mcdi_flush_async(struct efx_nic *efx) | |||
841 | 845 | ||
842 | mcdi = efx_mcdi(efx); | 846 | mcdi = efx_mcdi(efx); |
843 | 847 | ||
844 | /* We must be in polling mode so no more requests can be queued */ | 848 | /* We must be in poll or fail mode so no more requests can be queued */ |
845 | BUG_ON(mcdi->mode != MCDI_MODE_POLL); | 849 | BUG_ON(mcdi->mode == MCDI_MODE_EVENTS); |
846 | 850 | ||
847 | del_timer_sync(&mcdi->async_timer); | 851 | del_timer_sync(&mcdi->async_timer); |
848 | 852 | ||
@@ -875,8 +879,11 @@ void efx_mcdi_mode_event(struct efx_nic *efx) | |||
875 | return; | 879 | return; |
876 | 880 | ||
877 | mcdi = efx_mcdi(efx); | 881 | mcdi = efx_mcdi(efx); |
878 | 882 | /* If already in event completion mode, nothing to do. | |
879 | if (mcdi->mode == MCDI_MODE_EVENTS) | 883 | * If in fail-fast state, don't switch to event completion. FLR |
884 | * recovery will do that later. | ||
885 | */ | ||
886 | if (mcdi->mode == MCDI_MODE_EVENTS || mcdi->mode == MCDI_MODE_FAIL) | ||
880 | return; | 887 | return; |
881 | 888 | ||
882 | /* We can't switch from polled to event completion in the middle of a | 889 | /* We can't switch from polled to event completion in the middle of a |
@@ -966,6 +973,19 @@ static void efx_mcdi_ev_bist(struct efx_nic *efx) | |||
966 | spin_unlock(&mcdi->iface_lock); | 973 | spin_unlock(&mcdi->iface_lock); |
967 | } | 974 | } |
968 | 975 | ||
976 | /* MCDI timeouts seen, so make all MCDI calls fail-fast and issue an FLR to try | ||
977 | * to recover. | ||
978 | */ | ||
979 | static void efx_mcdi_abandon(struct efx_nic *efx) | ||
980 | { | ||
981 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | ||
982 | |||
983 | if (xchg(&mcdi->mode, MCDI_MODE_FAIL) == MCDI_MODE_FAIL) | ||
984 | return; /* it had already been done */ | ||
985 | netif_dbg(efx, hw, efx->net_dev, "MCDI is timing out; trying to recover\n"); | ||
986 | efx_schedule_reset(efx, RESET_TYPE_MCDI_TIMEOUT); | ||
987 | } | ||
988 | |||
969 | /* Called from falcon_process_eventq for MCDI events */ | 989 | /* Called from falcon_process_eventq for MCDI events */ |
970 | void efx_mcdi_process_event(struct efx_channel *channel, | 990 | void efx_mcdi_process_event(struct efx_channel *channel, |
971 | efx_qword_t *event) | 991 | efx_qword_t *event) |
@@ -1512,6 +1532,19 @@ int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method) | |||
1512 | { | 1532 | { |
1513 | int rc; | 1533 | int rc; |
1514 | 1534 | ||
1535 | /* If MCDI is down, we can't handle_assertion */ | ||
1536 | if (method == RESET_TYPE_MCDI_TIMEOUT) { | ||
1537 | rc = pci_reset_function(efx->pci_dev); | ||
1538 | if (rc) | ||
1539 | return rc; | ||
1540 | /* Re-enable polled MCDI completion */ | ||
1541 | if (efx->mcdi) { | ||
1542 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | ||
1543 | mcdi->mode = MCDI_MODE_POLL; | ||
1544 | } | ||
1545 | return 0; | ||
1546 | } | ||
1547 | |||
1515 | /* Recover from a failed assertion pre-reset */ | 1548 | /* Recover from a failed assertion pre-reset */ |
1516 | rc = efx_mcdi_handle_assertion(efx); | 1549 | rc = efx_mcdi_handle_assertion(efx); |
1517 | if (rc) | 1550 | if (rc) |
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h index 52931aebf3c3..56465f7465a2 100644 --- a/drivers/net/ethernet/sfc/mcdi.h +++ b/drivers/net/ethernet/sfc/mcdi.h | |||
@@ -28,9 +28,16 @@ enum efx_mcdi_state { | |||
28 | MCDI_STATE_COMPLETED, | 28 | MCDI_STATE_COMPLETED, |
29 | }; | 29 | }; |
30 | 30 | ||
31 | /** | ||
32 | * enum efx_mcdi_mode - MCDI transaction mode | ||
33 | * @MCDI_MODE_POLL: poll for MCDI completion, until timeout | ||
34 | * @MCDI_MODE_EVENTS: wait for an mcdi_event. On timeout, poll once | ||
35 | * @MCDI_MODE_FAIL: we think MCDI is dead, so fail-fast all calls | ||
36 | */ | ||
31 | enum efx_mcdi_mode { | 37 | enum efx_mcdi_mode { |
32 | MCDI_MODE_POLL, | 38 | MCDI_MODE_POLL, |
33 | MCDI_MODE_EVENTS, | 39 | MCDI_MODE_EVENTS, |
40 | MCDI_MODE_FAIL, | ||
34 | }; | 41 | }; |
35 | 42 | ||
36 | /** | 43 | /** |
@@ -104,6 +111,12 @@ struct efx_mcdi_data { | |||
104 | u32 fn_flags; | 111 | u32 fn_flags; |
105 | }; | 112 | }; |
106 | 113 | ||
114 | static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) | ||
115 | { | ||
116 | EFX_BUG_ON_PARANOID(!efx->mcdi); | ||
117 | return &efx->mcdi->iface; | ||
118 | } | ||
119 | |||
107 | #ifdef CONFIG_SFC_MCDI_MON | 120 | #ifdef CONFIG_SFC_MCDI_MON |
108 | static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx) | 121 | static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx) |
109 | { | 122 | { |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 8a400a0595eb..5bdae8ed7c57 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -972,6 +972,8 @@ struct efx_mtd_partition { | |||
972 | * (for Falcon architecture) | 972 | * (for Falcon architecture) |
973 | * @finish_flush: Clean up after flushing the DMA queues (for Falcon | 973 | * @finish_flush: Clean up after flushing the DMA queues (for Falcon |
974 | * architecture) | 974 | * architecture) |
975 | * @prepare_flr: Prepare for an FLR | ||
976 | * @finish_flr: Clean up after an FLR | ||
975 | * @describe_stats: Describe statistics for ethtool | 977 | * @describe_stats: Describe statistics for ethtool |
976 | * @update_stats: Update statistics not provided by event handling. | 978 | * @update_stats: Update statistics not provided by event handling. |
977 | * Either argument may be %NULL. | 979 | * Either argument may be %NULL. |
@@ -1100,6 +1102,8 @@ struct efx_nic_type { | |||
1100 | int (*fini_dmaq)(struct efx_nic *efx); | 1102 | int (*fini_dmaq)(struct efx_nic *efx); |
1101 | void (*prepare_flush)(struct efx_nic *efx); | 1103 | void (*prepare_flush)(struct efx_nic *efx); |
1102 | void (*finish_flush)(struct efx_nic *efx); | 1104 | void (*finish_flush)(struct efx_nic *efx); |
1105 | void (*prepare_flr)(struct efx_nic *efx); | ||
1106 | void (*finish_flr)(struct efx_nic *efx); | ||
1103 | size_t (*describe_stats)(struct efx_nic *efx, u8 *names); | 1107 | size_t (*describe_stats)(struct efx_nic *efx, u8 *names); |
1104 | size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats, | 1108 | size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats, |
1105 | struct rtnl_link_stats64 *core_stats); | 1109 | struct rtnl_link_stats64 *core_stats); |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index a001fae1a8d7..d3ad8ed8d901 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -757,6 +757,7 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) | |||
757 | int efx_nic_flush_queues(struct efx_nic *efx); | 757 | int efx_nic_flush_queues(struct efx_nic *efx); |
758 | void siena_prepare_flush(struct efx_nic *efx); | 758 | void siena_prepare_flush(struct efx_nic *efx); |
759 | int efx_farch_fini_dmaq(struct efx_nic *efx); | 759 | int efx_farch_fini_dmaq(struct efx_nic *efx); |
760 | void efx_farch_finish_flr(struct efx_nic *efx); | ||
760 | void siena_finish_flush(struct efx_nic *efx); | 761 | void siena_finish_flush(struct efx_nic *efx); |
761 | void falcon_start_nic_stats(struct efx_nic *efx); | 762 | void falcon_start_nic_stats(struct efx_nic *efx); |
762 | void falcon_stop_nic_stats(struct efx_nic *efx); | 763 | void falcon_stop_nic_stats(struct efx_nic *efx); |
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c index 23f3a6f7737a..50ffefed492c 100644 --- a/drivers/net/ethernet/sfc/siena.c +++ b/drivers/net/ethernet/sfc/siena.c | |||
@@ -921,6 +921,8 @@ const struct efx_nic_type siena_a0_nic_type = { | |||
921 | .fini_dmaq = efx_farch_fini_dmaq, | 921 | .fini_dmaq = efx_farch_fini_dmaq, |
922 | .prepare_flush = siena_prepare_flush, | 922 | .prepare_flush = siena_prepare_flush, |
923 | .finish_flush = siena_finish_flush, | 923 | .finish_flush = siena_finish_flush, |
924 | .prepare_flr = efx_port_dummy_op_void, | ||
925 | .finish_flr = efx_farch_finish_flr, | ||
924 | .describe_stats = siena_describe_nic_stats, | 926 | .describe_stats = siena_describe_nic_stats, |
925 | .update_stats = siena_update_nic_stats, | 927 | .update_stats = siena_update_nic_stats, |
926 | .start_stats = efx_mcdi_mac_start_stats, | 928 | .start_stats = efx_mcdi_mac_start_stats, |
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 430bb0db9bc4..e36f194673a4 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -365,7 +365,7 @@ __at86rf230_read_subreg(struct at86rf230_local *lp, | |||
365 | dev_vdbg(&lp->spi->dev, "buf[1] = %02x\n", buf[1]); | 365 | dev_vdbg(&lp->spi->dev, "buf[1] = %02x\n", buf[1]); |
366 | 366 | ||
367 | if (status == 0) | 367 | if (status == 0) |
368 | *data = buf[1]; | 368 | *data = (buf[1] & mask) >> shift; |
369 | 369 | ||
370 | return status; | 370 | return status; |
371 | } | 371 | } |
@@ -1025,14 +1025,6 @@ static int at86rf230_hw_init(struct at86rf230_local *lp) | |||
1025 | return -EINVAL; | 1025 | return -EINVAL; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | rc = at86rf230_read_subreg(lp, SR_AVDD_OK, &status); | ||
1029 | if (rc) | ||
1030 | return rc; | ||
1031 | if (!status) { | ||
1032 | dev_err(&lp->spi->dev, "AVDD error\n"); | ||
1033 | return -EINVAL; | ||
1034 | } | ||
1035 | |||
1036 | return 0; | 1028 | return 0; |
1037 | } | 1029 | } |
1038 | 1030 | ||
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index e701433bf52f..9c4defdec67b 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
@@ -32,29 +32,39 @@ | |||
32 | 32 | ||
33 | struct mdio_gpio_info { | 33 | struct mdio_gpio_info { |
34 | struct mdiobb_ctrl ctrl; | 34 | struct mdiobb_ctrl ctrl; |
35 | int mdc, mdio; | 35 | int mdc, mdio, mdo; |
36 | int mdc_active_low, mdio_active_low, mdo_active_low; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static void *mdio_gpio_of_get_data(struct platform_device *pdev) | 39 | static void *mdio_gpio_of_get_data(struct platform_device *pdev) |
39 | { | 40 | { |
40 | struct device_node *np = pdev->dev.of_node; | 41 | struct device_node *np = pdev->dev.of_node; |
41 | struct mdio_gpio_platform_data *pdata; | 42 | struct mdio_gpio_platform_data *pdata; |
43 | enum of_gpio_flags flags; | ||
42 | int ret; | 44 | int ret; |
43 | 45 | ||
44 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 46 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
45 | if (!pdata) | 47 | if (!pdata) |
46 | return NULL; | 48 | return NULL; |
47 | 49 | ||
48 | ret = of_get_gpio(np, 0); | 50 | ret = of_get_gpio_flags(np, 0, &flags); |
49 | if (ret < 0) | 51 | if (ret < 0) |
50 | return NULL; | 52 | return NULL; |
51 | 53 | ||
52 | pdata->mdc = ret; | 54 | pdata->mdc = ret; |
55 | pdata->mdc_active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
53 | 56 | ||
54 | ret = of_get_gpio(np, 1); | 57 | ret = of_get_gpio_flags(np, 1, &flags); |
55 | if (ret < 0) | 58 | if (ret < 0) |
56 | return NULL; | 59 | return NULL; |
57 | pdata->mdio = ret; | 60 | pdata->mdio = ret; |
61 | pdata->mdio_active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
62 | |||
63 | ret = of_get_gpio_flags(np, 2, &flags); | ||
64 | if (ret > 0) { | ||
65 | pdata->mdo = ret; | ||
66 | pdata->mdo_active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
67 | } | ||
58 | 68 | ||
59 | return pdata; | 69 | return pdata; |
60 | } | 70 | } |
@@ -64,8 +74,19 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir) | |||
64 | struct mdio_gpio_info *bitbang = | 74 | struct mdio_gpio_info *bitbang = |
65 | container_of(ctrl, struct mdio_gpio_info, ctrl); | 75 | container_of(ctrl, struct mdio_gpio_info, ctrl); |
66 | 76 | ||
77 | if (bitbang->mdo) { | ||
78 | /* Separate output pin. Always set its value to high | ||
79 | * when changing direction. If direction is input, | ||
80 | * assume the pin serves as pull-up. If direction is | ||
81 | * output, the default value is high. | ||
82 | */ | ||
83 | gpio_set_value(bitbang->mdo, 1 ^ bitbang->mdo_active_low); | ||
84 | return; | ||
85 | } | ||
86 | |||
67 | if (dir) | 87 | if (dir) |
68 | gpio_direction_output(bitbang->mdio, 1); | 88 | gpio_direction_output(bitbang->mdio, |
89 | 1 ^ bitbang->mdio_active_low); | ||
69 | else | 90 | else |
70 | gpio_direction_input(bitbang->mdio); | 91 | gpio_direction_input(bitbang->mdio); |
71 | } | 92 | } |
@@ -75,7 +96,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl) | |||
75 | struct mdio_gpio_info *bitbang = | 96 | struct mdio_gpio_info *bitbang = |
76 | container_of(ctrl, struct mdio_gpio_info, ctrl); | 97 | container_of(ctrl, struct mdio_gpio_info, ctrl); |
77 | 98 | ||
78 | return gpio_get_value(bitbang->mdio); | 99 | return gpio_get_value(bitbang->mdio) ^ bitbang->mdio_active_low; |
79 | } | 100 | } |
80 | 101 | ||
81 | static void mdio_set(struct mdiobb_ctrl *ctrl, int what) | 102 | static void mdio_set(struct mdiobb_ctrl *ctrl, int what) |
@@ -83,7 +104,10 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what) | |||
83 | struct mdio_gpio_info *bitbang = | 104 | struct mdio_gpio_info *bitbang = |
84 | container_of(ctrl, struct mdio_gpio_info, ctrl); | 105 | container_of(ctrl, struct mdio_gpio_info, ctrl); |
85 | 106 | ||
86 | gpio_set_value(bitbang->mdio, what); | 107 | if (bitbang->mdo) |
108 | gpio_set_value(bitbang->mdo, what ^ bitbang->mdo_active_low); | ||
109 | else | ||
110 | gpio_set_value(bitbang->mdio, what ^ bitbang->mdio_active_low); | ||
87 | } | 111 | } |
88 | 112 | ||
89 | static void mdc_set(struct mdiobb_ctrl *ctrl, int what) | 113 | static void mdc_set(struct mdiobb_ctrl *ctrl, int what) |
@@ -91,7 +115,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what) | |||
91 | struct mdio_gpio_info *bitbang = | 115 | struct mdio_gpio_info *bitbang = |
92 | container_of(ctrl, struct mdio_gpio_info, ctrl); | 116 | container_of(ctrl, struct mdio_gpio_info, ctrl); |
93 | 117 | ||
94 | gpio_set_value(bitbang->mdc, what); | 118 | gpio_set_value(bitbang->mdc, what ^ bitbang->mdc_active_low); |
95 | } | 119 | } |
96 | 120 | ||
97 | static struct mdiobb_ops mdio_gpio_ops = { | 121 | static struct mdiobb_ops mdio_gpio_ops = { |
@@ -110,18 +134,22 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, | |||
110 | struct mdio_gpio_info *bitbang; | 134 | struct mdio_gpio_info *bitbang; |
111 | int i; | 135 | int i; |
112 | 136 | ||
113 | bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL); | 137 | bitbang = devm_kzalloc(dev, sizeof(*bitbang), GFP_KERNEL); |
114 | if (!bitbang) | 138 | if (!bitbang) |
115 | goto out; | 139 | goto out; |
116 | 140 | ||
117 | bitbang->ctrl.ops = &mdio_gpio_ops; | 141 | bitbang->ctrl.ops = &mdio_gpio_ops; |
118 | bitbang->ctrl.reset = pdata->reset; | 142 | bitbang->ctrl.reset = pdata->reset; |
119 | bitbang->mdc = pdata->mdc; | 143 | bitbang->mdc = pdata->mdc; |
144 | bitbang->mdc_active_low = pdata->mdc_active_low; | ||
120 | bitbang->mdio = pdata->mdio; | 145 | bitbang->mdio = pdata->mdio; |
146 | bitbang->mdio_active_low = pdata->mdio_active_low; | ||
147 | bitbang->mdo = pdata->mdo; | ||
148 | bitbang->mdo_active_low = pdata->mdo_active_low; | ||
121 | 149 | ||
122 | new_bus = alloc_mdio_bitbang(&bitbang->ctrl); | 150 | new_bus = alloc_mdio_bitbang(&bitbang->ctrl); |
123 | if (!new_bus) | 151 | if (!new_bus) |
124 | goto out_free_bitbang; | 152 | goto out; |
125 | 153 | ||
126 | new_bus->name = "GPIO Bitbanged MDIO", | 154 | new_bus->name = "GPIO Bitbanged MDIO", |
127 | 155 | ||
@@ -138,11 +166,18 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, | |||
138 | 166 | ||
139 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id); | 167 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id); |
140 | 168 | ||
141 | if (gpio_request(bitbang->mdc, "mdc")) | 169 | if (devm_gpio_request(dev, bitbang->mdc, "mdc")) |
170 | goto out_free_bus; | ||
171 | |||
172 | if (devm_gpio_request(dev, bitbang->mdio, "mdio")) | ||
142 | goto out_free_bus; | 173 | goto out_free_bus; |
143 | 174 | ||
144 | if (gpio_request(bitbang->mdio, "mdio")) | 175 | if (bitbang->mdo) { |
145 | goto out_free_mdc; | 176 | if (devm_gpio_request(dev, bitbang->mdo, "mdo")) |
177 | goto out_free_bus; | ||
178 | gpio_direction_output(bitbang->mdo, 1); | ||
179 | gpio_direction_input(bitbang->mdio); | ||
180 | } | ||
146 | 181 | ||
147 | gpio_direction_output(bitbang->mdc, 0); | 182 | gpio_direction_output(bitbang->mdc, 0); |
148 | 183 | ||
@@ -150,12 +185,8 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, | |||
150 | 185 | ||
151 | return new_bus; | 186 | return new_bus; |
152 | 187 | ||
153 | out_free_mdc: | ||
154 | gpio_free(bitbang->mdc); | ||
155 | out_free_bus: | 188 | out_free_bus: |
156 | free_mdio_bitbang(new_bus); | 189 | free_mdio_bitbang(new_bus); |
157 | out_free_bitbang: | ||
158 | kfree(bitbang); | ||
159 | out: | 190 | out: |
160 | return NULL; | 191 | return NULL; |
161 | } | 192 | } |
@@ -163,13 +194,8 @@ out: | |||
163 | static void mdio_gpio_bus_deinit(struct device *dev) | 194 | static void mdio_gpio_bus_deinit(struct device *dev) |
164 | { | 195 | { |
165 | struct mii_bus *bus = dev_get_drvdata(dev); | 196 | struct mii_bus *bus = dev_get_drvdata(dev); |
166 | struct mdio_gpio_info *bitbang = bus->priv; | ||
167 | 197 | ||
168 | dev_set_drvdata(dev, NULL); | ||
169 | gpio_free(bitbang->mdio); | ||
170 | gpio_free(bitbang->mdc); | ||
171 | free_mdio_bitbang(bus); | 198 | free_mdio_bitbang(bus); |
172 | kfree(bitbang); | ||
173 | } | 199 | } |
174 | 200 | ||
175 | static void mdio_gpio_bus_destroy(struct device *dev) | 201 | static void mdio_gpio_bus_destroy(struct device *dev) |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index c55e316373a1..82355d5d155a 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1755,8 +1755,8 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, | |||
1755 | if (err) | 1755 | if (err) |
1756 | return err; | 1756 | return err; |
1757 | 1757 | ||
1758 | return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df, | 1758 | return iptunnel_xmit(vs->sock->sk, rt, skb, src, dst, IPPROTO_UDP, |
1759 | false); | 1759 | tos, ttl, df, false); |
1760 | } | 1760 | } |
1761 | EXPORT_SYMBOL_GPL(vxlan_xmit_skb); | 1761 | EXPORT_SYMBOL_GPL(vxlan_xmit_skb); |
1762 | 1762 | ||
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 84734a805092..83c39e2858bf 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -1521,11 +1521,7 @@ static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring) | |||
1521 | cosa_putstatus(cosa, 0); | 1521 | cosa_putstatus(cosa, 0); |
1522 | cosa_getdata8(cosa); | 1522 | cosa_getdata8(cosa); |
1523 | cosa_putstatus(cosa, SR_RST); | 1523 | cosa_putstatus(cosa, SR_RST); |
1524 | #ifdef MODULE | ||
1525 | msleep(500); | 1524 | msleep(500); |
1526 | #else | ||
1527 | udelay(5*100000); | ||
1528 | #endif | ||
1529 | /* Disable all IRQs from the card */ | 1525 | /* Disable all IRQs from the card */ |
1530 | cosa_putstatus(cosa, 0); | 1526 | cosa_putstatus(cosa, 0); |
1531 | 1527 | ||
diff --git a/drivers/net/wireless/cw1200/debug.c b/drivers/net/wireless/cw1200/debug.c index e323b4d54338..34f97c31eecf 100644 --- a/drivers/net/wireless/cw1200/debug.c +++ b/drivers/net/wireless/cw1200/debug.c | |||
@@ -41,6 +41,8 @@ static const char * const cw1200_debug_link_id[] = { | |||
41 | "REQ", | 41 | "REQ", |
42 | "SOFT", | 42 | "SOFT", |
43 | "HARD", | 43 | "HARD", |
44 | "RESET", | ||
45 | "RESET_REMAP", | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | static const char *cw1200_debug_mode(int mode) | 48 | static const char *cw1200_debug_mode(int mode) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 003a546571d4..4c2d4ef28b22 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -67,8 +67,8 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL7260_UCODE_API_MAX 8 | 70 | #define IWL7260_UCODE_API_MAX 9 |
71 | #define IWL3160_UCODE_API_MAX 8 | 71 | #define IWL3160_UCODE_API_MAX 9 |
72 | 72 | ||
73 | /* Oldest version we won't warn about */ | 73 | /* Oldest version we won't warn about */ |
74 | #define IWL7260_UCODE_API_OK 8 | 74 | #define IWL7260_UCODE_API_OK 8 |
@@ -244,3 +244,4 @@ const struct iwl_cfg iwl7265_n_cfg = { | |||
244 | 244 | ||
245 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 245 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
246 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 246 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
247 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 685f7e8e6943..fa858d548d13 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -190,7 +190,7 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { | |||
190 | cpu_to_le32(0xcc00aaaa), | 190 | cpu_to_le32(0xcc00aaaa), |
191 | cpu_to_le32(0x0000aaaa), | 191 | cpu_to_le32(0x0000aaaa), |
192 | cpu_to_le32(0xc0004000), | 192 | cpu_to_le32(0xc0004000), |
193 | cpu_to_le32(0x00000000), | 193 | cpu_to_le32(0x00004000), |
194 | cpu_to_le32(0xf0005000), | 194 | cpu_to_le32(0xf0005000), |
195 | cpu_to_le32(0xf0005000), | 195 | cpu_to_le32(0xf0005000), |
196 | }, | 196 | }, |
@@ -213,16 +213,16 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { | |||
213 | /* Tx Tx disabled */ | 213 | /* Tx Tx disabled */ |
214 | cpu_to_le32(0xaaaaaaaa), | 214 | cpu_to_le32(0xaaaaaaaa), |
215 | cpu_to_le32(0xaaaaaaaa), | 215 | cpu_to_le32(0xaaaaaaaa), |
216 | cpu_to_le32(0xaaaaaaaa), | 216 | cpu_to_le32(0xeeaaaaaa), |
217 | cpu_to_le32(0xaaaaaaaa), | 217 | cpu_to_le32(0xaaaaaaaa), |
218 | cpu_to_le32(0xcc00ff28), | 218 | cpu_to_le32(0xcc00ff28), |
219 | cpu_to_le32(0x0000aaaa), | 219 | cpu_to_le32(0x0000aaaa), |
220 | cpu_to_le32(0xcc00aaaa), | 220 | cpu_to_le32(0xcc00aaaa), |
221 | cpu_to_le32(0x0000aaaa), | 221 | cpu_to_le32(0x0000aaaa), |
222 | cpu_to_le32(0xC0004000), | 222 | cpu_to_le32(0xc0004000), |
223 | cpu_to_le32(0xC0004000), | 223 | cpu_to_le32(0xc0004000), |
224 | cpu_to_le32(0xF0005000), | 224 | cpu_to_le32(0xf0005000), |
225 | cpu_to_le32(0xF0005000), | 225 | cpu_to_le32(0xf0005000), |
226 | }, | 226 | }, |
227 | }; | 227 | }; |
228 | 228 | ||
@@ -1262,6 +1262,7 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, | |||
1262 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 1262 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
1263 | u32 ant_isolation = le32_to_cpup((void *)pkt->data); | 1263 | u32 ant_isolation = le32_to_cpup((void *)pkt->data); |
1264 | u8 __maybe_unused lower_bound, upper_bound; | 1264 | u8 __maybe_unused lower_bound, upper_bound; |
1265 | int ret; | ||
1265 | u8 lut; | 1266 | u8 lut; |
1266 | 1267 | ||
1267 | struct iwl_bt_coex_cmd *bt_cmd; | 1268 | struct iwl_bt_coex_cmd *bt_cmd; |
@@ -1318,5 +1319,8 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, | |||
1318 | memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[lut].lut20, | 1319 | memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[lut].lut20, |
1319 | sizeof(bt_cmd->bt4_corun_lut40)); | 1320 | sizeof(bt_cmd->bt4_corun_lut40)); |
1320 | 1321 | ||
1321 | return 0; | 1322 | ret = iwl_mvm_send_cmd(mvm, &cmd); |
1323 | |||
1324 | kfree(bt_cmd); | ||
1325 | return ret; | ||
1322 | } | 1326 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 4dd9ff43b8b6..f0cebf12c7b8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -1332,6 +1332,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1332 | */ | 1332 | */ |
1333 | iwl_mvm_remove_time_event(mvm, mvmvif, | 1333 | iwl_mvm_remove_time_event(mvm, mvmvif, |
1334 | &mvmvif->time_event_data); | 1334 | &mvmvif->time_event_data); |
1335 | iwl_mvm_sf_update(mvm, vif, false); | ||
1335 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); | 1336 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); |
1336 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | | 1337 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | |
1337 | BSS_CHANGED_QOS)) { | 1338 | BSS_CHANGED_QOS)) { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index 568abd61b14f..9f52c5b3f0ec 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
@@ -59,7 +59,7 @@ | |||
59 | /* max allowed rate miss before sync LQ cmd */ | 59 | /* max allowed rate miss before sync LQ cmd */ |
60 | #define IWL_MISSED_RATE_MAX 15 | 60 | #define IWL_MISSED_RATE_MAX 15 |
61 | #define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ) | 61 | #define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ) |
62 | 62 | #define RS_IDLE_TIMEOUT (5*HZ) | |
63 | 63 | ||
64 | static u8 rs_ht_to_legacy[] = { | 64 | static u8 rs_ht_to_legacy[] = { |
65 | [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX, | 65 | [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX, |
@@ -142,7 +142,7 @@ enum rs_column_mode { | |||
142 | RS_MIMO2, | 142 | RS_MIMO2, |
143 | }; | 143 | }; |
144 | 144 | ||
145 | #define MAX_NEXT_COLUMNS 5 | 145 | #define MAX_NEXT_COLUMNS 7 |
146 | #define MAX_COLUMN_CHECKS 3 | 146 | #define MAX_COLUMN_CHECKS 3 |
147 | 147 | ||
148 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, | 148 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, |
@@ -212,8 +212,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
212 | RS_COLUMN_LEGACY_ANT_B, | 212 | RS_COLUMN_LEGACY_ANT_B, |
213 | RS_COLUMN_SISO_ANT_A, | 213 | RS_COLUMN_SISO_ANT_A, |
214 | RS_COLUMN_SISO_ANT_B, | 214 | RS_COLUMN_SISO_ANT_B, |
215 | RS_COLUMN_MIMO2, | 215 | RS_COLUMN_INVALID, |
216 | RS_COLUMN_MIMO2_SGI, | 216 | RS_COLUMN_INVALID, |
217 | RS_COLUMN_INVALID, | ||
218 | RS_COLUMN_INVALID, | ||
217 | }, | 219 | }, |
218 | }, | 220 | }, |
219 | [RS_COLUMN_LEGACY_ANT_B] = { | 221 | [RS_COLUMN_LEGACY_ANT_B] = { |
@@ -223,8 +225,10 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
223 | RS_COLUMN_LEGACY_ANT_A, | 225 | RS_COLUMN_LEGACY_ANT_A, |
224 | RS_COLUMN_SISO_ANT_A, | 226 | RS_COLUMN_SISO_ANT_A, |
225 | RS_COLUMN_SISO_ANT_B, | 227 | RS_COLUMN_SISO_ANT_B, |
226 | RS_COLUMN_MIMO2, | 228 | RS_COLUMN_INVALID, |
227 | RS_COLUMN_MIMO2_SGI, | 229 | RS_COLUMN_INVALID, |
230 | RS_COLUMN_INVALID, | ||
231 | RS_COLUMN_INVALID, | ||
228 | }, | 232 | }, |
229 | }, | 233 | }, |
230 | [RS_COLUMN_SISO_ANT_A] = { | 234 | [RS_COLUMN_SISO_ANT_A] = { |
@@ -235,7 +239,9 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
235 | RS_COLUMN_MIMO2, | 239 | RS_COLUMN_MIMO2, |
236 | RS_COLUMN_SISO_ANT_A_SGI, | 240 | RS_COLUMN_SISO_ANT_A_SGI, |
237 | RS_COLUMN_SISO_ANT_B_SGI, | 241 | RS_COLUMN_SISO_ANT_B_SGI, |
238 | RS_COLUMN_MIMO2_SGI, | 242 | RS_COLUMN_LEGACY_ANT_A, |
243 | RS_COLUMN_LEGACY_ANT_B, | ||
244 | RS_COLUMN_INVALID, | ||
239 | }, | 245 | }, |
240 | .checks = { | 246 | .checks = { |
241 | rs_siso_allow, | 247 | rs_siso_allow, |
@@ -249,7 +255,9 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
249 | RS_COLUMN_MIMO2, | 255 | RS_COLUMN_MIMO2, |
250 | RS_COLUMN_SISO_ANT_B_SGI, | 256 | RS_COLUMN_SISO_ANT_B_SGI, |
251 | RS_COLUMN_SISO_ANT_A_SGI, | 257 | RS_COLUMN_SISO_ANT_A_SGI, |
252 | RS_COLUMN_MIMO2_SGI, | 258 | RS_COLUMN_LEGACY_ANT_A, |
259 | RS_COLUMN_LEGACY_ANT_B, | ||
260 | RS_COLUMN_INVALID, | ||
253 | }, | 261 | }, |
254 | .checks = { | 262 | .checks = { |
255 | rs_siso_allow, | 263 | rs_siso_allow, |
@@ -265,6 +273,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
265 | RS_COLUMN_SISO_ANT_A, | 273 | RS_COLUMN_SISO_ANT_A, |
266 | RS_COLUMN_SISO_ANT_B, | 274 | RS_COLUMN_SISO_ANT_B, |
267 | RS_COLUMN_MIMO2, | 275 | RS_COLUMN_MIMO2, |
276 | RS_COLUMN_LEGACY_ANT_A, | ||
277 | RS_COLUMN_LEGACY_ANT_B, | ||
268 | }, | 278 | }, |
269 | .checks = { | 279 | .checks = { |
270 | rs_siso_allow, | 280 | rs_siso_allow, |
@@ -281,6 +291,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
281 | RS_COLUMN_SISO_ANT_B, | 291 | RS_COLUMN_SISO_ANT_B, |
282 | RS_COLUMN_SISO_ANT_A, | 292 | RS_COLUMN_SISO_ANT_A, |
283 | RS_COLUMN_MIMO2, | 293 | RS_COLUMN_MIMO2, |
294 | RS_COLUMN_LEGACY_ANT_A, | ||
295 | RS_COLUMN_LEGACY_ANT_B, | ||
284 | }, | 296 | }, |
285 | .checks = { | 297 | .checks = { |
286 | rs_siso_allow, | 298 | rs_siso_allow, |
@@ -296,6 +308,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
296 | RS_COLUMN_SISO_ANT_A_SGI, | 308 | RS_COLUMN_SISO_ANT_A_SGI, |
297 | RS_COLUMN_SISO_ANT_B_SGI, | 309 | RS_COLUMN_SISO_ANT_B_SGI, |
298 | RS_COLUMN_MIMO2_SGI, | 310 | RS_COLUMN_MIMO2_SGI, |
311 | RS_COLUMN_LEGACY_ANT_A, | ||
312 | RS_COLUMN_LEGACY_ANT_B, | ||
299 | }, | 313 | }, |
300 | .checks = { | 314 | .checks = { |
301 | rs_mimo_allow, | 315 | rs_mimo_allow, |
@@ -311,6 +325,8 @@ static const struct rs_tx_column rs_tx_columns[] = { | |||
311 | RS_COLUMN_SISO_ANT_A, | 325 | RS_COLUMN_SISO_ANT_A, |
312 | RS_COLUMN_SISO_ANT_B, | 326 | RS_COLUMN_SISO_ANT_B, |
313 | RS_COLUMN_MIMO2, | 327 | RS_COLUMN_MIMO2, |
328 | RS_COLUMN_LEGACY_ANT_A, | ||
329 | RS_COLUMN_LEGACY_ANT_B, | ||
314 | }, | 330 | }, |
315 | .checks = { | 331 | .checks = { |
316 | rs_mimo_allow, | 332 | rs_mimo_allow, |
@@ -503,10 +519,12 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) | |||
503 | window->average_tpt = IWL_INVALID_VALUE; | 519 | window->average_tpt = IWL_INVALID_VALUE; |
504 | } | 520 | } |
505 | 521 | ||
506 | static void rs_rate_scale_clear_tbl_windows(struct iwl_scale_tbl_info *tbl) | 522 | static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm, |
523 | struct iwl_scale_tbl_info *tbl) | ||
507 | { | 524 | { |
508 | int i; | 525 | int i; |
509 | 526 | ||
527 | IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); | ||
510 | for (i = 0; i < IWL_RATE_COUNT; i++) | 528 | for (i = 0; i < IWL_RATE_COUNT; i++) |
511 | rs_rate_scale_clear_window(&tbl->win[i]); | 529 | rs_rate_scale_clear_window(&tbl->win[i]); |
512 | } | 530 | } |
@@ -992,6 +1010,13 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
992 | return; | 1010 | return; |
993 | } | 1011 | } |
994 | 1012 | ||
1013 | #ifdef CPTCFG_MAC80211_DEBUGFS | ||
1014 | /* Disable last tx check if we are debugging with fixed rate */ | ||
1015 | if (lq_sta->dbg_fixed_rate) { | ||
1016 | IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); | ||
1017 | return; | ||
1018 | } | ||
1019 | #endif | ||
995 | if (!ieee80211_is_data(hdr->frame_control) || | 1020 | if (!ieee80211_is_data(hdr->frame_control) || |
996 | info->flags & IEEE80211_TX_CTL_NO_ACK) | 1021 | info->flags & IEEE80211_TX_CTL_NO_ACK) |
997 | return; | 1022 | return; |
@@ -1034,6 +1059,18 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, | |||
1034 | mac_index++; | 1059 | mac_index++; |
1035 | } | 1060 | } |
1036 | 1061 | ||
1062 | if (time_after(jiffies, | ||
1063 | (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) { | ||
1064 | int tid; | ||
1065 | IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); | ||
1066 | for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) | ||
1067 | ieee80211_stop_tx_ba_session(sta, tid); | ||
1068 | |||
1069 | iwl_mvm_rs_rate_init(mvm, sta, sband->band, false); | ||
1070 | return; | ||
1071 | } | ||
1072 | lq_sta->last_tx = jiffies; | ||
1073 | |||
1037 | /* Here we actually compare this rate to the latest LQ command */ | 1074 | /* Here we actually compare this rate to the latest LQ command */ |
1038 | if ((mac_index < 0) || | 1075 | if ((mac_index < 0) || |
1039 | (rate.sgi != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || | 1076 | (rate.sgi != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || |
@@ -1186,9 +1223,26 @@ static void rs_set_stay_in_table(struct iwl_mvm *mvm, u8 is_legacy, | |||
1186 | lq_sta->visited_columns = 0; | 1223 | lq_sta->visited_columns = 0; |
1187 | } | 1224 | } |
1188 | 1225 | ||
1226 | static int rs_get_max_allowed_rate(struct iwl_lq_sta *lq_sta, | ||
1227 | const struct rs_tx_column *column) | ||
1228 | { | ||
1229 | switch (column->mode) { | ||
1230 | case RS_LEGACY: | ||
1231 | return lq_sta->max_legacy_rate_idx; | ||
1232 | case RS_SISO: | ||
1233 | return lq_sta->max_siso_rate_idx; | ||
1234 | case RS_MIMO2: | ||
1235 | return lq_sta->max_mimo2_rate_idx; | ||
1236 | default: | ||
1237 | WARN_ON_ONCE(1); | ||
1238 | } | ||
1239 | |||
1240 | return lq_sta->max_legacy_rate_idx; | ||
1241 | } | ||
1242 | |||
1189 | static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, | 1243 | static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, |
1190 | const struct rs_tx_column *column, | 1244 | const struct rs_tx_column *column, |
1191 | u32 bw) | 1245 | u32 bw) |
1192 | { | 1246 | { |
1193 | /* Used to choose among HT tables */ | 1247 | /* Used to choose among HT tables */ |
1194 | const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT]; | 1248 | const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT]; |
@@ -1438,7 +1492,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) | |||
1438 | 1492 | ||
1439 | IWL_DEBUG_RATE(mvm, | 1493 | IWL_DEBUG_RATE(mvm, |
1440 | "LQ: stay in table clear win\n"); | 1494 | "LQ: stay in table clear win\n"); |
1441 | rs_rate_scale_clear_tbl_windows(tbl); | 1495 | rs_rate_scale_clear_tbl_windows(mvm, tbl); |
1442 | } | 1496 | } |
1443 | } | 1497 | } |
1444 | 1498 | ||
@@ -1446,8 +1500,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) | |||
1446 | * bitmaps and stats in active table (this will become the new | 1500 | * bitmaps and stats in active table (this will become the new |
1447 | * "search" table). */ | 1501 | * "search" table). */ |
1448 | if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) { | 1502 | if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) { |
1449 | IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); | 1503 | rs_rate_scale_clear_tbl_windows(mvm, tbl); |
1450 | rs_rate_scale_clear_tbl_windows(tbl); | ||
1451 | } | 1504 | } |
1452 | } | 1505 | } |
1453 | } | 1506 | } |
@@ -1485,14 +1538,14 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1485 | struct ieee80211_sta *sta, | 1538 | struct ieee80211_sta *sta, |
1486 | struct iwl_scale_tbl_info *tbl) | 1539 | struct iwl_scale_tbl_info *tbl) |
1487 | { | 1540 | { |
1488 | int i, j, n; | 1541 | int i, j, max_rate; |
1489 | enum rs_column next_col_id; | 1542 | enum rs_column next_col_id; |
1490 | const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column]; | 1543 | const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column]; |
1491 | const struct rs_tx_column *next_col; | 1544 | const struct rs_tx_column *next_col; |
1492 | allow_column_func_t allow_func; | 1545 | allow_column_func_t allow_func; |
1493 | u8 valid_ants = mvm->fw->valid_tx_ant; | 1546 | u8 valid_ants = mvm->fw->valid_tx_ant; |
1494 | const u16 *expected_tpt_tbl; | 1547 | const u16 *expected_tpt_tbl; |
1495 | s32 tpt, max_expected_tpt; | 1548 | u16 tpt, max_expected_tpt; |
1496 | 1549 | ||
1497 | for (i = 0; i < MAX_NEXT_COLUMNS; i++) { | 1550 | for (i = 0; i < MAX_NEXT_COLUMNS; i++) { |
1498 | next_col_id = curr_col->next_columns[i]; | 1551 | next_col_id = curr_col->next_columns[i]; |
@@ -1535,11 +1588,11 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1535 | if (WARN_ON_ONCE(!expected_tpt_tbl)) | 1588 | if (WARN_ON_ONCE(!expected_tpt_tbl)) |
1536 | continue; | 1589 | continue; |
1537 | 1590 | ||
1538 | max_expected_tpt = 0; | 1591 | max_rate = rs_get_max_allowed_rate(lq_sta, next_col); |
1539 | for (n = 0; n < IWL_RATE_COUNT; n++) | 1592 | if (WARN_ON_ONCE(max_rate == IWL_RATE_INVALID)) |
1540 | if (expected_tpt_tbl[n] > max_expected_tpt) | 1593 | continue; |
1541 | max_expected_tpt = expected_tpt_tbl[n]; | ||
1542 | 1594 | ||
1595 | max_expected_tpt = expected_tpt_tbl[max_rate]; | ||
1543 | if (tpt >= max_expected_tpt) { | 1596 | if (tpt >= max_expected_tpt) { |
1544 | IWL_DEBUG_RATE(mvm, | 1597 | IWL_DEBUG_RATE(mvm, |
1545 | "Skip column %d: can't beat current TPT. Max expected %d current %d\n", | 1598 | "Skip column %d: can't beat current TPT. Max expected %d current %d\n", |
@@ -1547,14 +1600,15 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
1547 | continue; | 1600 | continue; |
1548 | } | 1601 | } |
1549 | 1602 | ||
1603 | IWL_DEBUG_RATE(mvm, | ||
1604 | "Found potential column %d. Max expected %d current %d\n", | ||
1605 | next_col_id, max_expected_tpt, tpt); | ||
1550 | break; | 1606 | break; |
1551 | } | 1607 | } |
1552 | 1608 | ||
1553 | if (i == MAX_NEXT_COLUMNS) | 1609 | if (i == MAX_NEXT_COLUMNS) |
1554 | return RS_COLUMN_INVALID; | 1610 | return RS_COLUMN_INVALID; |
1555 | 1611 | ||
1556 | IWL_DEBUG_RATE(mvm, "Found potential column %d\n", next_col_id); | ||
1557 | |||
1558 | return next_col_id; | 1612 | return next_col_id; |
1559 | } | 1613 | } |
1560 | 1614 | ||
@@ -1640,85 +1694,76 @@ static enum rs_action rs_get_rate_action(struct iwl_mvm *mvm, | |||
1640 | { | 1694 | { |
1641 | enum rs_action action = RS_ACTION_STAY; | 1695 | enum rs_action action = RS_ACTION_STAY; |
1642 | 1696 | ||
1643 | /* Too many failures, decrease rate */ | ||
1644 | if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) { | 1697 | if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) { |
1645 | IWL_DEBUG_RATE(mvm, | 1698 | IWL_DEBUG_RATE(mvm, |
1646 | "decrease rate because of low SR\n"); | 1699 | "Decrease rate because of low SR\n"); |
1647 | action = RS_ACTION_DOWNSCALE; | 1700 | return RS_ACTION_DOWNSCALE; |
1648 | /* No throughput measured yet for adjacent rates; try increase. */ | ||
1649 | } else if ((low_tpt == IWL_INVALID_VALUE) && | ||
1650 | (high_tpt == IWL_INVALID_VALUE)) { | ||
1651 | if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) { | ||
1652 | IWL_DEBUG_RATE(mvm, | ||
1653 | "Good SR and no high rate measurement. " | ||
1654 | "Increase rate\n"); | ||
1655 | action = RS_ACTION_UPSCALE; | ||
1656 | } else if (low != IWL_RATE_INVALID) { | ||
1657 | IWL_DEBUG_RATE(mvm, | ||
1658 | "Remain in current rate\n"); | ||
1659 | action = RS_ACTION_STAY; | ||
1660 | } | ||
1661 | } | 1701 | } |
1662 | 1702 | ||
1663 | /* Both adjacent throughputs are measured, but neither one has better | 1703 | if ((low_tpt == IWL_INVALID_VALUE) && |
1664 | * throughput; we're using the best rate, don't change it! | 1704 | (high_tpt == IWL_INVALID_VALUE) && |
1665 | */ | 1705 | (high != IWL_RATE_INVALID)) { |
1666 | else if ((low_tpt != IWL_INVALID_VALUE) && | ||
1667 | (high_tpt != IWL_INVALID_VALUE) && | ||
1668 | (low_tpt < current_tpt) && | ||
1669 | (high_tpt < current_tpt)) { | ||
1670 | IWL_DEBUG_RATE(mvm, | 1706 | IWL_DEBUG_RATE(mvm, |
1671 | "Both high and low are worse. " | 1707 | "No data about high/low rates. Increase rate\n"); |
1672 | "Maintain rate\n"); | 1708 | return RS_ACTION_UPSCALE; |
1673 | action = RS_ACTION_STAY; | ||
1674 | } | 1709 | } |
1675 | 1710 | ||
1676 | /* At least one adjacent rate's throughput is measured, | 1711 | if ((high_tpt == IWL_INVALID_VALUE) && |
1677 | * and may have better performance. | 1712 | (high != IWL_RATE_INVALID) && |
1678 | */ | 1713 | (low_tpt != IWL_INVALID_VALUE) && |
1679 | else { | 1714 | (low_tpt < current_tpt)) { |
1680 | /* Higher adjacent rate's throughput is measured */ | 1715 | IWL_DEBUG_RATE(mvm, |
1681 | if (high_tpt != IWL_INVALID_VALUE) { | 1716 | "No data about high rate and low rate is worse. Increase rate\n"); |
1682 | /* Higher rate has better throughput */ | 1717 | return RS_ACTION_UPSCALE; |
1683 | if (high_tpt > current_tpt && | 1718 | } |
1684 | sr >= IWL_RATE_INCREASE_TH) { | ||
1685 | IWL_DEBUG_RATE(mvm, | ||
1686 | "Higher rate is better and good " | ||
1687 | "SR. Increate rate\n"); | ||
1688 | action = RS_ACTION_UPSCALE; | ||
1689 | } else { | ||
1690 | IWL_DEBUG_RATE(mvm, | ||
1691 | "Higher rate isn't better OR " | ||
1692 | "no good SR. Maintain rate\n"); | ||
1693 | action = RS_ACTION_STAY; | ||
1694 | } | ||
1695 | 1719 | ||
1696 | /* Lower adjacent rate's throughput is measured */ | 1720 | if ((high_tpt != IWL_INVALID_VALUE) && |
1697 | } else if (low_tpt != IWL_INVALID_VALUE) { | 1721 | (high_tpt > current_tpt)) { |
1698 | /* Lower rate has better throughput */ | 1722 | IWL_DEBUG_RATE(mvm, |
1699 | if (low_tpt > current_tpt) { | 1723 | "Higher rate is better. Increate rate\n"); |
1700 | IWL_DEBUG_RATE(mvm, | 1724 | return RS_ACTION_UPSCALE; |
1701 | "Lower rate is better. " | ||
1702 | "Decrease rate\n"); | ||
1703 | action = RS_ACTION_DOWNSCALE; | ||
1704 | } else if (sr >= IWL_RATE_INCREASE_TH) { | ||
1705 | IWL_DEBUG_RATE(mvm, | ||
1706 | "Lower rate isn't better and " | ||
1707 | "good SR. Increase rate\n"); | ||
1708 | action = RS_ACTION_UPSCALE; | ||
1709 | } | ||
1710 | } | ||
1711 | } | 1725 | } |
1712 | 1726 | ||
1713 | /* Sanity check; asked for decrease, but success rate or throughput | 1727 | if ((low_tpt != IWL_INVALID_VALUE) && |
1714 | * has been good at old rate. Don't change it. | 1728 | (high_tpt != IWL_INVALID_VALUE) && |
1715 | */ | 1729 | (low_tpt < current_tpt) && |
1716 | if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID) && | 1730 | (high_tpt < current_tpt)) { |
1717 | ((sr > IWL_RATE_HIGH_TH) || | 1731 | IWL_DEBUG_RATE(mvm, |
1718 | (current_tpt > (100 * tbl->expected_tpt[low])))) { | 1732 | "Both high and low are worse. Maintain rate\n"); |
1733 | return RS_ACTION_STAY; | ||
1734 | } | ||
1735 | |||
1736 | if ((low_tpt != IWL_INVALID_VALUE) && | ||
1737 | (low_tpt > current_tpt)) { | ||
1738 | IWL_DEBUG_RATE(mvm, | ||
1739 | "Lower rate is better\n"); | ||
1740 | action = RS_ACTION_DOWNSCALE; | ||
1741 | goto out; | ||
1742 | } | ||
1743 | |||
1744 | if ((low_tpt == IWL_INVALID_VALUE) && | ||
1745 | (low != IWL_RATE_INVALID)) { | ||
1719 | IWL_DEBUG_RATE(mvm, | 1746 | IWL_DEBUG_RATE(mvm, |
1720 | "Sanity check failed. Maintain rate\n"); | 1747 | "No data about lower rate\n"); |
1721 | action = RS_ACTION_STAY; | 1748 | action = RS_ACTION_DOWNSCALE; |
1749 | goto out; | ||
1750 | } | ||
1751 | |||
1752 | IWL_DEBUG_RATE(mvm, "Maintain rate\n"); | ||
1753 | |||
1754 | out: | ||
1755 | if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) { | ||
1756 | if (sr >= RS_SR_NO_DECREASE) { | ||
1757 | IWL_DEBUG_RATE(mvm, | ||
1758 | "SR is above NO DECREASE. Avoid downscale\n"); | ||
1759 | action = RS_ACTION_STAY; | ||
1760 | } else if (current_tpt > (100 * tbl->expected_tpt[low])) { | ||
1761 | IWL_DEBUG_RATE(mvm, | ||
1762 | "Current TPT is higher than max expected in low rate. Avoid downscale\n"); | ||
1763 | action = RS_ACTION_STAY; | ||
1764 | } else { | ||
1765 | IWL_DEBUG_RATE(mvm, "Decrease rate\n"); | ||
1766 | } | ||
1722 | } | 1767 | } |
1723 | 1768 | ||
1724 | return action; | 1769 | return action; |
@@ -1792,6 +1837,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, | |||
1792 | "Aggregation changed: prev %d current %d. Update expected TPT table\n", | 1837 | "Aggregation changed: prev %d current %d. Update expected TPT table\n", |
1793 | prev_agg, lq_sta->is_agg); | 1838 | prev_agg, lq_sta->is_agg); |
1794 | rs_set_expected_tpt_table(lq_sta, tbl); | 1839 | rs_set_expected_tpt_table(lq_sta, tbl); |
1840 | rs_rate_scale_clear_tbl_windows(mvm, tbl); | ||
1795 | } | 1841 | } |
1796 | 1842 | ||
1797 | /* current tx rate */ | 1843 | /* current tx rate */ |
@@ -2021,7 +2067,7 @@ lq_update: | |||
2021 | if (lq_sta->search_better_tbl) { | 2067 | if (lq_sta->search_better_tbl) { |
2022 | /* Access the "search" table, clear its history. */ | 2068 | /* Access the "search" table, clear its history. */ |
2023 | tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | 2069 | tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
2024 | rs_rate_scale_clear_tbl_windows(tbl); | 2070 | rs_rate_scale_clear_tbl_windows(mvm, tbl); |
2025 | 2071 | ||
2026 | /* Use new "search" start rate */ | 2072 | /* Use new "search" start rate */ |
2027 | index = tbl->rate.index; | 2073 | index = tbl->rate.index; |
@@ -2042,8 +2088,18 @@ lq_update: | |||
2042 | * stay with best antenna legacy modulation for a while | 2088 | * stay with best antenna legacy modulation for a while |
2043 | * before next round of mode comparisons. */ | 2089 | * before next round of mode comparisons. */ |
2044 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); | 2090 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); |
2045 | if (is_legacy(&tbl1->rate) && !sta->ht_cap.ht_supported) { | 2091 | if (is_legacy(&tbl1->rate)) { |
2046 | IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n"); | 2092 | IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n"); |
2093 | |||
2094 | if (tid != IWL_MAX_TID_COUNT) { | ||
2095 | tid_data = &sta_priv->tid_data[tid]; | ||
2096 | if (tid_data->state != IWL_AGG_OFF) { | ||
2097 | IWL_DEBUG_RATE(mvm, | ||
2098 | "Stop aggregation on tid %d\n", | ||
2099 | tid); | ||
2100 | ieee80211_stop_tx_ba_session(sta, tid); | ||
2101 | } | ||
2102 | } | ||
2047 | rs_set_stay_in_table(mvm, 1, lq_sta); | 2103 | rs_set_stay_in_table(mvm, 1, lq_sta); |
2048 | } else { | 2104 | } else { |
2049 | /* If we're in an HT mode, and all 3 mode switch actions | 2105 | /* If we're in an HT mode, and all 3 mode switch actions |
@@ -2342,9 +2398,10 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
2342 | lq_sta->lq.sta_id = sta_priv->sta_id; | 2398 | lq_sta->lq.sta_id = sta_priv->sta_id; |
2343 | 2399 | ||
2344 | for (j = 0; j < LQ_SIZE; j++) | 2400 | for (j = 0; j < LQ_SIZE; j++) |
2345 | rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]); | 2401 | rs_rate_scale_clear_tbl_windows(mvm, &lq_sta->lq_info[j]); |
2346 | 2402 | ||
2347 | lq_sta->flush_timer = 0; | 2403 | lq_sta->flush_timer = 0; |
2404 | lq_sta->last_tx = jiffies; | ||
2348 | 2405 | ||
2349 | IWL_DEBUG_RATE(mvm, | 2406 | IWL_DEBUG_RATE(mvm, |
2350 | "LQ: *** rate scale station global init for station %d ***\n", | 2407 | "LQ: *** rate scale station global init for station %d ***\n", |
@@ -2388,11 +2445,22 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
2388 | lq_sta->is_vht = true; | 2445 | lq_sta->is_vht = true; |
2389 | } | 2446 | } |
2390 | 2447 | ||
2391 | IWL_DEBUG_RATE(mvm, | 2448 | lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate, |
2392 | "SISO-RATE=%X MIMO2-RATE=%X VHT=%d\n", | 2449 | BITS_PER_LONG); |
2450 | lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate, | ||
2451 | BITS_PER_LONG); | ||
2452 | lq_sta->max_mimo2_rate_idx = find_last_bit(&lq_sta->active_mimo2_rate, | ||
2453 | BITS_PER_LONG); | ||
2454 | |||
2455 | IWL_DEBUG_RATE(mvm, "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d\n", | ||
2456 | lq_sta->active_legacy_rate, | ||
2393 | lq_sta->active_siso_rate, | 2457 | lq_sta->active_siso_rate, |
2394 | lq_sta->active_mimo2_rate, | 2458 | lq_sta->active_mimo2_rate, |
2395 | lq_sta->is_vht); | 2459 | lq_sta->is_vht); |
2460 | IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n", | ||
2461 | lq_sta->max_legacy_rate_idx, | ||
2462 | lq_sta->max_siso_rate_idx, | ||
2463 | lq_sta->max_mimo2_rate_idx); | ||
2396 | 2464 | ||
2397 | /* These values will be overridden later */ | 2465 | /* These values will be overridden later */ |
2398 | lq_sta->lq.single_stream_ant_msk = | 2466 | lq_sta->lq.single_stream_ant_msk = |
@@ -2547,6 +2615,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm, | |||
2547 | if (is_siso(&rate)) { | 2615 | if (is_siso(&rate)) { |
2548 | num_rates = RS_SECONDARY_SISO_NUM_RATES; | 2616 | num_rates = RS_SECONDARY_SISO_NUM_RATES; |
2549 | num_retries = RS_SECONDARY_SISO_RETRIES; | 2617 | num_retries = RS_SECONDARY_SISO_RETRIES; |
2618 | lq_cmd->mimo_delim = index; | ||
2550 | } else if (is_legacy(&rate)) { | 2619 | } else if (is_legacy(&rate)) { |
2551 | num_rates = RS_SECONDARY_LEGACY_NUM_RATES; | 2620 | num_rates = RS_SECONDARY_LEGACY_NUM_RATES; |
2552 | num_retries = RS_LEGACY_RETRIES_PER_RATE; | 2621 | num_retries = RS_LEGACY_RETRIES_PER_RATE; |
@@ -2749,7 +2818,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2749 | return -ENOMEM; | 2818 | return -ENOMEM; |
2750 | 2819 | ||
2751 | desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); | 2820 | desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); |
2752 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", | 2821 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%lX\n", |
2753 | lq_sta->total_failed, lq_sta->total_success, | 2822 | lq_sta->total_failed, lq_sta->total_success, |
2754 | lq_sta->active_legacy_rate); | 2823 | lq_sta->active_legacy_rate); |
2755 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", | 2824 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h index 3332b396011e..0acfac96a56c 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ b/drivers/net/wireless/iwlwifi/mvm/rs.h | |||
@@ -156,6 +156,7 @@ enum { | |||
156 | #define IWL_RATE_HIGH_TH 10880 /* 85% */ | 156 | #define IWL_RATE_HIGH_TH 10880 /* 85% */ |
157 | #define IWL_RATE_INCREASE_TH 6400 /* 50% */ | 157 | #define IWL_RATE_INCREASE_TH 6400 /* 50% */ |
158 | #define RS_SR_FORCE_DECREASE 1920 /* 15% */ | 158 | #define RS_SR_FORCE_DECREASE 1920 /* 15% */ |
159 | #define RS_SR_NO_DECREASE 10880 /* 85% */ | ||
159 | 160 | ||
160 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ | 161 | #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ |
161 | #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) | 162 | #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) |
@@ -310,13 +311,20 @@ struct iwl_lq_sta { | |||
310 | u32 visited_columns; /* Bitmask marking which Tx columns were | 311 | u32 visited_columns; /* Bitmask marking which Tx columns were |
311 | * explored during a search cycle | 312 | * explored during a search cycle |
312 | */ | 313 | */ |
314 | u64 last_tx; | ||
313 | bool is_vht; | 315 | bool is_vht; |
314 | enum ieee80211_band band; | 316 | enum ieee80211_band band; |
315 | 317 | ||
316 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ | 318 | /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ |
317 | u16 active_legacy_rate; | 319 | unsigned long active_legacy_rate; |
318 | u16 active_siso_rate; | 320 | unsigned long active_siso_rate; |
319 | u16 active_mimo2_rate; | 321 | unsigned long active_mimo2_rate; |
322 | |||
323 | /* Highest rate per Tx mode */ | ||
324 | u8 max_legacy_rate_idx; | ||
325 | u8 max_siso_rate_idx; | ||
326 | u8 max_mimo2_rate_idx; | ||
327 | |||
320 | s8 max_rate_idx; /* Max rate set by user */ | 328 | s8 max_rate_idx; /* Max rate set by user */ |
321 | u8 missed_rate_counter; | 329 | u8 missed_rate_counter; |
322 | 330 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c index 8401627c0030..88809b2d1654 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/iwlwifi/mvm/sf.c | |||
@@ -274,7 +274,8 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, | |||
274 | return -EINVAL; | 274 | return -EINVAL; |
275 | if (changed_vif->type != NL80211_IFTYPE_STATION) { | 275 | if (changed_vif->type != NL80211_IFTYPE_STATION) { |
276 | new_state = SF_UNINIT; | 276 | new_state = SF_UNINIT; |
277 | } else if (changed_vif->bss_conf.assoc) { | 277 | } else if (changed_vif->bss_conf.assoc && |
278 | changed_vif->bss_conf.dtim_period) { | ||
278 | mvmvif = iwl_mvm_vif_from_mac80211(changed_vif); | 279 | mvmvif = iwl_mvm_vif_from_mac80211(changed_vif); |
279 | sta_id = mvmvif->ap_sta_id; | 280 | sta_id = mvmvif->ap_sta_id; |
280 | new_state = SF_FULL_ON; | 281 | new_state = SF_FULL_ON; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index edb015c99049..3d1d57f9f5bc 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -373,12 +373,14 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
373 | {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, | 373 | {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, |
374 | {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, | 374 | {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, |
375 | {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, | 375 | {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, |
376 | {IWL_PCI_DEVICE(0x095A, 0x5102, iwl7265_n_cfg)}, | ||
376 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, | 377 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, |
377 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, | 378 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, |
378 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, | 379 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, |
379 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 380 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
380 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 381 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
381 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 382 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
383 | {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)}, | ||
382 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, | 384 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, |
383 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, | 385 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, |
384 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 77db0886c6e2..9c771b3e9918 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -292,6 +292,12 @@ process_start: | |||
292 | while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) | 292 | while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) |
293 | mwifiex_handle_rx_packet(adapter, skb); | 293 | mwifiex_handle_rx_packet(adapter, skb); |
294 | 294 | ||
295 | /* Check for event */ | ||
296 | if (adapter->event_received) { | ||
297 | adapter->event_received = false; | ||
298 | mwifiex_process_event(adapter); | ||
299 | } | ||
300 | |||
295 | /* Check for Cmd Resp */ | 301 | /* Check for Cmd Resp */ |
296 | if (adapter->cmd_resp_received) { | 302 | if (adapter->cmd_resp_received) { |
297 | adapter->cmd_resp_received = false; | 303 | adapter->cmd_resp_received = false; |
@@ -304,12 +310,6 @@ process_start: | |||
304 | } | 310 | } |
305 | } | 311 | } |
306 | 312 | ||
307 | /* Check for event */ | ||
308 | if (adapter->event_received) { | ||
309 | adapter->event_received = false; | ||
310 | mwifiex_process_event(adapter); | ||
311 | } | ||
312 | |||
313 | /* Check if we need to confirm Sleep Request | 313 | /* Check if we need to confirm Sleep Request |
314 | received previously */ | 314 | received previously */ |
315 | if (adapter->ps_state == PS_STATE_PRE_SLEEP) { | 315 | if (adapter->ps_state == PS_STATE_PRE_SLEEP) { |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 894270611f2c..536c14aa71f3 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -60,9 +60,10 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, | |||
60 | int status; | 60 | int status; |
61 | 61 | ||
62 | /* Wait for completion */ | 62 | /* Wait for completion */ |
63 | status = wait_event_interruptible(adapter->cmd_wait_q.wait, | 63 | status = wait_event_interruptible_timeout(adapter->cmd_wait_q.wait, |
64 | *(cmd_queued->condition)); | 64 | *(cmd_queued->condition), |
65 | if (status) { | 65 | (12 * HZ)); |
66 | if (status <= 0) { | ||
66 | dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); | 67 | dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); |
67 | mwifiex_cancel_all_pending_cmd(adapter); | 68 | mwifiex_cancel_all_pending_cmd(adapter); |
68 | return status; | 69 | return status; |
diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c b/drivers/net/wireless/rsi/rsi_91x_core.c index 1a8d32138593..cf61d6e3eaa7 100644 --- a/drivers/net/wireless/rsi/rsi_91x_core.c +++ b/drivers/net/wireless/rsi/rsi_91x_core.c | |||
@@ -88,7 +88,7 @@ static u8 rsi_core_determine_hal_queue(struct rsi_common *common) | |||
88 | bool recontend_queue = false; | 88 | bool recontend_queue = false; |
89 | u32 q_len = 0; | 89 | u32 q_len = 0; |
90 | u8 q_num = INVALID_QUEUE; | 90 | u8 q_num = INVALID_QUEUE; |
91 | u8 ii, min = 0; | 91 | u8 ii = 0, min = 0; |
92 | 92 | ||
93 | if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) { | 93 | if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) { |
94 | if (!common->mgmt_q_block) | 94 | if (!common->mgmt_q_block) |
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 73694295648f..1b28cda6ca88 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c | |||
@@ -841,16 +841,6 @@ int rsi_set_channel(struct rsi_common *common, u16 channel) | |||
841 | rsi_dbg(MGMT_TX_ZONE, | 841 | rsi_dbg(MGMT_TX_ZONE, |
842 | "%s: Sending scan req frame\n", __func__); | 842 | "%s: Sending scan req frame\n", __func__); |
843 | 843 | ||
844 | skb = dev_alloc_skb(FRAME_DESC_SZ); | ||
845 | if (!skb) { | ||
846 | rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", | ||
847 | __func__); | ||
848 | return -ENOMEM; | ||
849 | } | ||
850 | |||
851 | memset(skb->data, 0, FRAME_DESC_SZ); | ||
852 | mgmt_frame = (struct rsi_mac_frame *)skb->data; | ||
853 | |||
854 | if (common->band == IEEE80211_BAND_5GHZ) { | 844 | if (common->band == IEEE80211_BAND_5GHZ) { |
855 | if ((channel >= 36) && (channel <= 64)) | 845 | if ((channel >= 36) && (channel <= 64)) |
856 | channel = ((channel - 32) / 4); | 846 | channel = ((channel - 32) / 4); |
@@ -868,6 +858,16 @@ int rsi_set_channel(struct rsi_common *common, u16 channel) | |||
868 | } | 858 | } |
869 | } | 859 | } |
870 | 860 | ||
861 | skb = dev_alloc_skb(FRAME_DESC_SZ); | ||
862 | if (!skb) { | ||
863 | rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", | ||
864 | __func__); | ||
865 | return -ENOMEM; | ||
866 | } | ||
867 | |||
868 | memset(skb->data, 0, FRAME_DESC_SZ); | ||
869 | mgmt_frame = (struct rsi_mac_frame *)skb->data; | ||
870 | |||
871 | mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); | 871 | mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); |
872 | mgmt_frame->desc_word[1] = cpu_to_le16(SCAN_REQUEST); | 872 | mgmt_frame->desc_word[1] = cpu_to_le16(SCAN_REQUEST); |
873 | mgmt_frame->desc_word[4] = cpu_to_le16(channel); | 873 | mgmt_frame->desc_word[4] = cpu_to_le16(channel); |
@@ -966,6 +966,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common) | |||
966 | if (!selected_rates) { | 966 | if (!selected_rates) { |
967 | rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n", | 967 | rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n", |
968 | __func__); | 968 | __func__); |
969 | dev_kfree_skb(skb); | ||
969 | return -ENOMEM; | 970 | return -ENOMEM; |
970 | } | 971 | } |
971 | 972 | ||
diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h index 398f3d2c0a6c..a76e98eb8372 100644 --- a/drivers/net/wireless/ti/wl18xx/event.h +++ b/drivers/net/wireless/ti/wl18xx/event.h | |||
@@ -68,6 +68,26 @@ struct wl18xx_event_mailbox { | |||
68 | 68 | ||
69 | /* bitmap of inactive stations (by HLID) */ | 69 | /* bitmap of inactive stations (by HLID) */ |
70 | __le32 inactive_sta_bitmap; | 70 | __le32 inactive_sta_bitmap; |
71 | |||
72 | /* rx BA win size indicated by RX_BA_WIN_SIZE_CHANGE_EVENT_ID */ | ||
73 | u8 rx_ba_role_id; | ||
74 | u8 rx_ba_link_id; | ||
75 | u8 rx_ba_win_size; | ||
76 | u8 padding; | ||
77 | |||
78 | /* smart config */ | ||
79 | u8 sc_ssid_len; | ||
80 | u8 sc_pwd_len; | ||
81 | u8 sc_token_len; | ||
82 | u8 padding1; | ||
83 | u8 sc_ssid[32]; | ||
84 | u8 sc_pwd[32]; | ||
85 | u8 sc_token[32]; | ||
86 | |||
87 | /* smart config sync channel */ | ||
88 | u8 sc_sync_channel; | ||
89 | u8 sc_sync_band; | ||
90 | u8 padding2[2]; | ||
71 | } __packed; | 91 | } __packed; |
72 | 92 | ||
73 | int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, | 93 | int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, |
diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c index 1f9a36031b06..16d10281798d 100644 --- a/drivers/net/wireless/ti/wlcore/event.c +++ b/drivers/net/wireless/ti/wlcore/event.c | |||
@@ -158,6 +158,11 @@ EXPORT_SYMBOL_GPL(wlcore_event_channel_switch); | |||
158 | 158 | ||
159 | void wlcore_event_dummy_packet(struct wl1271 *wl) | 159 | void wlcore_event_dummy_packet(struct wl1271 *wl) |
160 | { | 160 | { |
161 | if (wl->plt) { | ||
162 | wl1271_info("Got DUMMY_PACKET event in PLT mode. FW bug, ignoring."); | ||
163 | return; | ||
164 | } | ||
165 | |||
161 | wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); | 166 | wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); |
162 | wl1271_tx_dummy_packet(wl); | 167 | wl1271_tx_dummy_packet(wl); |
163 | } | 168 | } |
diff --git a/drivers/of/base.c b/drivers/of/base.c index f72d19b7e5d2..6d4ee22708c9 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1828,17 +1828,13 @@ int of_update_property(struct device_node *np, struct property *newprop) | |||
1828 | next = &(*next)->next; | 1828 | next = &(*next)->next; |
1829 | } | 1829 | } |
1830 | raw_spin_unlock_irqrestore(&devtree_lock, flags); | 1830 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
1831 | if (rc) | 1831 | if (!found) |
1832 | return rc; | 1832 | return -ENODEV; |
1833 | 1833 | ||
1834 | /* Update the sysfs attribute */ | 1834 | /* Update the sysfs attribute */ |
1835 | if (oldprop) | 1835 | sysfs_remove_bin_file(&np->kobj, &oldprop->attr); |
1836 | sysfs_remove_bin_file(&np->kobj, &oldprop->attr); | ||
1837 | __of_add_property_sysfs(np, newprop); | 1836 | __of_add_property_sysfs(np, newprop); |
1838 | 1837 | ||
1839 | if (!found) | ||
1840 | return -ENODEV; | ||
1841 | |||
1842 | return 0; | 1838 | return 0; |
1843 | } | 1839 | } |
1844 | 1840 | ||
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa16a912a927..7a2ef7bb8022 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -491,7 +491,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, | |||
491 | * in /reserved-memory matches the values supported by the current implementation, | 491 | * in /reserved-memory matches the values supported by the current implementation, |
492 | * also check if ranges property has been provided | 492 | * also check if ranges property has been provided |
493 | */ | 493 | */ |
494 | static int __reserved_mem_check_root(unsigned long node) | 494 | static int __init __reserved_mem_check_root(unsigned long node) |
495 | { | 495 | { |
496 | __be32 *prop; | 496 | __be32 *prop; |
497 | 497 | ||
diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index fd3e3ab56509..4fe349dcaf59 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/of_pci.h> | ||
18 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
20 | #include <linux/pm_runtime.h> | 21 | #include <linux/pm_runtime.h> |
@@ -180,8 +181,13 @@ static int rcar_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
180 | { | 181 | { |
181 | struct pci_sys_data *sys = dev->bus->sysdata; | 182 | struct pci_sys_data *sys = dev->bus->sysdata; |
182 | struct rcar_pci_priv *priv = sys->private_data; | 183 | struct rcar_pci_priv *priv = sys->private_data; |
184 | int irq; | ||
185 | |||
186 | irq = of_irq_parse_and_map_pci(dev, slot, pin); | ||
187 | if (!irq) | ||
188 | irq = priv->irq; | ||
183 | 189 | ||
184 | return priv->irq; | 190 | return irq; |
185 | } | 191 | } |
186 | 192 | ||
187 | #ifdef CONFIG_PCI_DEBUG | 193 | #ifdef CONFIG_PCI_DEBUG |
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 330f7e3a32dd..083cf37ca047 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -639,10 +639,15 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
639 | static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin) | 639 | static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin) |
640 | { | 640 | { |
641 | struct tegra_pcie *pcie = sys_to_pcie(pdev->bus->sysdata); | 641 | struct tegra_pcie *pcie = sys_to_pcie(pdev->bus->sysdata); |
642 | int irq; | ||
642 | 643 | ||
643 | tegra_cpuidle_pcie_irqs_in_use(); | 644 | tegra_cpuidle_pcie_irqs_in_use(); |
644 | 645 | ||
645 | return pcie->irq; | 646 | irq = of_irq_parse_and_map_pci(pdev, slot, pin); |
647 | if (!irq) | ||
648 | irq = pcie->irq; | ||
649 | |||
650 | return irq; | ||
646 | } | 651 | } |
647 | 652 | ||
648 | static void tegra_pcie_add_bus(struct pci_bus *bus) | 653 | static void tegra_pcie_add_bus(struct pci_bus *bus) |
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 509a29d84509..c4e373294476 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/msi.h> | 18 | #include <linux/msi.h> |
19 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
20 | #include <linux/of_pci.h> | ||
20 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
21 | #include <linux/pci_regs.h> | 22 | #include <linux/pci_regs.h> |
22 | #include <linux/types.h> | 23 | #include <linux/types.h> |
@@ -490,7 +491,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
490 | dw_pci.nr_controllers = 1; | 491 | dw_pci.nr_controllers = 1; |
491 | dw_pci.private_data = (void **)&pp; | 492 | dw_pci.private_data = (void **)&pp; |
492 | 493 | ||
493 | pci_common_init(&dw_pci); | 494 | pci_common_init_dev(pp->dev, &dw_pci); |
494 | pci_assign_unassigned_resources(); | 495 | pci_assign_unassigned_resources(); |
495 | #ifdef CONFIG_PCI_DOMAINS | 496 | #ifdef CONFIG_PCI_DOMAINS |
496 | dw_pci.domain++; | 497 | dw_pci.domain++; |
@@ -520,13 +521,13 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev) | |||
520 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 521 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
521 | PCIE_ATU_VIEWPORT); | 522 | PCIE_ATU_VIEWPORT); |
522 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); | 523 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); |
523 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
524 | dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); | 524 | dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); |
525 | dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); | 525 | dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); |
526 | dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, | 526 | dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, |
527 | PCIE_ATU_LIMIT); | 527 | PCIE_ATU_LIMIT); |
528 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); | 528 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
529 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); | 529 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
530 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
530 | } | 531 | } |
531 | 532 | ||
532 | static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) | 533 | static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) |
@@ -535,7 +536,6 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) | |||
535 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, | 536 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
536 | PCIE_ATU_VIEWPORT); | 537 | PCIE_ATU_VIEWPORT); |
537 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); | 538 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); |
538 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
539 | dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); | 539 | dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); |
540 | dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); | 540 | dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); |
541 | dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, | 541 | dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, |
@@ -543,6 +543,7 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) | |||
543 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); | 543 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); |
544 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), | 544 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), |
545 | PCIE_ATU_UPPER_TARGET); | 545 | PCIE_ATU_UPPER_TARGET); |
546 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
546 | } | 547 | } |
547 | 548 | ||
548 | static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) | 549 | static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) |
@@ -551,7 +552,6 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) | |||
551 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 552 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
552 | PCIE_ATU_VIEWPORT); | 553 | PCIE_ATU_VIEWPORT); |
553 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); | 554 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); |
554 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
555 | dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); | 555 | dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); |
556 | dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); | 556 | dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); |
557 | dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, | 557 | dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, |
@@ -559,6 +559,7 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) | |||
559 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); | 559 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); |
560 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), | 560 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), |
561 | PCIE_ATU_UPPER_TARGET); | 561 | PCIE_ATU_UPPER_TARGET); |
562 | dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); | ||
562 | } | 563 | } |
563 | 564 | ||
564 | static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, | 565 | static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, |
@@ -723,7 +724,7 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
723 | 724 | ||
724 | if (pp) { | 725 | if (pp) { |
725 | pp->root_bus_nr = sys->busnr; | 726 | pp->root_bus_nr = sys->busnr; |
726 | bus = pci_scan_root_bus(NULL, sys->busnr, &dw_pcie_ops, | 727 | bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops, |
727 | sys, &sys->resources); | 728 | sys, &sys->resources); |
728 | } else { | 729 | } else { |
729 | bus = NULL; | 730 | bus = NULL; |
@@ -736,8 +737,13 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys) | |||
736 | static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 737 | static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
737 | { | 738 | { |
738 | struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata); | 739 | struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata); |
740 | int irq; | ||
741 | |||
742 | irq = of_irq_parse_and_map_pci(dev, slot, pin); | ||
743 | if (!irq) | ||
744 | irq = pp->irq; | ||
739 | 745 | ||
740 | return pp->irq; | 746 | return irq; |
741 | } | 747 | } |
742 | 748 | ||
743 | static void dw_pcie_add_bus(struct pci_bus *bus) | 749 | static void dw_pcie_add_bus(struct pci_bus *bus) |
@@ -764,7 +770,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) | |||
764 | u32 membase; | 770 | u32 membase; |
765 | u32 memlimit; | 771 | u32 memlimit; |
766 | 772 | ||
767 | /* set the number of lines as 4 */ | 773 | /* set the number of lanes */ |
768 | dw_pcie_readl_rc(pp, PCIE_PORT_LINK_CONTROL, &val); | 774 | dw_pcie_readl_rc(pp, PCIE_PORT_LINK_CONTROL, &val); |
769 | val &= ~PORT_LINK_MODE_MASK; | 775 | val &= ~PORT_LINK_MODE_MASK; |
770 | switch (pp->lanes) { | 776 | switch (pp->lanes) { |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index e49324032611..e00c02d0a094 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -104,16 +104,16 @@ config PINCTRL_BCM2835 | |||
104 | select PINMUX | 104 | select PINMUX |
105 | select PINCONF | 105 | select PINCONF |
106 | 106 | ||
107 | config PINCTRL_CAPRI | 107 | config PINCTRL_BCM281XX |
108 | bool "Broadcom Capri pinctrl driver" | 108 | bool "Broadcom BCM281xx pinctrl driver" |
109 | depends on OF | 109 | depends on OF |
110 | select PINMUX | 110 | select PINMUX |
111 | select PINCONF | 111 | select PINCONF |
112 | select GENERIC_PINCONF | 112 | select GENERIC_PINCONF |
113 | select REGMAP_MMIO | 113 | select REGMAP_MMIO |
114 | help | 114 | help |
115 | Say Y here to support Broadcom Capri pinctrl driver, which is used for | 115 | Say Y here to support Broadcom BCM281xx pinctrl driver, which is used |
116 | the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351, | 116 | for the BCM281xx SoC family, including BCM11130, BCM11140, BCM11351, |
117 | BCM28145, and BCM28155 SoCs. This driver requires the pinctrl | 117 | BCM28145, and BCM28155 SoCs. This driver requires the pinctrl |
118 | framework. GPIO is provided by a separate GPIO driver. | 118 | framework. GPIO is provided by a separate GPIO driver. |
119 | 119 | ||
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index 4b835880cf80..6d3fd62b9ae8 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -21,7 +21,7 @@ obj-$(CONFIG_PINCTRL_BF60x) += pinctrl-adi2-bf60x.o | |||
21 | obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o | 21 | obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o |
22 | obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o | 22 | obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o |
23 | obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o | 23 | obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o |
24 | obj-$(CONFIG_PINCTRL_CAPRI) += pinctrl-capri.o | 24 | obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o |
25 | obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o | 25 | obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o |
26 | obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o | 26 | obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o |
27 | obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o | 27 | obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o |
diff --git a/drivers/pinctrl/pinctrl-bcm281xx.c b/drivers/pinctrl/pinctrl-bcm281xx.c new file mode 100644 index 000000000000..3bed792b2c03 --- /dev/null +++ b/drivers/pinctrl/pinctrl-bcm281xx.c | |||
@@ -0,0 +1,1461 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
9 | * kind, whether express or implied; without even the implied warranty | ||
10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/pinctrl/pinmux.h> | ||
20 | #include <linux/pinctrl/pinconf.h> | ||
21 | #include <linux/pinctrl/pinconf-generic.h> | ||
22 | #include <linux/regmap.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include "core.h" | ||
25 | #include "pinctrl-utils.h" | ||
26 | |||
27 | /* BCM281XX Pin Control Registers Definitions */ | ||
28 | |||
29 | /* Function Select bits are the same for all pin control registers */ | ||
30 | #define BCM281XX_PIN_REG_F_SEL_MASK 0x0700 | ||
31 | #define BCM281XX_PIN_REG_F_SEL_SHIFT 8 | ||
32 | |||
33 | /* Standard pin register */ | ||
34 | #define BCM281XX_STD_PIN_REG_DRV_STR_MASK 0x0007 | ||
35 | #define BCM281XX_STD_PIN_REG_DRV_STR_SHIFT 0 | ||
36 | #define BCM281XX_STD_PIN_REG_INPUT_DIS_MASK 0x0008 | ||
37 | #define BCM281XX_STD_PIN_REG_INPUT_DIS_SHIFT 3 | ||
38 | #define BCM281XX_STD_PIN_REG_SLEW_MASK 0x0010 | ||
39 | #define BCM281XX_STD_PIN_REG_SLEW_SHIFT 4 | ||
40 | #define BCM281XX_STD_PIN_REG_PULL_UP_MASK 0x0020 | ||
41 | #define BCM281XX_STD_PIN_REG_PULL_UP_SHIFT 5 | ||
42 | #define BCM281XX_STD_PIN_REG_PULL_DN_MASK 0x0040 | ||
43 | #define BCM281XX_STD_PIN_REG_PULL_DN_SHIFT 6 | ||
44 | #define BCM281XX_STD_PIN_REG_HYST_MASK 0x0080 | ||
45 | #define BCM281XX_STD_PIN_REG_HYST_SHIFT 7 | ||
46 | |||
47 | /* I2C pin register */ | ||
48 | #define BCM281XX_I2C_PIN_REG_INPUT_DIS_MASK 0x0004 | ||
49 | #define BCM281XX_I2C_PIN_REG_INPUT_DIS_SHIFT 2 | ||
50 | #define BCM281XX_I2C_PIN_REG_SLEW_MASK 0x0008 | ||
51 | #define BCM281XX_I2C_PIN_REG_SLEW_SHIFT 3 | ||
52 | #define BCM281XX_I2C_PIN_REG_PULL_UP_STR_MASK 0x0070 | ||
53 | #define BCM281XX_I2C_PIN_REG_PULL_UP_STR_SHIFT 4 | ||
54 | |||
55 | /* HDMI pin register */ | ||
56 | #define BCM281XX_HDMI_PIN_REG_INPUT_DIS_MASK 0x0008 | ||
57 | #define BCM281XX_HDMI_PIN_REG_INPUT_DIS_SHIFT 3 | ||
58 | #define BCM281XX_HDMI_PIN_REG_MODE_MASK 0x0010 | ||
59 | #define BCM281XX_HDMI_PIN_REG_MODE_SHIFT 4 | ||
60 | |||
61 | /** | ||
62 | * bcm281xx_pin_type - types of pin register | ||
63 | */ | ||
64 | enum bcm281xx_pin_type { | ||
65 | BCM281XX_PIN_TYPE_UNKNOWN = 0, | ||
66 | BCM281XX_PIN_TYPE_STD, | ||
67 | BCM281XX_PIN_TYPE_I2C, | ||
68 | BCM281XX_PIN_TYPE_HDMI, | ||
69 | }; | ||
70 | |||
71 | static enum bcm281xx_pin_type std_pin = BCM281XX_PIN_TYPE_STD; | ||
72 | static enum bcm281xx_pin_type i2c_pin = BCM281XX_PIN_TYPE_I2C; | ||
73 | static enum bcm281xx_pin_type hdmi_pin = BCM281XX_PIN_TYPE_HDMI; | ||
74 | |||
75 | /** | ||
76 | * bcm281xx_pin_function- define pin function | ||
77 | */ | ||
78 | struct bcm281xx_pin_function { | ||
79 | const char *name; | ||
80 | const char * const *groups; | ||
81 | const unsigned ngroups; | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * bcm281xx_pinctrl_data - Broadcom-specific pinctrl data | ||
86 | * @reg_base - base of pinctrl registers | ||
87 | */ | ||
88 | struct bcm281xx_pinctrl_data { | ||
89 | void __iomem *reg_base; | ||
90 | |||
91 | /* List of all pins */ | ||
92 | const struct pinctrl_pin_desc *pins; | ||
93 | const unsigned npins; | ||
94 | |||
95 | const struct bcm281xx_pin_function *functions; | ||
96 | const unsigned nfunctions; | ||
97 | |||
98 | struct regmap *regmap; | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * Pin number definition. The order here must be the same as defined in the | ||
103 | * PADCTRLREG block in the RDB. | ||
104 | */ | ||
105 | #define BCM281XX_PIN_ADCSYNC 0 | ||
106 | #define BCM281XX_PIN_BAT_RM 1 | ||
107 | #define BCM281XX_PIN_BSC1_SCL 2 | ||
108 | #define BCM281XX_PIN_BSC1_SDA 3 | ||
109 | #define BCM281XX_PIN_BSC2_SCL 4 | ||
110 | #define BCM281XX_PIN_BSC2_SDA 5 | ||
111 | #define BCM281XX_PIN_CLASSGPWR 6 | ||
112 | #define BCM281XX_PIN_CLK_CX8 7 | ||
113 | #define BCM281XX_PIN_CLKOUT_0 8 | ||
114 | #define BCM281XX_PIN_CLKOUT_1 9 | ||
115 | #define BCM281XX_PIN_CLKOUT_2 10 | ||
116 | #define BCM281XX_PIN_CLKOUT_3 11 | ||
117 | #define BCM281XX_PIN_CLKREQ_IN_0 12 | ||
118 | #define BCM281XX_PIN_CLKREQ_IN_1 13 | ||
119 | #define BCM281XX_PIN_CWS_SYS_REQ1 14 | ||
120 | #define BCM281XX_PIN_CWS_SYS_REQ2 15 | ||
121 | #define BCM281XX_PIN_CWS_SYS_REQ3 16 | ||
122 | #define BCM281XX_PIN_DIGMIC1_CLK 17 | ||
123 | #define BCM281XX_PIN_DIGMIC1_DQ 18 | ||
124 | #define BCM281XX_PIN_DIGMIC2_CLK 19 | ||
125 | #define BCM281XX_PIN_DIGMIC2_DQ 20 | ||
126 | #define BCM281XX_PIN_GPEN13 21 | ||
127 | #define BCM281XX_PIN_GPEN14 22 | ||
128 | #define BCM281XX_PIN_GPEN15 23 | ||
129 | #define BCM281XX_PIN_GPIO00 24 | ||
130 | #define BCM281XX_PIN_GPIO01 25 | ||
131 | #define BCM281XX_PIN_GPIO02 26 | ||
132 | #define BCM281XX_PIN_GPIO03 27 | ||
133 | #define BCM281XX_PIN_GPIO04 28 | ||
134 | #define BCM281XX_PIN_GPIO05 29 | ||
135 | #define BCM281XX_PIN_GPIO06 30 | ||
136 | #define BCM281XX_PIN_GPIO07 31 | ||
137 | #define BCM281XX_PIN_GPIO08 32 | ||
138 | #define BCM281XX_PIN_GPIO09 33 | ||
139 | #define BCM281XX_PIN_GPIO10 34 | ||
140 | #define BCM281XX_PIN_GPIO11 35 | ||
141 | #define BCM281XX_PIN_GPIO12 36 | ||
142 | #define BCM281XX_PIN_GPIO13 37 | ||
143 | #define BCM281XX_PIN_GPIO14 38 | ||
144 | #define BCM281XX_PIN_GPS_PABLANK 39 | ||
145 | #define BCM281XX_PIN_GPS_TMARK 40 | ||
146 | #define BCM281XX_PIN_HDMI_SCL 41 | ||
147 | #define BCM281XX_PIN_HDMI_SDA 42 | ||
148 | #define BCM281XX_PIN_IC_DM 43 | ||
149 | #define BCM281XX_PIN_IC_DP 44 | ||
150 | #define BCM281XX_PIN_KP_COL_IP_0 45 | ||
151 | #define BCM281XX_PIN_KP_COL_IP_1 46 | ||
152 | #define BCM281XX_PIN_KP_COL_IP_2 47 | ||
153 | #define BCM281XX_PIN_KP_COL_IP_3 48 | ||
154 | #define BCM281XX_PIN_KP_ROW_OP_0 49 | ||
155 | #define BCM281XX_PIN_KP_ROW_OP_1 50 | ||
156 | #define BCM281XX_PIN_KP_ROW_OP_2 51 | ||
157 | #define BCM281XX_PIN_KP_ROW_OP_3 52 | ||
158 | #define BCM281XX_PIN_LCD_B_0 53 | ||
159 | #define BCM281XX_PIN_LCD_B_1 54 | ||
160 | #define BCM281XX_PIN_LCD_B_2 55 | ||
161 | #define BCM281XX_PIN_LCD_B_3 56 | ||
162 | #define BCM281XX_PIN_LCD_B_4 57 | ||
163 | #define BCM281XX_PIN_LCD_B_5 58 | ||
164 | #define BCM281XX_PIN_LCD_B_6 59 | ||
165 | #define BCM281XX_PIN_LCD_B_7 60 | ||
166 | #define BCM281XX_PIN_LCD_G_0 61 | ||
167 | #define BCM281XX_PIN_LCD_G_1 62 | ||
168 | #define BCM281XX_PIN_LCD_G_2 63 | ||
169 | #define BCM281XX_PIN_LCD_G_3 64 | ||
170 | #define BCM281XX_PIN_LCD_G_4 65 | ||
171 | #define BCM281XX_PIN_LCD_G_5 66 | ||
172 | #define BCM281XX_PIN_LCD_G_6 67 | ||
173 | #define BCM281XX_PIN_LCD_G_7 68 | ||
174 | #define BCM281XX_PIN_LCD_HSYNC 69 | ||
175 | #define BCM281XX_PIN_LCD_OE 70 | ||
176 | #define BCM281XX_PIN_LCD_PCLK 71 | ||
177 | #define BCM281XX_PIN_LCD_R_0 72 | ||
178 | #define BCM281XX_PIN_LCD_R_1 73 | ||
179 | #define BCM281XX_PIN_LCD_R_2 74 | ||
180 | #define BCM281XX_PIN_LCD_R_3 75 | ||
181 | #define BCM281XX_PIN_LCD_R_4 76 | ||
182 | #define BCM281XX_PIN_LCD_R_5 77 | ||
183 | #define BCM281XX_PIN_LCD_R_6 78 | ||
184 | #define BCM281XX_PIN_LCD_R_7 79 | ||
185 | #define BCM281XX_PIN_LCD_VSYNC 80 | ||
186 | #define BCM281XX_PIN_MDMGPIO0 81 | ||
187 | #define BCM281XX_PIN_MDMGPIO1 82 | ||
188 | #define BCM281XX_PIN_MDMGPIO2 83 | ||
189 | #define BCM281XX_PIN_MDMGPIO3 84 | ||
190 | #define BCM281XX_PIN_MDMGPIO4 85 | ||
191 | #define BCM281XX_PIN_MDMGPIO5 86 | ||
192 | #define BCM281XX_PIN_MDMGPIO6 87 | ||
193 | #define BCM281XX_PIN_MDMGPIO7 88 | ||
194 | #define BCM281XX_PIN_MDMGPIO8 89 | ||
195 | #define BCM281XX_PIN_MPHI_DATA_0 90 | ||
196 | #define BCM281XX_PIN_MPHI_DATA_1 91 | ||
197 | #define BCM281XX_PIN_MPHI_DATA_2 92 | ||
198 | #define BCM281XX_PIN_MPHI_DATA_3 93 | ||
199 | #define BCM281XX_PIN_MPHI_DATA_4 94 | ||
200 | #define BCM281XX_PIN_MPHI_DATA_5 95 | ||
201 | #define BCM281XX_PIN_MPHI_DATA_6 96 | ||
202 | #define BCM281XX_PIN_MPHI_DATA_7 97 | ||
203 | #define BCM281XX_PIN_MPHI_DATA_8 98 | ||
204 | #define BCM281XX_PIN_MPHI_DATA_9 99 | ||
205 | #define BCM281XX_PIN_MPHI_DATA_10 100 | ||
206 | #define BCM281XX_PIN_MPHI_DATA_11 101 | ||
207 | #define BCM281XX_PIN_MPHI_DATA_12 102 | ||
208 | #define BCM281XX_PIN_MPHI_DATA_13 103 | ||
209 | #define BCM281XX_PIN_MPHI_DATA_14 104 | ||
210 | #define BCM281XX_PIN_MPHI_DATA_15 105 | ||
211 | #define BCM281XX_PIN_MPHI_HA0 106 | ||
212 | #define BCM281XX_PIN_MPHI_HAT0 107 | ||
213 | #define BCM281XX_PIN_MPHI_HAT1 108 | ||
214 | #define BCM281XX_PIN_MPHI_HCE0_N 109 | ||
215 | #define BCM281XX_PIN_MPHI_HCE1_N 110 | ||
216 | #define BCM281XX_PIN_MPHI_HRD_N 111 | ||
217 | #define BCM281XX_PIN_MPHI_HWR_N 112 | ||
218 | #define BCM281XX_PIN_MPHI_RUN0 113 | ||
219 | #define BCM281XX_PIN_MPHI_RUN1 114 | ||
220 | #define BCM281XX_PIN_MTX_SCAN_CLK 115 | ||
221 | #define BCM281XX_PIN_MTX_SCAN_DATA 116 | ||
222 | #define BCM281XX_PIN_NAND_AD_0 117 | ||
223 | #define BCM281XX_PIN_NAND_AD_1 118 | ||
224 | #define BCM281XX_PIN_NAND_AD_2 119 | ||
225 | #define BCM281XX_PIN_NAND_AD_3 120 | ||
226 | #define BCM281XX_PIN_NAND_AD_4 121 | ||
227 | #define BCM281XX_PIN_NAND_AD_5 122 | ||
228 | #define BCM281XX_PIN_NAND_AD_6 123 | ||
229 | #define BCM281XX_PIN_NAND_AD_7 124 | ||
230 | #define BCM281XX_PIN_NAND_ALE 125 | ||
231 | #define BCM281XX_PIN_NAND_CEN_0 126 | ||
232 | #define BCM281XX_PIN_NAND_CEN_1 127 | ||
233 | #define BCM281XX_PIN_NAND_CLE 128 | ||
234 | #define BCM281XX_PIN_NAND_OEN 129 | ||
235 | #define BCM281XX_PIN_NAND_RDY_0 130 | ||
236 | #define BCM281XX_PIN_NAND_RDY_1 131 | ||
237 | #define BCM281XX_PIN_NAND_WEN 132 | ||
238 | #define BCM281XX_PIN_NAND_WP 133 | ||
239 | #define BCM281XX_PIN_PC1 134 | ||
240 | #define BCM281XX_PIN_PC2 135 | ||
241 | #define BCM281XX_PIN_PMU_INT 136 | ||
242 | #define BCM281XX_PIN_PMU_SCL 137 | ||
243 | #define BCM281XX_PIN_PMU_SDA 138 | ||
244 | #define BCM281XX_PIN_RFST2G_MTSLOTEN3G 139 | ||
245 | #define BCM281XX_PIN_RGMII_0_RX_CTL 140 | ||
246 | #define BCM281XX_PIN_RGMII_0_RXC 141 | ||
247 | #define BCM281XX_PIN_RGMII_0_RXD_0 142 | ||
248 | #define BCM281XX_PIN_RGMII_0_RXD_1 143 | ||
249 | #define BCM281XX_PIN_RGMII_0_RXD_2 144 | ||
250 | #define BCM281XX_PIN_RGMII_0_RXD_3 145 | ||
251 | #define BCM281XX_PIN_RGMII_0_TX_CTL 146 | ||
252 | #define BCM281XX_PIN_RGMII_0_TXC 147 | ||
253 | #define BCM281XX_PIN_RGMII_0_TXD_0 148 | ||
254 | #define BCM281XX_PIN_RGMII_0_TXD_1 149 | ||
255 | #define BCM281XX_PIN_RGMII_0_TXD_2 150 | ||
256 | #define BCM281XX_PIN_RGMII_0_TXD_3 151 | ||
257 | #define BCM281XX_PIN_RGMII_1_RX_CTL 152 | ||
258 | #define BCM281XX_PIN_RGMII_1_RXC 153 | ||
259 | #define BCM281XX_PIN_RGMII_1_RXD_0 154 | ||
260 | #define BCM281XX_PIN_RGMII_1_RXD_1 155 | ||
261 | #define BCM281XX_PIN_RGMII_1_RXD_2 156 | ||
262 | #define BCM281XX_PIN_RGMII_1_RXD_3 157 | ||
263 | #define BCM281XX_PIN_RGMII_1_TX_CTL 158 | ||
264 | #define BCM281XX_PIN_RGMII_1_TXC 159 | ||
265 | #define BCM281XX_PIN_RGMII_1_TXD_0 160 | ||
266 | #define BCM281XX_PIN_RGMII_1_TXD_1 161 | ||
267 | #define BCM281XX_PIN_RGMII_1_TXD_2 162 | ||
268 | #define BCM281XX_PIN_RGMII_1_TXD_3 163 | ||
269 | #define BCM281XX_PIN_RGMII_GPIO_0 164 | ||
270 | #define BCM281XX_PIN_RGMII_GPIO_1 165 | ||
271 | #define BCM281XX_PIN_RGMII_GPIO_2 166 | ||
272 | #define BCM281XX_PIN_RGMII_GPIO_3 167 | ||
273 | #define BCM281XX_PIN_RTXDATA2G_TXDATA3G1 168 | ||
274 | #define BCM281XX_PIN_RTXEN2G_TXDATA3G2 169 | ||
275 | #define BCM281XX_PIN_RXDATA3G0 170 | ||
276 | #define BCM281XX_PIN_RXDATA3G1 171 | ||
277 | #define BCM281XX_PIN_RXDATA3G2 172 | ||
278 | #define BCM281XX_PIN_SDIO1_CLK 173 | ||
279 | #define BCM281XX_PIN_SDIO1_CMD 174 | ||
280 | #define BCM281XX_PIN_SDIO1_DATA_0 175 | ||
281 | #define BCM281XX_PIN_SDIO1_DATA_1 176 | ||
282 | #define BCM281XX_PIN_SDIO1_DATA_2 177 | ||
283 | #define BCM281XX_PIN_SDIO1_DATA_3 178 | ||
284 | #define BCM281XX_PIN_SDIO4_CLK 179 | ||
285 | #define BCM281XX_PIN_SDIO4_CMD 180 | ||
286 | #define BCM281XX_PIN_SDIO4_DATA_0 181 | ||
287 | #define BCM281XX_PIN_SDIO4_DATA_1 182 | ||
288 | #define BCM281XX_PIN_SDIO4_DATA_2 183 | ||
289 | #define BCM281XX_PIN_SDIO4_DATA_3 184 | ||
290 | #define BCM281XX_PIN_SIM_CLK 185 | ||
291 | #define BCM281XX_PIN_SIM_DATA 186 | ||
292 | #define BCM281XX_PIN_SIM_DET 187 | ||
293 | #define BCM281XX_PIN_SIM_RESETN 188 | ||
294 | #define BCM281XX_PIN_SIM2_CLK 189 | ||
295 | #define BCM281XX_PIN_SIM2_DATA 190 | ||
296 | #define BCM281XX_PIN_SIM2_DET 191 | ||
297 | #define BCM281XX_PIN_SIM2_RESETN 192 | ||
298 | #define BCM281XX_PIN_SRI_C 193 | ||
299 | #define BCM281XX_PIN_SRI_D 194 | ||
300 | #define BCM281XX_PIN_SRI_E 195 | ||
301 | #define BCM281XX_PIN_SSP_EXTCLK 196 | ||
302 | #define BCM281XX_PIN_SSP0_CLK 197 | ||
303 | #define BCM281XX_PIN_SSP0_FS 198 | ||
304 | #define BCM281XX_PIN_SSP0_RXD 199 | ||
305 | #define BCM281XX_PIN_SSP0_TXD 200 | ||
306 | #define BCM281XX_PIN_SSP2_CLK 201 | ||
307 | #define BCM281XX_PIN_SSP2_FS_0 202 | ||
308 | #define BCM281XX_PIN_SSP2_FS_1 203 | ||
309 | #define BCM281XX_PIN_SSP2_FS_2 204 | ||
310 | #define BCM281XX_PIN_SSP2_FS_3 205 | ||
311 | #define BCM281XX_PIN_SSP2_RXD_0 206 | ||
312 | #define BCM281XX_PIN_SSP2_RXD_1 207 | ||
313 | #define BCM281XX_PIN_SSP2_TXD_0 208 | ||
314 | #define BCM281XX_PIN_SSP2_TXD_1 209 | ||
315 | #define BCM281XX_PIN_SSP3_CLK 210 | ||
316 | #define BCM281XX_PIN_SSP3_FS 211 | ||
317 | #define BCM281XX_PIN_SSP3_RXD 212 | ||
318 | #define BCM281XX_PIN_SSP3_TXD 213 | ||
319 | #define BCM281XX_PIN_SSP4_CLK 214 | ||
320 | #define BCM281XX_PIN_SSP4_FS 215 | ||
321 | #define BCM281XX_PIN_SSP4_RXD 216 | ||
322 | #define BCM281XX_PIN_SSP4_TXD 217 | ||
323 | #define BCM281XX_PIN_SSP5_CLK 218 | ||
324 | #define BCM281XX_PIN_SSP5_FS 219 | ||
325 | #define BCM281XX_PIN_SSP5_RXD 220 | ||
326 | #define BCM281XX_PIN_SSP5_TXD 221 | ||
327 | #define BCM281XX_PIN_SSP6_CLK 222 | ||
328 | #define BCM281XX_PIN_SSP6_FS 223 | ||
329 | #define BCM281XX_PIN_SSP6_RXD 224 | ||
330 | #define BCM281XX_PIN_SSP6_TXD 225 | ||
331 | #define BCM281XX_PIN_STAT_1 226 | ||
332 | #define BCM281XX_PIN_STAT_2 227 | ||
333 | #define BCM281XX_PIN_SYSCLKEN 228 | ||
334 | #define BCM281XX_PIN_TRACECLK 229 | ||
335 | #define BCM281XX_PIN_TRACEDT00 230 | ||
336 | #define BCM281XX_PIN_TRACEDT01 231 | ||
337 | #define BCM281XX_PIN_TRACEDT02 232 | ||
338 | #define BCM281XX_PIN_TRACEDT03 233 | ||
339 | #define BCM281XX_PIN_TRACEDT04 234 | ||
340 | #define BCM281XX_PIN_TRACEDT05 235 | ||
341 | #define BCM281XX_PIN_TRACEDT06 236 | ||
342 | #define BCM281XX_PIN_TRACEDT07 237 | ||
343 | #define BCM281XX_PIN_TRACEDT08 238 | ||
344 | #define BCM281XX_PIN_TRACEDT09 239 | ||
345 | #define BCM281XX_PIN_TRACEDT10 240 | ||
346 | #define BCM281XX_PIN_TRACEDT11 241 | ||
347 | #define BCM281XX_PIN_TRACEDT12 242 | ||
348 | #define BCM281XX_PIN_TRACEDT13 243 | ||
349 | #define BCM281XX_PIN_TRACEDT14 244 | ||
350 | #define BCM281XX_PIN_TRACEDT15 245 | ||
351 | #define BCM281XX_PIN_TXDATA3G0 246 | ||
352 | #define BCM281XX_PIN_TXPWRIND 247 | ||
353 | #define BCM281XX_PIN_UARTB1_UCTS 248 | ||
354 | #define BCM281XX_PIN_UARTB1_URTS 249 | ||
355 | #define BCM281XX_PIN_UARTB1_URXD 250 | ||
356 | #define BCM281XX_PIN_UARTB1_UTXD 251 | ||
357 | #define BCM281XX_PIN_UARTB2_URXD 252 | ||
358 | #define BCM281XX_PIN_UARTB2_UTXD 253 | ||
359 | #define BCM281XX_PIN_UARTB3_UCTS 254 | ||
360 | #define BCM281XX_PIN_UARTB3_URTS 255 | ||
361 | #define BCM281XX_PIN_UARTB3_URXD 256 | ||
362 | #define BCM281XX_PIN_UARTB3_UTXD 257 | ||
363 | #define BCM281XX_PIN_UARTB4_UCTS 258 | ||
364 | #define BCM281XX_PIN_UARTB4_URTS 259 | ||
365 | #define BCM281XX_PIN_UARTB4_URXD 260 | ||
366 | #define BCM281XX_PIN_UARTB4_UTXD 261 | ||
367 | #define BCM281XX_PIN_VC_CAM1_SCL 262 | ||
368 | #define BCM281XX_PIN_VC_CAM1_SDA 263 | ||
369 | #define BCM281XX_PIN_VC_CAM2_SCL 264 | ||
370 | #define BCM281XX_PIN_VC_CAM2_SDA 265 | ||
371 | #define BCM281XX_PIN_VC_CAM3_SCL 266 | ||
372 | #define BCM281XX_PIN_VC_CAM3_SDA 267 | ||
373 | |||
374 | #define BCM281XX_PIN_DESC(a, b, c) \ | ||
375 | { .number = a, .name = b, .drv_data = &c##_pin } | ||
376 | |||
377 | /* | ||
378 | * Pin description definition. The order here must be the same as defined in | ||
379 | * the PADCTRLREG block in the RDB, since the pin number is used as an index | ||
380 | * into this array. | ||
381 | */ | ||
382 | static const struct pinctrl_pin_desc bcm281xx_pinctrl_pins[] = { | ||
383 | BCM281XX_PIN_DESC(BCM281XX_PIN_ADCSYNC, "adcsync", std), | ||
384 | BCM281XX_PIN_DESC(BCM281XX_PIN_BAT_RM, "bat_rm", std), | ||
385 | BCM281XX_PIN_DESC(BCM281XX_PIN_BSC1_SCL, "bsc1_scl", i2c), | ||
386 | BCM281XX_PIN_DESC(BCM281XX_PIN_BSC1_SDA, "bsc1_sda", i2c), | ||
387 | BCM281XX_PIN_DESC(BCM281XX_PIN_BSC2_SCL, "bsc2_scl", i2c), | ||
388 | BCM281XX_PIN_DESC(BCM281XX_PIN_BSC2_SDA, "bsc2_sda", i2c), | ||
389 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLASSGPWR, "classgpwr", std), | ||
390 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLK_CX8, "clk_cx8", std), | ||
391 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKOUT_0, "clkout_0", std), | ||
392 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKOUT_1, "clkout_1", std), | ||
393 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKOUT_2, "clkout_2", std), | ||
394 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKOUT_3, "clkout_3", std), | ||
395 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKREQ_IN_0, "clkreq_in_0", std), | ||
396 | BCM281XX_PIN_DESC(BCM281XX_PIN_CLKREQ_IN_1, "clkreq_in_1", std), | ||
397 | BCM281XX_PIN_DESC(BCM281XX_PIN_CWS_SYS_REQ1, "cws_sys_req1", std), | ||
398 | BCM281XX_PIN_DESC(BCM281XX_PIN_CWS_SYS_REQ2, "cws_sys_req2", std), | ||
399 | BCM281XX_PIN_DESC(BCM281XX_PIN_CWS_SYS_REQ3, "cws_sys_req3", std), | ||
400 | BCM281XX_PIN_DESC(BCM281XX_PIN_DIGMIC1_CLK, "digmic1_clk", std), | ||
401 | BCM281XX_PIN_DESC(BCM281XX_PIN_DIGMIC1_DQ, "digmic1_dq", std), | ||
402 | BCM281XX_PIN_DESC(BCM281XX_PIN_DIGMIC2_CLK, "digmic2_clk", std), | ||
403 | BCM281XX_PIN_DESC(BCM281XX_PIN_DIGMIC2_DQ, "digmic2_dq", std), | ||
404 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPEN13, "gpen13", std), | ||
405 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPEN14, "gpen14", std), | ||
406 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPEN15, "gpen15", std), | ||
407 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO00, "gpio00", std), | ||
408 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO01, "gpio01", std), | ||
409 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO02, "gpio02", std), | ||
410 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO03, "gpio03", std), | ||
411 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO04, "gpio04", std), | ||
412 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO05, "gpio05", std), | ||
413 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO06, "gpio06", std), | ||
414 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO07, "gpio07", std), | ||
415 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO08, "gpio08", std), | ||
416 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO09, "gpio09", std), | ||
417 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO10, "gpio10", std), | ||
418 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO11, "gpio11", std), | ||
419 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO12, "gpio12", std), | ||
420 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO13, "gpio13", std), | ||
421 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPIO14, "gpio14", std), | ||
422 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPS_PABLANK, "gps_pablank", std), | ||
423 | BCM281XX_PIN_DESC(BCM281XX_PIN_GPS_TMARK, "gps_tmark", std), | ||
424 | BCM281XX_PIN_DESC(BCM281XX_PIN_HDMI_SCL, "hdmi_scl", hdmi), | ||
425 | BCM281XX_PIN_DESC(BCM281XX_PIN_HDMI_SDA, "hdmi_sda", hdmi), | ||
426 | BCM281XX_PIN_DESC(BCM281XX_PIN_IC_DM, "ic_dm", std), | ||
427 | BCM281XX_PIN_DESC(BCM281XX_PIN_IC_DP, "ic_dp", std), | ||
428 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_COL_IP_0, "kp_col_ip_0", std), | ||
429 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_COL_IP_1, "kp_col_ip_1", std), | ||
430 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_COL_IP_2, "kp_col_ip_2", std), | ||
431 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_COL_IP_3, "kp_col_ip_3", std), | ||
432 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_ROW_OP_0, "kp_row_op_0", std), | ||
433 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_ROW_OP_1, "kp_row_op_1", std), | ||
434 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_ROW_OP_2, "kp_row_op_2", std), | ||
435 | BCM281XX_PIN_DESC(BCM281XX_PIN_KP_ROW_OP_3, "kp_row_op_3", std), | ||
436 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_0, "lcd_b_0", std), | ||
437 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_1, "lcd_b_1", std), | ||
438 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_2, "lcd_b_2", std), | ||
439 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_3, "lcd_b_3", std), | ||
440 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_4, "lcd_b_4", std), | ||
441 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_5, "lcd_b_5", std), | ||
442 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_6, "lcd_b_6", std), | ||
443 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_B_7, "lcd_b_7", std), | ||
444 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_0, "lcd_g_0", std), | ||
445 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_1, "lcd_g_1", std), | ||
446 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_2, "lcd_g_2", std), | ||
447 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_3, "lcd_g_3", std), | ||
448 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_4, "lcd_g_4", std), | ||
449 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_5, "lcd_g_5", std), | ||
450 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_6, "lcd_g_6", std), | ||
451 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_G_7, "lcd_g_7", std), | ||
452 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_HSYNC, "lcd_hsync", std), | ||
453 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_OE, "lcd_oe", std), | ||
454 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_PCLK, "lcd_pclk", std), | ||
455 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_0, "lcd_r_0", std), | ||
456 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_1, "lcd_r_1", std), | ||
457 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_2, "lcd_r_2", std), | ||
458 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_3, "lcd_r_3", std), | ||
459 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_4, "lcd_r_4", std), | ||
460 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_5, "lcd_r_5", std), | ||
461 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_6, "lcd_r_6", std), | ||
462 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_R_7, "lcd_r_7", std), | ||
463 | BCM281XX_PIN_DESC(BCM281XX_PIN_LCD_VSYNC, "lcd_vsync", std), | ||
464 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO0, "mdmgpio0", std), | ||
465 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO1, "mdmgpio1", std), | ||
466 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO2, "mdmgpio2", std), | ||
467 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO3, "mdmgpio3", std), | ||
468 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO4, "mdmgpio4", std), | ||
469 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO5, "mdmgpio5", std), | ||
470 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO6, "mdmgpio6", std), | ||
471 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO7, "mdmgpio7", std), | ||
472 | BCM281XX_PIN_DESC(BCM281XX_PIN_MDMGPIO8, "mdmgpio8", std), | ||
473 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_0, "mphi_data_0", std), | ||
474 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_1, "mphi_data_1", std), | ||
475 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_2, "mphi_data_2", std), | ||
476 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_3, "mphi_data_3", std), | ||
477 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_4, "mphi_data_4", std), | ||
478 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_5, "mphi_data_5", std), | ||
479 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_6, "mphi_data_6", std), | ||
480 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_7, "mphi_data_7", std), | ||
481 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_8, "mphi_data_8", std), | ||
482 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_9, "mphi_data_9", std), | ||
483 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_10, "mphi_data_10", std), | ||
484 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_11, "mphi_data_11", std), | ||
485 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_12, "mphi_data_12", std), | ||
486 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_13, "mphi_data_13", std), | ||
487 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_14, "mphi_data_14", std), | ||
488 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_DATA_15, "mphi_data_15", std), | ||
489 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HA0, "mphi_ha0", std), | ||
490 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HAT0, "mphi_hat0", std), | ||
491 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HAT1, "mphi_hat1", std), | ||
492 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HCE0_N, "mphi_hce0_n", std), | ||
493 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HCE1_N, "mphi_hce1_n", std), | ||
494 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HRD_N, "mphi_hrd_n", std), | ||
495 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_HWR_N, "mphi_hwr_n", std), | ||
496 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_RUN0, "mphi_run0", std), | ||
497 | BCM281XX_PIN_DESC(BCM281XX_PIN_MPHI_RUN1, "mphi_run1", std), | ||
498 | BCM281XX_PIN_DESC(BCM281XX_PIN_MTX_SCAN_CLK, "mtx_scan_clk", std), | ||
499 | BCM281XX_PIN_DESC(BCM281XX_PIN_MTX_SCAN_DATA, "mtx_scan_data", std), | ||
500 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_0, "nand_ad_0", std), | ||
501 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_1, "nand_ad_1", std), | ||
502 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_2, "nand_ad_2", std), | ||
503 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_3, "nand_ad_3", std), | ||
504 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_4, "nand_ad_4", std), | ||
505 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_5, "nand_ad_5", std), | ||
506 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_6, "nand_ad_6", std), | ||
507 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_AD_7, "nand_ad_7", std), | ||
508 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_ALE, "nand_ale", std), | ||
509 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_CEN_0, "nand_cen_0", std), | ||
510 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_CEN_1, "nand_cen_1", std), | ||
511 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_CLE, "nand_cle", std), | ||
512 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_OEN, "nand_oen", std), | ||
513 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_RDY_0, "nand_rdy_0", std), | ||
514 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_RDY_1, "nand_rdy_1", std), | ||
515 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_WEN, "nand_wen", std), | ||
516 | BCM281XX_PIN_DESC(BCM281XX_PIN_NAND_WP, "nand_wp", std), | ||
517 | BCM281XX_PIN_DESC(BCM281XX_PIN_PC1, "pc1", std), | ||
518 | BCM281XX_PIN_DESC(BCM281XX_PIN_PC2, "pc2", std), | ||
519 | BCM281XX_PIN_DESC(BCM281XX_PIN_PMU_INT, "pmu_int", std), | ||
520 | BCM281XX_PIN_DESC(BCM281XX_PIN_PMU_SCL, "pmu_scl", i2c), | ||
521 | BCM281XX_PIN_DESC(BCM281XX_PIN_PMU_SDA, "pmu_sda", i2c), | ||
522 | BCM281XX_PIN_DESC(BCM281XX_PIN_RFST2G_MTSLOTEN3G, "rfst2g_mtsloten3g", | ||
523 | std), | ||
524 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RX_CTL, "rgmii_0_rx_ctl", std), | ||
525 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RXC, "rgmii_0_rxc", std), | ||
526 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RXD_0, "rgmii_0_rxd_0", std), | ||
527 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RXD_1, "rgmii_0_rxd_1", std), | ||
528 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RXD_2, "rgmii_0_rxd_2", std), | ||
529 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_RXD_3, "rgmii_0_rxd_3", std), | ||
530 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TX_CTL, "rgmii_0_tx_ctl", std), | ||
531 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TXC, "rgmii_0_txc", std), | ||
532 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TXD_0, "rgmii_0_txd_0", std), | ||
533 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TXD_1, "rgmii_0_txd_1", std), | ||
534 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TXD_2, "rgmii_0_txd_2", std), | ||
535 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_0_TXD_3, "rgmii_0_txd_3", std), | ||
536 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RX_CTL, "rgmii_1_rx_ctl", std), | ||
537 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RXC, "rgmii_1_rxc", std), | ||
538 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RXD_0, "rgmii_1_rxd_0", std), | ||
539 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RXD_1, "rgmii_1_rxd_1", std), | ||
540 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RXD_2, "rgmii_1_rxd_2", std), | ||
541 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_RXD_3, "rgmii_1_rxd_3", std), | ||
542 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TX_CTL, "rgmii_1_tx_ctl", std), | ||
543 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TXC, "rgmii_1_txc", std), | ||
544 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TXD_0, "rgmii_1_txd_0", std), | ||
545 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TXD_1, "rgmii_1_txd_1", std), | ||
546 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TXD_2, "rgmii_1_txd_2", std), | ||
547 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_1_TXD_3, "rgmii_1_txd_3", std), | ||
548 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_GPIO_0, "rgmii_gpio_0", std), | ||
549 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_GPIO_1, "rgmii_gpio_1", std), | ||
550 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_GPIO_2, "rgmii_gpio_2", std), | ||
551 | BCM281XX_PIN_DESC(BCM281XX_PIN_RGMII_GPIO_3, "rgmii_gpio_3", std), | ||
552 | BCM281XX_PIN_DESC(BCM281XX_PIN_RTXDATA2G_TXDATA3G1, | ||
553 | "rtxdata2g_txdata3g1", std), | ||
554 | BCM281XX_PIN_DESC(BCM281XX_PIN_RTXEN2G_TXDATA3G2, "rtxen2g_txdata3g2", | ||
555 | std), | ||
556 | BCM281XX_PIN_DESC(BCM281XX_PIN_RXDATA3G0, "rxdata3g0", std), | ||
557 | BCM281XX_PIN_DESC(BCM281XX_PIN_RXDATA3G1, "rxdata3g1", std), | ||
558 | BCM281XX_PIN_DESC(BCM281XX_PIN_RXDATA3G2, "rxdata3g2", std), | ||
559 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_CLK, "sdio1_clk", std), | ||
560 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_CMD, "sdio1_cmd", std), | ||
561 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_DATA_0, "sdio1_data_0", std), | ||
562 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_DATA_1, "sdio1_data_1", std), | ||
563 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_DATA_2, "sdio1_data_2", std), | ||
564 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO1_DATA_3, "sdio1_data_3", std), | ||
565 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_CLK, "sdio4_clk", std), | ||
566 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_CMD, "sdio4_cmd", std), | ||
567 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_DATA_0, "sdio4_data_0", std), | ||
568 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_DATA_1, "sdio4_data_1", std), | ||
569 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_DATA_2, "sdio4_data_2", std), | ||
570 | BCM281XX_PIN_DESC(BCM281XX_PIN_SDIO4_DATA_3, "sdio4_data_3", std), | ||
571 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM_CLK, "sim_clk", std), | ||
572 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM_DATA, "sim_data", std), | ||
573 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM_DET, "sim_det", std), | ||
574 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM_RESETN, "sim_resetn", std), | ||
575 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM2_CLK, "sim2_clk", std), | ||
576 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM2_DATA, "sim2_data", std), | ||
577 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM2_DET, "sim2_det", std), | ||
578 | BCM281XX_PIN_DESC(BCM281XX_PIN_SIM2_RESETN, "sim2_resetn", std), | ||
579 | BCM281XX_PIN_DESC(BCM281XX_PIN_SRI_C, "sri_c", std), | ||
580 | BCM281XX_PIN_DESC(BCM281XX_PIN_SRI_D, "sri_d", std), | ||
581 | BCM281XX_PIN_DESC(BCM281XX_PIN_SRI_E, "sri_e", std), | ||
582 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP_EXTCLK, "ssp_extclk", std), | ||
583 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP0_CLK, "ssp0_clk", std), | ||
584 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP0_FS, "ssp0_fs", std), | ||
585 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP0_RXD, "ssp0_rxd", std), | ||
586 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP0_TXD, "ssp0_txd", std), | ||
587 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_CLK, "ssp2_clk", std), | ||
588 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_FS_0, "ssp2_fs_0", std), | ||
589 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_FS_1, "ssp2_fs_1", std), | ||
590 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_FS_2, "ssp2_fs_2", std), | ||
591 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_FS_3, "ssp2_fs_3", std), | ||
592 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_RXD_0, "ssp2_rxd_0", std), | ||
593 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_RXD_1, "ssp2_rxd_1", std), | ||
594 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_TXD_0, "ssp2_txd_0", std), | ||
595 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP2_TXD_1, "ssp2_txd_1", std), | ||
596 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP3_CLK, "ssp3_clk", std), | ||
597 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP3_FS, "ssp3_fs", std), | ||
598 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP3_RXD, "ssp3_rxd", std), | ||
599 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP3_TXD, "ssp3_txd", std), | ||
600 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP4_CLK, "ssp4_clk", std), | ||
601 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP4_FS, "ssp4_fs", std), | ||
602 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP4_RXD, "ssp4_rxd", std), | ||
603 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP4_TXD, "ssp4_txd", std), | ||
604 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP5_CLK, "ssp5_clk", std), | ||
605 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP5_FS, "ssp5_fs", std), | ||
606 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP5_RXD, "ssp5_rxd", std), | ||
607 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP5_TXD, "ssp5_txd", std), | ||
608 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP6_CLK, "ssp6_clk", std), | ||
609 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP6_FS, "ssp6_fs", std), | ||
610 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP6_RXD, "ssp6_rxd", std), | ||
611 | BCM281XX_PIN_DESC(BCM281XX_PIN_SSP6_TXD, "ssp6_txd", std), | ||
612 | BCM281XX_PIN_DESC(BCM281XX_PIN_STAT_1, "stat_1", std), | ||
613 | BCM281XX_PIN_DESC(BCM281XX_PIN_STAT_2, "stat_2", std), | ||
614 | BCM281XX_PIN_DESC(BCM281XX_PIN_SYSCLKEN, "sysclken", std), | ||
615 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACECLK, "traceclk", std), | ||
616 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT00, "tracedt00", std), | ||
617 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT01, "tracedt01", std), | ||
618 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT02, "tracedt02", std), | ||
619 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT03, "tracedt03", std), | ||
620 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT04, "tracedt04", std), | ||
621 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT05, "tracedt05", std), | ||
622 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT06, "tracedt06", std), | ||
623 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT07, "tracedt07", std), | ||
624 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT08, "tracedt08", std), | ||
625 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT09, "tracedt09", std), | ||
626 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT10, "tracedt10", std), | ||
627 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT11, "tracedt11", std), | ||
628 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT12, "tracedt12", std), | ||
629 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT13, "tracedt13", std), | ||
630 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT14, "tracedt14", std), | ||
631 | BCM281XX_PIN_DESC(BCM281XX_PIN_TRACEDT15, "tracedt15", std), | ||
632 | BCM281XX_PIN_DESC(BCM281XX_PIN_TXDATA3G0, "txdata3g0", std), | ||
633 | BCM281XX_PIN_DESC(BCM281XX_PIN_TXPWRIND, "txpwrind", std), | ||
634 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB1_UCTS, "uartb1_ucts", std), | ||
635 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB1_URTS, "uartb1_urts", std), | ||
636 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB1_URXD, "uartb1_urxd", std), | ||
637 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB1_UTXD, "uartb1_utxd", std), | ||
638 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB2_URXD, "uartb2_urxd", std), | ||
639 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB2_UTXD, "uartb2_utxd", std), | ||
640 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB3_UCTS, "uartb3_ucts", std), | ||
641 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB3_URTS, "uartb3_urts", std), | ||
642 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB3_URXD, "uartb3_urxd", std), | ||
643 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB3_UTXD, "uartb3_utxd", std), | ||
644 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB4_UCTS, "uartb4_ucts", std), | ||
645 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB4_URTS, "uartb4_urts", std), | ||
646 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB4_URXD, "uartb4_urxd", std), | ||
647 | BCM281XX_PIN_DESC(BCM281XX_PIN_UARTB4_UTXD, "uartb4_utxd", std), | ||
648 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM1_SCL, "vc_cam1_scl", i2c), | ||
649 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM1_SDA, "vc_cam1_sda", i2c), | ||
650 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM2_SCL, "vc_cam2_scl", i2c), | ||
651 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM2_SDA, "vc_cam2_sda", i2c), | ||
652 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM3_SCL, "vc_cam3_scl", i2c), | ||
653 | BCM281XX_PIN_DESC(BCM281XX_PIN_VC_CAM3_SDA, "vc_cam3_sda", i2c), | ||
654 | }; | ||
655 | |||
656 | static const char * const bcm281xx_alt_groups[] = { | ||
657 | "adcsync", | ||
658 | "bat_rm", | ||
659 | "bsc1_scl", | ||
660 | "bsc1_sda", | ||
661 | "bsc2_scl", | ||
662 | "bsc2_sda", | ||
663 | "classgpwr", | ||
664 | "clk_cx8", | ||
665 | "clkout_0", | ||
666 | "clkout_1", | ||
667 | "clkout_2", | ||
668 | "clkout_3", | ||
669 | "clkreq_in_0", | ||
670 | "clkreq_in_1", | ||
671 | "cws_sys_req1", | ||
672 | "cws_sys_req2", | ||
673 | "cws_sys_req3", | ||
674 | "digmic1_clk", | ||
675 | "digmic1_dq", | ||
676 | "digmic2_clk", | ||
677 | "digmic2_dq", | ||
678 | "gpen13", | ||
679 | "gpen14", | ||
680 | "gpen15", | ||
681 | "gpio00", | ||
682 | "gpio01", | ||
683 | "gpio02", | ||
684 | "gpio03", | ||
685 | "gpio04", | ||
686 | "gpio05", | ||
687 | "gpio06", | ||
688 | "gpio07", | ||
689 | "gpio08", | ||
690 | "gpio09", | ||
691 | "gpio10", | ||
692 | "gpio11", | ||
693 | "gpio12", | ||
694 | "gpio13", | ||
695 | "gpio14", | ||
696 | "gps_pablank", | ||
697 | "gps_tmark", | ||
698 | "hdmi_scl", | ||
699 | "hdmi_sda", | ||
700 | "ic_dm", | ||
701 | "ic_dp", | ||
702 | "kp_col_ip_0", | ||
703 | "kp_col_ip_1", | ||
704 | "kp_col_ip_2", | ||
705 | "kp_col_ip_3", | ||
706 | "kp_row_op_0", | ||
707 | "kp_row_op_1", | ||
708 | "kp_row_op_2", | ||
709 | "kp_row_op_3", | ||
710 | "lcd_b_0", | ||
711 | "lcd_b_1", | ||
712 | "lcd_b_2", | ||
713 | "lcd_b_3", | ||
714 | "lcd_b_4", | ||
715 | "lcd_b_5", | ||
716 | "lcd_b_6", | ||
717 | "lcd_b_7", | ||
718 | "lcd_g_0", | ||
719 | "lcd_g_1", | ||
720 | "lcd_g_2", | ||
721 | "lcd_g_3", | ||
722 | "lcd_g_4", | ||
723 | "lcd_g_5", | ||
724 | "lcd_g_6", | ||
725 | "lcd_g_7", | ||
726 | "lcd_hsync", | ||
727 | "lcd_oe", | ||
728 | "lcd_pclk", | ||
729 | "lcd_r_0", | ||
730 | "lcd_r_1", | ||
731 | "lcd_r_2", | ||
732 | "lcd_r_3", | ||
733 | "lcd_r_4", | ||
734 | "lcd_r_5", | ||
735 | "lcd_r_6", | ||
736 | "lcd_r_7", | ||
737 | "lcd_vsync", | ||
738 | "mdmgpio0", | ||
739 | "mdmgpio1", | ||
740 | "mdmgpio2", | ||
741 | "mdmgpio3", | ||
742 | "mdmgpio4", | ||
743 | "mdmgpio5", | ||
744 | "mdmgpio6", | ||
745 | "mdmgpio7", | ||
746 | "mdmgpio8", | ||
747 | "mphi_data_0", | ||
748 | "mphi_data_1", | ||
749 | "mphi_data_2", | ||
750 | "mphi_data_3", | ||
751 | "mphi_data_4", | ||
752 | "mphi_data_5", | ||
753 | "mphi_data_6", | ||
754 | "mphi_data_7", | ||
755 | "mphi_data_8", | ||
756 | "mphi_data_9", | ||
757 | "mphi_data_10", | ||
758 | "mphi_data_11", | ||
759 | "mphi_data_12", | ||
760 | "mphi_data_13", | ||
761 | "mphi_data_14", | ||
762 | "mphi_data_15", | ||
763 | "mphi_ha0", | ||
764 | "mphi_hat0", | ||
765 | "mphi_hat1", | ||
766 | "mphi_hce0_n", | ||
767 | "mphi_hce1_n", | ||
768 | "mphi_hrd_n", | ||
769 | "mphi_hwr_n", | ||
770 | "mphi_run0", | ||
771 | "mphi_run1", | ||
772 | "mtx_scan_clk", | ||
773 | "mtx_scan_data", | ||
774 | "nand_ad_0", | ||
775 | "nand_ad_1", | ||
776 | "nand_ad_2", | ||
777 | "nand_ad_3", | ||
778 | "nand_ad_4", | ||
779 | "nand_ad_5", | ||
780 | "nand_ad_6", | ||
781 | "nand_ad_7", | ||
782 | "nand_ale", | ||
783 | "nand_cen_0", | ||
784 | "nand_cen_1", | ||
785 | "nand_cle", | ||
786 | "nand_oen", | ||
787 | "nand_rdy_0", | ||
788 | "nand_rdy_1", | ||
789 | "nand_wen", | ||
790 | "nand_wp", | ||
791 | "pc1", | ||
792 | "pc2", | ||
793 | "pmu_int", | ||
794 | "pmu_scl", | ||
795 | "pmu_sda", | ||
796 | "rfst2g_mtsloten3g", | ||
797 | "rgmii_0_rx_ctl", | ||
798 | "rgmii_0_rxc", | ||
799 | "rgmii_0_rxd_0", | ||
800 | "rgmii_0_rxd_1", | ||
801 | "rgmii_0_rxd_2", | ||
802 | "rgmii_0_rxd_3", | ||
803 | "rgmii_0_tx_ctl", | ||
804 | "rgmii_0_txc", | ||
805 | "rgmii_0_txd_0", | ||
806 | "rgmii_0_txd_1", | ||
807 | "rgmii_0_txd_2", | ||
808 | "rgmii_0_txd_3", | ||
809 | "rgmii_1_rx_ctl", | ||
810 | "rgmii_1_rxc", | ||
811 | "rgmii_1_rxd_0", | ||
812 | "rgmii_1_rxd_1", | ||
813 | "rgmii_1_rxd_2", | ||
814 | "rgmii_1_rxd_3", | ||
815 | "rgmii_1_tx_ctl", | ||
816 | "rgmii_1_txc", | ||
817 | "rgmii_1_txd_0", | ||
818 | "rgmii_1_txd_1", | ||
819 | "rgmii_1_txd_2", | ||
820 | "rgmii_1_txd_3", | ||
821 | "rgmii_gpio_0", | ||
822 | "rgmii_gpio_1", | ||
823 | "rgmii_gpio_2", | ||
824 | "rgmii_gpio_3", | ||
825 | "rtxdata2g_txdata3g1", | ||
826 | "rtxen2g_txdata3g2", | ||
827 | "rxdata3g0", | ||
828 | "rxdata3g1", | ||
829 | "rxdata3g2", | ||
830 | "sdio1_clk", | ||
831 | "sdio1_cmd", | ||
832 | "sdio1_data_0", | ||
833 | "sdio1_data_1", | ||
834 | "sdio1_data_2", | ||
835 | "sdio1_data_3", | ||
836 | "sdio4_clk", | ||
837 | "sdio4_cmd", | ||
838 | "sdio4_data_0", | ||
839 | "sdio4_data_1", | ||
840 | "sdio4_data_2", | ||
841 | "sdio4_data_3", | ||
842 | "sim_clk", | ||
843 | "sim_data", | ||
844 | "sim_det", | ||
845 | "sim_resetn", | ||
846 | "sim2_clk", | ||
847 | "sim2_data", | ||
848 | "sim2_det", | ||
849 | "sim2_resetn", | ||
850 | "sri_c", | ||
851 | "sri_d", | ||
852 | "sri_e", | ||
853 | "ssp_extclk", | ||
854 | "ssp0_clk", | ||
855 | "ssp0_fs", | ||
856 | "ssp0_rxd", | ||
857 | "ssp0_txd", | ||
858 | "ssp2_clk", | ||
859 | "ssp2_fs_0", | ||
860 | "ssp2_fs_1", | ||
861 | "ssp2_fs_2", | ||
862 | "ssp2_fs_3", | ||
863 | "ssp2_rxd_0", | ||
864 | "ssp2_rxd_1", | ||
865 | "ssp2_txd_0", | ||
866 | "ssp2_txd_1", | ||
867 | "ssp3_clk", | ||
868 | "ssp3_fs", | ||
869 | "ssp3_rxd", | ||
870 | "ssp3_txd", | ||
871 | "ssp4_clk", | ||
872 | "ssp4_fs", | ||
873 | "ssp4_rxd", | ||
874 | "ssp4_txd", | ||
875 | "ssp5_clk", | ||
876 | "ssp5_fs", | ||
877 | "ssp5_rxd", | ||
878 | "ssp5_txd", | ||
879 | "ssp6_clk", | ||
880 | "ssp6_fs", | ||
881 | "ssp6_rxd", | ||
882 | "ssp6_txd", | ||
883 | "stat_1", | ||
884 | "stat_2", | ||
885 | "sysclken", | ||
886 | "traceclk", | ||
887 | "tracedt00", | ||
888 | "tracedt01", | ||
889 | "tracedt02", | ||
890 | "tracedt03", | ||
891 | "tracedt04", | ||
892 | "tracedt05", | ||
893 | "tracedt06", | ||
894 | "tracedt07", | ||
895 | "tracedt08", | ||
896 | "tracedt09", | ||
897 | "tracedt10", | ||
898 | "tracedt11", | ||
899 | "tracedt12", | ||
900 | "tracedt13", | ||
901 | "tracedt14", | ||
902 | "tracedt15", | ||
903 | "txdata3g0", | ||
904 | "txpwrind", | ||
905 | "uartb1_ucts", | ||
906 | "uartb1_urts", | ||
907 | "uartb1_urxd", | ||
908 | "uartb1_utxd", | ||
909 | "uartb2_urxd", | ||
910 | "uartb2_utxd", | ||
911 | "uartb3_ucts", | ||
912 | "uartb3_urts", | ||
913 | "uartb3_urxd", | ||
914 | "uartb3_utxd", | ||
915 | "uartb4_ucts", | ||
916 | "uartb4_urts", | ||
917 | "uartb4_urxd", | ||
918 | "uartb4_utxd", | ||
919 | "vc_cam1_scl", | ||
920 | "vc_cam1_sda", | ||
921 | "vc_cam2_scl", | ||
922 | "vc_cam2_sda", | ||
923 | "vc_cam3_scl", | ||
924 | "vc_cam3_sda", | ||
925 | }; | ||
926 | |||
927 | /* Every pin can implement all ALT1-ALT4 functions */ | ||
928 | #define BCM281XX_PIN_FUNCTION(fcn_name) \ | ||
929 | { \ | ||
930 | .name = #fcn_name, \ | ||
931 | .groups = bcm281xx_alt_groups, \ | ||
932 | .ngroups = ARRAY_SIZE(bcm281xx_alt_groups), \ | ||
933 | } | ||
934 | |||
935 | static const struct bcm281xx_pin_function bcm281xx_functions[] = { | ||
936 | BCM281XX_PIN_FUNCTION(alt1), | ||
937 | BCM281XX_PIN_FUNCTION(alt2), | ||
938 | BCM281XX_PIN_FUNCTION(alt3), | ||
939 | BCM281XX_PIN_FUNCTION(alt4), | ||
940 | }; | ||
941 | |||
942 | static struct bcm281xx_pinctrl_data bcm281xx_pinctrl = { | ||
943 | .pins = bcm281xx_pinctrl_pins, | ||
944 | .npins = ARRAY_SIZE(bcm281xx_pinctrl_pins), | ||
945 | .functions = bcm281xx_functions, | ||
946 | .nfunctions = ARRAY_SIZE(bcm281xx_functions), | ||
947 | }; | ||
948 | |||
949 | static inline enum bcm281xx_pin_type pin_type_get(struct pinctrl_dev *pctldev, | ||
950 | unsigned pin) | ||
951 | { | ||
952 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
953 | |||
954 | if (pin >= pdata->npins) | ||
955 | return BCM281XX_PIN_TYPE_UNKNOWN; | ||
956 | |||
957 | return *(enum bcm281xx_pin_type *)(pdata->pins[pin].drv_data); | ||
958 | } | ||
959 | |||
960 | #define BCM281XX_PIN_SHIFT(type, param) \ | ||
961 | (BCM281XX_ ## type ## _PIN_REG_ ## param ## _SHIFT) | ||
962 | |||
963 | #define BCM281XX_PIN_MASK(type, param) \ | ||
964 | (BCM281XX_ ## type ## _PIN_REG_ ## param ## _MASK) | ||
965 | |||
966 | /* | ||
967 | * This helper function is used to build up the value and mask used to write to | ||
968 | * a pin register, but does not actually write to the register. | ||
969 | */ | ||
970 | static inline void bcm281xx_pin_update(u32 *reg_val, u32 *reg_mask, | ||
971 | u32 param_val, u32 param_shift, | ||
972 | u32 param_mask) | ||
973 | { | ||
974 | *reg_val &= ~param_mask; | ||
975 | *reg_val |= (param_val << param_shift) & param_mask; | ||
976 | *reg_mask |= param_mask; | ||
977 | } | ||
978 | |||
979 | static struct regmap_config bcm281xx_pinctrl_regmap_config = { | ||
980 | .reg_bits = 32, | ||
981 | .reg_stride = 4, | ||
982 | .val_bits = 32, | ||
983 | .max_register = BCM281XX_PIN_VC_CAM3_SDA, | ||
984 | }; | ||
985 | |||
986 | static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) | ||
987 | { | ||
988 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
989 | |||
990 | return pdata->npins; | ||
991 | } | ||
992 | |||
993 | static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev, | ||
994 | unsigned group) | ||
995 | { | ||
996 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
997 | |||
998 | return pdata->pins[group].name; | ||
999 | } | ||
1000 | |||
1001 | static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, | ||
1002 | unsigned group, | ||
1003 | const unsigned **pins, | ||
1004 | unsigned *num_pins) | ||
1005 | { | ||
1006 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1007 | |||
1008 | *pins = &pdata->pins[group].number; | ||
1009 | *num_pins = 1; | ||
1010 | |||
1011 | return 0; | ||
1012 | } | ||
1013 | |||
1014 | static void bcm281xx_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, | ||
1015 | struct seq_file *s, | ||
1016 | unsigned offset) | ||
1017 | { | ||
1018 | seq_printf(s, " %s", dev_name(pctldev->dev)); | ||
1019 | } | ||
1020 | |||
1021 | static struct pinctrl_ops bcm281xx_pinctrl_ops = { | ||
1022 | .get_groups_count = bcm281xx_pinctrl_get_groups_count, | ||
1023 | .get_group_name = bcm281xx_pinctrl_get_group_name, | ||
1024 | .get_group_pins = bcm281xx_pinctrl_get_group_pins, | ||
1025 | .pin_dbg_show = bcm281xx_pinctrl_pin_dbg_show, | ||
1026 | .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, | ||
1027 | .dt_free_map = pinctrl_utils_dt_free_map, | ||
1028 | }; | ||
1029 | |||
1030 | static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev) | ||
1031 | { | ||
1032 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1033 | |||
1034 | return pdata->nfunctions; | ||
1035 | } | ||
1036 | |||
1037 | static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev, | ||
1038 | unsigned function) | ||
1039 | { | ||
1040 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1041 | |||
1042 | return pdata->functions[function].name; | ||
1043 | } | ||
1044 | |||
1045 | static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev, | ||
1046 | unsigned function, | ||
1047 | const char * const **groups, | ||
1048 | unsigned * const num_groups) | ||
1049 | { | ||
1050 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1051 | |||
1052 | *groups = pdata->functions[function].groups; | ||
1053 | *num_groups = pdata->functions[function].ngroups; | ||
1054 | |||
1055 | return 0; | ||
1056 | } | ||
1057 | |||
1058 | static int bcm281xx_pinmux_enable(struct pinctrl_dev *pctldev, | ||
1059 | unsigned function, | ||
1060 | unsigned group) | ||
1061 | { | ||
1062 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1063 | const struct bcm281xx_pin_function *f = &pdata->functions[function]; | ||
1064 | u32 offset = 4 * pdata->pins[group].number; | ||
1065 | int rc = 0; | ||
1066 | |||
1067 | dev_dbg(pctldev->dev, | ||
1068 | "%s(): Enable function %s (%d) of pin %s (%d) @offset 0x%x.\n", | ||
1069 | __func__, f->name, function, pdata->pins[group].name, | ||
1070 | pdata->pins[group].number, offset); | ||
1071 | |||
1072 | rc = regmap_update_bits(pdata->regmap, offset, | ||
1073 | BCM281XX_PIN_REG_F_SEL_MASK, | ||
1074 | function << BCM281XX_PIN_REG_F_SEL_SHIFT); | ||
1075 | if (rc) | ||
1076 | dev_err(pctldev->dev, | ||
1077 | "Error updating register for pin %s (%d).\n", | ||
1078 | pdata->pins[group].name, pdata->pins[group].number); | ||
1079 | |||
1080 | return rc; | ||
1081 | } | ||
1082 | |||
1083 | static struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = { | ||
1084 | .get_functions_count = bcm281xx_pinctrl_get_fcns_count, | ||
1085 | .get_function_name = bcm281xx_pinctrl_get_fcn_name, | ||
1086 | .get_function_groups = bcm281xx_pinctrl_get_fcn_groups, | ||
1087 | .enable = bcm281xx_pinmux_enable, | ||
1088 | }; | ||
1089 | |||
1090 | static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev, | ||
1091 | unsigned pin, | ||
1092 | unsigned long *config) | ||
1093 | { | ||
1094 | return -ENOTSUPP; | ||
1095 | } | ||
1096 | |||
1097 | |||
1098 | /* Goes through the configs and update register val/mask */ | ||
1099 | static int bcm281xx_std_pin_update(struct pinctrl_dev *pctldev, | ||
1100 | unsigned pin, | ||
1101 | unsigned long *configs, | ||
1102 | unsigned num_configs, | ||
1103 | u32 *val, | ||
1104 | u32 *mask) | ||
1105 | { | ||
1106 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1107 | int i; | ||
1108 | enum pin_config_param param; | ||
1109 | u16 arg; | ||
1110 | |||
1111 | for (i = 0; i < num_configs; i++) { | ||
1112 | param = pinconf_to_config_param(configs[i]); | ||
1113 | arg = pinconf_to_config_argument(configs[i]); | ||
1114 | |||
1115 | switch (param) { | ||
1116 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: | ||
1117 | arg = (arg >= 1 ? 1 : 0); | ||
1118 | bcm281xx_pin_update(val, mask, arg, | ||
1119 | BCM281XX_PIN_SHIFT(STD, HYST), | ||
1120 | BCM281XX_PIN_MASK(STD, HYST)); | ||
1121 | break; | ||
1122 | /* | ||
1123 | * The pin bias can only be one of pull-up, pull-down, or | ||
1124 | * disable. The user does not need to specify a value for the | ||
1125 | * property, and the default value from pinconf-generic is | ||
1126 | * ignored. | ||
1127 | */ | ||
1128 | case PIN_CONFIG_BIAS_DISABLE: | ||
1129 | bcm281xx_pin_update(val, mask, 0, | ||
1130 | BCM281XX_PIN_SHIFT(STD, PULL_UP), | ||
1131 | BCM281XX_PIN_MASK(STD, PULL_UP)); | ||
1132 | bcm281xx_pin_update(val, mask, 0, | ||
1133 | BCM281XX_PIN_SHIFT(STD, PULL_DN), | ||
1134 | BCM281XX_PIN_MASK(STD, PULL_DN)); | ||
1135 | break; | ||
1136 | |||
1137 | case PIN_CONFIG_BIAS_PULL_UP: | ||
1138 | bcm281xx_pin_update(val, mask, 1, | ||
1139 | BCM281XX_PIN_SHIFT(STD, PULL_UP), | ||
1140 | BCM281XX_PIN_MASK(STD, PULL_UP)); | ||
1141 | bcm281xx_pin_update(val, mask, 0, | ||
1142 | BCM281XX_PIN_SHIFT(STD, PULL_DN), | ||
1143 | BCM281XX_PIN_MASK(STD, PULL_DN)); | ||
1144 | break; | ||
1145 | |||
1146 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
1147 | bcm281xx_pin_update(val, mask, 0, | ||
1148 | BCM281XX_PIN_SHIFT(STD, PULL_UP), | ||
1149 | BCM281XX_PIN_MASK(STD, PULL_UP)); | ||
1150 | bcm281xx_pin_update(val, mask, 1, | ||
1151 | BCM281XX_PIN_SHIFT(STD, PULL_DN), | ||
1152 | BCM281XX_PIN_MASK(STD, PULL_DN)); | ||
1153 | break; | ||
1154 | |||
1155 | case PIN_CONFIG_SLEW_RATE: | ||
1156 | arg = (arg >= 1 ? 1 : 0); | ||
1157 | bcm281xx_pin_update(val, mask, arg, | ||
1158 | BCM281XX_PIN_SHIFT(STD, SLEW), | ||
1159 | BCM281XX_PIN_MASK(STD, SLEW)); | ||
1160 | break; | ||
1161 | |||
1162 | case PIN_CONFIG_INPUT_ENABLE: | ||
1163 | /* inversed since register is for input _disable_ */ | ||
1164 | arg = (arg >= 1 ? 0 : 1); | ||
1165 | bcm281xx_pin_update(val, mask, arg, | ||
1166 | BCM281XX_PIN_SHIFT(STD, INPUT_DIS), | ||
1167 | BCM281XX_PIN_MASK(STD, INPUT_DIS)); | ||
1168 | break; | ||
1169 | |||
1170 | case PIN_CONFIG_DRIVE_STRENGTH: | ||
1171 | /* Valid range is 2-16 mA, even numbers only */ | ||
1172 | if ((arg < 2) || (arg > 16) || (arg % 2)) { | ||
1173 | dev_err(pctldev->dev, | ||
1174 | "Invalid Drive Strength value (%d) for " | ||
1175 | "pin %s (%d). Valid values are " | ||
1176 | "(2..16) mA, even numbers only.\n", | ||
1177 | arg, pdata->pins[pin].name, pin); | ||
1178 | return -EINVAL; | ||
1179 | } | ||
1180 | bcm281xx_pin_update(val, mask, (arg/2)-1, | ||
1181 | BCM281XX_PIN_SHIFT(STD, DRV_STR), | ||
1182 | BCM281XX_PIN_MASK(STD, DRV_STR)); | ||
1183 | break; | ||
1184 | |||
1185 | default: | ||
1186 | dev_err(pctldev->dev, | ||
1187 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1188 | param, pdata->pins[pin].name, pin); | ||
1189 | return -EINVAL; | ||
1190 | |||
1191 | } /* switch config */ | ||
1192 | } /* for each config */ | ||
1193 | |||
1194 | return 0; | ||
1195 | } | ||
1196 | |||
1197 | /* | ||
1198 | * The pull-up strength for an I2C pin is represented by bits 4-6 in the | ||
1199 | * register with the following mapping: | ||
1200 | * 0b000: No pull-up | ||
1201 | * 0b001: 1200 Ohm | ||
1202 | * 0b010: 1800 Ohm | ||
1203 | * 0b011: 720 Ohm | ||
1204 | * 0b100: 2700 Ohm | ||
1205 | * 0b101: 831 Ohm | ||
1206 | * 0b110: 1080 Ohm | ||
1207 | * 0b111: 568 Ohm | ||
1208 | * This array maps pull-up strength in Ohms to register values (1+index). | ||
1209 | */ | ||
1210 | static const u16 bcm281xx_pullup_map[] = { | ||
1211 | 1200, 1800, 720, 2700, 831, 1080, 568 | ||
1212 | }; | ||
1213 | |||
1214 | /* Goes through the configs and update register val/mask */ | ||
1215 | static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev, | ||
1216 | unsigned pin, | ||
1217 | unsigned long *configs, | ||
1218 | unsigned num_configs, | ||
1219 | u32 *val, | ||
1220 | u32 *mask) | ||
1221 | { | ||
1222 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1223 | int i, j; | ||
1224 | enum pin_config_param param; | ||
1225 | u16 arg; | ||
1226 | |||
1227 | for (i = 0; i < num_configs; i++) { | ||
1228 | param = pinconf_to_config_param(configs[i]); | ||
1229 | arg = pinconf_to_config_argument(configs[i]); | ||
1230 | |||
1231 | switch (param) { | ||
1232 | case PIN_CONFIG_BIAS_PULL_UP: | ||
1233 | for (j = 0; j < ARRAY_SIZE(bcm281xx_pullup_map); j++) | ||
1234 | if (bcm281xx_pullup_map[j] == arg) | ||
1235 | break; | ||
1236 | |||
1237 | if (j == ARRAY_SIZE(bcm281xx_pullup_map)) { | ||
1238 | dev_err(pctldev->dev, | ||
1239 | "Invalid pull-up value (%d) for pin %s " | ||
1240 | "(%d). Valid values are 568, 720, 831, " | ||
1241 | "1080, 1200, 1800, 2700 Ohms.\n", | ||
1242 | arg, pdata->pins[pin].name, pin); | ||
1243 | return -EINVAL; | ||
1244 | } | ||
1245 | |||
1246 | bcm281xx_pin_update(val, mask, j+1, | ||
1247 | BCM281XX_PIN_SHIFT(I2C, PULL_UP_STR), | ||
1248 | BCM281XX_PIN_MASK(I2C, PULL_UP_STR)); | ||
1249 | break; | ||
1250 | |||
1251 | case PIN_CONFIG_BIAS_DISABLE: | ||
1252 | bcm281xx_pin_update(val, mask, 0, | ||
1253 | BCM281XX_PIN_SHIFT(I2C, PULL_UP_STR), | ||
1254 | BCM281XX_PIN_MASK(I2C, PULL_UP_STR)); | ||
1255 | break; | ||
1256 | |||
1257 | case PIN_CONFIG_SLEW_RATE: | ||
1258 | arg = (arg >= 1 ? 1 : 0); | ||
1259 | bcm281xx_pin_update(val, mask, arg, | ||
1260 | BCM281XX_PIN_SHIFT(I2C, SLEW), | ||
1261 | BCM281XX_PIN_MASK(I2C, SLEW)); | ||
1262 | break; | ||
1263 | |||
1264 | case PIN_CONFIG_INPUT_ENABLE: | ||
1265 | /* inversed since register is for input _disable_ */ | ||
1266 | arg = (arg >= 1 ? 0 : 1); | ||
1267 | bcm281xx_pin_update(val, mask, arg, | ||
1268 | BCM281XX_PIN_SHIFT(I2C, INPUT_DIS), | ||
1269 | BCM281XX_PIN_MASK(I2C, INPUT_DIS)); | ||
1270 | break; | ||
1271 | |||
1272 | default: | ||
1273 | dev_err(pctldev->dev, | ||
1274 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1275 | param, pdata->pins[pin].name, pin); | ||
1276 | return -EINVAL; | ||
1277 | |||
1278 | } /* switch config */ | ||
1279 | } /* for each config */ | ||
1280 | |||
1281 | return 0; | ||
1282 | } | ||
1283 | |||
1284 | /* Goes through the configs and update register val/mask */ | ||
1285 | static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev, | ||
1286 | unsigned pin, | ||
1287 | unsigned long *configs, | ||
1288 | unsigned num_configs, | ||
1289 | u32 *val, | ||
1290 | u32 *mask) | ||
1291 | { | ||
1292 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1293 | int i; | ||
1294 | enum pin_config_param param; | ||
1295 | u16 arg; | ||
1296 | |||
1297 | for (i = 0; i < num_configs; i++) { | ||
1298 | param = pinconf_to_config_param(configs[i]); | ||
1299 | arg = pinconf_to_config_argument(configs[i]); | ||
1300 | |||
1301 | switch (param) { | ||
1302 | case PIN_CONFIG_SLEW_RATE: | ||
1303 | arg = (arg >= 1 ? 1 : 0); | ||
1304 | bcm281xx_pin_update(val, mask, arg, | ||
1305 | BCM281XX_PIN_SHIFT(HDMI, MODE), | ||
1306 | BCM281XX_PIN_MASK(HDMI, MODE)); | ||
1307 | break; | ||
1308 | |||
1309 | case PIN_CONFIG_INPUT_ENABLE: | ||
1310 | /* inversed since register is for input _disable_ */ | ||
1311 | arg = (arg >= 1 ? 0 : 1); | ||
1312 | bcm281xx_pin_update(val, mask, arg, | ||
1313 | BCM281XX_PIN_SHIFT(HDMI, INPUT_DIS), | ||
1314 | BCM281XX_PIN_MASK(HDMI, INPUT_DIS)); | ||
1315 | break; | ||
1316 | |||
1317 | default: | ||
1318 | dev_err(pctldev->dev, | ||
1319 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1320 | param, pdata->pins[pin].name, pin); | ||
1321 | return -EINVAL; | ||
1322 | |||
1323 | } /* switch config */ | ||
1324 | } /* for each config */ | ||
1325 | |||
1326 | return 0; | ||
1327 | } | ||
1328 | |||
1329 | static int bcm281xx_pinctrl_pin_config_set(struct pinctrl_dev *pctldev, | ||
1330 | unsigned pin, | ||
1331 | unsigned long *configs, | ||
1332 | unsigned num_configs) | ||
1333 | { | ||
1334 | struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1335 | enum bcm281xx_pin_type pin_type; | ||
1336 | u32 offset = 4 * pin; | ||
1337 | u32 cfg_val, cfg_mask; | ||
1338 | int rc; | ||
1339 | |||
1340 | cfg_val = 0; | ||
1341 | cfg_mask = 0; | ||
1342 | pin_type = pin_type_get(pctldev, pin); | ||
1343 | |||
1344 | /* Different pins have different configuration options */ | ||
1345 | switch (pin_type) { | ||
1346 | case BCM281XX_PIN_TYPE_STD: | ||
1347 | rc = bcm281xx_std_pin_update(pctldev, pin, configs, | ||
1348 | num_configs, &cfg_val, &cfg_mask); | ||
1349 | break; | ||
1350 | |||
1351 | case BCM281XX_PIN_TYPE_I2C: | ||
1352 | rc = bcm281xx_i2c_pin_update(pctldev, pin, configs, | ||
1353 | num_configs, &cfg_val, &cfg_mask); | ||
1354 | break; | ||
1355 | |||
1356 | case BCM281XX_PIN_TYPE_HDMI: | ||
1357 | rc = bcm281xx_hdmi_pin_update(pctldev, pin, configs, | ||
1358 | num_configs, &cfg_val, &cfg_mask); | ||
1359 | break; | ||
1360 | |||
1361 | default: | ||
1362 | dev_err(pctldev->dev, "Unknown pin type for pin %s (%d).\n", | ||
1363 | pdata->pins[pin].name, pin); | ||
1364 | return -EINVAL; | ||
1365 | |||
1366 | } /* switch pin type */ | ||
1367 | |||
1368 | if (rc) | ||
1369 | return rc; | ||
1370 | |||
1371 | dev_dbg(pctldev->dev, | ||
1372 | "%s(): Set pin %s (%d) with config 0x%x, mask 0x%x\n", | ||
1373 | __func__, pdata->pins[pin].name, pin, cfg_val, cfg_mask); | ||
1374 | |||
1375 | rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val); | ||
1376 | if (rc) { | ||
1377 | dev_err(pctldev->dev, | ||
1378 | "Error updating register for pin %s (%d).\n", | ||
1379 | pdata->pins[pin].name, pin); | ||
1380 | return rc; | ||
1381 | } | ||
1382 | |||
1383 | return 0; | ||
1384 | } | ||
1385 | |||
1386 | static struct pinconf_ops bcm281xx_pinctrl_pinconf_ops = { | ||
1387 | .pin_config_get = bcm281xx_pinctrl_pin_config_get, | ||
1388 | .pin_config_set = bcm281xx_pinctrl_pin_config_set, | ||
1389 | }; | ||
1390 | |||
1391 | static struct pinctrl_desc bcm281xx_pinctrl_desc = { | ||
1392 | /* name, pins, npins members initialized in probe function */ | ||
1393 | .pctlops = &bcm281xx_pinctrl_ops, | ||
1394 | .pmxops = &bcm281xx_pinctrl_pinmux_ops, | ||
1395 | .confops = &bcm281xx_pinctrl_pinconf_ops, | ||
1396 | .owner = THIS_MODULE, | ||
1397 | }; | ||
1398 | |||
1399 | int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) | ||
1400 | { | ||
1401 | struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl; | ||
1402 | struct resource *res; | ||
1403 | struct pinctrl_dev *pctl; | ||
1404 | |||
1405 | /* So far We can assume there is only 1 bank of registers */ | ||
1406 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1407 | if (!res) { | ||
1408 | dev_err(&pdev->dev, "Missing MEM resource\n"); | ||
1409 | return -ENODEV; | ||
1410 | } | ||
1411 | |||
1412 | pdata->reg_base = devm_ioremap_resource(&pdev->dev, res); | ||
1413 | if (IS_ERR(pdata->reg_base)) { | ||
1414 | dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); | ||
1415 | return -ENODEV; | ||
1416 | } | ||
1417 | |||
1418 | /* Initialize the dynamic part of pinctrl_desc */ | ||
1419 | pdata->regmap = devm_regmap_init_mmio(&pdev->dev, pdata->reg_base, | ||
1420 | &bcm281xx_pinctrl_regmap_config); | ||
1421 | if (IS_ERR(pdata->regmap)) { | ||
1422 | dev_err(&pdev->dev, "Regmap MMIO init failed.\n"); | ||
1423 | return -ENODEV; | ||
1424 | } | ||
1425 | |||
1426 | bcm281xx_pinctrl_desc.name = dev_name(&pdev->dev); | ||
1427 | bcm281xx_pinctrl_desc.pins = bcm281xx_pinctrl.pins; | ||
1428 | bcm281xx_pinctrl_desc.npins = bcm281xx_pinctrl.npins; | ||
1429 | |||
1430 | pctl = pinctrl_register(&bcm281xx_pinctrl_desc, | ||
1431 | &pdev->dev, | ||
1432 | pdata); | ||
1433 | if (!pctl) { | ||
1434 | dev_err(&pdev->dev, "Failed to register pinctrl\n"); | ||
1435 | return -ENODEV; | ||
1436 | } | ||
1437 | |||
1438 | platform_set_drvdata(pdev, pdata); | ||
1439 | |||
1440 | return 0; | ||
1441 | } | ||
1442 | |||
1443 | static struct of_device_id bcm281xx_pinctrl_of_match[] = { | ||
1444 | { .compatible = "brcm,bcm11351-pinctrl", }, | ||
1445 | { }, | ||
1446 | }; | ||
1447 | |||
1448 | static struct platform_driver bcm281xx_pinctrl_driver = { | ||
1449 | .driver = { | ||
1450 | .name = "bcm281xx-pinctrl", | ||
1451 | .owner = THIS_MODULE, | ||
1452 | .of_match_table = bcm281xx_pinctrl_of_match, | ||
1453 | }, | ||
1454 | }; | ||
1455 | |||
1456 | module_platform_driver_probe(bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); | ||
1457 | |||
1458 | MODULE_AUTHOR("Broadcom Corporation <bcm-kernel-feedback-list@broadcom.com>"); | ||
1459 | MODULE_AUTHOR("Sherman Yin <syin@broadcom.com>"); | ||
1460 | MODULE_DESCRIPTION("Broadcom BCM281xx pinctrl driver"); | ||
1461 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-capri.c b/drivers/pinctrl/pinctrl-capri.c deleted file mode 100644 index eb2500212147..000000000000 --- a/drivers/pinctrl/pinctrl-capri.c +++ /dev/null | |||
@@ -1,1454 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
9 | * kind, whether express or implied; without even the implied warranty | ||
10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/pinctrl/pinmux.h> | ||
20 | #include <linux/pinctrl/pinconf.h> | ||
21 | #include <linux/pinctrl/pinconf-generic.h> | ||
22 | #include <linux/regmap.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include "core.h" | ||
25 | #include "pinctrl-utils.h" | ||
26 | |||
27 | /* Capri Pin Control Registers Definitions */ | ||
28 | |||
29 | /* Function Select bits are the same for all pin control registers */ | ||
30 | #define CAPRI_PIN_REG_F_SEL_MASK 0x0700 | ||
31 | #define CAPRI_PIN_REG_F_SEL_SHIFT 8 | ||
32 | |||
33 | /* Standard pin register */ | ||
34 | #define CAPRI_STD_PIN_REG_DRV_STR_MASK 0x0007 | ||
35 | #define CAPRI_STD_PIN_REG_DRV_STR_SHIFT 0 | ||
36 | #define CAPRI_STD_PIN_REG_INPUT_DIS_MASK 0x0008 | ||
37 | #define CAPRI_STD_PIN_REG_INPUT_DIS_SHIFT 3 | ||
38 | #define CAPRI_STD_PIN_REG_SLEW_MASK 0x0010 | ||
39 | #define CAPRI_STD_PIN_REG_SLEW_SHIFT 4 | ||
40 | #define CAPRI_STD_PIN_REG_PULL_UP_MASK 0x0020 | ||
41 | #define CAPRI_STD_PIN_REG_PULL_UP_SHIFT 5 | ||
42 | #define CAPRI_STD_PIN_REG_PULL_DN_MASK 0x0040 | ||
43 | #define CAPRI_STD_PIN_REG_PULL_DN_SHIFT 6 | ||
44 | #define CAPRI_STD_PIN_REG_HYST_MASK 0x0080 | ||
45 | #define CAPRI_STD_PIN_REG_HYST_SHIFT 7 | ||
46 | |||
47 | /* I2C pin register */ | ||
48 | #define CAPRI_I2C_PIN_REG_INPUT_DIS_MASK 0x0004 | ||
49 | #define CAPRI_I2C_PIN_REG_INPUT_DIS_SHIFT 2 | ||
50 | #define CAPRI_I2C_PIN_REG_SLEW_MASK 0x0008 | ||
51 | #define CAPRI_I2C_PIN_REG_SLEW_SHIFT 3 | ||
52 | #define CAPRI_I2C_PIN_REG_PULL_UP_STR_MASK 0x0070 | ||
53 | #define CAPRI_I2C_PIN_REG_PULL_UP_STR_SHIFT 4 | ||
54 | |||
55 | /* HDMI pin register */ | ||
56 | #define CAPRI_HDMI_PIN_REG_INPUT_DIS_MASK 0x0008 | ||
57 | #define CAPRI_HDMI_PIN_REG_INPUT_DIS_SHIFT 3 | ||
58 | #define CAPRI_HDMI_PIN_REG_MODE_MASK 0x0010 | ||
59 | #define CAPRI_HDMI_PIN_REG_MODE_SHIFT 4 | ||
60 | |||
61 | /** | ||
62 | * capri_pin_type - types of pin register | ||
63 | */ | ||
64 | enum capri_pin_type { | ||
65 | CAPRI_PIN_TYPE_UNKNOWN = 0, | ||
66 | CAPRI_PIN_TYPE_STD, | ||
67 | CAPRI_PIN_TYPE_I2C, | ||
68 | CAPRI_PIN_TYPE_HDMI, | ||
69 | }; | ||
70 | |||
71 | static enum capri_pin_type std_pin = CAPRI_PIN_TYPE_STD; | ||
72 | static enum capri_pin_type i2c_pin = CAPRI_PIN_TYPE_I2C; | ||
73 | static enum capri_pin_type hdmi_pin = CAPRI_PIN_TYPE_HDMI; | ||
74 | |||
75 | /** | ||
76 | * capri_pin_function- define pin function | ||
77 | */ | ||
78 | struct capri_pin_function { | ||
79 | const char *name; | ||
80 | const char * const *groups; | ||
81 | const unsigned ngroups; | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * capri_pinctrl_data - Broadcom-specific pinctrl data | ||
86 | * @reg_base - base of pinctrl registers | ||
87 | */ | ||
88 | struct capri_pinctrl_data { | ||
89 | void __iomem *reg_base; | ||
90 | |||
91 | /* List of all pins */ | ||
92 | const struct pinctrl_pin_desc *pins; | ||
93 | const unsigned npins; | ||
94 | |||
95 | const struct capri_pin_function *functions; | ||
96 | const unsigned nfunctions; | ||
97 | |||
98 | struct regmap *regmap; | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * Pin number definition. The order here must be the same as defined in the | ||
103 | * PADCTRLREG block in the RDB. | ||
104 | */ | ||
105 | #define CAPRI_PIN_ADCSYNC 0 | ||
106 | #define CAPRI_PIN_BAT_RM 1 | ||
107 | #define CAPRI_PIN_BSC1_SCL 2 | ||
108 | #define CAPRI_PIN_BSC1_SDA 3 | ||
109 | #define CAPRI_PIN_BSC2_SCL 4 | ||
110 | #define CAPRI_PIN_BSC2_SDA 5 | ||
111 | #define CAPRI_PIN_CLASSGPWR 6 | ||
112 | #define CAPRI_PIN_CLK_CX8 7 | ||
113 | #define CAPRI_PIN_CLKOUT_0 8 | ||
114 | #define CAPRI_PIN_CLKOUT_1 9 | ||
115 | #define CAPRI_PIN_CLKOUT_2 10 | ||
116 | #define CAPRI_PIN_CLKOUT_3 11 | ||
117 | #define CAPRI_PIN_CLKREQ_IN_0 12 | ||
118 | #define CAPRI_PIN_CLKREQ_IN_1 13 | ||
119 | #define CAPRI_PIN_CWS_SYS_REQ1 14 | ||
120 | #define CAPRI_PIN_CWS_SYS_REQ2 15 | ||
121 | #define CAPRI_PIN_CWS_SYS_REQ3 16 | ||
122 | #define CAPRI_PIN_DIGMIC1_CLK 17 | ||
123 | #define CAPRI_PIN_DIGMIC1_DQ 18 | ||
124 | #define CAPRI_PIN_DIGMIC2_CLK 19 | ||
125 | #define CAPRI_PIN_DIGMIC2_DQ 20 | ||
126 | #define CAPRI_PIN_GPEN13 21 | ||
127 | #define CAPRI_PIN_GPEN14 22 | ||
128 | #define CAPRI_PIN_GPEN15 23 | ||
129 | #define CAPRI_PIN_GPIO00 24 | ||
130 | #define CAPRI_PIN_GPIO01 25 | ||
131 | #define CAPRI_PIN_GPIO02 26 | ||
132 | #define CAPRI_PIN_GPIO03 27 | ||
133 | #define CAPRI_PIN_GPIO04 28 | ||
134 | #define CAPRI_PIN_GPIO05 29 | ||
135 | #define CAPRI_PIN_GPIO06 30 | ||
136 | #define CAPRI_PIN_GPIO07 31 | ||
137 | #define CAPRI_PIN_GPIO08 32 | ||
138 | #define CAPRI_PIN_GPIO09 33 | ||
139 | #define CAPRI_PIN_GPIO10 34 | ||
140 | #define CAPRI_PIN_GPIO11 35 | ||
141 | #define CAPRI_PIN_GPIO12 36 | ||
142 | #define CAPRI_PIN_GPIO13 37 | ||
143 | #define CAPRI_PIN_GPIO14 38 | ||
144 | #define CAPRI_PIN_GPS_PABLANK 39 | ||
145 | #define CAPRI_PIN_GPS_TMARK 40 | ||
146 | #define CAPRI_PIN_HDMI_SCL 41 | ||
147 | #define CAPRI_PIN_HDMI_SDA 42 | ||
148 | #define CAPRI_PIN_IC_DM 43 | ||
149 | #define CAPRI_PIN_IC_DP 44 | ||
150 | #define CAPRI_PIN_KP_COL_IP_0 45 | ||
151 | #define CAPRI_PIN_KP_COL_IP_1 46 | ||
152 | #define CAPRI_PIN_KP_COL_IP_2 47 | ||
153 | #define CAPRI_PIN_KP_COL_IP_3 48 | ||
154 | #define CAPRI_PIN_KP_ROW_OP_0 49 | ||
155 | #define CAPRI_PIN_KP_ROW_OP_1 50 | ||
156 | #define CAPRI_PIN_KP_ROW_OP_2 51 | ||
157 | #define CAPRI_PIN_KP_ROW_OP_3 52 | ||
158 | #define CAPRI_PIN_LCD_B_0 53 | ||
159 | #define CAPRI_PIN_LCD_B_1 54 | ||
160 | #define CAPRI_PIN_LCD_B_2 55 | ||
161 | #define CAPRI_PIN_LCD_B_3 56 | ||
162 | #define CAPRI_PIN_LCD_B_4 57 | ||
163 | #define CAPRI_PIN_LCD_B_5 58 | ||
164 | #define CAPRI_PIN_LCD_B_6 59 | ||
165 | #define CAPRI_PIN_LCD_B_7 60 | ||
166 | #define CAPRI_PIN_LCD_G_0 61 | ||
167 | #define CAPRI_PIN_LCD_G_1 62 | ||
168 | #define CAPRI_PIN_LCD_G_2 63 | ||
169 | #define CAPRI_PIN_LCD_G_3 64 | ||
170 | #define CAPRI_PIN_LCD_G_4 65 | ||
171 | #define CAPRI_PIN_LCD_G_5 66 | ||
172 | #define CAPRI_PIN_LCD_G_6 67 | ||
173 | #define CAPRI_PIN_LCD_G_7 68 | ||
174 | #define CAPRI_PIN_LCD_HSYNC 69 | ||
175 | #define CAPRI_PIN_LCD_OE 70 | ||
176 | #define CAPRI_PIN_LCD_PCLK 71 | ||
177 | #define CAPRI_PIN_LCD_R_0 72 | ||
178 | #define CAPRI_PIN_LCD_R_1 73 | ||
179 | #define CAPRI_PIN_LCD_R_2 74 | ||
180 | #define CAPRI_PIN_LCD_R_3 75 | ||
181 | #define CAPRI_PIN_LCD_R_4 76 | ||
182 | #define CAPRI_PIN_LCD_R_5 77 | ||
183 | #define CAPRI_PIN_LCD_R_6 78 | ||
184 | #define CAPRI_PIN_LCD_R_7 79 | ||
185 | #define CAPRI_PIN_LCD_VSYNC 80 | ||
186 | #define CAPRI_PIN_MDMGPIO0 81 | ||
187 | #define CAPRI_PIN_MDMGPIO1 82 | ||
188 | #define CAPRI_PIN_MDMGPIO2 83 | ||
189 | #define CAPRI_PIN_MDMGPIO3 84 | ||
190 | #define CAPRI_PIN_MDMGPIO4 85 | ||
191 | #define CAPRI_PIN_MDMGPIO5 86 | ||
192 | #define CAPRI_PIN_MDMGPIO6 87 | ||
193 | #define CAPRI_PIN_MDMGPIO7 88 | ||
194 | #define CAPRI_PIN_MDMGPIO8 89 | ||
195 | #define CAPRI_PIN_MPHI_DATA_0 90 | ||
196 | #define CAPRI_PIN_MPHI_DATA_1 91 | ||
197 | #define CAPRI_PIN_MPHI_DATA_2 92 | ||
198 | #define CAPRI_PIN_MPHI_DATA_3 93 | ||
199 | #define CAPRI_PIN_MPHI_DATA_4 94 | ||
200 | #define CAPRI_PIN_MPHI_DATA_5 95 | ||
201 | #define CAPRI_PIN_MPHI_DATA_6 96 | ||
202 | #define CAPRI_PIN_MPHI_DATA_7 97 | ||
203 | #define CAPRI_PIN_MPHI_DATA_8 98 | ||
204 | #define CAPRI_PIN_MPHI_DATA_9 99 | ||
205 | #define CAPRI_PIN_MPHI_DATA_10 100 | ||
206 | #define CAPRI_PIN_MPHI_DATA_11 101 | ||
207 | #define CAPRI_PIN_MPHI_DATA_12 102 | ||
208 | #define CAPRI_PIN_MPHI_DATA_13 103 | ||
209 | #define CAPRI_PIN_MPHI_DATA_14 104 | ||
210 | #define CAPRI_PIN_MPHI_DATA_15 105 | ||
211 | #define CAPRI_PIN_MPHI_HA0 106 | ||
212 | #define CAPRI_PIN_MPHI_HAT0 107 | ||
213 | #define CAPRI_PIN_MPHI_HAT1 108 | ||
214 | #define CAPRI_PIN_MPHI_HCE0_N 109 | ||
215 | #define CAPRI_PIN_MPHI_HCE1_N 110 | ||
216 | #define CAPRI_PIN_MPHI_HRD_N 111 | ||
217 | #define CAPRI_PIN_MPHI_HWR_N 112 | ||
218 | #define CAPRI_PIN_MPHI_RUN0 113 | ||
219 | #define CAPRI_PIN_MPHI_RUN1 114 | ||
220 | #define CAPRI_PIN_MTX_SCAN_CLK 115 | ||
221 | #define CAPRI_PIN_MTX_SCAN_DATA 116 | ||
222 | #define CAPRI_PIN_NAND_AD_0 117 | ||
223 | #define CAPRI_PIN_NAND_AD_1 118 | ||
224 | #define CAPRI_PIN_NAND_AD_2 119 | ||
225 | #define CAPRI_PIN_NAND_AD_3 120 | ||
226 | #define CAPRI_PIN_NAND_AD_4 121 | ||
227 | #define CAPRI_PIN_NAND_AD_5 122 | ||
228 | #define CAPRI_PIN_NAND_AD_6 123 | ||
229 | #define CAPRI_PIN_NAND_AD_7 124 | ||
230 | #define CAPRI_PIN_NAND_ALE 125 | ||
231 | #define CAPRI_PIN_NAND_CEN_0 126 | ||
232 | #define CAPRI_PIN_NAND_CEN_1 127 | ||
233 | #define CAPRI_PIN_NAND_CLE 128 | ||
234 | #define CAPRI_PIN_NAND_OEN 129 | ||
235 | #define CAPRI_PIN_NAND_RDY_0 130 | ||
236 | #define CAPRI_PIN_NAND_RDY_1 131 | ||
237 | #define CAPRI_PIN_NAND_WEN 132 | ||
238 | #define CAPRI_PIN_NAND_WP 133 | ||
239 | #define CAPRI_PIN_PC1 134 | ||
240 | #define CAPRI_PIN_PC2 135 | ||
241 | #define CAPRI_PIN_PMU_INT 136 | ||
242 | #define CAPRI_PIN_PMU_SCL 137 | ||
243 | #define CAPRI_PIN_PMU_SDA 138 | ||
244 | #define CAPRI_PIN_RFST2G_MTSLOTEN3G 139 | ||
245 | #define CAPRI_PIN_RGMII_0_RX_CTL 140 | ||
246 | #define CAPRI_PIN_RGMII_0_RXC 141 | ||
247 | #define CAPRI_PIN_RGMII_0_RXD_0 142 | ||
248 | #define CAPRI_PIN_RGMII_0_RXD_1 143 | ||
249 | #define CAPRI_PIN_RGMII_0_RXD_2 144 | ||
250 | #define CAPRI_PIN_RGMII_0_RXD_3 145 | ||
251 | #define CAPRI_PIN_RGMII_0_TX_CTL 146 | ||
252 | #define CAPRI_PIN_RGMII_0_TXC 147 | ||
253 | #define CAPRI_PIN_RGMII_0_TXD_0 148 | ||
254 | #define CAPRI_PIN_RGMII_0_TXD_1 149 | ||
255 | #define CAPRI_PIN_RGMII_0_TXD_2 150 | ||
256 | #define CAPRI_PIN_RGMII_0_TXD_3 151 | ||
257 | #define CAPRI_PIN_RGMII_1_RX_CTL 152 | ||
258 | #define CAPRI_PIN_RGMII_1_RXC 153 | ||
259 | #define CAPRI_PIN_RGMII_1_RXD_0 154 | ||
260 | #define CAPRI_PIN_RGMII_1_RXD_1 155 | ||
261 | #define CAPRI_PIN_RGMII_1_RXD_2 156 | ||
262 | #define CAPRI_PIN_RGMII_1_RXD_3 157 | ||
263 | #define CAPRI_PIN_RGMII_1_TX_CTL 158 | ||
264 | #define CAPRI_PIN_RGMII_1_TXC 159 | ||
265 | #define CAPRI_PIN_RGMII_1_TXD_0 160 | ||
266 | #define CAPRI_PIN_RGMII_1_TXD_1 161 | ||
267 | #define CAPRI_PIN_RGMII_1_TXD_2 162 | ||
268 | #define CAPRI_PIN_RGMII_1_TXD_3 163 | ||
269 | #define CAPRI_PIN_RGMII_GPIO_0 164 | ||
270 | #define CAPRI_PIN_RGMII_GPIO_1 165 | ||
271 | #define CAPRI_PIN_RGMII_GPIO_2 166 | ||
272 | #define CAPRI_PIN_RGMII_GPIO_3 167 | ||
273 | #define CAPRI_PIN_RTXDATA2G_TXDATA3G1 168 | ||
274 | #define CAPRI_PIN_RTXEN2G_TXDATA3G2 169 | ||
275 | #define CAPRI_PIN_RXDATA3G0 170 | ||
276 | #define CAPRI_PIN_RXDATA3G1 171 | ||
277 | #define CAPRI_PIN_RXDATA3G2 172 | ||
278 | #define CAPRI_PIN_SDIO1_CLK 173 | ||
279 | #define CAPRI_PIN_SDIO1_CMD 174 | ||
280 | #define CAPRI_PIN_SDIO1_DATA_0 175 | ||
281 | #define CAPRI_PIN_SDIO1_DATA_1 176 | ||
282 | #define CAPRI_PIN_SDIO1_DATA_2 177 | ||
283 | #define CAPRI_PIN_SDIO1_DATA_3 178 | ||
284 | #define CAPRI_PIN_SDIO4_CLK 179 | ||
285 | #define CAPRI_PIN_SDIO4_CMD 180 | ||
286 | #define CAPRI_PIN_SDIO4_DATA_0 181 | ||
287 | #define CAPRI_PIN_SDIO4_DATA_1 182 | ||
288 | #define CAPRI_PIN_SDIO4_DATA_2 183 | ||
289 | #define CAPRI_PIN_SDIO4_DATA_3 184 | ||
290 | #define CAPRI_PIN_SIM_CLK 185 | ||
291 | #define CAPRI_PIN_SIM_DATA 186 | ||
292 | #define CAPRI_PIN_SIM_DET 187 | ||
293 | #define CAPRI_PIN_SIM_RESETN 188 | ||
294 | #define CAPRI_PIN_SIM2_CLK 189 | ||
295 | #define CAPRI_PIN_SIM2_DATA 190 | ||
296 | #define CAPRI_PIN_SIM2_DET 191 | ||
297 | #define CAPRI_PIN_SIM2_RESETN 192 | ||
298 | #define CAPRI_PIN_SRI_C 193 | ||
299 | #define CAPRI_PIN_SRI_D 194 | ||
300 | #define CAPRI_PIN_SRI_E 195 | ||
301 | #define CAPRI_PIN_SSP_EXTCLK 196 | ||
302 | #define CAPRI_PIN_SSP0_CLK 197 | ||
303 | #define CAPRI_PIN_SSP0_FS 198 | ||
304 | #define CAPRI_PIN_SSP0_RXD 199 | ||
305 | #define CAPRI_PIN_SSP0_TXD 200 | ||
306 | #define CAPRI_PIN_SSP2_CLK 201 | ||
307 | #define CAPRI_PIN_SSP2_FS_0 202 | ||
308 | #define CAPRI_PIN_SSP2_FS_1 203 | ||
309 | #define CAPRI_PIN_SSP2_FS_2 204 | ||
310 | #define CAPRI_PIN_SSP2_FS_3 205 | ||
311 | #define CAPRI_PIN_SSP2_RXD_0 206 | ||
312 | #define CAPRI_PIN_SSP2_RXD_1 207 | ||
313 | #define CAPRI_PIN_SSP2_TXD_0 208 | ||
314 | #define CAPRI_PIN_SSP2_TXD_1 209 | ||
315 | #define CAPRI_PIN_SSP3_CLK 210 | ||
316 | #define CAPRI_PIN_SSP3_FS 211 | ||
317 | #define CAPRI_PIN_SSP3_RXD 212 | ||
318 | #define CAPRI_PIN_SSP3_TXD 213 | ||
319 | #define CAPRI_PIN_SSP4_CLK 214 | ||
320 | #define CAPRI_PIN_SSP4_FS 215 | ||
321 | #define CAPRI_PIN_SSP4_RXD 216 | ||
322 | #define CAPRI_PIN_SSP4_TXD 217 | ||
323 | #define CAPRI_PIN_SSP5_CLK 218 | ||
324 | #define CAPRI_PIN_SSP5_FS 219 | ||
325 | #define CAPRI_PIN_SSP5_RXD 220 | ||
326 | #define CAPRI_PIN_SSP5_TXD 221 | ||
327 | #define CAPRI_PIN_SSP6_CLK 222 | ||
328 | #define CAPRI_PIN_SSP6_FS 223 | ||
329 | #define CAPRI_PIN_SSP6_RXD 224 | ||
330 | #define CAPRI_PIN_SSP6_TXD 225 | ||
331 | #define CAPRI_PIN_STAT_1 226 | ||
332 | #define CAPRI_PIN_STAT_2 227 | ||
333 | #define CAPRI_PIN_SYSCLKEN 228 | ||
334 | #define CAPRI_PIN_TRACECLK 229 | ||
335 | #define CAPRI_PIN_TRACEDT00 230 | ||
336 | #define CAPRI_PIN_TRACEDT01 231 | ||
337 | #define CAPRI_PIN_TRACEDT02 232 | ||
338 | #define CAPRI_PIN_TRACEDT03 233 | ||
339 | #define CAPRI_PIN_TRACEDT04 234 | ||
340 | #define CAPRI_PIN_TRACEDT05 235 | ||
341 | #define CAPRI_PIN_TRACEDT06 236 | ||
342 | #define CAPRI_PIN_TRACEDT07 237 | ||
343 | #define CAPRI_PIN_TRACEDT08 238 | ||
344 | #define CAPRI_PIN_TRACEDT09 239 | ||
345 | #define CAPRI_PIN_TRACEDT10 240 | ||
346 | #define CAPRI_PIN_TRACEDT11 241 | ||
347 | #define CAPRI_PIN_TRACEDT12 242 | ||
348 | #define CAPRI_PIN_TRACEDT13 243 | ||
349 | #define CAPRI_PIN_TRACEDT14 244 | ||
350 | #define CAPRI_PIN_TRACEDT15 245 | ||
351 | #define CAPRI_PIN_TXDATA3G0 246 | ||
352 | #define CAPRI_PIN_TXPWRIND 247 | ||
353 | #define CAPRI_PIN_UARTB1_UCTS 248 | ||
354 | #define CAPRI_PIN_UARTB1_URTS 249 | ||
355 | #define CAPRI_PIN_UARTB1_URXD 250 | ||
356 | #define CAPRI_PIN_UARTB1_UTXD 251 | ||
357 | #define CAPRI_PIN_UARTB2_URXD 252 | ||
358 | #define CAPRI_PIN_UARTB2_UTXD 253 | ||
359 | #define CAPRI_PIN_UARTB3_UCTS 254 | ||
360 | #define CAPRI_PIN_UARTB3_URTS 255 | ||
361 | #define CAPRI_PIN_UARTB3_URXD 256 | ||
362 | #define CAPRI_PIN_UARTB3_UTXD 257 | ||
363 | #define CAPRI_PIN_UARTB4_UCTS 258 | ||
364 | #define CAPRI_PIN_UARTB4_URTS 259 | ||
365 | #define CAPRI_PIN_UARTB4_URXD 260 | ||
366 | #define CAPRI_PIN_UARTB4_UTXD 261 | ||
367 | #define CAPRI_PIN_VC_CAM1_SCL 262 | ||
368 | #define CAPRI_PIN_VC_CAM1_SDA 263 | ||
369 | #define CAPRI_PIN_VC_CAM2_SCL 264 | ||
370 | #define CAPRI_PIN_VC_CAM2_SDA 265 | ||
371 | #define CAPRI_PIN_VC_CAM3_SCL 266 | ||
372 | #define CAPRI_PIN_VC_CAM3_SDA 267 | ||
373 | |||
374 | #define CAPRI_PIN_DESC(a, b, c) \ | ||
375 | { .number = a, .name = b, .drv_data = &c##_pin } | ||
376 | |||
377 | /* | ||
378 | * Pin description definition. The order here must be the same as defined in | ||
379 | * the PADCTRLREG block in the RDB, since the pin number is used as an index | ||
380 | * into this array. | ||
381 | */ | ||
382 | static const struct pinctrl_pin_desc capri_pinctrl_pins[] = { | ||
383 | CAPRI_PIN_DESC(CAPRI_PIN_ADCSYNC, "adcsync", std), | ||
384 | CAPRI_PIN_DESC(CAPRI_PIN_BAT_RM, "bat_rm", std), | ||
385 | CAPRI_PIN_DESC(CAPRI_PIN_BSC1_SCL, "bsc1_scl", i2c), | ||
386 | CAPRI_PIN_DESC(CAPRI_PIN_BSC1_SDA, "bsc1_sda", i2c), | ||
387 | CAPRI_PIN_DESC(CAPRI_PIN_BSC2_SCL, "bsc2_scl", i2c), | ||
388 | CAPRI_PIN_DESC(CAPRI_PIN_BSC2_SDA, "bsc2_sda", i2c), | ||
389 | CAPRI_PIN_DESC(CAPRI_PIN_CLASSGPWR, "classgpwr", std), | ||
390 | CAPRI_PIN_DESC(CAPRI_PIN_CLK_CX8, "clk_cx8", std), | ||
391 | CAPRI_PIN_DESC(CAPRI_PIN_CLKOUT_0, "clkout_0", std), | ||
392 | CAPRI_PIN_DESC(CAPRI_PIN_CLKOUT_1, "clkout_1", std), | ||
393 | CAPRI_PIN_DESC(CAPRI_PIN_CLKOUT_2, "clkout_2", std), | ||
394 | CAPRI_PIN_DESC(CAPRI_PIN_CLKOUT_3, "clkout_3", std), | ||
395 | CAPRI_PIN_DESC(CAPRI_PIN_CLKREQ_IN_0, "clkreq_in_0", std), | ||
396 | CAPRI_PIN_DESC(CAPRI_PIN_CLKREQ_IN_1, "clkreq_in_1", std), | ||
397 | CAPRI_PIN_DESC(CAPRI_PIN_CWS_SYS_REQ1, "cws_sys_req1", std), | ||
398 | CAPRI_PIN_DESC(CAPRI_PIN_CWS_SYS_REQ2, "cws_sys_req2", std), | ||
399 | CAPRI_PIN_DESC(CAPRI_PIN_CWS_SYS_REQ3, "cws_sys_req3", std), | ||
400 | CAPRI_PIN_DESC(CAPRI_PIN_DIGMIC1_CLK, "digmic1_clk", std), | ||
401 | CAPRI_PIN_DESC(CAPRI_PIN_DIGMIC1_DQ, "digmic1_dq", std), | ||
402 | CAPRI_PIN_DESC(CAPRI_PIN_DIGMIC2_CLK, "digmic2_clk", std), | ||
403 | CAPRI_PIN_DESC(CAPRI_PIN_DIGMIC2_DQ, "digmic2_dq", std), | ||
404 | CAPRI_PIN_DESC(CAPRI_PIN_GPEN13, "gpen13", std), | ||
405 | CAPRI_PIN_DESC(CAPRI_PIN_GPEN14, "gpen14", std), | ||
406 | CAPRI_PIN_DESC(CAPRI_PIN_GPEN15, "gpen15", std), | ||
407 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO00, "gpio00", std), | ||
408 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO01, "gpio01", std), | ||
409 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO02, "gpio02", std), | ||
410 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO03, "gpio03", std), | ||
411 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO04, "gpio04", std), | ||
412 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO05, "gpio05", std), | ||
413 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO06, "gpio06", std), | ||
414 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO07, "gpio07", std), | ||
415 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO08, "gpio08", std), | ||
416 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO09, "gpio09", std), | ||
417 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO10, "gpio10", std), | ||
418 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO11, "gpio11", std), | ||
419 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO12, "gpio12", std), | ||
420 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO13, "gpio13", std), | ||
421 | CAPRI_PIN_DESC(CAPRI_PIN_GPIO14, "gpio14", std), | ||
422 | CAPRI_PIN_DESC(CAPRI_PIN_GPS_PABLANK, "gps_pablank", std), | ||
423 | CAPRI_PIN_DESC(CAPRI_PIN_GPS_TMARK, "gps_tmark", std), | ||
424 | CAPRI_PIN_DESC(CAPRI_PIN_HDMI_SCL, "hdmi_scl", hdmi), | ||
425 | CAPRI_PIN_DESC(CAPRI_PIN_HDMI_SDA, "hdmi_sda", hdmi), | ||
426 | CAPRI_PIN_DESC(CAPRI_PIN_IC_DM, "ic_dm", std), | ||
427 | CAPRI_PIN_DESC(CAPRI_PIN_IC_DP, "ic_dp", std), | ||
428 | CAPRI_PIN_DESC(CAPRI_PIN_KP_COL_IP_0, "kp_col_ip_0", std), | ||
429 | CAPRI_PIN_DESC(CAPRI_PIN_KP_COL_IP_1, "kp_col_ip_1", std), | ||
430 | CAPRI_PIN_DESC(CAPRI_PIN_KP_COL_IP_2, "kp_col_ip_2", std), | ||
431 | CAPRI_PIN_DESC(CAPRI_PIN_KP_COL_IP_3, "kp_col_ip_3", std), | ||
432 | CAPRI_PIN_DESC(CAPRI_PIN_KP_ROW_OP_0, "kp_row_op_0", std), | ||
433 | CAPRI_PIN_DESC(CAPRI_PIN_KP_ROW_OP_1, "kp_row_op_1", std), | ||
434 | CAPRI_PIN_DESC(CAPRI_PIN_KP_ROW_OP_2, "kp_row_op_2", std), | ||
435 | CAPRI_PIN_DESC(CAPRI_PIN_KP_ROW_OP_3, "kp_row_op_3", std), | ||
436 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_0, "lcd_b_0", std), | ||
437 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_1, "lcd_b_1", std), | ||
438 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_2, "lcd_b_2", std), | ||
439 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_3, "lcd_b_3", std), | ||
440 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_4, "lcd_b_4", std), | ||
441 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_5, "lcd_b_5", std), | ||
442 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_6, "lcd_b_6", std), | ||
443 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_B_7, "lcd_b_7", std), | ||
444 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_0, "lcd_g_0", std), | ||
445 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_1, "lcd_g_1", std), | ||
446 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_2, "lcd_g_2", std), | ||
447 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_3, "lcd_g_3", std), | ||
448 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_4, "lcd_g_4", std), | ||
449 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_5, "lcd_g_5", std), | ||
450 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_6, "lcd_g_6", std), | ||
451 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_G_7, "lcd_g_7", std), | ||
452 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_HSYNC, "lcd_hsync", std), | ||
453 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_OE, "lcd_oe", std), | ||
454 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_PCLK, "lcd_pclk", std), | ||
455 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_0, "lcd_r_0", std), | ||
456 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_1, "lcd_r_1", std), | ||
457 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_2, "lcd_r_2", std), | ||
458 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_3, "lcd_r_3", std), | ||
459 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_4, "lcd_r_4", std), | ||
460 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_5, "lcd_r_5", std), | ||
461 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_6, "lcd_r_6", std), | ||
462 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_R_7, "lcd_r_7", std), | ||
463 | CAPRI_PIN_DESC(CAPRI_PIN_LCD_VSYNC, "lcd_vsync", std), | ||
464 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO0, "mdmgpio0", std), | ||
465 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO1, "mdmgpio1", std), | ||
466 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO2, "mdmgpio2", std), | ||
467 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO3, "mdmgpio3", std), | ||
468 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO4, "mdmgpio4", std), | ||
469 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO5, "mdmgpio5", std), | ||
470 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO6, "mdmgpio6", std), | ||
471 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO7, "mdmgpio7", std), | ||
472 | CAPRI_PIN_DESC(CAPRI_PIN_MDMGPIO8, "mdmgpio8", std), | ||
473 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_0, "mphi_data_0", std), | ||
474 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_1, "mphi_data_1", std), | ||
475 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_2, "mphi_data_2", std), | ||
476 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_3, "mphi_data_3", std), | ||
477 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_4, "mphi_data_4", std), | ||
478 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_5, "mphi_data_5", std), | ||
479 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_6, "mphi_data_6", std), | ||
480 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_7, "mphi_data_7", std), | ||
481 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_8, "mphi_data_8", std), | ||
482 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_9, "mphi_data_9", std), | ||
483 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_10, "mphi_data_10", std), | ||
484 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_11, "mphi_data_11", std), | ||
485 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_12, "mphi_data_12", std), | ||
486 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_13, "mphi_data_13", std), | ||
487 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_14, "mphi_data_14", std), | ||
488 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_DATA_15, "mphi_data_15", std), | ||
489 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HA0, "mphi_ha0", std), | ||
490 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HAT0, "mphi_hat0", std), | ||
491 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HAT1, "mphi_hat1", std), | ||
492 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HCE0_N, "mphi_hce0_n", std), | ||
493 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HCE1_N, "mphi_hce1_n", std), | ||
494 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HRD_N, "mphi_hrd_n", std), | ||
495 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_HWR_N, "mphi_hwr_n", std), | ||
496 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_RUN0, "mphi_run0", std), | ||
497 | CAPRI_PIN_DESC(CAPRI_PIN_MPHI_RUN1, "mphi_run1", std), | ||
498 | CAPRI_PIN_DESC(CAPRI_PIN_MTX_SCAN_CLK, "mtx_scan_clk", std), | ||
499 | CAPRI_PIN_DESC(CAPRI_PIN_MTX_SCAN_DATA, "mtx_scan_data", std), | ||
500 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_0, "nand_ad_0", std), | ||
501 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_1, "nand_ad_1", std), | ||
502 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_2, "nand_ad_2", std), | ||
503 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_3, "nand_ad_3", std), | ||
504 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_4, "nand_ad_4", std), | ||
505 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_5, "nand_ad_5", std), | ||
506 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_6, "nand_ad_6", std), | ||
507 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_AD_7, "nand_ad_7", std), | ||
508 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_ALE, "nand_ale", std), | ||
509 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_CEN_0, "nand_cen_0", std), | ||
510 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_CEN_1, "nand_cen_1", std), | ||
511 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_CLE, "nand_cle", std), | ||
512 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_OEN, "nand_oen", std), | ||
513 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_RDY_0, "nand_rdy_0", std), | ||
514 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_RDY_1, "nand_rdy_1", std), | ||
515 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_WEN, "nand_wen", std), | ||
516 | CAPRI_PIN_DESC(CAPRI_PIN_NAND_WP, "nand_wp", std), | ||
517 | CAPRI_PIN_DESC(CAPRI_PIN_PC1, "pc1", std), | ||
518 | CAPRI_PIN_DESC(CAPRI_PIN_PC2, "pc2", std), | ||
519 | CAPRI_PIN_DESC(CAPRI_PIN_PMU_INT, "pmu_int", std), | ||
520 | CAPRI_PIN_DESC(CAPRI_PIN_PMU_SCL, "pmu_scl", i2c), | ||
521 | CAPRI_PIN_DESC(CAPRI_PIN_PMU_SDA, "pmu_sda", i2c), | ||
522 | CAPRI_PIN_DESC(CAPRI_PIN_RFST2G_MTSLOTEN3G, "rfst2g_mtsloten3g", std), | ||
523 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RX_CTL, "rgmii_0_rx_ctl", std), | ||
524 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RXC, "rgmii_0_rxc", std), | ||
525 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RXD_0, "rgmii_0_rxd_0", std), | ||
526 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RXD_1, "rgmii_0_rxd_1", std), | ||
527 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RXD_2, "rgmii_0_rxd_2", std), | ||
528 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_RXD_3, "rgmii_0_rxd_3", std), | ||
529 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TX_CTL, "rgmii_0_tx_ctl", std), | ||
530 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TXC, "rgmii_0_txc", std), | ||
531 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TXD_0, "rgmii_0_txd_0", std), | ||
532 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TXD_1, "rgmii_0_txd_1", std), | ||
533 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TXD_2, "rgmii_0_txd_2", std), | ||
534 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_0_TXD_3, "rgmii_0_txd_3", std), | ||
535 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RX_CTL, "rgmii_1_rx_ctl", std), | ||
536 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RXC, "rgmii_1_rxc", std), | ||
537 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RXD_0, "rgmii_1_rxd_0", std), | ||
538 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RXD_1, "rgmii_1_rxd_1", std), | ||
539 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RXD_2, "rgmii_1_rxd_2", std), | ||
540 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_RXD_3, "rgmii_1_rxd_3", std), | ||
541 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TX_CTL, "rgmii_1_tx_ctl", std), | ||
542 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TXC, "rgmii_1_txc", std), | ||
543 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TXD_0, "rgmii_1_txd_0", std), | ||
544 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TXD_1, "rgmii_1_txd_1", std), | ||
545 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TXD_2, "rgmii_1_txd_2", std), | ||
546 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_1_TXD_3, "rgmii_1_txd_3", std), | ||
547 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_GPIO_0, "rgmii_gpio_0", std), | ||
548 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_GPIO_1, "rgmii_gpio_1", std), | ||
549 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_GPIO_2, "rgmii_gpio_2", std), | ||
550 | CAPRI_PIN_DESC(CAPRI_PIN_RGMII_GPIO_3, "rgmii_gpio_3", std), | ||
551 | CAPRI_PIN_DESC(CAPRI_PIN_RTXDATA2G_TXDATA3G1, "rtxdata2g_txdata3g1", | ||
552 | std), | ||
553 | CAPRI_PIN_DESC(CAPRI_PIN_RTXEN2G_TXDATA3G2, "rtxen2g_txdata3g2", std), | ||
554 | CAPRI_PIN_DESC(CAPRI_PIN_RXDATA3G0, "rxdata3g0", std), | ||
555 | CAPRI_PIN_DESC(CAPRI_PIN_RXDATA3G1, "rxdata3g1", std), | ||
556 | CAPRI_PIN_DESC(CAPRI_PIN_RXDATA3G2, "rxdata3g2", std), | ||
557 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_CLK, "sdio1_clk", std), | ||
558 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_CMD, "sdio1_cmd", std), | ||
559 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_DATA_0, "sdio1_data_0", std), | ||
560 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_DATA_1, "sdio1_data_1", std), | ||
561 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_DATA_2, "sdio1_data_2", std), | ||
562 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO1_DATA_3, "sdio1_data_3", std), | ||
563 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_CLK, "sdio4_clk", std), | ||
564 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_CMD, "sdio4_cmd", std), | ||
565 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_DATA_0, "sdio4_data_0", std), | ||
566 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_DATA_1, "sdio4_data_1", std), | ||
567 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_DATA_2, "sdio4_data_2", std), | ||
568 | CAPRI_PIN_DESC(CAPRI_PIN_SDIO4_DATA_3, "sdio4_data_3", std), | ||
569 | CAPRI_PIN_DESC(CAPRI_PIN_SIM_CLK, "sim_clk", std), | ||
570 | CAPRI_PIN_DESC(CAPRI_PIN_SIM_DATA, "sim_data", std), | ||
571 | CAPRI_PIN_DESC(CAPRI_PIN_SIM_DET, "sim_det", std), | ||
572 | CAPRI_PIN_DESC(CAPRI_PIN_SIM_RESETN, "sim_resetn", std), | ||
573 | CAPRI_PIN_DESC(CAPRI_PIN_SIM2_CLK, "sim2_clk", std), | ||
574 | CAPRI_PIN_DESC(CAPRI_PIN_SIM2_DATA, "sim2_data", std), | ||
575 | CAPRI_PIN_DESC(CAPRI_PIN_SIM2_DET, "sim2_det", std), | ||
576 | CAPRI_PIN_DESC(CAPRI_PIN_SIM2_RESETN, "sim2_resetn", std), | ||
577 | CAPRI_PIN_DESC(CAPRI_PIN_SRI_C, "sri_c", std), | ||
578 | CAPRI_PIN_DESC(CAPRI_PIN_SRI_D, "sri_d", std), | ||
579 | CAPRI_PIN_DESC(CAPRI_PIN_SRI_E, "sri_e", std), | ||
580 | CAPRI_PIN_DESC(CAPRI_PIN_SSP_EXTCLK, "ssp_extclk", std), | ||
581 | CAPRI_PIN_DESC(CAPRI_PIN_SSP0_CLK, "ssp0_clk", std), | ||
582 | CAPRI_PIN_DESC(CAPRI_PIN_SSP0_FS, "ssp0_fs", std), | ||
583 | CAPRI_PIN_DESC(CAPRI_PIN_SSP0_RXD, "ssp0_rxd", std), | ||
584 | CAPRI_PIN_DESC(CAPRI_PIN_SSP0_TXD, "ssp0_txd", std), | ||
585 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_CLK, "ssp2_clk", std), | ||
586 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_FS_0, "ssp2_fs_0", std), | ||
587 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_FS_1, "ssp2_fs_1", std), | ||
588 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_FS_2, "ssp2_fs_2", std), | ||
589 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_FS_3, "ssp2_fs_3", std), | ||
590 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_RXD_0, "ssp2_rxd_0", std), | ||
591 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_RXD_1, "ssp2_rxd_1", std), | ||
592 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_TXD_0, "ssp2_txd_0", std), | ||
593 | CAPRI_PIN_DESC(CAPRI_PIN_SSP2_TXD_1, "ssp2_txd_1", std), | ||
594 | CAPRI_PIN_DESC(CAPRI_PIN_SSP3_CLK, "ssp3_clk", std), | ||
595 | CAPRI_PIN_DESC(CAPRI_PIN_SSP3_FS, "ssp3_fs", std), | ||
596 | CAPRI_PIN_DESC(CAPRI_PIN_SSP3_RXD, "ssp3_rxd", std), | ||
597 | CAPRI_PIN_DESC(CAPRI_PIN_SSP3_TXD, "ssp3_txd", std), | ||
598 | CAPRI_PIN_DESC(CAPRI_PIN_SSP4_CLK, "ssp4_clk", std), | ||
599 | CAPRI_PIN_DESC(CAPRI_PIN_SSP4_FS, "ssp4_fs", std), | ||
600 | CAPRI_PIN_DESC(CAPRI_PIN_SSP4_RXD, "ssp4_rxd", std), | ||
601 | CAPRI_PIN_DESC(CAPRI_PIN_SSP4_TXD, "ssp4_txd", std), | ||
602 | CAPRI_PIN_DESC(CAPRI_PIN_SSP5_CLK, "ssp5_clk", std), | ||
603 | CAPRI_PIN_DESC(CAPRI_PIN_SSP5_FS, "ssp5_fs", std), | ||
604 | CAPRI_PIN_DESC(CAPRI_PIN_SSP5_RXD, "ssp5_rxd", std), | ||
605 | CAPRI_PIN_DESC(CAPRI_PIN_SSP5_TXD, "ssp5_txd", std), | ||
606 | CAPRI_PIN_DESC(CAPRI_PIN_SSP6_CLK, "ssp6_clk", std), | ||
607 | CAPRI_PIN_DESC(CAPRI_PIN_SSP6_FS, "ssp6_fs", std), | ||
608 | CAPRI_PIN_DESC(CAPRI_PIN_SSP6_RXD, "ssp6_rxd", std), | ||
609 | CAPRI_PIN_DESC(CAPRI_PIN_SSP6_TXD, "ssp6_txd", std), | ||
610 | CAPRI_PIN_DESC(CAPRI_PIN_STAT_1, "stat_1", std), | ||
611 | CAPRI_PIN_DESC(CAPRI_PIN_STAT_2, "stat_2", std), | ||
612 | CAPRI_PIN_DESC(CAPRI_PIN_SYSCLKEN, "sysclken", std), | ||
613 | CAPRI_PIN_DESC(CAPRI_PIN_TRACECLK, "traceclk", std), | ||
614 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT00, "tracedt00", std), | ||
615 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT01, "tracedt01", std), | ||
616 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT02, "tracedt02", std), | ||
617 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT03, "tracedt03", std), | ||
618 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT04, "tracedt04", std), | ||
619 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT05, "tracedt05", std), | ||
620 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT06, "tracedt06", std), | ||
621 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT07, "tracedt07", std), | ||
622 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT08, "tracedt08", std), | ||
623 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT09, "tracedt09", std), | ||
624 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT10, "tracedt10", std), | ||
625 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT11, "tracedt11", std), | ||
626 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT12, "tracedt12", std), | ||
627 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT13, "tracedt13", std), | ||
628 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT14, "tracedt14", std), | ||
629 | CAPRI_PIN_DESC(CAPRI_PIN_TRACEDT15, "tracedt15", std), | ||
630 | CAPRI_PIN_DESC(CAPRI_PIN_TXDATA3G0, "txdata3g0", std), | ||
631 | CAPRI_PIN_DESC(CAPRI_PIN_TXPWRIND, "txpwrind", std), | ||
632 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB1_UCTS, "uartb1_ucts", std), | ||
633 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB1_URTS, "uartb1_urts", std), | ||
634 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB1_URXD, "uartb1_urxd", std), | ||
635 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB1_UTXD, "uartb1_utxd", std), | ||
636 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB2_URXD, "uartb2_urxd", std), | ||
637 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB2_UTXD, "uartb2_utxd", std), | ||
638 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB3_UCTS, "uartb3_ucts", std), | ||
639 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB3_URTS, "uartb3_urts", std), | ||
640 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB3_URXD, "uartb3_urxd", std), | ||
641 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB3_UTXD, "uartb3_utxd", std), | ||
642 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB4_UCTS, "uartb4_ucts", std), | ||
643 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB4_URTS, "uartb4_urts", std), | ||
644 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB4_URXD, "uartb4_urxd", std), | ||
645 | CAPRI_PIN_DESC(CAPRI_PIN_UARTB4_UTXD, "uartb4_utxd", std), | ||
646 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM1_SCL, "vc_cam1_scl", i2c), | ||
647 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM1_SDA, "vc_cam1_sda", i2c), | ||
648 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM2_SCL, "vc_cam2_scl", i2c), | ||
649 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM2_SDA, "vc_cam2_sda", i2c), | ||
650 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM3_SCL, "vc_cam3_scl", i2c), | ||
651 | CAPRI_PIN_DESC(CAPRI_PIN_VC_CAM3_SDA, "vc_cam3_sda", i2c), | ||
652 | }; | ||
653 | |||
654 | static const char * const capri_alt_groups[] = { | ||
655 | "adcsync", | ||
656 | "bat_rm", | ||
657 | "bsc1_scl", | ||
658 | "bsc1_sda", | ||
659 | "bsc2_scl", | ||
660 | "bsc2_sda", | ||
661 | "classgpwr", | ||
662 | "clk_cx8", | ||
663 | "clkout_0", | ||
664 | "clkout_1", | ||
665 | "clkout_2", | ||
666 | "clkout_3", | ||
667 | "clkreq_in_0", | ||
668 | "clkreq_in_1", | ||
669 | "cws_sys_req1", | ||
670 | "cws_sys_req2", | ||
671 | "cws_sys_req3", | ||
672 | "digmic1_clk", | ||
673 | "digmic1_dq", | ||
674 | "digmic2_clk", | ||
675 | "digmic2_dq", | ||
676 | "gpen13", | ||
677 | "gpen14", | ||
678 | "gpen15", | ||
679 | "gpio00", | ||
680 | "gpio01", | ||
681 | "gpio02", | ||
682 | "gpio03", | ||
683 | "gpio04", | ||
684 | "gpio05", | ||
685 | "gpio06", | ||
686 | "gpio07", | ||
687 | "gpio08", | ||
688 | "gpio09", | ||
689 | "gpio10", | ||
690 | "gpio11", | ||
691 | "gpio12", | ||
692 | "gpio13", | ||
693 | "gpio14", | ||
694 | "gps_pablank", | ||
695 | "gps_tmark", | ||
696 | "hdmi_scl", | ||
697 | "hdmi_sda", | ||
698 | "ic_dm", | ||
699 | "ic_dp", | ||
700 | "kp_col_ip_0", | ||
701 | "kp_col_ip_1", | ||
702 | "kp_col_ip_2", | ||
703 | "kp_col_ip_3", | ||
704 | "kp_row_op_0", | ||
705 | "kp_row_op_1", | ||
706 | "kp_row_op_2", | ||
707 | "kp_row_op_3", | ||
708 | "lcd_b_0", | ||
709 | "lcd_b_1", | ||
710 | "lcd_b_2", | ||
711 | "lcd_b_3", | ||
712 | "lcd_b_4", | ||
713 | "lcd_b_5", | ||
714 | "lcd_b_6", | ||
715 | "lcd_b_7", | ||
716 | "lcd_g_0", | ||
717 | "lcd_g_1", | ||
718 | "lcd_g_2", | ||
719 | "lcd_g_3", | ||
720 | "lcd_g_4", | ||
721 | "lcd_g_5", | ||
722 | "lcd_g_6", | ||
723 | "lcd_g_7", | ||
724 | "lcd_hsync", | ||
725 | "lcd_oe", | ||
726 | "lcd_pclk", | ||
727 | "lcd_r_0", | ||
728 | "lcd_r_1", | ||
729 | "lcd_r_2", | ||
730 | "lcd_r_3", | ||
731 | "lcd_r_4", | ||
732 | "lcd_r_5", | ||
733 | "lcd_r_6", | ||
734 | "lcd_r_7", | ||
735 | "lcd_vsync", | ||
736 | "mdmgpio0", | ||
737 | "mdmgpio1", | ||
738 | "mdmgpio2", | ||
739 | "mdmgpio3", | ||
740 | "mdmgpio4", | ||
741 | "mdmgpio5", | ||
742 | "mdmgpio6", | ||
743 | "mdmgpio7", | ||
744 | "mdmgpio8", | ||
745 | "mphi_data_0", | ||
746 | "mphi_data_1", | ||
747 | "mphi_data_2", | ||
748 | "mphi_data_3", | ||
749 | "mphi_data_4", | ||
750 | "mphi_data_5", | ||
751 | "mphi_data_6", | ||
752 | "mphi_data_7", | ||
753 | "mphi_data_8", | ||
754 | "mphi_data_9", | ||
755 | "mphi_data_10", | ||
756 | "mphi_data_11", | ||
757 | "mphi_data_12", | ||
758 | "mphi_data_13", | ||
759 | "mphi_data_14", | ||
760 | "mphi_data_15", | ||
761 | "mphi_ha0", | ||
762 | "mphi_hat0", | ||
763 | "mphi_hat1", | ||
764 | "mphi_hce0_n", | ||
765 | "mphi_hce1_n", | ||
766 | "mphi_hrd_n", | ||
767 | "mphi_hwr_n", | ||
768 | "mphi_run0", | ||
769 | "mphi_run1", | ||
770 | "mtx_scan_clk", | ||
771 | "mtx_scan_data", | ||
772 | "nand_ad_0", | ||
773 | "nand_ad_1", | ||
774 | "nand_ad_2", | ||
775 | "nand_ad_3", | ||
776 | "nand_ad_4", | ||
777 | "nand_ad_5", | ||
778 | "nand_ad_6", | ||
779 | "nand_ad_7", | ||
780 | "nand_ale", | ||
781 | "nand_cen_0", | ||
782 | "nand_cen_1", | ||
783 | "nand_cle", | ||
784 | "nand_oen", | ||
785 | "nand_rdy_0", | ||
786 | "nand_rdy_1", | ||
787 | "nand_wen", | ||
788 | "nand_wp", | ||
789 | "pc1", | ||
790 | "pc2", | ||
791 | "pmu_int", | ||
792 | "pmu_scl", | ||
793 | "pmu_sda", | ||
794 | "rfst2g_mtsloten3g", | ||
795 | "rgmii_0_rx_ctl", | ||
796 | "rgmii_0_rxc", | ||
797 | "rgmii_0_rxd_0", | ||
798 | "rgmii_0_rxd_1", | ||
799 | "rgmii_0_rxd_2", | ||
800 | "rgmii_0_rxd_3", | ||
801 | "rgmii_0_tx_ctl", | ||
802 | "rgmii_0_txc", | ||
803 | "rgmii_0_txd_0", | ||
804 | "rgmii_0_txd_1", | ||
805 | "rgmii_0_txd_2", | ||
806 | "rgmii_0_txd_3", | ||
807 | "rgmii_1_rx_ctl", | ||
808 | "rgmii_1_rxc", | ||
809 | "rgmii_1_rxd_0", | ||
810 | "rgmii_1_rxd_1", | ||
811 | "rgmii_1_rxd_2", | ||
812 | "rgmii_1_rxd_3", | ||
813 | "rgmii_1_tx_ctl", | ||
814 | "rgmii_1_txc", | ||
815 | "rgmii_1_txd_0", | ||
816 | "rgmii_1_txd_1", | ||
817 | "rgmii_1_txd_2", | ||
818 | "rgmii_1_txd_3", | ||
819 | "rgmii_gpio_0", | ||
820 | "rgmii_gpio_1", | ||
821 | "rgmii_gpio_2", | ||
822 | "rgmii_gpio_3", | ||
823 | "rtxdata2g_txdata3g1", | ||
824 | "rtxen2g_txdata3g2", | ||
825 | "rxdata3g0", | ||
826 | "rxdata3g1", | ||
827 | "rxdata3g2", | ||
828 | "sdio1_clk", | ||
829 | "sdio1_cmd", | ||
830 | "sdio1_data_0", | ||
831 | "sdio1_data_1", | ||
832 | "sdio1_data_2", | ||
833 | "sdio1_data_3", | ||
834 | "sdio4_clk", | ||
835 | "sdio4_cmd", | ||
836 | "sdio4_data_0", | ||
837 | "sdio4_data_1", | ||
838 | "sdio4_data_2", | ||
839 | "sdio4_data_3", | ||
840 | "sim_clk", | ||
841 | "sim_data", | ||
842 | "sim_det", | ||
843 | "sim_resetn", | ||
844 | "sim2_clk", | ||
845 | "sim2_data", | ||
846 | "sim2_det", | ||
847 | "sim2_resetn", | ||
848 | "sri_c", | ||
849 | "sri_d", | ||
850 | "sri_e", | ||
851 | "ssp_extclk", | ||
852 | "ssp0_clk", | ||
853 | "ssp0_fs", | ||
854 | "ssp0_rxd", | ||
855 | "ssp0_txd", | ||
856 | "ssp2_clk", | ||
857 | "ssp2_fs_0", | ||
858 | "ssp2_fs_1", | ||
859 | "ssp2_fs_2", | ||
860 | "ssp2_fs_3", | ||
861 | "ssp2_rxd_0", | ||
862 | "ssp2_rxd_1", | ||
863 | "ssp2_txd_0", | ||
864 | "ssp2_txd_1", | ||
865 | "ssp3_clk", | ||
866 | "ssp3_fs", | ||
867 | "ssp3_rxd", | ||
868 | "ssp3_txd", | ||
869 | "ssp4_clk", | ||
870 | "ssp4_fs", | ||
871 | "ssp4_rxd", | ||
872 | "ssp4_txd", | ||
873 | "ssp5_clk", | ||
874 | "ssp5_fs", | ||
875 | "ssp5_rxd", | ||
876 | "ssp5_txd", | ||
877 | "ssp6_clk", | ||
878 | "ssp6_fs", | ||
879 | "ssp6_rxd", | ||
880 | "ssp6_txd", | ||
881 | "stat_1", | ||
882 | "stat_2", | ||
883 | "sysclken", | ||
884 | "traceclk", | ||
885 | "tracedt00", | ||
886 | "tracedt01", | ||
887 | "tracedt02", | ||
888 | "tracedt03", | ||
889 | "tracedt04", | ||
890 | "tracedt05", | ||
891 | "tracedt06", | ||
892 | "tracedt07", | ||
893 | "tracedt08", | ||
894 | "tracedt09", | ||
895 | "tracedt10", | ||
896 | "tracedt11", | ||
897 | "tracedt12", | ||
898 | "tracedt13", | ||
899 | "tracedt14", | ||
900 | "tracedt15", | ||
901 | "txdata3g0", | ||
902 | "txpwrind", | ||
903 | "uartb1_ucts", | ||
904 | "uartb1_urts", | ||
905 | "uartb1_urxd", | ||
906 | "uartb1_utxd", | ||
907 | "uartb2_urxd", | ||
908 | "uartb2_utxd", | ||
909 | "uartb3_ucts", | ||
910 | "uartb3_urts", | ||
911 | "uartb3_urxd", | ||
912 | "uartb3_utxd", | ||
913 | "uartb4_ucts", | ||
914 | "uartb4_urts", | ||
915 | "uartb4_urxd", | ||
916 | "uartb4_utxd", | ||
917 | "vc_cam1_scl", | ||
918 | "vc_cam1_sda", | ||
919 | "vc_cam2_scl", | ||
920 | "vc_cam2_sda", | ||
921 | "vc_cam3_scl", | ||
922 | "vc_cam3_sda", | ||
923 | }; | ||
924 | |||
925 | /* Every pin can implement all ALT1-ALT4 functions */ | ||
926 | #define CAPRI_PIN_FUNCTION(fcn_name) \ | ||
927 | { \ | ||
928 | .name = #fcn_name, \ | ||
929 | .groups = capri_alt_groups, \ | ||
930 | .ngroups = ARRAY_SIZE(capri_alt_groups), \ | ||
931 | } | ||
932 | |||
933 | static const struct capri_pin_function capri_functions[] = { | ||
934 | CAPRI_PIN_FUNCTION(alt1), | ||
935 | CAPRI_PIN_FUNCTION(alt2), | ||
936 | CAPRI_PIN_FUNCTION(alt3), | ||
937 | CAPRI_PIN_FUNCTION(alt4), | ||
938 | }; | ||
939 | |||
940 | static struct capri_pinctrl_data capri_pinctrl = { | ||
941 | .pins = capri_pinctrl_pins, | ||
942 | .npins = ARRAY_SIZE(capri_pinctrl_pins), | ||
943 | .functions = capri_functions, | ||
944 | .nfunctions = ARRAY_SIZE(capri_functions), | ||
945 | }; | ||
946 | |||
947 | static inline enum capri_pin_type pin_type_get(struct pinctrl_dev *pctldev, | ||
948 | unsigned pin) | ||
949 | { | ||
950 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
951 | |||
952 | if (pin >= pdata->npins) | ||
953 | return CAPRI_PIN_TYPE_UNKNOWN; | ||
954 | |||
955 | return *(enum capri_pin_type *)(pdata->pins[pin].drv_data); | ||
956 | } | ||
957 | |||
958 | #define CAPRI_PIN_SHIFT(type, param) \ | ||
959 | (CAPRI_ ## type ## _PIN_REG_ ## param ## _SHIFT) | ||
960 | |||
961 | #define CAPRI_PIN_MASK(type, param) \ | ||
962 | (CAPRI_ ## type ## _PIN_REG_ ## param ## _MASK) | ||
963 | |||
964 | /* | ||
965 | * This helper function is used to build up the value and mask used to write to | ||
966 | * a pin register, but does not actually write to the register. | ||
967 | */ | ||
968 | static inline void capri_pin_update(u32 *reg_val, u32 *reg_mask, u32 param_val, | ||
969 | u32 param_shift, u32 param_mask) | ||
970 | { | ||
971 | *reg_val &= ~param_mask; | ||
972 | *reg_val |= (param_val << param_shift) & param_mask; | ||
973 | *reg_mask |= param_mask; | ||
974 | } | ||
975 | |||
976 | static struct regmap_config capri_pinctrl_regmap_config = { | ||
977 | .reg_bits = 32, | ||
978 | .reg_stride = 4, | ||
979 | .val_bits = 32, | ||
980 | .max_register = CAPRI_PIN_VC_CAM3_SDA, | ||
981 | }; | ||
982 | |||
983 | static int capri_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) | ||
984 | { | ||
985 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
986 | |||
987 | return pdata->npins; | ||
988 | } | ||
989 | |||
990 | static const char *capri_pinctrl_get_group_name(struct pinctrl_dev *pctldev, | ||
991 | unsigned group) | ||
992 | { | ||
993 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
994 | |||
995 | return pdata->pins[group].name; | ||
996 | } | ||
997 | |||
998 | static int capri_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, | ||
999 | unsigned group, | ||
1000 | const unsigned **pins, | ||
1001 | unsigned *num_pins) | ||
1002 | { | ||
1003 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1004 | |||
1005 | *pins = &pdata->pins[group].number; | ||
1006 | *num_pins = 1; | ||
1007 | |||
1008 | return 0; | ||
1009 | } | ||
1010 | |||
1011 | static void capri_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, | ||
1012 | struct seq_file *s, | ||
1013 | unsigned offset) | ||
1014 | { | ||
1015 | seq_printf(s, " %s", dev_name(pctldev->dev)); | ||
1016 | } | ||
1017 | |||
1018 | static struct pinctrl_ops capri_pinctrl_ops = { | ||
1019 | .get_groups_count = capri_pinctrl_get_groups_count, | ||
1020 | .get_group_name = capri_pinctrl_get_group_name, | ||
1021 | .get_group_pins = capri_pinctrl_get_group_pins, | ||
1022 | .pin_dbg_show = capri_pinctrl_pin_dbg_show, | ||
1023 | .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, | ||
1024 | .dt_free_map = pinctrl_utils_dt_free_map, | ||
1025 | }; | ||
1026 | |||
1027 | static int capri_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev) | ||
1028 | { | ||
1029 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1030 | |||
1031 | return pdata->nfunctions; | ||
1032 | } | ||
1033 | |||
1034 | static const char *capri_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev, | ||
1035 | unsigned function) | ||
1036 | { | ||
1037 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1038 | |||
1039 | return pdata->functions[function].name; | ||
1040 | } | ||
1041 | |||
1042 | static int capri_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev, | ||
1043 | unsigned function, | ||
1044 | const char * const **groups, | ||
1045 | unsigned * const num_groups) | ||
1046 | { | ||
1047 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1048 | |||
1049 | *groups = pdata->functions[function].groups; | ||
1050 | *num_groups = pdata->functions[function].ngroups; | ||
1051 | |||
1052 | return 0; | ||
1053 | } | ||
1054 | |||
1055 | static int capri_pinmux_enable(struct pinctrl_dev *pctldev, | ||
1056 | unsigned function, | ||
1057 | unsigned group) | ||
1058 | { | ||
1059 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1060 | const struct capri_pin_function *f = &pdata->functions[function]; | ||
1061 | u32 offset = 4 * pdata->pins[group].number; | ||
1062 | int rc = 0; | ||
1063 | |||
1064 | dev_dbg(pctldev->dev, | ||
1065 | "%s(): Enable function %s (%d) of pin %s (%d) @offset 0x%x.\n", | ||
1066 | __func__, f->name, function, pdata->pins[group].name, | ||
1067 | pdata->pins[group].number, offset); | ||
1068 | |||
1069 | rc = regmap_update_bits(pdata->regmap, offset, CAPRI_PIN_REG_F_SEL_MASK, | ||
1070 | function << CAPRI_PIN_REG_F_SEL_SHIFT); | ||
1071 | if (rc) | ||
1072 | dev_err(pctldev->dev, | ||
1073 | "Error updating register for pin %s (%d).\n", | ||
1074 | pdata->pins[group].name, pdata->pins[group].number); | ||
1075 | |||
1076 | return rc; | ||
1077 | } | ||
1078 | |||
1079 | static struct pinmux_ops capri_pinctrl_pinmux_ops = { | ||
1080 | .get_functions_count = capri_pinctrl_get_fcns_count, | ||
1081 | .get_function_name = capri_pinctrl_get_fcn_name, | ||
1082 | .get_function_groups = capri_pinctrl_get_fcn_groups, | ||
1083 | .enable = capri_pinmux_enable, | ||
1084 | }; | ||
1085 | |||
1086 | static int capri_pinctrl_pin_config_get(struct pinctrl_dev *pctldev, | ||
1087 | unsigned pin, | ||
1088 | unsigned long *config) | ||
1089 | { | ||
1090 | return -ENOTSUPP; | ||
1091 | } | ||
1092 | |||
1093 | |||
1094 | /* Goes through the configs and update register val/mask */ | ||
1095 | static int capri_std_pin_update(struct pinctrl_dev *pctldev, | ||
1096 | unsigned pin, | ||
1097 | unsigned long *configs, | ||
1098 | unsigned num_configs, | ||
1099 | u32 *val, | ||
1100 | u32 *mask) | ||
1101 | { | ||
1102 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1103 | int i; | ||
1104 | enum pin_config_param param; | ||
1105 | u16 arg; | ||
1106 | |||
1107 | for (i = 0; i < num_configs; i++) { | ||
1108 | param = pinconf_to_config_param(configs[i]); | ||
1109 | arg = pinconf_to_config_argument(configs[i]); | ||
1110 | |||
1111 | switch (param) { | ||
1112 | case PIN_CONFIG_INPUT_SCHMITT_ENABLE: | ||
1113 | arg = (arg >= 1 ? 1 : 0); | ||
1114 | capri_pin_update(val, mask, arg, | ||
1115 | CAPRI_PIN_SHIFT(STD, HYST), | ||
1116 | CAPRI_PIN_MASK(STD, HYST)); | ||
1117 | break; | ||
1118 | /* | ||
1119 | * The pin bias can only be one of pull-up, pull-down, or | ||
1120 | * disable. The user does not need to specify a value for the | ||
1121 | * property, and the default value from pinconf-generic is | ||
1122 | * ignored. | ||
1123 | */ | ||
1124 | case PIN_CONFIG_BIAS_DISABLE: | ||
1125 | capri_pin_update(val, mask, 0, | ||
1126 | CAPRI_PIN_SHIFT(STD, PULL_UP), | ||
1127 | CAPRI_PIN_MASK(STD, PULL_UP)); | ||
1128 | capri_pin_update(val, mask, 0, | ||
1129 | CAPRI_PIN_SHIFT(STD, PULL_DN), | ||
1130 | CAPRI_PIN_MASK(STD, PULL_DN)); | ||
1131 | break; | ||
1132 | |||
1133 | case PIN_CONFIG_BIAS_PULL_UP: | ||
1134 | capri_pin_update(val, mask, 1, | ||
1135 | CAPRI_PIN_SHIFT(STD, PULL_UP), | ||
1136 | CAPRI_PIN_MASK(STD, PULL_UP)); | ||
1137 | capri_pin_update(val, mask, 0, | ||
1138 | CAPRI_PIN_SHIFT(STD, PULL_DN), | ||
1139 | CAPRI_PIN_MASK(STD, PULL_DN)); | ||
1140 | break; | ||
1141 | |||
1142 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
1143 | capri_pin_update(val, mask, 0, | ||
1144 | CAPRI_PIN_SHIFT(STD, PULL_UP), | ||
1145 | CAPRI_PIN_MASK(STD, PULL_UP)); | ||
1146 | capri_pin_update(val, mask, 1, | ||
1147 | CAPRI_PIN_SHIFT(STD, PULL_DN), | ||
1148 | CAPRI_PIN_MASK(STD, PULL_DN)); | ||
1149 | break; | ||
1150 | |||
1151 | case PIN_CONFIG_SLEW_RATE: | ||
1152 | arg = (arg >= 1 ? 1 : 0); | ||
1153 | capri_pin_update(val, mask, arg, | ||
1154 | CAPRI_PIN_SHIFT(STD, SLEW), | ||
1155 | CAPRI_PIN_MASK(STD, SLEW)); | ||
1156 | break; | ||
1157 | |||
1158 | case PIN_CONFIG_INPUT_ENABLE: | ||
1159 | /* inversed since register is for input _disable_ */ | ||
1160 | arg = (arg >= 1 ? 0 : 1); | ||
1161 | capri_pin_update(val, mask, arg, | ||
1162 | CAPRI_PIN_SHIFT(STD, INPUT_DIS), | ||
1163 | CAPRI_PIN_MASK(STD, INPUT_DIS)); | ||
1164 | break; | ||
1165 | |||
1166 | case PIN_CONFIG_DRIVE_STRENGTH: | ||
1167 | /* Valid range is 2-16 mA, even numbers only */ | ||
1168 | if ((arg < 2) || (arg > 16) || (arg % 2)) { | ||
1169 | dev_err(pctldev->dev, | ||
1170 | "Invalid Drive Strength value (%d) for " | ||
1171 | "pin %s (%d). Valid values are " | ||
1172 | "(2..16) mA, even numbers only.\n", | ||
1173 | arg, pdata->pins[pin].name, pin); | ||
1174 | return -EINVAL; | ||
1175 | } | ||
1176 | capri_pin_update(val, mask, (arg/2)-1, | ||
1177 | CAPRI_PIN_SHIFT(STD, DRV_STR), | ||
1178 | CAPRI_PIN_MASK(STD, DRV_STR)); | ||
1179 | break; | ||
1180 | |||
1181 | default: | ||
1182 | dev_err(pctldev->dev, | ||
1183 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1184 | param, pdata->pins[pin].name, pin); | ||
1185 | return -EINVAL; | ||
1186 | |||
1187 | } /* switch config */ | ||
1188 | } /* for each config */ | ||
1189 | |||
1190 | return 0; | ||
1191 | } | ||
1192 | |||
1193 | /* | ||
1194 | * The pull-up strength for an I2C pin is represented by bits 4-6 in the | ||
1195 | * register with the following mapping: | ||
1196 | * 0b000: No pull-up | ||
1197 | * 0b001: 1200 Ohm | ||
1198 | * 0b010: 1800 Ohm | ||
1199 | * 0b011: 720 Ohm | ||
1200 | * 0b100: 2700 Ohm | ||
1201 | * 0b101: 831 Ohm | ||
1202 | * 0b110: 1080 Ohm | ||
1203 | * 0b111: 568 Ohm | ||
1204 | * This array maps pull-up strength in Ohms to register values (1+index). | ||
1205 | */ | ||
1206 | static const u16 capri_pullup_map[] = {1200, 1800, 720, 2700, 831, 1080, 568}; | ||
1207 | |||
1208 | /* Goes through the configs and update register val/mask */ | ||
1209 | static int capri_i2c_pin_update(struct pinctrl_dev *pctldev, | ||
1210 | unsigned pin, | ||
1211 | unsigned long *configs, | ||
1212 | unsigned num_configs, | ||
1213 | u32 *val, | ||
1214 | u32 *mask) | ||
1215 | { | ||
1216 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1217 | int i, j; | ||
1218 | enum pin_config_param param; | ||
1219 | u16 arg; | ||
1220 | |||
1221 | for (i = 0; i < num_configs; i++) { | ||
1222 | param = pinconf_to_config_param(configs[i]); | ||
1223 | arg = pinconf_to_config_argument(configs[i]); | ||
1224 | |||
1225 | switch (param) { | ||
1226 | case PIN_CONFIG_BIAS_PULL_UP: | ||
1227 | for (j = 0; j < ARRAY_SIZE(capri_pullup_map); j++) | ||
1228 | if (capri_pullup_map[j] == arg) | ||
1229 | break; | ||
1230 | |||
1231 | if (j == ARRAY_SIZE(capri_pullup_map)) { | ||
1232 | dev_err(pctldev->dev, | ||
1233 | "Invalid pull-up value (%d) for pin %s " | ||
1234 | "(%d). Valid values are 568, 720, 831, " | ||
1235 | "1080, 1200, 1800, 2700 Ohms.\n", | ||
1236 | arg, pdata->pins[pin].name, pin); | ||
1237 | return -EINVAL; | ||
1238 | } | ||
1239 | |||
1240 | capri_pin_update(val, mask, j+1, | ||
1241 | CAPRI_PIN_SHIFT(I2C, PULL_UP_STR), | ||
1242 | CAPRI_PIN_MASK(I2C, PULL_UP_STR)); | ||
1243 | break; | ||
1244 | |||
1245 | case PIN_CONFIG_BIAS_DISABLE: | ||
1246 | capri_pin_update(val, mask, 0, | ||
1247 | CAPRI_PIN_SHIFT(I2C, PULL_UP_STR), | ||
1248 | CAPRI_PIN_MASK(I2C, PULL_UP_STR)); | ||
1249 | break; | ||
1250 | |||
1251 | case PIN_CONFIG_SLEW_RATE: | ||
1252 | arg = (arg >= 1 ? 1 : 0); | ||
1253 | capri_pin_update(val, mask, arg, | ||
1254 | CAPRI_PIN_SHIFT(I2C, SLEW), | ||
1255 | CAPRI_PIN_MASK(I2C, SLEW)); | ||
1256 | break; | ||
1257 | |||
1258 | case PIN_CONFIG_INPUT_ENABLE: | ||
1259 | /* inversed since register is for input _disable_ */ | ||
1260 | arg = (arg >= 1 ? 0 : 1); | ||
1261 | capri_pin_update(val, mask, arg, | ||
1262 | CAPRI_PIN_SHIFT(I2C, INPUT_DIS), | ||
1263 | CAPRI_PIN_MASK(I2C, INPUT_DIS)); | ||
1264 | break; | ||
1265 | |||
1266 | default: | ||
1267 | dev_err(pctldev->dev, | ||
1268 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1269 | param, pdata->pins[pin].name, pin); | ||
1270 | return -EINVAL; | ||
1271 | |||
1272 | } /* switch config */ | ||
1273 | } /* for each config */ | ||
1274 | |||
1275 | return 0; | ||
1276 | } | ||
1277 | |||
1278 | /* Goes through the configs and update register val/mask */ | ||
1279 | static int capri_hdmi_pin_update(struct pinctrl_dev *pctldev, | ||
1280 | unsigned pin, | ||
1281 | unsigned long *configs, | ||
1282 | unsigned num_configs, | ||
1283 | u32 *val, | ||
1284 | u32 *mask) | ||
1285 | { | ||
1286 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1287 | int i; | ||
1288 | enum pin_config_param param; | ||
1289 | u16 arg; | ||
1290 | |||
1291 | for (i = 0; i < num_configs; i++) { | ||
1292 | param = pinconf_to_config_param(configs[i]); | ||
1293 | arg = pinconf_to_config_argument(configs[i]); | ||
1294 | |||
1295 | switch (param) { | ||
1296 | case PIN_CONFIG_SLEW_RATE: | ||
1297 | arg = (arg >= 1 ? 1 : 0); | ||
1298 | capri_pin_update(val, mask, arg, | ||
1299 | CAPRI_PIN_SHIFT(HDMI, MODE), | ||
1300 | CAPRI_PIN_MASK(HDMI, MODE)); | ||
1301 | break; | ||
1302 | |||
1303 | case PIN_CONFIG_INPUT_ENABLE: | ||
1304 | /* inversed since register is for input _disable_ */ | ||
1305 | arg = (arg >= 1 ? 0 : 1); | ||
1306 | capri_pin_update(val, mask, arg, | ||
1307 | CAPRI_PIN_SHIFT(HDMI, INPUT_DIS), | ||
1308 | CAPRI_PIN_MASK(HDMI, INPUT_DIS)); | ||
1309 | break; | ||
1310 | |||
1311 | default: | ||
1312 | dev_err(pctldev->dev, | ||
1313 | "Unrecognized pin config %d for pin %s (%d).\n", | ||
1314 | param, pdata->pins[pin].name, pin); | ||
1315 | return -EINVAL; | ||
1316 | |||
1317 | } /* switch config */ | ||
1318 | } /* for each config */ | ||
1319 | |||
1320 | return 0; | ||
1321 | } | ||
1322 | |||
1323 | static int capri_pinctrl_pin_config_set(struct pinctrl_dev *pctldev, | ||
1324 | unsigned pin, | ||
1325 | unsigned long *configs, | ||
1326 | unsigned num_configs) | ||
1327 | { | ||
1328 | struct capri_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); | ||
1329 | enum capri_pin_type pin_type; | ||
1330 | u32 offset = 4 * pin; | ||
1331 | u32 cfg_val, cfg_mask; | ||
1332 | int rc; | ||
1333 | |||
1334 | cfg_val = 0; | ||
1335 | cfg_mask = 0; | ||
1336 | pin_type = pin_type_get(pctldev, pin); | ||
1337 | |||
1338 | /* Different pins have different configuration options */ | ||
1339 | switch (pin_type) { | ||
1340 | case CAPRI_PIN_TYPE_STD: | ||
1341 | rc = capri_std_pin_update(pctldev, pin, configs, num_configs, | ||
1342 | &cfg_val, &cfg_mask); | ||
1343 | break; | ||
1344 | |||
1345 | case CAPRI_PIN_TYPE_I2C: | ||
1346 | rc = capri_i2c_pin_update(pctldev, pin, configs, num_configs, | ||
1347 | &cfg_val, &cfg_mask); | ||
1348 | break; | ||
1349 | |||
1350 | case CAPRI_PIN_TYPE_HDMI: | ||
1351 | rc = capri_hdmi_pin_update(pctldev, pin, configs, num_configs, | ||
1352 | &cfg_val, &cfg_mask); | ||
1353 | break; | ||
1354 | |||
1355 | default: | ||
1356 | dev_err(pctldev->dev, "Unknown pin type for pin %s (%d).\n", | ||
1357 | pdata->pins[pin].name, pin); | ||
1358 | return -EINVAL; | ||
1359 | |||
1360 | } /* switch pin type */ | ||
1361 | |||
1362 | if (rc) | ||
1363 | return rc; | ||
1364 | |||
1365 | dev_dbg(pctldev->dev, | ||
1366 | "%s(): Set pin %s (%d) with config 0x%x, mask 0x%x\n", | ||
1367 | __func__, pdata->pins[pin].name, pin, cfg_val, cfg_mask); | ||
1368 | |||
1369 | rc = regmap_update_bits(pdata->regmap, offset, cfg_mask, cfg_val); | ||
1370 | if (rc) { | ||
1371 | dev_err(pctldev->dev, | ||
1372 | "Error updating register for pin %s (%d).\n", | ||
1373 | pdata->pins[pin].name, pin); | ||
1374 | return rc; | ||
1375 | } | ||
1376 | |||
1377 | return 0; | ||
1378 | } | ||
1379 | |||
1380 | static struct pinconf_ops capri_pinctrl_pinconf_ops = { | ||
1381 | .pin_config_get = capri_pinctrl_pin_config_get, | ||
1382 | .pin_config_set = capri_pinctrl_pin_config_set, | ||
1383 | }; | ||
1384 | |||
1385 | static struct pinctrl_desc capri_pinctrl_desc = { | ||
1386 | /* name, pins, npins members initialized in probe function */ | ||
1387 | .pctlops = &capri_pinctrl_ops, | ||
1388 | .pmxops = &capri_pinctrl_pinmux_ops, | ||
1389 | .confops = &capri_pinctrl_pinconf_ops, | ||
1390 | .owner = THIS_MODULE, | ||
1391 | }; | ||
1392 | |||
1393 | int __init capri_pinctrl_probe(struct platform_device *pdev) | ||
1394 | { | ||
1395 | struct capri_pinctrl_data *pdata = &capri_pinctrl; | ||
1396 | struct resource *res; | ||
1397 | struct pinctrl_dev *pctl; | ||
1398 | |||
1399 | /* So far We can assume there is only 1 bank of registers */ | ||
1400 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1401 | if (!res) { | ||
1402 | dev_err(&pdev->dev, "Missing MEM resource\n"); | ||
1403 | return -ENODEV; | ||
1404 | } | ||
1405 | |||
1406 | pdata->reg_base = devm_ioremap_resource(&pdev->dev, res); | ||
1407 | if (IS_ERR(pdata->reg_base)) { | ||
1408 | dev_err(&pdev->dev, "Failed to ioremap MEM resource\n"); | ||
1409 | return -ENODEV; | ||
1410 | } | ||
1411 | |||
1412 | /* Initialize the dynamic part of pinctrl_desc */ | ||
1413 | pdata->regmap = devm_regmap_init_mmio(&pdev->dev, pdata->reg_base, | ||
1414 | &capri_pinctrl_regmap_config); | ||
1415 | if (IS_ERR(pdata->regmap)) { | ||
1416 | dev_err(&pdev->dev, "Regmap MMIO init failed.\n"); | ||
1417 | return -ENODEV; | ||
1418 | } | ||
1419 | |||
1420 | capri_pinctrl_desc.name = dev_name(&pdev->dev); | ||
1421 | capri_pinctrl_desc.pins = capri_pinctrl.pins; | ||
1422 | capri_pinctrl_desc.npins = capri_pinctrl.npins; | ||
1423 | |||
1424 | pctl = pinctrl_register(&capri_pinctrl_desc, | ||
1425 | &pdev->dev, | ||
1426 | pdata); | ||
1427 | if (!pctl) { | ||
1428 | dev_err(&pdev->dev, "Failed to register pinctrl\n"); | ||
1429 | return -ENODEV; | ||
1430 | } | ||
1431 | |||
1432 | platform_set_drvdata(pdev, pdata); | ||
1433 | |||
1434 | return 0; | ||
1435 | } | ||
1436 | |||
1437 | static struct of_device_id capri_pinctrl_of_match[] = { | ||
1438 | { .compatible = "brcm,bcm11351-pinctrl", }, | ||
1439 | { }, | ||
1440 | }; | ||
1441 | |||
1442 | static struct platform_driver capri_pinctrl_driver = { | ||
1443 | .driver = { | ||
1444 | .name = "bcm-capri-pinctrl", | ||
1445 | .owner = THIS_MODULE, | ||
1446 | .of_match_table = capri_pinctrl_of_match, | ||
1447 | }, | ||
1448 | }; | ||
1449 | |||
1450 | module_platform_driver_probe(capri_pinctrl_driver, capri_pinctrl_probe); | ||
1451 | |||
1452 | MODULE_AUTHOR("Sherman Yin <syin@broadcom.com>"); | ||
1453 | MODULE_DESCRIPTION("Broadcom Capri pinctrl driver"); | ||
1454 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c index 38d579b47f31..e43fbce56598 100644 --- a/drivers/pinctrl/pinctrl-msm.c +++ b/drivers/pinctrl/pinctrl-msm.c | |||
@@ -665,7 +665,10 @@ static void msm_gpio_irq_ack(struct irq_data *d) | |||
665 | spin_lock_irqsave(&pctrl->lock, flags); | 665 | spin_lock_irqsave(&pctrl->lock, flags); |
666 | 666 | ||
667 | val = readl(pctrl->regs + g->intr_status_reg); | 667 | val = readl(pctrl->regs + g->intr_status_reg); |
668 | val &= ~BIT(g->intr_status_bit); | 668 | if (g->intr_ack_high) |
669 | val |= BIT(g->intr_status_bit); | ||
670 | else | ||
671 | val &= ~BIT(g->intr_status_bit); | ||
669 | writel(val, pctrl->regs + g->intr_status_reg); | 672 | writel(val, pctrl->regs + g->intr_status_reg); |
670 | 673 | ||
671 | if (test_bit(d->hwirq, pctrl->dual_edge_irqs)) | 674 | if (test_bit(d->hwirq, pctrl->dual_edge_irqs)) |
@@ -744,6 +747,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
744 | break; | 747 | break; |
745 | case IRQ_TYPE_EDGE_BOTH: | 748 | case IRQ_TYPE_EDGE_BOTH: |
746 | val |= BIT(g->intr_detection_bit); | 749 | val |= BIT(g->intr_detection_bit); |
750 | val |= BIT(g->intr_polarity_bit); | ||
747 | break; | 751 | break; |
748 | case IRQ_TYPE_LEVEL_LOW: | 752 | case IRQ_TYPE_LEVEL_LOW: |
749 | break; | 753 | break; |
diff --git a/drivers/pinctrl/pinctrl-msm.h b/drivers/pinctrl/pinctrl-msm.h index 8fbe9fb19f36..6e26f1b676d7 100644 --- a/drivers/pinctrl/pinctrl-msm.h +++ b/drivers/pinctrl/pinctrl-msm.h | |||
@@ -84,6 +84,7 @@ struct msm_pingroup { | |||
84 | 84 | ||
85 | unsigned intr_enable_bit:5; | 85 | unsigned intr_enable_bit:5; |
86 | unsigned intr_status_bit:5; | 86 | unsigned intr_status_bit:5; |
87 | unsigned intr_ack_high:1; | ||
87 | 88 | ||
88 | unsigned intr_target_bit:5; | 89 | unsigned intr_target_bit:5; |
89 | unsigned intr_raw_status_bit:5; | 90 | unsigned intr_raw_status_bit:5; |
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 208341fd57d2..8f6f16ef73f3 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -877,7 +877,6 @@ static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
877 | struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); | 877 | struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); |
878 | u32 status; | 878 | u32 status; |
879 | 879 | ||
880 | pr_err("PLONK IRQ %d\n", irq); | ||
881 | clk_enable(nmk_chip->clk); | 880 | clk_enable(nmk_chip->clk); |
882 | status = readl(nmk_chip->addr + NMK_GPIO_IS); | 881 | status = readl(nmk_chip->addr + NMK_GPIO_IS); |
883 | clk_disable(nmk_chip->clk); | 882 | clk_disable(nmk_chip->clk); |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 46dddc159286..96c60d230c13 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -342,7 +342,7 @@ static const struct pinctrl_ops rockchip_pctrl_ops = { | |||
342 | * @pin: pin to change | 342 | * @pin: pin to change |
343 | * @mux: new mux function to set | 343 | * @mux: new mux function to set |
344 | */ | 344 | */ |
345 | static void rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) | 345 | static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) |
346 | { | 346 | { |
347 | struct rockchip_pinctrl *info = bank->drvdata; | 347 | struct rockchip_pinctrl *info = bank->drvdata; |
348 | void __iomem *reg = info->reg_base + info->ctrl->mux_offset; | 348 | void __iomem *reg = info->reg_base + info->ctrl->mux_offset; |
@@ -350,6 +350,20 @@ static void rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) | |||
350 | u8 bit; | 350 | u8 bit; |
351 | u32 data; | 351 | u32 data; |
352 | 352 | ||
353 | /* | ||
354 | * The first 16 pins of rk3188_bank0 are always gpios and do not have | ||
355 | * a mux register at all. | ||
356 | */ | ||
357 | if (bank->bank_type == RK3188_BANK0 && pin < 16) { | ||
358 | if (mux != RK_FUNC_GPIO) { | ||
359 | dev_err(info->dev, | ||
360 | "pin %d only supports a gpio mux\n", pin); | ||
361 | return -ENOTSUPP; | ||
362 | } else { | ||
363 | return 0; | ||
364 | } | ||
365 | } | ||
366 | |||
353 | dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", | 367 | dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", |
354 | bank->bank_num, pin, mux); | 368 | bank->bank_num, pin, mux); |
355 | 369 | ||
@@ -365,6 +379,8 @@ static void rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) | |||
365 | writel(data, reg); | 379 | writel(data, reg); |
366 | 380 | ||
367 | spin_unlock_irqrestore(&bank->slock, flags); | 381 | spin_unlock_irqrestore(&bank->slock, flags); |
382 | |||
383 | return 0; | ||
368 | } | 384 | } |
369 | 385 | ||
370 | #define RK2928_PULL_OFFSET 0x118 | 386 | #define RK2928_PULL_OFFSET 0x118 |
@@ -560,7 +576,7 @@ static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, | |||
560 | const unsigned int *pins = info->groups[group].pins; | 576 | const unsigned int *pins = info->groups[group].pins; |
561 | const struct rockchip_pin_config *data = info->groups[group].data; | 577 | const struct rockchip_pin_config *data = info->groups[group].data; |
562 | struct rockchip_pin_bank *bank; | 578 | struct rockchip_pin_bank *bank; |
563 | int cnt; | 579 | int cnt, ret = 0; |
564 | 580 | ||
565 | dev_dbg(info->dev, "enable function %s group %s\n", | 581 | dev_dbg(info->dev, "enable function %s group %s\n", |
566 | info->functions[selector].name, info->groups[group].name); | 582 | info->functions[selector].name, info->groups[group].name); |
@@ -571,8 +587,18 @@ static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, | |||
571 | */ | 587 | */ |
572 | for (cnt = 0; cnt < info->groups[group].npins; cnt++) { | 588 | for (cnt = 0; cnt < info->groups[group].npins; cnt++) { |
573 | bank = pin_to_bank(info, pins[cnt]); | 589 | bank = pin_to_bank(info, pins[cnt]); |
574 | rockchip_set_mux(bank, pins[cnt] - bank->pin_base, | 590 | ret = rockchip_set_mux(bank, pins[cnt] - bank->pin_base, |
575 | data[cnt].func); | 591 | data[cnt].func); |
592 | if (ret) | ||
593 | break; | ||
594 | } | ||
595 | |||
596 | if (ret) { | ||
597 | /* revert the already done pin settings */ | ||
598 | for (cnt--; cnt >= 0; cnt--) | ||
599 | rockchip_set_mux(bank, pins[cnt] - bank->pin_base, 0); | ||
600 | |||
601 | return ret; | ||
576 | } | 602 | } |
577 | 603 | ||
578 | return 0; | 604 | return 0; |
@@ -607,7 +633,7 @@ static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, | |||
607 | struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); | 633 | struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); |
608 | struct rockchip_pin_bank *bank; | 634 | struct rockchip_pin_bank *bank; |
609 | struct gpio_chip *chip; | 635 | struct gpio_chip *chip; |
610 | int pin; | 636 | int pin, ret; |
611 | u32 data; | 637 | u32 data; |
612 | 638 | ||
613 | chip = range->gc; | 639 | chip = range->gc; |
@@ -617,7 +643,9 @@ static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, | |||
617 | dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", | 643 | dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", |
618 | offset, range->name, pin, input ? "input" : "output"); | 644 | offset, range->name, pin, input ? "input" : "output"); |
619 | 645 | ||
620 | rockchip_set_mux(bank, pin, RK_FUNC_GPIO); | 646 | ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO); |
647 | if (ret < 0) | ||
648 | return ret; | ||
621 | 649 | ||
622 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); | 650 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); |
623 | /* set bit to 1 for output, 0 for input */ | 651 | /* set bit to 1 for output, 0 for input */ |
@@ -1144,9 +1172,13 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
1144 | u32 polarity; | 1172 | u32 polarity; |
1145 | u32 level; | 1173 | u32 level; |
1146 | u32 data; | 1174 | u32 data; |
1175 | int ret; | ||
1147 | 1176 | ||
1148 | /* make sure the pin is configured as gpio input */ | 1177 | /* make sure the pin is configured as gpio input */ |
1149 | rockchip_set_mux(bank, d->hwirq, RK_FUNC_GPIO); | 1178 | ret = rockchip_set_mux(bank, d->hwirq, RK_FUNC_GPIO); |
1179 | if (ret < 0) | ||
1180 | return ret; | ||
1181 | |||
1150 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); | 1182 | data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); |
1151 | data &= ~mask; | 1183 | data &= ~mask; |
1152 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); | 1184 | writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); |
@@ -1534,7 +1566,7 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = { | |||
1534 | .nr_banks = ARRAY_SIZE(rk3188_pin_banks), | 1566 | .nr_banks = ARRAY_SIZE(rk3188_pin_banks), |
1535 | .label = "RK3188-GPIO", | 1567 | .label = "RK3188-GPIO", |
1536 | .type = RK3188, | 1568 | .type = RK3188, |
1537 | .mux_offset = 0x68, | 1569 | .mux_offset = 0x60, |
1538 | .pull_calc_reg = rk3188_calc_pull_reg_and_bit, | 1570 | .pull_calc_reg = rk3188_calc_pull_reg_and_bit, |
1539 | }; | 1571 | }; |
1540 | 1572 | ||
diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c index 8fc9d6df87f6..1685f63b9e5d 100644 --- a/drivers/power/tps65090-charger.c +++ b/drivers/power/tps65090-charger.c | |||
@@ -28,17 +28,6 @@ | |||
28 | 28 | ||
29 | #include <linux/mfd/tps65090.h> | 29 | #include <linux/mfd/tps65090.h> |
30 | 30 | ||
31 | #define TPS65090_REG_INTR_STS 0x00 | ||
32 | #define TPS65090_REG_INTR_MASK 0x02 | ||
33 | #define TPS65090_REG_CG_CTRL0 0x04 | ||
34 | #define TPS65090_REG_CG_CTRL1 0x05 | ||
35 | #define TPS65090_REG_CG_CTRL2 0x06 | ||
36 | #define TPS65090_REG_CG_CTRL3 0x07 | ||
37 | #define TPS65090_REG_CG_CTRL4 0x08 | ||
38 | #define TPS65090_REG_CG_CTRL5 0x09 | ||
39 | #define TPS65090_REG_CG_STATUS1 0x0a | ||
40 | #define TPS65090_REG_CG_STATUS2 0x0b | ||
41 | |||
42 | #define TPS65090_CHARGER_ENABLE BIT(0) | 31 | #define TPS65090_CHARGER_ENABLE BIT(0) |
43 | #define TPS65090_VACG BIT(1) | 32 | #define TPS65090_VACG BIT(1) |
44 | #define TPS65090_NOITERM BIT(5) | 33 | #define TPS65090_NOITERM BIT(5) |
diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c index 8ad26b8bf418..cb2d4f0f9711 100644 --- a/drivers/pwm/pwm-spear.c +++ b/drivers/pwm/pwm-spear.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * ST Microelectronics SPEAr Pulse Width Modulator driver | 2 | * ST Microelectronics SPEAr Pulse Width Modulator driver |
3 | * | 3 | * |
4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
5 | * Shiraz Hashim <shiraz.hashim@st.com> | 5 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
6 | * | 6 | * |
7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
@@ -264,6 +264,6 @@ static struct platform_driver spear_pwm_driver = { | |||
264 | module_platform_driver(spear_pwm_driver); | 264 | module_platform_driver(spear_pwm_driver); |
265 | 265 | ||
266 | MODULE_LICENSE("GPL"); | 266 | MODULE_LICENSE("GPL"); |
267 | MODULE_AUTHOR("Shiraz Hashim <shiraz.hashim@st.com>"); | 267 | MODULE_AUTHOR("Shiraz Hashim <shiraz.linux.kernel@gmail.com>"); |
268 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.com>"); | 268 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.com>"); |
269 | MODULE_ALIAS("platform:spear-pwm"); | 269 | MODULE_ALIAS("platform:spear-pwm"); |
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index 1990285296c6..c316051d9bda 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c | |||
@@ -1252,7 +1252,7 @@ static __init int sclp_initcall(void) | |||
1252 | return rc; | 1252 | return rc; |
1253 | 1253 | ||
1254 | sclp_pdev = platform_device_register_simple("sclp", -1, NULL, 0); | 1254 | sclp_pdev = platform_device_register_simple("sclp", -1, NULL, 0); |
1255 | rc = PTR_RET(sclp_pdev); | 1255 | rc = PTR_ERR_OR_ZERO(sclp_pdev); |
1256 | if (rc) | 1256 | if (rc) |
1257 | goto fail_platform_driver_unregister; | 1257 | goto fail_platform_driver_unregister; |
1258 | 1258 | ||
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 6e8f90f84e49..6e14999f9e8f 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -515,7 +515,7 @@ static int __init sclp_detect_standby_memory(void) | |||
515 | if (rc) | 515 | if (rc) |
516 | goto out; | 516 | goto out; |
517 | sclp_pdev = platform_device_register_simple("sclp_mem", -1, NULL, 0); | 517 | sclp_pdev = platform_device_register_simple("sclp_mem", -1, NULL, 0); |
518 | rc = PTR_RET(sclp_pdev); | 518 | rc = PTR_ERR_OR_ZERO(sclp_pdev); |
519 | if (rc) | 519 | if (rc) |
520 | goto out_driver; | 520 | goto out_driver; |
521 | sclp_add_standby_memory(); | 521 | sclp_add_standby_memory(); |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 4eed38cd0af6..cd9c91909596 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -97,13 +97,16 @@ static void sclp_vt220_pm_event_fn(struct sclp_register *reg, | |||
97 | static int __sclp_vt220_emit(struct sclp_vt220_request *request); | 97 | static int __sclp_vt220_emit(struct sclp_vt220_request *request); |
98 | static void sclp_vt220_emit_current(void); | 98 | static void sclp_vt220_emit_current(void); |
99 | 99 | ||
100 | /* Registration structure for our interest in SCLP event buffers */ | 100 | /* Registration structure for SCLP output event buffers */ |
101 | static struct sclp_register sclp_vt220_register = { | 101 | static struct sclp_register sclp_vt220_register = { |
102 | .send_mask = EVTYP_VT220MSG_MASK, | 102 | .send_mask = EVTYP_VT220MSG_MASK, |
103 | .pm_event_fn = sclp_vt220_pm_event_fn, | ||
104 | }; | ||
105 | |||
106 | /* Registration structure for SCLP input event buffers */ | ||
107 | static struct sclp_register sclp_vt220_register_input = { | ||
103 | .receive_mask = EVTYP_VT220MSG_MASK, | 108 | .receive_mask = EVTYP_VT220MSG_MASK, |
104 | .state_change_fn = NULL, | ||
105 | .receiver_fn = sclp_vt220_receiver_fn, | 109 | .receiver_fn = sclp_vt220_receiver_fn, |
106 | .pm_event_fn = sclp_vt220_pm_event_fn, | ||
107 | }; | 110 | }; |
108 | 111 | ||
109 | 112 | ||
@@ -715,9 +718,14 @@ static int __init sclp_vt220_tty_init(void) | |||
715 | rc = tty_register_driver(driver); | 718 | rc = tty_register_driver(driver); |
716 | if (rc) | 719 | if (rc) |
717 | goto out_init; | 720 | goto out_init; |
721 | rc = sclp_register(&sclp_vt220_register_input); | ||
722 | if (rc) | ||
723 | goto out_reg; | ||
718 | sclp_vt220_driver = driver; | 724 | sclp_vt220_driver = driver; |
719 | return 0; | 725 | return 0; |
720 | 726 | ||
727 | out_reg: | ||
728 | tty_unregister_driver(driver); | ||
721 | out_init: | 729 | out_init: |
722 | __sclp_vt220_cleanup(); | 730 | __sclp_vt220_cleanup(); |
723 | out_driver: | 731 | out_driver: |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index ea5efb426f75..22365f140bec 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -40,8 +40,6 @@ source "drivers/staging/olpc_dcon/Kconfig" | |||
40 | 40 | ||
41 | source "drivers/staging/panel/Kconfig" | 41 | source "drivers/staging/panel/Kconfig" |
42 | 42 | ||
43 | source "drivers/staging/rtl8187se/Kconfig" | ||
44 | |||
45 | source "drivers/staging/rtl8192u/Kconfig" | 43 | source "drivers/staging/rtl8192u/Kconfig" |
46 | 44 | ||
47 | source "drivers/staging/rtl8192e/Kconfig" | 45 | source "drivers/staging/rtl8192e/Kconfig" |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 86e020c2ad0d..fbe84ed2d048 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
@@ -12,7 +12,6 @@ obj-$(CONFIG_PRISM2_USB) += wlan-ng/ | |||
12 | obj-$(CONFIG_COMEDI) += comedi/ | 12 | obj-$(CONFIG_COMEDI) += comedi/ |
13 | obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ | 13 | obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ |
14 | obj-$(CONFIG_PANEL) += panel/ | 14 | obj-$(CONFIG_PANEL) += panel/ |
15 | obj-$(CONFIG_R8187SE) += rtl8187se/ | ||
16 | obj-$(CONFIG_RTL8192U) += rtl8192u/ | 15 | obj-$(CONFIG_RTL8192U) += rtl8192u/ |
17 | obj-$(CONFIG_RTL8192E) += rtl8192e/ | 16 | obj-$(CONFIG_RTL8192E) += rtl8192e/ |
18 | obj-$(CONFIG_R8712U) += rtl8712/ | 17 | obj-$(CONFIG_R8712U) += rtl8712/ |
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 924fce977985..257595016161 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c | |||
@@ -61,6 +61,8 @@ static void __comedi_buf_free(struct comedi_device *dev, | |||
61 | struct comedi_subdevice *s) | 61 | struct comedi_subdevice *s) |
62 | { | 62 | { |
63 | struct comedi_async *async = s->async; | 63 | struct comedi_async *async = s->async; |
64 | struct comedi_buf_map *bm; | ||
65 | unsigned long flags; | ||
64 | 66 | ||
65 | if (async->prealloc_buf) { | 67 | if (async->prealloc_buf) { |
66 | vunmap(async->prealloc_buf); | 68 | vunmap(async->prealloc_buf); |
@@ -68,8 +70,11 @@ static void __comedi_buf_free(struct comedi_device *dev, | |||
68 | async->prealloc_bufsz = 0; | 70 | async->prealloc_bufsz = 0; |
69 | } | 71 | } |
70 | 72 | ||
71 | comedi_buf_map_put(async->buf_map); | 73 | spin_lock_irqsave(&s->spin_lock, flags); |
74 | bm = async->buf_map; | ||
72 | async->buf_map = NULL; | 75 | async->buf_map = NULL; |
76 | spin_unlock_irqrestore(&s->spin_lock, flags); | ||
77 | comedi_buf_map_put(bm); | ||
73 | } | 78 | } |
74 | 79 | ||
75 | static void __comedi_buf_alloc(struct comedi_device *dev, | 80 | static void __comedi_buf_alloc(struct comedi_device *dev, |
@@ -80,6 +85,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
80 | struct page **pages = NULL; | 85 | struct page **pages = NULL; |
81 | struct comedi_buf_map *bm; | 86 | struct comedi_buf_map *bm; |
82 | struct comedi_buf_page *buf; | 87 | struct comedi_buf_page *buf; |
88 | unsigned long flags; | ||
83 | unsigned i; | 89 | unsigned i; |
84 | 90 | ||
85 | if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) { | 91 | if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) { |
@@ -92,8 +98,10 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
92 | if (!bm) | 98 | if (!bm) |
93 | return; | 99 | return; |
94 | 100 | ||
95 | async->buf_map = bm; | ||
96 | kref_init(&bm->refcount); | 101 | kref_init(&bm->refcount); |
102 | spin_lock_irqsave(&s->spin_lock, flags); | ||
103 | async->buf_map = bm; | ||
104 | spin_unlock_irqrestore(&s->spin_lock, flags); | ||
97 | bm->dma_dir = s->async_dma_dir; | 105 | bm->dma_dir = s->async_dma_dir; |
98 | if (bm->dma_dir != DMA_NONE) | 106 | if (bm->dma_dir != DMA_NONE) |
99 | /* Need ref to hardware device to free buffer later. */ | 107 | /* Need ref to hardware device to free buffer later. */ |
@@ -127,7 +135,9 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
127 | 135 | ||
128 | pages[i] = virt_to_page(buf->virt_addr); | 136 | pages[i] = virt_to_page(buf->virt_addr); |
129 | } | 137 | } |
138 | spin_lock_irqsave(&s->spin_lock, flags); | ||
130 | bm->n_pages = i; | 139 | bm->n_pages = i; |
140 | spin_unlock_irqrestore(&s->spin_lock, flags); | ||
131 | 141 | ||
132 | /* vmap the prealloc_buf if all the pages were allocated */ | 142 | /* vmap the prealloc_buf if all the pages were allocated */ |
133 | if (i == n_pages) | 143 | if (i == n_pages) |
@@ -150,6 +160,29 @@ int comedi_buf_map_put(struct comedi_buf_map *bm) | |||
150 | return 1; | 160 | return 1; |
151 | } | 161 | } |
152 | 162 | ||
163 | /* returns s->async->buf_map and increments its kref refcount */ | ||
164 | struct comedi_buf_map * | ||
165 | comedi_buf_map_from_subdev_get(struct comedi_subdevice *s) | ||
166 | { | ||
167 | struct comedi_async *async = s->async; | ||
168 | struct comedi_buf_map *bm = NULL; | ||
169 | unsigned long flags; | ||
170 | |||
171 | if (!async) | ||
172 | return NULL; | ||
173 | |||
174 | spin_lock_irqsave(&s->spin_lock, flags); | ||
175 | bm = async->buf_map; | ||
176 | /* only want it if buffer pages allocated */ | ||
177 | if (bm && bm->n_pages) | ||
178 | comedi_buf_map_get(bm); | ||
179 | else | ||
180 | bm = NULL; | ||
181 | spin_unlock_irqrestore(&s->spin_lock, flags); | ||
182 | |||
183 | return bm; | ||
184 | } | ||
185 | |||
153 | bool comedi_buf_is_mmapped(struct comedi_async *async) | 186 | bool comedi_buf_is_mmapped(struct comedi_async *async) |
154 | { | 187 | { |
155 | struct comedi_buf_map *bm = async->buf_map; | 188 | struct comedi_buf_map *bm = async->buf_map; |
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index ea6dc36d753b..acc80197e35e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -1926,14 +1926,21 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | |||
1926 | struct comedi_device *dev = file->private_data; | 1926 | struct comedi_device *dev = file->private_data; |
1927 | struct comedi_subdevice *s; | 1927 | struct comedi_subdevice *s; |
1928 | struct comedi_async *async; | 1928 | struct comedi_async *async; |
1929 | struct comedi_buf_map *bm; | 1929 | struct comedi_buf_map *bm = NULL; |
1930 | unsigned long start = vma->vm_start; | 1930 | unsigned long start = vma->vm_start; |
1931 | unsigned long size; | 1931 | unsigned long size; |
1932 | int n_pages; | 1932 | int n_pages; |
1933 | int i; | 1933 | int i; |
1934 | int retval; | 1934 | int retval; |
1935 | 1935 | ||
1936 | mutex_lock(&dev->mutex); | 1936 | /* |
1937 | * 'trylock' avoids circular dependency with current->mm->mmap_sem | ||
1938 | * and down-reading &dev->attach_lock should normally succeed without | ||
1939 | * contention unless the device is in the process of being attached | ||
1940 | * or detached. | ||
1941 | */ | ||
1942 | if (!down_read_trylock(&dev->attach_lock)) | ||
1943 | return -EAGAIN; | ||
1937 | 1944 | ||
1938 | if (!dev->attached) { | 1945 | if (!dev->attached) { |
1939 | dev_dbg(dev->class_dev, "no driver attached\n"); | 1946 | dev_dbg(dev->class_dev, "no driver attached\n"); |
@@ -1973,7 +1980,9 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | |||
1973 | } | 1980 | } |
1974 | 1981 | ||
1975 | n_pages = size >> PAGE_SHIFT; | 1982 | n_pages = size >> PAGE_SHIFT; |
1976 | bm = async->buf_map; | 1983 | |
1984 | /* get reference to current buf map (if any) */ | ||
1985 | bm = comedi_buf_map_from_subdev_get(s); | ||
1977 | if (!bm || n_pages > bm->n_pages) { | 1986 | if (!bm || n_pages > bm->n_pages) { |
1978 | retval = -EINVAL; | 1987 | retval = -EINVAL; |
1979 | goto done; | 1988 | goto done; |
@@ -1997,7 +2006,8 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | |||
1997 | 2006 | ||
1998 | retval = 0; | 2007 | retval = 0; |
1999 | done: | 2008 | done: |
2000 | mutex_unlock(&dev->mutex); | 2009 | up_read(&dev->attach_lock); |
2010 | comedi_buf_map_put(bm); /* put reference to buf map - okay if NULL */ | ||
2001 | return retval; | 2011 | return retval; |
2002 | } | 2012 | } |
2003 | 2013 | ||
diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index 9a746570f161..a492f2d2436e 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h | |||
@@ -19,6 +19,8 @@ void comedi_buf_reset(struct comedi_async *async); | |||
19 | bool comedi_buf_is_mmapped(struct comedi_async *async); | 19 | bool comedi_buf_is_mmapped(struct comedi_async *async); |
20 | void comedi_buf_map_get(struct comedi_buf_map *bm); | 20 | void comedi_buf_map_get(struct comedi_buf_map *bm); |
21 | int comedi_buf_map_put(struct comedi_buf_map *bm); | 21 | int comedi_buf_map_put(struct comedi_buf_map *bm); |
22 | struct comedi_buf_map *comedi_buf_map_from_subdev_get( | ||
23 | struct comedi_subdevice *s); | ||
22 | unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); | 24 | unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); |
23 | void comedi_device_cancel_all(struct comedi_device *dev); | 25 | void comedi_device_cancel_all(struct comedi_device *dev); |
24 | 26 | ||
diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c index f96dcec740ae..7ac2602242f1 100644 --- a/drivers/staging/goldfish/goldfish_audio.c +++ b/drivers/staging/goldfish/goldfish_audio.c | |||
@@ -334,6 +334,7 @@ static int goldfish_audio_probe(struct platform_device *pdev) | |||
334 | return 0; | 334 | return 0; |
335 | 335 | ||
336 | err_misc_register_failed: | 336 | err_misc_register_failed: |
337 | free_irq(data->irq, data); | ||
337 | err_request_irq_failed: | 338 | err_request_irq_failed: |
338 | dma_free_coherent(&pdev->dev, COMBINED_BUFFER_SIZE, | 339 | dma_free_coherent(&pdev->dev, COMBINED_BUFFER_SIZE, |
339 | data->buffer_virt, data->buffer_phys); | 340 | data->buffer_virt, data->buffer_phys); |
diff --git a/drivers/staging/gs_fpgaboot/Makefile b/drivers/staging/gs_fpgaboot/Makefile index 34cb606e0e3d..d2f0211ba540 100644 --- a/drivers/staging/gs_fpgaboot/Makefile +++ b/drivers/staging/gs_fpgaboot/Makefile | |||
@@ -1,4 +1,2 @@ | |||
1 | gs_fpga-y += gs_fpgaboot.o io.o | 1 | gs_fpga-y += gs_fpgaboot.o io.o |
2 | obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o | 2 | obj-$(CONFIG_GS_FPGABOOT) += gs_fpga.o |
3 | |||
4 | ccflags-$(CONFIG_GS_FPGA_DEBUG) := -DDEBUG | ||
diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c index 89bc84d833e6..7506900c9b8d 100644 --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c | |||
@@ -373,7 +373,6 @@ static int __init gs_fpgaboot_init(void) | |||
373 | r = -1; | 373 | r = -1; |
374 | 374 | ||
375 | pr_info("FPGA DOWNLOAD --->\n"); | 375 | pr_info("FPGA DOWNLOAD --->\n"); |
376 | pr_info("built at %s UTC\n", __TIMESTAMP__); | ||
377 | 376 | ||
378 | pr_info("FPGA image file name: %s\n", file); | 377 | pr_info("FPGA image file name: %s\n", file); |
379 | 378 | ||
diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig deleted file mode 100644 index ff8d41ebca36..000000000000 --- a/drivers/staging/rtl8187se/Kconfig +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | config R8187SE | ||
2 | tristate "RealTek RTL8187SE Wireless LAN NIC driver" | ||
3 | depends on PCI && WLAN | ||
4 | depends on m | ||
5 | select WIRELESS_EXT | ||
6 | select WEXT_PRIV | ||
7 | select EEPROM_93CX6 | ||
8 | select CRYPTO | ||
9 | ---help--- | ||
10 | If built as a module, it will be called r8187se.ko. | ||
diff --git a/drivers/staging/rtl8187se/Makefile b/drivers/staging/rtl8187se/Makefile deleted file mode 100644 index 91d1aa2830c9..000000000000 --- a/drivers/staging/rtl8187se/Makefile +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | |||
2 | #ccflags-y += -DCONFIG_IEEE80211_NOWEP=y | ||
3 | #ccflags-y += -std=gnu89 | ||
4 | #ccflags-y += -O2 | ||
5 | #CC = gcc | ||
6 | |||
7 | ccflags-y := -DSW_ANTE | ||
8 | ccflags-y += -DTX_TRACK | ||
9 | ccflags-y += -DHIGH_POWER | ||
10 | ccflags-y += -DSW_DIG | ||
11 | ccflags-y += -DRATE_ADAPT | ||
12 | |||
13 | #enable it for legacy power save, disable it for leisure power save | ||
14 | ccflags-y += -DENABLE_LPS | ||
15 | |||
16 | |||
17 | #ccflags-y := -mhard-float -DCONFIG_FORCE_HARD_FLOAT=y | ||
18 | |||
19 | r8187se-y := \ | ||
20 | r8180_core.o \ | ||
21 | r8180_wx.o \ | ||
22 | r8180_rtl8225z2.o \ | ||
23 | r8185b_init.o \ | ||
24 | r8180_dm.o \ | ||
25 | ieee80211/dot11d.o \ | ||
26 | ieee80211/ieee80211_softmac.o \ | ||
27 | ieee80211/ieee80211_rx.o \ | ||
28 | ieee80211/ieee80211_tx.o \ | ||
29 | ieee80211/ieee80211_wx.o \ | ||
30 | ieee80211/ieee80211_module.o \ | ||
31 | ieee80211/ieee80211_softmac_wx.o \ | ||
32 | ieee80211/ieee80211_crypt.o \ | ||
33 | ieee80211/ieee80211_crypt_tkip.o \ | ||
34 | ieee80211/ieee80211_crypt_ccmp.o \ | ||
35 | ieee80211/ieee80211_crypt_wep.o | ||
36 | |||
37 | obj-$(CONFIG_R8187SE) += r8187se.o | ||
38 | |||
diff --git a/drivers/staging/rtl8187se/Module.symvers b/drivers/staging/rtl8187se/Module.symvers deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/drivers/staging/rtl8187se/Module.symvers +++ /dev/null | |||
diff --git a/drivers/staging/rtl8187se/TODO b/drivers/staging/rtl8187se/TODO deleted file mode 100644 index 704949a9da0d..000000000000 --- a/drivers/staging/rtl8187se/TODO +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | TODO: | ||
2 | - prepare private ieee80211 stack for merge with rtl8192su's version: | ||
3 | - add hwsec_active flag to struct ieee80211_device | ||
4 | - add bHwSec flag to cb_desc structure | ||
5 | - switch to use shared "librtl" instead of private ieee80211 stack | ||
6 | - switch to use LIB80211 | ||
7 | - switch to use MAC80211 | ||
8 | - use kernel coding style | ||
9 | - checkpatch.pl fixes | ||
10 | - sparse fixes | ||
11 | - integrate with drivers/net/wireless/rtl818x | ||
12 | |||
13 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>. | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c deleted file mode 100644 index 4483c2c0307c..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ /dev/null | |||
@@ -1,189 +0,0 @@ | |||
1 | #include "dot11d.h" | ||
2 | |||
3 | void Dot11d_Init(struct ieee80211_device *ieee) | ||
4 | { | ||
5 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); | ||
6 | |||
7 | pDot11dInfo->bEnabled = 0; | ||
8 | |||
9 | pDot11dInfo->State = DOT11D_STATE_NONE; | ||
10 | pDot11dInfo->CountryIeLen = 0; | ||
11 | memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); | ||
12 | memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); | ||
13 | RESET_CIE_WATCHDOG(ieee); | ||
14 | |||
15 | netdev_info(ieee->dev, "Dot11d_Init()\n"); | ||
16 | } | ||
17 | |||
18 | /* Reset to the state as we are just entering a regulatory domain. */ | ||
19 | void Dot11d_Reset(struct ieee80211_device *ieee) | ||
20 | { | ||
21 | u32 i; | ||
22 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); | ||
23 | |||
24 | /* Clear old channel map */ | ||
25 | memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); | ||
26 | memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); | ||
27 | /* Set new channel map */ | ||
28 | for (i = 1; i <= 11; i++) | ||
29 | (pDot11dInfo->channel_map)[i] = 1; | ||
30 | |||
31 | for (i = 12; i <= 14; i++) | ||
32 | (pDot11dInfo->channel_map)[i] = 2; | ||
33 | |||
34 | pDot11dInfo->State = DOT11D_STATE_NONE; | ||
35 | pDot11dInfo->CountryIeLen = 0; | ||
36 | RESET_CIE_WATCHDOG(ieee); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Description: | ||
41 | * Update country IE from Beacon or Probe Response and configure PHY for | ||
42 | * operation in the regulatory domain. | ||
43 | * | ||
44 | * TODO: | ||
45 | * Configure Tx power. | ||
46 | * | ||
47 | * Assumption: | ||
48 | * 1. IS_DOT11D_ENABLE() is TRUE. | ||
49 | * 2. Input IE is an valid one. | ||
50 | */ | ||
51 | void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr, | ||
52 | u16 CoutryIeLen, u8 *pCoutryIe) | ||
53 | { | ||
54 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); | ||
55 | u8 i, j, NumTriples, MaxChnlNum; | ||
56 | u8 index, MaxTxPowerInDbm; | ||
57 | PCHNL_TXPOWER_TRIPLE pTriple; | ||
58 | |||
59 | if ((CoutryIeLen - 3)%3 != 0) { | ||
60 | netdev_info(dev->dev, "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); | ||
61 | Dot11d_Reset(dev); | ||
62 | return; | ||
63 | } | ||
64 | |||
65 | memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); | ||
66 | memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); | ||
67 | MaxChnlNum = 0; | ||
68 | NumTriples = (CoutryIeLen - 3) / 3; /* skip 3-byte country string. */ | ||
69 | pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); | ||
70 | for (i = 0; i < NumTriples; i++) { | ||
71 | if (MaxChnlNum >= pTriple->FirstChnl) { | ||
72 | /* | ||
73 | * It is not in a monotonically increasing order, | ||
74 | * so stop processing. | ||
75 | */ | ||
76 | netdev_info(dev->dev, | ||
77 | "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); | ||
78 | Dot11d_Reset(dev); | ||
79 | return; | ||
80 | } | ||
81 | if (MAX_CHANNEL_NUMBER < | ||
82 | (pTriple->FirstChnl + pTriple->NumChnls)) { | ||
83 | /* | ||
84 | * It is not a valid set of channel id, | ||
85 | * so stop processing | ||
86 | */ | ||
87 | netdev_info(dev->dev, | ||
88 | "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); | ||
89 | Dot11d_Reset(dev); | ||
90 | return; | ||
91 | } | ||
92 | |||
93 | for (j = 0; j < pTriple->NumChnls; j++) { | ||
94 | index = pTriple->FirstChnl + j; | ||
95 | pDot11dInfo->channel_map[index] = 1; | ||
96 | MaxTxPowerInDbm = pTriple->MaxTxPowerInDbm; | ||
97 | pDot11dInfo->MaxTxPwrDbmList[index] = MaxTxPowerInDbm; | ||
98 | MaxChnlNum = pTriple->FirstChnl + j; | ||
99 | } | ||
100 | |||
101 | pTriple = (PCHNL_TXPOWER_TRIPLE)((u8 *)pTriple + 3); | ||
102 | } | ||
103 | #if 1 | ||
104 | netdev_info(dev->dev, "Channel List:"); | ||
105 | for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) | ||
106 | if (pDot11dInfo->channel_map[i] > 0) | ||
107 | netdev_info(dev->dev, " %d", i); | ||
108 | netdev_info(dev->dev, "\n"); | ||
109 | #endif | ||
110 | |||
111 | UPDATE_CIE_SRC(dev, pTaddr); | ||
112 | |||
113 | pDot11dInfo->CountryIeLen = CoutryIeLen; | ||
114 | memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe, CoutryIeLen); | ||
115 | pDot11dInfo->State = DOT11D_STATE_LEARNED; | ||
116 | } | ||
117 | |||
118 | u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel) | ||
119 | { | ||
120 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); | ||
121 | u8 MaxTxPwrInDbm = 255; | ||
122 | |||
123 | if (MAX_CHANNEL_NUMBER < Channel) { | ||
124 | netdev_info(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); | ||
125 | return MaxTxPwrInDbm; | ||
126 | } | ||
127 | if (pDot11dInfo->channel_map[Channel]) | ||
128 | MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; | ||
129 | |||
130 | return MaxTxPwrInDbm; | ||
131 | } | ||
132 | |||
133 | |||
134 | void DOT11D_ScanComplete(struct ieee80211_device *dev) | ||
135 | { | ||
136 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); | ||
137 | |||
138 | switch (pDot11dInfo->State) { | ||
139 | case DOT11D_STATE_LEARNED: | ||
140 | pDot11dInfo->State = DOT11D_STATE_DONE; | ||
141 | break; | ||
142 | |||
143 | case DOT11D_STATE_DONE: | ||
144 | if (GET_CIE_WATCHDOG(dev) == 0) { | ||
145 | /* Reset country IE if previous one is gone. */ | ||
146 | Dot11d_Reset(dev); | ||
147 | } | ||
148 | break; | ||
149 | case DOT11D_STATE_NONE: | ||
150 | break; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | int IsLegalChannel(struct ieee80211_device *dev, u8 channel) | ||
155 | { | ||
156 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); | ||
157 | |||
158 | if (MAX_CHANNEL_NUMBER < channel) { | ||
159 | netdev_info(dev->dev, "IsLegalChannel(): Invalid Channel\n"); | ||
160 | return 0; | ||
161 | } | ||
162 | if (pDot11dInfo->channel_map[channel] > 0) | ||
163 | return 1; | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | int ToLegalChannel(struct ieee80211_device *dev, u8 channel) | ||
168 | { | ||
169 | PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); | ||
170 | u8 default_chn = 0; | ||
171 | u32 i = 0; | ||
172 | |||
173 | for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) { | ||
174 | if (pDot11dInfo->channel_map[i] > 0) { | ||
175 | default_chn = i; | ||
176 | break; | ||
177 | } | ||
178 | } | ||
179 | |||
180 | if (MAX_CHANNEL_NUMBER < channel) { | ||
181 | netdev_info(dev->dev, "IsLegalChannel(): Invalid Channel\n"); | ||
182 | return default_chn; | ||
183 | } | ||
184 | |||
185 | if (pDot11dInfo->channel_map[channel] > 0) | ||
186 | return channel; | ||
187 | |||
188 | return default_chn; | ||
189 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.h b/drivers/staging/rtl8187se/ieee80211/dot11d.h deleted file mode 100644 index f996691307bf..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.h +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | #ifndef __INC_DOT11D_H | ||
2 | #define __INC_DOT11D_H | ||
3 | |||
4 | #include "ieee80211.h" | ||
5 | |||
6 | /* #define ENABLE_DOT11D */ | ||
7 | |||
8 | /* #define DOT11D_MAX_CHNL_NUM 83 */ | ||
9 | |||
10 | typedef struct _CHNL_TXPOWER_TRIPLE { | ||
11 | u8 FirstChnl; | ||
12 | u8 NumChnls; | ||
13 | u8 MaxTxPowerInDbm; | ||
14 | } CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; | ||
15 | |||
16 | typedef enum _DOT11D_STATE { | ||
17 | DOT11D_STATE_NONE = 0, | ||
18 | DOT11D_STATE_LEARNED, | ||
19 | DOT11D_STATE_DONE, | ||
20 | } DOT11D_STATE; | ||
21 | |||
22 | typedef struct _RT_DOT11D_INFO { | ||
23 | /* DECLARE_RT_OBJECT(RT_DOT12D_INFO); */ | ||
24 | |||
25 | bool bEnabled; /* dot11MultiDomainCapabilityEnabled */ | ||
26 | |||
27 | u16 CountryIeLen; /* > 0 if CountryIeBuf[] contains valid country information element. */ | ||
28 | u8 CountryIeBuf[MAX_IE_LEN]; | ||
29 | u8 CountryIeSrcAddr[6]; /* Source AP of the country IE. */ | ||
30 | u8 CountryIeWatchdog; | ||
31 | |||
32 | u8 channel_map[MAX_CHANNEL_NUMBER+1]; /* !!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) */ | ||
33 | /* u8 ChnlListLen; // #Bytes valid in ChnlList[]. */ | ||
34 | /* u8 ChnlList[DOT11D_MAX_CHNL_NUM]; */ | ||
35 | u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; | ||
36 | |||
37 | DOT11D_STATE State; | ||
38 | } RT_DOT11D_INFO, *PRT_DOT11D_INFO; | ||
39 | |||
40 | #define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1:0) | ||
41 | #define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5]) | ||
42 | #define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) | ||
43 | |||
44 | #define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled | ||
45 | #define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) | ||
46 | |||
47 | #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) | ||
48 | #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) | ||
49 | |||
50 | #define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ | ||
51 | (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ | ||
52 | FALSE : \ | ||
53 | (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) | ||
54 | |||
55 | #define CIE_WATCHDOG_TH 1 | ||
56 | #define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog | ||
57 | #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 | ||
58 | #define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) | ||
59 | |||
60 | #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) | ||
61 | |||
62 | void Dot11d_Init(struct ieee80211_device *dev); | ||
63 | void Dot11d_Reset(struct ieee80211_device *dev); | ||
64 | void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr, | ||
65 | u16 CoutryIeLen, u8 *pCoutryIe); | ||
66 | u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel); | ||
67 | void DOT11D_ScanComplete(struct ieee80211_device *dev); | ||
68 | int IsLegalChannel(struct ieee80211_device *dev, u8 channel); | ||
69 | int ToLegalChannel(struct ieee80211_device *dev, u8 channel); | ||
70 | |||
71 | #endif /* #ifndef __INC_DOT11D_H */ | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h deleted file mode 100644 index d1763b7b8f27..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ /dev/null | |||
@@ -1,1496 +0,0 @@ | |||
1 | /* | ||
2 | * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 | ||
3 | * remains copyright by the original authors | ||
4 | * | ||
5 | * Portions of the merged code are based on Host AP (software wireless | ||
6 | * LAN access point) driver for Intersil Prism2/2.5/3. | ||
7 | * | ||
8 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
9 | * <jkmaline@cc.hut.fi> | ||
10 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
11 | * | ||
12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | ||
13 | * <jketreno@linux.intel.com> | ||
14 | * Copyright (c) 2004, Intel Corporation | ||
15 | * | ||
16 | * Modified for Realtek's wi-fi cards by Andrea Merello | ||
17 | * <andrea.merello@gmail.com> | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License version 2 as | ||
21 | * published by the Free Software Foundation. See README and COPYING for | ||
22 | * more details. | ||
23 | */ | ||
24 | #ifndef IEEE80211_H | ||
25 | #define IEEE80211_H | ||
26 | #include <linux/if_ether.h> /* ETH_ALEN */ | ||
27 | #include <linux/kernel.h> /* ARRAY_SIZE */ | ||
28 | #include <linux/jiffies.h> | ||
29 | #include <linux/timer.h> | ||
30 | #include <linux/sched.h> | ||
31 | #include <linux/semaphore.h> | ||
32 | #include <linux/wireless.h> | ||
33 | #include <linux/ieee80211.h> | ||
34 | #include <linux/interrupt.h> | ||
35 | |||
36 | #define KEY_TYPE_NA 0x0 | ||
37 | #define KEY_TYPE_WEP40 0x1 | ||
38 | #define KEY_TYPE_TKIP 0x2 | ||
39 | #define KEY_TYPE_CCMP 0x4 | ||
40 | #define KEY_TYPE_WEP104 0x5 | ||
41 | |||
42 | #define aSifsTime 10 | ||
43 | |||
44 | #define MGMT_QUEUE_NUM 5 | ||
45 | |||
46 | |||
47 | #define IEEE_CMD_SET_WPA_PARAM 1 | ||
48 | #define IEEE_CMD_SET_WPA_IE 2 | ||
49 | #define IEEE_CMD_SET_ENCRYPTION 3 | ||
50 | #define IEEE_CMD_MLME 4 | ||
51 | |||
52 | #define IEEE_PARAM_WPA_ENABLED 1 | ||
53 | #define IEEE_PARAM_TKIP_COUNTERMEASURES 2 | ||
54 | #define IEEE_PARAM_DROP_UNENCRYPTED 3 | ||
55 | #define IEEE_PARAM_PRIVACY_INVOKED 4 | ||
56 | #define IEEE_PARAM_AUTH_ALGS 5 | ||
57 | #define IEEE_PARAM_IEEE_802_1X 6 | ||
58 | //It should consistent with the driver_XXX.c | ||
59 | // David, 2006.9.26 | ||
60 | #define IEEE_PARAM_WPAX_SELECT 7 | ||
61 | //Added for notify the encryption type selection | ||
62 | // David, 2006.9.26 | ||
63 | #define IEEE_PROTO_WPA 1 | ||
64 | #define IEEE_PROTO_RSN 2 | ||
65 | //Added for notify the encryption type selection | ||
66 | // David, 2006.9.26 | ||
67 | #define IEEE_WPAX_USEGROUP 0 | ||
68 | #define IEEE_WPAX_WEP40 1 | ||
69 | #define IEEE_WPAX_TKIP 2 | ||
70 | #define IEEE_WPAX_WRAP 3 | ||
71 | #define IEEE_WPAX_CCMP 4 | ||
72 | #define IEEE_WPAX_WEP104 5 | ||
73 | |||
74 | #define IEEE_KEY_MGMT_IEEE8021X 1 | ||
75 | #define IEEE_KEY_MGMT_PSK 2 | ||
76 | |||
77 | |||
78 | |||
79 | #define IEEE_MLME_STA_DEAUTH 1 | ||
80 | #define IEEE_MLME_STA_DISASSOC 2 | ||
81 | |||
82 | |||
83 | #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 | ||
84 | #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3 | ||
85 | #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 | ||
86 | #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 | ||
87 | #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 | ||
88 | #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 | ||
89 | |||
90 | |||
91 | #define IEEE_CRYPT_ALG_NAME_LEN 16 | ||
92 | |||
93 | extern int ieee80211_crypto_tkip_init(void); | ||
94 | extern void ieee80211_crypto_tkip_exit(void); | ||
95 | |||
96 | //by amy for ps | ||
97 | typedef struct ieee_param { | ||
98 | u32 cmd; | ||
99 | u8 sta_addr[ETH_ALEN]; | ||
100 | union { | ||
101 | struct { | ||
102 | u8 name; | ||
103 | u32 value; | ||
104 | } wpa_param; | ||
105 | struct { | ||
106 | u32 len; | ||
107 | u8 reserved[32]; | ||
108 | u8 data[0]; | ||
109 | } wpa_ie; | ||
110 | struct{ | ||
111 | int command; | ||
112 | int reason_code; | ||
113 | } mlme; | ||
114 | struct { | ||
115 | u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; | ||
116 | u8 set_tx; | ||
117 | u32 err; | ||
118 | u8 idx; | ||
119 | u8 seq[8]; /* sequence counter (set: RX, get: TX) */ | ||
120 | u16 key_len; | ||
121 | u8 key[0]; | ||
122 | } crypt; | ||
123 | |||
124 | } u; | ||
125 | }ieee_param; | ||
126 | |||
127 | |||
128 | #define MSECS(t) msecs_to_jiffies(t) | ||
129 | #define msleep_interruptible_rtl msleep_interruptible | ||
130 | |||
131 | #define IEEE80211_DATA_LEN 2304 | ||
132 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | ||
133 | 6.2.1.1.2. | ||
134 | |||
135 | The figure in section 7.1.2 suggests a body size of up to 2312 | ||
136 | bytes is allowed, which is a bit confusing, I suspect this | ||
137 | represents the 2304 bytes of real data, plus a possible 8 bytes of | ||
138 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ | ||
139 | |||
140 | #define IEEE80211_3ADDR_LEN 24 | ||
141 | #define IEEE80211_4ADDR_LEN 30 | ||
142 | #define IEEE80211_FCS_LEN 4 | ||
143 | #define IEEE80211_HLEN IEEE80211_4ADDR_LEN | ||
144 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
145 | #define IEEE80211_MGMT_HDR_LEN 24 | ||
146 | #define IEEE80211_DATA_HDR3_LEN 24 | ||
147 | #define IEEE80211_DATA_HDR4_LEN 30 | ||
148 | |||
149 | #define MIN_FRAG_THRESHOLD 256U | ||
150 | #define MAX_FRAG_THRESHOLD 2346U | ||
151 | |||
152 | /* Frame control field constants */ | ||
153 | #define IEEE80211_FCTL_DSTODS 0x0300 //added by david | ||
154 | #define IEEE80211_FCTL_WEP 0x4000 | ||
155 | |||
156 | /* debug macros */ | ||
157 | |||
158 | #ifdef CONFIG_IEEE80211_DEBUG | ||
159 | extern u32 ieee80211_debug_level; | ||
160 | #define IEEE80211_DEBUG(level, fmt, args...) \ | ||
161 | do { if (ieee80211_debug_level & (level)) \ | ||
162 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ | ||
163 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) | ||
164 | #else | ||
165 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | ||
166 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
167 | |||
168 | /* | ||
169 | * To use the debug system; | ||
170 | * | ||
171 | * If you are defining a new debug classification, simply add it to the #define | ||
172 | * list here in the form of: | ||
173 | * | ||
174 | * #define IEEE80211_DL_xxxx VALUE | ||
175 | * | ||
176 | * shifting value to the left one bit from the previous entry. xxxx should be | ||
177 | * the name of the classification (for example, WEP) | ||
178 | * | ||
179 | * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your | ||
180 | * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want | ||
181 | * to send output to that classification. | ||
182 | * | ||
183 | * To add your debug level to the list of levels seen when you perform | ||
184 | * | ||
185 | * % cat /proc/net/ipw/debug_level | ||
186 | * | ||
187 | * you simply need to add your entry to the ipw_debug_levels array. | ||
188 | * | ||
189 | * If you do not see debug_level in /proc/net/ipw then you do not have | ||
190 | * CONFIG_IEEE80211_DEBUG defined in your kernel configuration | ||
191 | * | ||
192 | */ | ||
193 | |||
194 | #define IEEE80211_DL_INFO (1<<0) | ||
195 | #define IEEE80211_DL_WX (1<<1) | ||
196 | #define IEEE80211_DL_SCAN (1<<2) | ||
197 | #define IEEE80211_DL_STATE (1<<3) | ||
198 | #define IEEE80211_DL_MGMT (1<<4) | ||
199 | #define IEEE80211_DL_FRAG (1<<5) | ||
200 | #define IEEE80211_DL_EAP (1<<6) | ||
201 | #define IEEE80211_DL_DROP (1<<7) | ||
202 | |||
203 | #define IEEE80211_DL_TX (1<<8) | ||
204 | #define IEEE80211_DL_RX (1<<9) | ||
205 | |||
206 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) | ||
207 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) | ||
208 | #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a) | ||
209 | |||
210 | #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a) | ||
211 | #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a) | ||
212 | //#define IEEE_DEBUG_SCAN IEEE80211_WARNING | ||
213 | #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) | ||
214 | #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) | ||
215 | #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) | ||
216 | #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a) | ||
217 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) | ||
218 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) | ||
219 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) | ||
220 | #include <linux/netdevice.h> | ||
221 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ | ||
222 | |||
223 | #ifndef WIRELESS_SPY | ||
224 | #define WIRELESS_SPY // enable iwspy support | ||
225 | #endif | ||
226 | #include <net/iw_handler.h> // new driver API | ||
227 | |||
228 | #ifndef ETH_P_PAE | ||
229 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | ||
230 | #endif /* ETH_P_PAE */ | ||
231 | |||
232 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ | ||
233 | |||
234 | #ifndef ETH_P_80211_RAW | ||
235 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) | ||
236 | #endif | ||
237 | |||
238 | /* IEEE 802.11 defines */ | ||
239 | |||
240 | #define P80211_OUI_LEN 3 | ||
241 | |||
242 | struct ieee80211_snap_hdr { | ||
243 | |||
244 | u8 dsap; /* always 0xAA */ | ||
245 | u8 ssap; /* always 0xAA */ | ||
246 | u8 ctrl; /* always 0x03 */ | ||
247 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ | ||
248 | |||
249 | } __attribute__ ((packed)); | ||
250 | |||
251 | #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) | ||
252 | |||
253 | #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) | ||
254 | #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) | ||
255 | |||
256 | #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) | ||
257 | #define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ) | ||
258 | |||
259 | #define WLAN_CAPABILITY_BSS (1<<0) | ||
260 | #define WLAN_CAPABILITY_SHORT_SLOT (1<<10) | ||
261 | |||
262 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | ||
263 | #define IEEE80211_STATMASK_RSSI (1<<1) | ||
264 | #define IEEE80211_STATMASK_NOISE (1<<2) | ||
265 | #define IEEE80211_STATMASK_RATE (1<<3) | ||
266 | #define IEEE80211_STATMASK_WEMASK 0x7 | ||
267 | |||
268 | |||
269 | #define IEEE80211_CCK_MODULATION (1<<0) | ||
270 | #define IEEE80211_OFDM_MODULATION (1<<1) | ||
271 | |||
272 | #define IEEE80211_24GHZ_BAND (1<<0) | ||
273 | #define IEEE80211_52GHZ_BAND (1<<1) | ||
274 | |||
275 | #define IEEE80211_CCK_RATE_LEN 4 | ||
276 | #define IEEE80211_CCK_RATE_1MB 0x02 | ||
277 | #define IEEE80211_CCK_RATE_2MB 0x04 | ||
278 | #define IEEE80211_CCK_RATE_5MB 0x0B | ||
279 | #define IEEE80211_CCK_RATE_11MB 0x16 | ||
280 | #define IEEE80211_OFDM_RATE_LEN 8 | ||
281 | #define IEEE80211_OFDM_RATE_6MB 0x0C | ||
282 | #define IEEE80211_OFDM_RATE_9MB 0x12 | ||
283 | #define IEEE80211_OFDM_RATE_12MB 0x18 | ||
284 | #define IEEE80211_OFDM_RATE_18MB 0x24 | ||
285 | #define IEEE80211_OFDM_RATE_24MB 0x30 | ||
286 | #define IEEE80211_OFDM_RATE_36MB 0x48 | ||
287 | #define IEEE80211_OFDM_RATE_48MB 0x60 | ||
288 | #define IEEE80211_OFDM_RATE_54MB 0x6C | ||
289 | #define IEEE80211_BASIC_RATE_MASK 0x80 | ||
290 | |||
291 | #define IEEE80211_CCK_RATE_1MB_MASK (1<<0) | ||
292 | #define IEEE80211_CCK_RATE_2MB_MASK (1<<1) | ||
293 | #define IEEE80211_CCK_RATE_5MB_MASK (1<<2) | ||
294 | #define IEEE80211_CCK_RATE_11MB_MASK (1<<3) | ||
295 | #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) | ||
296 | #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) | ||
297 | #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) | ||
298 | #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) | ||
299 | #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) | ||
300 | #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) | ||
301 | #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) | ||
302 | #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) | ||
303 | |||
304 | #define IEEE80211_CCK_RATES_MASK 0x0000000F | ||
305 | #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ | ||
306 | IEEE80211_CCK_RATE_2MB_MASK) | ||
307 | #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ | ||
308 | IEEE80211_CCK_RATE_5MB_MASK | \ | ||
309 | IEEE80211_CCK_RATE_11MB_MASK) | ||
310 | |||
311 | #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 | ||
312 | #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ | ||
313 | IEEE80211_OFDM_RATE_12MB_MASK | \ | ||
314 | IEEE80211_OFDM_RATE_24MB_MASK) | ||
315 | #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ | ||
316 | IEEE80211_OFDM_RATE_9MB_MASK | \ | ||
317 | IEEE80211_OFDM_RATE_18MB_MASK | \ | ||
318 | IEEE80211_OFDM_RATE_36MB_MASK | \ | ||
319 | IEEE80211_OFDM_RATE_48MB_MASK | \ | ||
320 | IEEE80211_OFDM_RATE_54MB_MASK) | ||
321 | #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ | ||
322 | IEEE80211_CCK_DEFAULT_RATES_MASK) | ||
323 | |||
324 | #define IEEE80211_NUM_OFDM_RATES 8 | ||
325 | #define IEEE80211_NUM_CCK_RATES 4 | ||
326 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 | ||
327 | |||
328 | /* this is stolen and modified from the madwifi driver*/ | ||
329 | #define IEEE80211_FC0_TYPE_MASK 0x0c | ||
330 | #define IEEE80211_FC0_TYPE_DATA 0x08 | ||
331 | #define IEEE80211_FC0_SUBTYPE_MASK 0xB0 | ||
332 | #define IEEE80211_FC0_SUBTYPE_QOS 0x80 | ||
333 | |||
334 | #define IEEE80211_QOS_HAS_SEQ(fc) \ | ||
335 | (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \ | ||
336 | (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) | ||
337 | |||
338 | /* this is stolen from ipw2200 driver */ | ||
339 | #define IEEE_IBSS_MAC_HASH_SIZE 31 | ||
340 | struct ieee_ibss_seq { | ||
341 | u8 mac[ETH_ALEN]; | ||
342 | u16 seq_num[17]; | ||
343 | u16 frag_num[17]; | ||
344 | unsigned long packet_time[17]; | ||
345 | struct list_head list; | ||
346 | }; | ||
347 | |||
348 | /* NOTE: This data is for statistical purposes; not all hardware provides this | ||
349 | * information for frames received. Not setting these will not cause | ||
350 | * any adverse affects. */ | ||
351 | struct ieee80211_rx_stats { | ||
352 | u32 mac_time[2]; | ||
353 | u8 signalstrength; | ||
354 | s8 rssi; | ||
355 | u8 signal; | ||
356 | u8 noise; | ||
357 | u16 rate; /* in 100 kbps */ | ||
358 | u8 received_channel; | ||
359 | u8 control; | ||
360 | u8 mask; | ||
361 | u8 freq; | ||
362 | u16 len; | ||
363 | u8 nic_type; | ||
364 | }; | ||
365 | |||
366 | /* IEEE 802.11 requires that STA supports concurrent reception of at least | ||
367 | * three fragmented frames. This define can be increased to support more | ||
368 | * concurrent frames, but it should be noted that each entry can consume about | ||
369 | * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ | ||
370 | #define IEEE80211_FRAG_CACHE_LEN 4 | ||
371 | |||
372 | struct ieee80211_frag_entry { | ||
373 | unsigned long first_frag_time; | ||
374 | unsigned int seq; | ||
375 | unsigned int last_frag; | ||
376 | struct sk_buff *skb; | ||
377 | u8 src_addr[ETH_ALEN]; | ||
378 | u8 dst_addr[ETH_ALEN]; | ||
379 | }; | ||
380 | |||
381 | struct ieee80211_stats { | ||
382 | unsigned int tx_unicast_frames; | ||
383 | unsigned int tx_multicast_frames; | ||
384 | unsigned int tx_fragments; | ||
385 | unsigned int tx_unicast_octets; | ||
386 | unsigned int tx_multicast_octets; | ||
387 | unsigned int tx_deferred_transmissions; | ||
388 | unsigned int tx_single_retry_frames; | ||
389 | unsigned int tx_multiple_retry_frames; | ||
390 | unsigned int tx_retry_limit_exceeded; | ||
391 | unsigned int tx_discards; | ||
392 | unsigned int rx_unicast_frames; | ||
393 | unsigned int rx_multicast_frames; | ||
394 | unsigned int rx_fragments; | ||
395 | unsigned int rx_unicast_octets; | ||
396 | unsigned int rx_multicast_octets; | ||
397 | unsigned int rx_fcs_errors; | ||
398 | unsigned int rx_discards_no_buffer; | ||
399 | unsigned int tx_discards_wrong_sa; | ||
400 | unsigned int rx_discards_undecryptable; | ||
401 | unsigned int rx_message_in_msg_fragments; | ||
402 | unsigned int rx_message_in_bad_msg_fragments; | ||
403 | }; | ||
404 | |||
405 | struct ieee80211_device; | ||
406 | |||
407 | #include "ieee80211_crypt.h" | ||
408 | |||
409 | #define SEC_KEY_1 (1<<0) | ||
410 | #define SEC_KEY_2 (1<<1) | ||
411 | #define SEC_KEY_3 (1<<2) | ||
412 | #define SEC_KEY_4 (1<<3) | ||
413 | #define SEC_ACTIVE_KEY (1<<4) | ||
414 | #define SEC_AUTH_MODE (1<<5) | ||
415 | #define SEC_UNICAST_GROUP (1<<6) | ||
416 | #define SEC_LEVEL (1<<7) | ||
417 | #define SEC_ENABLED (1<<8) | ||
418 | |||
419 | #define SEC_LEVEL_0 0 /* None */ | ||
420 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ | ||
421 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ | ||
422 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ | ||
423 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | ||
424 | |||
425 | #define WEP_KEYS 4 | ||
426 | #define WEP_KEY_LEN 13 | ||
427 | |||
428 | #define WEP_KEY_LEN_MODIF 32 | ||
429 | |||
430 | struct ieee80211_security { | ||
431 | u16 active_key:2, | ||
432 | enabled:1, | ||
433 | auth_mode:2, | ||
434 | auth_algo:4, | ||
435 | unicast_uses_group:1; | ||
436 | u8 key_sizes[WEP_KEYS]; | ||
437 | u8 keys[WEP_KEYS][WEP_KEY_LEN_MODIF]; | ||
438 | u8 level; | ||
439 | u16 flags; | ||
440 | } __attribute__ ((packed)); | ||
441 | |||
442 | |||
443 | /* | ||
444 | |||
445 | 802.11 data frame from AP | ||
446 | |||
447 | ,-------------------------------------------------------------------. | ||
448 | Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | | ||
449 | |------|------|---------|---------|---------|------|---------|------| | ||
450 | Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | | ||
451 | | | tion | (BSSID) | | | ence | data | | | ||
452 | `-------------------------------------------------------------------' | ||
453 | |||
454 | Total: 28-2340 bytes | ||
455 | |||
456 | */ | ||
457 | |||
458 | /* Management Frame Information Element Types */ | ||
459 | enum { | ||
460 | MFIE_TYPE_SSID = 0, | ||
461 | MFIE_TYPE_RATES = 1, | ||
462 | MFIE_TYPE_FH_SET = 2, | ||
463 | MFIE_TYPE_DS_SET = 3, | ||
464 | MFIE_TYPE_CF_SET = 4, | ||
465 | MFIE_TYPE_TIM = 5, | ||
466 | MFIE_TYPE_IBSS_SET = 6, | ||
467 | MFIE_TYPE_COUNTRY = 7, | ||
468 | MFIE_TYPE_CHALLENGE = 16, | ||
469 | MFIE_TYPE_ERP = 42, | ||
470 | MFIE_TYPE_RSN = 48, | ||
471 | MFIE_TYPE_RATES_EX = 50, | ||
472 | MFIE_TYPE_GENERIC = 221, | ||
473 | }; | ||
474 | |||
475 | struct ieee80211_header_data { | ||
476 | __le16 frame_ctl; | ||
477 | u16 duration_id; | ||
478 | u8 addr1[6]; | ||
479 | u8 addr2[6]; | ||
480 | u8 addr3[6]; | ||
481 | u16 seq_ctrl; | ||
482 | }; | ||
483 | |||
484 | struct ieee80211_hdr_4addr { | ||
485 | __le16 frame_ctl; | ||
486 | u16 duration_id; | ||
487 | u8 addr1[ETH_ALEN]; | ||
488 | u8 addr2[ETH_ALEN]; | ||
489 | u8 addr3[ETH_ALEN]; | ||
490 | u16 seq_ctl; | ||
491 | u8 addr4[ETH_ALEN]; | ||
492 | } __attribute__ ((packed)); | ||
493 | |||
494 | struct ieee80211_hdr_3addrqos { | ||
495 | u16 frame_ctl; | ||
496 | u16 duration_id; | ||
497 | u8 addr1[ETH_ALEN]; | ||
498 | u8 addr2[ETH_ALEN]; | ||
499 | u8 addr3[ETH_ALEN]; | ||
500 | u16 seq_ctl; | ||
501 | u16 qos_ctl; | ||
502 | } __attribute__ ((packed)); | ||
503 | |||
504 | struct ieee80211_hdr_4addrqos { | ||
505 | u16 frame_ctl; | ||
506 | u16 duration_id; | ||
507 | u8 addr1[ETH_ALEN]; | ||
508 | u8 addr2[ETH_ALEN]; | ||
509 | u8 addr3[ETH_ALEN]; | ||
510 | u16 seq_ctl; | ||
511 | u8 addr4[ETH_ALEN]; | ||
512 | u16 qos_ctl; | ||
513 | } __attribute__ ((packed)); | ||
514 | |||
515 | struct ieee80211_info_element_hdr { | ||
516 | u8 id; | ||
517 | u8 len; | ||
518 | } __attribute__ ((packed)); | ||
519 | |||
520 | struct ieee80211_info_element { | ||
521 | u8 id; | ||
522 | u8 len; | ||
523 | u8 data[0]; | ||
524 | } __attribute__ ((packed)); | ||
525 | |||
526 | struct ieee80211_authentication { | ||
527 | struct ieee80211_header_data header; | ||
528 | u16 algorithm; | ||
529 | u16 transaction; | ||
530 | u16 status; | ||
531 | //struct ieee80211_info_element_hdr info_element; | ||
532 | } __attribute__ ((packed)); | ||
533 | |||
534 | struct ieee80211_disassoc_frame { | ||
535 | struct ieee80211_hdr_3addr header; | ||
536 | u16 reasoncode; | ||
537 | } __attribute__ ((packed)); | ||
538 | |||
539 | struct ieee80211_probe_request { | ||
540 | struct ieee80211_header_data header; | ||
541 | /* struct ieee80211_info_element info_element; */ | ||
542 | } __attribute__ ((packed)); | ||
543 | |||
544 | struct ieee80211_probe_response { | ||
545 | struct ieee80211_header_data header; | ||
546 | u32 time_stamp[2]; | ||
547 | u16 beacon_interval; | ||
548 | u16 capability; | ||
549 | struct ieee80211_info_element info_element; | ||
550 | } __attribute__ ((packed)); | ||
551 | |||
552 | struct ieee80211_assoc_request_frame { | ||
553 | struct ieee80211_hdr_3addr header; | ||
554 | u16 capability; | ||
555 | u16 listen_interval; | ||
556 | //u8 current_ap[ETH_ALEN]; | ||
557 | struct ieee80211_info_element_hdr info_element; | ||
558 | } __attribute__ ((packed)); | ||
559 | |||
560 | struct ieee80211_assoc_response_frame { | ||
561 | struct ieee80211_hdr_3addr header; | ||
562 | u16 capability; | ||
563 | u16 status; | ||
564 | u16 aid; | ||
565 | struct ieee80211_info_element info_element; /* supported rates */ | ||
566 | } __attribute__ ((packed)); | ||
567 | |||
568 | struct ieee80211_txb { | ||
569 | u8 nr_frags; | ||
570 | u8 encrypted; | ||
571 | u16 reserved; | ||
572 | u16 frag_size; | ||
573 | u16 payload_size; | ||
574 | struct sk_buff *fragments[0]; | ||
575 | }; | ||
576 | |||
577 | /* SWEEP TABLE ENTRIES NUMBER */ | ||
578 | #define MAX_SWEEP_TAB_ENTRIES 42 | ||
579 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 | ||
580 | |||
581 | /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs | ||
582 | * only use 8, and then use extended rates for the remaining supported | ||
583 | * rates. Other APs, however, stick all of their supported rates on the | ||
584 | * main rates information element... */ | ||
585 | #define MAX_RATES_LENGTH ((u8)12) | ||
586 | #define MAX_RATES_EX_LENGTH ((u8)16) | ||
587 | |||
588 | #define MAX_NETWORK_COUNT 128 | ||
589 | |||
590 | #define MAX_CHANNEL_NUMBER 165 | ||
591 | |||
592 | #define IEEE80211_SOFTMAC_SCAN_TIME 100 /* (HZ / 2) */ | ||
593 | #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) | ||
594 | |||
595 | #define CRC_LENGTH 4U | ||
596 | |||
597 | #define MAX_WPA_IE_LEN 64 | ||
598 | |||
599 | #define NETWORK_EMPTY_ESSID (1 << 0) | ||
600 | #define NETWORK_HAS_OFDM (1 << 1) | ||
601 | #define NETWORK_HAS_CCK (1 << 2) | ||
602 | |||
603 | struct ieee80211_wmm_ac_param { | ||
604 | u8 ac_aci_acm_aifsn; | ||
605 | u8 ac_ecwmin_ecwmax; | ||
606 | u16 ac_txop_limit; | ||
607 | }; | ||
608 | |||
609 | struct ieee80211_wmm_ts_info { | ||
610 | u8 ac_dir_tid; | ||
611 | u8 ac_up_psb; | ||
612 | u8 reserved; | ||
613 | } __attribute__ ((packed)); | ||
614 | |||
615 | struct ieee80211_wmm_tspec_elem { | ||
616 | struct ieee80211_wmm_ts_info ts_info; | ||
617 | u16 norm_msdu_size; | ||
618 | u16 max_msdu_size; | ||
619 | u32 min_serv_inter; | ||
620 | u32 max_serv_inter; | ||
621 | u32 inact_inter; | ||
622 | u32 suspen_inter; | ||
623 | u32 serv_start_time; | ||
624 | u32 min_data_rate; | ||
625 | u32 mean_data_rate; | ||
626 | u32 peak_data_rate; | ||
627 | u32 max_burst_size; | ||
628 | u32 delay_bound; | ||
629 | u32 min_phy_rate; | ||
630 | u16 surp_band_allow; | ||
631 | u16 medium_time; | ||
632 | }__attribute__((packed)); | ||
633 | |||
634 | enum eap_type { | ||
635 | EAP_PACKET = 0, | ||
636 | EAPOL_START, | ||
637 | EAPOL_LOGOFF, | ||
638 | EAPOL_KEY, | ||
639 | EAPOL_ENCAP_ASF_ALERT | ||
640 | }; | ||
641 | |||
642 | static const char *eap_types[] = { | ||
643 | [EAP_PACKET] = "EAP-Packet", | ||
644 | [EAPOL_START] = "EAPOL-Start", | ||
645 | [EAPOL_LOGOFF] = "EAPOL-Logoff", | ||
646 | [EAPOL_KEY] = "EAPOL-Key", | ||
647 | [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" | ||
648 | }; | ||
649 | |||
650 | static inline const char *eap_get_type(int type) | ||
651 | { | ||
652 | return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; | ||
653 | } | ||
654 | |||
655 | struct eapol { | ||
656 | u8 snap[6]; | ||
657 | u16 ethertype; | ||
658 | u8 version; | ||
659 | u8 type; | ||
660 | u16 length; | ||
661 | } __attribute__ ((packed)); | ||
662 | |||
663 | struct ieee80211_softmac_stats { | ||
664 | unsigned int rx_ass_ok; | ||
665 | unsigned int rx_ass_err; | ||
666 | unsigned int rx_probe_rq; | ||
667 | unsigned int tx_probe_rs; | ||
668 | unsigned int tx_beacons; | ||
669 | unsigned int rx_auth_rq; | ||
670 | unsigned int rx_auth_rs_ok; | ||
671 | unsigned int rx_auth_rs_err; | ||
672 | unsigned int tx_auth_rq; | ||
673 | unsigned int no_auth_rs; | ||
674 | unsigned int no_ass_rs; | ||
675 | unsigned int tx_ass_rq; | ||
676 | unsigned int rx_ass_rq; | ||
677 | unsigned int tx_probe_rq; | ||
678 | unsigned int reassoc; | ||
679 | unsigned int swtxstop; | ||
680 | unsigned int swtxawake; | ||
681 | }; | ||
682 | |||
683 | #define BEACON_PROBE_SSID_ID_POSITION 12 | ||
684 | |||
685 | /* | ||
686 | * These are the data types that can make up management packets | ||
687 | * | ||
688 | u16 auth_algorithm; | ||
689 | u16 auth_sequence; | ||
690 | u16 beacon_interval; | ||
691 | u16 capability; | ||
692 | u8 current_ap[ETH_ALEN]; | ||
693 | u16 listen_interval; | ||
694 | struct { | ||
695 | u16 association_id:14, reserved:2; | ||
696 | } __attribute__ ((packed)); | ||
697 | u32 time_stamp[2]; | ||
698 | u16 reason; | ||
699 | u16 status; | ||
700 | */ | ||
701 | |||
702 | #define IEEE80211_DEFAULT_TX_ESSID "Penguin" | ||
703 | #define IEEE80211_DEFAULT_BASIC_RATE 10 | ||
704 | |||
705 | enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; | ||
706 | #define MAX_SP_Len (WMM_all_frame << 4) | ||
707 | #define IEEE80211_QOS_TID 0x0f | ||
708 | #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5) | ||
709 | |||
710 | #define MAX_IE_LEN 0xFF //+YJ,080625 | ||
711 | |||
712 | struct rtl8187se_channel_list { | ||
713 | u8 channel[MAX_CHANNEL_NUMBER + 1]; | ||
714 | u8 len; | ||
715 | }; | ||
716 | |||
717 | //by amy for ps | ||
718 | #define IEEE80211_WATCH_DOG_TIME 2000 | ||
719 | //by amy for ps | ||
720 | //by amy for antenna | ||
721 | #define ANTENNA_DIVERSITY_TIMER_PERIOD 1000 // 1000 m | ||
722 | //by amy for antenna | ||
723 | |||
724 | #define IEEE80211_DTIM_MBCAST 4 | ||
725 | #define IEEE80211_DTIM_UCAST 2 | ||
726 | #define IEEE80211_DTIM_VALID 1 | ||
727 | #define IEEE80211_DTIM_INVALID 0 | ||
728 | |||
729 | #define IEEE80211_PS_DISABLED 0 | ||
730 | #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST | ||
731 | #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST | ||
732 | #define IEEE80211_PS_ENABLE IEEE80211_DTIM_VALID | ||
733 | //added by David for QoS 2006/6/30 | ||
734 | //#define WMM_Hang_8187 | ||
735 | #ifdef WMM_Hang_8187 | ||
736 | #undef WMM_Hang_8187 | ||
737 | #endif | ||
738 | |||
739 | #define WME_AC_BE 0x00 | ||
740 | #define WME_AC_BK 0x01 | ||
741 | #define WME_AC_VI 0x02 | ||
742 | #define WME_AC_VO 0x03 | ||
743 | #define WME_ACI_MASK 0x03 | ||
744 | #define WME_AIFSN_MASK 0x03 | ||
745 | #define WME_AC_PRAM_LEN 16 | ||
746 | |||
747 | //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP | ||
748 | //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) | ||
749 | #define UP2AC(up) ( \ | ||
750 | ((up) < 1) ? WME_AC_BE : \ | ||
751 | ((up) < 3) ? WME_AC_BK : \ | ||
752 | ((up) < 4) ? WME_AC_BE : \ | ||
753 | ((up) < 6) ? WME_AC_VI : \ | ||
754 | WME_AC_VO) | ||
755 | //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue | ||
756 | #define AC2UP(_ac) ( \ | ||
757 | ((_ac) == WME_AC_VO) ? 6 : \ | ||
758 | ((_ac) == WME_AC_VI) ? 5 : \ | ||
759 | ((_ac) == WME_AC_BK) ? 1 : \ | ||
760 | 0) | ||
761 | |||
762 | #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ | ||
763 | struct ether_header { | ||
764 | u8 ether_dhost[ETHER_ADDR_LEN]; | ||
765 | u8 ether_shost[ETHER_ADDR_LEN]; | ||
766 | u16 ether_type; | ||
767 | } __attribute__((packed)); | ||
768 | |||
769 | #ifndef ETHERTYPE_PAE | ||
770 | #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ | ||
771 | #endif | ||
772 | #ifndef ETHERTYPE_IP | ||
773 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ | ||
774 | #endif | ||
775 | |||
776 | struct ieee80211_network { | ||
777 | /* These entries are used to identify a unique network */ | ||
778 | u8 bssid[ETH_ALEN]; | ||
779 | u8 channel; | ||
780 | /* Ensure null-terminated for any debug msgs */ | ||
781 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | ||
782 | u8 ssid_len; | ||
783 | |||
784 | /* These are network statistics */ | ||
785 | struct ieee80211_rx_stats stats; | ||
786 | u16 capability; | ||
787 | u8 rates[MAX_RATES_LENGTH]; | ||
788 | u8 rates_len; | ||
789 | u8 rates_ex[MAX_RATES_EX_LENGTH]; | ||
790 | u8 rates_ex_len; | ||
791 | unsigned long last_scanned; | ||
792 | u8 mode; | ||
793 | u8 flags; | ||
794 | u32 last_associate; | ||
795 | u32 time_stamp[2]; | ||
796 | u16 beacon_interval; | ||
797 | u16 listen_interval; | ||
798 | u16 atim_window; | ||
799 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
800 | size_t wpa_ie_len; | ||
801 | u8 rsn_ie[MAX_WPA_IE_LEN]; | ||
802 | size_t rsn_ie_len; | ||
803 | u8 dtim_period; | ||
804 | u8 dtim_data; | ||
805 | u32 last_dtim_sta_time[2]; | ||
806 | struct list_head list; | ||
807 | //appeded for QoS | ||
808 | u8 wmm_info; | ||
809 | struct ieee80211_wmm_ac_param wmm_param[4]; | ||
810 | u8 QoS_Enable; | ||
811 | u8 SignalStrength; | ||
812 | //by amy 080312 | ||
813 | u8 HighestOperaRate; | ||
814 | //by amy 080312 | ||
815 | u8 Turbo_Enable;//enable turbo mode, added by thomas | ||
816 | u16 CountryIeLen; | ||
817 | u8 CountryIeBuf[MAX_IE_LEN]; | ||
818 | }; | ||
819 | |||
820 | enum ieee80211_state { | ||
821 | |||
822 | /* the card is not linked at all */ | ||
823 | IEEE80211_NOLINK = 0, | ||
824 | |||
825 | /* IEEE80211_ASSOCIATING* are for BSS client mode | ||
826 | * the driver shall not perform RX filtering unless | ||
827 | * the state is LINKED. | ||
828 | * The driver shall just check for the state LINKED and | ||
829 | * defaults to NOLINK for ALL the other states (including | ||
830 | * LINKED_SCANNING) | ||
831 | */ | ||
832 | |||
833 | /* the association procedure will start (wq scheduling)*/ | ||
834 | IEEE80211_ASSOCIATING, | ||
835 | IEEE80211_ASSOCIATING_RETRY, | ||
836 | |||
837 | /* the association procedure is sending AUTH request*/ | ||
838 | IEEE80211_ASSOCIATING_AUTHENTICATING, | ||
839 | |||
840 | /* the association procedure has successfully authenticated | ||
841 | * and is sending association request | ||
842 | */ | ||
843 | IEEE80211_ASSOCIATING_AUTHENTICATED, | ||
844 | |||
845 | /* the link is ok. the card associated to a BSS or linked | ||
846 | * to a ibss cell or acting as an AP and creating the bss | ||
847 | */ | ||
848 | IEEE80211_LINKED, | ||
849 | |||
850 | /* same as LINKED, but the driver shall apply RX filter | ||
851 | * rules as we are in NO_LINK mode. As the card is still | ||
852 | * logically linked, but it is doing a syncro site survey | ||
853 | * then it will be back to LINKED state. | ||
854 | */ | ||
855 | IEEE80211_LINKED_SCANNING, | ||
856 | |||
857 | }; | ||
858 | |||
859 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | ||
860 | #define DEFAULT_FTS 2346 | ||
861 | |||
862 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | ||
863 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | ||
864 | |||
865 | typedef struct tx_pending_t{ | ||
866 | int frag; | ||
867 | struct ieee80211_txb *txb; | ||
868 | }tx_pending_t; | ||
869 | |||
870 | enum { | ||
871 | COUNTRY_CODE_FCC = 0, | ||
872 | COUNTRY_CODE_IC = 1, | ||
873 | COUNTRY_CODE_ETSI = 2, | ||
874 | COUNTRY_CODE_SPAIN = 3, | ||
875 | COUNTRY_CODE_FRANCE = 4, | ||
876 | COUNTRY_CODE_MKK = 5, | ||
877 | COUNTRY_CODE_MKK1 = 6, | ||
878 | COUNTRY_CODE_ISRAEL = 7, | ||
879 | COUNTRY_CODE_TELEC = 8, | ||
880 | COUNTRY_CODE_GLOBAL_DOMAIN = 9, | ||
881 | COUNTRY_CODE_WORLD_WIDE_13_INDEX = 10 | ||
882 | }; | ||
883 | |||
884 | struct ieee80211_device { | ||
885 | struct net_device *dev; | ||
886 | |||
887 | /* Bookkeeping structures */ | ||
888 | struct net_device_stats stats; | ||
889 | struct ieee80211_stats ieee_stats; | ||
890 | struct ieee80211_softmac_stats softmac_stats; | ||
891 | |||
892 | /* Probe / Beacon management */ | ||
893 | struct list_head network_free_list; | ||
894 | struct list_head network_list; | ||
895 | struct ieee80211_network *networks; | ||
896 | int scans; | ||
897 | int scan_age; | ||
898 | |||
899 | int iw_mode; /* operating mode (IW_MODE_*) */ | ||
900 | |||
901 | spinlock_t lock; | ||
902 | spinlock_t wpax_suitlist_lock; | ||
903 | |||
904 | int tx_headroom; /* Set to size of any additional room needed at front | ||
905 | * of allocated Tx SKBs */ | ||
906 | u32 config; | ||
907 | |||
908 | /* WEP and other encryption related settings at the device level */ | ||
909 | int open_wep; /* Set to 1 to allow unencrypted frames */ | ||
910 | |||
911 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on | ||
912 | * WEP key changes */ | ||
913 | |||
914 | /* If the host performs {en,de}cryption, then set to 1 */ | ||
915 | int host_encrypt; | ||
916 | int host_decrypt; | ||
917 | int ieee802_1x; /* is IEEE 802.1X used */ | ||
918 | |||
919 | /* WPA data */ | ||
920 | int wpa_enabled; | ||
921 | int drop_unencrypted; | ||
922 | int tkip_countermeasures; | ||
923 | int privacy_invoked; | ||
924 | size_t wpa_ie_len; | ||
925 | u8 *wpa_ie; | ||
926 | |||
927 | u8 ap_mac_addr[6]; | ||
928 | u16 pairwise_key_type; | ||
929 | u16 broadcast_key_type; | ||
930 | |||
931 | struct list_head crypt_deinit_list; | ||
932 | struct ieee80211_crypt_data *crypt[WEP_KEYS]; | ||
933 | int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ | ||
934 | struct timer_list crypt_deinit_timer; | ||
935 | |||
936 | int bcrx_sta_key; /* use individual keys to override default keys even | ||
937 | * with RX of broad/multicast frames */ | ||
938 | |||
939 | /* Fragmentation structures */ | ||
940 | /* each stream contains an entry */ | ||
941 | struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; | ||
942 | unsigned int frag_next_idx[17]; | ||
943 | u16 fts; /* Fragmentation Threshold */ | ||
944 | |||
945 | /* This stores infos for the current network. | ||
946 | * Either the network we are associated in INFRASTRUCTURE | ||
947 | * or the network that we are creating in MASTER mode. | ||
948 | * ad-hoc is a mixture ;-). | ||
949 | * Note that in infrastructure mode, even when not associated, | ||
950 | * fields bssid and essid may be valid (if wpa_set and essid_set | ||
951 | * are true) as thy carry the value set by the user via iwconfig | ||
952 | */ | ||
953 | struct ieee80211_network current_network; | ||
954 | |||
955 | |||
956 | enum ieee80211_state state; | ||
957 | |||
958 | int short_slot; | ||
959 | int mode; /* A, B, G */ | ||
960 | int modulation; /* CCK, OFDM */ | ||
961 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ | ||
962 | int abg_true; /* ABG flag */ | ||
963 | |||
964 | /* used for forcing the ibss workqueue to terminate | ||
965 | * without wait for the syncro scan to terminate | ||
966 | */ | ||
967 | short sync_scan_hurryup; | ||
968 | |||
969 | void * pDot11dInfo; | ||
970 | bool bGlobalDomain; | ||
971 | |||
972 | // For Liteon Ch12~13 passive scan | ||
973 | u8 MinPassiveChnlNum; | ||
974 | u8 IbssStartChnl; | ||
975 | |||
976 | int rate; /* current rate */ | ||
977 | int basic_rate; | ||
978 | //FIXME: please callback, see if redundant with softmac_features | ||
979 | short active_scan; | ||
980 | |||
981 | /* this contains flags for selectively enable softmac support */ | ||
982 | u16 softmac_features; | ||
983 | |||
984 | /* if the sequence control field is not filled by HW */ | ||
985 | u16 seq_ctrl[5]; | ||
986 | |||
987 | /* association procedure transaction sequence number */ | ||
988 | u16 associate_seq; | ||
989 | |||
990 | /* AID for RTXed association responses */ | ||
991 | u16 assoc_id; | ||
992 | |||
993 | /* power save mode related*/ | ||
994 | short ps; | ||
995 | short sta_sleep; | ||
996 | int ps_timeout; | ||
997 | struct tasklet_struct ps_task; | ||
998 | u32 ps_th; | ||
999 | u32 ps_tl; | ||
1000 | |||
1001 | short raw_tx; | ||
1002 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ | ||
1003 | short queue_stop; | ||
1004 | short scanning; | ||
1005 | short proto_started; | ||
1006 | |||
1007 | struct semaphore wx_sem; | ||
1008 | struct semaphore scan_sem; | ||
1009 | |||
1010 | spinlock_t mgmt_tx_lock; | ||
1011 | spinlock_t beacon_lock; | ||
1012 | |||
1013 | short beacon_txing; | ||
1014 | |||
1015 | short wap_set; | ||
1016 | short ssid_set; | ||
1017 | |||
1018 | u8 wpax_type_set; //{added by David, 2006.9.28} | ||
1019 | u32 wpax_type_notify; //{added by David, 2006.9.26} | ||
1020 | |||
1021 | /* QoS related flag */ | ||
1022 | char init_wmmparam_flag; | ||
1023 | |||
1024 | /* for discarding duplicated packets in IBSS */ | ||
1025 | struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; | ||
1026 | |||
1027 | /* for discarding duplicated packets in BSS */ | ||
1028 | u16 last_rxseq_num[17]; /* rx seq previous per-tid */ | ||
1029 | u16 last_rxfrag_num[17];/* tx frag previous per-tid */ | ||
1030 | unsigned long last_packet_time[17]; | ||
1031 | |||
1032 | /* for PS mode */ | ||
1033 | unsigned long last_rx_ps_time; | ||
1034 | |||
1035 | /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ | ||
1036 | struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; | ||
1037 | int mgmt_queue_head; | ||
1038 | int mgmt_queue_tail; | ||
1039 | |||
1040 | |||
1041 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ | ||
1042 | struct tx_pending_t tx_pending; | ||
1043 | |||
1044 | /* used if IEEE_SOFTMAC_ASSOCIATE is set */ | ||
1045 | struct timer_list associate_timer; | ||
1046 | |||
1047 | /* used if IEEE_SOFTMAC_BEACONS is set */ | ||
1048 | struct timer_list beacon_timer; | ||
1049 | |||
1050 | struct work_struct associate_complete_wq; | ||
1051 | // struct work_struct associate_retry_wq; | ||
1052 | struct work_struct associate_procedure_wq; | ||
1053 | // struct work_struct softmac_scan_wq; | ||
1054 | struct work_struct wx_sync_scan_wq; | ||
1055 | struct work_struct wmm_param_update_wq; | ||
1056 | struct work_struct ps_request_tx_ack_wq;//for ps | ||
1057 | // struct work_struct hw_wakeup_wq; | ||
1058 | // struct work_struct hw_sleep_wq; | ||
1059 | // struct work_struct watch_dog_wq; | ||
1060 | bool bInactivePs; | ||
1061 | bool actscanning; | ||
1062 | bool beinretry; | ||
1063 | u16 ListenInterval; | ||
1064 | unsigned long NumRxDataInPeriod; //YJ,add,080828 | ||
1065 | unsigned long NumRxBcnInPeriod; //YJ,add,080828 | ||
1066 | unsigned long NumRxOkTotal; | ||
1067 | unsigned long NumRxUnicast;//YJ,add,080828,for keep alive | ||
1068 | bool bHwRadioOff; | ||
1069 | struct delayed_work softmac_scan_wq; | ||
1070 | struct delayed_work associate_retry_wq; | ||
1071 | struct delayed_work hw_wakeup_wq; | ||
1072 | struct delayed_work hw_sleep_wq;//+by amy 080324 | ||
1073 | struct delayed_work watch_dog_wq; | ||
1074 | struct delayed_work sw_antenna_wq; | ||
1075 | struct delayed_work start_ibss_wq; | ||
1076 | //by amy for rate adaptive 080312 | ||
1077 | struct delayed_work rate_adapter_wq; | ||
1078 | //by amy for rate adaptive | ||
1079 | struct delayed_work hw_dig_wq; | ||
1080 | struct delayed_work tx_pw_wq; | ||
1081 | |||
1082 | //Added for RF power on power off by lizhaoming 080512 | ||
1083 | struct delayed_work GPIOChangeRFWorkItem; | ||
1084 | |||
1085 | struct workqueue_struct *wq; | ||
1086 | |||
1087 | /* Callback functions */ | ||
1088 | void (*set_security)(struct net_device *dev, | ||
1089 | struct ieee80211_security *sec); | ||
1090 | |||
1091 | /* Used to TX data frame by using txb structs. | ||
1092 | * this is not used if in the softmac_features | ||
1093 | * is set the flag IEEE_SOFTMAC_TX_QUEUE | ||
1094 | */ | ||
1095 | int (*hard_start_xmit)(struct ieee80211_txb *txb, | ||
1096 | struct net_device *dev); | ||
1097 | |||
1098 | int (*reset_port)(struct net_device *dev); | ||
1099 | |||
1100 | /* Softmac-generated frames (management) are TXed via this | ||
1101 | * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is | ||
1102 | * not set. As some cards may have different HW queues that | ||
1103 | * one might want to use for data and management frames | ||
1104 | * the option to have two callbacks might be useful. | ||
1105 | * This function can't sleep. | ||
1106 | */ | ||
1107 | int (*softmac_hard_start_xmit)(struct sk_buff *skb, | ||
1108 | struct net_device *dev); | ||
1109 | |||
1110 | /* used instead of hard_start_xmit (not softmac_hard_start_xmit) | ||
1111 | * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data | ||
1112 | * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set | ||
1113 | * then also management frames are sent via this callback. | ||
1114 | * This function can't sleep. | ||
1115 | */ | ||
1116 | void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, | ||
1117 | struct net_device *dev,int rate); | ||
1118 | |||
1119 | /* stops the HW queue for DATA frames. Useful to avoid | ||
1120 | * waste time to TX data frame when we are reassociating | ||
1121 | * This function can sleep. | ||
1122 | */ | ||
1123 | void (*data_hard_stop)(struct net_device *dev); | ||
1124 | |||
1125 | /* OK this is complementar to data_poll_hard_stop */ | ||
1126 | void (*data_hard_resume)(struct net_device *dev); | ||
1127 | |||
1128 | /* ask to the driver to retune the radio . | ||
1129 | * This function can sleep. the driver should ensure | ||
1130 | * the radio has been switched before return. | ||
1131 | */ | ||
1132 | void (*set_chan)(struct net_device *dev,short ch); | ||
1133 | |||
1134 | /* These are not used if the ieee stack takes care of | ||
1135 | * scanning (IEEE_SOFTMAC_SCAN feature set). | ||
1136 | * In this case only the set_chan is used. | ||
1137 | * | ||
1138 | * The syncro version is similar to the start_scan but | ||
1139 | * does not return until all channels has been scanned. | ||
1140 | * this is called in user context and should sleep, | ||
1141 | * it is called in a work_queue when switching to ad-hoc mode | ||
1142 | * or in behalf of iwlist scan when the card is associated | ||
1143 | * and root user ask for a scan. | ||
1144 | * the function stop_scan should stop both the syncro and | ||
1145 | * background scanning and can sleep. | ||
1146 | * The function start_scan should initiate the background | ||
1147 | * scanning and can't sleep. | ||
1148 | */ | ||
1149 | void (*scan_syncro)(struct net_device *dev); | ||
1150 | void (*start_scan)(struct net_device *dev); | ||
1151 | void (*stop_scan)(struct net_device *dev); | ||
1152 | |||
1153 | /* indicate the driver that the link state is changed | ||
1154 | * for example it may indicate the card is associated now. | ||
1155 | * Driver might be interested in this to apply RX filter | ||
1156 | * rules or simply light the LINK led | ||
1157 | */ | ||
1158 | void (*link_change)(struct net_device *dev); | ||
1159 | |||
1160 | /* these two function indicates to the HW when to start | ||
1161 | * and stop to send beacons. This is used when the | ||
1162 | * IEEE_SOFTMAC_BEACONS is not set. For now the | ||
1163 | * stop_send_bacons is NOT guaranteed to be called only | ||
1164 | * after start_send_beacons. | ||
1165 | */ | ||
1166 | void (*start_send_beacons) (struct net_device *dev); | ||
1167 | void (*stop_send_beacons) (struct net_device *dev); | ||
1168 | |||
1169 | /* power save mode related */ | ||
1170 | void (*sta_wake_up) (struct net_device *dev); | ||
1171 | void (*ps_request_tx_ack) (struct net_device *dev); | ||
1172 | void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); | ||
1173 | short (*ps_is_queue_empty) (struct net_device *dev); | ||
1174 | |||
1175 | /* QoS related */ | ||
1176 | //void (*wmm_param_update) (struct net_device *dev, u8 *ac_param); | ||
1177 | //void (*wmm_param_update) (struct ieee80211_device *ieee); | ||
1178 | |||
1179 | /* This must be the last item so that it points to the data | ||
1180 | * allocated beyond this structure by alloc_ieee80211 */ | ||
1181 | u8 priv[0]; | ||
1182 | }; | ||
1183 | |||
1184 | #define IEEE_A (1<<0) | ||
1185 | #define IEEE_B (1<<1) | ||
1186 | #define IEEE_G (1<<2) | ||
1187 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) | ||
1188 | |||
1189 | /* Generate a 802.11 header */ | ||
1190 | |||
1191 | /* Uses the channel change callback directly | ||
1192 | * instead of [start/stop] scan callbacks | ||
1193 | */ | ||
1194 | #define IEEE_SOFTMAC_SCAN (1<<2) | ||
1195 | |||
1196 | /* Perform authentication and association handshake */ | ||
1197 | #define IEEE_SOFTMAC_ASSOCIATE (1<<3) | ||
1198 | |||
1199 | /* Generate probe requests */ | ||
1200 | #define IEEE_SOFTMAC_PROBERQ (1<<4) | ||
1201 | |||
1202 | /* Generate response to probe requests */ | ||
1203 | #define IEEE_SOFTMAC_PROBERS (1<<5) | ||
1204 | |||
1205 | /* The ieee802.11 stack will manages the netif queue | ||
1206 | * wake/stop for the driver, taking care of 802.11 | ||
1207 | * fragmentation. See softmac.c for details. */ | ||
1208 | #define IEEE_SOFTMAC_TX_QUEUE (1<<7) | ||
1209 | |||
1210 | /* Uses only the softmac_data_hard_start_xmit | ||
1211 | * even for TX management frames. | ||
1212 | */ | ||
1213 | #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) | ||
1214 | |||
1215 | /* Generate beacons. The stack will enqueue beacons | ||
1216 | * to the card | ||
1217 | */ | ||
1218 | #define IEEE_SOFTMAC_BEACONS (1<<6) | ||
1219 | |||
1220 | |||
1221 | |||
1222 | static inline void *ieee80211_priv(struct net_device *dev) | ||
1223 | { | ||
1224 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | ||
1225 | } | ||
1226 | |||
1227 | static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | ||
1228 | { | ||
1229 | /* Single white space is for Linksys APs */ | ||
1230 | if (essid_len == 1 && essid[0] == ' ') | ||
1231 | return 1; | ||
1232 | |||
1233 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ | ||
1234 | while (essid_len) { | ||
1235 | essid_len--; | ||
1236 | if (essid[essid_len] != '\0') | ||
1237 | return 0; | ||
1238 | } | ||
1239 | |||
1240 | return 1; | ||
1241 | } | ||
1242 | |||
1243 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, | ||
1244 | int mode) | ||
1245 | { | ||
1246 | /* | ||
1247 | * It is possible for both access points and our device to support | ||
1248 | * combinations of modes, so as long as there is one valid combination | ||
1249 | * of ap/device supported modes, then return success | ||
1250 | * | ||
1251 | */ | ||
1252 | if ((mode & IEEE_A) && | ||
1253 | (ieee->modulation & IEEE80211_OFDM_MODULATION) && | ||
1254 | (ieee->freq_band & IEEE80211_52GHZ_BAND)) | ||
1255 | return 1; | ||
1256 | |||
1257 | if ((mode & IEEE_G) && | ||
1258 | (ieee->modulation & IEEE80211_OFDM_MODULATION) && | ||
1259 | (ieee->freq_band & IEEE80211_24GHZ_BAND)) | ||
1260 | return 1; | ||
1261 | |||
1262 | if ((mode & IEEE_B) && | ||
1263 | (ieee->modulation & IEEE80211_CCK_MODULATION) && | ||
1264 | (ieee->freq_band & IEEE80211_24GHZ_BAND)) | ||
1265 | return 1; | ||
1266 | |||
1267 | return 0; | ||
1268 | } | ||
1269 | |||
1270 | static inline int ieee80211_get_hdrlen(u16 fc) | ||
1271 | { | ||
1272 | int hdrlen = 24; | ||
1273 | |||
1274 | switch (WLAN_FC_GET_TYPE(fc)) { | ||
1275 | case IEEE80211_FTYPE_DATA: | ||
1276 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | ||
1277 | hdrlen = 30; /* Addr4 */ | ||
1278 | if(IEEE80211_QOS_HAS_SEQ(fc)) | ||
1279 | hdrlen += 2; /* QOS ctrl*/ | ||
1280 | break; | ||
1281 | case IEEE80211_FTYPE_CTL: | ||
1282 | switch (WLAN_FC_GET_STYPE(fc)) { | ||
1283 | case IEEE80211_STYPE_CTS: | ||
1284 | case IEEE80211_STYPE_ACK: | ||
1285 | hdrlen = 10; | ||
1286 | break; | ||
1287 | default: | ||
1288 | hdrlen = 16; | ||
1289 | break; | ||
1290 | } | ||
1291 | break; | ||
1292 | } | ||
1293 | |||
1294 | return hdrlen; | ||
1295 | } | ||
1296 | |||
1297 | |||
1298 | |||
1299 | /* ieee80211.c */ | ||
1300 | extern void free_ieee80211(struct net_device *dev); | ||
1301 | extern struct net_device *alloc_ieee80211(int sizeof_priv); | ||
1302 | |||
1303 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | ||
1304 | |||
1305 | /* ieee80211_tx.c */ | ||
1306 | |||
1307 | extern int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, | ||
1308 | struct sk_buff *frag, int hdr_len); | ||
1309 | |||
1310 | extern int ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev); | ||
1311 | extern void ieee80211_txb_free(struct ieee80211_txb *); | ||
1312 | |||
1313 | |||
1314 | /* ieee80211_rx.c */ | ||
1315 | extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
1316 | struct ieee80211_rx_stats *rx_stats); | ||
1317 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | ||
1318 | struct ieee80211_hdr_4addr *header, | ||
1319 | struct ieee80211_rx_stats *stats); | ||
1320 | |||
1321 | /* ieee80211_wx.c */ | ||
1322 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | ||
1323 | struct iw_request_info *info, | ||
1324 | union iwreq_data *wrqu, char *key); | ||
1325 | extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | ||
1326 | struct iw_request_info *info, | ||
1327 | union iwreq_data *wrqu, char *key); | ||
1328 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | ||
1329 | struct iw_request_info *info, | ||
1330 | union iwreq_data *wrqu, char *key); | ||
1331 | extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, | ||
1332 | struct iw_request_info *info, | ||
1333 | union iwreq_data *wrqu, char *extra); | ||
1334 | int ieee80211_wx_set_auth(struct ieee80211_device *ieee, | ||
1335 | struct iw_request_info *info, | ||
1336 | struct iw_param *data, char *extra); | ||
1337 | int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, | ||
1338 | struct iw_request_info *info, | ||
1339 | union iwreq_data *wrqu, char *extra); | ||
1340 | |||
1341 | int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); | ||
1342 | /* ieee80211_softmac.c */ | ||
1343 | extern short ieee80211_is_54g(const struct ieee80211_network *net); | ||
1344 | extern short ieee80211_is_shortslot(const struct ieee80211_network *net); | ||
1345 | extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, | ||
1346 | struct sk_buff *skb, | ||
1347 | struct ieee80211_rx_stats *rx_stats, | ||
1348 | u16 type, u16 stype); | ||
1349 | extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, | ||
1350 | struct ieee80211_network *net); | ||
1351 | |||
1352 | extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, | ||
1353 | struct ieee80211_device *ieee); | ||
1354 | extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); | ||
1355 | extern void ieee80211_start_bss(struct ieee80211_device *ieee); | ||
1356 | extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); | ||
1357 | extern void ieee80211_start_ibss(struct ieee80211_device *ieee); | ||
1358 | extern void ieee80211_softmac_init(struct ieee80211_device *ieee); | ||
1359 | extern void ieee80211_softmac_free(struct ieee80211_device *ieee); | ||
1360 | extern void ieee80211_associate_abort(struct ieee80211_device *ieee); | ||
1361 | extern void ieee80211_disassociate(struct ieee80211_device *ieee); | ||
1362 | extern void ieee80211_stop_scan(struct ieee80211_device *ieee); | ||
1363 | extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); | ||
1364 | extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); | ||
1365 | extern void ieee80211_start_protocol(struct ieee80211_device *ieee); | ||
1366 | extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); | ||
1367 | extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); | ||
1368 | extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); | ||
1369 | extern void ieee80211_reset_queue(struct ieee80211_device *ieee); | ||
1370 | extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee); | ||
1371 | extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee); | ||
1372 | extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); | ||
1373 | extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); | ||
1374 | extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); | ||
1375 | extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, | ||
1376 | struct iw_point *p); | ||
1377 | extern void notify_wx_assoc_event(struct ieee80211_device *ieee); | ||
1378 | extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); | ||
1379 | extern void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, | ||
1380 | u8 asRsn); | ||
1381 | extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee); | ||
1382 | |||
1383 | //Add for RF power on power off by lizhaoming 080512 | ||
1384 | extern void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, | ||
1385 | u8 asRsn); | ||
1386 | |||
1387 | /* ieee80211_crypt_ccmp&tkip&wep.c */ | ||
1388 | extern void ieee80211_tkip_null(void); | ||
1389 | extern void ieee80211_wep_null(void); | ||
1390 | extern void ieee80211_ccmp_null(void); | ||
1391 | /* ieee80211_softmac_wx.c */ | ||
1392 | |||
1393 | extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, | ||
1394 | struct iw_request_info *info, | ||
1395 | union iwreq_data *wrqu, char *ext); | ||
1396 | |||
1397 | extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, | ||
1398 | struct iw_request_info *info, | ||
1399 | union iwreq_data *awrq, | ||
1400 | char *extra); | ||
1401 | |||
1402 | extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, | ||
1403 | struct iw_request_info *a, | ||
1404 | union iwreq_data *wrqu, char *b); | ||
1405 | |||
1406 | extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, | ||
1407 | struct iw_request_info *info, | ||
1408 | union iwreq_data *wrqu, char *extra); | ||
1409 | |||
1410 | extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, | ||
1411 | struct iw_request_info *info, | ||
1412 | union iwreq_data *wrqu, char *extra); | ||
1413 | |||
1414 | extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, | ||
1415 | struct iw_request_info *a, | ||
1416 | union iwreq_data *wrqu, char *b); | ||
1417 | |||
1418 | extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, | ||
1419 | struct iw_request_info *a, | ||
1420 | union iwreq_data *wrqu, char *b); | ||
1421 | |||
1422 | extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, | ||
1423 | struct iw_request_info *a, | ||
1424 | union iwreq_data *wrqu, char *extra); | ||
1425 | |||
1426 | extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, | ||
1427 | struct iw_request_info *a, | ||
1428 | union iwreq_data *wrqu, char *b); | ||
1429 | |||
1430 | extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, | ||
1431 | struct iw_request_info *a, | ||
1432 | union iwreq_data *wrqu, char *b); | ||
1433 | |||
1434 | extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, | ||
1435 | struct iw_request_info *a, | ||
1436 | union iwreq_data *wrqu, char *b); | ||
1437 | |||
1438 | extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); | ||
1439 | |||
1440 | extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, | ||
1441 | struct iw_request_info *info, | ||
1442 | union iwreq_data *wrqu, char *extra); | ||
1443 | |||
1444 | extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, | ||
1445 | struct iw_request_info *info, | ||
1446 | union iwreq_data *wrqu, char *extra); | ||
1447 | |||
1448 | extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, | ||
1449 | struct iw_request_info *info, | ||
1450 | union iwreq_data *wrqu, char *extra); | ||
1451 | |||
1452 | extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, | ||
1453 | struct iw_request_info *info, | ||
1454 | union iwreq_data *wrqu, char *extra); | ||
1455 | |||
1456 | extern void ieee80211_softmac_ips_scan_syncro(struct ieee80211_device *ieee); | ||
1457 | |||
1458 | extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, | ||
1459 | short pwr); | ||
1460 | |||
1461 | extern const long ieee80211_wlan_frequencies[]; | ||
1462 | |||
1463 | extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | ||
1464 | { | ||
1465 | ieee->scans++; | ||
1466 | } | ||
1467 | |||
1468 | extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) | ||
1469 | { | ||
1470 | return ieee->scans; | ||
1471 | } | ||
1472 | |||
1473 | static inline const char *escape_essid(const char *essid, u8 essid_len) { | ||
1474 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
1475 | const char *s = essid; | ||
1476 | char *d = escaped; | ||
1477 | |||
1478 | if (ieee80211_is_empty_essid(essid, essid_len)) { | ||
1479 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
1480 | return escaped; | ||
1481 | } | ||
1482 | |||
1483 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | ||
1484 | while (essid_len--) { | ||
1485 | if (*s == '\0') { | ||
1486 | *d++ = '\\'; | ||
1487 | *d++ = '0'; | ||
1488 | s++; | ||
1489 | } else { | ||
1490 | *d++ = *s++; | ||
1491 | } | ||
1492 | } | ||
1493 | *d = '\0'; | ||
1494 | return escaped; | ||
1495 | } | ||
1496 | #endif /* IEEE80211_H */ | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c deleted file mode 100644 index 101f0c0cdb0a..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* | ||
2 | * Host AP crypto routines | ||
3 | * | ||
4 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * Portions Copyright (C) 2004, Intel Corporation <jketreno@linux.intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. See README and COPYING for | ||
10 | * more details. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
16 | //#include <linux/config.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/errno.h> | ||
21 | |||
22 | #include "ieee80211.h" | ||
23 | |||
24 | MODULE_AUTHOR("Jouni Malinen"); | ||
25 | MODULE_DESCRIPTION("HostAP crypto"); | ||
26 | MODULE_LICENSE("GPL"); | ||
27 | |||
28 | struct ieee80211_crypto_alg { | ||
29 | struct list_head list; | ||
30 | struct ieee80211_crypto_ops *ops; | ||
31 | }; | ||
32 | |||
33 | |||
34 | struct ieee80211_crypto { | ||
35 | struct list_head algs; | ||
36 | spinlock_t lock; | ||
37 | }; | ||
38 | |||
39 | static struct ieee80211_crypto *hcrypt; | ||
40 | |||
41 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) | ||
42 | { | ||
43 | struct list_head *ptr, *n; | ||
44 | struct ieee80211_crypt_data *entry; | ||
45 | |||
46 | for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; | ||
47 | ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { | ||
48 | entry = list_entry(ptr, struct ieee80211_crypt_data, list); | ||
49 | |||
50 | if (atomic_read(&entry->refcnt) != 0 && !force) | ||
51 | continue; | ||
52 | |||
53 | list_del(ptr); | ||
54 | |||
55 | if (entry->ops) | ||
56 | entry->ops->deinit(entry->priv); | ||
57 | kfree(entry); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | void ieee80211_crypt_deinit_handler(unsigned long data) | ||
62 | { | ||
63 | struct ieee80211_device *ieee = (struct ieee80211_device *)data; | ||
64 | unsigned long flags; | ||
65 | |||
66 | spin_lock_irqsave(&ieee->lock, flags); | ||
67 | ieee80211_crypt_deinit_entries(ieee, 0); | ||
68 | if (!list_empty(&ieee->crypt_deinit_list)) { | ||
69 | pr_debug("entries remaining in delayed crypt deletion list\n"); | ||
70 | ieee->crypt_deinit_timer.expires = jiffies + HZ; | ||
71 | add_timer(&ieee->crypt_deinit_timer); | ||
72 | } | ||
73 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
74 | |||
75 | } | ||
76 | |||
77 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | ||
78 | struct ieee80211_crypt_data **crypt) | ||
79 | { | ||
80 | struct ieee80211_crypt_data *tmp; | ||
81 | unsigned long flags; | ||
82 | |||
83 | if (*crypt == NULL) | ||
84 | return; | ||
85 | |||
86 | tmp = *crypt; | ||
87 | *crypt = NULL; | ||
88 | |||
89 | /* must not run ops->deinit() while there may be pending encrypt or | ||
90 | * decrypt operations. Use a list of delayed deinits to avoid needing | ||
91 | * locking. */ | ||
92 | |||
93 | spin_lock_irqsave(&ieee->lock, flags); | ||
94 | list_add(&tmp->list, &ieee->crypt_deinit_list); | ||
95 | if (!timer_pending(&ieee->crypt_deinit_timer)) { | ||
96 | ieee->crypt_deinit_timer.expires = jiffies + HZ; | ||
97 | add_timer(&ieee->crypt_deinit_timer); | ||
98 | } | ||
99 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
100 | } | ||
101 | |||
102 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | struct ieee80211_crypto_alg *alg; | ||
106 | |||
107 | if (hcrypt == NULL) | ||
108 | return -1; | ||
109 | |||
110 | alg = kzalloc(sizeof(*alg), GFP_KERNEL); | ||
111 | if (alg == NULL) | ||
112 | return -ENOMEM; | ||
113 | |||
114 | alg->ops = ops; | ||
115 | |||
116 | spin_lock_irqsave(&hcrypt->lock, flags); | ||
117 | list_add(&alg->list, &hcrypt->algs); | ||
118 | spin_unlock_irqrestore(&hcrypt->lock, flags); | ||
119 | |||
120 | pr_debug("registered algorithm '%s'\n", ops->name); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | ||
126 | { | ||
127 | unsigned long flags; | ||
128 | struct list_head *ptr; | ||
129 | struct ieee80211_crypto_alg *del_alg = NULL; | ||
130 | |||
131 | if (hcrypt == NULL) | ||
132 | return -1; | ||
133 | |||
134 | spin_lock_irqsave(&hcrypt->lock, flags); | ||
135 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | ||
136 | struct ieee80211_crypto_alg *alg = | ||
137 | (struct ieee80211_crypto_alg *) ptr; | ||
138 | if (alg->ops == ops) { | ||
139 | list_del(&alg->list); | ||
140 | del_alg = alg; | ||
141 | break; | ||
142 | } | ||
143 | } | ||
144 | spin_unlock_irqrestore(&hcrypt->lock, flags); | ||
145 | |||
146 | if (del_alg) { | ||
147 | pr_debug("unregistered algorithm '%s'\n", ops->name); | ||
148 | kfree(del_alg); | ||
149 | } | ||
150 | |||
151 | return del_alg ? 0 : -1; | ||
152 | } | ||
153 | |||
154 | |||
155 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) | ||
156 | { | ||
157 | unsigned long flags; | ||
158 | struct list_head *ptr; | ||
159 | struct ieee80211_crypto_alg *found_alg = NULL; | ||
160 | |||
161 | if (hcrypt == NULL) | ||
162 | return NULL; | ||
163 | |||
164 | spin_lock_irqsave(&hcrypt->lock, flags); | ||
165 | for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { | ||
166 | struct ieee80211_crypto_alg *alg = | ||
167 | (struct ieee80211_crypto_alg *) ptr; | ||
168 | if (strcmp(alg->ops->name, name) == 0) { | ||
169 | found_alg = alg; | ||
170 | break; | ||
171 | } | ||
172 | } | ||
173 | spin_unlock_irqrestore(&hcrypt->lock, flags); | ||
174 | |||
175 | if (found_alg) | ||
176 | return found_alg->ops; | ||
177 | else | ||
178 | return NULL; | ||
179 | } | ||
180 | |||
181 | |||
182 | static void *ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } | ||
183 | static void ieee80211_crypt_null_deinit(void *priv) {} | ||
184 | |||
185 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { | ||
186 | .name = "NULL", | ||
187 | .init = ieee80211_crypt_null_init, | ||
188 | .deinit = ieee80211_crypt_null_deinit, | ||
189 | .encrypt_mpdu = NULL, | ||
190 | .decrypt_mpdu = NULL, | ||
191 | .encrypt_msdu = NULL, | ||
192 | .decrypt_msdu = NULL, | ||
193 | .set_key = NULL, | ||
194 | .get_key = NULL, | ||
195 | .extra_prefix_len = 0, | ||
196 | .extra_postfix_len = 0, | ||
197 | .owner = THIS_MODULE, | ||
198 | }; | ||
199 | |||
200 | |||
201 | int ieee80211_crypto_init(void) | ||
202 | { | ||
203 | int ret = -ENOMEM; | ||
204 | |||
205 | hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL); | ||
206 | if (!hcrypt) | ||
207 | goto out; | ||
208 | |||
209 | INIT_LIST_HEAD(&hcrypt->algs); | ||
210 | spin_lock_init(&hcrypt->lock); | ||
211 | |||
212 | ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); | ||
213 | if (ret < 0) { | ||
214 | kfree(hcrypt); | ||
215 | hcrypt = NULL; | ||
216 | } | ||
217 | out: | ||
218 | return ret; | ||
219 | } | ||
220 | |||
221 | |||
222 | void ieee80211_crypto_deinit(void) | ||
223 | { | ||
224 | struct list_head *ptr, *n; | ||
225 | struct ieee80211_crypto_alg *alg = NULL; | ||
226 | |||
227 | if (hcrypt == NULL) | ||
228 | return; | ||
229 | |||
230 | list_for_each_safe(ptr, n, &hcrypt->algs) { | ||
231 | alg = list_entry(ptr, struct ieee80211_crypto_alg, list); | ||
232 | if (alg) { | ||
233 | list_del(ptr); | ||
234 | pr_debug("unregistered algorithm '%s' (deinit)\n", | ||
235 | alg->ops->name); | ||
236 | kfree(alg); | ||
237 | } | ||
238 | } | ||
239 | kfree(hcrypt); | ||
240 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h deleted file mode 100644 index 0b4ea431982d..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * Original code based on Host AP (software wireless LAN access point) driver | ||
3 | * for Intersil Prism2/2.5/3. | ||
4 | * | ||
5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
6 | * <jkmaline@cc.hut.fi> | ||
7 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
8 | * | ||
9 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | ||
10 | * <jketreno@linux.intel.com> | ||
11 | * | ||
12 | * Copyright (c) 2004, Intel Corporation | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. See README and COPYING for | ||
17 | * more details. | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * This file defines the interface to the ieee80211 crypto module. | ||
22 | */ | ||
23 | #ifndef IEEE80211_CRYPT_H | ||
24 | #define IEEE80211_CRYPT_H | ||
25 | |||
26 | #include <linux/skbuff.h> | ||
27 | |||
28 | struct ieee80211_crypto_ops { | ||
29 | const char *name; | ||
30 | |||
31 | /* init new crypto context (e.g., allocate private data space, | ||
32 | * select IV, etc.); returns NULL on failure or pointer to allocated | ||
33 | * private data on success */ | ||
34 | void * (*init)(int keyidx); | ||
35 | |||
36 | /* deinitialize crypto context and free allocated private data */ | ||
37 | void (*deinit)(void *priv); | ||
38 | |||
39 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return | ||
40 | * value from decrypt_mpdu is passed as the keyidx value for | ||
41 | * decrypt_msdu. skb must have enough head and tail room for the | ||
42 | * encryption; if not, error will be returned; these functions are | ||
43 | * called for all MPDUs (i.e., fragments). | ||
44 | */ | ||
45 | int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); | ||
46 | int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); | ||
47 | |||
48 | /* These functions are called for full MSDUs, i.e. full frames. | ||
49 | * These can be NULL if full MSDU operations are not needed. */ | ||
50 | int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); | ||
51 | int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, | ||
52 | void *priv); | ||
53 | |||
54 | int (*set_key)(void *key, int len, u8 *seq, void *priv); | ||
55 | int (*get_key)(void *key, int len, u8 *seq, void *priv); | ||
56 | |||
57 | /* procfs handler for printing out key information and possible | ||
58 | * statistics */ | ||
59 | char * (*print_stats)(char *p, void *priv); | ||
60 | |||
61 | /* maximum number of bytes added by encryption; encrypt buf is | ||
62 | * allocated with extra_prefix_len bytes, copy of in_buf, and | ||
63 | * extra_postfix_len; encrypt need not use all this space, but | ||
64 | * the result must start at the beginning of the buffer and correct | ||
65 | * length must be returned */ | ||
66 | int extra_prefix_len, extra_postfix_len; | ||
67 | |||
68 | struct module *owner; | ||
69 | }; | ||
70 | |||
71 | struct ieee80211_crypt_data { | ||
72 | struct list_head list; /* delayed deletion list */ | ||
73 | struct ieee80211_crypto_ops *ops; | ||
74 | void *priv; | ||
75 | atomic_t refcnt; | ||
76 | }; | ||
77 | |||
78 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | ||
79 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | ||
80 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); | ||
81 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | ||
82 | void ieee80211_crypt_deinit_handler(unsigned long); | ||
83 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | ||
84 | struct ieee80211_crypt_data **crypt); | ||
85 | |||
86 | #endif | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c deleted file mode 100644 index 4fe253818630..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ /dev/null | |||
@@ -1,455 +0,0 @@ | |||
1 | /* | ||
2 | * Host AP crypt: host-based CCMP encryption implementation for Host AP driver | ||
3 | * | ||
4 | * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. See README and COPYING for | ||
9 | * more details. | ||
10 | */ | ||
11 | |||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/random.h> | ||
17 | #include <linux/skbuff.h> | ||
18 | #include <linux/netdevice.h> | ||
19 | #include <linux/if_ether.h> | ||
20 | #include <linux/if_arp.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/wireless.h> | ||
23 | |||
24 | #include "ieee80211.h" | ||
25 | |||
26 | #include <linux/crypto.h> | ||
27 | #include <linux/scatterlist.h> | ||
28 | |||
29 | MODULE_AUTHOR("Jouni Malinen"); | ||
30 | MODULE_DESCRIPTION("Host AP crypt: CCMP"); | ||
31 | MODULE_LICENSE("GPL"); | ||
32 | |||
33 | |||
34 | #define AES_BLOCK_LEN 16 | ||
35 | #define CCMP_HDR_LEN 8 | ||
36 | #define CCMP_MIC_LEN 8 | ||
37 | #define CCMP_TK_LEN 16 | ||
38 | #define CCMP_PN_LEN 6 | ||
39 | |||
40 | struct ieee80211_ccmp_data { | ||
41 | u8 key[CCMP_TK_LEN]; | ||
42 | int key_set; | ||
43 | |||
44 | u8 tx_pn[CCMP_PN_LEN]; | ||
45 | u8 rx_pn[CCMP_PN_LEN]; | ||
46 | |||
47 | u32 dot11RSNAStatsCCMPFormatErrors; | ||
48 | u32 dot11RSNAStatsCCMPReplays; | ||
49 | u32 dot11RSNAStatsCCMPDecryptErrors; | ||
50 | |||
51 | int key_idx; | ||
52 | |||
53 | struct crypto_tfm *tfm; | ||
54 | |||
55 | /* scratch buffers for virt_to_page() (crypto API) */ | ||
56 | u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], | ||
57 | tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; | ||
58 | u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; | ||
59 | }; | ||
60 | |||
61 | static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, | ||
62 | const u8 pt[16], u8 ct[16]) | ||
63 | { | ||
64 | crypto_cipher_encrypt_one((void *)tfm, ct, pt); | ||
65 | } | ||
66 | |||
67 | static void *ieee80211_ccmp_init(int key_idx) | ||
68 | { | ||
69 | struct ieee80211_ccmp_data *priv; | ||
70 | |||
71 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); | ||
72 | if (priv == NULL) | ||
73 | goto fail; | ||
74 | priv->key_idx = key_idx; | ||
75 | |||
76 | priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); | ||
77 | if (IS_ERR(priv->tfm)) { | ||
78 | pr_debug("could not allocate crypto API aes\n"); | ||
79 | priv->tfm = NULL; | ||
80 | goto fail; | ||
81 | } | ||
82 | |||
83 | return priv; | ||
84 | |||
85 | fail: | ||
86 | if (priv) { | ||
87 | if (priv->tfm) | ||
88 | crypto_free_cipher((void *)priv->tfm); | ||
89 | kfree(priv); | ||
90 | } | ||
91 | |||
92 | return NULL; | ||
93 | } | ||
94 | |||
95 | |||
96 | static void ieee80211_ccmp_deinit(void *priv) | ||
97 | { | ||
98 | struct ieee80211_ccmp_data *_priv = priv; | ||
99 | |||
100 | if (_priv && _priv->tfm) | ||
101 | crypto_free_cipher((void *)_priv->tfm); | ||
102 | kfree(priv); | ||
103 | } | ||
104 | |||
105 | |||
106 | static inline void xor_block(u8 *b, u8 *a, size_t len) | ||
107 | { | ||
108 | int i; | ||
109 | for (i = 0; i < len; i++) | ||
110 | b[i] ^= a[i]; | ||
111 | } | ||
112 | |||
113 | static void ccmp_init_blocks(struct crypto_tfm *tfm, | ||
114 | struct ieee80211_hdr_4addr *hdr, | ||
115 | u8 *pn, size_t dlen, u8 *b0, u8 *auth, | ||
116 | u8 *s0) | ||
117 | { | ||
118 | u8 *pos, qc = 0; | ||
119 | size_t aad_len; | ||
120 | u16 fc; | ||
121 | int a4_included, qc_included; | ||
122 | u8 aad[2 * AES_BLOCK_LEN]; | ||
123 | |||
124 | fc = le16_to_cpu(hdr->frame_ctl); | ||
125 | a4_included = ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | ||
126 | (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)); | ||
127 | /* | ||
128 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && | ||
129 | (WLAN_FC_GET_STYPE(fc) & 0x08)); | ||
130 | */ | ||
131 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && | ||
132 | (WLAN_FC_GET_STYPE(fc) & 0x80)); | ||
133 | aad_len = 22; | ||
134 | if (a4_included) | ||
135 | aad_len += 6; | ||
136 | if (qc_included) { | ||
137 | pos = (u8 *) &hdr->addr4; | ||
138 | if (a4_included) | ||
139 | pos += 6; | ||
140 | qc = *pos & 0x0f; | ||
141 | aad_len += 2; | ||
142 | } | ||
143 | /* CCM Initial Block: | ||
144 | * Flag (Include authentication header, M=3 (8-octet MIC), | ||
145 | * L=1 (2-octet Dlen)) | ||
146 | * Nonce: 0x00 | A2 | PN | ||
147 | * Dlen */ | ||
148 | b0[0] = 0x59; | ||
149 | b0[1] = qc; | ||
150 | memcpy(b0 + 2, hdr->addr2, ETH_ALEN); | ||
151 | memcpy(b0 + 8, pn, CCMP_PN_LEN); | ||
152 | b0[14] = (dlen >> 8) & 0xff; | ||
153 | b0[15] = dlen & 0xff; | ||
154 | |||
155 | /* AAD: | ||
156 | * FC with bits 4..6 and 11..13 masked to zero; 14 is always one | ||
157 | * A1 | A2 | A3 | ||
158 | * SC with bits 4..15 (seq#) masked to zero | ||
159 | * A4 (if present) | ||
160 | * QC (if present) | ||
161 | */ | ||
162 | pos = (u8 *) hdr; | ||
163 | aad[0] = 0; /* aad_len >> 8 */ | ||
164 | aad[1] = aad_len & 0xff; | ||
165 | aad[2] = pos[0] & 0x8f; | ||
166 | aad[3] = pos[1] & 0xc7; | ||
167 | memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); | ||
168 | pos = (u8 *) &hdr->seq_ctl; | ||
169 | aad[22] = pos[0] & 0x0f; | ||
170 | aad[23] = 0; /* all bits masked */ | ||
171 | memset(aad + 24, 0, 8); | ||
172 | if (a4_included) | ||
173 | memcpy(aad + 24, hdr->addr4, ETH_ALEN); | ||
174 | if (qc_included) { | ||
175 | aad[a4_included ? 30 : 24] = qc; | ||
176 | /* rest of QC masked */ | ||
177 | } | ||
178 | |||
179 | /* Start with the first block and AAD */ | ||
180 | ieee80211_ccmp_aes_encrypt(tfm, b0, auth); | ||
181 | xor_block(auth, aad, AES_BLOCK_LEN); | ||
182 | ieee80211_ccmp_aes_encrypt(tfm, auth, auth); | ||
183 | xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); | ||
184 | ieee80211_ccmp_aes_encrypt(tfm, auth, auth); | ||
185 | b0[0] &= 0x07; | ||
186 | b0[14] = b0[15] = 0; | ||
187 | ieee80211_ccmp_aes_encrypt(tfm, b0, s0); | ||
188 | } | ||
189 | |||
190 | static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
191 | { | ||
192 | struct ieee80211_ccmp_data *key = priv; | ||
193 | int data_len, i; | ||
194 | u8 *pos; | ||
195 | struct ieee80211_hdr_4addr *hdr; | ||
196 | int blocks, last, len; | ||
197 | u8 *mic; | ||
198 | u8 *b0 = key->tx_b0; | ||
199 | u8 *b = key->tx_b; | ||
200 | u8 *e = key->tx_e; | ||
201 | u8 *s0 = key->tx_s0; | ||
202 | |||
203 | if (skb_headroom(skb) < CCMP_HDR_LEN || | ||
204 | skb_tailroom(skb) < CCMP_MIC_LEN || | ||
205 | skb->len < hdr_len) | ||
206 | return -1; | ||
207 | |||
208 | data_len = skb->len - hdr_len; | ||
209 | pos = skb_push(skb, CCMP_HDR_LEN); | ||
210 | memmove(pos, pos + CCMP_HDR_LEN, hdr_len); | ||
211 | pos += hdr_len; | ||
212 | |||
213 | i = CCMP_PN_LEN - 1; | ||
214 | while (i >= 0) { | ||
215 | key->tx_pn[i]++; | ||
216 | if (key->tx_pn[i] != 0) | ||
217 | break; | ||
218 | i--; | ||
219 | } | ||
220 | |||
221 | *pos++ = key->tx_pn[5]; | ||
222 | *pos++ = key->tx_pn[4]; | ||
223 | *pos++ = 0; | ||
224 | *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; | ||
225 | *pos++ = key->tx_pn[3]; | ||
226 | *pos++ = key->tx_pn[2]; | ||
227 | *pos++ = key->tx_pn[1]; | ||
228 | *pos++ = key->tx_pn[0]; | ||
229 | |||
230 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
231 | mic = skb_put(skb, CCMP_MIC_LEN); | ||
232 | |||
233 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); | ||
234 | |||
235 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | ||
236 | last = data_len % AES_BLOCK_LEN; | ||
237 | |||
238 | for (i = 1; i <= blocks; i++) { | ||
239 | len = (i == blocks && last) ? last : AES_BLOCK_LEN; | ||
240 | /* Authentication */ | ||
241 | xor_block(b, pos, len); | ||
242 | ieee80211_ccmp_aes_encrypt(key->tfm, b, b); | ||
243 | /* Encryption, with counter */ | ||
244 | b0[14] = (i >> 8) & 0xff; | ||
245 | b0[15] = i & 0xff; | ||
246 | ieee80211_ccmp_aes_encrypt(key->tfm, b0, e); | ||
247 | xor_block(pos, e, len); | ||
248 | pos += len; | ||
249 | } | ||
250 | |||
251 | for (i = 0; i < CCMP_MIC_LEN; i++) | ||
252 | mic[i] = b[i] ^ s0[i]; | ||
253 | |||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | |||
258 | static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
259 | { | ||
260 | struct ieee80211_ccmp_data *key = priv; | ||
261 | u8 keyidx, *pos; | ||
262 | struct ieee80211_hdr_4addr *hdr; | ||
263 | u8 pn[6]; | ||
264 | size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; | ||
265 | u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; | ||
266 | u8 *b0 = key->rx_b0; | ||
267 | u8 *b = key->rx_b; | ||
268 | u8 *a = key->rx_a; | ||
269 | int i, blocks, last, len; | ||
270 | |||
271 | if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { | ||
272 | key->dot11RSNAStatsCCMPFormatErrors++; | ||
273 | return -1; | ||
274 | } | ||
275 | |||
276 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
277 | pos = skb->data + hdr_len; | ||
278 | keyidx = pos[3]; | ||
279 | if (!(keyidx & (1 << 5))) { | ||
280 | if (net_ratelimit()) { | ||
281 | pr_debug("received packet without ExtIV flag from %pM\n", | ||
282 | hdr->addr2); | ||
283 | } | ||
284 | key->dot11RSNAStatsCCMPFormatErrors++; | ||
285 | return -2; | ||
286 | } | ||
287 | keyidx >>= 6; | ||
288 | if (key->key_idx != keyidx) { | ||
289 | pr_debug("RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", | ||
290 | key->key_idx, keyidx, priv); | ||
291 | return -6; | ||
292 | } | ||
293 | if (!key->key_set) { | ||
294 | if (net_ratelimit()) { | ||
295 | pr_debug("received packet from %pM with keyid=%d that does not have a configured key\n", | ||
296 | hdr->addr2, keyidx); | ||
297 | } | ||
298 | return -3; | ||
299 | } | ||
300 | |||
301 | pn[0] = pos[7]; | ||
302 | pn[1] = pos[6]; | ||
303 | pn[2] = pos[5]; | ||
304 | pn[3] = pos[4]; | ||
305 | pn[4] = pos[1]; | ||
306 | pn[5] = pos[0]; | ||
307 | pos += 8; | ||
308 | |||
309 | if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { | ||
310 | if (net_ratelimit()) { | ||
311 | pr_debug("replay detected: STA=%pM previous PN %pm received PN %pm\n", | ||
312 | hdr->addr2, key->rx_pn, pn); | ||
313 | } | ||
314 | key->dot11RSNAStatsCCMPReplays++; | ||
315 | return -4; | ||
316 | } | ||
317 | |||
318 | ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); | ||
319 | xor_block(mic, b, CCMP_MIC_LEN); | ||
320 | |||
321 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | ||
322 | last = data_len % AES_BLOCK_LEN; | ||
323 | |||
324 | for (i = 1; i <= blocks; i++) { | ||
325 | len = (i == blocks && last) ? last : AES_BLOCK_LEN; | ||
326 | /* Decrypt, with counter */ | ||
327 | b0[14] = (i >> 8) & 0xff; | ||
328 | b0[15] = i & 0xff; | ||
329 | ieee80211_ccmp_aes_encrypt(key->tfm, b0, b); | ||
330 | xor_block(pos, b, len); | ||
331 | /* Authentication */ | ||
332 | xor_block(a, pos, len); | ||
333 | ieee80211_ccmp_aes_encrypt(key->tfm, a, a); | ||
334 | pos += len; | ||
335 | } | ||
336 | |||
337 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { | ||
338 | if (net_ratelimit()) | ||
339 | pr_debug("decrypt failed: STA=%pM\n", hdr->addr2); | ||
340 | |||
341 | key->dot11RSNAStatsCCMPDecryptErrors++; | ||
342 | return -5; | ||
343 | } | ||
344 | |||
345 | memcpy(key->rx_pn, pn, CCMP_PN_LEN); | ||
346 | |||
347 | /* Remove hdr and MIC */ | ||
348 | memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); | ||
349 | skb_pull(skb, CCMP_HDR_LEN); | ||
350 | skb_trim(skb, skb->len - CCMP_MIC_LEN); | ||
351 | |||
352 | return keyidx; | ||
353 | } | ||
354 | |||
355 | |||
356 | static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) | ||
357 | { | ||
358 | struct ieee80211_ccmp_data *data = priv; | ||
359 | int keyidx; | ||
360 | struct crypto_tfm *tfm = data->tfm; | ||
361 | |||
362 | keyidx = data->key_idx; | ||
363 | memset(data, 0, sizeof(*data)); | ||
364 | data->key_idx = keyidx; | ||
365 | data->tfm = tfm; | ||
366 | if (len == CCMP_TK_LEN) { | ||
367 | memcpy(data->key, key, CCMP_TK_LEN); | ||
368 | data->key_set = 1; | ||
369 | if (seq) { | ||
370 | data->rx_pn[0] = seq[5]; | ||
371 | data->rx_pn[1] = seq[4]; | ||
372 | data->rx_pn[2] = seq[3]; | ||
373 | data->rx_pn[3] = seq[2]; | ||
374 | data->rx_pn[4] = seq[1]; | ||
375 | data->rx_pn[5] = seq[0]; | ||
376 | } | ||
377 | crypto_cipher_setkey((void *)data->tfm, data->key, CCMP_TK_LEN); | ||
378 | } else if (len == 0) | ||
379 | data->key_set = 0; | ||
380 | else | ||
381 | return -1; | ||
382 | |||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | |||
387 | static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) | ||
388 | { | ||
389 | struct ieee80211_ccmp_data *data = priv; | ||
390 | |||
391 | if (len < CCMP_TK_LEN) | ||
392 | return -1; | ||
393 | |||
394 | if (!data->key_set) | ||
395 | return 0; | ||
396 | memcpy(key, data->key, CCMP_TK_LEN); | ||
397 | |||
398 | if (seq) { | ||
399 | seq[0] = data->tx_pn[5]; | ||
400 | seq[1] = data->tx_pn[4]; | ||
401 | seq[2] = data->tx_pn[3]; | ||
402 | seq[3] = data->tx_pn[2]; | ||
403 | seq[4] = data->tx_pn[1]; | ||
404 | seq[5] = data->tx_pn[0]; | ||
405 | } | ||
406 | |||
407 | return CCMP_TK_LEN; | ||
408 | } | ||
409 | |||
410 | |||
411 | static char *ieee80211_ccmp_print_stats(char *p, void *priv) | ||
412 | { | ||
413 | struct ieee80211_ccmp_data *ccmp = priv; | ||
414 | p += sprintf(p, | ||
415 | "key[%d] alg=CCMP key_set=%d tx_pn=%pm rx_pn=%pm format_errors=%d replays=%d decrypt_errors=%d\n", | ||
416 | ccmp->key_idx, ccmp->key_set, | ||
417 | ccmp->tx_pn, ccmp->rx_pn, | ||
418 | ccmp->dot11RSNAStatsCCMPFormatErrors, | ||
419 | ccmp->dot11RSNAStatsCCMPReplays, | ||
420 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | ||
421 | |||
422 | return p; | ||
423 | } | ||
424 | |||
425 | void ieee80211_ccmp_null(void) | ||
426 | { | ||
427 | return; | ||
428 | } | ||
429 | static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { | ||
430 | .name = "CCMP", | ||
431 | .init = ieee80211_ccmp_init, | ||
432 | .deinit = ieee80211_ccmp_deinit, | ||
433 | .encrypt_mpdu = ieee80211_ccmp_encrypt, | ||
434 | .decrypt_mpdu = ieee80211_ccmp_decrypt, | ||
435 | .encrypt_msdu = NULL, | ||
436 | .decrypt_msdu = NULL, | ||
437 | .set_key = ieee80211_ccmp_set_key, | ||
438 | .get_key = ieee80211_ccmp_get_key, | ||
439 | .print_stats = ieee80211_ccmp_print_stats, | ||
440 | .extra_prefix_len = CCMP_HDR_LEN, | ||
441 | .extra_postfix_len = CCMP_MIC_LEN, | ||
442 | .owner = THIS_MODULE, | ||
443 | }; | ||
444 | |||
445 | |||
446 | int ieee80211_crypto_ccmp_init(void) | ||
447 | { | ||
448 | return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); | ||
449 | } | ||
450 | |||
451 | |||
452 | void ieee80211_crypto_ccmp_exit(void) | ||
453 | { | ||
454 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); | ||
455 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c deleted file mode 100644 index 6c1acc5dfba7..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ /dev/null | |||
@@ -1,740 +0,0 @@ | |||
1 | /* | ||
2 | * Host AP crypt: host-based TKIP encryption implementation for Host AP driver | ||
3 | * | ||
4 | * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. See README and COPYING for | ||
9 | * more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/random.h> | ||
15 | #include <linux/skbuff.h> | ||
16 | #include <linux/netdevice.h> | ||
17 | #include <linux/if_ether.h> | ||
18 | #include <linux/if_arp.h> | ||
19 | #include <asm/string.h> | ||
20 | |||
21 | #include "ieee80211.h" | ||
22 | |||
23 | #include <linux/crypto.h> | ||
24 | #include <linux/scatterlist.h> | ||
25 | #include <linux/crc32.h> | ||
26 | |||
27 | MODULE_AUTHOR("Jouni Malinen"); | ||
28 | MODULE_DESCRIPTION("Host AP crypt: TKIP"); | ||
29 | MODULE_LICENSE("GPL"); | ||
30 | |||
31 | |||
32 | struct ieee80211_tkip_data { | ||
33 | #define TKIP_KEY_LEN 32 | ||
34 | u8 key[TKIP_KEY_LEN]; | ||
35 | int key_set; | ||
36 | |||
37 | u32 tx_iv32; | ||
38 | u16 tx_iv16; | ||
39 | u16 tx_ttak[5]; | ||
40 | int tx_phase1_done; | ||
41 | |||
42 | u32 rx_iv32; | ||
43 | u16 rx_iv16; | ||
44 | u16 rx_ttak[5]; | ||
45 | int rx_phase1_done; | ||
46 | u32 rx_iv32_new; | ||
47 | u16 rx_iv16_new; | ||
48 | |||
49 | u32 dot11RSNAStatsTKIPReplays; | ||
50 | u32 dot11RSNAStatsTKIPICVErrors; | ||
51 | u32 dot11RSNAStatsTKIPLocalMICFailures; | ||
52 | |||
53 | int key_idx; | ||
54 | |||
55 | struct crypto_blkcipher *rx_tfm_arc4; | ||
56 | struct crypto_hash *rx_tfm_michael; | ||
57 | struct crypto_blkcipher *tx_tfm_arc4; | ||
58 | struct crypto_hash *tx_tfm_michael; | ||
59 | struct crypto_tfm *tfm_arc4; | ||
60 | struct crypto_tfm *tfm_michael; | ||
61 | |||
62 | /* scratch buffers for virt_to_page() (crypto API) */ | ||
63 | u8 rx_hdr[16], tx_hdr[16]; | ||
64 | }; | ||
65 | |||
66 | static void *ieee80211_tkip_init(int key_idx) | ||
67 | { | ||
68 | struct ieee80211_tkip_data *priv; | ||
69 | |||
70 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); | ||
71 | if (priv == NULL) | ||
72 | goto fail; | ||
73 | priv->key_idx = key_idx; | ||
74 | |||
75 | priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, | ||
76 | CRYPTO_ALG_ASYNC); | ||
77 | if (IS_ERR(priv->tx_tfm_arc4)) { | ||
78 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
79 | "crypto API arc4\n"); | ||
80 | priv->tx_tfm_arc4 = NULL; | ||
81 | goto fail; | ||
82 | } | ||
83 | |||
84 | priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, | ||
85 | CRYPTO_ALG_ASYNC); | ||
86 | if (IS_ERR(priv->tx_tfm_michael)) { | ||
87 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
88 | "crypto API michael_mic\n"); | ||
89 | priv->tx_tfm_michael = NULL; | ||
90 | goto fail; | ||
91 | } | ||
92 | |||
93 | priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, | ||
94 | CRYPTO_ALG_ASYNC); | ||
95 | if (IS_ERR(priv->rx_tfm_arc4)) { | ||
96 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
97 | "crypto API arc4\n"); | ||
98 | priv->rx_tfm_arc4 = NULL; | ||
99 | goto fail; | ||
100 | } | ||
101 | |||
102 | priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, | ||
103 | CRYPTO_ALG_ASYNC); | ||
104 | if (IS_ERR(priv->rx_tfm_michael)) { | ||
105 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " | ||
106 | "crypto API michael_mic\n"); | ||
107 | priv->rx_tfm_michael = NULL; | ||
108 | goto fail; | ||
109 | } | ||
110 | |||
111 | return priv; | ||
112 | |||
113 | fail: | ||
114 | if (priv) { | ||
115 | if (priv->tx_tfm_michael) | ||
116 | crypto_free_hash(priv->tx_tfm_michael); | ||
117 | if (priv->tx_tfm_arc4) | ||
118 | crypto_free_blkcipher(priv->tx_tfm_arc4); | ||
119 | if (priv->rx_tfm_michael) | ||
120 | crypto_free_hash(priv->rx_tfm_michael); | ||
121 | if (priv->rx_tfm_arc4) | ||
122 | crypto_free_blkcipher(priv->rx_tfm_arc4); | ||
123 | kfree(priv); | ||
124 | } | ||
125 | |||
126 | return NULL; | ||
127 | } | ||
128 | |||
129 | |||
130 | static void ieee80211_tkip_deinit(void *priv) | ||
131 | { | ||
132 | struct ieee80211_tkip_data *_priv = priv; | ||
133 | |||
134 | if (_priv) { | ||
135 | if (_priv->tx_tfm_michael) | ||
136 | crypto_free_hash(_priv->tx_tfm_michael); | ||
137 | if (_priv->tx_tfm_arc4) | ||
138 | crypto_free_blkcipher(_priv->tx_tfm_arc4); | ||
139 | if (_priv->rx_tfm_michael) | ||
140 | crypto_free_hash(_priv->rx_tfm_michael); | ||
141 | if (_priv->rx_tfm_arc4) | ||
142 | crypto_free_blkcipher(_priv->rx_tfm_arc4); | ||
143 | } | ||
144 | kfree(priv); | ||
145 | } | ||
146 | |||
147 | |||
148 | static inline u16 RotR1(u16 val) | ||
149 | { | ||
150 | return (val >> 1) | (val << 15); | ||
151 | } | ||
152 | |||
153 | |||
154 | static inline u8 Lo8(u16 val) | ||
155 | { | ||
156 | return val & 0xff; | ||
157 | } | ||
158 | |||
159 | |||
160 | static inline u8 Hi8(u16 val) | ||
161 | { | ||
162 | return val >> 8; | ||
163 | } | ||
164 | |||
165 | |||
166 | static inline u16 Lo16(u32 val) | ||
167 | { | ||
168 | return val & 0xffff; | ||
169 | } | ||
170 | |||
171 | |||
172 | static inline u16 Hi16(u32 val) | ||
173 | { | ||
174 | return val >> 16; | ||
175 | } | ||
176 | |||
177 | |||
178 | static inline u16 Mk16(u8 hi, u8 lo) | ||
179 | { | ||
180 | return lo | (((u16) hi) << 8); | ||
181 | } | ||
182 | |||
183 | |||
184 | static inline u16 Mk16_le(u16 *v) | ||
185 | { | ||
186 | return le16_to_cpu(*v); | ||
187 | } | ||
188 | |||
189 | |||
190 | static const u16 Sbox[256] = { | ||
191 | 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, | ||
192 | 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, | ||
193 | 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, | ||
194 | 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, | ||
195 | 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, | ||
196 | 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, | ||
197 | 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, | ||
198 | 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, | ||
199 | 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, | ||
200 | 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, | ||
201 | 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, | ||
202 | 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, | ||
203 | 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, | ||
204 | 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, | ||
205 | 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, | ||
206 | 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, | ||
207 | 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, | ||
208 | 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, | ||
209 | 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, | ||
210 | 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, | ||
211 | 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, | ||
212 | 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, | ||
213 | 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, | ||
214 | 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, | ||
215 | 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, | ||
216 | 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, | ||
217 | 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, | ||
218 | 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, | ||
219 | 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, | ||
220 | 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, | ||
221 | 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, | ||
222 | 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, | ||
223 | }; | ||
224 | |||
225 | |||
226 | static inline u16 _S_(u16 v) | ||
227 | { | ||
228 | u16 t = Sbox[Hi8(v)]; | ||
229 | return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); | ||
230 | } | ||
231 | |||
232 | #define PHASE1_LOOP_COUNT 8 | ||
233 | |||
234 | static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) | ||
235 | { | ||
236 | int i, j; | ||
237 | |||
238 | /* Initialize the 80-bit TTAK from TSC (IV32) and TA[0..5] */ | ||
239 | TTAK[0] = Lo16(IV32); | ||
240 | TTAK[1] = Hi16(IV32); | ||
241 | TTAK[2] = Mk16(TA[1], TA[0]); | ||
242 | TTAK[3] = Mk16(TA[3], TA[2]); | ||
243 | TTAK[4] = Mk16(TA[5], TA[4]); | ||
244 | |||
245 | for (i = 0; i < PHASE1_LOOP_COUNT; i++) { | ||
246 | j = 2 * (i & 1); | ||
247 | TTAK[0] += _S_(TTAK[4] ^ Mk16(TK[1 + j], TK[0 + j])); | ||
248 | TTAK[1] += _S_(TTAK[0] ^ Mk16(TK[5 + j], TK[4 + j])); | ||
249 | TTAK[2] += _S_(TTAK[1] ^ Mk16(TK[9 + j], TK[8 + j])); | ||
250 | TTAK[3] += _S_(TTAK[2] ^ Mk16(TK[13 + j], TK[12 + j])); | ||
251 | TTAK[4] += _S_(TTAK[3] ^ Mk16(TK[1 + j], TK[0 + j])) + i; | ||
252 | } | ||
253 | } | ||
254 | |||
255 | |||
256 | static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, | ||
257 | u16 IV16) | ||
258 | { | ||
259 | /* Make temporary area overlap WEP seed so that the final copy can be | ||
260 | * avoided on little endian hosts. */ | ||
261 | u16 *PPK = (u16 *) &WEPSeed[4]; | ||
262 | |||
263 | /* Step 1 - make copy of TTAK and bring in TSC */ | ||
264 | PPK[0] = TTAK[0]; | ||
265 | PPK[1] = TTAK[1]; | ||
266 | PPK[2] = TTAK[2]; | ||
267 | PPK[3] = TTAK[3]; | ||
268 | PPK[4] = TTAK[4]; | ||
269 | PPK[5] = TTAK[4] + IV16; | ||
270 | |||
271 | /* Step 2 - 96-bit bijective mixing using S-box */ | ||
272 | PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); | ||
273 | PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); | ||
274 | PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); | ||
275 | PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); | ||
276 | PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); | ||
277 | PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); | ||
278 | |||
279 | PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); | ||
280 | PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); | ||
281 | PPK[2] += RotR1(PPK[1]); | ||
282 | PPK[3] += RotR1(PPK[2]); | ||
283 | PPK[4] += RotR1(PPK[3]); | ||
284 | PPK[5] += RotR1(PPK[4]); | ||
285 | |||
286 | /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value | ||
287 | * WEPSeed[0..2] is transmitted as WEP IV */ | ||
288 | WEPSeed[0] = Hi8(IV16); | ||
289 | WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; | ||
290 | WEPSeed[2] = Lo8(IV16); | ||
291 | WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); | ||
292 | |||
293 | #ifdef __BIG_ENDIAN | ||
294 | { | ||
295 | int i; | ||
296 | for (i = 0; i < 6; i++) | ||
297 | PPK[i] = (PPK[i] << 8) | (PPK[i] >> 8); | ||
298 | } | ||
299 | #endif | ||
300 | } | ||
301 | |||
302 | static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
303 | { | ||
304 | struct ieee80211_tkip_data *tkey = priv; | ||
305 | struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; | ||
306 | int len; | ||
307 | u8 *pos; | ||
308 | struct ieee80211_hdr_4addr *hdr; | ||
309 | u8 rc4key[16], *icv; | ||
310 | u32 crc; | ||
311 | struct scatterlist sg; | ||
312 | int ret; | ||
313 | |||
314 | ret = 0; | ||
315 | if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || | ||
316 | skb->len < hdr_len) | ||
317 | return -1; | ||
318 | |||
319 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
320 | |||
321 | if (!tkey->tx_phase1_done) { | ||
322 | tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, | ||
323 | tkey->tx_iv32); | ||
324 | tkey->tx_phase1_done = 1; | ||
325 | } | ||
326 | tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); | ||
327 | |||
328 | len = skb->len - hdr_len; | ||
329 | pos = skb_push(skb, 8); | ||
330 | memmove(pos, pos + 8, hdr_len); | ||
331 | pos += hdr_len; | ||
332 | |||
333 | *pos++ = rc4key[0]; | ||
334 | *pos++ = rc4key[1]; | ||
335 | *pos++ = rc4key[2]; | ||
336 | *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; | ||
337 | *pos++ = tkey->tx_iv32 & 0xff; | ||
338 | *pos++ = (tkey->tx_iv32 >> 8) & 0xff; | ||
339 | *pos++ = (tkey->tx_iv32 >> 16) & 0xff; | ||
340 | *pos++ = (tkey->tx_iv32 >> 24) & 0xff; | ||
341 | |||
342 | icv = skb_put(skb, 4); | ||
343 | crc = ~crc32_le(~0, pos, len); | ||
344 | icv[0] = crc; | ||
345 | icv[1] = crc >> 8; | ||
346 | icv[2] = crc >> 16; | ||
347 | icv[3] = crc >> 24; | ||
348 | crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); | ||
349 | sg_init_one(&sg, pos, len + 4); | ||
350 | ret = crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | ||
351 | |||
352 | tkey->tx_iv16++; | ||
353 | if (tkey->tx_iv16 == 0) { | ||
354 | tkey->tx_phase1_done = 0; | ||
355 | tkey->tx_iv32++; | ||
356 | } | ||
357 | return ret; | ||
358 | } | ||
359 | |||
360 | static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
361 | { | ||
362 | struct ieee80211_tkip_data *tkey = priv; | ||
363 | struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 }; | ||
364 | u8 keyidx, *pos; | ||
365 | u32 iv32; | ||
366 | u16 iv16; | ||
367 | struct ieee80211_hdr_4addr *hdr; | ||
368 | u8 icv[4]; | ||
369 | u32 crc; | ||
370 | struct scatterlist sg; | ||
371 | u8 rc4key[16]; | ||
372 | int plen; | ||
373 | |||
374 | if (skb->len < hdr_len + 8 + 4) | ||
375 | return -1; | ||
376 | |||
377 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
378 | pos = skb->data + hdr_len; | ||
379 | keyidx = pos[3]; | ||
380 | if (!(keyidx & (1 << 5))) { | ||
381 | if (net_ratelimit()) { | ||
382 | printk(KERN_DEBUG "TKIP: received packet without ExtIV" | ||
383 | " flag from %pM\n", hdr->addr2); | ||
384 | } | ||
385 | return -2; | ||
386 | } | ||
387 | keyidx >>= 6; | ||
388 | if (tkey->key_idx != keyidx) { | ||
389 | printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " | ||
390 | "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); | ||
391 | return -6; | ||
392 | } | ||
393 | if (!tkey->key_set) { | ||
394 | if (net_ratelimit()) { | ||
395 | printk(KERN_DEBUG "TKIP: received packet from %pM" | ||
396 | " with keyid=%d that does not have a configured" | ||
397 | " key\n", hdr->addr2, keyidx); | ||
398 | } | ||
399 | return -3; | ||
400 | } | ||
401 | iv16 = (pos[0] << 8) | pos[2]; | ||
402 | iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24); | ||
403 | pos += 8; | ||
404 | |||
405 | if (iv32 < tkey->rx_iv32 || | ||
406 | (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) { | ||
407 | if (net_ratelimit()) { | ||
408 | printk(KERN_DEBUG "TKIP: replay detected: STA=%pM" | ||
409 | " previous TSC %08x%04x received TSC " | ||
410 | "%08x%04x\n", hdr->addr2, | ||
411 | tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); | ||
412 | } | ||
413 | tkey->dot11RSNAStatsTKIPReplays++; | ||
414 | return -4; | ||
415 | } | ||
416 | |||
417 | if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { | ||
418 | tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); | ||
419 | tkey->rx_phase1_done = 1; | ||
420 | } | ||
421 | tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); | ||
422 | |||
423 | plen = skb->len - hdr_len - 12; | ||
424 | crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); | ||
425 | sg_init_one(&sg, pos, plen + 4); | ||
426 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { | ||
427 | if (net_ratelimit()) { | ||
428 | printk(KERN_DEBUG ": TKIP: failed to decrypt " | ||
429 | "received packet from %pM\n", | ||
430 | hdr->addr2); | ||
431 | } | ||
432 | return -7; | ||
433 | } | ||
434 | |||
435 | crc = ~crc32_le(~0, pos, plen); | ||
436 | icv[0] = crc; | ||
437 | icv[1] = crc >> 8; | ||
438 | icv[2] = crc >> 16; | ||
439 | icv[3] = crc >> 24; | ||
440 | if (memcmp(icv, pos + plen, 4) != 0) { | ||
441 | if (iv32 != tkey->rx_iv32) { | ||
442 | /* Previously cached Phase1 result was already lost, so | ||
443 | * it needs to be recalculated for the next packet. */ | ||
444 | tkey->rx_phase1_done = 0; | ||
445 | } | ||
446 | if (net_ratelimit()) { | ||
447 | printk(KERN_DEBUG "TKIP: ICV error detected: STA=" | ||
448 | "%pM\n", hdr->addr2); | ||
449 | } | ||
450 | tkey->dot11RSNAStatsTKIPICVErrors++; | ||
451 | return -5; | ||
452 | } | ||
453 | |||
454 | /* Update real counters only after Michael MIC verification has | ||
455 | * completed */ | ||
456 | tkey->rx_iv32_new = iv32; | ||
457 | tkey->rx_iv16_new = iv16; | ||
458 | |||
459 | /* Remove IV and ICV */ | ||
460 | memmove(skb->data + 8, skb->data, hdr_len); | ||
461 | skb_pull(skb, 8); | ||
462 | skb_trim(skb, skb->len - 4); | ||
463 | |||
464 | return keyidx; | ||
465 | } | ||
466 | |||
467 | static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, | ||
468 | u8 *data, size_t data_len, u8 *mic) | ||
469 | { | ||
470 | struct hash_desc desc; | ||
471 | struct scatterlist sg[2]; | ||
472 | |||
473 | if (tfm_michael == NULL) { | ||
474 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); | ||
475 | return -1; | ||
476 | } | ||
477 | |||
478 | sg_init_table(sg, 2); | ||
479 | sg_set_buf(&sg[0], hdr, 16); | ||
480 | sg_set_buf(&sg[1], data, data_len); | ||
481 | |||
482 | if (crypto_hash_setkey(tfm_michael, key, 8)) | ||
483 | return -1; | ||
484 | |||
485 | desc.tfm = tfm_michael; | ||
486 | desc.flags = 0; | ||
487 | return crypto_hash_digest(&desc, sg, data_len + 16, mic); | ||
488 | } | ||
489 | |||
490 | static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) | ||
491 | { | ||
492 | struct ieee80211_hdr_4addr *hdr11; | ||
493 | |||
494 | hdr11 = (struct ieee80211_hdr_4addr *)skb->data; | ||
495 | switch (le16_to_cpu(hdr11->frame_ctl) & | ||
496 | (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { | ||
497 | case IEEE80211_FCTL_TODS: | ||
498 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ | ||
499 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ | ||
500 | break; | ||
501 | case IEEE80211_FCTL_FROMDS: | ||
502 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ | ||
503 | memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ | ||
504 | break; | ||
505 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: | ||
506 | memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ | ||
507 | memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ | ||
508 | break; | ||
509 | case 0: | ||
510 | memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ | ||
511 | memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ | ||
512 | break; | ||
513 | } | ||
514 | |||
515 | hdr[12] = 0; /* priority */ | ||
516 | |||
517 | hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ | ||
518 | } | ||
519 | |||
520 | |||
521 | static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, | ||
522 | void *priv) | ||
523 | { | ||
524 | struct ieee80211_tkip_data *tkey = priv; | ||
525 | u8 *pos; | ||
526 | struct ieee80211_hdr_4addr *hdr; | ||
527 | |||
528 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
529 | |||
530 | if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { | ||
531 | printk(KERN_DEBUG "Invalid packet for Michael MIC add " | ||
532 | "(tailroom=%d hdr_len=%d skb->len=%d)\n", | ||
533 | skb_tailroom(skb), hdr_len, skb->len); | ||
534 | return -1; | ||
535 | } | ||
536 | |||
537 | michael_mic_hdr(skb, tkey->tx_hdr); | ||
538 | |||
539 | if (IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) | ||
540 | tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; | ||
541 | |||
542 | pos = skb_put(skb, 8); | ||
543 | |||
544 | if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, | ||
545 | skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) | ||
546 | return -1; | ||
547 | |||
548 | return 0; | ||
549 | } | ||
550 | |||
551 | static void ieee80211_michael_mic_failure(struct net_device *dev, | ||
552 | struct ieee80211_hdr_4addr *hdr, | ||
553 | int keyidx) | ||
554 | { | ||
555 | union iwreq_data wrqu; | ||
556 | struct iw_michaelmicfailure ev; | ||
557 | |||
558 | /* TODO: needed parameters: count, keyid, key type, TSC */ | ||
559 | memset(&ev, 0, sizeof(ev)); | ||
560 | ev.flags = keyidx & IW_MICFAILURE_KEY_ID; | ||
561 | if (hdr->addr1[0] & 0x01) | ||
562 | ev.flags |= IW_MICFAILURE_GROUP; | ||
563 | else | ||
564 | ev.flags |= IW_MICFAILURE_PAIRWISE; | ||
565 | ev.src_addr.sa_family = ARPHRD_ETHER; | ||
566 | memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); | ||
567 | memset(&wrqu, 0, sizeof(wrqu)); | ||
568 | wrqu.data.length = sizeof(ev); | ||
569 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); | ||
570 | } | ||
571 | |||
572 | static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, | ||
573 | int hdr_len, void *priv) | ||
574 | { | ||
575 | struct ieee80211_tkip_data *tkey = priv; | ||
576 | u8 mic[8]; | ||
577 | struct ieee80211_hdr_4addr *hdr; | ||
578 | |||
579 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
580 | |||
581 | if (!tkey->key_set) | ||
582 | return -1; | ||
583 | |||
584 | michael_mic_hdr(skb, tkey->rx_hdr); | ||
585 | if (IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) | ||
586 | tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; | ||
587 | |||
588 | if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, | ||
589 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) | ||
590 | return -1; | ||
591 | |||
592 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { | ||
593 | struct ieee80211_hdr_4addr *hdr; | ||
594 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
595 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " | ||
596 | "MSDU from %pM keyidx=%d\n", | ||
597 | skb->dev ? skb->dev->name : "N/A", hdr->addr2, | ||
598 | keyidx); | ||
599 | if (skb->dev) | ||
600 | ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); | ||
601 | tkey->dot11RSNAStatsTKIPLocalMICFailures++; | ||
602 | return -1; | ||
603 | } | ||
604 | |||
605 | /* Update TSC counters for RX now that the packet verification has | ||
606 | * completed. */ | ||
607 | tkey->rx_iv32 = tkey->rx_iv32_new; | ||
608 | tkey->rx_iv16 = tkey->rx_iv16_new; | ||
609 | |||
610 | skb_trim(skb, skb->len - 8); | ||
611 | |||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | |||
616 | static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) | ||
617 | { | ||
618 | struct ieee80211_tkip_data *tkey = priv; | ||
619 | int keyidx; | ||
620 | struct crypto_hash *tfm = tkey->tx_tfm_michael; | ||
621 | struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; | ||
622 | struct crypto_hash *tfm3 = tkey->rx_tfm_michael; | ||
623 | struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; | ||
624 | |||
625 | keyidx = tkey->key_idx; | ||
626 | memset(tkey, 0, sizeof(*tkey)); | ||
627 | tkey->key_idx = keyidx; | ||
628 | |||
629 | tkey->tx_tfm_michael = tfm; | ||
630 | tkey->tx_tfm_arc4 = tfm2; | ||
631 | tkey->rx_tfm_michael = tfm3; | ||
632 | tkey->rx_tfm_arc4 = tfm4; | ||
633 | |||
634 | if (len == TKIP_KEY_LEN) { | ||
635 | memcpy(tkey->key, key, TKIP_KEY_LEN); | ||
636 | tkey->key_set = 1; | ||
637 | tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ | ||
638 | if (seq) { | ||
639 | tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | | ||
640 | (seq[3] << 8) | seq[2]; | ||
641 | tkey->rx_iv16 = (seq[1] << 8) | seq[0]; | ||
642 | } | ||
643 | } else if (len == 0) | ||
644 | tkey->key_set = 0; | ||
645 | else | ||
646 | return -1; | ||
647 | |||
648 | return 0; | ||
649 | } | ||
650 | |||
651 | |||
652 | static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) | ||
653 | { | ||
654 | struct ieee80211_tkip_data *tkey = priv; | ||
655 | |||
656 | if (len < TKIP_KEY_LEN) | ||
657 | return -1; | ||
658 | |||
659 | if (!tkey->key_set) | ||
660 | return 0; | ||
661 | memcpy(key, tkey->key, TKIP_KEY_LEN); | ||
662 | |||
663 | if (seq) { | ||
664 | /* Return the sequence number of the last transmitted frame. */ | ||
665 | u16 iv16 = tkey->tx_iv16; | ||
666 | u32 iv32 = tkey->tx_iv32; | ||
667 | if (iv16 == 0) | ||
668 | iv32--; | ||
669 | iv16--; | ||
670 | seq[0] = tkey->tx_iv16; | ||
671 | seq[1] = tkey->tx_iv16 >> 8; | ||
672 | seq[2] = tkey->tx_iv32; | ||
673 | seq[3] = tkey->tx_iv32 >> 8; | ||
674 | seq[4] = tkey->tx_iv32 >> 16; | ||
675 | seq[5] = tkey->tx_iv32 >> 24; | ||
676 | } | ||
677 | |||
678 | return TKIP_KEY_LEN; | ||
679 | } | ||
680 | |||
681 | |||
682 | static char *ieee80211_tkip_print_stats(char *p, void *priv) | ||
683 | { | ||
684 | struct ieee80211_tkip_data *tkip = priv; | ||
685 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " | ||
686 | "tx_pn=%02x%02x%02x%02x%02x%02x " | ||
687 | "rx_pn=%02x%02x%02x%02x%02x%02x " | ||
688 | "replays=%d icv_errors=%d local_mic_failures=%d\n", | ||
689 | tkip->key_idx, tkip->key_set, | ||
690 | (tkip->tx_iv32 >> 24) & 0xff, | ||
691 | (tkip->tx_iv32 >> 16) & 0xff, | ||
692 | (tkip->tx_iv32 >> 8) & 0xff, | ||
693 | tkip->tx_iv32 & 0xff, | ||
694 | (tkip->tx_iv16 >> 8) & 0xff, | ||
695 | tkip->tx_iv16 & 0xff, | ||
696 | (tkip->rx_iv32 >> 24) & 0xff, | ||
697 | (tkip->rx_iv32 >> 16) & 0xff, | ||
698 | (tkip->rx_iv32 >> 8) & 0xff, | ||
699 | tkip->rx_iv32 & 0xff, | ||
700 | (tkip->rx_iv16 >> 8) & 0xff, | ||
701 | tkip->rx_iv16 & 0xff, | ||
702 | tkip->dot11RSNAStatsTKIPReplays, | ||
703 | tkip->dot11RSNAStatsTKIPICVErrors, | ||
704 | tkip->dot11RSNAStatsTKIPLocalMICFailures); | ||
705 | return p; | ||
706 | } | ||
707 | |||
708 | |||
709 | static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { | ||
710 | .name = "TKIP", | ||
711 | .init = ieee80211_tkip_init, | ||
712 | .deinit = ieee80211_tkip_deinit, | ||
713 | .encrypt_mpdu = ieee80211_tkip_encrypt, | ||
714 | .decrypt_mpdu = ieee80211_tkip_decrypt, | ||
715 | .encrypt_msdu = ieee80211_michael_mic_add, | ||
716 | .decrypt_msdu = ieee80211_michael_mic_verify, | ||
717 | .set_key = ieee80211_tkip_set_key, | ||
718 | .get_key = ieee80211_tkip_get_key, | ||
719 | .print_stats = ieee80211_tkip_print_stats, | ||
720 | .extra_prefix_len = 4 + 4, /* IV + ExtIV */ | ||
721 | .extra_postfix_len = 8 + 4, /* MIC + ICV */ | ||
722 | .owner = THIS_MODULE, | ||
723 | }; | ||
724 | |||
725 | |||
726 | int ieee80211_crypto_tkip_init(void) | ||
727 | { | ||
728 | return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); | ||
729 | } | ||
730 | |||
731 | |||
732 | void ieee80211_crypto_tkip_exit(void) | ||
733 | { | ||
734 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); | ||
735 | } | ||
736 | |||
737 | |||
738 | void ieee80211_tkip_null(void) | ||
739 | { | ||
740 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c deleted file mode 100644 index f25367224941..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +++ /dev/null | |||
@@ -1,277 +0,0 @@ | |||
1 | /* | ||
2 | * Host AP crypt: host-based WEP encryption implementation for Host AP driver | ||
3 | * | ||
4 | * Copyright (c) 2002-2004, Jouni Malinen <jkmaline@cc.hut.fi> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. See README and COPYING for | ||
9 | * more details. | ||
10 | */ | ||
11 | |||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/random.h> | ||
17 | #include <linux/skbuff.h> | ||
18 | #include <linux/string.h> | ||
19 | |||
20 | #include "ieee80211.h" | ||
21 | |||
22 | #include <linux/crypto.h> | ||
23 | #include <linux/scatterlist.h> | ||
24 | #include <linux/crc32.h> | ||
25 | |||
26 | MODULE_AUTHOR("Jouni Malinen"); | ||
27 | MODULE_DESCRIPTION("Host AP crypt: WEP"); | ||
28 | MODULE_LICENSE("GPL"); | ||
29 | |||
30 | struct prism2_wep_data { | ||
31 | u32 iv; | ||
32 | #define WEP_KEY_LEN 13 | ||
33 | u8 key[WEP_KEY_LEN + 1]; | ||
34 | u8 key_len; | ||
35 | u8 key_idx; | ||
36 | struct crypto_blkcipher *tx_tfm; | ||
37 | struct crypto_blkcipher *rx_tfm; | ||
38 | }; | ||
39 | |||
40 | static void *prism2_wep_init(int keyidx) | ||
41 | { | ||
42 | struct prism2_wep_data *priv; | ||
43 | |||
44 | priv = kzalloc(sizeof(*priv), GFP_ATOMIC); | ||
45 | if (priv == NULL) | ||
46 | goto fail; | ||
47 | priv->key_idx = keyidx; | ||
48 | priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | ||
49 | if (IS_ERR(priv->tx_tfm)) { | ||
50 | pr_debug("could not allocate crypto API arc4\n"); | ||
51 | priv->tx_tfm = NULL; | ||
52 | goto fail; | ||
53 | } | ||
54 | priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | ||
55 | if (IS_ERR(priv->rx_tfm)) { | ||
56 | pr_debug("could not allocate crypto API arc4\n"); | ||
57 | priv->rx_tfm = NULL; | ||
58 | goto fail; | ||
59 | } | ||
60 | |||
61 | /* start WEP IV from a random value */ | ||
62 | get_random_bytes(&priv->iv, 4); | ||
63 | |||
64 | return priv; | ||
65 | |||
66 | fail: | ||
67 | if (priv) { | ||
68 | if (priv->tx_tfm) | ||
69 | crypto_free_blkcipher(priv->tx_tfm); | ||
70 | if (priv->rx_tfm) | ||
71 | crypto_free_blkcipher(priv->rx_tfm); | ||
72 | kfree(priv); | ||
73 | } | ||
74 | |||
75 | return NULL; | ||
76 | } | ||
77 | |||
78 | static void prism2_wep_deinit(void *priv) | ||
79 | { | ||
80 | struct prism2_wep_data *_priv = priv; | ||
81 | |||
82 | if (_priv) { | ||
83 | if (_priv->tx_tfm) | ||
84 | crypto_free_blkcipher(_priv->tx_tfm); | ||
85 | if (_priv->rx_tfm) | ||
86 | crypto_free_blkcipher(_priv->rx_tfm); | ||
87 | } | ||
88 | |||
89 | kfree(priv); | ||
90 | } | ||
91 | |||
92 | /* Perform WEP encryption on given skb that has at least 4 bytes of headroom | ||
93 | * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, | ||
94 | * so the payload length increases with 8 bytes. | ||
95 | * | ||
96 | * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) | ||
97 | */ | ||
98 | static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
99 | { | ||
100 | struct prism2_wep_data *wep = priv; | ||
101 | struct blkcipher_desc desc = { .tfm = wep->tx_tfm }; | ||
102 | u32 klen, len; | ||
103 | u8 key[WEP_KEY_LEN + 3]; | ||
104 | u8 *pos; | ||
105 | u32 crc; | ||
106 | u8 *icv; | ||
107 | struct scatterlist sg; | ||
108 | |||
109 | if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || | ||
110 | skb->len < hdr_len) | ||
111 | return -1; | ||
112 | |||
113 | len = skb->len - hdr_len; | ||
114 | pos = skb_push(skb, 4); | ||
115 | memmove(pos, pos + 4, hdr_len); | ||
116 | pos += hdr_len; | ||
117 | |||
118 | klen = 3 + wep->key_len; | ||
119 | |||
120 | wep->iv++; | ||
121 | |||
122 | /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key | ||
123 | * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) | ||
124 | * can be used to speedup attacks, so avoid using them. */ | ||
125 | if ((wep->iv & 0xff00) == 0xff00) { | ||
126 | u8 B = (wep->iv >> 16) & 0xff; | ||
127 | if (B >= 3 && B < klen) | ||
128 | wep->iv += 0x0100; | ||
129 | } | ||
130 | |||
131 | /* Prepend 24-bit IV to RC4 key and TX frame */ | ||
132 | *pos++ = key[0] = (wep->iv >> 16) & 0xff; | ||
133 | *pos++ = key[1] = (wep->iv >> 8) & 0xff; | ||
134 | *pos++ = key[2] = wep->iv & 0xff; | ||
135 | *pos++ = wep->key_idx << 6; | ||
136 | |||
137 | /* Copy rest of the WEP key (the secret part) */ | ||
138 | memcpy(key + 3, wep->key, wep->key_len); | ||
139 | |||
140 | /* Append little-endian CRC32 and encrypt it to produce ICV */ | ||
141 | crc = ~crc32_le(~0, pos, len); | ||
142 | icv = skb_put(skb, 4); | ||
143 | icv[0] = crc; | ||
144 | icv[1] = crc >> 8; | ||
145 | icv[2] = crc >> 16; | ||
146 | icv[3] = crc >> 24; | ||
147 | |||
148 | crypto_blkcipher_setkey(wep->tx_tfm, key, klen); | ||
149 | sg_init_one(&sg, pos, len + 4); | ||
150 | |||
151 | return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); | ||
152 | } | ||
153 | |||
154 | /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of | ||
155 | * the frame: IV (4 bytes), encrypted payload (including SNAP header), | ||
156 | * ICV (4 bytes). len includes both IV and ICV. | ||
157 | * | ||
158 | * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on | ||
159 | * failure. If frame is OK, IV and ICV will be removed. | ||
160 | */ | ||
161 | static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | ||
162 | { | ||
163 | struct prism2_wep_data *wep = priv; | ||
164 | struct blkcipher_desc desc = { .tfm = wep->rx_tfm }; | ||
165 | u32 klen, plen; | ||
166 | u8 key[WEP_KEY_LEN + 3]; | ||
167 | u8 keyidx, *pos; | ||
168 | u32 crc; | ||
169 | u8 icv[4]; | ||
170 | struct scatterlist sg; | ||
171 | |||
172 | if (skb->len < hdr_len + 8) | ||
173 | return -1; | ||
174 | |||
175 | pos = skb->data + hdr_len; | ||
176 | key[0] = *pos++; | ||
177 | key[1] = *pos++; | ||
178 | key[2] = *pos++; | ||
179 | keyidx = *pos++ >> 6; | ||
180 | if (keyidx != wep->key_idx) | ||
181 | return -1; | ||
182 | |||
183 | klen = 3 + wep->key_len; | ||
184 | |||
185 | /* Copy rest of the WEP key (the secret part) */ | ||
186 | memcpy(key + 3, wep->key, wep->key_len); | ||
187 | |||
188 | /* Apply RC4 to data and compute CRC32 over decrypted data */ | ||
189 | plen = skb->len - hdr_len - 8; | ||
190 | |||
191 | crypto_blkcipher_setkey(wep->rx_tfm, key, klen); | ||
192 | sg_init_one(&sg, pos, plen + 4); | ||
193 | |||
194 | if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) | ||
195 | return -7; | ||
196 | |||
197 | crc = ~crc32_le(~0, pos, plen); | ||
198 | icv[0] = crc; | ||
199 | icv[1] = crc >> 8; | ||
200 | icv[2] = crc >> 16; | ||
201 | icv[3] = crc >> 24; | ||
202 | |||
203 | if (memcmp(icv, pos + plen, 4) != 0) { | ||
204 | /* ICV mismatch - drop frame */ | ||
205 | return -2; | ||
206 | } | ||
207 | |||
208 | /* Remove IV and ICV */ | ||
209 | memmove(skb->data + 4, skb->data, hdr_len); | ||
210 | skb_pull(skb, 4); | ||
211 | skb_trim(skb, skb->len - 4); | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) | ||
216 | { | ||
217 | struct prism2_wep_data *wep = priv; | ||
218 | |||
219 | if (len < 0 || len > WEP_KEY_LEN) | ||
220 | return -1; | ||
221 | |||
222 | memcpy(wep->key, key, len); | ||
223 | wep->key_len = len; | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | ||
229 | { | ||
230 | struct prism2_wep_data *wep = priv; | ||
231 | |||
232 | if (len < wep->key_len) | ||
233 | return -1; | ||
234 | |||
235 | memcpy(key, wep->key, wep->key_len); | ||
236 | |||
237 | return wep->key_len; | ||
238 | } | ||
239 | |||
240 | static char *prism2_wep_print_stats(char *p, void *priv) | ||
241 | { | ||
242 | struct prism2_wep_data *wep = priv; | ||
243 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", | ||
244 | wep->key_idx, wep->key_len); | ||
245 | return p; | ||
246 | } | ||
247 | |||
248 | static struct ieee80211_crypto_ops ieee80211_crypt_wep = { | ||
249 | .name = "WEP", | ||
250 | .init = prism2_wep_init, | ||
251 | .deinit = prism2_wep_deinit, | ||
252 | .encrypt_mpdu = prism2_wep_encrypt, | ||
253 | .decrypt_mpdu = prism2_wep_decrypt, | ||
254 | .encrypt_msdu = NULL, | ||
255 | .decrypt_msdu = NULL, | ||
256 | .set_key = prism2_wep_set_key, | ||
257 | .get_key = prism2_wep_get_key, | ||
258 | .print_stats = prism2_wep_print_stats, | ||
259 | .extra_prefix_len = 4, /* IV */ | ||
260 | .extra_postfix_len = 4, /* ICV */ | ||
261 | .owner = THIS_MODULE, | ||
262 | }; | ||
263 | |||
264 | int ieee80211_crypto_wep_init(void) | ||
265 | { | ||
266 | return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); | ||
267 | } | ||
268 | |||
269 | void ieee80211_crypto_wep_exit(void) | ||
270 | { | ||
271 | ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); | ||
272 | } | ||
273 | |||
274 | void ieee80211_wep_null(void) | ||
275 | { | ||
276 | return; | ||
277 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c deleted file mode 100644 index 07a1fbb6678e..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c +++ /dev/null | |||
@@ -1,203 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | |||
3 | Copyright(c) 2004 Intel Corporation. All rights reserved. | ||
4 | |||
5 | Portions of this file are based on the WEP enablement code provided by the | ||
6 | Host AP project hostap-drivers v0.1.3 | ||
7 | Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
8 | <jkmaline@cc.hut.fi> | ||
9 | Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
10 | |||
11 | This program is free software; you can redistribute it and/or modify it | ||
12 | under the terms of version 2 of the GNU General Public License as | ||
13 | published by the Free Software Foundation. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, but WITHOUT | ||
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
17 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
18 | more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License along with | ||
21 | this program; if not, write to the Free Software Foundation, Inc., 59 | ||
22 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
23 | |||
24 | The full GNU General Public License is included in this distribution in the | ||
25 | file called LICENSE. | ||
26 | |||
27 | Contact Information: | ||
28 | James P. Ketrenos <ipw2100-admin@linux.intel.com> | ||
29 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
30 | |||
31 | *******************************************************************************/ | ||
32 | |||
33 | #include <linux/compiler.h> | ||
34 | //#include <linux/config.h> | ||
35 | #include <linux/errno.h> | ||
36 | #include <linux/if_arp.h> | ||
37 | #include <linux/in6.h> | ||
38 | #include <linux/in.h> | ||
39 | #include <linux/ip.h> | ||
40 | #include <linux/kernel.h> | ||
41 | #include <linux/module.h> | ||
42 | #include <linux/netdevice.h> | ||
43 | #include <linux/pci.h> | ||
44 | #include <linux/proc_fs.h> | ||
45 | #include <linux/skbuff.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/tcp.h> | ||
48 | #include <linux/types.h> | ||
49 | #include <linux/wireless.h> | ||
50 | #include <linux/etherdevice.h> | ||
51 | #include <linux/uaccess.h> | ||
52 | #include <net/arp.h> | ||
53 | #include <net/net_namespace.h> | ||
54 | |||
55 | #include "ieee80211.h" | ||
56 | |||
57 | MODULE_DESCRIPTION("802.11 data/management/control stack"); | ||
58 | MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); | ||
59 | MODULE_LICENSE("GPL"); | ||
60 | |||
61 | #define DRV_NAME "ieee80211" | ||
62 | |||
63 | static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) | ||
64 | { | ||
65 | if (ieee->networks) | ||
66 | return 0; | ||
67 | |||
68 | ieee->networks = kcalloc( | ||
69 | MAX_NETWORK_COUNT, sizeof(struct ieee80211_network), | ||
70 | GFP_KERNEL); | ||
71 | if (!ieee->networks) | ||
72 | return -ENOMEM; | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline void ieee80211_networks_free(struct ieee80211_device *ieee) | ||
78 | { | ||
79 | if (!ieee->networks) | ||
80 | return; | ||
81 | kfree(ieee->networks); | ||
82 | ieee->networks = NULL; | ||
83 | } | ||
84 | |||
85 | static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) | ||
86 | { | ||
87 | int i; | ||
88 | |||
89 | INIT_LIST_HEAD(&ieee->network_free_list); | ||
90 | INIT_LIST_HEAD(&ieee->network_list); | ||
91 | for (i = 0; i < MAX_NETWORK_COUNT; i++) | ||
92 | list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); | ||
93 | } | ||
94 | |||
95 | |||
96 | struct net_device *alloc_ieee80211(int sizeof_priv) | ||
97 | { | ||
98 | struct ieee80211_device *ieee; | ||
99 | struct net_device *dev; | ||
100 | int i, err; | ||
101 | |||
102 | IEEE80211_DEBUG_INFO("Initializing...\n"); | ||
103 | |||
104 | dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); | ||
105 | if (!dev) { | ||
106 | IEEE80211_ERROR("Unable to network device.\n"); | ||
107 | goto failed; | ||
108 | } | ||
109 | ieee = netdev_priv(dev); | ||
110 | |||
111 | ieee->dev = dev; | ||
112 | |||
113 | err = ieee80211_networks_allocate(ieee); | ||
114 | if (err) { | ||
115 | IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", | ||
116 | err); | ||
117 | goto failed; | ||
118 | } | ||
119 | ieee80211_networks_initialize(ieee); | ||
120 | |||
121 | /* Default fragmentation threshold is maximum payload size */ | ||
122 | ieee->fts = DEFAULT_FTS; | ||
123 | ieee->scan_age = DEFAULT_MAX_SCAN_AGE; | ||
124 | ieee->open_wep = 1; | ||
125 | |||
126 | /* Default to enabling full open WEP with host based encrypt/decrypt */ | ||
127 | ieee->host_encrypt = 1; | ||
128 | ieee->host_decrypt = 1; | ||
129 | ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ | ||
130 | |||
131 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); | ||
132 | init_timer(&ieee->crypt_deinit_timer); | ||
133 | ieee->crypt_deinit_timer.data = (unsigned long)ieee; | ||
134 | ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; | ||
135 | |||
136 | spin_lock_init(&ieee->lock); | ||
137 | spin_lock_init(&ieee->wpax_suitlist_lock); | ||
138 | |||
139 | ieee->wpax_type_set = 0; | ||
140 | ieee->wpa_enabled = 0; | ||
141 | ieee->tkip_countermeasures = 0; | ||
142 | ieee->drop_unencrypted = 0; | ||
143 | ieee->privacy_invoked = 0; | ||
144 | ieee->ieee802_1x = 1; | ||
145 | ieee->raw_tx = 0; | ||
146 | |||
147 | ieee80211_softmac_init(ieee); | ||
148 | |||
149 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) | ||
150 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); | ||
151 | |||
152 | for (i = 0; i < 17; i++) { | ||
153 | ieee->last_rxseq_num[i] = -1; | ||
154 | ieee->last_rxfrag_num[i] = -1; | ||
155 | ieee->last_packet_time[i] = 0; | ||
156 | } | ||
157 | //These function were added to load crypte module autoly | ||
158 | ieee80211_tkip_null(); | ||
159 | ieee80211_wep_null(); | ||
160 | ieee80211_ccmp_null(); | ||
161 | return dev; | ||
162 | |||
163 | failed: | ||
164 | if (dev) | ||
165 | free_netdev(dev); | ||
166 | return NULL; | ||
167 | } | ||
168 | |||
169 | |||
170 | void free_ieee80211(struct net_device *dev) | ||
171 | { | ||
172 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
173 | |||
174 | int i; | ||
175 | struct list_head *p, *q; | ||
176 | |||
177 | |||
178 | ieee80211_softmac_free(ieee); | ||
179 | del_timer_sync(&ieee->crypt_deinit_timer); | ||
180 | ieee80211_crypt_deinit_entries(ieee, 1); | ||
181 | |||
182 | for (i = 0; i < WEP_KEYS; i++) { | ||
183 | struct ieee80211_crypt_data *crypt = ieee->crypt[i]; | ||
184 | if (crypt) { | ||
185 | if (crypt->ops) | ||
186 | crypt->ops->deinit(crypt->priv); | ||
187 | kfree(crypt); | ||
188 | ieee->crypt[i] = NULL; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | ieee80211_networks_free(ieee); | ||
193 | |||
194 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { | ||
195 | list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { | ||
196 | kfree(list_entry(p, struct ieee_ibss_seq, list)); | ||
197 | list_del(p); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | |||
202 | free_netdev(dev); | ||
203 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c deleted file mode 100644 index b522b57a2691..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ /dev/null | |||
@@ -1,1486 +0,0 @@ | |||
1 | /* | ||
2 | * Original code based Host AP (software wireless LAN access point) driver | ||
3 | * for Intersil Prism2/2.5/3 - hostap.o module, common routines | ||
4 | * | ||
5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
6 | * <jkmaline@cc.hut.fi> | ||
7 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
8 | * Copyright (c) 2004, Intel Corporation | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. See README and COPYING for | ||
13 | * more details. | ||
14 | ****************************************************************************** | ||
15 | |||
16 | Few modifications for Realtek's Wi-Fi drivers by | ||
17 | Andrea Merello <andrea.merello@gmail.com> | ||
18 | |||
19 | A special thanks goes to Realtek for their support ! | ||
20 | |||
21 | ******************************************************************************/ | ||
22 | |||
23 | |||
24 | #include <linux/compiler.h> | ||
25 | //#include <linux/config.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/if_arp.h> | ||
28 | #include <linux/in6.h> | ||
29 | #include <linux/in.h> | ||
30 | #include <linux/ip.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/netdevice.h> | ||
34 | #include <linux/pci.h> | ||
35 | #include <linux/proc_fs.h> | ||
36 | #include <linux/skbuff.h> | ||
37 | #include <linux/slab.h> | ||
38 | #include <linux/tcp.h> | ||
39 | #include <linux/types.h> | ||
40 | #include <linux/wireless.h> | ||
41 | #include <linux/etherdevice.h> | ||
42 | #include <linux/uaccess.h> | ||
43 | #include <linux/ctype.h> | ||
44 | |||
45 | #include "ieee80211.h" | ||
46 | #include "dot11d.h" | ||
47 | static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, | ||
48 | struct sk_buff *skb, | ||
49 | struct ieee80211_rx_stats *rx_stats) | ||
50 | { | ||
51 | struct ieee80211_hdr_4addr *hdr = | ||
52 | (struct ieee80211_hdr_4addr *)skb->data; | ||
53 | u16 fc = le16_to_cpu(hdr->frame_ctl); | ||
54 | |||
55 | skb->dev = ieee->dev; | ||
56 | skb_reset_mac_header(skb); | ||
57 | skb_pull(skb, ieee80211_get_hdrlen(fc)); | ||
58 | skb->pkt_type = PACKET_OTHERHOST; | ||
59 | skb->protocol = __constant_htons(ETH_P_80211_RAW); | ||
60 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
61 | netif_rx(skb); | ||
62 | } | ||
63 | |||
64 | |||
65 | /* Called only as a tasklet (software IRQ) */ | ||
66 | static struct ieee80211_frag_entry * | ||
67 | ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, | ||
68 | unsigned int frag, u8 tid, u8 *src, u8 *dst) | ||
69 | { | ||
70 | struct ieee80211_frag_entry *entry; | ||
71 | int i; | ||
72 | |||
73 | for (i = 0; i < IEEE80211_FRAG_CACHE_LEN; i++) { | ||
74 | entry = &ieee->frag_cache[tid][i]; | ||
75 | if (entry->skb != NULL && | ||
76 | time_after(jiffies, entry->first_frag_time + 2 * HZ)) { | ||
77 | IEEE80211_DEBUG_FRAG( | ||
78 | "expiring fragment cache entry " | ||
79 | "seq=%u last_frag=%u\n", | ||
80 | entry->seq, entry->last_frag); | ||
81 | dev_kfree_skb_any(entry->skb); | ||
82 | entry->skb = NULL; | ||
83 | } | ||
84 | |||
85 | if (entry->skb != NULL && entry->seq == seq && | ||
86 | (entry->last_frag + 1 == frag || frag == -1) && | ||
87 | memcmp(entry->src_addr, src, ETH_ALEN) == 0 && | ||
88 | memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) | ||
89 | return entry; | ||
90 | } | ||
91 | |||
92 | return NULL; | ||
93 | } | ||
94 | |||
95 | /* Called only as a tasklet (software IRQ) */ | ||
96 | static struct sk_buff * | ||
97 | ieee80211_frag_cache_get(struct ieee80211_device *ieee, | ||
98 | struct ieee80211_hdr_4addr *hdr) | ||
99 | { | ||
100 | struct sk_buff *skb = NULL; | ||
101 | u16 fc = le16_to_cpu(hdr->frame_ctl); | ||
102 | u16 sc = le16_to_cpu(hdr->seq_ctl); | ||
103 | unsigned int frag = WLAN_GET_SEQ_FRAG(sc); | ||
104 | unsigned int seq = WLAN_GET_SEQ_SEQ(sc); | ||
105 | struct ieee80211_frag_entry *entry; | ||
106 | struct ieee80211_hdr_3addrqos *hdr_3addrqos; | ||
107 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; | ||
108 | u8 tid; | ||
109 | |||
110 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { | ||
111 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; | ||
112 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
113 | tid = UP2AC(tid); | ||
114 | tid++; | ||
115 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { | ||
116 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; | ||
117 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
118 | tid = UP2AC(tid); | ||
119 | tid++; | ||
120 | } else { | ||
121 | tid = 0; | ||
122 | } | ||
123 | |||
124 | if (frag == 0) { | ||
125 | /* Reserve enough space to fit maximum frame length */ | ||
126 | skb = dev_alloc_skb(ieee->dev->mtu + | ||
127 | sizeof(struct ieee80211_hdr_4addr) + | ||
128 | 8 /* LLC */ + | ||
129 | 2 /* alignment */ + | ||
130 | 8 /* WEP */ + | ||
131 | ETH_ALEN /* WDS */ + | ||
132 | (IEEE80211_QOS_HAS_SEQ(fc) ? 2 : 0) /* QOS Control */); | ||
133 | if (skb == NULL) | ||
134 | return NULL; | ||
135 | |||
136 | entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]]; | ||
137 | ieee->frag_next_idx[tid]++; | ||
138 | if (ieee->frag_next_idx[tid] >= IEEE80211_FRAG_CACHE_LEN) | ||
139 | ieee->frag_next_idx[tid] = 0; | ||
140 | |||
141 | if (entry->skb != NULL) | ||
142 | dev_kfree_skb_any(entry->skb); | ||
143 | |||
144 | entry->first_frag_time = jiffies; | ||
145 | entry->seq = seq; | ||
146 | entry->last_frag = frag; | ||
147 | entry->skb = skb; | ||
148 | memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); | ||
149 | memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); | ||
150 | } else { | ||
151 | /* received a fragment of a frame for which the head fragment | ||
152 | * should have already been received */ | ||
153 | entry = ieee80211_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, | ||
154 | hdr->addr1); | ||
155 | if (entry != NULL) { | ||
156 | entry->last_frag = frag; | ||
157 | skb = entry->skb; | ||
158 | } | ||
159 | } | ||
160 | |||
161 | return skb; | ||
162 | } | ||
163 | |||
164 | |||
165 | /* Called only as a tasklet (software IRQ) */ | ||
166 | static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | ||
167 | struct ieee80211_hdr_4addr *hdr) | ||
168 | { | ||
169 | u16 fc = le16_to_cpu(hdr->frame_ctl); | ||
170 | u16 sc = le16_to_cpu(hdr->seq_ctl); | ||
171 | unsigned int seq = WLAN_GET_SEQ_SEQ(sc); | ||
172 | struct ieee80211_frag_entry *entry; | ||
173 | struct ieee80211_hdr_3addrqos *hdr_3addrqos; | ||
174 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; | ||
175 | u8 tid; | ||
176 | |||
177 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { | ||
178 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; | ||
179 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
180 | tid = UP2AC(tid); | ||
181 | tid++; | ||
182 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { | ||
183 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; | ||
184 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
185 | tid = UP2AC(tid); | ||
186 | tid++; | ||
187 | } else { | ||
188 | tid = 0; | ||
189 | } | ||
190 | |||
191 | entry = ieee80211_frag_cache_find(ieee, seq, -1, tid, hdr->addr2, | ||
192 | hdr->addr1); | ||
193 | |||
194 | if (entry == NULL) { | ||
195 | IEEE80211_DEBUG_FRAG( | ||
196 | "could not invalidate fragment cache " | ||
197 | "entry (seq=%u)\n", seq); | ||
198 | return -1; | ||
199 | } | ||
200 | |||
201 | entry->skb = NULL; | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | |||
206 | |||
207 | /* ieee80211_rx_frame_mgtmt | ||
208 | * | ||
209 | * Responsible for handling management control frames | ||
210 | * | ||
211 | * Called by ieee80211_rx */ | ||
212 | static inline int | ||
213 | ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
214 | struct ieee80211_rx_stats *rx_stats, u16 type, | ||
215 | u16 stype) | ||
216 | { | ||
217 | struct ieee80211_hdr_4addr *hdr; | ||
218 | |||
219 | // cheat the the hdr type | ||
220 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
221 | |||
222 | /* On the struct stats definition there is written that | ||
223 | * this is not mandatory.... but seems that the probe | ||
224 | * response parser uses it | ||
225 | */ | ||
226 | rx_stats->len = skb->len; | ||
227 | ieee80211_rx_mgt(ieee, (struct ieee80211_hdr_4addr *)skb->data, | ||
228 | rx_stats); | ||
229 | |||
230 | if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) { | ||
231 | dev_kfree_skb_any(skb); | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); | ||
236 | |||
237 | dev_kfree_skb_any(skb); | ||
238 | |||
239 | return 0; | ||
240 | |||
241 | } | ||
242 | |||
243 | |||
244 | |||
245 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | ||
246 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | ||
247 | static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
248 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | ||
249 | static unsigned char bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | ||
250 | /* No encapsulation header if EtherType < 0x600 (=length) */ | ||
251 | |||
252 | /* Called by ieee80211_rx_frame_decrypt */ | ||
253 | static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | ||
254 | struct sk_buff *skb, size_t hdrlen) | ||
255 | { | ||
256 | struct net_device *dev = ieee->dev; | ||
257 | u16 fc, ethertype; | ||
258 | struct ieee80211_hdr_4addr *hdr; | ||
259 | u8 *pos; | ||
260 | |||
261 | if (skb->len < 24) | ||
262 | return 0; | ||
263 | |||
264 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
265 | fc = le16_to_cpu(hdr->frame_ctl); | ||
266 | |||
267 | /* check that the frame is unicast frame to us */ | ||
268 | if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | ||
269 | IEEE80211_FCTL_TODS && | ||
270 | memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && | ||
271 | memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { | ||
272 | /* ToDS frame with own addr BSSID and DA */ | ||
273 | } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | ||
274 | IEEE80211_FCTL_FROMDS && | ||
275 | memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { | ||
276 | /* FromDS frame with own addr as DA */ | ||
277 | } else | ||
278 | return 0; | ||
279 | |||
280 | if (skb->len < 24 + 8) | ||
281 | return 0; | ||
282 | |||
283 | /* check for port access entity Ethernet type */ | ||
284 | // pos = skb->data + 24; | ||
285 | pos = skb->data + hdrlen; | ||
286 | ethertype = (pos[6] << 8) | pos[7]; | ||
287 | if (ethertype == ETH_P_PAE) | ||
288 | return 1; | ||
289 | |||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | ||
294 | static inline int | ||
295 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
296 | struct ieee80211_crypt_data *crypt) | ||
297 | { | ||
298 | struct ieee80211_hdr_4addr *hdr; | ||
299 | int res, hdrlen; | ||
300 | |||
301 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | ||
302 | return 0; | ||
303 | |||
304 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
305 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | ||
306 | |||
307 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | ||
308 | if (ieee->tkip_countermeasures && | ||
309 | strcmp(crypt->ops->name, "TKIP") == 0) { | ||
310 | if (net_ratelimit()) { | ||
311 | netdev_dbg(ieee->dev, | ||
312 | "TKIP countermeasures: dropped received packet from %pM\n", | ||
313 | ieee->dev->name, hdr->addr2); | ||
314 | } | ||
315 | return -1; | ||
316 | } | ||
317 | #endif | ||
318 | |||
319 | atomic_inc(&crypt->refcnt); | ||
320 | res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); | ||
321 | atomic_dec(&crypt->refcnt); | ||
322 | if (res < 0) { | ||
323 | IEEE80211_DEBUG_DROP( | ||
324 | "decryption failed (SA=%pM" | ||
325 | ") res=%d\n", hdr->addr2, res); | ||
326 | if (res == -2) | ||
327 | IEEE80211_DEBUG_DROP("Decryption failed ICV " | ||
328 | "mismatch (key %d)\n", | ||
329 | skb->data[hdrlen + 3] >> 6); | ||
330 | ieee->ieee_stats.rx_discards_undecryptable++; | ||
331 | return -1; | ||
332 | } | ||
333 | |||
334 | return res; | ||
335 | } | ||
336 | |||
337 | |||
338 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | ||
339 | static inline int | ||
340 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, | ||
341 | struct sk_buff *skb, int keyidx, | ||
342 | struct ieee80211_crypt_data *crypt) | ||
343 | { | ||
344 | struct ieee80211_hdr_4addr *hdr; | ||
345 | int res, hdrlen; | ||
346 | |||
347 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | ||
348 | return 0; | ||
349 | |||
350 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
351 | hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | ||
352 | |||
353 | atomic_inc(&crypt->refcnt); | ||
354 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); | ||
355 | atomic_dec(&crypt->refcnt); | ||
356 | if (res < 0) { | ||
357 | netdev_dbg(ieee->dev, | ||
358 | "MSDU decryption/MIC verification failed (SA=%pM keyidx=%d)\n", | ||
359 | hdr->addr2, keyidx); | ||
360 | return -1; | ||
361 | } | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | |||
367 | /* this function is stolen from ipw2200 driver*/ | ||
368 | #define IEEE_PACKET_RETRY_TIME (5*HZ) | ||
369 | static int is_duplicate_packet(struct ieee80211_device *ieee, | ||
370 | struct ieee80211_hdr_4addr *header) | ||
371 | { | ||
372 | u16 fc = le16_to_cpu(header->frame_ctl); | ||
373 | u16 sc = le16_to_cpu(header->seq_ctl); | ||
374 | u16 seq = WLAN_GET_SEQ_SEQ(sc); | ||
375 | u16 frag = WLAN_GET_SEQ_FRAG(sc); | ||
376 | u16 *last_seq, *last_frag; | ||
377 | unsigned long *last_time; | ||
378 | struct ieee80211_hdr_3addrqos *hdr_3addrqos; | ||
379 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; | ||
380 | u8 tid; | ||
381 | |||
382 | //TO2DS and QoS | ||
383 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { | ||
384 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; | ||
385 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
386 | tid = UP2AC(tid); | ||
387 | tid++; | ||
388 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { //QoS | ||
389 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; | ||
390 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | ||
391 | tid = UP2AC(tid); | ||
392 | tid++; | ||
393 | } else { // no QoS | ||
394 | tid = 0; | ||
395 | } | ||
396 | switch (ieee->iw_mode) { | ||
397 | case IW_MODE_ADHOC: | ||
398 | { | ||
399 | struct list_head *p; | ||
400 | struct ieee_ibss_seq *entry = NULL; | ||
401 | u8 *mac = header->addr2; | ||
402 | int index = mac[5] % IEEE_IBSS_MAC_HASH_SIZE; | ||
403 | |||
404 | list_for_each(p, &ieee->ibss_mac_hash[index]) { | ||
405 | entry = list_entry(p, struct ieee_ibss_seq, list); | ||
406 | if (!memcmp(entry->mac, mac, ETH_ALEN)) | ||
407 | break; | ||
408 | } | ||
409 | // if (memcmp(entry->mac, mac, ETH_ALEN)){ | ||
410 | if (p == &ieee->ibss_mac_hash[index]) { | ||
411 | entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); | ||
412 | if (!entry) | ||
413 | return 0; | ||
414 | |||
415 | memcpy(entry->mac, mac, ETH_ALEN); | ||
416 | entry->seq_num[tid] = seq; | ||
417 | entry->frag_num[tid] = frag; | ||
418 | entry->packet_time[tid] = jiffies; | ||
419 | list_add(&entry->list, &ieee->ibss_mac_hash[index]); | ||
420 | return 0; | ||
421 | } | ||
422 | last_seq = &entry->seq_num[tid]; | ||
423 | last_frag = &entry->frag_num[tid]; | ||
424 | last_time = &entry->packet_time[tid]; | ||
425 | break; | ||
426 | } | ||
427 | |||
428 | case IW_MODE_INFRA: | ||
429 | last_seq = &ieee->last_rxseq_num[tid]; | ||
430 | last_frag = &ieee->last_rxfrag_num[tid]; | ||
431 | last_time = &ieee->last_packet_time[tid]; | ||
432 | |||
433 | break; | ||
434 | default: | ||
435 | return 0; | ||
436 | } | ||
437 | |||
438 | // if(tid != 0) { | ||
439 | // printk(KERN_WARNING ":)))))))))))%x %x %x, fc(%x)\n", tid, *last_seq, seq, header->frame_ctl); | ||
440 | // } | ||
441 | if ((*last_seq == seq) && | ||
442 | time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { | ||
443 | if (*last_frag == frag) { | ||
444 | //printk(KERN_WARNING "[1] go drop!\n"); | ||
445 | goto drop; | ||
446 | |||
447 | } | ||
448 | if (*last_frag + 1 != frag) | ||
449 | /* out-of-order fragment */ | ||
450 | //printk(KERN_WARNING "[2] go drop!\n"); | ||
451 | goto drop; | ||
452 | } else | ||
453 | *last_seq = seq; | ||
454 | |||
455 | *last_frag = frag; | ||
456 | *last_time = jiffies; | ||
457 | return 0; | ||
458 | |||
459 | drop: | ||
460 | // BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); | ||
461 | // printk("DUP\n"); | ||
462 | |||
463 | return 1; | ||
464 | } | ||
465 | |||
466 | |||
467 | /* All received frames are sent to this function. @skb contains the frame in | ||
468 | * IEEE 802.11 format, i.e., in the format it was sent over air. | ||
469 | * This function is called only as a tasklet (software IRQ). */ | ||
470 | int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
471 | struct ieee80211_rx_stats *rx_stats) | ||
472 | { | ||
473 | struct net_device *dev = ieee->dev; | ||
474 | //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
475 | struct ieee80211_hdr_4addr *hdr; | ||
476 | |||
477 | size_t hdrlen; | ||
478 | u16 fc, type, stype, sc; | ||
479 | struct net_device_stats *stats; | ||
480 | unsigned int frag; | ||
481 | u8 *payload; | ||
482 | u16 ethertype; | ||
483 | u8 dst[ETH_ALEN]; | ||
484 | u8 src[ETH_ALEN]; | ||
485 | u8 bssid[ETH_ALEN]; | ||
486 | struct ieee80211_crypt_data *crypt = NULL; | ||
487 | int keyidx = 0; | ||
488 | |||
489 | // cheat the the hdr type | ||
490 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
491 | stats = &ieee->stats; | ||
492 | |||
493 | if (skb->len < 10) { | ||
494 | netdev_info(ieee->dev, "SKB length < 10\n"); | ||
495 | goto rx_dropped; | ||
496 | } | ||
497 | |||
498 | fc = le16_to_cpu(hdr->frame_ctl); | ||
499 | type = WLAN_FC_GET_TYPE(fc); | ||
500 | stype = WLAN_FC_GET_STYPE(fc); | ||
501 | sc = le16_to_cpu(hdr->seq_ctl); | ||
502 | |||
503 | frag = WLAN_GET_SEQ_FRAG(sc); | ||
504 | |||
505 | //YJ,add,080828,for keep alive | ||
506 | if ((fc & IEEE80211_FCTL_TODS) != IEEE80211_FCTL_TODS) { | ||
507 | if (!memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) | ||
508 | ieee->NumRxUnicast++; | ||
509 | } else { | ||
510 | if (!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) | ||
511 | ieee->NumRxUnicast++; | ||
512 | } | ||
513 | //YJ,add,080828,for keep alive,end | ||
514 | |||
515 | hdrlen = ieee80211_get_hdrlen(fc); | ||
516 | |||
517 | |||
518 | if (ieee->iw_mode == IW_MODE_MONITOR) { | ||
519 | ieee80211_monitor_rx(ieee, skb, rx_stats); | ||
520 | stats->rx_packets++; | ||
521 | stats->rx_bytes += skb->len; | ||
522 | return 1; | ||
523 | } | ||
524 | |||
525 | if (ieee->host_decrypt) { | ||
526 | int idx = 0; | ||
527 | if (skb->len >= hdrlen + 3) | ||
528 | idx = skb->data[hdrlen + 3] >> 6; | ||
529 | crypt = ieee->crypt[idx]; | ||
530 | |||
531 | /* allow NULL decrypt to indicate an station specific override | ||
532 | * for default encryption */ | ||
533 | if (crypt && (crypt->ops == NULL || | ||
534 | crypt->ops->decrypt_mpdu == NULL)) | ||
535 | crypt = NULL; | ||
536 | |||
537 | if (!crypt && (fc & IEEE80211_FCTL_WEP)) { | ||
538 | /* This seems to be triggered by some (multicast?) | ||
539 | * frames from other than current BSS, so just drop the | ||
540 | * frames silently instead of filling system log with | ||
541 | * these reports. */ | ||
542 | IEEE80211_DEBUG_DROP("Decryption failed (not set)" | ||
543 | " (SA=%pM)\n", | ||
544 | hdr->addr2); | ||
545 | ieee->ieee_stats.rx_discards_undecryptable++; | ||
546 | goto rx_dropped; | ||
547 | } | ||
548 | } | ||
549 | |||
550 | if (skb->len < IEEE80211_DATA_HDR3_LEN) | ||
551 | goto rx_dropped; | ||
552 | |||
553 | // if QoS enabled, should check the sequence for each of the AC | ||
554 | if (is_duplicate_packet(ieee, hdr)) | ||
555 | goto rx_dropped; | ||
556 | |||
557 | |||
558 | if (type == IEEE80211_FTYPE_MGMT) { | ||
559 | if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) | ||
560 | goto rx_dropped; | ||
561 | else | ||
562 | goto rx_exit; | ||
563 | } | ||
564 | |||
565 | /* Data frame - extract src/dst addresses */ | ||
566 | switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { | ||
567 | case IEEE80211_FCTL_FROMDS: | ||
568 | memcpy(dst, hdr->addr1, ETH_ALEN); | ||
569 | memcpy(src, hdr->addr3, ETH_ALEN); | ||
570 | memcpy(bssid, hdr->addr2, ETH_ALEN); | ||
571 | break; | ||
572 | case IEEE80211_FCTL_TODS: | ||
573 | memcpy(dst, hdr->addr3, ETH_ALEN); | ||
574 | memcpy(src, hdr->addr2, ETH_ALEN); | ||
575 | memcpy(bssid, hdr->addr1, ETH_ALEN); | ||
576 | break; | ||
577 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: | ||
578 | if (skb->len < IEEE80211_DATA_HDR4_LEN) | ||
579 | goto rx_dropped; | ||
580 | memcpy(dst, hdr->addr3, ETH_ALEN); | ||
581 | memcpy(src, hdr->addr4, ETH_ALEN); | ||
582 | memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); | ||
583 | break; | ||
584 | case 0: | ||
585 | memcpy(dst, hdr->addr1, ETH_ALEN); | ||
586 | memcpy(src, hdr->addr2, ETH_ALEN); | ||
587 | memcpy(bssid, hdr->addr3, ETH_ALEN); | ||
588 | break; | ||
589 | } | ||
590 | |||
591 | |||
592 | dev->last_rx = jiffies; | ||
593 | |||
594 | |||
595 | /* Nullfunc frames may have PS-bit set, so they must be passed to | ||
596 | * hostap_handle_sta_rx() before being dropped here. */ | ||
597 | if (stype != IEEE80211_STYPE_DATA && | ||
598 | stype != IEEE80211_STYPE_DATA_CFACK && | ||
599 | stype != IEEE80211_STYPE_DATA_CFPOLL && | ||
600 | stype != IEEE80211_STYPE_DATA_CFACKPOLL && | ||
601 | stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 | ||
602 | ) { | ||
603 | if (stype != IEEE80211_STYPE_NULLFUNC) | ||
604 | IEEE80211_DEBUG_DROP( | ||
605 | "RX: dropped data frame " | ||
606 | "with no data (type=0x%02x, " | ||
607 | "subtype=0x%02x, len=%d)\n", | ||
608 | type, stype, skb->len); | ||
609 | goto rx_dropped; | ||
610 | } | ||
611 | if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) | ||
612 | goto rx_dropped; | ||
613 | |||
614 | ieee->NumRxDataInPeriod++; | ||
615 | ieee->NumRxOkTotal++; | ||
616 | /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ | ||
617 | |||
618 | if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && | ||
619 | (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) | ||
620 | goto rx_dropped; | ||
621 | |||
622 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
623 | |||
624 | /* skb: hdr + (possibly fragmented) plaintext payload */ | ||
625 | // PR: FIXME: hostap has additional conditions in the "if" below: | ||
626 | // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && | ||
627 | if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { | ||
628 | int flen; | ||
629 | struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); | ||
630 | IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); | ||
631 | |||
632 | if (!frag_skb) { | ||
633 | IEEE80211_DEBUG(IEEE80211_DL_RX | IEEE80211_DL_FRAG, | ||
634 | "Rx cannot get skb from fragment " | ||
635 | "cache (morefrag=%d seq=%u frag=%u)\n", | ||
636 | (fc & IEEE80211_FCTL_MOREFRAGS) != 0, | ||
637 | WLAN_GET_SEQ_SEQ(sc), frag); | ||
638 | goto rx_dropped; | ||
639 | } | ||
640 | flen = skb->len; | ||
641 | if (frag != 0) | ||
642 | flen -= hdrlen; | ||
643 | |||
644 | if (frag_skb->tail + flen > frag_skb->end) { | ||
645 | netdev_warn(ieee->dev, | ||
646 | "host decrypted and reassembled frame did not fit skb\n"); | ||
647 | ieee80211_frag_cache_invalidate(ieee, hdr); | ||
648 | goto rx_dropped; | ||
649 | } | ||
650 | |||
651 | if (frag == 0) { | ||
652 | /* copy first fragment (including full headers) into | ||
653 | * beginning of the fragment cache skb */ | ||
654 | memcpy(skb_put(frag_skb, flen), skb->data, flen); | ||
655 | } else { | ||
656 | /* append frame payload to the end of the fragment | ||
657 | * cache skb */ | ||
658 | memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, | ||
659 | flen); | ||
660 | } | ||
661 | dev_kfree_skb_any(skb); | ||
662 | skb = NULL; | ||
663 | |||
664 | if (fc & IEEE80211_FCTL_MOREFRAGS) { | ||
665 | /* more fragments expected - leave the skb in fragment | ||
666 | * cache for now; it will be delivered to upper layers | ||
667 | * after all fragments have been received */ | ||
668 | goto rx_exit; | ||
669 | } | ||
670 | |||
671 | /* this was the last fragment and the frame will be | ||
672 | * delivered, so remove skb from fragment cache */ | ||
673 | skb = frag_skb; | ||
674 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
675 | ieee80211_frag_cache_invalidate(ieee, hdr); | ||
676 | } | ||
677 | |||
678 | /* skb: hdr + (possible reassembled) full MSDU payload; possibly still | ||
679 | * encrypted/authenticated */ | ||
680 | if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && | ||
681 | ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) | ||
682 | goto rx_dropped; | ||
683 | |||
684 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | ||
685 | if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { | ||
686 | if (/*ieee->ieee802_1x &&*/ | ||
687 | ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { | ||
688 | |||
689 | #ifdef CONFIG_IEEE80211_DEBUG | ||
690 | /* pass unencrypted EAPOL frames even if encryption is | ||
691 | * configured */ | ||
692 | struct eapol *eap = (struct eapol *)(skb->data + | ||
693 | 24); | ||
694 | IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", | ||
695 | eap_get_type(eap->type)); | ||
696 | #endif | ||
697 | } else { | ||
698 | IEEE80211_DEBUG_DROP( | ||
699 | "encryption configured, but RX " | ||
700 | "frame not encrypted (SA=%pM)\n", | ||
701 | hdr->addr2); | ||
702 | goto rx_dropped; | ||
703 | } | ||
704 | } | ||
705 | |||
706 | #ifdef CONFIG_IEEE80211_DEBUG | ||
707 | if (crypt && !(fc & IEEE80211_FCTL_WEP) && | ||
708 | ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { | ||
709 | struct eapol *eap = (struct eapol *)(skb->data + | ||
710 | 24); | ||
711 | IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", | ||
712 | eap_get_type(eap->type)); | ||
713 | } | ||
714 | #endif | ||
715 | |||
716 | if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep && | ||
717 | !ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { | ||
718 | IEEE80211_DEBUG_DROP( | ||
719 | "dropped unencrypted RX data " | ||
720 | "frame from %pM" | ||
721 | " (drop_unencrypted=1)\n", | ||
722 | hdr->addr2); | ||
723 | goto rx_dropped; | ||
724 | } | ||
725 | /* | ||
726 | if(ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { | ||
727 | printk(KERN_WARNING "RX: IEEE802.1X EPAOL frame!\n"); | ||
728 | } | ||
729 | */ | ||
730 | /* skb: hdr + (possible reassembled) full plaintext payload */ | ||
731 | payload = skb->data + hdrlen; | ||
732 | ethertype = (payload[6] << 8) | payload[7]; | ||
733 | |||
734 | |||
735 | /* convert hdr + possible LLC headers into Ethernet header */ | ||
736 | if (skb->len - hdrlen >= 8 && | ||
737 | ((memcmp(payload, rfc1042_header, SNAP_SIZE) == 0 && | ||
738 | ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || | ||
739 | memcmp(payload, bridge_tunnel_header, SNAP_SIZE) == 0)) { | ||
740 | /* remove RFC1042 or Bridge-Tunnel encapsulation and | ||
741 | * replace EtherType */ | ||
742 | skb_pull(skb, hdrlen + SNAP_SIZE); | ||
743 | memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); | ||
744 | memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); | ||
745 | } else { | ||
746 | u16 len; | ||
747 | /* Leave Ethernet header part of hdr and full payload */ | ||
748 | skb_pull(skb, hdrlen); | ||
749 | len = htons(skb->len); | ||
750 | memcpy(skb_push(skb, 2), &len, 2); | ||
751 | memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); | ||
752 | memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); | ||
753 | } | ||
754 | |||
755 | |||
756 | stats->rx_packets++; | ||
757 | stats->rx_bytes += skb->len; | ||
758 | |||
759 | if (skb) { | ||
760 | skb->protocol = eth_type_trans(skb, dev); | ||
761 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
762 | skb->dev = dev; | ||
763 | skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ | ||
764 | ieee->last_rx_ps_time = jiffies; | ||
765 | netif_rx(skb); | ||
766 | } | ||
767 | |||
768 | rx_exit: | ||
769 | return 1; | ||
770 | |||
771 | rx_dropped: | ||
772 | stats->rx_dropped++; | ||
773 | |||
774 | /* Returning 0 indicates to caller that we have not handled the SKB-- | ||
775 | * so it is still allocated and can be used again by underlying | ||
776 | * hardware as a DMA target */ | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 | ||
781 | |||
782 | static inline int ieee80211_is_ofdm_rate(u8 rate) | ||
783 | { | ||
784 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | ||
785 | case IEEE80211_OFDM_RATE_6MB: | ||
786 | case IEEE80211_OFDM_RATE_9MB: | ||
787 | case IEEE80211_OFDM_RATE_12MB: | ||
788 | case IEEE80211_OFDM_RATE_18MB: | ||
789 | case IEEE80211_OFDM_RATE_24MB: | ||
790 | case IEEE80211_OFDM_RATE_36MB: | ||
791 | case IEEE80211_OFDM_RATE_48MB: | ||
792 | case IEEE80211_OFDM_RATE_54MB: | ||
793 | return 1; | ||
794 | } | ||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | static inline int ieee80211_SignalStrengthTranslate(int CurrSS) | ||
799 | { | ||
800 | int RetSS; | ||
801 | |||
802 | // Step 1. Scale mapping. | ||
803 | if (CurrSS >= 71 && CurrSS <= 100) | ||
804 | RetSS = 90 + ((CurrSS - 70) / 3); | ||
805 | else if (CurrSS >= 41 && CurrSS <= 70) | ||
806 | RetSS = 78 + ((CurrSS - 40) / 3); | ||
807 | else if (CurrSS >= 31 && CurrSS <= 40) | ||
808 | RetSS = 66 + (CurrSS - 30); | ||
809 | else if (CurrSS >= 21 && CurrSS <= 30) | ||
810 | RetSS = 54 + (CurrSS - 20); | ||
811 | else if (CurrSS >= 5 && CurrSS <= 20) | ||
812 | RetSS = 42 + (((CurrSS - 5) * 2) / 3); | ||
813 | else if (CurrSS == 4) | ||
814 | RetSS = 36; | ||
815 | else if (CurrSS == 3) | ||
816 | RetSS = 27; | ||
817 | else if (CurrSS == 2) | ||
818 | RetSS = 18; | ||
819 | else if (CurrSS == 1) | ||
820 | RetSS = 9; | ||
821 | else | ||
822 | RetSS = CurrSS; | ||
823 | |||
824 | //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); | ||
825 | |||
826 | // Step 2. Smoothing. | ||
827 | |||
828 | //RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); | ||
829 | |||
830 | return RetSS; | ||
831 | } | ||
832 | |||
833 | static inline void | ||
834 | ieee80211_extract_country_ie(struct ieee80211_device *ieee, | ||
835 | struct ieee80211_info_element *info_element, | ||
836 | struct ieee80211_network *network, u8 *addr2) | ||
837 | { | ||
838 | if (IS_DOT11D_ENABLE(ieee)) { | ||
839 | if (info_element->len != 0) { | ||
840 | memcpy(network->CountryIeBuf, info_element->data, info_element->len); | ||
841 | network->CountryIeLen = info_element->len; | ||
842 | |||
843 | if (!IS_COUNTRY_IE_VALID(ieee)) | ||
844 | Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); | ||
845 | } | ||
846 | |||
847 | // | ||
848 | // 070305, rcnjko: I update country IE watch dog here because | ||
849 | // some AP (e.g. Cisco 1242) don't include country IE in their | ||
850 | // probe response frame. | ||
851 | // | ||
852 | if (IS_EQUAL_CIE_SRC(ieee, addr2)) | ||
853 | UPDATE_CIE_WATCHDOG(ieee); | ||
854 | } | ||
855 | |||
856 | } | ||
857 | |||
858 | /* SignalStrengthIndex is 0-100 */ | ||
859 | static int ieee80211_TranslateToDbm(unsigned char SignalStrengthIndex) | ||
860 | { | ||
861 | unsigned char SignalPower; // in dBm. | ||
862 | |||
863 | // Translate to dBm (x=0.5y-95). | ||
864 | SignalPower = (int)SignalStrengthIndex * 7 / 10; | ||
865 | SignalPower -= 95; | ||
866 | |||
867 | return SignalPower; | ||
868 | } | ||
869 | inline int ieee80211_network_init( | ||
870 | struct ieee80211_device *ieee, | ||
871 | struct ieee80211_probe_response *beacon, | ||
872 | struct ieee80211_network *network, | ||
873 | struct ieee80211_rx_stats *stats) | ||
874 | { | ||
875 | #ifdef CONFIG_IEEE80211_DEBUG | ||
876 | char rates_str[64]; | ||
877 | char *p; | ||
878 | #endif | ||
879 | struct ieee80211_info_element *info_element; | ||
880 | u16 left; | ||
881 | u8 i; | ||
882 | short offset; | ||
883 | u8 curRate = 0, hOpRate = 0, curRate_ex = 0; | ||
884 | |||
885 | /* Pull out fixed field data */ | ||
886 | memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); | ||
887 | network->capability = beacon->capability; | ||
888 | network->last_scanned = jiffies; | ||
889 | network->time_stamp[0] = beacon->time_stamp[0]; | ||
890 | network->time_stamp[1] = beacon->time_stamp[1]; | ||
891 | network->beacon_interval = beacon->beacon_interval; | ||
892 | /* Where to pull this? beacon->listen_interval;*/ | ||
893 | network->listen_interval = 0x0A; | ||
894 | network->rates_len = network->rates_ex_len = 0; | ||
895 | network->last_associate = 0; | ||
896 | network->ssid_len = 0; | ||
897 | network->flags = 0; | ||
898 | network->atim_window = 0; | ||
899 | network->QoS_Enable = 0; | ||
900 | //by amy 080312 | ||
901 | network->HighestOperaRate = 0; | ||
902 | //by amy 080312 | ||
903 | network->Turbo_Enable = 0; | ||
904 | network->CountryIeLen = 0; | ||
905 | memset(network->CountryIeBuf, 0, MAX_IE_LEN); | ||
906 | |||
907 | if (stats->freq == IEEE80211_52GHZ_BAND) { | ||
908 | /* for A band (No DS info) */ | ||
909 | network->channel = stats->received_channel; | ||
910 | } else | ||
911 | network->flags |= NETWORK_HAS_CCK; | ||
912 | |||
913 | network->wpa_ie_len = 0; | ||
914 | network->rsn_ie_len = 0; | ||
915 | |||
916 | info_element = &beacon->info_element; | ||
917 | left = stats->len - ((void *)info_element - (void *)beacon); | ||
918 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { | ||
919 | if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { | ||
920 | IEEE80211_DEBUG_SCAN("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%d left=%d.\n", | ||
921 | info_element->len + sizeof(struct ieee80211_info_element), | ||
922 | left); | ||
923 | return 1; | ||
924 | } | ||
925 | |||
926 | switch (info_element->id) { | ||
927 | case MFIE_TYPE_SSID: | ||
928 | if (ieee80211_is_empty_essid(info_element->data, | ||
929 | info_element->len)) { | ||
930 | network->flags |= NETWORK_EMPTY_ESSID; | ||
931 | break; | ||
932 | } | ||
933 | |||
934 | network->ssid_len = min(info_element->len, | ||
935 | (u8)IW_ESSID_MAX_SIZE); | ||
936 | memcpy(network->ssid, info_element->data, network->ssid_len); | ||
937 | if (network->ssid_len < IW_ESSID_MAX_SIZE) | ||
938 | memset(network->ssid + network->ssid_len, 0, | ||
939 | IW_ESSID_MAX_SIZE - network->ssid_len); | ||
940 | |||
941 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", | ||
942 | network->ssid, network->ssid_len); | ||
943 | break; | ||
944 | |||
945 | case MFIE_TYPE_RATES: | ||
946 | #ifdef CONFIG_IEEE80211_DEBUG | ||
947 | p = rates_str; | ||
948 | #endif | ||
949 | network->rates_len = min(info_element->len, MAX_RATES_LENGTH); | ||
950 | for (i = 0; i < network->rates_len; i++) { | ||
951 | network->rates[i] = info_element->data[i]; | ||
952 | curRate = network->rates[i] & 0x7f; | ||
953 | if (hOpRate < curRate) | ||
954 | hOpRate = curRate; | ||
955 | #ifdef CONFIG_IEEE80211_DEBUG | ||
956 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | ||
957 | #endif | ||
958 | if (ieee80211_is_ofdm_rate(info_element->data[i])) { | ||
959 | network->flags |= NETWORK_HAS_OFDM; | ||
960 | if (info_element->data[i] & | ||
961 | IEEE80211_BASIC_RATE_MASK) | ||
962 | network->flags &= | ||
963 | ~NETWORK_HAS_CCK; | ||
964 | } | ||
965 | } | ||
966 | |||
967 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_RATES: '%s' (%d)\n", | ||
968 | rates_str, network->rates_len); | ||
969 | break; | ||
970 | |||
971 | case MFIE_TYPE_RATES_EX: | ||
972 | #ifdef CONFIG_IEEE80211_DEBUG | ||
973 | p = rates_str; | ||
974 | #endif | ||
975 | network->rates_ex_len = min(info_element->len, MAX_RATES_EX_LENGTH); | ||
976 | for (i = 0; i < network->rates_ex_len; i++) { | ||
977 | network->rates_ex[i] = info_element->data[i]; | ||
978 | curRate_ex = network->rates_ex[i] & 0x7f; | ||
979 | if (hOpRate < curRate_ex) | ||
980 | hOpRate = curRate_ex; | ||
981 | #ifdef CONFIG_IEEE80211_DEBUG | ||
982 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | ||
983 | #endif | ||
984 | if (ieee80211_is_ofdm_rate(info_element->data[i])) { | ||
985 | network->flags |= NETWORK_HAS_OFDM; | ||
986 | if (info_element->data[i] & | ||
987 | IEEE80211_BASIC_RATE_MASK) | ||
988 | network->flags &= | ||
989 | ~NETWORK_HAS_CCK; | ||
990 | } | ||
991 | } | ||
992 | |||
993 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_RATES_EX: '%s' (%d)\n", | ||
994 | rates_str, network->rates_ex_len); | ||
995 | break; | ||
996 | |||
997 | case MFIE_TYPE_DS_SET: | ||
998 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", | ||
999 | info_element->data[0]); | ||
1000 | if (stats->freq == IEEE80211_24GHZ_BAND) | ||
1001 | network->channel = info_element->data[0]; | ||
1002 | break; | ||
1003 | |||
1004 | case MFIE_TYPE_FH_SET: | ||
1005 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); | ||
1006 | break; | ||
1007 | |||
1008 | case MFIE_TYPE_CF_SET: | ||
1009 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_CF_SET: ignored\n"); | ||
1010 | break; | ||
1011 | |||
1012 | case MFIE_TYPE_TIM: | ||
1013 | |||
1014 | if (info_element->len < 4) | ||
1015 | break; | ||
1016 | |||
1017 | network->dtim_period = info_element->data[1]; | ||
1018 | |||
1019 | if (ieee->state != IEEE80211_LINKED) | ||
1020 | break; | ||
1021 | |||
1022 | network->last_dtim_sta_time[0] = jiffies; | ||
1023 | network->last_dtim_sta_time[1] = stats->mac_time[1]; | ||
1024 | |||
1025 | network->dtim_data = IEEE80211_DTIM_VALID; | ||
1026 | |||
1027 | if (info_element->data[0] != 0) | ||
1028 | break; | ||
1029 | |||
1030 | if (info_element->data[2] & 1) | ||
1031 | network->dtim_data |= IEEE80211_DTIM_MBCAST; | ||
1032 | |||
1033 | offset = (info_element->data[2] >> 1)*2; | ||
1034 | |||
1035 | //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); | ||
1036 | |||
1037 | /* add and modified for ps 2008.1.22 */ | ||
1038 | if (ieee->assoc_id < 8*offset || | ||
1039 | ieee->assoc_id > 8*(offset + info_element->len - 3)) { | ||
1040 | break; | ||
1041 | } | ||
1042 | |||
1043 | offset = (ieee->assoc_id/8) - offset;// + ((aid % 8)? 0 : 1) ; | ||
1044 | |||
1045 | // printk("offset:%x data:%x, ucast:%d\n", offset, | ||
1046 | // info_element->data[3+offset] , | ||
1047 | // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); | ||
1048 | |||
1049 | if (info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) | ||
1050 | network->dtim_data |= IEEE80211_DTIM_UCAST; | ||
1051 | |||
1052 | break; | ||
1053 | |||
1054 | case MFIE_TYPE_IBSS_SET: | ||
1055 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n"); | ||
1056 | break; | ||
1057 | |||
1058 | case MFIE_TYPE_CHALLENGE: | ||
1059 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_CHALLENGE: ignored\n"); | ||
1060 | break; | ||
1061 | |||
1062 | case MFIE_TYPE_GENERIC: | ||
1063 | //nic is 87B | ||
1064 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", | ||
1065 | info_element->len); | ||
1066 | if (info_element->len >= 4 && | ||
1067 | info_element->data[0] == 0x00 && | ||
1068 | info_element->data[1] == 0x50 && | ||
1069 | info_element->data[2] == 0xf2 && | ||
1070 | info_element->data[3] == 0x01) { | ||
1071 | network->wpa_ie_len = min(info_element->len + 2, | ||
1072 | MAX_WPA_IE_LEN); | ||
1073 | memcpy(network->wpa_ie, info_element, | ||
1074 | network->wpa_ie_len); | ||
1075 | } | ||
1076 | |||
1077 | if (info_element->len == 7 && | ||
1078 | info_element->data[0] == 0x00 && | ||
1079 | info_element->data[1] == 0xe0 && | ||
1080 | info_element->data[2] == 0x4c && | ||
1081 | info_element->data[3] == 0x01 && | ||
1082 | info_element->data[4] == 0x02) { | ||
1083 | network->Turbo_Enable = 1; | ||
1084 | } | ||
1085 | if (1 == stats->nic_type) //nic 87 | ||
1086 | break; | ||
1087 | |||
1088 | if (info_element->len >= 5 && | ||
1089 | info_element->data[0] == 0x00 && | ||
1090 | info_element->data[1] == 0x50 && | ||
1091 | info_element->data[2] == 0xf2 && | ||
1092 | info_element->data[3] == 0x02 && | ||
1093 | info_element->data[4] == 0x00) { | ||
1094 | //printk(KERN_WARNING "wmm info updated: %x\n", info_element->data[6]); | ||
1095 | //WMM Information Element | ||
1096 | network->wmm_info = info_element->data[6]; | ||
1097 | network->QoS_Enable = 1; | ||
1098 | } | ||
1099 | |||
1100 | if (info_element->len >= 8 && | ||
1101 | info_element->data[0] == 0x00 && | ||
1102 | info_element->data[1] == 0x50 && | ||
1103 | info_element->data[2] == 0xf2 && | ||
1104 | info_element->data[3] == 0x02 && | ||
1105 | info_element->data[4] == 0x01) { | ||
1106 | // Not care about version at present. | ||
1107 | //WMM Information Element | ||
1108 | //printk(KERN_WARNING "wmm info¶m updated: %x\n", info_element->data[6]); | ||
1109 | network->wmm_info = info_element->data[6]; | ||
1110 | //WMM Parameter Element | ||
1111 | memcpy(network->wmm_param, (u8 *)(info_element->data + 8), (info_element->len - 8)); | ||
1112 | network->QoS_Enable = 1; | ||
1113 | } | ||
1114 | break; | ||
1115 | |||
1116 | case MFIE_TYPE_RSN: | ||
1117 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_RSN: %d bytes\n", | ||
1118 | info_element->len); | ||
1119 | network->rsn_ie_len = min(info_element->len + 2, | ||
1120 | MAX_WPA_IE_LEN); | ||
1121 | memcpy(network->rsn_ie, info_element, | ||
1122 | network->rsn_ie_len); | ||
1123 | break; | ||
1124 | case MFIE_TYPE_COUNTRY: | ||
1125 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n", | ||
1126 | info_element->len); | ||
1127 | // printk("=====>Receive <%s> Country IE\n",network->ssid); | ||
1128 | ieee80211_extract_country_ie(ieee, info_element, network, beacon->header.addr2); | ||
1129 | break; | ||
1130 | default: | ||
1131 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", | ||
1132 | info_element->id); | ||
1133 | break; | ||
1134 | } | ||
1135 | |||
1136 | left -= sizeof(struct ieee80211_info_element_hdr) + | ||
1137 | info_element->len; | ||
1138 | info_element = (struct ieee80211_info_element *) | ||
1139 | &info_element->data[info_element->len]; | ||
1140 | } | ||
1141 | //by amy 080312 | ||
1142 | network->HighestOperaRate = hOpRate; | ||
1143 | //by amy 080312 | ||
1144 | network->mode = 0; | ||
1145 | if (stats->freq == IEEE80211_52GHZ_BAND) | ||
1146 | network->mode = IEEE_A; | ||
1147 | else { | ||
1148 | if (network->flags & NETWORK_HAS_OFDM) | ||
1149 | network->mode |= IEEE_G; | ||
1150 | if (network->flags & NETWORK_HAS_CCK) | ||
1151 | network->mode |= IEEE_B; | ||
1152 | } | ||
1153 | |||
1154 | if (network->mode == 0) { | ||
1155 | IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' " | ||
1156 | "network.\n", | ||
1157 | escape_essid(network->ssid, | ||
1158 | network->ssid_len), | ||
1159 | network->bssid); | ||
1160 | return 1; | ||
1161 | } | ||
1162 | |||
1163 | if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) | ||
1164 | network->flags |= NETWORK_EMPTY_ESSID; | ||
1165 | |||
1166 | stats->signal = ieee80211_TranslateToDbm(stats->signalstrength); | ||
1167 | //stats->noise = stats->signal - stats->noise; | ||
1168 | stats->noise = ieee80211_TranslateToDbm(100 - stats->signalstrength) - 25; | ||
1169 | memcpy(&network->stats, stats, sizeof(network->stats)); | ||
1170 | |||
1171 | return 0; | ||
1172 | } | ||
1173 | |||
1174 | static inline int is_same_network(struct ieee80211_network *src, | ||
1175 | struct ieee80211_network *dst, | ||
1176 | struct ieee80211_device *ieee) | ||
1177 | { | ||
1178 | /* A network is only a duplicate if the channel, BSSID, ESSID | ||
1179 | * and the capability field (in particular IBSS and BSS) all match. | ||
1180 | * We treat all <hidden> with the same BSSID and channel | ||
1181 | * as one network */ | ||
1182 | return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod,080819,for hidden ap | ||
1183 | //((src->ssid_len == dst->ssid_len) && | ||
1184 | (src->channel == dst->channel) && | ||
1185 | !memcmp(src->bssid, dst->bssid, ETH_ALEN) && | ||
1186 | (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod,080819,for hidden ap | ||
1187 | //!memcmp(src->ssid, dst->ssid, src->ssid_len) && | ||
1188 | ((src->capability & WLAN_CAPABILITY_IBSS) == | ||
1189 | (dst->capability & WLAN_CAPABILITY_IBSS)) && | ||
1190 | ((src->capability & WLAN_CAPABILITY_BSS) == | ||
1191 | (dst->capability & WLAN_CAPABILITY_BSS))); | ||
1192 | } | ||
1193 | |||
1194 | inline void update_network(struct ieee80211_network *dst, | ||
1195 | struct ieee80211_network *src) | ||
1196 | { | ||
1197 | unsigned char quality = src->stats.signalstrength; | ||
1198 | unsigned char signal = 0; | ||
1199 | unsigned char noise = 0; | ||
1200 | if (dst->stats.signalstrength > 0) | ||
1201 | quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; | ||
1202 | signal = ieee80211_TranslateToDbm(quality); | ||
1203 | //noise = signal - src->stats.noise; | ||
1204 | if (dst->stats.noise > 0) | ||
1205 | noise = (dst->stats.noise * 5 + src->stats.noise)/6; | ||
1206 | //if(strcmp(dst->ssid, "linksys_lzm000") == 0) | ||
1207 | // printk("ssid:%s, quality:%d, signal:%d\n", dst->ssid, quality, signal); | ||
1208 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); | ||
1209 | dst->stats.signalstrength = quality; | ||
1210 | dst->stats.signal = signal; | ||
1211 | // printk("==================>stats.signal is %d\n",dst->stats.signal); | ||
1212 | dst->stats.noise = noise; | ||
1213 | |||
1214 | |||
1215 | dst->capability = src->capability; | ||
1216 | memcpy(dst->rates, src->rates, src->rates_len); | ||
1217 | dst->rates_len = src->rates_len; | ||
1218 | memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); | ||
1219 | dst->rates_ex_len = src->rates_ex_len; | ||
1220 | dst->HighestOperaRate = src->HighestOperaRate; | ||
1221 | //printk("==========>in %s: src->ssid is %s,chan is %d\n",__func__,src->ssid,src->channel); | ||
1222 | |||
1223 | //YJ,add,080819,for hidden ap | ||
1224 | if (src->ssid_len > 0) { | ||
1225 | //if(src->ssid_len == 13) | ||
1226 | // printk("=====================>>>>>>>> Dst ssid: %s Src ssid: %s\n", dst->ssid, src->ssid); | ||
1227 | memset(dst->ssid, 0, dst->ssid_len); | ||
1228 | dst->ssid_len = src->ssid_len; | ||
1229 | memcpy(dst->ssid, src->ssid, src->ssid_len); | ||
1230 | } | ||
1231 | //YJ,add,080819,for hidden ap,end | ||
1232 | |||
1233 | dst->channel = src->channel; | ||
1234 | dst->mode = src->mode; | ||
1235 | dst->flags = src->flags; | ||
1236 | dst->time_stamp[0] = src->time_stamp[0]; | ||
1237 | dst->time_stamp[1] = src->time_stamp[1]; | ||
1238 | |||
1239 | dst->beacon_interval = src->beacon_interval; | ||
1240 | dst->listen_interval = src->listen_interval; | ||
1241 | dst->atim_window = src->atim_window; | ||
1242 | dst->dtim_period = src->dtim_period; | ||
1243 | dst->dtim_data = src->dtim_data; | ||
1244 | dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0]; | ||
1245 | dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; | ||
1246 | // printk("update:%s, dtim_period:%x, dtim_data:%x\n", src->ssid, src->dtim_period, src->dtim_data); | ||
1247 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); | ||
1248 | dst->wpa_ie_len = src->wpa_ie_len; | ||
1249 | memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); | ||
1250 | dst->rsn_ie_len = src->rsn_ie_len; | ||
1251 | |||
1252 | dst->last_scanned = jiffies; | ||
1253 | /* dst->last_associate is not overwritten */ | ||
1254 | // disable QoS process now, added by David 2006/7/25 | ||
1255 | #if 1 | ||
1256 | dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. | ||
1257 | /* | ||
1258 | if((dst->wmm_info^src->wmm_info)&0x0f) {//Param Set Count change, update Parameter | ||
1259 | memcpy(dst->wmm_param, src->wmm_param, IEEE80211_AC_PRAM_LEN); | ||
1260 | } | ||
1261 | */ | ||
1262 | if (src->wmm_param[0].ac_aci_acm_aifsn || \ | ||
1263 | src->wmm_param[1].ac_aci_acm_aifsn || \ | ||
1264 | src->wmm_param[2].ac_aci_acm_aifsn || \ | ||
1265 | src->wmm_param[3].ac_aci_acm_aifsn) { | ||
1266 | memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); | ||
1267 | } | ||
1268 | dst->QoS_Enable = src->QoS_Enable; | ||
1269 | #else | ||
1270 | dst->QoS_Enable = 1;//for Rtl8187 simulation | ||
1271 | #endif | ||
1272 | dst->SignalStrength = src->SignalStrength; | ||
1273 | dst->Turbo_Enable = src->Turbo_Enable; | ||
1274 | dst->CountryIeLen = src->CountryIeLen; | ||
1275 | memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen); | ||
1276 | } | ||
1277 | |||
1278 | |||
1279 | inline void | ||
1280 | ieee80211_process_probe_response(struct ieee80211_device *ieee, | ||
1281 | struct ieee80211_probe_response *beacon, | ||
1282 | struct ieee80211_rx_stats *stats) | ||
1283 | { | ||
1284 | struct ieee80211_network network; | ||
1285 | struct ieee80211_network *target; | ||
1286 | struct ieee80211_network *oldest = NULL; | ||
1287 | #ifdef CONFIG_IEEE80211_DEBUG | ||
1288 | struct ieee80211_info_element *info_element = &beacon->info_element; | ||
1289 | #endif | ||
1290 | unsigned long flags; | ||
1291 | short renew; | ||
1292 | u8 wmm_info; | ||
1293 | u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON) ? 1 : 0; //YJ,add,080819,for hidden ap | ||
1294 | |||
1295 | memset(&network, 0, sizeof(struct ieee80211_network)); | ||
1296 | |||
1297 | IEEE80211_DEBUG_SCAN( | ||
1298 | "'%s' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", | ||
1299 | escape_essid(info_element->data, info_element->len), | ||
1300 | beacon->header.addr3, | ||
1301 | (beacon->capability & (1<<0xf)) ? '1' : '0', | ||
1302 | (beacon->capability & (1<<0xe)) ? '1' : '0', | ||
1303 | (beacon->capability & (1<<0xd)) ? '1' : '0', | ||
1304 | (beacon->capability & (1<<0xc)) ? '1' : '0', | ||
1305 | (beacon->capability & (1<<0xb)) ? '1' : '0', | ||
1306 | (beacon->capability & (1<<0xa)) ? '1' : '0', | ||
1307 | (beacon->capability & (1<<0x9)) ? '1' : '0', | ||
1308 | (beacon->capability & (1<<0x8)) ? '1' : '0', | ||
1309 | (beacon->capability & (1<<0x7)) ? '1' : '0', | ||
1310 | (beacon->capability & (1<<0x6)) ? '1' : '0', | ||
1311 | (beacon->capability & (1<<0x5)) ? '1' : '0', | ||
1312 | (beacon->capability & (1<<0x4)) ? '1' : '0', | ||
1313 | (beacon->capability & (1<<0x3)) ? '1' : '0', | ||
1314 | (beacon->capability & (1<<0x2)) ? '1' : '0', | ||
1315 | (beacon->capability & (1<<0x1)) ? '1' : '0', | ||
1316 | (beacon->capability & (1<<0x0)) ? '1' : '0'); | ||
1317 | |||
1318 | if (ieee80211_network_init(ieee, beacon, &network, stats)) { | ||
1319 | IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", | ||
1320 | escape_essid(info_element->data, | ||
1321 | info_element->len), | ||
1322 | beacon->header.addr3, | ||
1323 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | ||
1324 | IEEE80211_STYPE_PROBE_RESP ? | ||
1325 | "PROBE RESPONSE" : "BEACON"); | ||
1326 | return; | ||
1327 | } | ||
1328 | |||
1329 | // For Asus EeePc request, | ||
1330 | // (1) if wireless adapter receive get any 802.11d country code in AP beacon, | ||
1331 | // wireless adapter should follow the country code. | ||
1332 | // (2) If there is no any country code in beacon, | ||
1333 | // then wireless adapter should do active scan from ch1~11 and | ||
1334 | // passive scan from ch12~14 | ||
1335 | if (ieee->bGlobalDomain) { | ||
1336 | if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) { | ||
1337 | // Case 1: Country code | ||
1338 | if (IS_COUNTRY_IE_VALID(ieee)) { | ||
1339 | if (!IsLegalChannel(ieee, network.channel)) { | ||
1340 | printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); | ||
1341 | return; | ||
1342 | } | ||
1343 | } | ||
1344 | // Case 2: No any country code. | ||
1345 | else { | ||
1346 | // Filter over channel ch12~14 | ||
1347 | if (network.channel > 11) { | ||
1348 | printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); | ||
1349 | return; | ||
1350 | } | ||
1351 | } | ||
1352 | } else { | ||
1353 | // Case 1: Country code | ||
1354 | if (IS_COUNTRY_IE_VALID(ieee)) { | ||
1355 | if (!IsLegalChannel(ieee, network.channel)) { | ||
1356 | printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n", network.channel); | ||
1357 | return; | ||
1358 | } | ||
1359 | } | ||
1360 | // Case 2: No any country code. | ||
1361 | else { | ||
1362 | // Filter over channel ch12~14 | ||
1363 | if (network.channel > 14) { | ||
1364 | printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n", network.channel); | ||
1365 | return; | ||
1366 | } | ||
1367 | } | ||
1368 | } | ||
1369 | } | ||
1370 | /* The network parsed correctly -- so now we scan our known networks | ||
1371 | * to see if we can find it in our list. | ||
1372 | * | ||
1373 | * NOTE: This search is definitely not optimized. Once its doing | ||
1374 | * the "right thing" we'll optimize it for efficiency if | ||
1375 | * necessary */ | ||
1376 | |||
1377 | /* Search for this entry in the list and update it if it is | ||
1378 | * already there. */ | ||
1379 | |||
1380 | spin_lock_irqsave(&ieee->lock, flags); | ||
1381 | |||
1382 | if (is_same_network(&ieee->current_network, &network, ieee)) { | ||
1383 | wmm_info = ieee->current_network.wmm_info; | ||
1384 | //YJ,add,080819,for hidden ap | ||
1385 | if (is_beacon == 0) | ||
1386 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); | ||
1387 | else if (ieee->state == IEEE80211_LINKED) | ||
1388 | ieee->NumRxBcnInPeriod++; | ||
1389 | //YJ,add,080819,for hidden ap,end | ||
1390 | //printk("====>network.ssid=%s cur_ssid=%s\n", network.ssid, ieee->current_network.ssid); | ||
1391 | update_network(&ieee->current_network, &network); | ||
1392 | } | ||
1393 | |||
1394 | list_for_each_entry(target, &ieee->network_list, list) { | ||
1395 | if (is_same_network(target, &network, ieee)) | ||
1396 | break; | ||
1397 | if ((oldest == NULL) || | ||
1398 | (target->last_scanned < oldest->last_scanned)) | ||
1399 | oldest = target; | ||
1400 | } | ||
1401 | |||
1402 | /* If we didn't find a match, then get a new network slot to initialize | ||
1403 | * with this beacon's information */ | ||
1404 | if (&target->list == &ieee->network_list) { | ||
1405 | if (list_empty(&ieee->network_free_list)) { | ||
1406 | /* If there are no more slots, expire the oldest */ | ||
1407 | list_del(&oldest->list); | ||
1408 | target = oldest; | ||
1409 | IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from " | ||
1410 | "network list.\n", | ||
1411 | escape_essid(target->ssid, | ||
1412 | target->ssid_len), | ||
1413 | target->bssid); | ||
1414 | } else { | ||
1415 | /* Otherwise just pull from the free list */ | ||
1416 | target = list_entry(ieee->network_free_list.next, | ||
1417 | struct ieee80211_network, list); | ||
1418 | list_del(ieee->network_free_list.next); | ||
1419 | } | ||
1420 | |||
1421 | |||
1422 | #ifdef CONFIG_IEEE80211_DEBUG | ||
1423 | IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", | ||
1424 | escape_essid(network.ssid, | ||
1425 | network.ssid_len), | ||
1426 | network.bssid, | ||
1427 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | ||
1428 | IEEE80211_STYPE_PROBE_RESP ? | ||
1429 | "PROBE RESPONSE" : "BEACON"); | ||
1430 | #endif | ||
1431 | |||
1432 | memcpy(target, &network, sizeof(*target)); | ||
1433 | list_add_tail(&target->list, &ieee->network_list); | ||
1434 | } else { | ||
1435 | IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", | ||
1436 | escape_essid(target->ssid, | ||
1437 | target->ssid_len), | ||
1438 | target->bssid, | ||
1439 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == | ||
1440 | IEEE80211_STYPE_PROBE_RESP ? | ||
1441 | "PROBE RESPONSE" : "BEACON"); | ||
1442 | |||
1443 | /* we have an entry and we are going to update it. But this entry may | ||
1444 | * be already expired. In this case we do the same as we found a new | ||
1445 | * net and call the new_net handler | ||
1446 | */ | ||
1447 | renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); | ||
1448 | //YJ,add,080819,for hidden ap | ||
1449 | if (is_beacon == 0) | ||
1450 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); | ||
1451 | //if(strncmp(network.ssid, "linksys-c",9) == 0) | ||
1452 | // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); | ||
1453 | if (((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ | ||
1454 | && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ | ||
1455 | || ((ieee->current_network.ssid_len == network.ssid_len) && (strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0) && (ieee->state == IEEE80211_NOLINK)))) | ||
1456 | renew = 1; | ||
1457 | //YJ,add,080819,for hidden ap,end | ||
1458 | update_network(target, &network); | ||
1459 | } | ||
1460 | |||
1461 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1462 | } | ||
1463 | |||
1464 | void ieee80211_rx_mgt(struct ieee80211_device *ieee, | ||
1465 | struct ieee80211_hdr_4addr *header, | ||
1466 | struct ieee80211_rx_stats *stats) | ||
1467 | { | ||
1468 | switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { | ||
1469 | |||
1470 | case IEEE80211_STYPE_BEACON: | ||
1471 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", | ||
1472 | WLAN_FC_GET_STYPE(header->frame_ctl)); | ||
1473 | IEEE80211_DEBUG_SCAN("Beacon\n"); | ||
1474 | ieee80211_process_probe_response( | ||
1475 | ieee, (struct ieee80211_probe_response *)header, stats); | ||
1476 | break; | ||
1477 | |||
1478 | case IEEE80211_STYPE_PROBE_RESP: | ||
1479 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", | ||
1480 | WLAN_FC_GET_STYPE(header->frame_ctl)); | ||
1481 | IEEE80211_DEBUG_SCAN("Probe response\n"); | ||
1482 | ieee80211_process_probe_response( | ||
1483 | ieee, (struct ieee80211_probe_response *)header, stats); | ||
1484 | break; | ||
1485 | } | ||
1486 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c deleted file mode 100644 index 03eb164798cd..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ /dev/null | |||
@@ -1,2711 +0,0 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | ||
2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> | ||
3 | * | ||
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | ||
5 | * in-kernel generic ieee802.11 stack. | ||
6 | * | ||
7 | * Few lines might be stolen from other part of the ieee80211 | ||
8 | * stack. Copyright who own it's copyright | ||
9 | * | ||
10 | * WPA code stolen from the ipw2200 driver. | ||
11 | * Copyright who own it's copyright. | ||
12 | * | ||
13 | * released under the GPL | ||
14 | */ | ||
15 | |||
16 | #include "ieee80211.h" | ||
17 | |||
18 | #include <linux/random.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/uaccess.h> | ||
23 | #include <linux/etherdevice.h> | ||
24 | |||
25 | #include "dot11d.h" | ||
26 | |||
27 | short ieee80211_is_54g(const struct ieee80211_network *net) | ||
28 | { | ||
29 | return (net->rates_ex_len > 0) || (net->rates_len > 4); | ||
30 | } | ||
31 | |||
32 | short ieee80211_is_shortslot(const struct ieee80211_network *net) | ||
33 | { | ||
34 | return net->capability & WLAN_CAPABILITY_SHORT_SLOT; | ||
35 | } | ||
36 | |||
37 | /* returns the total length needed for placing the RATE MFIE | ||
38 | * tag and the EXTENDED RATE MFIE tag if needed. | ||
39 | * It encludes two bytes per tag for the tag itself and its len | ||
40 | */ | ||
41 | static unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee) | ||
42 | { | ||
43 | unsigned int rate_len = 0; | ||
44 | |||
45 | if (ieee->modulation & IEEE80211_CCK_MODULATION) | ||
46 | rate_len = IEEE80211_CCK_RATE_LEN + 2; | ||
47 | |||
48 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) | ||
49 | |||
50 | rate_len += IEEE80211_OFDM_RATE_LEN + 2; | ||
51 | |||
52 | return rate_len; | ||
53 | } | ||
54 | |||
55 | /* place the MFIE rate, tag to the memory (double) poised. | ||
56 | * Then it updates the pointer so that it points after the new MFIE tag added. | ||
57 | */ | ||
58 | static void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) | ||
59 | { | ||
60 | u8 *tag = *tag_p; | ||
61 | |||
62 | if (ieee->modulation & IEEE80211_CCK_MODULATION) { | ||
63 | *tag++ = MFIE_TYPE_RATES; | ||
64 | *tag++ = 4; | ||
65 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; | ||
66 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; | ||
67 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; | ||
68 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; | ||
69 | } | ||
70 | |||
71 | /* We may add an option for custom rates that specific HW might support */ | ||
72 | *tag_p = tag; | ||
73 | } | ||
74 | |||
75 | static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) | ||
76 | { | ||
77 | u8 *tag = *tag_p; | ||
78 | |||
79 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) { | ||
80 | *tag++ = MFIE_TYPE_RATES_EX; | ||
81 | *tag++ = 8; | ||
82 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; | ||
83 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; | ||
84 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; | ||
85 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; | ||
86 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; | ||
87 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; | ||
88 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; | ||
89 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; | ||
90 | |||
91 | } | ||
92 | /* We may add an option for custom rates that specific HW might support */ | ||
93 | *tag_p = tag; | ||
94 | } | ||
95 | |||
96 | static void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) | ||
97 | { | ||
98 | u8 *tag = *tag_p; | ||
99 | |||
100 | *tag++ = MFIE_TYPE_GENERIC; /* 0 */ | ||
101 | *tag++ = 7; | ||
102 | *tag++ = 0x00; | ||
103 | *tag++ = 0x50; | ||
104 | *tag++ = 0xf2; | ||
105 | *tag++ = 0x02; /* 5 */ | ||
106 | *tag++ = 0x00; | ||
107 | *tag++ = 0x01; | ||
108 | #ifdef SUPPORT_USPD | ||
109 | if (ieee->current_network.wmm_info & 0x80) | ||
110 | *tag++ = 0x0f|MAX_SP_Len; | ||
111 | else | ||
112 | *tag++ = MAX_SP_Len; | ||
113 | #else | ||
114 | *tag++ = MAX_SP_Len; | ||
115 | #endif | ||
116 | *tag_p = tag; | ||
117 | } | ||
118 | |||
119 | static void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) | ||
120 | { | ||
121 | u8 *tag = *tag_p; | ||
122 | *tag++ = MFIE_TYPE_GENERIC; /* 0 */ | ||
123 | *tag++ = 7; | ||
124 | *tag++ = 0x00; | ||
125 | *tag++ = 0xe0; | ||
126 | *tag++ = 0x4c; | ||
127 | *tag++ = 0x01; /* 5 */ | ||
128 | *tag++ = 0x02; | ||
129 | *tag++ = 0x11; | ||
130 | *tag++ = 0x00; | ||
131 | *tag_p = tag; | ||
132 | printk(KERN_ALERT "This is enable turbo mode IE process\n"); | ||
133 | } | ||
134 | |||
135 | static void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) | ||
136 | { | ||
137 | int nh; | ||
138 | nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM; | ||
139 | |||
140 | ieee->mgmt_queue_head = nh; | ||
141 | ieee->mgmt_queue_ring[nh] = skb; | ||
142 | } | ||
143 | |||
144 | static struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) | ||
145 | { | ||
146 | struct sk_buff *ret; | ||
147 | |||
148 | if (ieee->mgmt_queue_tail == ieee->mgmt_queue_head) | ||
149 | return NULL; | ||
150 | |||
151 | ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; | ||
152 | |||
153 | ieee->mgmt_queue_tail = | ||
154 | (ieee->mgmt_queue_tail + 1) % MGMT_QUEUE_NUM; | ||
155 | |||
156 | return ret; | ||
157 | } | ||
158 | |||
159 | static void init_mgmt_queue(struct ieee80211_device *ieee) | ||
160 | { | ||
161 | ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; | ||
162 | } | ||
163 | |||
164 | void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); | ||
165 | |||
166 | inline void softmac_mgmt_xmit(struct sk_buff *skb, | ||
167 | struct ieee80211_device *ieee) | ||
168 | { | ||
169 | unsigned long flags; | ||
170 | short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; | ||
171 | struct ieee80211_hdr_3addr *header = | ||
172 | (struct ieee80211_hdr_3addr *) skb->data; | ||
173 | |||
174 | spin_lock_irqsave(&ieee->lock, flags); | ||
175 | |||
176 | /* called with 2nd param 0, no mgmt lock required */ | ||
177 | ieee80211_sta_wakeup(ieee, 0); | ||
178 | |||
179 | if (single) { | ||
180 | if (ieee->queue_stop) { | ||
181 | enqueue_mgmt(ieee, skb); | ||
182 | } else { | ||
183 | header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0]<<4); | ||
184 | |||
185 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
186 | ieee->seq_ctrl[0] = 0; | ||
187 | else | ||
188 | ieee->seq_ctrl[0]++; | ||
189 | |||
190 | /* avoid watchdog triggers */ | ||
191 | ieee->dev->trans_start = jiffies; | ||
192 | ieee->softmac_data_hard_start_xmit(skb, ieee->dev, ieee->basic_rate); | ||
193 | } | ||
194 | |||
195 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
196 | } else { | ||
197 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
198 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); | ||
199 | |||
200 | header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); | ||
201 | |||
202 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
203 | ieee->seq_ctrl[0] = 0; | ||
204 | else | ||
205 | ieee->seq_ctrl[0]++; | ||
206 | |||
207 | /* avoid watchdog triggers */ | ||
208 | ieee->dev->trans_start = jiffies; | ||
209 | ieee->softmac_hard_start_xmit(skb, ieee->dev); | ||
210 | |||
211 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, | ||
216 | struct ieee80211_device *ieee) | ||
217 | { | ||
218 | short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; | ||
219 | struct ieee80211_hdr_3addr *header = | ||
220 | (struct ieee80211_hdr_3addr *) skb->data; | ||
221 | |||
222 | if (single) { | ||
223 | header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); | ||
224 | |||
225 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
226 | ieee->seq_ctrl[0] = 0; | ||
227 | else | ||
228 | ieee->seq_ctrl[0]++; | ||
229 | |||
230 | /* avoid watchdog triggers */ | ||
231 | ieee->dev->trans_start = jiffies; | ||
232 | ieee->softmac_data_hard_start_xmit(skb, ieee->dev, ieee->basic_rate); | ||
233 | } else { | ||
234 | header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); | ||
235 | |||
236 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
237 | ieee->seq_ctrl[0] = 0; | ||
238 | else | ||
239 | ieee->seq_ctrl[0]++; | ||
240 | |||
241 | /* avoid watchdog triggers */ | ||
242 | ieee->dev->trans_start = jiffies; | ||
243 | ieee->softmac_hard_start_xmit(skb, ieee->dev); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | inline struct sk_buff * | ||
248 | ieee80211_disassociate_skb(struct ieee80211_network *beacon, | ||
249 | struct ieee80211_device *ieee, u8 asRsn) | ||
250 | { | ||
251 | struct sk_buff *skb; | ||
252 | struct ieee80211_disassoc_frame *disass; | ||
253 | |||
254 | skb = dev_alloc_skb(sizeof(struct ieee80211_disassoc_frame)); | ||
255 | if (!skb) | ||
256 | return NULL; | ||
257 | |||
258 | disass = (struct ieee80211_disassoc_frame *) skb_put(skb, sizeof(struct ieee80211_disassoc_frame)); | ||
259 | disass->header.frame_control = cpu_to_le16(IEEE80211_STYPE_DISASSOC); | ||
260 | disass->header.duration_id = 0; | ||
261 | |||
262 | memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN); | ||
263 | memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
264 | memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN); | ||
265 | |||
266 | disass->reasoncode = asRsn; | ||
267 | return skb; | ||
268 | } | ||
269 | |||
270 | void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, u8 asRsn) | ||
271 | { | ||
272 | struct ieee80211_network *beacon = &ieee->current_network; | ||
273 | struct sk_buff *skb; | ||
274 | skb = ieee80211_disassociate_skb(beacon, ieee, asRsn); | ||
275 | if (skb) | ||
276 | softmac_mgmt_xmit(skb, ieee); | ||
277 | } | ||
278 | |||
279 | inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) | ||
280 | { | ||
281 | unsigned int len, rate_len; | ||
282 | u8 *tag; | ||
283 | struct sk_buff *skb; | ||
284 | struct ieee80211_probe_request *req; | ||
285 | |||
286 | len = ieee->current_network.ssid_len; | ||
287 | |||
288 | rate_len = ieee80211_MFIE_rate_len(ieee); | ||
289 | |||
290 | skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + | ||
291 | 2 + len + rate_len); | ||
292 | if (!skb) | ||
293 | return NULL; | ||
294 | |||
295 | req = (struct ieee80211_probe_request *) skb_put(skb, sizeof(struct ieee80211_probe_request)); | ||
296 | req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
297 | req->header.duration_id = 0; /* FIXME: is this OK ? */ | ||
298 | |||
299 | memset(req->header.addr1, 0xff, ETH_ALEN); | ||
300 | memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
301 | memset(req->header.addr3, 0xff, ETH_ALEN); | ||
302 | |||
303 | tag = (u8 *) skb_put(skb, len + 2 + rate_len); | ||
304 | |||
305 | *tag++ = MFIE_TYPE_SSID; | ||
306 | *tag++ = len; | ||
307 | memcpy(tag, ieee->current_network.ssid, len); | ||
308 | tag += len; | ||
309 | ieee80211_MFIE_Brate(ieee, &tag); | ||
310 | ieee80211_MFIE_Grate(ieee, &tag); | ||
311 | |||
312 | return skb; | ||
313 | } | ||
314 | |||
315 | struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); | ||
316 | |||
317 | static void ieee80211_send_beacon(struct ieee80211_device *ieee) | ||
318 | { | ||
319 | struct sk_buff *skb; | ||
320 | |||
321 | skb = ieee80211_get_beacon_(ieee); | ||
322 | |||
323 | if (skb) { | ||
324 | softmac_mgmt_xmit(skb, ieee); | ||
325 | ieee->softmac_stats.tx_beacons++; | ||
326 | dev_kfree_skb_any(skb); | ||
327 | } | ||
328 | |||
329 | ieee->beacon_timer.expires = jiffies + | ||
330 | (MSECS(ieee->current_network.beacon_interval - 5)); | ||
331 | |||
332 | if (ieee->beacon_txing) | ||
333 | add_timer(&ieee->beacon_timer); | ||
334 | } | ||
335 | |||
336 | |||
337 | static void ieee80211_send_beacon_cb(unsigned long _ieee) | ||
338 | { | ||
339 | struct ieee80211_device *ieee = | ||
340 | (struct ieee80211_device *) _ieee; | ||
341 | unsigned long flags; | ||
342 | |||
343 | spin_lock_irqsave(&ieee->beacon_lock, flags); | ||
344 | ieee80211_send_beacon(ieee); | ||
345 | spin_unlock_irqrestore(&ieee->beacon_lock, flags); | ||
346 | } | ||
347 | |||
348 | static void ieee80211_send_probe(struct ieee80211_device *ieee) | ||
349 | { | ||
350 | struct sk_buff *skb; | ||
351 | |||
352 | skb = ieee80211_probe_req(ieee); | ||
353 | if (skb) { | ||
354 | softmac_mgmt_xmit(skb, ieee); | ||
355 | ieee->softmac_stats.tx_probe_rq++; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | static void ieee80211_send_probe_requests(struct ieee80211_device *ieee) | ||
360 | { | ||
361 | if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)) { | ||
362 | ieee80211_send_probe(ieee); | ||
363 | ieee80211_send_probe(ieee); | ||
364 | } | ||
365 | } | ||
366 | |||
367 | /* this performs syncro scan blocking the caller until all channels | ||
368 | * in the allowed channel map has been checked. | ||
369 | */ | ||
370 | static void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) | ||
371 | { | ||
372 | short ch = 0; | ||
373 | u8 channel_map[MAX_CHANNEL_NUMBER+1]; | ||
374 | memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); | ||
375 | down(&ieee->scan_sem); | ||
376 | |||
377 | while (1) { | ||
378 | do { | ||
379 | ch++; | ||
380 | if (ch > MAX_CHANNEL_NUMBER) | ||
381 | goto out; /* scan completed */ | ||
382 | |||
383 | } while (!channel_map[ch]); | ||
384 | /* this function can be called in two situations | ||
385 | * 1- We have switched to ad-hoc mode and we are | ||
386 | * performing a complete syncro scan before conclude | ||
387 | * there are no interesting cell and to create a | ||
388 | * new one. In this case the link state is | ||
389 | * IEEE80211_NOLINK until we found an interesting cell. | ||
390 | * If so the ieee8021_new_net, called by the RX path | ||
391 | * will set the state to IEEE80211_LINKED, so we stop | ||
392 | * scanning | ||
393 | * 2- We are linked and the root uses run iwlist scan. | ||
394 | * So we switch to IEEE80211_LINKED_SCANNING to remember | ||
395 | * that we are still logically linked (not interested in | ||
396 | * new network events, despite for updating the net list, | ||
397 | * but we are temporarily 'unlinked' as the driver shall | ||
398 | * not filter RX frames and the channel is changing. | ||
399 | * So the only situation in witch are interested is to check | ||
400 | * if the state become LINKED because of the #1 situation | ||
401 | */ | ||
402 | |||
403 | if (ieee->state == IEEE80211_LINKED) | ||
404 | goto out; | ||
405 | |||
406 | ieee->set_chan(ieee->dev, ch); | ||
407 | if (channel_map[ch] == 1) | ||
408 | ieee80211_send_probe_requests(ieee); | ||
409 | |||
410 | /* this prevent excessive time wait when we | ||
411 | * need to wait for a syncro scan to end.. | ||
412 | */ | ||
413 | if (ieee->sync_scan_hurryup) | ||
414 | goto out; | ||
415 | |||
416 | msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME); | ||
417 | } | ||
418 | out: | ||
419 | ieee->sync_scan_hurryup = 0; | ||
420 | up(&ieee->scan_sem); | ||
421 | if (IS_DOT11D_ENABLE(ieee)) | ||
422 | DOT11D_ScanComplete(ieee); | ||
423 | } | ||
424 | |||
425 | void ieee80211_softmac_ips_scan_syncro(struct ieee80211_device *ieee) | ||
426 | { | ||
427 | int ch; | ||
428 | unsigned int watch_dog = 0; | ||
429 | u8 channel_map[MAX_CHANNEL_NUMBER+1]; | ||
430 | memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); | ||
431 | down(&ieee->scan_sem); | ||
432 | ch = ieee->current_network.channel; | ||
433 | |||
434 | while (1) { | ||
435 | /* this function can be called in two situations | ||
436 | * 1- We have switched to ad-hoc mode and we are | ||
437 | * performing a complete syncro scan before conclude | ||
438 | * there are no interesting cell and to create a | ||
439 | * new one. In this case the link state is | ||
440 | * IEEE80211_NOLINK until we found an interesting cell. | ||
441 | * If so the ieee8021_new_net, called by the RX path | ||
442 | * will set the state to IEEE80211_LINKED, so we stop | ||
443 | * scanning | ||
444 | * 2- We are linked and the root uses run iwlist scan. | ||
445 | * So we switch to IEEE80211_LINKED_SCANNING to remember | ||
446 | * that we are still logically linked (not interested in | ||
447 | * new network events, despite for updating the net list, | ||
448 | * but we are temporarily 'unlinked' as the driver shall | ||
449 | * not filter RX frames and the channel is changing. | ||
450 | * So the only situation in witch are interested is to check | ||
451 | * if the state become LINKED because of the #1 situation | ||
452 | */ | ||
453 | if (ieee->state == IEEE80211_LINKED) | ||
454 | goto out; | ||
455 | |||
456 | if (channel_map[ieee->current_network.channel] > 0) | ||
457 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
458 | |||
459 | if (channel_map[ieee->current_network.channel] == 1) | ||
460 | ieee80211_send_probe_requests(ieee); | ||
461 | |||
462 | msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME); | ||
463 | |||
464 | do { | ||
465 | if (watch_dog++ >= MAX_CHANNEL_NUMBER) | ||
466 | goto out; /* scan completed */ | ||
467 | |||
468 | ieee->current_network.channel = (ieee->current_network.channel + 1)%MAX_CHANNEL_NUMBER; | ||
469 | } while (!channel_map[ieee->current_network.channel]); | ||
470 | } | ||
471 | out: | ||
472 | ieee->actscanning = false; | ||
473 | up(&ieee->scan_sem); | ||
474 | if (IS_DOT11D_ENABLE(ieee)) | ||
475 | DOT11D_ScanComplete(ieee); | ||
476 | } | ||
477 | |||
478 | static void ieee80211_softmac_scan_wq(struct work_struct *work) | ||
479 | { | ||
480 | struct delayed_work *dwork = to_delayed_work(work); | ||
481 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); | ||
482 | static short watchdog; | ||
483 | u8 channel_map[MAX_CHANNEL_NUMBER+1]; | ||
484 | memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); | ||
485 | down(&ieee->scan_sem); | ||
486 | |||
487 | do { | ||
488 | ieee->current_network.channel = | ||
489 | (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; | ||
490 | if (watchdog++ > MAX_CHANNEL_NUMBER) | ||
491 | goto out; /* no good chans */ | ||
492 | } while (!channel_map[ieee->current_network.channel]); | ||
493 | |||
494 | if (ieee->scanning == 0) { | ||
495 | printk("error out, scanning = 0\n"); | ||
496 | goto out; | ||
497 | } | ||
498 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
499 | if (channel_map[ieee->current_network.channel] == 1) | ||
500 | ieee80211_send_probe_requests(ieee); | ||
501 | |||
502 | queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); | ||
503 | up(&ieee->scan_sem); | ||
504 | return; | ||
505 | out: | ||
506 | ieee->actscanning = false; | ||
507 | watchdog = 0; | ||
508 | ieee->scanning = 0; | ||
509 | up(&ieee->scan_sem); | ||
510 | |||
511 | if (IS_DOT11D_ENABLE(ieee)) | ||
512 | DOT11D_ScanComplete(ieee); | ||
513 | return; | ||
514 | } | ||
515 | |||
516 | static void ieee80211_beacons_start(struct ieee80211_device *ieee) | ||
517 | { | ||
518 | unsigned long flags; | ||
519 | |||
520 | spin_lock_irqsave(&ieee->beacon_lock, flags); | ||
521 | |||
522 | ieee->beacon_txing = 1; | ||
523 | ieee80211_send_beacon(ieee); | ||
524 | |||
525 | spin_unlock_irqrestore(&ieee->beacon_lock, flags); | ||
526 | } | ||
527 | |||
528 | static void ieee80211_beacons_stop(struct ieee80211_device *ieee) | ||
529 | { | ||
530 | unsigned long flags; | ||
531 | |||
532 | spin_lock_irqsave(&ieee->beacon_lock, flags); | ||
533 | |||
534 | ieee->beacon_txing = 0; | ||
535 | del_timer_sync(&ieee->beacon_timer); | ||
536 | |||
537 | spin_unlock_irqrestore(&ieee->beacon_lock, flags); | ||
538 | } | ||
539 | |||
540 | void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) | ||
541 | { | ||
542 | if (ieee->stop_send_beacons) | ||
543 | ieee->stop_send_beacons(ieee->dev); | ||
544 | if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) | ||
545 | ieee80211_beacons_stop(ieee); | ||
546 | } | ||
547 | |||
548 | void ieee80211_start_send_beacons(struct ieee80211_device *ieee) | ||
549 | { | ||
550 | if (ieee->start_send_beacons) | ||
551 | ieee->start_send_beacons(ieee->dev); | ||
552 | if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) | ||
553 | ieee80211_beacons_start(ieee); | ||
554 | } | ||
555 | |||
556 | static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) | ||
557 | { | ||
558 | down(&ieee->scan_sem); | ||
559 | |||
560 | if (ieee->scanning == 1) { | ||
561 | ieee->scanning = 0; | ||
562 | cancel_delayed_work(&ieee->softmac_scan_wq); | ||
563 | } | ||
564 | |||
565 | up(&ieee->scan_sem); | ||
566 | } | ||
567 | |||
568 | void ieee80211_stop_scan(struct ieee80211_device *ieee) | ||
569 | { | ||
570 | if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) | ||
571 | ieee80211_softmac_stop_scan(ieee); | ||
572 | else | ||
573 | ieee->stop_scan(ieee->dev); | ||
574 | } | ||
575 | |||
576 | /* called with ieee->lock held */ | ||
577 | void ieee80211_rtl_start_scan(struct ieee80211_device *ieee) | ||
578 | { | ||
579 | if (IS_DOT11D_ENABLE(ieee)) { | ||
580 | if (IS_COUNTRY_IE_VALID(ieee)) | ||
581 | RESET_CIE_WATCHDOG(ieee); | ||
582 | } | ||
583 | |||
584 | if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) { | ||
585 | if (ieee->scanning == 0) { | ||
586 | ieee->scanning = 1; | ||
587 | #if 1 | ||
588 | queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); | ||
589 | #endif | ||
590 | } | ||
591 | }else | ||
592 | ieee->start_scan(ieee->dev); | ||
593 | } | ||
594 | |||
595 | /* called with wx_sem held */ | ||
596 | void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) | ||
597 | { | ||
598 | if (IS_DOT11D_ENABLE(ieee)) { | ||
599 | if (IS_COUNTRY_IE_VALID(ieee)) | ||
600 | RESET_CIE_WATCHDOG(ieee); | ||
601 | } | ||
602 | ieee->sync_scan_hurryup = 0; | ||
603 | |||
604 | if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) | ||
605 | ieee80211_softmac_scan_syncro(ieee); | ||
606 | else | ||
607 | ieee->scan_syncro(ieee->dev); | ||
608 | } | ||
609 | |||
610 | inline struct sk_buff * | ||
611 | ieee80211_authentication_req(struct ieee80211_network *beacon, | ||
612 | struct ieee80211_device *ieee, int challengelen) | ||
613 | { | ||
614 | struct sk_buff *skb; | ||
615 | struct ieee80211_authentication *auth; | ||
616 | |||
617 | skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); | ||
618 | |||
619 | if (!skb) | ||
620 | return NULL; | ||
621 | |||
622 | auth = (struct ieee80211_authentication *) | ||
623 | skb_put(skb, sizeof(struct ieee80211_authentication)); | ||
624 | |||
625 | auth->header.frame_ctl = IEEE80211_STYPE_AUTH; | ||
626 | if (challengelen) | ||
627 | auth->header.frame_ctl |= IEEE80211_FCTL_WEP; | ||
628 | |||
629 | auth->header.duration_id = 0x013a; /* FIXME */ | ||
630 | |||
631 | memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); | ||
632 | memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
633 | memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); | ||
634 | |||
635 | auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; | ||
636 | |||
637 | auth->transaction = cpu_to_le16(ieee->associate_seq); | ||
638 | ieee->associate_seq++; | ||
639 | |||
640 | auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS); | ||
641 | |||
642 | return skb; | ||
643 | } | ||
644 | |||
645 | static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, | ||
646 | u8 *dest) | ||
647 | { | ||
648 | u8 *tag; | ||
649 | int beacon_size; | ||
650 | struct ieee80211_probe_response *beacon_buf; | ||
651 | struct sk_buff *skb; | ||
652 | int encrypt; | ||
653 | int atim_len, erp_len; | ||
654 | struct ieee80211_crypt_data *crypt; | ||
655 | |||
656 | char *ssid = ieee->current_network.ssid; | ||
657 | int ssid_len = ieee->current_network.ssid_len; | ||
658 | int rate_len = ieee->current_network.rates_len+2; | ||
659 | int rate_ex_len = ieee->current_network.rates_ex_len; | ||
660 | int wpa_ie_len = ieee->wpa_ie_len; | ||
661 | if (rate_ex_len > 0) | ||
662 | rate_ex_len += 2; | ||
663 | |||
664 | if (ieee->current_network.capability & WLAN_CAPABILITY_IBSS) | ||
665 | atim_len = 4; | ||
666 | else | ||
667 | atim_len = 0; | ||
668 | |||
669 | if (ieee80211_is_54g(&ieee->current_network)) | ||
670 | erp_len = 3; | ||
671 | else | ||
672 | erp_len = 0; | ||
673 | |||
674 | beacon_size = sizeof(struct ieee80211_probe_response)+ | ||
675 | ssid_len | ||
676 | +3 /* channel */ | ||
677 | +rate_len | ||
678 | +rate_ex_len | ||
679 | +atim_len | ||
680 | +wpa_ie_len | ||
681 | +erp_len; | ||
682 | |||
683 | skb = dev_alloc_skb(beacon_size); | ||
684 | |||
685 | if (!skb) | ||
686 | return NULL; | ||
687 | |||
688 | beacon_buf = (struct ieee80211_probe_response *) skb_put(skb, beacon_size); | ||
689 | |||
690 | memcpy(beacon_buf->header.addr1, dest, ETH_ALEN); | ||
691 | memcpy(beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
692 | memcpy(beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); | ||
693 | |||
694 | beacon_buf->header.duration_id = 0; /* FIXME */ | ||
695 | beacon_buf->beacon_interval = | ||
696 | cpu_to_le16(ieee->current_network.beacon_interval); | ||
697 | beacon_buf->capability = | ||
698 | cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); | ||
699 | |||
700 | if (ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) | ||
701 | beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); | ||
702 | |||
703 | crypt = ieee->crypt[ieee->tx_keyidx]; | ||
704 | |||
705 | encrypt = ieee->host_encrypt && crypt && crypt->ops && | ||
706 | ((0 == strcmp(crypt->ops->name, "WEP")) || wpa_ie_len); | ||
707 | |||
708 | if (encrypt) | ||
709 | beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); | ||
710 | |||
711 | |||
712 | beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); | ||
713 | |||
714 | beacon_buf->info_element.id = MFIE_TYPE_SSID; | ||
715 | beacon_buf->info_element.len = ssid_len; | ||
716 | |||
717 | tag = (u8 *) beacon_buf->info_element.data; | ||
718 | |||
719 | memcpy(tag, ssid, ssid_len); | ||
720 | |||
721 | tag += ssid_len; | ||
722 | |||
723 | *(tag++) = MFIE_TYPE_RATES; | ||
724 | *(tag++) = rate_len - 2; | ||
725 | memcpy(tag, ieee->current_network.rates, rate_len-2); | ||
726 | tag += rate_len - 2; | ||
727 | |||
728 | *(tag++) = MFIE_TYPE_DS_SET; | ||
729 | *(tag++) = 1; | ||
730 | *(tag++) = ieee->current_network.channel; | ||
731 | |||
732 | if (atim_len) { | ||
733 | *(tag++) = MFIE_TYPE_IBSS_SET; | ||
734 | *(tag++) = 2; | ||
735 | *((u16 *)(tag)) = cpu_to_le16(ieee->current_network.atim_window); | ||
736 | tag += 2; | ||
737 | } | ||
738 | |||
739 | if (erp_len) { | ||
740 | *(tag++) = MFIE_TYPE_ERP; | ||
741 | *(tag++) = 1; | ||
742 | *(tag++) = 0; | ||
743 | } | ||
744 | |||
745 | if (rate_ex_len) { | ||
746 | *(tag++) = MFIE_TYPE_RATES_EX; | ||
747 | *(tag++) = rate_ex_len-2; | ||
748 | memcpy(tag, ieee->current_network.rates_ex, rate_ex_len-2); | ||
749 | tag += rate_ex_len - 2; | ||
750 | } | ||
751 | |||
752 | if (wpa_ie_len) { | ||
753 | if (ieee->iw_mode == IW_MODE_ADHOC) { | ||
754 | /* as Windows will set pairwise key same as the group | ||
755 | * key which is not allowed in Linux, so set this for | ||
756 | * IOT issue. | ||
757 | */ | ||
758 | memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4); | ||
759 | } | ||
760 | |||
761 | memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); | ||
762 | } | ||
763 | skb->dev = ieee->dev; | ||
764 | return skb; | ||
765 | } | ||
766 | |||
767 | static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, | ||
768 | u8 *dest) | ||
769 | { | ||
770 | struct sk_buff *skb; | ||
771 | u8 *tag; | ||
772 | |||
773 | struct ieee80211_crypt_data *crypt; | ||
774 | struct ieee80211_assoc_response_frame *assoc; | ||
775 | short encrypt; | ||
776 | |||
777 | unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); | ||
778 | int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len; | ||
779 | |||
780 | skb = dev_alloc_skb(len); | ||
781 | |||
782 | if (!skb) | ||
783 | return NULL; | ||
784 | |||
785 | assoc = (struct ieee80211_assoc_response_frame *) | ||
786 | skb_put(skb, sizeof(struct ieee80211_assoc_response_frame)); | ||
787 | |||
788 | assoc->header.frame_control = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); | ||
789 | memcpy(assoc->header.addr1, dest, ETH_ALEN); | ||
790 | memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); | ||
791 | memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
792 | assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? | ||
793 | WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); | ||
794 | |||
795 | if (ieee->short_slot) | ||
796 | assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); | ||
797 | |||
798 | if (ieee->host_encrypt) | ||
799 | crypt = ieee->crypt[ieee->tx_keyidx]; | ||
800 | else | ||
801 | crypt = NULL; | ||
802 | |||
803 | encrypt = (crypt && crypt->ops); | ||
804 | |||
805 | if (encrypt) | ||
806 | assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); | ||
807 | |||
808 | assoc->status = 0; | ||
809 | assoc->aid = cpu_to_le16(ieee->assoc_id); | ||
810 | if (ieee->assoc_id == 0x2007) | ||
811 | ieee->assoc_id = 0; | ||
812 | else | ||
813 | ieee->assoc_id++; | ||
814 | |||
815 | tag = (u8 *) skb_put(skb, rate_len); | ||
816 | |||
817 | ieee80211_MFIE_Brate(ieee, &tag); | ||
818 | ieee80211_MFIE_Grate(ieee, &tag); | ||
819 | |||
820 | return skb; | ||
821 | } | ||
822 | |||
823 | static struct sk_buff *ieee80211_auth_resp(struct ieee80211_device *ieee, | ||
824 | int status, u8 *dest) | ||
825 | { | ||
826 | struct sk_buff *skb; | ||
827 | struct ieee80211_authentication *auth; | ||
828 | |||
829 | skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); | ||
830 | |||
831 | if (!skb) | ||
832 | return NULL; | ||
833 | |||
834 | skb->len = sizeof(struct ieee80211_authentication); | ||
835 | |||
836 | auth = (struct ieee80211_authentication *)skb->data; | ||
837 | |||
838 | auth->status = cpu_to_le16(status); | ||
839 | auth->transaction = cpu_to_le16(2); | ||
840 | auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); | ||
841 | |||
842 | memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); | ||
843 | memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
844 | memcpy(auth->header.addr1, dest, ETH_ALEN); | ||
845 | auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); | ||
846 | return skb; | ||
847 | } | ||
848 | |||
849 | static struct sk_buff *ieee80211_null_func(struct ieee80211_device *ieee, short pwr) | ||
850 | { | ||
851 | struct sk_buff *skb; | ||
852 | struct ieee80211_hdr_3addr *hdr; | ||
853 | |||
854 | skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); | ||
855 | |||
856 | if (!skb) | ||
857 | return NULL; | ||
858 | |||
859 | hdr = (struct ieee80211_hdr_3addr *)skb_put(skb, sizeof(struct ieee80211_hdr_3addr)); | ||
860 | |||
861 | memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); | ||
862 | memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
863 | memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); | ||
864 | |||
865 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | | ||
866 | IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | | ||
867 | (pwr ? IEEE80211_FCTL_PM:0)); | ||
868 | |||
869 | return skb; | ||
870 | } | ||
871 | |||
872 | static void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8 *dest) | ||
873 | { | ||
874 | struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); | ||
875 | |||
876 | if (buf) { | ||
877 | softmac_mgmt_xmit(buf, ieee); | ||
878 | dev_kfree_skb_any(buf); | ||
879 | } | ||
880 | } | ||
881 | |||
882 | static void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8 *dest) | ||
883 | { | ||
884 | struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); | ||
885 | |||
886 | if (buf) { | ||
887 | softmac_mgmt_xmit(buf, ieee); | ||
888 | dev_kfree_skb_any(buf); | ||
889 | } | ||
890 | } | ||
891 | |||
892 | static void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) | ||
893 | { | ||
894 | struct sk_buff *buf = ieee80211_probe_resp(ieee, dest); | ||
895 | |||
896 | if (buf) { | ||
897 | softmac_mgmt_xmit(buf, ieee); | ||
898 | dev_kfree_skb_any(buf); | ||
899 | } | ||
900 | } | ||
901 | |||
902 | inline struct sk_buff * | ||
903 | ieee80211_association_req(struct ieee80211_network *beacon, | ||
904 | struct ieee80211_device *ieee) | ||
905 | { | ||
906 | struct sk_buff *skb; | ||
907 | |||
908 | struct ieee80211_assoc_request_frame *hdr; | ||
909 | u8 *tag; | ||
910 | unsigned int wpa_len = beacon->wpa_ie_len; | ||
911 | #if 1 | ||
912 | /* for testing purpose */ | ||
913 | unsigned int rsn_len = beacon->rsn_ie_len; | ||
914 | #endif | ||
915 | unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); | ||
916 | unsigned int wmm_info_len = beacon->QoS_Enable?9:0; | ||
917 | unsigned int turbo_info_len = beacon->Turbo_Enable?9:0; | ||
918 | |||
919 | u8 encry_proto = ieee->wpax_type_notify & 0xff; | ||
920 | |||
921 | int len = 0; | ||
922 | |||
923 | /* [0] Notify type of encryption: WPA/WPA2 | ||
924 | * [1] pair wise type | ||
925 | * [2] authen type | ||
926 | */ | ||
927 | if (ieee->wpax_type_set) { | ||
928 | if (IEEE_PROTO_WPA == encry_proto) { | ||
929 | rsn_len = 0; | ||
930 | } else if (IEEE_PROTO_RSN == encry_proto) { | ||
931 | wpa_len = 0; | ||
932 | } | ||
933 | } | ||
934 | len = sizeof(struct ieee80211_assoc_request_frame)+ | ||
935 | + beacon->ssid_len /* essid tagged val */ | ||
936 | + rate_len /* rates tagged val */ | ||
937 | + wpa_len | ||
938 | + rsn_len | ||
939 | + wmm_info_len | ||
940 | + turbo_info_len; | ||
941 | |||
942 | skb = dev_alloc_skb(len); | ||
943 | |||
944 | if (!skb) | ||
945 | return NULL; | ||
946 | |||
947 | hdr = (struct ieee80211_assoc_request_frame *) | ||
948 | skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)); | ||
949 | |||
950 | hdr->header.frame_control = IEEE80211_STYPE_ASSOC_REQ; | ||
951 | hdr->header.duration_id = 37; /* FIXME */ | ||
952 | memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); | ||
953 | memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); | ||
954 | memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); | ||
955 | memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN); /* for HW security */ | ||
956 | |||
957 | hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS); | ||
958 | if (beacon->capability & WLAN_CAPABILITY_PRIVACY) | ||
959 | hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); | ||
960 | if (beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) | ||
961 | hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); | ||
962 | |||
963 | if (ieee->short_slot) | ||
964 | hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); | ||
965 | |||
966 | hdr->listen_interval = 0xa; /* FIXME */ | ||
967 | |||
968 | hdr->info_element.id = MFIE_TYPE_SSID; | ||
969 | |||
970 | hdr->info_element.len = beacon->ssid_len; | ||
971 | tag = skb_put(skb, beacon->ssid_len); | ||
972 | memcpy(tag, beacon->ssid, beacon->ssid_len); | ||
973 | |||
974 | tag = skb_put(skb, rate_len); | ||
975 | |||
976 | ieee80211_MFIE_Brate(ieee, &tag); | ||
977 | ieee80211_MFIE_Grate(ieee, &tag); | ||
978 | |||
979 | /* add rsn==0 condition for ap's mix security mode(wpa+wpa2) | ||
980 | * choose AES encryption as default algorithm while using mixed mode. | ||
981 | */ | ||
982 | |||
983 | tag = skb_put(skb, ieee->wpa_ie_len); | ||
984 | memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); | ||
985 | |||
986 | tag = skb_put(skb, wmm_info_len); | ||
987 | if (wmm_info_len) | ||
988 | ieee80211_WMM_Info(ieee, &tag); | ||
989 | |||
990 | tag = skb_put(skb, turbo_info_len); | ||
991 | if (turbo_info_len) | ||
992 | ieee80211_TURBO_Info(ieee, &tag); | ||
993 | |||
994 | return skb; | ||
995 | } | ||
996 | |||
997 | void ieee80211_associate_abort(struct ieee80211_device *ieee) | ||
998 | { | ||
999 | unsigned long flags; | ||
1000 | spin_lock_irqsave(&ieee->lock, flags); | ||
1001 | |||
1002 | ieee->associate_seq++; | ||
1003 | |||
1004 | /* don't scan, and avoid to have the RX path possibly | ||
1005 | * try again to associate. Even do not react to AUTH or | ||
1006 | * ASSOC response. Just wait for the retry wq to be scheduled. | ||
1007 | * Here we will check if there are good nets to associate | ||
1008 | * with, so we retry or just get back to NO_LINK and scanning | ||
1009 | */ | ||
1010 | if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING) { | ||
1011 | IEEE80211_DEBUG_MGMT("Authentication failed\n"); | ||
1012 | ieee->softmac_stats.no_auth_rs++; | ||
1013 | } else { | ||
1014 | IEEE80211_DEBUG_MGMT("Association failed\n"); | ||
1015 | ieee->softmac_stats.no_ass_rs++; | ||
1016 | } | ||
1017 | |||
1018 | ieee->state = IEEE80211_ASSOCIATING_RETRY; | ||
1019 | |||
1020 | queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); | ||
1021 | |||
1022 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1023 | } | ||
1024 | |||
1025 | static void ieee80211_associate_abort_cb(unsigned long dev) | ||
1026 | { | ||
1027 | ieee80211_associate_abort((struct ieee80211_device *) dev); | ||
1028 | } | ||
1029 | |||
1030 | static void ieee80211_associate_step1(struct ieee80211_device *ieee) | ||
1031 | { | ||
1032 | struct ieee80211_network *beacon = &ieee->current_network; | ||
1033 | struct sk_buff *skb; | ||
1034 | |||
1035 | IEEE80211_DEBUG_MGMT("Stopping scan\n"); | ||
1036 | ieee->softmac_stats.tx_auth_rq++; | ||
1037 | skb = ieee80211_authentication_req(beacon, ieee, 0); | ||
1038 | if (!skb) { | ||
1039 | ieee80211_associate_abort(ieee); | ||
1040 | } else { | ||
1041 | ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING; | ||
1042 | IEEE80211_DEBUG_MGMT("Sending authentication request\n"); | ||
1043 | softmac_mgmt_xmit(skb, ieee); | ||
1044 | /* BUGON when you try to add_timer twice, using mod_timer may | ||
1045 | * be better. | ||
1046 | */ | ||
1047 | if (!timer_pending(&ieee->associate_timer)) { | ||
1048 | ieee->associate_timer.expires = jiffies + (HZ / 2); | ||
1049 | add_timer(&ieee->associate_timer); | ||
1050 | } | ||
1051 | /* If call dev_kfree_skb_any,a warning will ocur.... | ||
1052 | * KERNEL: assertion (!atomic_read(&skb->users)) failed at | ||
1053 | * net/core/dev.c (1708) | ||
1054 | */ | ||
1055 | } | ||
1056 | } | ||
1057 | |||
1058 | static void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, | ||
1059 | int chlen) | ||
1060 | { | ||
1061 | u8 *c; | ||
1062 | struct sk_buff *skb; | ||
1063 | struct ieee80211_network *beacon = &ieee->current_network; | ||
1064 | del_timer_sync(&ieee->associate_timer); | ||
1065 | ieee->associate_seq++; | ||
1066 | ieee->softmac_stats.tx_auth_rq++; | ||
1067 | |||
1068 | skb = ieee80211_authentication_req(beacon, ieee, chlen+2); | ||
1069 | if (!skb) | ||
1070 | ieee80211_associate_abort(ieee); | ||
1071 | else { | ||
1072 | c = skb_put(skb, chlen+2); | ||
1073 | *(c++) = MFIE_TYPE_CHALLENGE; | ||
1074 | *(c++) = chlen; | ||
1075 | memcpy(c, challenge, chlen); | ||
1076 | |||
1077 | IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); | ||
1078 | |||
1079 | ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr)); | ||
1080 | |||
1081 | softmac_mgmt_xmit(skb, ieee); | ||
1082 | if (!timer_pending(&ieee->associate_timer)) { | ||
1083 | ieee->associate_timer.expires = jiffies + (HZ / 2); | ||
1084 | add_timer(&ieee->associate_timer); | ||
1085 | } | ||
1086 | dev_kfree_skb_any(skb); | ||
1087 | } | ||
1088 | kfree(challenge); | ||
1089 | } | ||
1090 | |||
1091 | static void ieee80211_associate_step2(struct ieee80211_device *ieee) | ||
1092 | { | ||
1093 | struct sk_buff *skb; | ||
1094 | struct ieee80211_network *beacon = &ieee->current_network; | ||
1095 | |||
1096 | del_timer_sync(&ieee->associate_timer); | ||
1097 | |||
1098 | IEEE80211_DEBUG_MGMT("Sending association request\n"); | ||
1099 | ieee->softmac_stats.tx_ass_rq++; | ||
1100 | skb = ieee80211_association_req(beacon, ieee); | ||
1101 | if (!skb) | ||
1102 | ieee80211_associate_abort(ieee); | ||
1103 | else { | ||
1104 | softmac_mgmt_xmit(skb, ieee); | ||
1105 | if (!timer_pending(&ieee->associate_timer)) { | ||
1106 | ieee->associate_timer.expires = jiffies + (HZ / 2); | ||
1107 | add_timer(&ieee->associate_timer); | ||
1108 | } | ||
1109 | } | ||
1110 | } | ||
1111 | |||
1112 | static void ieee80211_associate_complete_wq(struct work_struct *work) | ||
1113 | { | ||
1114 | struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); | ||
1115 | |||
1116 | printk(KERN_INFO "Associated successfully\n"); | ||
1117 | if (ieee80211_is_54g(&ieee->current_network) && | ||
1118 | (ieee->modulation & IEEE80211_OFDM_MODULATION)) { | ||
1119 | ieee->rate = 540; | ||
1120 | printk(KERN_INFO"Using G rates\n"); | ||
1121 | } else { | ||
1122 | ieee->rate = 110; | ||
1123 | printk(KERN_INFO"Using B rates\n"); | ||
1124 | } | ||
1125 | ieee->link_change(ieee->dev); | ||
1126 | notify_wx_assoc_event(ieee); | ||
1127 | if (ieee->data_hard_resume) | ||
1128 | ieee->data_hard_resume(ieee->dev); | ||
1129 | netif_carrier_on(ieee->dev); | ||
1130 | } | ||
1131 | |||
1132 | static void ieee80211_associate_complete(struct ieee80211_device *ieee) | ||
1133 | { | ||
1134 | del_timer_sync(&ieee->associate_timer); | ||
1135 | |||
1136 | ieee->state = IEEE80211_LINKED; | ||
1137 | IEEE80211_DEBUG_MGMT("Successfully associated\n"); | ||
1138 | |||
1139 | queue_work(ieee->wq, &ieee->associate_complete_wq); | ||
1140 | } | ||
1141 | |||
1142 | static void ieee80211_associate_procedure_wq(struct work_struct *work) | ||
1143 | { | ||
1144 | struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); | ||
1145 | |||
1146 | ieee->sync_scan_hurryup = 1; | ||
1147 | down(&ieee->wx_sem); | ||
1148 | |||
1149 | if (ieee->data_hard_stop) | ||
1150 | ieee->data_hard_stop(ieee->dev); | ||
1151 | |||
1152 | ieee80211_stop_scan(ieee); | ||
1153 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
1154 | |||
1155 | ieee->associate_seq = 1; | ||
1156 | ieee80211_associate_step1(ieee); | ||
1157 | |||
1158 | up(&ieee->wx_sem); | ||
1159 | } | ||
1160 | |||
1161 | inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, | ||
1162 | struct ieee80211_network *net) | ||
1163 | { | ||
1164 | u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; | ||
1165 | int tmp_ssid_len = 0; | ||
1166 | |||
1167 | short apset, ssidset, ssidbroad, apmatch, ssidmatch; | ||
1168 | |||
1169 | /* we are interested in new new only if we are not associated | ||
1170 | * and we are not associating / authenticating | ||
1171 | */ | ||
1172 | if (ieee->state != IEEE80211_NOLINK) | ||
1173 | return; | ||
1174 | |||
1175 | if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS)) | ||
1176 | return; | ||
1177 | |||
1178 | if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) | ||
1179 | return; | ||
1180 | |||
1181 | if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) { | ||
1182 | /* if the user specified the AP MAC, we need also the essid | ||
1183 | * This could be obtained by beacons or, if the network does not | ||
1184 | * broadcast it, it can be put manually. | ||
1185 | */ | ||
1186 | apset = ieee->wap_set; | ||
1187 | ssidset = ieee->ssid_set; | ||
1188 | ssidbroad = !(net->ssid_len == 0 || net->ssid[0] == '\0'); | ||
1189 | apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN) == 0); | ||
1190 | |||
1191 | if (ieee->current_network.ssid_len != net->ssid_len) | ||
1192 | ssidmatch = 0; | ||
1193 | else | ||
1194 | ssidmatch = (0 == strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len)); | ||
1195 | |||
1196 | /* if the user set the AP check if match. | ||
1197 | * if the network does not broadcast essid we check the user | ||
1198 | * supplied ANY essid | ||
1199 | * if the network does broadcast and the user does not set essid | ||
1200 | * it is OK | ||
1201 | * if the network does broadcast and the user did set essid | ||
1202 | * chech if essid match | ||
1203 | * (apset && apmatch && ((ssidset && ssidbroad && ssidmatch) || | ||
1204 | * (ssidbroad && !ssidset) || (!ssidbroad && ssidset))) || | ||
1205 | * if the ap is not set, check that the user set the bssid and | ||
1206 | * the network does broadcast and that those two bssid matches | ||
1207 | * (!apset && ssidset && ssidbroad && ssidmatch) | ||
1208 | */ | ||
1209 | if ((apset && apmatch && ((ssidset && ssidbroad && ssidmatch) || | ||
1210 | (ssidbroad && !ssidset) || (!ssidbroad && ssidset))) || | ||
1211 | (!apset && ssidset && ssidbroad && ssidmatch)) { | ||
1212 | /* if the essid is hidden replace it with the | ||
1213 | * essid provided by the user. | ||
1214 | */ | ||
1215 | if (!ssidbroad) { | ||
1216 | strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); | ||
1217 | tmp_ssid_len = ieee->current_network.ssid_len; | ||
1218 | } | ||
1219 | memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); | ||
1220 | |||
1221 | if (!ssidbroad) { | ||
1222 | strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); | ||
1223 | ieee->current_network.ssid_len = tmp_ssid_len; | ||
1224 | } | ||
1225 | printk(KERN_INFO"Linking with %s: channel is %d\n", ieee->current_network.ssid, ieee->current_network.channel); | ||
1226 | |||
1227 | if (ieee->iw_mode == IW_MODE_INFRA) { | ||
1228 | ieee->state = IEEE80211_ASSOCIATING; | ||
1229 | ieee->beinretry = false; | ||
1230 | queue_work(ieee->wq, &ieee->associate_procedure_wq); | ||
1231 | } else { | ||
1232 | if (ieee80211_is_54g(&ieee->current_network) && | ||
1233 | (ieee->modulation & IEEE80211_OFDM_MODULATION)) { | ||
1234 | ieee->rate = 540; | ||
1235 | printk(KERN_INFO"Using G rates\n"); | ||
1236 | } else { | ||
1237 | ieee->rate = 110; | ||
1238 | printk(KERN_INFO"Using B rates\n"); | ||
1239 | } | ||
1240 | ieee->state = IEEE80211_LINKED; | ||
1241 | ieee->beinretry = false; | ||
1242 | } | ||
1243 | } | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) | ||
1248 | { | ||
1249 | unsigned long flags; | ||
1250 | struct ieee80211_network *target; | ||
1251 | |||
1252 | spin_lock_irqsave(&ieee->lock, flags); | ||
1253 | list_for_each_entry(target, &ieee->network_list, list) { | ||
1254 | /* if the state become different that NOLINK means | ||
1255 | * we had found what we are searching for | ||
1256 | */ | ||
1257 | if (ieee->state != IEEE80211_NOLINK) | ||
1258 | break; | ||
1259 | |||
1260 | if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies)) | ||
1261 | ieee80211_softmac_new_net(ieee, target); | ||
1262 | } | ||
1263 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1264 | } | ||
1265 | |||
1266 | static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) | ||
1267 | { | ||
1268 | struct ieee80211_authentication *a; | ||
1269 | u8 *t; | ||
1270 | if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { | ||
1271 | IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); | ||
1272 | return 0xcafe; | ||
1273 | } | ||
1274 | *challenge = NULL; | ||
1275 | a = (struct ieee80211_authentication *) skb->data; | ||
1276 | if (skb->len > (sizeof(struct ieee80211_authentication) + 3)) { | ||
1277 | t = skb->data + sizeof(struct ieee80211_authentication); | ||
1278 | |||
1279 | if (*(t++) == MFIE_TYPE_CHALLENGE) { | ||
1280 | *chlen = *(t++); | ||
1281 | *challenge = kmemdup(t, *chlen, GFP_ATOMIC); | ||
1282 | if (!*challenge) | ||
1283 | return -ENOMEM; | ||
1284 | } | ||
1285 | } | ||
1286 | return cpu_to_le16(a->status); | ||
1287 | } | ||
1288 | |||
1289 | static int auth_rq_parse(struct sk_buff *skb, u8 *dest) | ||
1290 | { | ||
1291 | struct ieee80211_authentication *a; | ||
1292 | |||
1293 | if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { | ||
1294 | IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n", skb->len); | ||
1295 | return -1; | ||
1296 | } | ||
1297 | a = (struct ieee80211_authentication *) skb->data; | ||
1298 | |||
1299 | memcpy(dest, a->header.addr2, ETH_ALEN); | ||
1300 | |||
1301 | if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) | ||
1302 | return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; | ||
1303 | |||
1304 | return WLAN_STATUS_SUCCESS; | ||
1305 | } | ||
1306 | |||
1307 | static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
1308 | u8 *src) | ||
1309 | { | ||
1310 | u8 *tag; | ||
1311 | u8 *skbend; | ||
1312 | u8 *ssid = NULL; | ||
1313 | u8 ssidlen = 0; | ||
1314 | |||
1315 | struct ieee80211_hdr_3addr *header = | ||
1316 | (struct ieee80211_hdr_3addr *) skb->data; | ||
1317 | |||
1318 | if (skb->len < sizeof(struct ieee80211_hdr_3addr)) | ||
1319 | return -1; /* corrupted */ | ||
1320 | |||
1321 | memcpy(src, header->addr2, ETH_ALEN); | ||
1322 | |||
1323 | skbend = (u8 *)skb->data + skb->len; | ||
1324 | |||
1325 | tag = skb->data + sizeof(struct ieee80211_hdr_3addr); | ||
1326 | |||
1327 | while (tag+1 < skbend) { | ||
1328 | if (*tag == 0) { | ||
1329 | ssid = tag+2; | ||
1330 | ssidlen = *(tag+1); | ||
1331 | break; | ||
1332 | } | ||
1333 | tag++; /* point to the len field */ | ||
1334 | tag = tag + *(tag); /* point to the last data byte of the tag */ | ||
1335 | tag++; /* point to the next tag */ | ||
1336 | } | ||
1337 | |||
1338 | if (ssidlen == 0) | ||
1339 | return 1; | ||
1340 | |||
1341 | if (!ssid) | ||
1342 | return 1; /* ssid not found in tagged param */ | ||
1343 | |||
1344 | return (!strncmp(ssid, ieee->current_network.ssid, ssidlen)); | ||
1345 | |||
1346 | } | ||
1347 | |||
1348 | static int assoc_rq_parse(struct sk_buff *skb, u8 *dest) | ||
1349 | { | ||
1350 | struct ieee80211_assoc_request_frame *a; | ||
1351 | |||
1352 | if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - | ||
1353 | sizeof(struct ieee80211_info_element))) { | ||
1354 | |||
1355 | IEEE80211_DEBUG_MGMT("invalid len in auth request:%d\n", skb->len); | ||
1356 | return -1; | ||
1357 | } | ||
1358 | |||
1359 | a = (struct ieee80211_assoc_request_frame *) skb->data; | ||
1360 | |||
1361 | memcpy(dest, a->header.addr2, ETH_ALEN); | ||
1362 | |||
1363 | return 0; | ||
1364 | } | ||
1365 | |||
1366 | static inline u16 assoc_parse(struct sk_buff *skb, int *aid) | ||
1367 | { | ||
1368 | struct ieee80211_assoc_response_frame *a; | ||
1369 | if (skb->len < sizeof(struct ieee80211_assoc_response_frame)) { | ||
1370 | IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); | ||
1371 | return 0xcafe; | ||
1372 | } | ||
1373 | |||
1374 | a = (struct ieee80211_assoc_response_frame *) skb->data; | ||
1375 | *aid = le16_to_cpu(a->aid) & 0x3fff; | ||
1376 | return le16_to_cpu(a->status); | ||
1377 | } | ||
1378 | |||
1379 | static inline void ieee80211_rx_probe_rq(struct ieee80211_device *ieee, | ||
1380 | struct sk_buff *skb) | ||
1381 | { | ||
1382 | u8 dest[ETH_ALEN]; | ||
1383 | |||
1384 | ieee->softmac_stats.rx_probe_rq++; | ||
1385 | if (probe_rq_parse(ieee, skb, dest)) { | ||
1386 | ieee->softmac_stats.tx_probe_rs++; | ||
1387 | ieee80211_resp_to_probe(ieee, dest); | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1391 | inline void ieee80211_rx_auth_rq(struct ieee80211_device *ieee, | ||
1392 | struct sk_buff *skb) | ||
1393 | { | ||
1394 | u8 dest[ETH_ALEN]; | ||
1395 | int status; | ||
1396 | ieee->softmac_stats.rx_auth_rq++; | ||
1397 | |||
1398 | status = auth_rq_parse(skb, dest); | ||
1399 | if (status != -1) | ||
1400 | ieee80211_resp_to_auth(ieee, status, dest); | ||
1401 | } | ||
1402 | |||
1403 | inline void | ||
1404 | ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) | ||
1405 | { | ||
1406 | |||
1407 | u8 dest[ETH_ALEN]; | ||
1408 | |||
1409 | ieee->softmac_stats.rx_ass_rq++; | ||
1410 | if (assoc_rq_parse(skb, dest) != -1) | ||
1411 | ieee80211_resp_to_assoc_rq(ieee, dest); | ||
1412 | |||
1413 | |||
1414 | printk(KERN_INFO"New client associated: %pM\n", dest); | ||
1415 | } | ||
1416 | |||
1417 | void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) | ||
1418 | { | ||
1419 | struct sk_buff *buf = ieee80211_null_func(ieee, pwr); | ||
1420 | |||
1421 | if (buf) | ||
1422 | softmac_ps_mgmt_xmit(buf, ieee); | ||
1423 | } | ||
1424 | |||
1425 | static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, | ||
1426 | u32 *time_l) | ||
1427 | { | ||
1428 | int timeout = 0; | ||
1429 | |||
1430 | u8 dtim; | ||
1431 | dtim = ieee->current_network.dtim_data; | ||
1432 | |||
1433 | if (!(dtim & IEEE80211_DTIM_VALID)) | ||
1434 | return 0; | ||
1435 | else | ||
1436 | timeout = ieee->current_network.beacon_interval; | ||
1437 | |||
1438 | ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; | ||
1439 | |||
1440 | if (dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST) & ieee->ps)) | ||
1441 | return 2; | ||
1442 | |||
1443 | if (!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) | ||
1444 | return 0; | ||
1445 | |||
1446 | if (!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) | ||
1447 | return 0; | ||
1448 | |||
1449 | if ((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) && | ||
1450 | (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) | ||
1451 | return 0; | ||
1452 | |||
1453 | if (time_l) { | ||
1454 | *time_l = ieee->current_network.last_dtim_sta_time[0] | ||
1455 | + MSECS((ieee->current_network.beacon_interval)); | ||
1456 | } | ||
1457 | |||
1458 | if (time_h) { | ||
1459 | *time_h = ieee->current_network.last_dtim_sta_time[1]; | ||
1460 | if (time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) | ||
1461 | *time_h += 1; | ||
1462 | } | ||
1463 | |||
1464 | return 1; | ||
1465 | } | ||
1466 | |||
1467 | static inline void ieee80211_sta_ps(struct ieee80211_device *ieee) | ||
1468 | { | ||
1469 | |||
1470 | u32 th, tl; | ||
1471 | short sleep; | ||
1472 | |||
1473 | unsigned long flags, flags2; | ||
1474 | |||
1475 | spin_lock_irqsave(&ieee->lock, flags); | ||
1476 | |||
1477 | if ((ieee->ps == IEEE80211_PS_DISABLED || | ||
1478 | ieee->iw_mode != IW_MODE_INFRA || | ||
1479 | ieee->state != IEEE80211_LINKED)) { | ||
1480 | |||
1481 | /* #warning CHECK_LOCK_HERE */ | ||
1482 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); | ||
1483 | |||
1484 | ieee80211_sta_wakeup(ieee, 1); | ||
1485 | |||
1486 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); | ||
1487 | } | ||
1488 | |||
1489 | sleep = ieee80211_sta_ps_sleep(ieee, &th, &tl); | ||
1490 | /* 2 wake, 1 sleep, 0 do nothing */ | ||
1491 | if (sleep == 0) | ||
1492 | goto out; | ||
1493 | |||
1494 | if (sleep == 1) { | ||
1495 | if (ieee->sta_sleep == 1) | ||
1496 | ieee->enter_sleep_state(ieee->dev, th, tl); | ||
1497 | |||
1498 | else if (ieee->sta_sleep == 0) { | ||
1499 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); | ||
1500 | if (ieee->ps_is_queue_empty(ieee->dev)) { | ||
1501 | ieee->sta_sleep = 2; | ||
1502 | |||
1503 | ieee->ps_request_tx_ack(ieee->dev); | ||
1504 | |||
1505 | ieee80211_sta_ps_send_null_frame(ieee, 1); | ||
1506 | |||
1507 | ieee->ps_th = th; | ||
1508 | ieee->ps_tl = tl; | ||
1509 | } | ||
1510 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); | ||
1511 | } | ||
1512 | } else if (sleep == 2) { | ||
1513 | /* #warning CHECK_LOCK_HERE */ | ||
1514 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); | ||
1515 | |||
1516 | ieee80211_sta_wakeup(ieee, 1); | ||
1517 | |||
1518 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); | ||
1519 | } | ||
1520 | out: | ||
1521 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1522 | } | ||
1523 | |||
1524 | void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) | ||
1525 | { | ||
1526 | if (ieee->sta_sleep == 0) { | ||
1527 | if (nl) { | ||
1528 | ieee->ps_request_tx_ack(ieee->dev); | ||
1529 | ieee80211_sta_ps_send_null_frame(ieee, 0); | ||
1530 | } | ||
1531 | return; | ||
1532 | } | ||
1533 | |||
1534 | if (ieee->sta_sleep == 1) | ||
1535 | ieee->sta_wake_up(ieee->dev); | ||
1536 | |||
1537 | ieee->sta_sleep = 0; | ||
1538 | |||
1539 | if (nl) { | ||
1540 | ieee->ps_request_tx_ack(ieee->dev); | ||
1541 | ieee80211_sta_ps_send_null_frame(ieee, 0); | ||
1542 | } | ||
1543 | } | ||
1544 | |||
1545 | void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) | ||
1546 | { | ||
1547 | unsigned long flags, flags2; | ||
1548 | |||
1549 | spin_lock_irqsave(&ieee->lock, flags); | ||
1550 | if (ieee->sta_sleep == 2) { | ||
1551 | /* Null frame with PS bit set */ | ||
1552 | if (success) { | ||
1553 | ieee->sta_sleep = 1; | ||
1554 | ieee->enter_sleep_state(ieee->dev, ieee->ps_th, ieee->ps_tl); | ||
1555 | } | ||
1556 | /* if the card report not success we can't be sure the AP | ||
1557 | * has not RXed so we can't assume the AP believe us awake | ||
1558 | */ | ||
1559 | } else { | ||
1560 | if ((ieee->sta_sleep == 0) && !success) { | ||
1561 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); | ||
1562 | ieee80211_sta_ps_send_null_frame(ieee, 0); | ||
1563 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); | ||
1564 | } | ||
1565 | } | ||
1566 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1567 | } | ||
1568 | |||
1569 | inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, | ||
1570 | struct sk_buff *skb, | ||
1571 | struct ieee80211_rx_stats *rx_stats, | ||
1572 | u16 type, u16 stype) | ||
1573 | { | ||
1574 | struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; | ||
1575 | u16 errcode; | ||
1576 | u8 *challenge = NULL; | ||
1577 | int chlen = 0; | ||
1578 | int aid = 0; | ||
1579 | struct ieee80211_assoc_response_frame *assoc_resp; | ||
1580 | struct ieee80211_info_element *info_element; | ||
1581 | |||
1582 | if (!ieee->proto_started) | ||
1583 | return 0; | ||
1584 | |||
1585 | if (ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED && | ||
1586 | ieee->iw_mode == IW_MODE_INFRA && | ||
1587 | ieee->state == IEEE80211_LINKED)) | ||
1588 | |||
1589 | tasklet_schedule(&ieee->ps_task); | ||
1590 | |||
1591 | if (WLAN_FC_GET_STYPE(header->frame_control) != IEEE80211_STYPE_PROBE_RESP && | ||
1592 | WLAN_FC_GET_STYPE(header->frame_control) != IEEE80211_STYPE_BEACON) | ||
1593 | ieee->last_rx_ps_time = jiffies; | ||
1594 | |||
1595 | switch (WLAN_FC_GET_STYPE(header->frame_control)) { | ||
1596 | case IEEE80211_STYPE_ASSOC_RESP: | ||
1597 | case IEEE80211_STYPE_REASSOC_RESP: | ||
1598 | IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", | ||
1599 | WLAN_FC_GET_STYPE(header->frame_ctl)); | ||
1600 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && | ||
1601 | ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && | ||
1602 | ieee->iw_mode == IW_MODE_INFRA) { | ||
1603 | errcode = assoc_parse(skb, &aid); | ||
1604 | if (0 == errcode) { | ||
1605 | u16 left; | ||
1606 | |||
1607 | ieee->state = IEEE80211_LINKED; | ||
1608 | ieee->assoc_id = aid; | ||
1609 | ieee->softmac_stats.rx_ass_ok++; | ||
1610 | /* card type is 8187 */ | ||
1611 | if (1 == rx_stats->nic_type) | ||
1612 | goto associate_complete; | ||
1613 | |||
1614 | assoc_resp = (struct ieee80211_assoc_response_frame *)skb->data; | ||
1615 | info_element = &assoc_resp->info_element; | ||
1616 | left = skb->len - ((void *)info_element - (void *)assoc_resp); | ||
1617 | |||
1618 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { | ||
1619 | if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { | ||
1620 | printk(KERN_WARNING "[re]associate response error!"); | ||
1621 | return 1; | ||
1622 | } | ||
1623 | switch (info_element->id) { | ||
1624 | case MFIE_TYPE_GENERIC: | ||
1625 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len); | ||
1626 | if (info_element->len >= 8 && | ||
1627 | info_element->data[0] == 0x00 && | ||
1628 | info_element->data[1] == 0x50 && | ||
1629 | info_element->data[2] == 0xf2 && | ||
1630 | info_element->data[3] == 0x02 && | ||
1631 | info_element->data[4] == 0x01) { | ||
1632 | /* Not care about version at present. | ||
1633 | * WMM Parameter Element. | ||
1634 | */ | ||
1635 | memcpy(ieee->current_network.wmm_param, (u8 *)(info_element->data\ | ||
1636 | + 8), (info_element->len - 8)); | ||
1637 | |||
1638 | if (((ieee->current_network.wmm_info^info_element->data[6])& \ | ||
1639 | 0x0f) || (!ieee->init_wmmparam_flag)) { | ||
1640 | /* refresh parameter element for current network | ||
1641 | * update the register parameter for hardware. | ||
1642 | */ | ||
1643 | ieee->init_wmmparam_flag = 1; | ||
1644 | queue_work(ieee->wq, &ieee->wmm_param_update_wq); | ||
1645 | } | ||
1646 | /* update info_element for current network */ | ||
1647 | ieee->current_network.wmm_info = info_element->data[6]; | ||
1648 | } | ||
1649 | break; | ||
1650 | default: | ||
1651 | /* nothing to do at present!!! */ | ||
1652 | break; | ||
1653 | } | ||
1654 | |||
1655 | left -= sizeof(struct ieee80211_info_element_hdr) + | ||
1656 | info_element->len; | ||
1657 | info_element = (struct ieee80211_info_element *) | ||
1658 | &info_element->data[info_element->len]; | ||
1659 | } | ||
1660 | /* legacy AP, reset the AC_xx_param register */ | ||
1661 | if (!ieee->init_wmmparam_flag) { | ||
1662 | queue_work(ieee->wq, &ieee->wmm_param_update_wq); | ||
1663 | ieee->init_wmmparam_flag = 1; /* indicate AC_xx_param upated since last associate */ | ||
1664 | } | ||
1665 | associate_complete: | ||
1666 | ieee80211_associate_complete(ieee); | ||
1667 | } else { | ||
1668 | ieee->softmac_stats.rx_ass_err++; | ||
1669 | IEEE80211_DEBUG_MGMT( | ||
1670 | "Association response status code 0x%x\n", | ||
1671 | errcode); | ||
1672 | ieee80211_associate_abort(ieee); | ||
1673 | } | ||
1674 | } | ||
1675 | break; | ||
1676 | case IEEE80211_STYPE_ASSOC_REQ: | ||
1677 | case IEEE80211_STYPE_REASSOC_REQ: | ||
1678 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && | ||
1679 | ieee->iw_mode == IW_MODE_MASTER) | ||
1680 | |||
1681 | ieee80211_rx_assoc_rq(ieee, skb); | ||
1682 | break; | ||
1683 | case IEEE80211_STYPE_AUTH: | ||
1684 | if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { | ||
1685 | if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && | ||
1686 | ieee->iw_mode == IW_MODE_INFRA){ | ||
1687 | IEEE80211_DEBUG_MGMT("Received authentication response"); | ||
1688 | |||
1689 | errcode = auth_parse(skb, &challenge, &chlen); | ||
1690 | if (0 == errcode) { | ||
1691 | if (ieee->open_wep || !challenge) { | ||
1692 | ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; | ||
1693 | ieee->softmac_stats.rx_auth_rs_ok++; | ||
1694 | |||
1695 | ieee80211_associate_step2(ieee); | ||
1696 | } else { | ||
1697 | ieee80211_rtl_auth_challenge(ieee, challenge, chlen); | ||
1698 | } | ||
1699 | } else { | ||
1700 | ieee->softmac_stats.rx_auth_rs_err++; | ||
1701 | IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x", errcode); | ||
1702 | ieee80211_associate_abort(ieee); | ||
1703 | } | ||
1704 | |||
1705 | } else if (ieee->iw_mode == IW_MODE_MASTER) { | ||
1706 | ieee80211_rx_auth_rq(ieee, skb); | ||
1707 | } | ||
1708 | } | ||
1709 | break; | ||
1710 | case IEEE80211_STYPE_PROBE_REQ: | ||
1711 | if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && | ||
1712 | ((ieee->iw_mode == IW_MODE_ADHOC || | ||
1713 | ieee->iw_mode == IW_MODE_MASTER) && | ||
1714 | ieee->state == IEEE80211_LINKED)) | ||
1715 | |||
1716 | ieee80211_rx_probe_rq(ieee, skb); | ||
1717 | break; | ||
1718 | case IEEE80211_STYPE_DISASSOC: | ||
1719 | case IEEE80211_STYPE_DEAUTH: | ||
1720 | /* FIXME for now repeat all the association procedure | ||
1721 | * both for disassociation and deauthentication | ||
1722 | */ | ||
1723 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && | ||
1724 | (ieee->state == IEEE80211_LINKED) && | ||
1725 | (ieee->iw_mode == IW_MODE_INFRA) && | ||
1726 | (!memcmp(header->addr2, ieee->current_network.bssid, ETH_ALEN))) { | ||
1727 | ieee->state = IEEE80211_ASSOCIATING; | ||
1728 | ieee->softmac_stats.reassoc++; | ||
1729 | |||
1730 | queue_work(ieee->wq, &ieee->associate_procedure_wq); | ||
1731 | } | ||
1732 | break; | ||
1733 | default: | ||
1734 | return -1; | ||
1735 | break; | ||
1736 | } | ||
1737 | return 0; | ||
1738 | } | ||
1739 | |||
1740 | /* following are for a simpler TX queue management. | ||
1741 | * Instead of using netif_[stop/wake]_queue the driver | ||
1742 | * will uses these two function (plus a reset one), that | ||
1743 | * will internally uses the kernel netif_* and takes | ||
1744 | * care of the ieee802.11 fragmentation. | ||
1745 | * So the driver receives a fragment per time and might | ||
1746 | * call the stop function when it want without take care | ||
1747 | * to have enough room to TX an entire packet. | ||
1748 | * This might be useful if each fragment need it's own | ||
1749 | * descriptor, thus just keep a total free memory > than | ||
1750 | * the max fragmentation threshold is not enough.. If the | ||
1751 | * ieee802.11 stack passed a TXB struct then you needed | ||
1752 | * to keep N free descriptors where | ||
1753 | * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD | ||
1754 | * In this way you need just one and the 802.11 stack | ||
1755 | * will take care of buffering fragments and pass them to | ||
1756 | * to the driver later, when it wakes the queue. | ||
1757 | */ | ||
1758 | |||
1759 | void ieee80211_softmac_xmit(struct ieee80211_txb *txb, | ||
1760 | struct ieee80211_device *ieee) | ||
1761 | { | ||
1762 | unsigned long flags; | ||
1763 | int i; | ||
1764 | |||
1765 | spin_lock_irqsave(&ieee->lock, flags); | ||
1766 | |||
1767 | /* called with 2nd parm 0, no tx mgmt lock required */ | ||
1768 | ieee80211_sta_wakeup(ieee, 0); | ||
1769 | |||
1770 | for (i = 0; i < txb->nr_frags; i++) { | ||
1771 | if (ieee->queue_stop) { | ||
1772 | ieee->tx_pending.txb = txb; | ||
1773 | ieee->tx_pending.frag = i; | ||
1774 | goto exit; | ||
1775 | } else { | ||
1776 | ieee->softmac_data_hard_start_xmit( | ||
1777 | txb->fragments[i], | ||
1778 | ieee->dev, ieee->rate); | ||
1779 | ieee->stats.tx_packets++; | ||
1780 | ieee->stats.tx_bytes += txb->fragments[i]->len; | ||
1781 | ieee->dev->trans_start = jiffies; | ||
1782 | } | ||
1783 | } | ||
1784 | |||
1785 | ieee80211_txb_free(txb); | ||
1786 | |||
1787 | exit: | ||
1788 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1789 | } | ||
1790 | |||
1791 | /* called with ieee->lock acquired */ | ||
1792 | static void ieee80211_resume_tx(struct ieee80211_device *ieee) | ||
1793 | { | ||
1794 | int i; | ||
1795 | for (i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { | ||
1796 | |||
1797 | if (ieee->queue_stop) { | ||
1798 | ieee->tx_pending.frag = i; | ||
1799 | return; | ||
1800 | } else { | ||
1801 | ieee->softmac_data_hard_start_xmit( | ||
1802 | ieee->tx_pending.txb->fragments[i], | ||
1803 | ieee->dev, ieee->rate); | ||
1804 | ieee->stats.tx_packets++; | ||
1805 | ieee->dev->trans_start = jiffies; | ||
1806 | } | ||
1807 | } | ||
1808 | |||
1809 | ieee80211_txb_free(ieee->tx_pending.txb); | ||
1810 | ieee->tx_pending.txb = NULL; | ||
1811 | } | ||
1812 | |||
1813 | void ieee80211_reset_queue(struct ieee80211_device *ieee) | ||
1814 | { | ||
1815 | unsigned long flags; | ||
1816 | |||
1817 | spin_lock_irqsave(&ieee->lock, flags); | ||
1818 | init_mgmt_queue(ieee); | ||
1819 | if (ieee->tx_pending.txb) { | ||
1820 | ieee80211_txb_free(ieee->tx_pending.txb); | ||
1821 | ieee->tx_pending.txb = NULL; | ||
1822 | } | ||
1823 | ieee->queue_stop = 0; | ||
1824 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1825 | } | ||
1826 | |||
1827 | void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee) | ||
1828 | { | ||
1829 | unsigned long flags; | ||
1830 | struct sk_buff *skb; | ||
1831 | struct ieee80211_hdr_3addr *header; | ||
1832 | |||
1833 | spin_lock_irqsave(&ieee->lock, flags); | ||
1834 | if (!ieee->queue_stop) | ||
1835 | goto exit; | ||
1836 | |||
1837 | ieee->queue_stop = 0; | ||
1838 | |||
1839 | if (ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) { | ||
1840 | while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))) { | ||
1841 | header = (struct ieee80211_hdr_3addr *) skb->data; | ||
1842 | |||
1843 | header->seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); | ||
1844 | |||
1845 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
1846 | ieee->seq_ctrl[0] = 0; | ||
1847 | else | ||
1848 | ieee->seq_ctrl[0]++; | ||
1849 | |||
1850 | ieee->softmac_data_hard_start_xmit(skb, ieee->dev, ieee->basic_rate); | ||
1851 | dev_kfree_skb_any(skb); | ||
1852 | } | ||
1853 | } | ||
1854 | if (!ieee->queue_stop && ieee->tx_pending.txb) | ||
1855 | ieee80211_resume_tx(ieee); | ||
1856 | |||
1857 | if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)) { | ||
1858 | ieee->softmac_stats.swtxawake++; | ||
1859 | netif_wake_queue(ieee->dev); | ||
1860 | } | ||
1861 | exit: | ||
1862 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
1863 | } | ||
1864 | |||
1865 | void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee) | ||
1866 | { | ||
1867 | if (!netif_queue_stopped(ieee->dev)) { | ||
1868 | netif_stop_queue(ieee->dev); | ||
1869 | ieee->softmac_stats.swtxstop++; | ||
1870 | } | ||
1871 | ieee->queue_stop = 1; | ||
1872 | } | ||
1873 | |||
1874 | inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) | ||
1875 | { | ||
1876 | random_ether_addr(ieee->current_network.bssid); | ||
1877 | } | ||
1878 | |||
1879 | /* called in user context only */ | ||
1880 | void ieee80211_start_master_bss(struct ieee80211_device *ieee) | ||
1881 | { | ||
1882 | ieee->assoc_id = 1; | ||
1883 | |||
1884 | if (ieee->current_network.ssid_len == 0) { | ||
1885 | strncpy(ieee->current_network.ssid, | ||
1886 | IEEE80211_DEFAULT_TX_ESSID, | ||
1887 | IW_ESSID_MAX_SIZE); | ||
1888 | |||
1889 | ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); | ||
1890 | ieee->ssid_set = 1; | ||
1891 | } | ||
1892 | |||
1893 | memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); | ||
1894 | |||
1895 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
1896 | ieee->state = IEEE80211_LINKED; | ||
1897 | ieee->link_change(ieee->dev); | ||
1898 | notify_wx_assoc_event(ieee); | ||
1899 | |||
1900 | if (ieee->data_hard_resume) | ||
1901 | ieee->data_hard_resume(ieee->dev); | ||
1902 | |||
1903 | netif_carrier_on(ieee->dev); | ||
1904 | } | ||
1905 | |||
1906 | static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) | ||
1907 | { | ||
1908 | if (ieee->raw_tx) { | ||
1909 | |||
1910 | if (ieee->data_hard_resume) | ||
1911 | ieee->data_hard_resume(ieee->dev); | ||
1912 | |||
1913 | netif_carrier_on(ieee->dev); | ||
1914 | } | ||
1915 | } | ||
1916 | |||
1917 | static void ieee80211_start_ibss_wq(struct work_struct *work) | ||
1918 | { | ||
1919 | struct delayed_work *dwork = to_delayed_work(work); | ||
1920 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); | ||
1921 | |||
1922 | /* iwconfig mode ad-hoc will schedule this and return | ||
1923 | * on the other hand this will block further iwconfig SET | ||
1924 | * operations because of the wx_sem hold. | ||
1925 | * Anyway some most set operations set a flag to speed-up | ||
1926 | * (abort) this wq (when syncro scanning) before sleeping | ||
1927 | * on the semaphore | ||
1928 | */ | ||
1929 | |||
1930 | down(&ieee->wx_sem); | ||
1931 | |||
1932 | if (ieee->current_network.ssid_len == 0) { | ||
1933 | strcpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID); | ||
1934 | ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); | ||
1935 | ieee->ssid_set = 1; | ||
1936 | } | ||
1937 | |||
1938 | /* check if we have this cell in our network list */ | ||
1939 | ieee80211_softmac_check_all_nets(ieee); | ||
1940 | |||
1941 | if (ieee->state == IEEE80211_NOLINK) | ||
1942 | ieee->current_network.channel = 10; | ||
1943 | /* if not then the state is not linked. Maybe the user switched to | ||
1944 | * ad-hoc mode just after being in monitor mode, or just after | ||
1945 | * being very few time in managed mode (so the card have had no | ||
1946 | * time to scan all the chans..) or we have just run up the iface | ||
1947 | * after setting ad-hoc mode. So we have to give another try.. | ||
1948 | * Here, in ibss mode, should be safe to do this without extra care | ||
1949 | * (in bss mode we had to make sure no-one tried to associate when | ||
1950 | * we had just checked the ieee->state and we was going to start the | ||
1951 | * scan) because in ibss mode the ieee80211_new_net function, when | ||
1952 | * finds a good net, just set the ieee->state to IEEE80211_LINKED, | ||
1953 | * so, at worst, we waste a bit of time to initiate an unneeded syncro | ||
1954 | * scan, that will stop at the first round because it sees the state | ||
1955 | * associated. | ||
1956 | */ | ||
1957 | if (ieee->state == IEEE80211_NOLINK) | ||
1958 | ieee80211_start_scan_syncro(ieee); | ||
1959 | |||
1960 | /* the network definitively is not here.. create a new cell */ | ||
1961 | if (ieee->state == IEEE80211_NOLINK) { | ||
1962 | printk("creating new IBSS cell\n"); | ||
1963 | if (!ieee->wap_set) | ||
1964 | ieee80211_randomize_cell(ieee); | ||
1965 | |||
1966 | if (ieee->modulation & IEEE80211_CCK_MODULATION) { | ||
1967 | ieee->current_network.rates_len = 4; | ||
1968 | |||
1969 | ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; | ||
1970 | ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; | ||
1971 | ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; | ||
1972 | ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; | ||
1973 | |||
1974 | } else | ||
1975 | ieee->current_network.rates_len = 0; | ||
1976 | |||
1977 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) { | ||
1978 | ieee->current_network.rates_ex_len = 8; | ||
1979 | |||
1980 | ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; | ||
1981 | ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; | ||
1982 | ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; | ||
1983 | ieee->current_network.rates_ex[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; | ||
1984 | ieee->current_network.rates_ex[4] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; | ||
1985 | ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; | ||
1986 | ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; | ||
1987 | ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; | ||
1988 | |||
1989 | ieee->rate = 540; | ||
1990 | } else { | ||
1991 | ieee->current_network.rates_ex_len = 0; | ||
1992 | ieee->rate = 110; | ||
1993 | } | ||
1994 | |||
1995 | /* By default, WMM function will be disabled in IBSS mode */ | ||
1996 | ieee->current_network.QoS_Enable = 0; | ||
1997 | |||
1998 | ieee->current_network.atim_window = 0; | ||
1999 | ieee->current_network.capability = WLAN_CAPABILITY_IBSS; | ||
2000 | if (ieee->short_slot) | ||
2001 | ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT; | ||
2002 | } | ||
2003 | |||
2004 | ieee->state = IEEE80211_LINKED; | ||
2005 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
2006 | ieee->link_change(ieee->dev); | ||
2007 | |||
2008 | notify_wx_assoc_event(ieee); | ||
2009 | |||
2010 | ieee80211_start_send_beacons(ieee); | ||
2011 | printk(KERN_WARNING "after sending beacon packet!\n"); | ||
2012 | |||
2013 | if (ieee->data_hard_resume) | ||
2014 | ieee->data_hard_resume(ieee->dev); | ||
2015 | |||
2016 | netif_carrier_on(ieee->dev); | ||
2017 | |||
2018 | up(&ieee->wx_sem); | ||
2019 | } | ||
2020 | |||
2021 | inline void ieee80211_start_ibss(struct ieee80211_device *ieee) | ||
2022 | { | ||
2023 | queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 100); | ||
2024 | } | ||
2025 | |||
2026 | /* this is called only in user context, with wx_sem held */ | ||
2027 | void ieee80211_start_bss(struct ieee80211_device *ieee) | ||
2028 | { | ||
2029 | unsigned long flags; | ||
2030 | /* Ref: 802.11d 11.1.3.3 | ||
2031 | * STA shall not start a BSS unless properly formed Beacon frame | ||
2032 | * including a Country IE. | ||
2033 | */ | ||
2034 | if (IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) { | ||
2035 | if (!ieee->bGlobalDomain) | ||
2036 | return; | ||
2037 | } | ||
2038 | /* check if we have already found the net we are interested in (if any). | ||
2039 | * if not (we are disassociated and we are not | ||
2040 | * in associating / authenticating phase) start the background scanning. | ||
2041 | */ | ||
2042 | ieee80211_softmac_check_all_nets(ieee); | ||
2043 | |||
2044 | /* ensure no-one start an associating process (thus setting | ||
2045 | * the ieee->state to ieee80211_ASSOCIATING) while we | ||
2046 | * have just cheked it and we are going to enable scan. | ||
2047 | * The ieee80211_new_net function is always called with | ||
2048 | * lock held (from both ieee80211_softmac_check_all_nets and | ||
2049 | * the rx path), so we cannot be in the middle of such function | ||
2050 | */ | ||
2051 | spin_lock_irqsave(&ieee->lock, flags); | ||
2052 | |||
2053 | if (ieee->state == IEEE80211_NOLINK) { | ||
2054 | ieee->actscanning = true; | ||
2055 | ieee80211_rtl_start_scan(ieee); | ||
2056 | } | ||
2057 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
2058 | } | ||
2059 | |||
2060 | /* called only in userspace context */ | ||
2061 | void ieee80211_disassociate(struct ieee80211_device *ieee) | ||
2062 | { | ||
2063 | netif_carrier_off(ieee->dev); | ||
2064 | |||
2065 | if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) | ||
2066 | ieee80211_reset_queue(ieee); | ||
2067 | |||
2068 | if (ieee->data_hard_stop) | ||
2069 | ieee->data_hard_stop(ieee->dev); | ||
2070 | |||
2071 | if (IS_DOT11D_ENABLE(ieee)) | ||
2072 | Dot11d_Reset(ieee); | ||
2073 | |||
2074 | ieee->link_change(ieee->dev); | ||
2075 | if (ieee->state == IEEE80211_LINKED) | ||
2076 | notify_wx_assoc_event(ieee); | ||
2077 | ieee->state = IEEE80211_NOLINK; | ||
2078 | |||
2079 | } | ||
2080 | static void ieee80211_associate_retry_wq(struct work_struct *work) | ||
2081 | { | ||
2082 | struct delayed_work *dwork = to_delayed_work(work); | ||
2083 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); | ||
2084 | unsigned long flags; | ||
2085 | down(&ieee->wx_sem); | ||
2086 | if (!ieee->proto_started) | ||
2087 | goto exit; | ||
2088 | if (ieee->state != IEEE80211_ASSOCIATING_RETRY) | ||
2089 | goto exit; | ||
2090 | /* until we do not set the state to IEEE80211_NOLINK | ||
2091 | * there are no possibility to have someone else trying | ||
2092 | * to start an association procedure (we get here with | ||
2093 | * ieee->state = IEEE80211_ASSOCIATING). | ||
2094 | * When we set the state to IEEE80211_NOLINK it is possible | ||
2095 | * that the RX path run an attempt to associate, but | ||
2096 | * both ieee80211_softmac_check_all_nets and the | ||
2097 | * RX path works with ieee->lock held so there are no | ||
2098 | * problems. If we are still disassociated then start a scan. | ||
2099 | * the lock here is necessary to ensure no one try to start | ||
2100 | * an association procedure when we have just checked the | ||
2101 | * state and we are going to start the scan. | ||
2102 | */ | ||
2103 | ieee->state = IEEE80211_NOLINK; | ||
2104 | ieee->beinretry = true; | ||
2105 | ieee80211_softmac_check_all_nets(ieee); | ||
2106 | |||
2107 | spin_lock_irqsave(&ieee->lock, flags); | ||
2108 | |||
2109 | if (ieee->state == IEEE80211_NOLINK) { | ||
2110 | ieee->beinretry = false; | ||
2111 | ieee->actscanning = true; | ||
2112 | ieee80211_rtl_start_scan(ieee); | ||
2113 | } | ||
2114 | if (ieee->state == IEEE80211_NOLINK) | ||
2115 | notify_wx_assoc_event(ieee); | ||
2116 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
2117 | |||
2118 | exit: | ||
2119 | up(&ieee->wx_sem); | ||
2120 | } | ||
2121 | |||
2122 | struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) | ||
2123 | { | ||
2124 | u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
2125 | |||
2126 | struct sk_buff *skb = NULL; | ||
2127 | struct ieee80211_probe_response *b; | ||
2128 | |||
2129 | skb = ieee80211_probe_resp(ieee, broadcast_addr); | ||
2130 | if (!skb) | ||
2131 | return NULL; | ||
2132 | |||
2133 | b = (struct ieee80211_probe_response *) skb->data; | ||
2134 | b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); | ||
2135 | |||
2136 | return skb; | ||
2137 | } | ||
2138 | |||
2139 | struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) | ||
2140 | { | ||
2141 | struct sk_buff *skb; | ||
2142 | struct ieee80211_probe_response *b; | ||
2143 | |||
2144 | skb = ieee80211_get_beacon_(ieee); | ||
2145 | if (!skb) | ||
2146 | return NULL; | ||
2147 | |||
2148 | b = (struct ieee80211_probe_response *) skb->data; | ||
2149 | b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); | ||
2150 | |||
2151 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
2152 | ieee->seq_ctrl[0] = 0; | ||
2153 | else | ||
2154 | ieee->seq_ctrl[0]++; | ||
2155 | |||
2156 | return skb; | ||
2157 | } | ||
2158 | |||
2159 | void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) | ||
2160 | { | ||
2161 | ieee->sync_scan_hurryup = 1; | ||
2162 | down(&ieee->wx_sem); | ||
2163 | ieee80211_stop_protocol(ieee); | ||
2164 | up(&ieee->wx_sem); | ||
2165 | } | ||
2166 | |||
2167 | void ieee80211_stop_protocol(struct ieee80211_device *ieee) | ||
2168 | { | ||
2169 | if (!ieee->proto_started) | ||
2170 | return; | ||
2171 | |||
2172 | ieee->proto_started = 0; | ||
2173 | |||
2174 | ieee80211_stop_send_beacons(ieee); | ||
2175 | if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == IEEE80211_LINKED)) | ||
2176 | SendDisassociation(ieee, NULL, WLAN_REASON_DISASSOC_STA_HAS_LEFT); | ||
2177 | |||
2178 | del_timer_sync(&ieee->associate_timer); | ||
2179 | cancel_delayed_work(&ieee->associate_retry_wq); | ||
2180 | cancel_delayed_work(&ieee->start_ibss_wq); | ||
2181 | ieee80211_stop_scan(ieee); | ||
2182 | |||
2183 | ieee80211_disassociate(ieee); | ||
2184 | } | ||
2185 | |||
2186 | void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) | ||
2187 | { | ||
2188 | ieee->sync_scan_hurryup = 0; | ||
2189 | down(&ieee->wx_sem); | ||
2190 | ieee80211_start_protocol(ieee); | ||
2191 | up(&ieee->wx_sem); | ||
2192 | } | ||
2193 | |||
2194 | void ieee80211_start_protocol(struct ieee80211_device *ieee) | ||
2195 | { | ||
2196 | short ch = 0; | ||
2197 | int i = 0; | ||
2198 | |||
2199 | if (ieee->proto_started) | ||
2200 | return; | ||
2201 | |||
2202 | ieee->proto_started = 1; | ||
2203 | |||
2204 | if (ieee->current_network.channel == 0) { | ||
2205 | do { | ||
2206 | ch++; | ||
2207 | if (ch > MAX_CHANNEL_NUMBER) | ||
2208 | return; /* no channel found */ | ||
2209 | |||
2210 | } while (!GET_DOT11D_INFO(ieee)->channel_map[ch]); | ||
2211 | |||
2212 | ieee->current_network.channel = ch; | ||
2213 | } | ||
2214 | |||
2215 | if (ieee->current_network.beacon_interval == 0) | ||
2216 | ieee->current_network.beacon_interval = 100; | ||
2217 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
2218 | |||
2219 | for (i = 0; i < 17; i++) { | ||
2220 | ieee->last_rxseq_num[i] = -1; | ||
2221 | ieee->last_rxfrag_num[i] = -1; | ||
2222 | ieee->last_packet_time[i] = 0; | ||
2223 | } | ||
2224 | |||
2225 | ieee->init_wmmparam_flag = 0; /* reinitialize AC_xx_PARAM registers. */ | ||
2226 | |||
2227 | /* if the user set the MAC of the ad-hoc cell and then | ||
2228 | * switch to managed mode, shall we make sure that association | ||
2229 | * attempts does not fail just because the user provide the essid | ||
2230 | * and the nic is still checking for the AP MAC ?? | ||
2231 | */ | ||
2232 | switch (ieee->iw_mode) { | ||
2233 | case IW_MODE_AUTO: | ||
2234 | ieee->iw_mode = IW_MODE_INFRA; | ||
2235 | /* not set break here intentionly */ | ||
2236 | case IW_MODE_INFRA: | ||
2237 | ieee80211_start_bss(ieee); | ||
2238 | break; | ||
2239 | |||
2240 | case IW_MODE_ADHOC: | ||
2241 | ieee80211_start_ibss(ieee); | ||
2242 | break; | ||
2243 | |||
2244 | case IW_MODE_MASTER: | ||
2245 | ieee80211_start_master_bss(ieee); | ||
2246 | break; | ||
2247 | |||
2248 | case IW_MODE_MONITOR: | ||
2249 | ieee80211_start_monitor_mode(ieee); | ||
2250 | break; | ||
2251 | |||
2252 | default: | ||
2253 | ieee->iw_mode = IW_MODE_INFRA; | ||
2254 | ieee80211_start_bss(ieee); | ||
2255 | break; | ||
2256 | } | ||
2257 | } | ||
2258 | |||
2259 | #define DRV_NAME "Ieee80211" | ||
2260 | void ieee80211_softmac_init(struct ieee80211_device *ieee) | ||
2261 | { | ||
2262 | int i; | ||
2263 | memset(&ieee->current_network, 0, sizeof(struct ieee80211_network)); | ||
2264 | |||
2265 | ieee->state = IEEE80211_NOLINK; | ||
2266 | ieee->sync_scan_hurryup = 0; | ||
2267 | for (i = 0; i < 5; i++) | ||
2268 | ieee->seq_ctrl[i] = 0; | ||
2269 | |||
2270 | ieee->assoc_id = 0; | ||
2271 | ieee->queue_stop = 0; | ||
2272 | ieee->scanning = 0; | ||
2273 | ieee->softmac_features = 0; /* so IEEE2100-like driver are happy */ | ||
2274 | ieee->wap_set = 0; | ||
2275 | ieee->ssid_set = 0; | ||
2276 | ieee->proto_started = 0; | ||
2277 | ieee->basic_rate = IEEE80211_DEFAULT_BASIC_RATE; | ||
2278 | ieee->rate = 3; | ||
2279 | ieee->ps = IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST; | ||
2280 | ieee->sta_sleep = 0; | ||
2281 | ieee->bInactivePs = false; | ||
2282 | ieee->actscanning = false; | ||
2283 | ieee->ListenInterval = 2; | ||
2284 | ieee->NumRxDataInPeriod = 0; | ||
2285 | ieee->NumRxBcnInPeriod = 0; | ||
2286 | ieee->NumRxOkTotal = 0; | ||
2287 | ieee->NumRxUnicast = 0; /* for keep alive */ | ||
2288 | ieee->beinretry = false; | ||
2289 | ieee->bHwRadioOff = false; | ||
2290 | |||
2291 | init_mgmt_queue(ieee); | ||
2292 | |||
2293 | ieee->tx_pending.txb = NULL; | ||
2294 | |||
2295 | init_timer(&ieee->associate_timer); | ||
2296 | ieee->associate_timer.data = (unsigned long)ieee; | ||
2297 | ieee->associate_timer.function = ieee80211_associate_abort_cb; | ||
2298 | |||
2299 | init_timer(&ieee->beacon_timer); | ||
2300 | ieee->beacon_timer.data = (unsigned long) ieee; | ||
2301 | ieee->beacon_timer.function = ieee80211_send_beacon_cb; | ||
2302 | |||
2303 | ieee->wq = create_workqueue(DRV_NAME); | ||
2304 | |||
2305 | INIT_DELAYED_WORK(&ieee->start_ibss_wq, (void *) ieee80211_start_ibss_wq); | ||
2306 | INIT_WORK(&ieee->associate_complete_wq, (void *) ieee80211_associate_complete_wq); | ||
2307 | INIT_WORK(&ieee->associate_procedure_wq, (void *) ieee80211_associate_procedure_wq); | ||
2308 | INIT_DELAYED_WORK(&ieee->softmac_scan_wq, (void *) ieee80211_softmac_scan_wq); | ||
2309 | INIT_DELAYED_WORK(&ieee->associate_retry_wq, (void *) ieee80211_associate_retry_wq); | ||
2310 | INIT_WORK(&ieee->wx_sync_scan_wq, (void *) ieee80211_wx_sync_scan_wq); | ||
2311 | |||
2312 | sema_init(&ieee->wx_sem, 1); | ||
2313 | sema_init(&ieee->scan_sem, 1); | ||
2314 | |||
2315 | spin_lock_init(&ieee->mgmt_tx_lock); | ||
2316 | spin_lock_init(&ieee->beacon_lock); | ||
2317 | |||
2318 | tasklet_init(&ieee->ps_task, | ||
2319 | (void(*)(unsigned long)) ieee80211_sta_ps, | ||
2320 | (unsigned long)ieee); | ||
2321 | ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC); | ||
2322 | } | ||
2323 | |||
2324 | void ieee80211_softmac_free(struct ieee80211_device *ieee) | ||
2325 | { | ||
2326 | down(&ieee->wx_sem); | ||
2327 | |||
2328 | del_timer_sync(&ieee->associate_timer); | ||
2329 | cancel_delayed_work(&ieee->associate_retry_wq); | ||
2330 | |||
2331 | /* add for RF power on power of */ | ||
2332 | cancel_delayed_work(&ieee->GPIOChangeRFWorkItem); | ||
2333 | |||
2334 | destroy_workqueue(ieee->wq); | ||
2335 | kfree(ieee->pDot11dInfo); | ||
2336 | up(&ieee->wx_sem); | ||
2337 | } | ||
2338 | |||
2339 | /* Start of WPA code. This is stolen from the ipw2200 driver */ | ||
2340 | static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) | ||
2341 | { | ||
2342 | /* This is called when wpa_supplicant loads and closes the driver | ||
2343 | * interface. */ | ||
2344 | printk("%s WPA\n", value ? "enabling" : "disabling"); | ||
2345 | ieee->wpa_enabled = value; | ||
2346 | return 0; | ||
2347 | } | ||
2348 | |||
2349 | static void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, | ||
2350 | int wpa_ie_len) | ||
2351 | { | ||
2352 | /* make sure WPA is enabled */ | ||
2353 | ieee80211_wpa_enable(ieee, 1); | ||
2354 | |||
2355 | ieee80211_disassociate(ieee); | ||
2356 | } | ||
2357 | |||
2358 | static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, | ||
2359 | int reason) | ||
2360 | { | ||
2361 | int ret = 0; | ||
2362 | |||
2363 | switch (command) { | ||
2364 | case IEEE_MLME_STA_DEAUTH: | ||
2365 | /* silently ignore */ | ||
2366 | break; | ||
2367 | |||
2368 | case IEEE_MLME_STA_DISASSOC: | ||
2369 | ieee80211_disassociate(ieee); | ||
2370 | break; | ||
2371 | |||
2372 | default: | ||
2373 | printk("Unknown MLME request: %d\n", command); | ||
2374 | ret = -EOPNOTSUPP; | ||
2375 | } | ||
2376 | |||
2377 | return ret; | ||
2378 | } | ||
2379 | |||
2380 | static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, | ||
2381 | struct ieee_param *param, int plen) | ||
2382 | { | ||
2383 | u8 *buf; | ||
2384 | |||
2385 | if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || | ||
2386 | (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) | ||
2387 | return -EINVAL; | ||
2388 | |||
2389 | if (param->u.wpa_ie.len) { | ||
2390 | buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len, | ||
2391 | GFP_KERNEL); | ||
2392 | if (buf == NULL) | ||
2393 | return -ENOMEM; | ||
2394 | |||
2395 | kfree(ieee->wpa_ie); | ||
2396 | ieee->wpa_ie = buf; | ||
2397 | ieee->wpa_ie_len = param->u.wpa_ie.len; | ||
2398 | } else { | ||
2399 | kfree(ieee->wpa_ie); | ||
2400 | ieee->wpa_ie = NULL; | ||
2401 | ieee->wpa_ie_len = 0; | ||
2402 | } | ||
2403 | |||
2404 | ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); | ||
2405 | return 0; | ||
2406 | } | ||
2407 | |||
2408 | #define AUTH_ALG_OPEN_SYSTEM 0x1 | ||
2409 | #define AUTH_ALG_SHARED_KEY 0x2 | ||
2410 | |||
2411 | static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) | ||
2412 | { | ||
2413 | struct ieee80211_security sec = { | ||
2414 | .flags = SEC_AUTH_MODE, | ||
2415 | }; | ||
2416 | int ret = 0; | ||
2417 | |||
2418 | if (value & AUTH_ALG_SHARED_KEY) { | ||
2419 | sec.auth_mode = WLAN_AUTH_SHARED_KEY; | ||
2420 | ieee->open_wep = 0; | ||
2421 | } else { | ||
2422 | sec.auth_mode = WLAN_AUTH_OPEN; | ||
2423 | ieee->open_wep = 1; | ||
2424 | } | ||
2425 | |||
2426 | if (ieee->set_security) | ||
2427 | ieee->set_security(ieee->dev, &sec); | ||
2428 | else | ||
2429 | ret = -EOPNOTSUPP; | ||
2430 | |||
2431 | return ret; | ||
2432 | } | ||
2433 | |||
2434 | static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, | ||
2435 | u32 value) | ||
2436 | { | ||
2437 | int ret = 0; | ||
2438 | unsigned long flags; | ||
2439 | |||
2440 | switch (name) { | ||
2441 | case IEEE_PARAM_WPA_ENABLED: | ||
2442 | ret = ieee80211_wpa_enable(ieee, value); | ||
2443 | break; | ||
2444 | |||
2445 | case IEEE_PARAM_TKIP_COUNTERMEASURES: | ||
2446 | ieee->tkip_countermeasures = value; | ||
2447 | break; | ||
2448 | |||
2449 | case IEEE_PARAM_DROP_UNENCRYPTED: { | ||
2450 | /* HACK: | ||
2451 | * | ||
2452 | * wpa_supplicant calls set_wpa_enabled when the driver | ||
2453 | * is loaded and unloaded, regardless of if WPA is being | ||
2454 | * used. No other calls are made which can be used to | ||
2455 | * determine if encryption will be used or not prior to | ||
2456 | * association being expected. If encryption is not being | ||
2457 | * used, drop_unencrypted is set to false, else true -- we | ||
2458 | * can use this to determine if the CAP_PRIVACY_ON bit should | ||
2459 | * be set. | ||
2460 | */ | ||
2461 | struct ieee80211_security sec = { | ||
2462 | .flags = SEC_ENABLED, | ||
2463 | .enabled = value, | ||
2464 | }; | ||
2465 | ieee->drop_unencrypted = value; | ||
2466 | /* We only change SEC_LEVEL for open mode. Others | ||
2467 | * are set by ipw_wpa_set_encryption. | ||
2468 | */ | ||
2469 | if (!value) { | ||
2470 | sec.flags |= SEC_LEVEL; | ||
2471 | sec.level = SEC_LEVEL_0; | ||
2472 | } else { | ||
2473 | sec.flags |= SEC_LEVEL; | ||
2474 | sec.level = SEC_LEVEL_1; | ||
2475 | } | ||
2476 | if (ieee->set_security) | ||
2477 | ieee->set_security(ieee->dev, &sec); | ||
2478 | break; | ||
2479 | } | ||
2480 | |||
2481 | case IEEE_PARAM_PRIVACY_INVOKED: | ||
2482 | ieee->privacy_invoked = value; | ||
2483 | break; | ||
2484 | case IEEE_PARAM_AUTH_ALGS: | ||
2485 | ret = ieee80211_wpa_set_auth_algs(ieee, value); | ||
2486 | break; | ||
2487 | case IEEE_PARAM_IEEE_802_1X: | ||
2488 | ieee->ieee802_1x = value; | ||
2489 | break; | ||
2490 | case IEEE_PARAM_WPAX_SELECT: | ||
2491 | spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); | ||
2492 | ieee->wpax_type_set = 1; | ||
2493 | ieee->wpax_type_notify = value; | ||
2494 | spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); | ||
2495 | break; | ||
2496 | default: | ||
2497 | printk("Unknown WPA param: %d\n", name); | ||
2498 | ret = -EOPNOTSUPP; | ||
2499 | } | ||
2500 | |||
2501 | return ret; | ||
2502 | } | ||
2503 | |||
2504 | /* implementation borrowed from hostap driver */ | ||
2505 | |||
2506 | static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, | ||
2507 | struct ieee_param *param, int param_len) | ||
2508 | { | ||
2509 | int ret = 0; | ||
2510 | |||
2511 | struct ieee80211_crypto_ops *ops; | ||
2512 | struct ieee80211_crypt_data **crypt; | ||
2513 | |||
2514 | struct ieee80211_security sec = { | ||
2515 | .flags = 0, | ||
2516 | }; | ||
2517 | |||
2518 | param->u.crypt.err = 0; | ||
2519 | param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; | ||
2520 | |||
2521 | if (param_len != | ||
2522 | (int) ((char *) param->u.crypt.key - (char *) param) + | ||
2523 | param->u.crypt.key_len) { | ||
2524 | printk("Len mismatch %d, %d\n", param_len, | ||
2525 | param->u.crypt.key_len); | ||
2526 | return -EINVAL; | ||
2527 | } | ||
2528 | if (is_broadcast_ether_addr(param->sta_addr)) { | ||
2529 | if (param->u.crypt.idx >= WEP_KEYS) | ||
2530 | return -EINVAL; | ||
2531 | crypt = &ieee->crypt[param->u.crypt.idx]; | ||
2532 | } else { | ||
2533 | return -EINVAL; | ||
2534 | } | ||
2535 | |||
2536 | if (strcmp(param->u.crypt.alg, "none") == 0) { | ||
2537 | if (crypt) { | ||
2538 | sec.enabled = 0; | ||
2539 | /* FIXME FIXME */ | ||
2540 | sec.level = SEC_LEVEL_0; | ||
2541 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | ||
2542 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
2543 | } | ||
2544 | goto done; | ||
2545 | } | ||
2546 | sec.enabled = 1; | ||
2547 | /* FIXME FIXME */ | ||
2548 | sec.flags |= SEC_ENABLED; | ||
2549 | |||
2550 | /* IPW HW cannot build TKIP MIC, host decryption still needed. */ | ||
2551 | if (!(ieee->host_encrypt || ieee->host_decrypt) && | ||
2552 | strcmp(param->u.crypt.alg, "TKIP")) | ||
2553 | goto skip_host_crypt; | ||
2554 | |||
2555 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
2556 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) | ||
2557 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
2558 | else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) | ||
2559 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
2560 | else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) | ||
2561 | ops = ieee80211_get_crypto_ops(param->u.crypt.alg); | ||
2562 | if (ops == NULL) { | ||
2563 | printk("unknown crypto alg '%s'\n", param->u.crypt.alg); | ||
2564 | param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; | ||
2565 | ret = -EINVAL; | ||
2566 | goto done; | ||
2567 | } | ||
2568 | |||
2569 | if (*crypt == NULL || (*crypt)->ops != ops) { | ||
2570 | struct ieee80211_crypt_data *new_crypt; | ||
2571 | |||
2572 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
2573 | |||
2574 | new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); | ||
2575 | if (new_crypt == NULL) { | ||
2576 | ret = -ENOMEM; | ||
2577 | goto done; | ||
2578 | } | ||
2579 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); | ||
2580 | new_crypt->ops = ops; | ||
2581 | if (new_crypt->ops) | ||
2582 | new_crypt->priv = | ||
2583 | new_crypt->ops->init(param->u.crypt.idx); | ||
2584 | |||
2585 | if (new_crypt->priv == NULL) { | ||
2586 | kfree(new_crypt); | ||
2587 | param->u.crypt.err = IEEE_CRYPT_ERR_CRYPT_INIT_FAILED; | ||
2588 | ret = -EINVAL; | ||
2589 | goto done; | ||
2590 | } | ||
2591 | |||
2592 | *crypt = new_crypt; | ||
2593 | } | ||
2594 | |||
2595 | if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && | ||
2596 | (*crypt)->ops->set_key(param->u.crypt.key, | ||
2597 | param->u.crypt.key_len, param->u.crypt.seq, | ||
2598 | (*crypt)->priv) < 0) { | ||
2599 | printk("key setting failed\n"); | ||
2600 | param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; | ||
2601 | ret = -EINVAL; | ||
2602 | goto done; | ||
2603 | } | ||
2604 | |||
2605 | skip_host_crypt: | ||
2606 | if (param->u.crypt.set_tx) { | ||
2607 | ieee->tx_keyidx = param->u.crypt.idx; | ||
2608 | sec.active_key = param->u.crypt.idx; | ||
2609 | sec.flags |= SEC_ACTIVE_KEY; | ||
2610 | } else | ||
2611 | sec.flags &= ~SEC_ACTIVE_KEY; | ||
2612 | |||
2613 | if (param->u.crypt.alg != NULL) { | ||
2614 | memcpy(sec.keys[param->u.crypt.idx], | ||
2615 | param->u.crypt.key, | ||
2616 | param->u.crypt.key_len); | ||
2617 | sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; | ||
2618 | sec.flags |= (1 << param->u.crypt.idx); | ||
2619 | |||
2620 | if (strcmp(param->u.crypt.alg, "WEP") == 0) { | ||
2621 | sec.flags |= SEC_LEVEL; | ||
2622 | sec.level = SEC_LEVEL_1; | ||
2623 | } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { | ||
2624 | sec.flags |= SEC_LEVEL; | ||
2625 | sec.level = SEC_LEVEL_2; | ||
2626 | } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { | ||
2627 | sec.flags |= SEC_LEVEL; | ||
2628 | sec.level = SEC_LEVEL_3; | ||
2629 | } | ||
2630 | } | ||
2631 | done: | ||
2632 | if (ieee->set_security) | ||
2633 | ieee->set_security(ieee->dev, &sec); | ||
2634 | |||
2635 | /* Do not reset port if card is in Managed mode since resetting will | ||
2636 | * generate new IEEE 802.11 authentication which may end up in looping | ||
2637 | * with IEEE 802.1X. If your hardware requires a reset after WEP | ||
2638 | * configuration (for example... Prism2), implement the reset_port in | ||
2639 | * the callbacks structures used to initialize the 802.11 stack. */ | ||
2640 | if (ieee->reset_on_keychange && | ||
2641 | ieee->iw_mode != IW_MODE_INFRA && | ||
2642 | ieee->reset_port && | ||
2643 | ieee->reset_port(ieee->dev)) { | ||
2644 | printk("reset_port failed\n"); | ||
2645 | param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; | ||
2646 | return -EINVAL; | ||
2647 | } | ||
2648 | |||
2649 | return ret; | ||
2650 | } | ||
2651 | |||
2652 | int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, | ||
2653 | struct iw_point *p) | ||
2654 | { | ||
2655 | struct ieee_param *param; | ||
2656 | int ret = 0; | ||
2657 | |||
2658 | down(&ieee->wx_sem); | ||
2659 | |||
2660 | if (p->length < sizeof(struct ieee_param) || !p->pointer) { | ||
2661 | ret = -EINVAL; | ||
2662 | goto out; | ||
2663 | } | ||
2664 | |||
2665 | param = memdup_user(p->pointer, p->length); | ||
2666 | if (IS_ERR(param)) { | ||
2667 | ret = PTR_ERR(param); | ||
2668 | goto out; | ||
2669 | } | ||
2670 | |||
2671 | switch (param->cmd) { | ||
2672 | case IEEE_CMD_SET_WPA_PARAM: | ||
2673 | ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, | ||
2674 | param->u.wpa_param.value); | ||
2675 | break; | ||
2676 | case IEEE_CMD_SET_WPA_IE: | ||
2677 | ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); | ||
2678 | break; | ||
2679 | case IEEE_CMD_SET_ENCRYPTION: | ||
2680 | ret = ieee80211_wpa_set_encryption(ieee, param, p->length); | ||
2681 | break; | ||
2682 | case IEEE_CMD_MLME: | ||
2683 | ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, | ||
2684 | param->u.mlme.reason_code); | ||
2685 | break; | ||
2686 | default: | ||
2687 | printk("Unknown WPA supplicant request: %d\n", param->cmd); | ||
2688 | ret = -EOPNOTSUPP; | ||
2689 | break; | ||
2690 | } | ||
2691 | |||
2692 | if (ret == 0 && copy_to_user(p->pointer, param, p->length)) | ||
2693 | ret = -EFAULT; | ||
2694 | |||
2695 | kfree(param); | ||
2696 | out: | ||
2697 | up(&ieee->wx_sem); | ||
2698 | |||
2699 | return ret; | ||
2700 | } | ||
2701 | |||
2702 | void notify_wx_assoc_event(struct ieee80211_device *ieee) | ||
2703 | { | ||
2704 | union iwreq_data wrqu; | ||
2705 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
2706 | if (ieee->state == IEEE80211_LINKED) | ||
2707 | memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); | ||
2708 | else | ||
2709 | memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); | ||
2710 | wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); | ||
2711 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c deleted file mode 100644 index 46f35644126c..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ /dev/null | |||
@@ -1,567 +0,0 @@ | |||
1 | /* IEEE 802.11 SoftMAC layer | ||
2 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> | ||
3 | * | ||
4 | * Mostly extracted from the rtl8180-sa2400 driver for the | ||
5 | * in-kernel generic ieee802.11 stack. | ||
6 | * | ||
7 | * Some pieces of code might be stolen from ipw2100 driver | ||
8 | * copyright of who own it's copyright ;-) | ||
9 | * | ||
10 | * PS wx handler mostly stolen from hostap, copyright who | ||
11 | * own it's copyright ;-) | ||
12 | * | ||
13 | * released under the GPL | ||
14 | */ | ||
15 | |||
16 | |||
17 | #include <linux/etherdevice.h> | ||
18 | |||
19 | #include "ieee80211.h" | ||
20 | |||
21 | /* FIXME: add A freqs */ | ||
22 | |||
23 | const long ieee80211_wlan_frequencies[] = { | ||
24 | 2412, 2417, 2422, 2427, | ||
25 | 2432, 2437, 2442, 2447, | ||
26 | 2452, 2457, 2462, 2467, | ||
27 | 2472, 2484 | ||
28 | }; | ||
29 | |||
30 | |||
31 | int ieee80211_wx_set_freq(struct ieee80211_device *ieee, | ||
32 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
33 | char *b) | ||
34 | { | ||
35 | int ret; | ||
36 | struct iw_freq *fwrq = &wrqu->freq; | ||
37 | // printk("in %s\n",__func__); | ||
38 | down(&ieee->wx_sem); | ||
39 | |||
40 | if (ieee->iw_mode == IW_MODE_INFRA) { | ||
41 | ret = -EOPNOTSUPP; | ||
42 | goto out; | ||
43 | } | ||
44 | |||
45 | /* if setting by freq convert to channel */ | ||
46 | if (fwrq->e == 1) { | ||
47 | if ((fwrq->m >= (int) 2.412e8 && | ||
48 | fwrq->m <= (int) 2.487e8)) { | ||
49 | int f = fwrq->m / 100000; | ||
50 | int c = 0; | ||
51 | |||
52 | while ((c < 14) && (f != ieee80211_wlan_frequencies[c])) | ||
53 | c++; | ||
54 | |||
55 | /* hack to fall through */ | ||
56 | fwrq->e = 0; | ||
57 | fwrq->m = c + 1; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1) { | ||
62 | ret = -EOPNOTSUPP; | ||
63 | goto out; | ||
64 | |||
65 | } else { /* Set the channel */ | ||
66 | |||
67 | |||
68 | ieee->current_network.channel = fwrq->m; | ||
69 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | ||
70 | |||
71 | if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) | ||
72 | if (ieee->state == IEEE80211_LINKED) { | ||
73 | ieee80211_stop_send_beacons(ieee); | ||
74 | ieee80211_start_send_beacons(ieee); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | ret = 0; | ||
79 | out: | ||
80 | up(&ieee->wx_sem); | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | |||
85 | int ieee80211_wx_get_freq(struct ieee80211_device *ieee, | ||
86 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
87 | char *b) | ||
88 | { | ||
89 | struct iw_freq *fwrq = &wrqu->freq; | ||
90 | |||
91 | if (ieee->current_network.channel == 0) | ||
92 | return -1; | ||
93 | |||
94 | fwrq->m = ieee->current_network.channel; | ||
95 | fwrq->e = 0; | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | int ieee80211_wx_get_wap(struct ieee80211_device *ieee, | ||
101 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
102 | char *extra) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | |||
106 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | ||
107 | |||
108 | if (ieee->iw_mode == IW_MODE_MONITOR) | ||
109 | return -1; | ||
110 | |||
111 | /* We want avoid to give to the user inconsistent infos*/ | ||
112 | spin_lock_irqsave(&ieee->lock, flags); | ||
113 | |||
114 | if (ieee->state != IEEE80211_LINKED && | ||
115 | ieee->state != IEEE80211_LINKED_SCANNING && | ||
116 | ieee->wap_set == 0) | ||
117 | |||
118 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); | ||
119 | else | ||
120 | memcpy(wrqu->ap_addr.sa_data, | ||
121 | ieee->current_network.bssid, ETH_ALEN); | ||
122 | |||
123 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | |||
129 | int ieee80211_wx_set_wap(struct ieee80211_device *ieee, | ||
130 | struct iw_request_info *info, union iwreq_data *awrq, | ||
131 | char *extra) | ||
132 | { | ||
133 | |||
134 | int ret = 0; | ||
135 | unsigned long flags; | ||
136 | |||
137 | short ifup = ieee->proto_started;//dev->flags & IFF_UP; | ||
138 | struct sockaddr *temp = (struct sockaddr *)awrq; | ||
139 | |||
140 | //printk("=======Set WAP:"); | ||
141 | ieee->sync_scan_hurryup = 1; | ||
142 | |||
143 | down(&ieee->wx_sem); | ||
144 | /* use ifconfig hw ether */ | ||
145 | if (ieee->iw_mode == IW_MODE_MASTER) { | ||
146 | ret = -1; | ||
147 | goto out; | ||
148 | } | ||
149 | |||
150 | if (temp->sa_family != ARPHRD_ETHER) { | ||
151 | ret = -EINVAL; | ||
152 | goto out; | ||
153 | } | ||
154 | |||
155 | if (ifup) | ||
156 | ieee80211_stop_protocol(ieee); | ||
157 | |||
158 | /* just to avoid to give inconsistent infos in the | ||
159 | * get wx method. not really needed otherwise | ||
160 | */ | ||
161 | spin_lock_irqsave(&ieee->lock, flags); | ||
162 | |||
163 | memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); | ||
164 | ieee->wap_set = !is_zero_ether_addr(temp->sa_data); | ||
165 | //printk(" %x:%x:%x:%x:%x:%x\n", ieee->current_network.bssid[0],ieee->current_network.bssid[1],ieee->current_network.bssid[2],ieee->current_network.bssid[3],ieee->current_network.bssid[4],ieee->current_network.bssid[5]); | ||
166 | |||
167 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
168 | |||
169 | if (ifup) | ||
170 | ieee80211_start_protocol(ieee); | ||
171 | |||
172 | out: | ||
173 | up(&ieee->wx_sem); | ||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | int ieee80211_wx_get_essid(struct ieee80211_device *ieee, | ||
178 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
179 | char *b) | ||
180 | { | ||
181 | int len, ret = 0; | ||
182 | unsigned long flags; | ||
183 | |||
184 | if (ieee->iw_mode == IW_MODE_MONITOR) | ||
185 | return -1; | ||
186 | |||
187 | /* We want avoid to give to the user inconsistent infos*/ | ||
188 | spin_lock_irqsave(&ieee->lock, flags); | ||
189 | |||
190 | if (ieee->current_network.ssid[0] == '\0' || | ||
191 | ieee->current_network.ssid_len == 0){ | ||
192 | ret = -1; | ||
193 | goto out; | ||
194 | } | ||
195 | |||
196 | if (ieee->state != IEEE80211_LINKED && | ||
197 | ieee->state != IEEE80211_LINKED_SCANNING && | ||
198 | ieee->ssid_set == 0){ | ||
199 | ret = -1; | ||
200 | goto out; | ||
201 | } | ||
202 | len = ieee->current_network.ssid_len; | ||
203 | wrqu->essid.length = len; | ||
204 | strncpy(b, ieee->current_network.ssid, len); | ||
205 | wrqu->essid.flags = 1; | ||
206 | |||
207 | out: | ||
208 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
209 | |||
210 | return ret; | ||
211 | |||
212 | } | ||
213 | |||
214 | int ieee80211_wx_set_rate(struct ieee80211_device *ieee, | ||
215 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
216 | char *extra) | ||
217 | { | ||
218 | |||
219 | u32 target_rate = wrqu->bitrate.value; | ||
220 | |||
221 | //added by lizhaoming for auto mode | ||
222 | if (target_rate == -1) | ||
223 | ieee->rate = 110; | ||
224 | else | ||
225 | ieee->rate = target_rate/100000; | ||
226 | |||
227 | //FIXME: we might want to limit rate also in management protocols. | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | |||
232 | |||
233 | int ieee80211_wx_get_rate(struct ieee80211_device *ieee, | ||
234 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
235 | char *extra) | ||
236 | { | ||
237 | |||
238 | wrqu->bitrate.value = ieee->rate * 100000; | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | int ieee80211_wx_set_mode(struct ieee80211_device *ieee, | ||
244 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
245 | char *b) | ||
246 | { | ||
247 | |||
248 | ieee->sync_scan_hurryup = 1; | ||
249 | |||
250 | down(&ieee->wx_sem); | ||
251 | |||
252 | if (wrqu->mode == ieee->iw_mode) | ||
253 | goto out; | ||
254 | |||
255 | if (wrqu->mode == IW_MODE_MONITOR) | ||
256 | ieee->dev->type = ARPHRD_IEEE80211; | ||
257 | else | ||
258 | ieee->dev->type = ARPHRD_ETHER; | ||
259 | |||
260 | if (!ieee->proto_started) { | ||
261 | ieee->iw_mode = wrqu->mode; | ||
262 | } else { | ||
263 | ieee80211_stop_protocol(ieee); | ||
264 | ieee->iw_mode = wrqu->mode; | ||
265 | ieee80211_start_protocol(ieee); | ||
266 | } | ||
267 | |||
268 | out: | ||
269 | up(&ieee->wx_sem); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | |||
274 | void ieee80211_wx_sync_scan_wq(struct work_struct *work) | ||
275 | { | ||
276 | struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); | ||
277 | short chan; | ||
278 | |||
279 | chan = ieee->current_network.channel; | ||
280 | |||
281 | if (ieee->data_hard_stop) | ||
282 | ieee->data_hard_stop(ieee->dev); | ||
283 | |||
284 | ieee80211_stop_send_beacons(ieee); | ||
285 | |||
286 | ieee->state = IEEE80211_LINKED_SCANNING; | ||
287 | ieee->link_change(ieee->dev); | ||
288 | |||
289 | ieee80211_start_scan_syncro(ieee); | ||
290 | |||
291 | ieee->set_chan(ieee->dev, chan); | ||
292 | |||
293 | ieee->state = IEEE80211_LINKED; | ||
294 | ieee->link_change(ieee->dev); | ||
295 | |||
296 | if (ieee->data_hard_resume) | ||
297 | ieee->data_hard_resume(ieee->dev); | ||
298 | |||
299 | if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) | ||
300 | ieee80211_start_send_beacons(ieee); | ||
301 | |||
302 | //YJ,add,080828, In prevent of lossing ping packet during scanning | ||
303 | //ieee80211_sta_ps_send_null_frame(ieee, false); | ||
304 | //YJ,add,080828,end | ||
305 | |||
306 | up(&ieee->wx_sem); | ||
307 | |||
308 | } | ||
309 | |||
310 | int ieee80211_wx_set_scan(struct ieee80211_device *ieee, | ||
311 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
312 | char *b) | ||
313 | { | ||
314 | int ret = 0; | ||
315 | |||
316 | down(&ieee->wx_sem); | ||
317 | |||
318 | if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { | ||
319 | ret = -1; | ||
320 | goto out; | ||
321 | } | ||
322 | //YJ,add,080828 | ||
323 | //In prevent of lossing ping packet during scanning | ||
324 | //ieee80211_sta_ps_send_null_frame(ieee, true); | ||
325 | //YJ,add,080828,end | ||
326 | |||
327 | if (ieee->state == IEEE80211_LINKED) { | ||
328 | queue_work(ieee->wq, &ieee->wx_sync_scan_wq); | ||
329 | /* intentionally forget to up sem */ | ||
330 | return 0; | ||
331 | } | ||
332 | |||
333 | out: | ||
334 | up(&ieee->wx_sem); | ||
335 | return ret; | ||
336 | } | ||
337 | |||
338 | int ieee80211_wx_set_essid(struct ieee80211_device *ieee, | ||
339 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
340 | char *extra) | ||
341 | { | ||
342 | |||
343 | int ret = 0, len; | ||
344 | short proto_started; | ||
345 | unsigned long flags; | ||
346 | |||
347 | ieee->sync_scan_hurryup = 1; | ||
348 | |||
349 | down(&ieee->wx_sem); | ||
350 | |||
351 | proto_started = ieee->proto_started; | ||
352 | |||
353 | if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { | ||
354 | ret = -E2BIG; | ||
355 | goto out; | ||
356 | } | ||
357 | |||
358 | if (ieee->iw_mode == IW_MODE_MONITOR) { | ||
359 | ret = -1; | ||
360 | goto out; | ||
361 | } | ||
362 | |||
363 | if (proto_started) | ||
364 | ieee80211_stop_protocol(ieee); | ||
365 | |||
366 | /* this is just to be sure that the GET wx callback | ||
367 | * has consistent infos. not needed otherwise | ||
368 | */ | ||
369 | spin_lock_irqsave(&ieee->lock, flags); | ||
370 | |||
371 | if (wrqu->essid.flags && wrqu->essid.length) { | ||
372 | //YJ,modified,080819 | ||
373 | len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length) : IW_ESSID_MAX_SIZE; | ||
374 | memset(ieee->current_network.ssid, 0, ieee->current_network.ssid_len); //YJ,add,080819 | ||
375 | strncpy(ieee->current_network.ssid, extra, len); | ||
376 | ieee->current_network.ssid_len = len; | ||
377 | ieee->ssid_set = 1; | ||
378 | //YJ,modified,080819,end | ||
379 | |||
380 | //YJ,add,080819,for hidden ap | ||
381 | if (len == 0) { | ||
382 | memset(ieee->current_network.bssid, 0, ETH_ALEN); | ||
383 | ieee->current_network.capability = 0; | ||
384 | } | ||
385 | //YJ,add,080819,for hidden ap,end | ||
386 | } else { | ||
387 | ieee->ssid_set = 0; | ||
388 | ieee->current_network.ssid[0] = '\0'; | ||
389 | ieee->current_network.ssid_len = 0; | ||
390 | } | ||
391 | //printk("==========set essid %s!\n",ieee->current_network.ssid); | ||
392 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
393 | |||
394 | if (proto_started) | ||
395 | ieee80211_start_protocol(ieee); | ||
396 | out: | ||
397 | up(&ieee->wx_sem); | ||
398 | return ret; | ||
399 | } | ||
400 | |||
401 | int ieee80211_wx_get_mode(struct ieee80211_device *ieee, | ||
402 | struct iw_request_info *a, union iwreq_data *wrqu, | ||
403 | char *b) | ||
404 | { | ||
405 | |||
406 | wrqu->mode = ieee->iw_mode; | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, | ||
411 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
412 | char *extra) | ||
413 | { | ||
414 | |||
415 | int *parms = (int *)extra; | ||
416 | int enable = (parms[0] > 0); | ||
417 | short prev = ieee->raw_tx; | ||
418 | |||
419 | down(&ieee->wx_sem); | ||
420 | |||
421 | if (enable) | ||
422 | ieee->raw_tx = 1; | ||
423 | else | ||
424 | ieee->raw_tx = 0; | ||
425 | |||
426 | netdev_info(ieee->dev, "raw TX is %s\n", | ||
427 | ieee->raw_tx ? "enabled" : "disabled"); | ||
428 | |||
429 | if (ieee->iw_mode == IW_MODE_MONITOR) { | ||
430 | if (prev == 0 && ieee->raw_tx) { | ||
431 | if (ieee->data_hard_resume) | ||
432 | ieee->data_hard_resume(ieee->dev); | ||
433 | |||
434 | netif_carrier_on(ieee->dev); | ||
435 | } | ||
436 | |||
437 | if (prev && ieee->raw_tx == 1) | ||
438 | netif_carrier_off(ieee->dev); | ||
439 | } | ||
440 | |||
441 | up(&ieee->wx_sem); | ||
442 | |||
443 | return 0; | ||
444 | } | ||
445 | |||
446 | int ieee80211_wx_get_name(struct ieee80211_device *ieee, | ||
447 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
448 | char *extra) | ||
449 | { | ||
450 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); | ||
451 | if (ieee->modulation & IEEE80211_CCK_MODULATION) { | ||
452 | strlcat(wrqu->name, "b", IFNAMSIZ); | ||
453 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) | ||
454 | strlcat(wrqu->name, "/g", IFNAMSIZ); | ||
455 | } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) | ||
456 | strlcat(wrqu->name, "g", IFNAMSIZ); | ||
457 | |||
458 | if ((ieee->state == IEEE80211_LINKED) || | ||
459 | (ieee->state == IEEE80211_LINKED_SCANNING)) | ||
460 | strlcat(wrqu->name, " link", IFNAMSIZ); | ||
461 | else if (ieee->state != IEEE80211_NOLINK) | ||
462 | strlcat(wrqu->name, " .....", IFNAMSIZ); | ||
463 | |||
464 | |||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | |||
469 | /* this is mostly stolen from hostap */ | ||
470 | int ieee80211_wx_set_power(struct ieee80211_device *ieee, | ||
471 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
472 | char *extra) | ||
473 | { | ||
474 | int ret = 0; | ||
475 | |||
476 | if ((!ieee->sta_wake_up) || | ||
477 | (!ieee->ps_request_tx_ack) || | ||
478 | (!ieee->enter_sleep_state) || | ||
479 | (!ieee->ps_is_queue_empty)) { | ||
480 | |||
481 | printk("ERROR. PS mode tried to be use but driver missed a callback\n\n"); | ||
482 | |||
483 | return -1; | ||
484 | } | ||
485 | |||
486 | down(&ieee->wx_sem); | ||
487 | |||
488 | if (wrqu->power.disabled) { | ||
489 | ieee->ps = IEEE80211_PS_DISABLED; | ||
490 | |||
491 | goto exit; | ||
492 | } | ||
493 | switch (wrqu->power.flags & IW_POWER_MODE) { | ||
494 | case IW_POWER_UNICAST_R: | ||
495 | ieee->ps = IEEE80211_PS_UNICAST; | ||
496 | |||
497 | break; | ||
498 | case IW_POWER_ALL_R: | ||
499 | ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; | ||
500 | break; | ||
501 | |||
502 | case IW_POWER_ON: | ||
503 | ieee->ps = IEEE80211_PS_DISABLED; | ||
504 | break; | ||
505 | |||
506 | default: | ||
507 | ret = -EINVAL; | ||
508 | goto exit; | ||
509 | } | ||
510 | |||
511 | if (wrqu->power.flags & IW_POWER_TIMEOUT) { | ||
512 | |||
513 | ieee->ps_timeout = wrqu->power.value / 1000; | ||
514 | printk("Timeout %d\n", ieee->ps_timeout); | ||
515 | } | ||
516 | |||
517 | if (wrqu->power.flags & IW_POWER_PERIOD) { | ||
518 | |||
519 | ret = -EOPNOTSUPP; | ||
520 | goto exit; | ||
521 | //wrq->value / 1024; | ||
522 | |||
523 | } | ||
524 | exit: | ||
525 | up(&ieee->wx_sem); | ||
526 | return ret; | ||
527 | |||
528 | } | ||
529 | |||
530 | /* this is stolen from hostap */ | ||
531 | int ieee80211_wx_get_power(struct ieee80211_device *ieee, | ||
532 | struct iw_request_info *info, union iwreq_data *wrqu, | ||
533 | char *extra) | ||
534 | { | ||
535 | int ret = 0; | ||
536 | |||
537 | down(&ieee->wx_sem); | ||
538 | |||
539 | if (ieee->ps == IEEE80211_PS_DISABLED) { | ||
540 | wrqu->power.disabled = 1; | ||
541 | goto exit; | ||
542 | } | ||
543 | |||
544 | wrqu->power.disabled = 0; | ||
545 | |||
546 | // if ((wrqu->power.flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | ||
547 | wrqu->power.flags = IW_POWER_TIMEOUT; | ||
548 | wrqu->power.value = ieee->ps_timeout * 1000; | ||
549 | // } else { | ||
550 | // ret = -EOPNOTSUPP; | ||
551 | // goto exit; | ||
552 | //wrqu->power.flags = IW_POWER_PERIOD; | ||
553 | //wrqu->power.value = ieee->current_network.dtim_period * | ||
554 | // ieee->current_network.beacon_interval * 1024; | ||
555 | // } | ||
556 | |||
557 | |||
558 | if (ieee->ps & IEEE80211_PS_MBCAST) | ||
559 | wrqu->power.flags |= IW_POWER_ALL_R; | ||
560 | else | ||
561 | wrqu->power.flags |= IW_POWER_UNICAST_R; | ||
562 | |||
563 | exit: | ||
564 | up(&ieee->wx_sem); | ||
565 | return ret; | ||
566 | |||
567 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c deleted file mode 100644 index 0dc5ae414270..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ /dev/null | |||
@@ -1,591 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | |||
3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify it | ||
6 | under the terms of version 2 of the GNU General Public License as | ||
7 | published by the Free Software Foundation. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along with | ||
15 | this program; if not, write to the Free Software Foundation, Inc., 59 | ||
16 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | |||
18 | The full GNU General Public License is included in this distribution in the | ||
19 | file called LICENSE. | ||
20 | |||
21 | Contact Information: | ||
22 | James P. Ketrenos <ipw2100-admin@linux.intel.com> | ||
23 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
24 | |||
25 | ****************************************************************************** | ||
26 | |||
27 | Few modifications for Realtek's Wi-Fi drivers by | ||
28 | Andrea Merello <andrea.merello@gmail.com> | ||
29 | |||
30 | A special thanks goes to Realtek for their support ! | ||
31 | |||
32 | ******************************************************************************/ | ||
33 | |||
34 | #include <linux/compiler.h> | ||
35 | #include <linux/errno.h> | ||
36 | #include <linux/if_arp.h> | ||
37 | #include <linux/in6.h> | ||
38 | #include <linux/in.h> | ||
39 | #include <linux/ip.h> | ||
40 | #include <linux/kernel.h> | ||
41 | #include <linux/module.h> | ||
42 | #include <linux/netdevice.h> | ||
43 | #include <linux/pci.h> | ||
44 | #include <linux/proc_fs.h> | ||
45 | #include <linux/skbuff.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/tcp.h> | ||
48 | #include <linux/types.h> | ||
49 | #include <linux/wireless.h> | ||
50 | #include <linux/etherdevice.h> | ||
51 | #include <asm/uaccess.h> | ||
52 | #include <linux/if_vlan.h> | ||
53 | |||
54 | #include "ieee80211.h" | ||
55 | |||
56 | |||
57 | /* | ||
58 | |||
59 | |||
60 | 802.11 Data Frame | ||
61 | |||
62 | |||
63 | 802.11 frame_contorl for data frames - 2 bytes | ||
64 | ,-----------------------------------------------------------------------------------------. | ||
65 | bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | | ||
66 | |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| | ||
67 | val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | | ||
68 | |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| | ||
69 | desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | | ||
70 | | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | | ||
71 | '-----------------------------------------------------------------------------------------' | ||
72 | /\ | ||
73 | | | ||
74 | 802.11 Data Frame | | ||
75 | ,--------- 'ctrl' expands to >-----------' | ||
76 | | | ||
77 | ,--'---,-------------------------------------------------------------. | ||
78 | Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | | ||
79 | |------|------|---------|---------|---------|------|---------|------| | ||
80 | Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | | ||
81 | | | tion | (BSSID) | | | ence | data | | | ||
82 | `--------------------------------------------------| |------' | ||
83 | Total: 28 non-data bytes `----.----' | ||
84 | | | ||
85 | .- 'Frame data' expands to <---------------------------' | ||
86 | | | ||
87 | V | ||
88 | ,---------------------------------------------------. | ||
89 | Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | | ||
90 | |------|------|---------|----------|------|---------| | ||
91 | Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | | ||
92 | | DSAP | SSAP | | | | Packet | | ||
93 | | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | | ||
94 | `-----------------------------------------| | | ||
95 | Total: 8 non-data bytes `----.----' | ||
96 | | | ||
97 | .- 'IP Packet' expands, if WEP enabled, to <--' | ||
98 | | | ||
99 | V | ||
100 | ,-----------------------. | ||
101 | Bytes | 4 | 0-2296 | 4 | | ||
102 | |-----|-----------|-----| | ||
103 | Desc. | IV | Encrypted | ICV | | ||
104 | | | IP Packet | | | ||
105 | `-----------------------' | ||
106 | Total: 8 non-data bytes | ||
107 | |||
108 | |||
109 | 802.3 Ethernet Data Frame | ||
110 | |||
111 | ,-----------------------------------------. | ||
112 | Bytes | 6 | 6 | 2 | Variable | 4 | | ||
113 | |-------|-------|------|-----------|------| | ||
114 | Desc. | Dest. | Source| Type | IP Packet | fcs | | ||
115 | | MAC | MAC | | | | | ||
116 | `-----------------------------------------' | ||
117 | Total: 18 non-data bytes | ||
118 | |||
119 | In the event that fragmentation is required, the incoming payload is split into | ||
120 | N parts of size ieee->fts. The first fragment contains the SNAP header and the | ||
121 | remaining packets are just data. | ||
122 | |||
123 | If encryption is enabled, each fragment payload size is reduced by enough space | ||
124 | to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) | ||
125 | So if you have 1500 bytes of payload with ieee->fts set to 500 without | ||
126 | encryption it will take 3 frames. With WEP it will take 4 frames as the | ||
127 | payload of each frame is reduced to 492 bytes. | ||
128 | |||
129 | * SKB visualization | ||
130 | * | ||
131 | * ,- skb->data | ||
132 | * | | ||
133 | * | ETHERNET HEADER ,-<-- PAYLOAD | ||
134 | * | | 14 bytes from skb->data | ||
135 | * | 2 bytes for Type --> ,T. | (sizeof ethhdr) | ||
136 | * | | | | | ||
137 | * |,-Dest.--. ,--Src.---. | | | | ||
138 | * | 6 bytes| | 6 bytes | | | | | ||
139 | * v | | | | | | | ||
140 | * 0 | v 1 | v | v 2 | ||
141 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | ||
142 | * ^ | ^ | ^ | | ||
143 | * | | | | | | | ||
144 | * | | | | `T' <---- 2 bytes for Type | ||
145 | * | | | | | ||
146 | * | | '---SNAP--' <-------- 6 bytes for SNAP | ||
147 | * | | | ||
148 | * `-IV--' <-------------------- 4 bytes for IV (WEP) | ||
149 | * | ||
150 | * SNAP HEADER | ||
151 | * | ||
152 | */ | ||
153 | |||
154 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; | ||
155 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; | ||
156 | |||
157 | static inline int ieee80211_put_snap(u8 *data, u16 h_proto) | ||
158 | { | ||
159 | struct ieee80211_snap_hdr *snap; | ||
160 | u8 *oui; | ||
161 | |||
162 | snap = (struct ieee80211_snap_hdr *)data; | ||
163 | snap->dsap = 0xaa; | ||
164 | snap->ssap = 0xaa; | ||
165 | snap->ctrl = 0x03; | ||
166 | |||
167 | if (h_proto == 0x8137 || h_proto == 0x80f3) | ||
168 | oui = P802_1H_OUI; | ||
169 | else | ||
170 | oui = RFC1042_OUI; | ||
171 | snap->oui[0] = oui[0]; | ||
172 | snap->oui[1] = oui[1]; | ||
173 | snap->oui[2] = oui[2]; | ||
174 | |||
175 | *(u16 *)(data + SNAP_SIZE) = htons(h_proto); | ||
176 | |||
177 | return SNAP_SIZE + sizeof(u16); | ||
178 | } | ||
179 | |||
180 | int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, | ||
181 | struct sk_buff *frag, int hdr_len) | ||
182 | { | ||
183 | struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; | ||
184 | int res; | ||
185 | |||
186 | /* | ||
187 | * added to care about null crypt condition, to solve that system hangs | ||
188 | * when shared keys error | ||
189 | */ | ||
190 | if (!crypt || !crypt->ops) | ||
191 | return -1; | ||
192 | |||
193 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP | ||
194 | struct ieee80211_hdr_4addr *header; | ||
195 | |||
196 | if (ieee->tkip_countermeasures && | ||
197 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { | ||
198 | header = (struct ieee80211_hdr_4addr *)frag->data; | ||
199 | if (net_ratelimit()) { | ||
200 | netdev_dbg(ieee->dev, "TKIP countermeasures: dropped " | ||
201 | "TX packet to %pM\n", header->addr1); | ||
202 | } | ||
203 | return -1; | ||
204 | } | ||
205 | #endif | ||
206 | /* | ||
207 | * To encrypt, frame format is: | ||
208 | * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) | ||
209 | * | ||
210 | * PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU | ||
211 | * encryption. | ||
212 | * | ||
213 | * Host-based IEEE 802.11 fragmentation for TX is not yet supported, so | ||
214 | * call both MSDU and MPDU encryption functions from here. | ||
215 | */ | ||
216 | atomic_inc(&crypt->refcnt); | ||
217 | res = 0; | ||
218 | if (crypt->ops->encrypt_msdu) | ||
219 | res = crypt->ops->encrypt_msdu(frag, hdr_len, crypt->priv); | ||
220 | if (res == 0 && crypt->ops->encrypt_mpdu) | ||
221 | res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); | ||
222 | |||
223 | atomic_dec(&crypt->refcnt); | ||
224 | if (res < 0) { | ||
225 | netdev_info(ieee->dev, "Encryption failed: len=%d.\n", frag->len); | ||
226 | ieee->ieee_stats.tx_discards++; | ||
227 | return -1; | ||
228 | } | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | |||
234 | void ieee80211_txb_free(struct ieee80211_txb *txb) | ||
235 | { | ||
236 | int i; | ||
237 | if (unlikely(!txb)) | ||
238 | return; | ||
239 | for (i = 0; i < txb->nr_frags; i++) | ||
240 | if (txb->fragments[i]) | ||
241 | dev_kfree_skb_any(txb->fragments[i]); | ||
242 | kfree(txb); | ||
243 | } | ||
244 | |||
245 | static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, | ||
246 | gfp_t gfp_mask) | ||
247 | { | ||
248 | struct ieee80211_txb *txb; | ||
249 | int i; | ||
250 | txb = kmalloc( | ||
251 | sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags), | ||
252 | gfp_mask); | ||
253 | if (!txb) | ||
254 | return NULL; | ||
255 | |||
256 | memset(txb, 0, sizeof(struct ieee80211_txb)); | ||
257 | txb->nr_frags = nr_frags; | ||
258 | txb->frag_size = txb_size; | ||
259 | |||
260 | for (i = 0; i < nr_frags; i++) { | ||
261 | txb->fragments[i] = dev_alloc_skb(txb_size); | ||
262 | if (unlikely(!txb->fragments[i])) { | ||
263 | i--; | ||
264 | break; | ||
265 | } | ||
266 | } | ||
267 | if (unlikely(i != nr_frags)) { | ||
268 | while (i >= 0) | ||
269 | dev_kfree_skb_any(txb->fragments[i--]); | ||
270 | kfree(txb); | ||
271 | return NULL; | ||
272 | } | ||
273 | return txb; | ||
274 | } | ||
275 | |||
276 | /* | ||
277 | * Classify the to-be send data packet | ||
278 | * Need to acquire the sent queue index. | ||
279 | */ | ||
280 | static int ieee80211_classify(struct sk_buff *skb, | ||
281 | struct ieee80211_network *network) | ||
282 | { | ||
283 | struct ether_header *eh = (struct ether_header *)skb->data; | ||
284 | unsigned int wme_UP = 0; | ||
285 | |||
286 | if (!network->QoS_Enable) { | ||
287 | skb->priority = 0; | ||
288 | return(wme_UP); | ||
289 | } | ||
290 | |||
291 | if (eh->ether_type == __constant_htons(ETHERTYPE_IP)) { | ||
292 | const struct iphdr *ih = (struct iphdr *)(skb->data + | ||
293 | sizeof(struct ether_header)); | ||
294 | wme_UP = (ih->tos >> 5)&0x07; | ||
295 | } else if (vlan_tx_tag_present(skb)) {/* vtag packet */ | ||
296 | #ifndef VLAN_PRI_SHIFT | ||
297 | #define VLAN_PRI_SHIFT 13 /* Shift to find VLAN user priority */ | ||
298 | #define VLAN_PRI_MASK 7 /* Mask for user priority bits in VLAN */ | ||
299 | #endif | ||
300 | u32 tag = vlan_tx_tag_get(skb); | ||
301 | wme_UP = (tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; | ||
302 | } else if (ETH_P_PAE == ntohs(((struct ethhdr *)skb->data)->h_proto)) { | ||
303 | wme_UP = 7; | ||
304 | } | ||
305 | |||
306 | skb->priority = wme_UP; | ||
307 | return(wme_UP); | ||
308 | } | ||
309 | |||
310 | /* SKBs are added to the ieee->tx_queue. */ | ||
311 | int ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev) | ||
312 | { | ||
313 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
314 | struct ieee80211_txb *txb = NULL; | ||
315 | struct ieee80211_hdr_3addrqos *frag_hdr; | ||
316 | int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; | ||
317 | unsigned long flags; | ||
318 | struct net_device_stats *stats = &ieee->stats; | ||
319 | int ether_type, encrypt; | ||
320 | int bytes, fc, qos_ctl, hdr_len; | ||
321 | struct sk_buff *skb_frag; | ||
322 | struct ieee80211_hdr_3addrqos header = { /* Ensure zero initialized */ | ||
323 | .duration_id = 0, | ||
324 | .seq_ctl = 0, | ||
325 | .qos_ctl = 0 | ||
326 | }; | ||
327 | u8 dest[ETH_ALEN], src[ETH_ALEN]; | ||
328 | |||
329 | struct ieee80211_crypt_data* crypt; | ||
330 | |||
331 | spin_lock_irqsave(&ieee->lock, flags); | ||
332 | |||
333 | /* | ||
334 | * If there is no driver handler to take the TXB, don't bother | ||
335 | * creating it... | ||
336 | */ | ||
337 | if ((!ieee->hard_start_xmit && | ||
338 | !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)) || | ||
339 | ((!ieee->softmac_data_hard_start_xmit && | ||
340 | (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { | ||
341 | netdev_warn(ieee->dev, "No xmit handler.\n"); | ||
342 | goto success; | ||
343 | } | ||
344 | |||
345 | ieee80211_classify(skb,&ieee->current_network); | ||
346 | if (likely(ieee->raw_tx == 0)){ | ||
347 | |||
348 | if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { | ||
349 | netdev_warn(ieee->dev, "skb too small (%d).\n", skb->len); | ||
350 | goto success; | ||
351 | } | ||
352 | |||
353 | ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); | ||
354 | |||
355 | crypt = ieee->crypt[ieee->tx_keyidx]; | ||
356 | |||
357 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && | ||
358 | ieee->host_encrypt && crypt && crypt->ops; | ||
359 | |||
360 | if (!encrypt && ieee->ieee802_1x && | ||
361 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { | ||
362 | stats->tx_dropped++; | ||
363 | goto success; | ||
364 | } | ||
365 | |||
366 | #ifdef CONFIG_IEEE80211_DEBUG | ||
367 | if (crypt && !encrypt && ether_type == ETH_P_PAE) { | ||
368 | struct eapol *eap = (struct eapol *)(skb->data + | ||
369 | sizeof(struct ethhdr) - SNAP_SIZE - sizeof(u16)); | ||
370 | IEEE80211_DEBUG_EAP("TX: IEEE 802.11 EAPOL frame: %s\n", | ||
371 | eap_get_type(eap->type)); | ||
372 | } | ||
373 | #endif | ||
374 | |||
375 | /* Save source and destination addresses */ | ||
376 | memcpy(&dest, skb->data, ETH_ALEN); | ||
377 | memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); | ||
378 | |||
379 | /* Advance the SKB to the start of the payload */ | ||
380 | skb_pull(skb, sizeof(struct ethhdr)); | ||
381 | |||
382 | /* Determine total amount of storage required for TXB packets */ | ||
383 | bytes = skb->len + SNAP_SIZE + sizeof(u16); | ||
384 | |||
385 | if (ieee->current_network.QoS_Enable) { | ||
386 | if (encrypt) | ||
387 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA | | ||
388 | IEEE80211_FCTL_WEP; | ||
389 | else | ||
390 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA; | ||
391 | |||
392 | } else { | ||
393 | if (encrypt) | ||
394 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | | ||
395 | IEEE80211_FCTL_WEP; | ||
396 | else | ||
397 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; | ||
398 | } | ||
399 | |||
400 | if (ieee->iw_mode == IW_MODE_INFRA) { | ||
401 | fc |= IEEE80211_FCTL_TODS; | ||
402 | /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ | ||
403 | memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); | ||
404 | memcpy(&header.addr2, &src, ETH_ALEN); | ||
405 | memcpy(&header.addr3, &dest, ETH_ALEN); | ||
406 | } else if (ieee->iw_mode == IW_MODE_ADHOC) { | ||
407 | /* | ||
408 | * not From/To DS: Addr1 = DA, Addr2 = SA, | ||
409 | * Addr3 = BSSID | ||
410 | */ | ||
411 | memcpy(&header.addr1, dest, ETH_ALEN); | ||
412 | memcpy(&header.addr2, src, ETH_ALEN); | ||
413 | memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); | ||
414 | } | ||
415 | header.frame_ctl = cpu_to_le16(fc); | ||
416 | |||
417 | /* | ||
418 | * Determine fragmentation size based on destination (multicast | ||
419 | * and broadcast are not fragmented) | ||
420 | */ | ||
421 | if (is_multicast_ether_addr(header.addr1)) { | ||
422 | frag_size = MAX_FRAG_THRESHOLD; | ||
423 | qos_ctl = QOS_CTL_NOTCONTAIN_ACK; | ||
424 | } else { | ||
425 | /* default:392 */ | ||
426 | frag_size = ieee->fts; | ||
427 | qos_ctl = 0; | ||
428 | } | ||
429 | |||
430 | if (ieee->current_network.QoS_Enable) { | ||
431 | hdr_len = IEEE80211_3ADDR_LEN + 2; | ||
432 | /* skb->priority is set in the ieee80211_classify() */ | ||
433 | qos_ctl |= skb->priority; | ||
434 | header.qos_ctl = cpu_to_le16(qos_ctl); | ||
435 | } else { | ||
436 | hdr_len = IEEE80211_3ADDR_LEN; | ||
437 | } | ||
438 | |||
439 | /* | ||
440 | * Determine amount of payload per fragment. Regardless of if | ||
441 | * this stack is providing the full 802.11 header, one will | ||
442 | * eventually be affixed to this fragment -- so we must account | ||
443 | * for it when determining the amount of payload space. | ||
444 | */ | ||
445 | bytes_per_frag = frag_size - hdr_len; | ||
446 | if (ieee->config & | ||
447 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | ||
448 | bytes_per_frag -= IEEE80211_FCS_LEN; | ||
449 | |||
450 | /* Each fragment may need to have room for encryption pre/postfix */ | ||
451 | if (encrypt) | ||
452 | bytes_per_frag -= crypt->ops->extra_prefix_len + | ||
453 | crypt->ops->extra_postfix_len; | ||
454 | |||
455 | /* | ||
456 | * Number of fragments is the total bytes_per_frag / | ||
457 | * payload_per_fragment | ||
458 | */ | ||
459 | nr_frags = bytes / bytes_per_frag; | ||
460 | bytes_last_frag = bytes % bytes_per_frag; | ||
461 | if (bytes_last_frag) | ||
462 | nr_frags++; | ||
463 | else | ||
464 | bytes_last_frag = bytes_per_frag; | ||
465 | |||
466 | /* | ||
467 | * When we allocate the TXB we allocate enough space for the | ||
468 | * reserve and full fragment bytes (bytes_per_frag doesn't | ||
469 | * include prefix, postfix, header, FCS, etc.) | ||
470 | */ | ||
471 | txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); | ||
472 | if (unlikely(!txb)) { | ||
473 | netdev_warn(ieee->dev, "Could not allocate TXB\n"); | ||
474 | goto failed; | ||
475 | } | ||
476 | txb->encrypted = encrypt; | ||
477 | txb->payload_size = bytes; | ||
478 | |||
479 | for (i = 0; i < nr_frags; i++) { | ||
480 | skb_frag = txb->fragments[i]; | ||
481 | skb_frag->priority = UP2AC(skb->priority); | ||
482 | if (encrypt) | ||
483 | skb_reserve(skb_frag, crypt->ops->extra_prefix_len); | ||
484 | |||
485 | frag_hdr = (struct ieee80211_hdr_3addrqos *)skb_put( | ||
486 | skb_frag, hdr_len); | ||
487 | memcpy(frag_hdr, &header, hdr_len); | ||
488 | |||
489 | /* | ||
490 | * If this is not the last fragment, then add the MOREFRAGS | ||
491 | * bit to the frame control | ||
492 | */ | ||
493 | if (i != nr_frags - 1) { | ||
494 | frag_hdr->frame_ctl = cpu_to_le16( | ||
495 | fc | IEEE80211_FCTL_MOREFRAGS); | ||
496 | bytes = bytes_per_frag; | ||
497 | |||
498 | } else { | ||
499 | /* The last fragment takes the remaining length */ | ||
500 | bytes = bytes_last_frag; | ||
501 | } | ||
502 | if (ieee->current_network.QoS_Enable) { | ||
503 | /* | ||
504 | * add 1 only indicate to corresponding seq | ||
505 | * number control 2006/7/12 | ||
506 | */ | ||
507 | frag_hdr->seq_ctl = cpu_to_le16( | ||
508 | ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i); | ||
509 | } else { | ||
510 | frag_hdr->seq_ctl = cpu_to_le16( | ||
511 | ieee->seq_ctrl[0]<<4 | i); | ||
512 | } | ||
513 | |||
514 | /* Put a SNAP header on the first fragment */ | ||
515 | if (i == 0) { | ||
516 | ieee80211_put_snap( | ||
517 | skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), | ||
518 | ether_type); | ||
519 | bytes -= SNAP_SIZE + sizeof(u16); | ||
520 | } | ||
521 | |||
522 | memcpy(skb_put(skb_frag, bytes), skb->data, bytes); | ||
523 | |||
524 | /* Advance the SKB... */ | ||
525 | skb_pull(skb, bytes); | ||
526 | |||
527 | /* | ||
528 | * Encryption routine will move the header forward in | ||
529 | * order to insert the IV between the header and the | ||
530 | * payload | ||
531 | */ | ||
532 | if (encrypt) | ||
533 | ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); | ||
534 | if (ieee->config & | ||
535 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) | ||
536 | skb_put(skb_frag, 4); | ||
537 | } | ||
538 | /* Advance sequence number in data frame. */ | ||
539 | if (ieee->current_network.QoS_Enable) { | ||
540 | if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF) | ||
541 | ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0; | ||
542 | else | ||
543 | ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; | ||
544 | } else { | ||
545 | if (ieee->seq_ctrl[0] == 0xFFF) | ||
546 | ieee->seq_ctrl[0] = 0; | ||
547 | else | ||
548 | ieee->seq_ctrl[0]++; | ||
549 | } | ||
550 | } else { | ||
551 | if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { | ||
552 | netdev_warn(ieee->dev, "skb too small (%d).\n", skb->len); | ||
553 | goto success; | ||
554 | } | ||
555 | |||
556 | txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); | ||
557 | if (!txb) { | ||
558 | netdev_warn(ieee->dev, "Could not allocate TXB\n"); | ||
559 | goto failed; | ||
560 | } | ||
561 | |||
562 | txb->encrypted = 0; | ||
563 | txb->payload_size = skb->len; | ||
564 | memcpy(skb_put(txb->fragments[0], skb->len), skb->data, skb->len); | ||
565 | } | ||
566 | |||
567 | success: | ||
568 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
569 | dev_kfree_skb_any(skb); | ||
570 | if (txb) { | ||
571 | if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) { | ||
572 | ieee80211_softmac_xmit(txb, ieee); | ||
573 | } else { | ||
574 | if ((*ieee->hard_start_xmit)(txb, dev) == 0) { | ||
575 | stats->tx_packets++; | ||
576 | stats->tx_bytes += txb->payload_size; | ||
577 | return NETDEV_TX_OK; | ||
578 | } | ||
579 | ieee80211_txb_free(txb); | ||
580 | } | ||
581 | } | ||
582 | |||
583 | return NETDEV_TX_OK; | ||
584 | |||
585 | failed: | ||
586 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
587 | netif_stop_queue(dev); | ||
588 | stats->tx_errors++; | ||
589 | return NETDEV_TX_BUSY; | ||
590 | |||
591 | } | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c deleted file mode 100644 index 07c3f715a6f5..000000000000 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +++ /dev/null | |||
@@ -1,713 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2004 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * Portions of this file are based on the WEP enablement code provided by the | ||
5 | * Host AP project hostap-drivers v0.1.3 | ||
6 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
7 | * <jkmaline@cc.hut.fi> | ||
8 | * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of version 2 of the GNU General Public License as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
17 | * more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along with | ||
20 | * this program; if not, write to the Free Software Foundation, Inc., 59 | ||
21 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | * | ||
23 | * The full GNU General Public License is included in this distribution in the | ||
24 | * file called LICENSE. | ||
25 | * | ||
26 | * Contact Information: | ||
27 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> | ||
28 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
29 | */ | ||
30 | |||
31 | #include <linux/wireless.h> | ||
32 | #include <linux/kmod.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/etherdevice.h> | ||
36 | |||
37 | #include "ieee80211.h" | ||
38 | static const char *ieee80211_modes[] = { | ||
39 | "?", "a", "b", "ab", "g", "ag", "bg", "abg" | ||
40 | }; | ||
41 | |||
42 | #define MAX_CUSTOM_LEN 64 | ||
43 | static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, | ||
44 | char *start, char *stop, | ||
45 | struct ieee80211_network *network, | ||
46 | struct iw_request_info *info) | ||
47 | { | ||
48 | char custom[MAX_CUSTOM_LEN]; | ||
49 | char *p; | ||
50 | struct iw_event iwe; | ||
51 | int i, j; | ||
52 | u8 max_rate, rate; | ||
53 | |||
54 | /* First entry *MUST* be the AP MAC address */ | ||
55 | iwe.cmd = SIOCGIWAP; | ||
56 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | ||
57 | ether_addr_copy(iwe.u.ap_addr.sa_data, network->bssid); | ||
58 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); | ||
59 | |||
60 | /* Remaining entries will be displayed in the order we provide them */ | ||
61 | |||
62 | /* Add the ESSID */ | ||
63 | iwe.cmd = SIOCGIWESSID; | ||
64 | iwe.u.data.flags = 1; | ||
65 | if (network->ssid_len == 0) { | ||
66 | iwe.u.data.length = sizeof("<hidden>"); | ||
67 | start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); | ||
68 | } else { | ||
69 | iwe.u.data.length = min_t(u8, network->ssid_len, 32); | ||
70 | start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); | ||
71 | } | ||
72 | /* Add the protocol name */ | ||
73 | iwe.cmd = SIOCGIWNAME; | ||
74 | snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); | ||
75 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); | ||
76 | |||
77 | /* Add mode */ | ||
78 | iwe.cmd = SIOCGIWMODE; | ||
79 | if (network->capability & | ||
80 | (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { | ||
81 | if (network->capability & WLAN_CAPABILITY_BSS) | ||
82 | iwe.u.mode = IW_MODE_MASTER; | ||
83 | else | ||
84 | iwe.u.mode = IW_MODE_ADHOC; | ||
85 | |||
86 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); | ||
87 | } | ||
88 | |||
89 | /* Add frequency/channel */ | ||
90 | iwe.cmd = SIOCGIWFREQ; | ||
91 | iwe.u.freq.m = network->channel; | ||
92 | iwe.u.freq.e = 0; | ||
93 | iwe.u.freq.i = 0; | ||
94 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); | ||
95 | |||
96 | /* Add encryption capability */ | ||
97 | iwe.cmd = SIOCGIWENCODE; | ||
98 | if (network->capability & WLAN_CAPABILITY_PRIVACY) | ||
99 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | ||
100 | else | ||
101 | iwe.u.data.flags = IW_ENCODE_DISABLED; | ||
102 | iwe.u.data.length = 0; | ||
103 | start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); | ||
104 | |||
105 | /* Add basic and extended rates */ | ||
106 | max_rate = 0; | ||
107 | p = custom; | ||
108 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); | ||
109 | for (i = 0, j = 0; i < network->rates_len; ) { | ||
110 | if (j < network->rates_ex_len && | ||
111 | ((network->rates_ex[j] & 0x7F) < | ||
112 | (network->rates[i] & 0x7F))) | ||
113 | rate = network->rates_ex[j++] & 0x7F; | ||
114 | else | ||
115 | rate = network->rates[i++] & 0x7F; | ||
116 | if (rate > max_rate) | ||
117 | max_rate = rate; | ||
118 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), | ||
119 | "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); | ||
120 | } | ||
121 | for (; j < network->rates_ex_len; j++) { | ||
122 | rate = network->rates_ex[j] & 0x7F; | ||
123 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), | ||
124 | "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); | ||
125 | if (rate > max_rate) | ||
126 | max_rate = rate; | ||
127 | } | ||
128 | |||
129 | iwe.cmd = SIOCGIWRATE; | ||
130 | iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; | ||
131 | iwe.u.bitrate.value = max_rate * 500000; | ||
132 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_PARAM_LEN); | ||
133 | |||
134 | iwe.cmd = IWEVCUSTOM; | ||
135 | iwe.u.data.length = p - custom; | ||
136 | if (iwe.u.data.length) | ||
137 | start = iwe_stream_add_point(info, start, stop, &iwe, custom); | ||
138 | |||
139 | /* Add quality statistics */ | ||
140 | /* TODO: Fix these values... */ | ||
141 | if (network->stats.signal == 0 || network->stats.rssi == 0) | ||
142 | netdev_info(ieee->dev, "========>signal:%d, rssi:%d\n", | ||
143 | network->stats.signal, network->stats.rssi); | ||
144 | iwe.cmd = IWEVQUAL; | ||
145 | iwe.u.qual.qual = network->stats.signalstrength; | ||
146 | iwe.u.qual.level = network->stats.signal; | ||
147 | iwe.u.qual.noise = network->stats.noise; | ||
148 | iwe.u.qual.updated = network->stats.mask & IEEE80211_STATMASK_WEMASK; | ||
149 | if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) | ||
150 | iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; | ||
151 | if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) | ||
152 | iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; | ||
153 | if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) | ||
154 | iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; | ||
155 | iwe.u.qual.updated = 7; | ||
156 | start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); | ||
157 | |||
158 | iwe.cmd = IWEVCUSTOM; | ||
159 | p = custom; | ||
160 | |||
161 | iwe.u.data.length = p - custom; | ||
162 | if (iwe.u.data.length) | ||
163 | start = iwe_stream_add_point(info, start, stop, &iwe, custom); | ||
164 | |||
165 | memset(&iwe, 0, sizeof(iwe)); | ||
166 | if (network->wpa_ie_len) { | ||
167 | char buf[MAX_WPA_IE_LEN]; | ||
168 | memcpy(buf, network->wpa_ie, network->wpa_ie_len); | ||
169 | iwe.cmd = IWEVGENIE; | ||
170 | iwe.u.data.length = network->wpa_ie_len; | ||
171 | start = iwe_stream_add_point(info, start, stop, &iwe, buf); | ||
172 | } | ||
173 | |||
174 | memset(&iwe, 0, sizeof(iwe)); | ||
175 | if (network->rsn_ie_len) { | ||
176 | char buf[MAX_WPA_IE_LEN]; | ||
177 | memcpy(buf, network->rsn_ie, network->rsn_ie_len); | ||
178 | iwe.cmd = IWEVGENIE; | ||
179 | iwe.u.data.length = network->rsn_ie_len; | ||
180 | start = iwe_stream_add_point(info, start, stop, &iwe, buf); | ||
181 | } | ||
182 | |||
183 | /* Add EXTRA: Age to display seconds since last beacon/probe response | ||
184 | * for given network. | ||
185 | */ | ||
186 | iwe.cmd = IWEVCUSTOM; | ||
187 | p = custom; | ||
188 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), | ||
189 | " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); | ||
190 | iwe.u.data.length = p - custom; | ||
191 | if (iwe.u.data.length) | ||
192 | start = iwe_stream_add_point(info, start, stop, &iwe, custom); | ||
193 | |||
194 | return start; | ||
195 | } | ||
196 | |||
197 | int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | ||
198 | struct iw_request_info *info, | ||
199 | union iwreq_data *wrqu, char *extra) | ||
200 | { | ||
201 | struct ieee80211_network *network; | ||
202 | unsigned long flags; | ||
203 | int err = 0; | ||
204 | char *ev = extra; | ||
205 | char *stop = ev + wrqu->data.length; | ||
206 | int i = 0; | ||
207 | |||
208 | IEEE80211_DEBUG_WX("Getting scan\n"); | ||
209 | down(&ieee->wx_sem); | ||
210 | spin_lock_irqsave(&ieee->lock, flags); | ||
211 | |||
212 | if (!ieee->bHwRadioOff) { | ||
213 | list_for_each_entry(network, &ieee->network_list, list) { | ||
214 | i++; | ||
215 | |||
216 | if ((stop-ev) < 200) { | ||
217 | err = -E2BIG; | ||
218 | break; | ||
219 | } | ||
220 | if (ieee->scan_age == 0 || | ||
221 | time_after(network->last_scanned + ieee->scan_age, jiffies)) { | ||
222 | ev = rtl818x_translate_scan(ieee, ev, stop, network, info); | ||
223 | } else | ||
224 | IEEE80211_DEBUG_SCAN( | ||
225 | "Not showing network '%s (" | ||
226 | "%pM)' due to age (%lums).\n", | ||
227 | escape_essid(network->ssid, | ||
228 | network->ssid_len), | ||
229 | network->bssid, | ||
230 | (jiffies - network->last_scanned) / (HZ / 100)); | ||
231 | } | ||
232 | } | ||
233 | spin_unlock_irqrestore(&ieee->lock, flags); | ||
234 | up(&ieee->wx_sem); | ||
235 | wrqu->data.length = ev - extra; | ||
236 | wrqu->data.flags = 0; | ||
237 | IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); | ||
238 | |||
239 | return err; | ||
240 | } | ||
241 | |||
242 | int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | ||
243 | struct iw_request_info *info, | ||
244 | union iwreq_data *wrqu, char *keybuf) | ||
245 | { | ||
246 | struct iw_point *erq = &(wrqu->encoding); | ||
247 | struct net_device *dev = ieee->dev; | ||
248 | struct ieee80211_security sec = { | ||
249 | .flags = 0 | ||
250 | }; | ||
251 | int i, key, key_provided, len; | ||
252 | struct ieee80211_crypt_data **crypt; | ||
253 | |||
254 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); | ||
255 | |||
256 | key = erq->flags & IW_ENCODE_INDEX; | ||
257 | if (key) { | ||
258 | if (key > WEP_KEYS) | ||
259 | return -EINVAL; | ||
260 | key--; | ||
261 | key_provided = 1; | ||
262 | } else { | ||
263 | key_provided = 0; | ||
264 | key = ieee->tx_keyidx; | ||
265 | } | ||
266 | |||
267 | IEEE80211_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? | ||
268 | "provided" : "default"); | ||
269 | |||
270 | crypt = &ieee->crypt[key]; | ||
271 | |||
272 | if (erq->flags & IW_ENCODE_DISABLED) { | ||
273 | if (key_provided && *crypt) { | ||
274 | IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n", | ||
275 | key); | ||
276 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
277 | } else | ||
278 | IEEE80211_DEBUG_WX("Disabling encryption.\n"); | ||
279 | |||
280 | /* Check all the keys to see if any are still configured, | ||
281 | * and if no key index was provided, de-init them all. | ||
282 | */ | ||
283 | for (i = 0; i < WEP_KEYS; i++) { | ||
284 | if (ieee->crypt[i] != NULL) { | ||
285 | if (key_provided) | ||
286 | break; | ||
287 | ieee80211_crypt_delayed_deinit( | ||
288 | ieee, &ieee->crypt[i]); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | if (i == WEP_KEYS) { | ||
293 | sec.enabled = 0; | ||
294 | sec.level = SEC_LEVEL_0; | ||
295 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | ||
296 | } | ||
297 | |||
298 | goto done; | ||
299 | } | ||
300 | |||
301 | sec.enabled = 1; | ||
302 | sec.flags |= SEC_ENABLED; | ||
303 | |||
304 | if (*crypt != NULL && (*crypt)->ops != NULL && | ||
305 | strcmp((*crypt)->ops->name, "WEP") != 0) { | ||
306 | /* changing to use WEP; deinit previously used algorithm | ||
307 | * on this key. | ||
308 | */ | ||
309 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
310 | } | ||
311 | |||
312 | if (*crypt == NULL) { | ||
313 | struct ieee80211_crypt_data *new_crypt; | ||
314 | |||
315 | /* take WEP into use */ | ||
316 | new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), | ||
317 | GFP_KERNEL); | ||
318 | if (new_crypt == NULL) | ||
319 | return -ENOMEM; | ||
320 | new_crypt->ops = ieee80211_get_crypto_ops("WEP"); | ||
321 | if (!new_crypt->ops) | ||
322 | new_crypt->ops = ieee80211_get_crypto_ops("WEP"); | ||
323 | |||
324 | if (new_crypt->ops) | ||
325 | new_crypt->priv = new_crypt->ops->init(key); | ||
326 | |||
327 | if (!new_crypt->ops || !new_crypt->priv) { | ||
328 | kfree(new_crypt); | ||
329 | new_crypt = NULL; | ||
330 | |||
331 | netdev_warn(ieee->dev, | ||
332 | "could not initialize WEP: load module ieee80211_crypt_wep\n"); | ||
333 | return -EOPNOTSUPP; | ||
334 | } | ||
335 | *crypt = new_crypt; | ||
336 | } | ||
337 | |||
338 | /* If a new key was provided, set it up */ | ||
339 | if (erq->length > 0) { | ||
340 | len = erq->length <= 5 ? 5 : 13; | ||
341 | memcpy(sec.keys[key], keybuf, erq->length); | ||
342 | if (len > erq->length) | ||
343 | memset(sec.keys[key] + erq->length, 0, | ||
344 | len - erq->length); | ||
345 | IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", | ||
346 | key, escape_essid(sec.keys[key], len), | ||
347 | erq->length, len); | ||
348 | sec.key_sizes[key] = len; | ||
349 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, | ||
350 | (*crypt)->priv); | ||
351 | sec.flags |= (1 << key); | ||
352 | /* This ensures a key will be activated if no key is | ||
353 | * explicitly set. | ||
354 | */ | ||
355 | if (key == sec.active_key) | ||
356 | sec.flags |= SEC_ACTIVE_KEY; | ||
357 | ieee->tx_keyidx = key; | ||
358 | } else { | ||
359 | len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, | ||
360 | NULL, (*crypt)->priv); | ||
361 | if (len == 0) { | ||
362 | /* Set a default key of all 0 */ | ||
363 | IEEE80211_DEBUG_WX("Setting key %d to all zero.\n", | ||
364 | key); | ||
365 | memset(sec.keys[key], 0, 13); | ||
366 | (*crypt)->ops->set_key(sec.keys[key], 13, NULL, | ||
367 | (*crypt)->priv); | ||
368 | sec.key_sizes[key] = 13; | ||
369 | sec.flags |= (1 << key); | ||
370 | } | ||
371 | |||
372 | /* No key data - just set the default TX key index */ | ||
373 | if (key_provided) { | ||
374 | IEEE80211_DEBUG_WX( | ||
375 | "Setting key %d to default Tx key.\n", key); | ||
376 | ieee->tx_keyidx = key; | ||
377 | sec.active_key = key; | ||
378 | sec.flags |= SEC_ACTIVE_KEY; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | done: | ||
383 | ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); | ||
384 | sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; | ||
385 | sec.flags |= SEC_AUTH_MODE; | ||
386 | IEEE80211_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ? | ||
387 | "OPEN" : "SHARED KEY"); | ||
388 | |||
389 | /* For now we just support WEP, so only set that security level... | ||
390 | * TODO: When WPA is added this is one place that needs to change | ||
391 | */ | ||
392 | sec.flags |= SEC_LEVEL; | ||
393 | sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ | ||
394 | |||
395 | if (ieee->set_security) | ||
396 | ieee->set_security(dev, &sec); | ||
397 | |||
398 | /* Do not reset port if card is in Managed mode since resetting will | ||
399 | * generate new IEEE 802.11 authentication which may end up in looping | ||
400 | * with IEEE 802.1X. If your hardware requires a reset after WEP | ||
401 | * configuration (for example... Prism2), implement the reset_port in | ||
402 | * the callbacks structures used to initialize the 802.11 stack. | ||
403 | */ | ||
404 | if (ieee->reset_on_keychange && | ||
405 | ieee->iw_mode != IW_MODE_INFRA && | ||
406 | ieee->reset_port && ieee->reset_port(dev)) { | ||
407 | netdev_dbg(ieee->dev, "reset_port failed\n"); | ||
408 | return -EINVAL; | ||
409 | } | ||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | ||
414 | struct iw_request_info *info, | ||
415 | union iwreq_data *wrqu, char *keybuf) | ||
416 | { | ||
417 | struct iw_point *erq = &(wrqu->encoding); | ||
418 | int len, key; | ||
419 | struct ieee80211_crypt_data *crypt; | ||
420 | |||
421 | IEEE80211_DEBUG_WX("GET_ENCODE\n"); | ||
422 | |||
423 | if (ieee->iw_mode == IW_MODE_MONITOR) | ||
424 | return -1; | ||
425 | |||
426 | key = erq->flags & IW_ENCODE_INDEX; | ||
427 | if (key) { | ||
428 | if (key > WEP_KEYS) | ||
429 | return -EINVAL; | ||
430 | key--; | ||
431 | } else | ||
432 | key = ieee->tx_keyidx; | ||
433 | |||
434 | crypt = ieee->crypt[key]; | ||
435 | erq->flags = key + 1; | ||
436 | |||
437 | if (crypt == NULL || crypt->ops == NULL) { | ||
438 | erq->length = 0; | ||
439 | erq->flags |= IW_ENCODE_DISABLED; | ||
440 | return 0; | ||
441 | } | ||
442 | |||
443 | if (strcmp(crypt->ops->name, "WEP") != 0) { | ||
444 | /* only WEP is supported with wireless extensions, so just | ||
445 | * report that encryption is used. | ||
446 | */ | ||
447 | erq->length = 0; | ||
448 | erq->flags |= IW_ENCODE_ENABLED; | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | len = crypt->ops->get_key(keybuf, WEP_KEY_LEN, NULL, crypt->priv); | ||
453 | erq->length = (len >= 0 ? len : 0); | ||
454 | |||
455 | erq->flags |= IW_ENCODE_ENABLED; | ||
456 | |||
457 | if (ieee->open_wep) | ||
458 | erq->flags |= IW_ENCODE_OPEN; | ||
459 | else | ||
460 | erq->flags |= IW_ENCODE_RESTRICTED; | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, | ||
466 | struct iw_request_info *info, | ||
467 | union iwreq_data *wrqu, char *extra) | ||
468 | { | ||
469 | struct net_device *dev = ieee->dev; | ||
470 | struct iw_point *encoding = &wrqu->encoding; | ||
471 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
472 | int i, idx, ret = 0; | ||
473 | int group_key = 0; | ||
474 | const char *alg; | ||
475 | struct ieee80211_crypto_ops *ops; | ||
476 | struct ieee80211_crypt_data **crypt; | ||
477 | |||
478 | struct ieee80211_security sec = { | ||
479 | .flags = 0, | ||
480 | }; | ||
481 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
482 | if (idx) { | ||
483 | if (idx < 1 || idx > WEP_KEYS) | ||
484 | return -EINVAL; | ||
485 | idx--; | ||
486 | } else | ||
487 | idx = ieee->tx_keyidx; | ||
488 | |||
489 | if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { | ||
490 | crypt = &ieee->crypt[idx]; | ||
491 | group_key = 1; | ||
492 | } else { | ||
493 | /* some Cisco APs use idx>0 for unicast in dynamic WEP */ | ||
494 | if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) | ||
495 | return -EINVAL; | ||
496 | if (ieee->iw_mode == IW_MODE_INFRA) | ||
497 | crypt = &ieee->crypt[idx]; | ||
498 | else | ||
499 | return -EINVAL; | ||
500 | } | ||
501 | |||
502 | sec.flags |= SEC_ENABLED; | ||
503 | if ((encoding->flags & IW_ENCODE_DISABLED) || | ||
504 | ext->alg == IW_ENCODE_ALG_NONE) { | ||
505 | if (*crypt) | ||
506 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
507 | |||
508 | for (i = 0; i < WEP_KEYS; i++) | ||
509 | if (ieee->crypt[i] != NULL) | ||
510 | break; | ||
511 | |||
512 | if (i == WEP_KEYS) { | ||
513 | sec.enabled = 0; | ||
514 | sec.level = SEC_LEVEL_0; | ||
515 | sec.flags |= SEC_LEVEL; | ||
516 | } | ||
517 | goto done; | ||
518 | } | ||
519 | |||
520 | sec.enabled = 1; | ||
521 | |||
522 | switch (ext->alg) { | ||
523 | case IW_ENCODE_ALG_WEP: | ||
524 | alg = "WEP"; | ||
525 | break; | ||
526 | case IW_ENCODE_ALG_TKIP: | ||
527 | alg = "TKIP"; | ||
528 | break; | ||
529 | case IW_ENCODE_ALG_CCMP: | ||
530 | alg = "CCMP"; | ||
531 | break; | ||
532 | default: | ||
533 | IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", | ||
534 | dev->name, ext->alg); | ||
535 | ret = -EINVAL; | ||
536 | goto done; | ||
537 | } | ||
538 | |||
539 | ops = ieee80211_get_crypto_ops(alg); | ||
540 | if (ops == NULL) | ||
541 | ops = ieee80211_get_crypto_ops(alg); | ||
542 | if (ops == NULL) { | ||
543 | IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", | ||
544 | dev->name, ext->alg); | ||
545 | netdev_err(ieee->dev, "========>unknown crypto alg %d\n", | ||
546 | ext->alg); | ||
547 | ret = -EINVAL; | ||
548 | goto done; | ||
549 | } | ||
550 | |||
551 | if (*crypt == NULL || (*crypt)->ops != ops) { | ||
552 | struct ieee80211_crypt_data *new_crypt; | ||
553 | |||
554 | ieee80211_crypt_delayed_deinit(ieee, crypt); | ||
555 | |||
556 | new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); | ||
557 | if (new_crypt == NULL) { | ||
558 | ret = -ENOMEM; | ||
559 | goto done; | ||
560 | } | ||
561 | new_crypt->ops = ops; | ||
562 | if (new_crypt->ops) | ||
563 | new_crypt->priv = new_crypt->ops->init(idx); | ||
564 | if (new_crypt->priv == NULL) { | ||
565 | kfree(new_crypt); | ||
566 | ret = -EINVAL; | ||
567 | goto done; | ||
568 | } | ||
569 | *crypt = new_crypt; | ||
570 | |||
571 | } | ||
572 | |||
573 | if (ext->key_len > 0 && (*crypt)->ops->set_key && | ||
574 | (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, | ||
575 | (*crypt)->priv) < 0) { | ||
576 | IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); | ||
577 | netdev_err(ieee->dev, "key setting failed\n"); | ||
578 | ret = -EINVAL; | ||
579 | goto done; | ||
580 | } | ||
581 | #if 1 | ||
582 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | ||
583 | ieee->tx_keyidx = idx; | ||
584 | sec.active_key = idx; | ||
585 | sec.flags |= SEC_ACTIVE_KEY; | ||
586 | } | ||
587 | |||
588 | if (ext->alg != IW_ENCODE_ALG_NONE) { | ||
589 | memcpy(sec.keys[idx], ext->key, ext->key_len); | ||
590 | sec.key_sizes[idx] = ext->key_len; | ||
591 | sec.flags |= (1 << idx); | ||
592 | if (ext->alg == IW_ENCODE_ALG_WEP) { | ||
593 | sec.flags |= SEC_LEVEL; | ||
594 | sec.level = SEC_LEVEL_1; | ||
595 | } else if (ext->alg == IW_ENCODE_ALG_TKIP) { | ||
596 | sec.flags |= SEC_LEVEL; | ||
597 | sec.level = SEC_LEVEL_2; | ||
598 | } else if (ext->alg == IW_ENCODE_ALG_CCMP) { | ||
599 | sec.flags |= SEC_LEVEL; | ||
600 | sec.level = SEC_LEVEL_3; | ||
601 | } | ||
602 | /* Don't set sec level for group keys. */ | ||
603 | if (group_key) | ||
604 | sec.flags &= ~SEC_LEVEL; | ||
605 | } | ||
606 | #endif | ||
607 | done: | ||
608 | if (ieee->set_security) | ||
609 | ieee->set_security(ieee->dev, &sec); | ||
610 | |||
611 | if (ieee->reset_on_keychange && | ||
612 | ieee->iw_mode != IW_MODE_INFRA && | ||
613 | ieee->reset_port && ieee->reset_port(dev)) { | ||
614 | IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); | ||
615 | return -EINVAL; | ||
616 | } | ||
617 | |||
618 | return ret; | ||
619 | } | ||
620 | |||
621 | int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, | ||
622 | struct iw_request_info *info, | ||
623 | union iwreq_data *wrqu, char *extra) | ||
624 | { | ||
625 | struct iw_mlme *mlme = (struct iw_mlme *) extra; | ||
626 | #if 1 | ||
627 | switch (mlme->cmd) { | ||
628 | case IW_MLME_DEAUTH: | ||
629 | case IW_MLME_DISASSOC: | ||
630 | ieee80211_disassociate(ieee); | ||
631 | break; | ||
632 | default: | ||
633 | return -EOPNOTSUPP; | ||
634 | } | ||
635 | #endif | ||
636 | return 0; | ||
637 | } | ||
638 | |||
639 | int ieee80211_wx_set_auth(struct ieee80211_device *ieee, | ||
640 | struct iw_request_info *info, | ||
641 | struct iw_param *data, char *extra) | ||
642 | { | ||
643 | switch (data->flags & IW_AUTH_INDEX) { | ||
644 | case IW_AUTH_WPA_VERSION: | ||
645 | /* need to support wpa2 here */ | ||
646 | break; | ||
647 | case IW_AUTH_CIPHER_PAIRWISE: | ||
648 | case IW_AUTH_CIPHER_GROUP: | ||
649 | case IW_AUTH_KEY_MGMT: | ||
650 | /* Host AP driver does not use these parameters and allows | ||
651 | * wpa_supplicant to control them internally. | ||
652 | */ | ||
653 | break; | ||
654 | case IW_AUTH_TKIP_COUNTERMEASURES: | ||
655 | ieee->tkip_countermeasures = data->value; | ||
656 | break; | ||
657 | case IW_AUTH_DROP_UNENCRYPTED: | ||
658 | ieee->drop_unencrypted = data->value; | ||
659 | break; | ||
660 | |||
661 | case IW_AUTH_80211_AUTH_ALG: | ||
662 | ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM) ? 1 : 0; | ||
663 | break; | ||
664 | |||
665 | #if 1 | ||
666 | case IW_AUTH_WPA_ENABLED: | ||
667 | ieee->wpa_enabled = (data->value) ? 1 : 0; | ||
668 | break; | ||
669 | |||
670 | #endif | ||
671 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
672 | ieee->ieee802_1x = data->value; | ||
673 | break; | ||
674 | case IW_AUTH_PRIVACY_INVOKED: | ||
675 | ieee->privacy_invoked = data->value; | ||
676 | break; | ||
677 | default: | ||
678 | return -EOPNOTSUPP; | ||
679 | } | ||
680 | return 0; | ||
681 | } | ||
682 | |||
683 | #if 1 | ||
684 | int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) | ||
685 | { | ||
686 | u8 *buf = NULL; | ||
687 | |||
688 | if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) { | ||
689 | netdev_err(ieee->dev, "return error out, len:%zu\n", len); | ||
690 | return -EINVAL; | ||
691 | } | ||
692 | |||
693 | if (len) { | ||
694 | if (len != ie[1]+2) { | ||
695 | netdev_err(ieee->dev, "len:%zu, ie:%d\n", len, ie[1]); | ||
696 | return -EINVAL; | ||
697 | } | ||
698 | buf = kmemdup(ie, len, GFP_KERNEL); | ||
699 | if (buf == NULL) | ||
700 | return -ENOMEM; | ||
701 | kfree(ieee->wpa_ie); | ||
702 | ieee->wpa_ie = buf; | ||
703 | ieee->wpa_ie_len = len; | ||
704 | } else { | ||
705 | kfree(ieee->wpa_ie); | ||
706 | ieee->wpa_ie = NULL; | ||
707 | ieee->wpa_ie_len = 0; | ||
708 | } | ||
709 | |||
710 | return 0; | ||
711 | |||
712 | } | ||
713 | #endif | ||
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h deleted file mode 100644 index 9f931dba1d82..000000000000 --- a/drivers/staging/rtl8187se/r8180.h +++ /dev/null | |||
@@ -1,640 +0,0 @@ | |||
1 | /* | ||
2 | * This is part of rtl8180 OpenSource driver. | ||
3 | * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> | ||
4 | * Released under the terms of GPL (General Public Licence) | ||
5 | * | ||
6 | * Parts of this driver are based on the GPL part of the official realtek driver | ||
7 | * | ||
8 | * Parts of this driver are based on the rtl8180 driver skeleton from Patric | ||
9 | * Schenke & Andres Salomon | ||
10 | * | ||
11 | * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver | ||
12 | * | ||
13 | * We want to thanks the Authors of those projects and the Ndiswrapper project | ||
14 | * Authors. | ||
15 | */ | ||
16 | |||
17 | #ifndef R8180H | ||
18 | #define R8180H | ||
19 | |||
20 | #include <linux/interrupt.h> | ||
21 | |||
22 | #define RTL8180_MODULE_NAME "r8180" | ||
23 | #define DMESG(x, a...) printk(KERN_INFO RTL8180_MODULE_NAME ": " x "\n", ## a) | ||
24 | #define DMESGW(x, a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": WW:" x "\n", ## a) | ||
25 | #define DMESGE(x, a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": EE:" x "\n", ## a) | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/ioport.h> | ||
30 | #include <linux/sched.h> | ||
31 | #include <linux/types.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/netdevice.h> | ||
34 | #include <linux/pci.h> | ||
35 | #include <linux/etherdevice.h> | ||
36 | #include <linux/delay.h> | ||
37 | #include <linux/rtnetlink.h> /* for rtnl_lock() */ | ||
38 | #include <linux/wireless.h> | ||
39 | #include <linux/timer.h> | ||
40 | #include <linux/proc_fs.h> /* Necessary because we use the proc fs. */ | ||
41 | #include <linux/if_arp.h> | ||
42 | #include "ieee80211/ieee80211.h" | ||
43 | #include <asm/io.h> | ||
44 | |||
45 | #define EPROM_93c46 0 | ||
46 | #define EPROM_93c56 1 | ||
47 | |||
48 | #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) | ||
49 | |||
50 | #define DEFAULT_FRAG_THRESHOLD 2342U | ||
51 | #define MIN_FRAG_THRESHOLD 256U | ||
52 | #define DEFAULT_RTS_THRESHOLD 2342U | ||
53 | #define MIN_RTS_THRESHOLD 0U | ||
54 | #define MAX_RTS_THRESHOLD 2342U | ||
55 | #define DEFAULT_BEACONINTERVAL 0x64U | ||
56 | |||
57 | #define DEFAULT_RETRY_RTS 7 | ||
58 | #define DEFAULT_RETRY_DATA 7 | ||
59 | |||
60 | #define BEACON_QUEUE 6 | ||
61 | |||
62 | #define aSifsTime 10 | ||
63 | |||
64 | #define sCrcLng 4 | ||
65 | #define sAckCtsLng 112 /* bits in ACK and CTS frames. */ | ||
66 | /* +by amy 080312. */ | ||
67 | #define RATE_ADAPTIVE_TIMER_PERIOD 300 | ||
68 | |||
69 | enum wireless_mode { | ||
70 | WIRELESS_MODE_UNKNOWN = 0x00, | ||
71 | WIRELESS_MODE_A = 0x01, | ||
72 | WIRELESS_MODE_B = 0x02, | ||
73 | WIRELESS_MODE_G = 0x04, | ||
74 | WIRELESS_MODE_AUTO = 0x08, | ||
75 | }; | ||
76 | |||
77 | struct chnl_access_setting { | ||
78 | u16 sifs_timer; | ||
79 | u16 difs_timer; | ||
80 | u16 slot_time_timer; | ||
81 | u16 eifs_timer; | ||
82 | u16 cwmin_index; | ||
83 | u16 cwmax_index; | ||
84 | }; | ||
85 | |||
86 | enum nic_t { | ||
87 | NIC_8185 = 1, | ||
88 | NIC_8185B | ||
89 | }; | ||
90 | |||
91 | typedef u32 AC_CODING; | ||
92 | #define AC0_BE 0 /* ACI: 0x00 */ /* Best Effort. */ | ||
93 | #define AC1_BK 1 /* ACI: 0x01 */ /* Background. */ | ||
94 | #define AC2_VI 2 /* ACI: 0x10 */ /* Video. */ | ||
95 | #define AC3_VO 3 /* ACI: 0x11 */ /* Voice. */ | ||
96 | #define AC_MAX 4 /* Max: define total number; Should not to be used as a real | ||
97 | * enum. | ||
98 | */ | ||
99 | |||
100 | /* | ||
101 | * ECWmin/ECWmax field. | ||
102 | * Ref: WMM spec 2.2.2: WME Parameter Element, p.13. | ||
103 | */ | ||
104 | typedef union _ECW { | ||
105 | u8 charData; | ||
106 | struct { | ||
107 | u8 ECWmin:4; | ||
108 | u8 ECWmax:4; | ||
109 | } f; /* Field */ | ||
110 | } ECW, *PECW; | ||
111 | |||
112 | /* | ||
113 | * ACI/AIFSN Field. Ref: WMM spec 2.2.2: WME Parameter Element, p.12. | ||
114 | */ | ||
115 | typedef union _ACI_AIFSN { | ||
116 | u8 charData; | ||
117 | |||
118 | struct { | ||
119 | u8 AIFSN:4; | ||
120 | u8 ACM:1; | ||
121 | u8 ACI:2; | ||
122 | u8 Reserved:1; | ||
123 | } f; /* Field */ | ||
124 | } ACI_AIFSN, *PACI_AIFSN; | ||
125 | |||
126 | /* | ||
127 | * AC Parameters Record Format. | ||
128 | * Ref: WMM spec 2.2.2: WME Parameter Element, p.12. | ||
129 | */ | ||
130 | typedef union _AC_PARAM { | ||
131 | u32 longData; | ||
132 | u8 charData[4]; | ||
133 | |||
134 | struct { | ||
135 | ACI_AIFSN AciAifsn; | ||
136 | ECW Ecw; | ||
137 | u16 TXOPLimit; | ||
138 | } f; /* Field */ | ||
139 | } AC_PARAM, *PAC_PARAM; | ||
140 | |||
141 | struct buffer { | ||
142 | struct buffer *next; | ||
143 | u32 *buf; | ||
144 | dma_addr_t dma; | ||
145 | }; | ||
146 | |||
147 | /* YJ,modified,080828. */ | ||
148 | struct stats { | ||
149 | unsigned long txrdu; | ||
150 | unsigned long rxrdu; | ||
151 | unsigned long rxnolast; | ||
152 | unsigned long rxnodata; | ||
153 | unsigned long rxnopointer; | ||
154 | unsigned long txnperr; | ||
155 | unsigned long txresumed; | ||
156 | unsigned long rxerr; | ||
157 | unsigned long rxoverflow; | ||
158 | unsigned long rxint; | ||
159 | unsigned long txbkpokint; | ||
160 | unsigned long txbepoking; | ||
161 | unsigned long txbkperr; | ||
162 | unsigned long txbeperr; | ||
163 | unsigned long txnpokint; | ||
164 | unsigned long txhpokint; | ||
165 | unsigned long txhperr; | ||
166 | unsigned long ints; | ||
167 | unsigned long shints; | ||
168 | unsigned long txoverflow; | ||
169 | unsigned long rxdmafail; | ||
170 | unsigned long txbeacon; | ||
171 | unsigned long txbeaconerr; | ||
172 | unsigned long txlpokint; | ||
173 | unsigned long txlperr; | ||
174 | unsigned long txretry; /* retry number tony 20060601 */ | ||
175 | unsigned long rxcrcerrmin; /* crc error (0-500) */ | ||
176 | unsigned long rxcrcerrmid; /* crc error (500-1000) */ | ||
177 | unsigned long rxcrcerrmax; /* crc error (>1000) */ | ||
178 | unsigned long rxicverr; /* ICV error */ | ||
179 | }; | ||
180 | |||
181 | #define MAX_LD_SLOT_NUM 10 | ||
182 | #define KEEP_ALIVE_INTERVAL 20 /* in seconds. */ | ||
183 | #define CHECK_FOR_HANG_PERIOD 2 /* be equal to watchdog check time. */ | ||
184 | #define DEFAULT_KEEP_ALIVE_LEVEL 1 | ||
185 | #define DEFAULT_SLOT_NUM 2 | ||
186 | #define POWER_PROFILE_AC 0 | ||
187 | #define POWER_PROFILE_BATTERY 1 | ||
188 | |||
189 | struct link_detect_t { | ||
190 | u32 rx_frame_num[MAX_LD_SLOT_NUM]; /* number of Rx Frame. | ||
191 | * CheckForHang_period to determine | ||
192 | * link status. | ||
193 | */ | ||
194 | u16 slot_num; /* number of CheckForHang period to determine link status, | ||
195 | * default is 2. | ||
196 | */ | ||
197 | u16 slot_index; | ||
198 | u32 num_tx_ok_in_period; /* number of packet transmitted during | ||
199 | * CheckForHang. | ||
200 | */ | ||
201 | u32 num_rx_ok_in_period; /* number of packet received during | ||
202 | * CheckForHang. | ||
203 | */ | ||
204 | u8 idle_count; /* (KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD) */ | ||
205 | u32 last_num_tx_unicast; | ||
206 | u32 last_num_rx_unicast; | ||
207 | |||
208 | bool b_busy_traffic; /* when it is set to 1, UI cann't scan at will. */ | ||
209 | }; | ||
210 | |||
211 | /* YJ,modified,080828,end */ | ||
212 | |||
213 | /* by amy for led | ||
214 | * ========================================================================== | ||
215 | * LED customization. | ||
216 | * ========================================================================== | ||
217 | */ | ||
218 | enum led_strategy_8185 { | ||
219 | SW_LED_MODE0, | ||
220 | SW_LED_MODE1, | ||
221 | HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different | ||
222 | * control modes). */ | ||
223 | }; | ||
224 | |||
225 | enum rt_rf_power_state { | ||
226 | RF_ON, | ||
227 | RF_SLEEP, | ||
228 | RF_OFF | ||
229 | }; | ||
230 | |||
231 | enum _ReasonCode { | ||
232 | unspec_reason = 0x1, | ||
233 | auth_not_valid = 0x2, | ||
234 | deauth_lv_ss = 0x3, | ||
235 | inactivity = 0x4, | ||
236 | ap_overload = 0x5, | ||
237 | class2_err = 0x6, | ||
238 | class3_err = 0x7, | ||
239 | disas_lv_ss = 0x8, | ||
240 | asoc_not_auth = 0x9, | ||
241 | |||
242 | /* ----MIC_CHECK */ | ||
243 | mic_failure = 0xe, | ||
244 | /* ----END MIC_CHECK */ | ||
245 | |||
246 | /* Reason code defined in 802.11i D10.0 p.28. */ | ||
247 | invalid_IE = 0x0d, | ||
248 | four_way_tmout = 0x0f, | ||
249 | two_way_tmout = 0x10, | ||
250 | IE_dismatch = 0x11, | ||
251 | invalid_Gcipher = 0x12, | ||
252 | invalid_Pcipher = 0x13, | ||
253 | invalid_AKMP = 0x14, | ||
254 | unsup_RSNIEver = 0x15, | ||
255 | invalid_RSNIE = 0x16, | ||
256 | auth_802_1x_fail = 0x17, | ||
257 | ciper_reject = 0x18, | ||
258 | |||
259 | /* Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, | ||
260 | * 2005-11-15. | ||
261 | */ | ||
262 | QoS_unspec = 0x20, /* 32 */ | ||
263 | QAP_bandwidth = 0x21, /* 33 */ | ||
264 | poor_condition = 0x22, /* 34 */ | ||
265 | no_facility = 0x23, /* 35 */ | ||
266 | /* Where is 36??? */ | ||
267 | req_declined = 0x25, /* 37 */ | ||
268 | invalid_param = 0x26, /* 38 */ | ||
269 | req_not_honored = 0x27, /* 39 */ | ||
270 | TS_not_created = 0x2F, /* 47 */ | ||
271 | DL_not_allowed = 0x30, /* 48 */ | ||
272 | dest_not_exist = 0x31, /* 49 */ | ||
273 | dest_not_QSTA = 0x32, /* 50 */ | ||
274 | }; | ||
275 | |||
276 | enum rt_ps_mode { | ||
277 | ACTIVE, /* Active/Continuous access. */ | ||
278 | MAX_PS, /* Max power save mode. */ | ||
279 | FAST_PS /* Fast power save mode. */ | ||
280 | }; | ||
281 | |||
282 | /* by amy for power save. */ | ||
283 | struct r8180_priv { | ||
284 | struct pci_dev *pdev; | ||
285 | |||
286 | short epromtype; | ||
287 | int irq; | ||
288 | struct ieee80211_device *ieee80211; | ||
289 | |||
290 | short plcp_preamble_mode; /* 0:auto 1:short 2:long */ | ||
291 | |||
292 | spinlock_t irq_th_lock; | ||
293 | spinlock_t tx_lock; | ||
294 | spinlock_t ps_lock; | ||
295 | spinlock_t rf_ps_lock; | ||
296 | |||
297 | u16 irq_mask; | ||
298 | short irq_enabled; | ||
299 | struct net_device *dev; | ||
300 | short chan; | ||
301 | short sens; | ||
302 | short max_sens; | ||
303 | u8 chtxpwr[15]; /* channels from 1 to 14, 0 not used. */ | ||
304 | u8 chtxpwr_ofdm[15]; /* channels from 1 to 14, 0 not used. */ | ||
305 | u8 channel_plan; /* it's the channel plan index. */ | ||
306 | short up; | ||
307 | short crcmon; /* if 1 allow bad crc frame reception in monitor mode. */ | ||
308 | |||
309 | struct timer_list scan_timer; | ||
310 | spinlock_t scan_lock; | ||
311 | u8 active_probe; | ||
312 | struct semaphore wx_sem; | ||
313 | short hw_wep; | ||
314 | |||
315 | short digphy; | ||
316 | short antb; | ||
317 | short diversity; | ||
318 | u32 key0[4]; | ||
319 | short (*rf_set_sens)(struct net_device *dev, short sens); | ||
320 | void (*rf_set_chan)(struct net_device *dev, short ch); | ||
321 | void (*rf_close)(struct net_device *dev); | ||
322 | void (*rf_init)(struct net_device *dev); | ||
323 | void (*rf_sleep)(struct net_device *dev); | ||
324 | void (*rf_wakeup)(struct net_device *dev); | ||
325 | /* short rate; */ | ||
326 | short promisc; | ||
327 | /* stats */ | ||
328 | struct stats stats; | ||
329 | struct link_detect_t link_detect; /* YJ,add,080828 */ | ||
330 | struct iw_statistics wstats; | ||
331 | |||
332 | /* RX stuff. */ | ||
333 | u32 *rxring; | ||
334 | u32 *rxringtail; | ||
335 | dma_addr_t rxringdma; | ||
336 | struct buffer *rxbuffer; | ||
337 | struct buffer *rxbufferhead; | ||
338 | int rxringcount; | ||
339 | u16 rxbuffersize; | ||
340 | |||
341 | struct sk_buff *rx_skb; | ||
342 | |||
343 | short rx_skb_complete; | ||
344 | |||
345 | u32 rx_prevlen; | ||
346 | |||
347 | u32 *txmapring; | ||
348 | u32 *txbkpring; | ||
349 | u32 *txbepring; | ||
350 | u32 *txvipring; | ||
351 | u32 *txvopring; | ||
352 | u32 *txhpring; | ||
353 | dma_addr_t txmapringdma; | ||
354 | dma_addr_t txbkpringdma; | ||
355 | dma_addr_t txbepringdma; | ||
356 | dma_addr_t txvipringdma; | ||
357 | dma_addr_t txvopringdma; | ||
358 | dma_addr_t txhpringdma; | ||
359 | u32 *txmapringtail; | ||
360 | u32 *txbkpringtail; | ||
361 | u32 *txbepringtail; | ||
362 | u32 *txvipringtail; | ||
363 | u32 *txvopringtail; | ||
364 | u32 *txhpringtail; | ||
365 | u32 *txmapringhead; | ||
366 | u32 *txbkpringhead; | ||
367 | u32 *txbepringhead; | ||
368 | u32 *txvipringhead; | ||
369 | u32 *txvopringhead; | ||
370 | u32 *txhpringhead; | ||
371 | struct buffer *txmapbufs; | ||
372 | struct buffer *txbkpbufs; | ||
373 | struct buffer *txbepbufs; | ||
374 | struct buffer *txvipbufs; | ||
375 | struct buffer *txvopbufs; | ||
376 | struct buffer *txhpbufs; | ||
377 | struct buffer *txmapbufstail; | ||
378 | struct buffer *txbkpbufstail; | ||
379 | struct buffer *txbepbufstail; | ||
380 | struct buffer *txvipbufstail; | ||
381 | struct buffer *txvopbufstail; | ||
382 | struct buffer *txhpbufstail; | ||
383 | |||
384 | int txringcount; | ||
385 | int txbuffsize; | ||
386 | struct tasklet_struct irq_rx_tasklet; | ||
387 | u8 dma_poll_mask; | ||
388 | |||
389 | /* adhoc/master mode stuff. */ | ||
390 | u32 *txbeaconringtail; | ||
391 | dma_addr_t txbeaconringdma; | ||
392 | u32 *txbeaconring; | ||
393 | int txbeaconcount; | ||
394 | struct buffer *txbeaconbufs; | ||
395 | struct buffer *txbeaconbufstail; | ||
396 | |||
397 | u8 retry_data; | ||
398 | u8 retry_rts; | ||
399 | u16 rts; | ||
400 | |||
401 | /* by amy for led. */ | ||
402 | enum led_strategy_8185 led_strategy; | ||
403 | /* by amy for led. */ | ||
404 | |||
405 | /* by amy for power save. */ | ||
406 | struct timer_list watch_dog_timer; | ||
407 | bool bInactivePs; | ||
408 | bool bSwRfProcessing; | ||
409 | enum rt_rf_power_state eInactivePowerState; | ||
410 | enum rt_rf_power_state eRFPowerState; | ||
411 | u32 RfOffReason; | ||
412 | bool RFChangeInProgress; | ||
413 | bool SetRFPowerStateInProgress; | ||
414 | u8 RFProgType; | ||
415 | bool bLeisurePs; | ||
416 | enum rt_ps_mode dot11PowerSaveMode; | ||
417 | u8 TxPollingTimes; | ||
418 | |||
419 | bool bApBufOurFrame; /* TRUE if AP buffer our unicast data , we will | ||
420 | * keep eAwake until receive data or timeout. | ||
421 | */ | ||
422 | u8 WaitBufDataBcnCount; | ||
423 | u8 WaitBufDataTimeOut; | ||
424 | |||
425 | /* by amy for power save. */ | ||
426 | /* by amy for antenna. */ | ||
427 | u8 EEPROMSwAntennaDiversity; | ||
428 | bool EEPROMDefaultAntenna1; | ||
429 | u8 RegSwAntennaDiversityMechanism; | ||
430 | bool bSwAntennaDiverity; | ||
431 | u8 RegDefaultAntenna; | ||
432 | bool bDefaultAntenna1; | ||
433 | u8 SignalStrength; | ||
434 | long Stats_SignalStrength; | ||
435 | long LastSignalStrengthInPercent; /* In percentage, used for smoothing, | ||
436 | * e.g. Moving Average. | ||
437 | */ | ||
438 | u8 SignalQuality; /* in 0-100 index. */ | ||
439 | long Stats_SignalQuality; | ||
440 | long RecvSignalPower; /* in dBm. */ | ||
441 | long Stats_RecvSignalPower; | ||
442 | u8 LastRxPktAntenna; /* +by amy 080312 Antenna which received the lasted | ||
443 | * packet. 0: Aux, 1:Main. Added by Roger, | ||
444 | * 2008.01.25. | ||
445 | */ | ||
446 | u32 AdRxOkCnt; | ||
447 | long AdRxSignalStrength; | ||
448 | u8 CurrAntennaIndex; /* Index to current Antenna (both Tx and Rx). */ | ||
449 | u8 AdTickCount; /* Times of SwAntennaDiversityTimer happened. */ | ||
450 | u8 AdCheckPeriod; /* # of period SwAntennaDiversityTimer to check Rx | ||
451 | * signal strength for SW Antenna Diversity. | ||
452 | */ | ||
453 | u8 AdMinCheckPeriod; /* Min value of AdCheckPeriod. */ | ||
454 | u8 AdMaxCheckPeriod; /* Max value of AdCheckPeriod. */ | ||
455 | long AdRxSsThreshold; /* Signal strength threshold to switch antenna. */ | ||
456 | long AdMaxRxSsThreshold; /* Max value of AdRxSsThreshold. */ | ||
457 | bool bAdSwitchedChecking; /* TRUE if we shall shall check Rx signal | ||
458 | * strength for last time switching antenna. | ||
459 | */ | ||
460 | long AdRxSsBeforeSwitched; /* Rx signal strength before we switched | ||
461 | * antenna. | ||
462 | */ | ||
463 | struct timer_list SwAntennaDiversityTimer; | ||
464 | /* by amy for antenna {by amy 080312 */ | ||
465 | |||
466 | /* Crystal calibration. Added by Roger, 2007.12.11. */ | ||
467 | |||
468 | bool bXtalCalibration; /* Crystal calibration.*/ | ||
469 | u8 XtalCal_Xin; /* Crystal calibration for Xin. 0~7.5pF */ | ||
470 | u8 XtalCal_Xout; /* Crystal calibration for Xout. 0~7.5pF */ | ||
471 | |||
472 | /* Tx power tracking with thermal meter indication. | ||
473 | * Added by Roger, 2007.12.11. | ||
474 | */ | ||
475 | |||
476 | bool bTxPowerTrack; /* Tx Power tracking. */ | ||
477 | u8 ThermalMeter; /* Thermal meter reference indication. */ | ||
478 | |||
479 | /* Dynamic Initial Gain Adjustment Mechanism. Added by Bruce, | ||
480 | * 2007-02-14. | ||
481 | */ | ||
482 | bool bDigMechanism; /* TRUE if DIG is enabled, FALSE ow. */ | ||
483 | bool bRegHighPowerMechanism; /* For High Power Mechanism. 061010, | ||
484 | * by rcnjko. | ||
485 | */ | ||
486 | u32 FalseAlarmRegValue; | ||
487 | u8 RegDigOfdmFaUpTh; /* Upper threshold of OFDM false alarm, which is | ||
488 | * used in DIG. | ||
489 | */ | ||
490 | u8 DIG_NumberFallbackVote; | ||
491 | u8 DIG_NumberUpgradeVote; | ||
492 | /* For HW antenna diversity, added by Roger, 2008.01.30. */ | ||
493 | u32 AdMainAntennaRxOkCnt; /* Main antenna Rx OK count. */ | ||
494 | u32 AdAuxAntennaRxOkCnt; /* Aux antenna Rx OK count. */ | ||
495 | bool bHWAdSwitched; /* TRUE if we has switched default antenna by HW | ||
496 | * evaluation. | ||
497 | */ | ||
498 | /* RF High Power upper/lower threshold. */ | ||
499 | u8 RegHiPwrUpperTh; | ||
500 | u8 RegHiPwrLowerTh; | ||
501 | /* RF RSSI High Power upper/lower Threshold. */ | ||
502 | u8 RegRSSIHiPwrUpperTh; | ||
503 | u8 RegRSSIHiPwrLowerTh; | ||
504 | /* Current CCK RSSI value to determine CCK high power, asked by SD3 DZ, | ||
505 | * by Bruce, 2007-04-12. | ||
506 | */ | ||
507 | u8 CurCCKRSSI; | ||
508 | bool bCurCCKPkt; | ||
509 | /* High Power Mechanism. Added by amy, 080312. */ | ||
510 | bool bToUpdateTxPwr; | ||
511 | long UndecoratedSmoothedSS; | ||
512 | long UndecoratedSmoothedRxPower; | ||
513 | u8 RSSI; | ||
514 | char RxPower; | ||
515 | u8 InitialGain; | ||
516 | /* For adjust Dig Threshold during Legacy/Leisure Power Save Mode. */ | ||
517 | u32 DozePeriodInPast2Sec; | ||
518 | /* Don't access BB/RF under disable PLL situation. */ | ||
519 | u8 InitialGainBackUp; | ||
520 | u8 RegBModeGainStage; | ||
521 | /* by amy for rate adaptive */ | ||
522 | struct timer_list rateadapter_timer; | ||
523 | u32 RateAdaptivePeriod; | ||
524 | bool bEnhanceTxPwr; | ||
525 | bool bUpdateARFR; | ||
526 | int ForcedDataRate; /* Force Data Rate. 0: Auto, 0x02: 1M ~ 0x6C: 54M.) | ||
527 | */ | ||
528 | u32 NumTxUnicast; /* YJ,add,080828,for keep alive. */ | ||
529 | u8 keepAliveLevel; /*YJ,add,080828,for KeepAlive. */ | ||
530 | unsigned long NumTxOkTotal; | ||
531 | u16 LastRetryCnt; | ||
532 | u16 LastRetryRate; | ||
533 | unsigned long LastTxokCnt; | ||
534 | unsigned long LastRxokCnt; | ||
535 | u16 CurrRetryCnt; | ||
536 | unsigned long LastTxOKBytes; | ||
537 | unsigned long NumTxOkBytesTotal; | ||
538 | u8 LastFailTxRate; | ||
539 | long LastFailTxRateSS; | ||
540 | u8 FailTxRateCount; | ||
541 | u32 LastTxThroughput; | ||
542 | /* for up rate. */ | ||
543 | unsigned short bTryuping; | ||
544 | u8 CurrTxRate; /* the rate before up. */ | ||
545 | u16 CurrRetryRate; | ||
546 | u16 TryupingCount; | ||
547 | u8 TryDownCountLowData; | ||
548 | u8 TryupingCountNoData; | ||
549 | |||
550 | u8 CurrentOperaRate; | ||
551 | struct work_struct reset_wq; | ||
552 | struct work_struct watch_dog_wq; | ||
553 | short ack_tx_to_ieee; | ||
554 | |||
555 | u8 dma_poll_stop_mask; | ||
556 | |||
557 | u16 ShortRetryLimit; | ||
558 | u16 LongRetryLimit; | ||
559 | u16 EarlyRxThreshold; | ||
560 | u32 TransmitConfig; | ||
561 | u32 ReceiveConfig; | ||
562 | u32 IntrMask; | ||
563 | |||
564 | struct chnl_access_setting ChannelAccessSetting; | ||
565 | }; | ||
566 | |||
567 | #define MANAGE_PRIORITY 0 | ||
568 | #define BK_PRIORITY 1 | ||
569 | #define BE_PRIORITY 2 | ||
570 | #define VI_PRIORITY 3 | ||
571 | #define VO_PRIORITY 4 | ||
572 | #define HI_PRIORITY 5 | ||
573 | #define BEACON_PRIORITY 6 | ||
574 | |||
575 | #define LOW_PRIORITY VI_PRIORITY | ||
576 | #define NORM_PRIORITY VO_PRIORITY | ||
577 | /* AC2Queue mapping. */ | ||
578 | #define AC2Q(_ac) (((_ac) == WME_AC_VO) ? VO_PRIORITY : \ | ||
579 | ((_ac) == WME_AC_VI) ? VI_PRIORITY : \ | ||
580 | ((_ac) == WME_AC_BK) ? BK_PRIORITY : \ | ||
581 | BE_PRIORITY) | ||
582 | |||
583 | short rtl8180_tx(struct net_device *dev, u8 *skbuf, int len, int priority, | ||
584 | bool morefrag, short fragdesc, int rate); | ||
585 | |||
586 | u8 read_nic_byte(struct net_device *dev, int x); | ||
587 | u32 read_nic_dword(struct net_device *dev, int x); | ||
588 | u16 read_nic_word(struct net_device *dev, int x); | ||
589 | void write_nic_byte(struct net_device *dev, int x, u8 y); | ||
590 | void write_nic_word(struct net_device *dev, int x, u16 y); | ||
591 | void write_nic_dword(struct net_device *dev, int x, u32 y); | ||
592 | void force_pci_posting(struct net_device *dev); | ||
593 | |||
594 | void rtl8180_rtx_disable(struct net_device *); | ||
595 | void rtl8180_set_anaparam(struct net_device *dev, u32 a); | ||
596 | void rtl8185_set_anaparam2(struct net_device *dev, u32 a); | ||
597 | void rtl8180_set_hw_wep(struct net_device *dev); | ||
598 | void rtl8180_no_hw_wep(struct net_device *dev); | ||
599 | void rtl8180_update_msr(struct net_device *dev); | ||
600 | void rtl8180_beacon_tx_disable(struct net_device *dev); | ||
601 | void rtl8180_beacon_rx_disable(struct net_device *dev); | ||
602 | int rtl8180_down(struct net_device *dev); | ||
603 | int rtl8180_up(struct net_device *dev); | ||
604 | void rtl8180_commit(struct net_device *dev); | ||
605 | void rtl8180_set_chan(struct net_device *dev, short ch); | ||
606 | void write_phy(struct net_device *dev, u8 adr, u8 data); | ||
607 | void write_phy_cck(struct net_device *dev, u8 adr, u32 data); | ||
608 | void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); | ||
609 | void rtl8185_tx_antenna(struct net_device *dev, u8 ant); | ||
610 | void rtl8185_rf_pins_enable(struct net_device *dev); | ||
611 | void IPSEnter(struct net_device *dev); | ||
612 | void IPSLeave(struct net_device *dev); | ||
613 | int get_curr_tx_free_desc(struct net_device *dev, int priority); | ||
614 | void UpdateInitialGain(struct net_device *dev); | ||
615 | bool SetAntennaConfig87SE(struct net_device *dev, u8 DefaultAnt, | ||
616 | bool bAntDiversity); | ||
617 | |||
618 | void rtl8185b_adapter_start(struct net_device *dev); | ||
619 | void rtl8185b_rx_enable(struct net_device *dev); | ||
620 | void rtl8185b_tx_enable(struct net_device *dev); | ||
621 | void rtl8180_reset(struct net_device *dev); | ||
622 | void rtl8185b_irq_enable(struct net_device *dev); | ||
623 | void fix_rx_fifo(struct net_device *dev); | ||
624 | void fix_tx_fifo(struct net_device *dev); | ||
625 | void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch); | ||
626 | void rtl8180_rate_adapter(struct work_struct *work); | ||
627 | bool MgntActSet_RF_State(struct net_device *dev, enum rt_rf_power_state StateToSet, | ||
628 | u32 ChangeSource); | ||
629 | |||
630 | #endif | ||
631 | |||
632 | /* fun with the built-in ieee80211 stack... */ | ||
633 | extern int ieee80211_crypto_init(void); | ||
634 | extern void ieee80211_crypto_deinit(void); | ||
635 | extern int ieee80211_crypto_tkip_init(void); | ||
636 | extern void ieee80211_crypto_tkip_exit(void); | ||
637 | extern int ieee80211_crypto_ccmp_init(void); | ||
638 | extern void ieee80211_crypto_ccmp_exit(void); | ||
639 | extern int ieee80211_crypto_wep_init(void); | ||
640 | extern void ieee80211_crypto_wep_exit(void); | ||
diff --git a/drivers/staging/rtl8187se/r8180_93cx6.h b/drivers/staging/rtl8187se/r8180_93cx6.h deleted file mode 100644 index b52b5b0610ab..000000000000 --- a/drivers/staging/rtl8187se/r8180_93cx6.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | This is part of rtl8180 OpenSource driver | ||
3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> | ||
4 | Released under the terms of GPL (General Public Licence) | ||
5 | |||
6 | Parts of this driver are based on the GPL part of the official realtek driver | ||
7 | Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon | ||
8 | Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver | ||
9 | |||
10 | We want to tanks the Authors of such projects and the Ndiswrapper project Authors. | ||
11 | */ | ||
12 | |||
13 | /*This files contains card eeprom (93c46 or 93c56) programming routines*/ | ||
14 | /*memory is addressed by WORDS*/ | ||
15 | |||
16 | #include "r8180.h" | ||
17 | #include "r8180_hw.h" | ||
18 | |||
19 | #define EPROM_DELAY 10 | ||
20 | |||
21 | #define EPROM_ANAPARAM_ADDRLWORD 0xd | ||
22 | #define EPROM_ANAPARAM_ADDRHWORD 0xe | ||
23 | |||
24 | #define RFCHIPID 0x6 | ||
25 | #define RFCHIPID_INTERSIL 1 | ||
26 | #define RFCHIPID_RFMD 2 | ||
27 | #define RFCHIPID_PHILIPS 3 | ||
28 | #define RFCHIPID_MAXIM 4 | ||
29 | #define RFCHIPID_GCT 5 | ||
30 | #define RFCHIPID_RTL8225 9 | ||
31 | #define RF_ZEBRA2 11 | ||
32 | #define EPROM_TXPW_BASE 0x05 | ||
33 | #define RF_ZEBRA4 12 | ||
34 | #define RFCHIPID_RTL8255 0xa | ||
35 | #define RF_PARAM 0x19 | ||
36 | #define RF_PARAM_DIGPHY_SHIFT 0 | ||
37 | #define RF_PARAM_ANTBDEFAULT_SHIFT 1 | ||
38 | #define RF_PARAM_CARRIERSENSE_SHIFT 2 | ||
39 | #define RF_PARAM_CARRIERSENSE_MASK (3<<2) | ||
40 | #define ENERGY_TRESHOLD 0x17 | ||
41 | #define EPROM_VERSION 0x1E | ||
42 | #define MAC_ADR 0x7 | ||
43 | |||
44 | #define CIS 0x18 | ||
45 | |||
46 | #define EPROM_TXPW_OFDM_CH1_2 0x20 | ||
47 | |||
48 | #define EPROM_TXPW_CH1_2 0x30 | ||
49 | |||
50 | #define RTL818X_EEPROM_CMD_READ (1 << 0) | ||
51 | #define RTL818X_EEPROM_CMD_WRITE (1 << 1) | ||
52 | #define RTL818X_EEPROM_CMD_CK (1 << 2) | ||
53 | #define RTL818X_EEPROM_CMD_CS (1 << 3) | ||
54 | |||
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c deleted file mode 100644 index a6022d4e7573..000000000000 --- a/drivers/staging/rtl8187se/r8180_core.c +++ /dev/null | |||
@@ -1,3775 +0,0 @@ | |||
1 | /* | ||
2 | * This is part of rtl818x pci OpenSource driver - v 0.1 | ||
3 | * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> | ||
4 | * Released under the terms of GPL (General Public License) | ||
5 | * | ||
6 | * Parts of this driver are based on the GPL part of the official | ||
7 | * Realtek driver. | ||
8 | * | ||
9 | * Parts of this driver are based on the rtl8180 driver skeleton | ||
10 | * from Patric Schenke & Andres Salomon. | ||
11 | * | ||
12 | * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. | ||
13 | * | ||
14 | * Parts of BB/RF code are derived from David Young rtl8180 netbsd driver. | ||
15 | * | ||
16 | * RSSI calc function from 'The Deuce' | ||
17 | * | ||
18 | * Some ideas borrowed from the 8139too.c driver included in linux kernel. | ||
19 | * | ||
20 | * We (I?) want to thanks the Authors of those projecs and also the | ||
21 | * Ndiswrapper's project Authors. | ||
22 | * | ||
23 | * A big big thanks goes also to Realtek corp. for their help in my attempt to | ||
24 | * add RTL8185 and RTL8225 support, and to David Young also. | ||
25 | * | ||
26 | * Power management interface routines. | ||
27 | * Written by Mariusz Matuszek. | ||
28 | */ | ||
29 | |||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
32 | #undef RX_DONT_PASS_UL | ||
33 | #undef DUMMY_RX | ||
34 | |||
35 | #include <linux/slab.h> | ||
36 | #include <linux/syscalls.h> | ||
37 | #include <linux/eeprom_93cx6.h> | ||
38 | #include <linux/interrupt.h> | ||
39 | #include <linux/proc_fs.h> | ||
40 | #include <linux/seq_file.h> | ||
41 | |||
42 | #include "r8180_hw.h" | ||
43 | #include "r8180.h" | ||
44 | #include "r8180_rtl8225.h" /* RTL8225 Radio frontend */ | ||
45 | #include "r8180_93cx6.h" /* Card EEPROM */ | ||
46 | #include "r8180_wx.h" | ||
47 | #include "r8180_dm.h" | ||
48 | |||
49 | #include "ieee80211/dot11d.h" | ||
50 | |||
51 | static struct pci_device_id rtl8180_pci_id_tbl[] = { | ||
52 | { | ||
53 | .vendor = PCI_VENDOR_ID_REALTEK, | ||
54 | .device = 0x8199, | ||
55 | .subvendor = PCI_ANY_ID, | ||
56 | .subdevice = PCI_ANY_ID, | ||
57 | .driver_data = 0, | ||
58 | }, | ||
59 | { | ||
60 | .vendor = 0, | ||
61 | .device = 0, | ||
62 | .subvendor = 0, | ||
63 | .subdevice = 0, | ||
64 | .driver_data = 0, | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static char ifname[IFNAMSIZ] = "wlan%d"; | ||
69 | static int hwwep; | ||
70 | |||
71 | MODULE_LICENSE("GPL"); | ||
72 | MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl); | ||
73 | MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>"); | ||
74 | MODULE_DESCRIPTION("Linux driver for Realtek RTL8187SE WiFi cards"); | ||
75 | |||
76 | module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR); | ||
77 | module_param(hwwep, int, S_IRUGO|S_IWUSR); | ||
78 | |||
79 | MODULE_PARM_DESC(hwwep, " Try to use hardware WEP support. Still broken and not available on all cards"); | ||
80 | |||
81 | static int rtl8180_pci_probe(struct pci_dev *pdev, | ||
82 | const struct pci_device_id *id); | ||
83 | |||
84 | static void rtl8180_pci_remove(struct pci_dev *pdev); | ||
85 | |||
86 | static void rtl8180_shutdown(struct pci_dev *pdev) | ||
87 | { | ||
88 | struct net_device *dev = pci_get_drvdata(pdev); | ||
89 | if (dev->netdev_ops->ndo_stop) | ||
90 | dev->netdev_ops->ndo_stop(dev); | ||
91 | pci_disable_device(pdev); | ||
92 | } | ||
93 | |||
94 | static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state) | ||
95 | { | ||
96 | struct net_device *dev = pci_get_drvdata(pdev); | ||
97 | |||
98 | if (!netif_running(dev)) | ||
99 | goto out_pci_suspend; | ||
100 | |||
101 | if (dev->netdev_ops->ndo_stop) | ||
102 | dev->netdev_ops->ndo_stop(dev); | ||
103 | |||
104 | netif_device_detach(dev); | ||
105 | |||
106 | out_pci_suspend: | ||
107 | pci_save_state(pdev); | ||
108 | pci_disable_device(pdev); | ||
109 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int rtl8180_resume(struct pci_dev *pdev) | ||
114 | { | ||
115 | struct net_device *dev = pci_get_drvdata(pdev); | ||
116 | int err; | ||
117 | u32 val; | ||
118 | |||
119 | pci_set_power_state(pdev, PCI_D0); | ||
120 | |||
121 | err = pci_enable_device(pdev); | ||
122 | if (err) { | ||
123 | dev_err(&pdev->dev, "pci_enable_device failed on resume\n"); | ||
124 | |||
125 | return err; | ||
126 | } | ||
127 | |||
128 | pci_restore_state(pdev); | ||
129 | |||
130 | /* | ||
131 | * Suspend/Resume resets the PCI configuration space, so we have to | ||
132 | * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries | ||
133 | * from interfering with C3 CPU state. pci_restore_state won't help | ||
134 | * here since it only restores the first 64 bytes pci config header. | ||
135 | */ | ||
136 | pci_read_config_dword(pdev, 0x40, &val); | ||
137 | if ((val & 0x0000ff00) != 0) | ||
138 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); | ||
139 | |||
140 | if (!netif_running(dev)) | ||
141 | goto out; | ||
142 | |||
143 | if (dev->netdev_ops->ndo_open) | ||
144 | dev->netdev_ops->ndo_open(dev); | ||
145 | |||
146 | netif_device_attach(dev); | ||
147 | out: | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static struct pci_driver rtl8180_pci_driver = { | ||
152 | .name = RTL8180_MODULE_NAME, | ||
153 | .id_table = rtl8180_pci_id_tbl, | ||
154 | .probe = rtl8180_pci_probe, | ||
155 | .remove = rtl8180_pci_remove, | ||
156 | .suspend = rtl8180_suspend, | ||
157 | .resume = rtl8180_resume, | ||
158 | .shutdown = rtl8180_shutdown, | ||
159 | }; | ||
160 | |||
161 | u8 read_nic_byte(struct net_device *dev, int x) | ||
162 | { | ||
163 | return 0xff&readb((u8 __iomem *)dev->mem_start + x); | ||
164 | } | ||
165 | |||
166 | u32 read_nic_dword(struct net_device *dev, int x) | ||
167 | { | ||
168 | return readl((u8 __iomem *)dev->mem_start + x); | ||
169 | } | ||
170 | |||
171 | u16 read_nic_word(struct net_device *dev, int x) | ||
172 | { | ||
173 | return readw((u8 __iomem *)dev->mem_start + x); | ||
174 | } | ||
175 | |||
176 | void write_nic_byte(struct net_device *dev, int x, u8 y) | ||
177 | { | ||
178 | writeb(y, (u8 __iomem *)dev->mem_start + x); | ||
179 | udelay(20); | ||
180 | } | ||
181 | |||
182 | void write_nic_dword(struct net_device *dev, int x, u32 y) | ||
183 | { | ||
184 | writel(y, (u8 __iomem *)dev->mem_start + x); | ||
185 | udelay(20); | ||
186 | } | ||
187 | |||
188 | void write_nic_word(struct net_device *dev, int x, u16 y) | ||
189 | { | ||
190 | writew(y, (u8 __iomem *)dev->mem_start + x); | ||
191 | udelay(20); | ||
192 | } | ||
193 | |||
194 | inline void force_pci_posting(struct net_device *dev) | ||
195 | { | ||
196 | read_nic_byte(dev, EPROM_CMD); | ||
197 | mb(); | ||
198 | } | ||
199 | |||
200 | static irqreturn_t rtl8180_interrupt(int irq, void *netdev); | ||
201 | void set_nic_rxring(struct net_device *dev); | ||
202 | void set_nic_txring(struct net_device *dev); | ||
203 | static struct net_device_stats *rtl8180_stats(struct net_device *dev); | ||
204 | void rtl8180_commit(struct net_device *dev); | ||
205 | void rtl8180_start_tx_beacon(struct net_device *dev); | ||
206 | |||
207 | static struct proc_dir_entry *rtl8180_proc; | ||
208 | |||
209 | static int proc_get_registers(struct seq_file *m, void *v) | ||
210 | { | ||
211 | struct net_device *dev = m->private; | ||
212 | int i, n, max = 0xff; | ||
213 | |||
214 | /* This dump the current register page */ | ||
215 | for (n = 0; n <= max;) { | ||
216 | seq_printf(m, "\nD: %2x > ", n); | ||
217 | |||
218 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
219 | seq_printf(m, "%2x ", read_nic_byte(dev, n)); | ||
220 | } | ||
221 | seq_putc(m, '\n'); | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | int get_curr_tx_free_desc(struct net_device *dev, int priority); | ||
226 | |||
227 | static int proc_get_stats_hw(struct seq_file *m, void *v) | ||
228 | { | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static int proc_get_stats_rx(struct seq_file *m, void *v) | ||
233 | { | ||
234 | struct net_device *dev = m->private; | ||
235 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
236 | |||
237 | seq_printf(m, | ||
238 | "RX OK: %lu\n" | ||
239 | "RX Retry: %lu\n" | ||
240 | "RX CRC Error(0-500): %lu\n" | ||
241 | "RX CRC Error(500-1000): %lu\n" | ||
242 | "RX CRC Error(>1000): %lu\n" | ||
243 | "RX ICV Error: %lu\n", | ||
244 | priv->stats.rxint, | ||
245 | priv->stats.rxerr, | ||
246 | priv->stats.rxcrcerrmin, | ||
247 | priv->stats.rxcrcerrmid, | ||
248 | priv->stats.rxcrcerrmax, | ||
249 | priv->stats.rxicverr | ||
250 | ); | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int proc_get_stats_tx(struct seq_file *m, void *v) | ||
256 | { | ||
257 | struct net_device *dev = m->private; | ||
258 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
259 | unsigned long totalOK; | ||
260 | |||
261 | totalOK = priv->stats.txnpokint + priv->stats.txhpokint + | ||
262 | priv->stats.txlpokint; | ||
263 | |||
264 | seq_printf(m, | ||
265 | "TX OK: %lu\n" | ||
266 | "TX Error: %lu\n" | ||
267 | "TX Retry: %lu\n" | ||
268 | "TX beacon OK: %lu\n" | ||
269 | "TX beacon error: %lu\n", | ||
270 | totalOK, | ||
271 | priv->stats.txnperr+priv->stats.txhperr+priv->stats.txlperr, | ||
272 | priv->stats.txretry, | ||
273 | priv->stats.txbeacon, | ||
274 | priv->stats.txbeaconerr | ||
275 | ); | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | static void rtl8180_proc_module_init(void) | ||
281 | { | ||
282 | DMESG("Initializing proc filesystem"); | ||
283 | rtl8180_proc = proc_mkdir(RTL8180_MODULE_NAME, init_net.proc_net); | ||
284 | } | ||
285 | |||
286 | static void rtl8180_proc_module_remove(void) | ||
287 | { | ||
288 | remove_proc_entry(RTL8180_MODULE_NAME, init_net.proc_net); | ||
289 | } | ||
290 | |||
291 | static void rtl8180_proc_remove_one(struct net_device *dev) | ||
292 | { | ||
293 | remove_proc_subtree(dev->name, rtl8180_proc); | ||
294 | } | ||
295 | |||
296 | /* | ||
297 | * seq_file wrappers for procfile show routines. | ||
298 | */ | ||
299 | static int rtl8180_proc_open(struct inode *inode, struct file *file) | ||
300 | { | ||
301 | struct net_device *dev = proc_get_parent_data(inode); | ||
302 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
303 | |||
304 | return single_open(file, show, dev); | ||
305 | } | ||
306 | |||
307 | static const struct file_operations rtl8180_proc_fops = { | ||
308 | .open = rtl8180_proc_open, | ||
309 | .read = seq_read, | ||
310 | .llseek = seq_lseek, | ||
311 | .release = single_release, | ||
312 | }; | ||
313 | |||
314 | /* | ||
315 | * Table of proc files we need to create. | ||
316 | */ | ||
317 | struct rtl8180_proc_file { | ||
318 | char name[12]; | ||
319 | int (*show)(struct seq_file *, void *); | ||
320 | }; | ||
321 | |||
322 | static const struct rtl8180_proc_file rtl8180_proc_files[] = { | ||
323 | { "stats-hw", &proc_get_stats_hw }, | ||
324 | { "stats-rx", &proc_get_stats_rx }, | ||
325 | { "stats-tx", &proc_get_stats_tx }, | ||
326 | { "registers", &proc_get_registers }, | ||
327 | { "" } | ||
328 | }; | ||
329 | |||
330 | static void rtl8180_proc_init_one(struct net_device *dev) | ||
331 | { | ||
332 | const struct rtl8180_proc_file *f; | ||
333 | struct proc_dir_entry *dir; | ||
334 | |||
335 | dir = proc_mkdir_data(dev->name, 0, rtl8180_proc, dev); | ||
336 | if (!dir) { | ||
337 | DMESGE("Unable to initialize /proc/net/r8180/%s\n", dev->name); | ||
338 | return; | ||
339 | } | ||
340 | |||
341 | for (f = rtl8180_proc_files; f->name[0]; f++) { | ||
342 | if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, | ||
343 | &rtl8180_proc_fops, f->show)) { | ||
344 | DMESGE("Unable to initialize /proc/net/r8180/%s/%s\n", | ||
345 | dev->name, f->name); | ||
346 | return; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * FIXME: check if we can use some standard already-existent | ||
353 | * data type+functions in kernel. | ||
354 | */ | ||
355 | |||
356 | static short buffer_add(struct buffer **buffer, u32 *buf, dma_addr_t dma, | ||
357 | struct buffer **bufferhead) | ||
358 | { | ||
359 | struct buffer *tmp; | ||
360 | |||
361 | if (!*buffer) { | ||
362 | |||
363 | *buffer = kmalloc(sizeof(struct buffer), GFP_KERNEL); | ||
364 | |||
365 | if (*buffer == NULL) { | ||
366 | DMESGE("Failed to kmalloc head of TX/RX struct"); | ||
367 | return -1; | ||
368 | } | ||
369 | (*buffer)->next = *buffer; | ||
370 | (*buffer)->buf = buf; | ||
371 | (*buffer)->dma = dma; | ||
372 | if (bufferhead != NULL) | ||
373 | (*bufferhead) = (*buffer); | ||
374 | return 0; | ||
375 | } | ||
376 | tmp = *buffer; | ||
377 | |||
378 | while (tmp->next != (*buffer)) | ||
379 | tmp = tmp->next; | ||
380 | tmp->next = kmalloc(sizeof(struct buffer), GFP_KERNEL); | ||
381 | if (tmp->next == NULL) { | ||
382 | DMESGE("Failed to kmalloc TX/RX struct"); | ||
383 | return -1; | ||
384 | } | ||
385 | tmp->next->buf = buf; | ||
386 | tmp->next->dma = dma; | ||
387 | tmp->next->next = *buffer; | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static void buffer_free(struct net_device *dev, struct buffer **buffer, int len, | ||
393 | short consistent) | ||
394 | { | ||
395 | |||
396 | struct buffer *tmp, *next; | ||
397 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
398 | struct pci_dev *pdev = priv->pdev; | ||
399 | |||
400 | if (!*buffer) | ||
401 | return; | ||
402 | |||
403 | tmp = *buffer; | ||
404 | |||
405 | do { | ||
406 | next = tmp->next; | ||
407 | if (consistent) { | ||
408 | pci_free_consistent(pdev, len, | ||
409 | tmp->buf, tmp->dma); | ||
410 | } else { | ||
411 | pci_unmap_single(pdev, tmp->dma, | ||
412 | len, PCI_DMA_FROMDEVICE); | ||
413 | kfree(tmp->buf); | ||
414 | } | ||
415 | kfree(tmp); | ||
416 | tmp = next; | ||
417 | } while (next != *buffer); | ||
418 | |||
419 | *buffer = NULL; | ||
420 | } | ||
421 | |||
422 | int get_curr_tx_free_desc(struct net_device *dev, int priority) | ||
423 | { | ||
424 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
425 | u32 *tail; | ||
426 | u32 *head; | ||
427 | int ret; | ||
428 | |||
429 | switch (priority) { | ||
430 | case MANAGE_PRIORITY: | ||
431 | head = priv->txmapringhead; | ||
432 | tail = priv->txmapringtail; | ||
433 | break; | ||
434 | case BK_PRIORITY: | ||
435 | head = priv->txbkpringhead; | ||
436 | tail = priv->txbkpringtail; | ||
437 | break; | ||
438 | case BE_PRIORITY: | ||
439 | head = priv->txbepringhead; | ||
440 | tail = priv->txbepringtail; | ||
441 | break; | ||
442 | case VI_PRIORITY: | ||
443 | head = priv->txvipringhead; | ||
444 | tail = priv->txvipringtail; | ||
445 | break; | ||
446 | case VO_PRIORITY: | ||
447 | head = priv->txvopringhead; | ||
448 | tail = priv->txvopringtail; | ||
449 | break; | ||
450 | case HI_PRIORITY: | ||
451 | head = priv->txhpringhead; | ||
452 | tail = priv->txhpringtail; | ||
453 | break; | ||
454 | default: | ||
455 | return -1; | ||
456 | } | ||
457 | |||
458 | if (head <= tail) | ||
459 | ret = priv->txringcount - (tail - head)/8; | ||
460 | else | ||
461 | ret = (head - tail)/8; | ||
462 | |||
463 | if (ret > priv->txringcount) | ||
464 | DMESG("BUG"); | ||
465 | |||
466 | return ret; | ||
467 | } | ||
468 | |||
469 | static short check_nic_enought_desc(struct net_device *dev, int priority) | ||
470 | { | ||
471 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
472 | struct ieee80211_device *ieee = netdev_priv(dev); | ||
473 | int requiredbyte; | ||
474 | int required; | ||
475 | |||
476 | requiredbyte = priv->ieee80211->fts + | ||
477 | sizeof(struct ieee80211_header_data); | ||
478 | |||
479 | if (ieee->current_network.QoS_Enable) | ||
480 | requiredbyte += 2; | ||
481 | |||
482 | required = requiredbyte / (priv->txbuffsize-4); | ||
483 | |||
484 | if (requiredbyte % priv->txbuffsize) | ||
485 | required++; | ||
486 | |||
487 | /* for now we keep two free descriptor as a safety boundary | ||
488 | * between the tail and the head | ||
489 | */ | ||
490 | |||
491 | return required + 2 < get_curr_tx_free_desc(dev, priority); | ||
492 | } | ||
493 | |||
494 | void fix_tx_fifo(struct net_device *dev) | ||
495 | { | ||
496 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
497 | u32 *tmp; | ||
498 | int i; | ||
499 | |||
500 | for (tmp = priv->txmapring, i = 0; | ||
501 | i < priv->txringcount; | ||
502 | tmp += 8, i++) { | ||
503 | *tmp = *tmp & ~(1<<31); | ||
504 | } | ||
505 | |||
506 | for (tmp = priv->txbkpring, i = 0; | ||
507 | i < priv->txringcount; | ||
508 | tmp += 8, i++) { | ||
509 | *tmp = *tmp & ~(1<<31); | ||
510 | } | ||
511 | |||
512 | for (tmp = priv->txbepring, i = 0; | ||
513 | i < priv->txringcount; | ||
514 | tmp += 8, i++) { | ||
515 | *tmp = *tmp & ~(1<<31); | ||
516 | } | ||
517 | for (tmp = priv->txvipring, i = 0; | ||
518 | i < priv->txringcount; | ||
519 | tmp += 8, i++) { | ||
520 | *tmp = *tmp & ~(1<<31); | ||
521 | } | ||
522 | |||
523 | for (tmp = priv->txvopring, i = 0; | ||
524 | i < priv->txringcount; | ||
525 | tmp += 8, i++) { | ||
526 | *tmp = *tmp & ~(1<<31); | ||
527 | } | ||
528 | |||
529 | for (tmp = priv->txhpring, i = 0; | ||
530 | i < priv->txringcount; | ||
531 | tmp += 8, i++) { | ||
532 | *tmp = *tmp & ~(1<<31); | ||
533 | } | ||
534 | |||
535 | for (tmp = priv->txbeaconring, i = 0; | ||
536 | i < priv->txbeaconcount; | ||
537 | tmp += 8, i++) { | ||
538 | *tmp = *tmp & ~(1<<31); | ||
539 | } | ||
540 | |||
541 | priv->txmapringtail = priv->txmapring; | ||
542 | priv->txmapringhead = priv->txmapring; | ||
543 | priv->txmapbufstail = priv->txmapbufs; | ||
544 | |||
545 | priv->txbkpringtail = priv->txbkpring; | ||
546 | priv->txbkpringhead = priv->txbkpring; | ||
547 | priv->txbkpbufstail = priv->txbkpbufs; | ||
548 | |||
549 | priv->txbepringtail = priv->txbepring; | ||
550 | priv->txbepringhead = priv->txbepring; | ||
551 | priv->txbepbufstail = priv->txbepbufs; | ||
552 | |||
553 | priv->txvipringtail = priv->txvipring; | ||
554 | priv->txvipringhead = priv->txvipring; | ||
555 | priv->txvipbufstail = priv->txvipbufs; | ||
556 | |||
557 | priv->txvopringtail = priv->txvopring; | ||
558 | priv->txvopringhead = priv->txvopring; | ||
559 | priv->txvopbufstail = priv->txvopbufs; | ||
560 | |||
561 | priv->txhpringtail = priv->txhpring; | ||
562 | priv->txhpringhead = priv->txhpring; | ||
563 | priv->txhpbufstail = priv->txhpbufs; | ||
564 | |||
565 | priv->txbeaconringtail = priv->txbeaconring; | ||
566 | priv->txbeaconbufstail = priv->txbeaconbufs; | ||
567 | set_nic_txring(dev); | ||
568 | |||
569 | ieee80211_reset_queue(priv->ieee80211); | ||
570 | priv->ack_tx_to_ieee = 0; | ||
571 | } | ||
572 | |||
573 | void fix_rx_fifo(struct net_device *dev) | ||
574 | { | ||
575 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
576 | u32 *tmp; | ||
577 | struct buffer *rxbuf; | ||
578 | u8 rx_desc_size; | ||
579 | |||
580 | rx_desc_size = 8; /* 4*8 = 32 bytes */ | ||
581 | |||
582 | for (tmp = priv->rxring, rxbuf = priv->rxbufferhead; | ||
583 | (tmp < (priv->rxring)+(priv->rxringcount)*rx_desc_size); | ||
584 | tmp += rx_desc_size, rxbuf = rxbuf->next) { | ||
585 | *(tmp+2) = rxbuf->dma; | ||
586 | *tmp = *tmp & ~0xfff; | ||
587 | *tmp = *tmp | priv->rxbuffersize; | ||
588 | *tmp |= (1<<31); | ||
589 | } | ||
590 | |||
591 | priv->rxringtail = priv->rxring; | ||
592 | priv->rxbuffer = priv->rxbufferhead; | ||
593 | priv->rx_skb_complete = 1; | ||
594 | set_nic_rxring(dev); | ||
595 | } | ||
596 | |||
597 | static void rtl8180_irq_disable(struct net_device *dev) | ||
598 | { | ||
599 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
600 | |||
601 | write_nic_dword(dev, IMR, 0); | ||
602 | force_pci_posting(dev); | ||
603 | priv->irq_enabled = 0; | ||
604 | } | ||
605 | |||
606 | void rtl8180_set_mode(struct net_device *dev, int mode) | ||
607 | { | ||
608 | u8 ecmd; | ||
609 | |||
610 | ecmd = read_nic_byte(dev, EPROM_CMD); | ||
611 | ecmd = ecmd & ~EPROM_CMD_OPERATING_MODE_MASK; | ||
612 | ecmd = ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT); | ||
613 | ecmd = ecmd & ~(1<<EPROM_CS_SHIFT); | ||
614 | ecmd = ecmd & ~(1<<EPROM_CK_SHIFT); | ||
615 | write_nic_byte(dev, EPROM_CMD, ecmd); | ||
616 | } | ||
617 | |||
618 | void rtl8180_beacon_tx_enable(struct net_device *dev); | ||
619 | |||
620 | void rtl8180_update_msr(struct net_device *dev) | ||
621 | { | ||
622 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
623 | u8 msr; | ||
624 | u32 rxconf; | ||
625 | |||
626 | msr = read_nic_byte(dev, MSR); | ||
627 | msr &= ~MSR_LINK_MASK; | ||
628 | |||
629 | rxconf = read_nic_dword(dev, RX_CONF); | ||
630 | |||
631 | if (priv->ieee80211->state == IEEE80211_LINKED) { | ||
632 | if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) | ||
633 | msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT); | ||
634 | else if (priv->ieee80211->iw_mode == IW_MODE_MASTER) | ||
635 | msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT); | ||
636 | else if (priv->ieee80211->iw_mode == IW_MODE_INFRA) | ||
637 | msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT); | ||
638 | else | ||
639 | msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); | ||
640 | rxconf |= (1<<RX_CHECK_BSSID_SHIFT); | ||
641 | |||
642 | } else { | ||
643 | msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); | ||
644 | rxconf &= ~(1<<RX_CHECK_BSSID_SHIFT); | ||
645 | } | ||
646 | |||
647 | write_nic_byte(dev, MSR, msr); | ||
648 | write_nic_dword(dev, RX_CONF, rxconf); | ||
649 | } | ||
650 | |||
651 | void rtl8180_set_chan(struct net_device *dev, short ch) | ||
652 | { | ||
653 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
654 | |||
655 | if ((ch > 14) || (ch < 1)) { | ||
656 | netdev_err(dev, "In %s: Invalid channel %d\n", __func__, ch); | ||
657 | return; | ||
658 | } | ||
659 | |||
660 | priv->chan = ch; | ||
661 | priv->rf_set_chan(dev, priv->chan); | ||
662 | } | ||
663 | |||
664 | void set_nic_txring(struct net_device *dev) | ||
665 | { | ||
666 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
667 | |||
668 | write_nic_dword(dev, TX_MANAGEPRIORITY_RING_ADDR, priv->txmapringdma); | ||
669 | write_nic_dword(dev, TX_BKPRIORITY_RING_ADDR, priv->txbkpringdma); | ||
670 | write_nic_dword(dev, TX_BEPRIORITY_RING_ADDR, priv->txbepringdma); | ||
671 | write_nic_dword(dev, TX_VIPRIORITY_RING_ADDR, priv->txvipringdma); | ||
672 | write_nic_dword(dev, TX_VOPRIORITY_RING_ADDR, priv->txvopringdma); | ||
673 | write_nic_dword(dev, TX_HIGHPRIORITY_RING_ADDR, priv->txhpringdma); | ||
674 | write_nic_dword(dev, TX_BEACON_RING_ADDR, priv->txbeaconringdma); | ||
675 | } | ||
676 | |||
677 | void rtl8180_beacon_tx_enable(struct net_device *dev) | ||
678 | { | ||
679 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
680 | |||
681 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
682 | priv->dma_poll_stop_mask &= ~(TPPOLLSTOP_BQ); | ||
683 | write_nic_byte(dev, TPPollStop, priv->dma_poll_mask); | ||
684 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
685 | } | ||
686 | |||
687 | void rtl8180_beacon_tx_disable(struct net_device *dev) | ||
688 | { | ||
689 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
690 | |||
691 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
692 | priv->dma_poll_stop_mask |= TPPOLLSTOP_BQ; | ||
693 | write_nic_byte(dev, TPPollStop, priv->dma_poll_stop_mask); | ||
694 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
695 | |||
696 | } | ||
697 | |||
698 | void rtl8180_rtx_disable(struct net_device *dev) | ||
699 | { | ||
700 | u8 cmd; | ||
701 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
702 | |||
703 | cmd = read_nic_byte(dev, CMD); | ||
704 | write_nic_byte(dev, CMD, cmd & | ||
705 | ~((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT))); | ||
706 | force_pci_posting(dev); | ||
707 | mdelay(10); | ||
708 | |||
709 | if (!priv->rx_skb_complete) | ||
710 | dev_kfree_skb_any(priv->rx_skb); | ||
711 | } | ||
712 | |||
713 | static short alloc_tx_desc_ring(struct net_device *dev, int bufsize, int count, | ||
714 | int addr) | ||
715 | { | ||
716 | int i; | ||
717 | u32 *desc; | ||
718 | u32 *tmp; | ||
719 | dma_addr_t dma_desc, dma_tmp; | ||
720 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
721 | struct pci_dev *pdev = priv->pdev; | ||
722 | void *buf; | ||
723 | |||
724 | if ((bufsize & 0xfff) != bufsize) { | ||
725 | DMESGE("TX buffer allocation too large"); | ||
726 | return 0; | ||
727 | } | ||
728 | desc = (u32 *)pci_alloc_consistent(pdev, | ||
729 | sizeof(u32)*8*count+256, &dma_desc); | ||
730 | if (desc == NULL) | ||
731 | return -1; | ||
732 | |||
733 | if (dma_desc & 0xff) | ||
734 | /* | ||
735 | * descriptor's buffer must be 256 byte aligned | ||
736 | * we shouldn't be here, since we set DMA mask ! | ||
737 | */ | ||
738 | WARN(1, "DMA buffer is not aligned\n"); | ||
739 | |||
740 | tmp = desc; | ||
741 | |||
742 | for (i = 0; i < count; i++) { | ||
743 | buf = (void *)pci_alloc_consistent(pdev, bufsize, &dma_tmp); | ||
744 | if (buf == NULL) | ||
745 | return -ENOMEM; | ||
746 | |||
747 | switch (addr) { | ||
748 | case TX_MANAGEPRIORITY_RING_ADDR: | ||
749 | if (-1 == buffer_add(&priv->txmapbufs, | ||
750 | buf, dma_tmp, NULL)) { | ||
751 | DMESGE("Unable to allocate mem for buffer NP"); | ||
752 | return -ENOMEM; | ||
753 | } | ||
754 | break; | ||
755 | case TX_BKPRIORITY_RING_ADDR: | ||
756 | if (-1 == buffer_add(&priv->txbkpbufs, | ||
757 | buf, dma_tmp, NULL)) { | ||
758 | DMESGE("Unable to allocate mem for buffer LP"); | ||
759 | return -ENOMEM; | ||
760 | } | ||
761 | break; | ||
762 | case TX_BEPRIORITY_RING_ADDR: | ||
763 | if (-1 == buffer_add(&priv->txbepbufs, | ||
764 | buf, dma_tmp, NULL)) { | ||
765 | DMESGE("Unable to allocate mem for buffer NP"); | ||
766 | return -ENOMEM; | ||
767 | } | ||
768 | break; | ||
769 | case TX_VIPRIORITY_RING_ADDR: | ||
770 | if (-1 == buffer_add(&priv->txvipbufs, | ||
771 | buf, dma_tmp, NULL)) { | ||
772 | DMESGE("Unable to allocate mem for buffer LP"); | ||
773 | return -ENOMEM; | ||
774 | } | ||
775 | break; | ||
776 | case TX_VOPRIORITY_RING_ADDR: | ||
777 | if (-1 == buffer_add(&priv->txvopbufs, | ||
778 | buf, dma_tmp, NULL)) { | ||
779 | DMESGE("Unable to allocate mem for buffer NP"); | ||
780 | return -ENOMEM; | ||
781 | } | ||
782 | break; | ||
783 | case TX_HIGHPRIORITY_RING_ADDR: | ||
784 | if (-1 == buffer_add(&priv->txhpbufs, | ||
785 | buf, dma_tmp, NULL)) { | ||
786 | DMESGE("Unable to allocate mem for buffer HP"); | ||
787 | return -ENOMEM; | ||
788 | } | ||
789 | break; | ||
790 | case TX_BEACON_RING_ADDR: | ||
791 | if (-1 == buffer_add(&priv->txbeaconbufs, | ||
792 | buf, dma_tmp, NULL)) { | ||
793 | DMESGE("Unable to allocate mem for buffer BP"); | ||
794 | return -ENOMEM; | ||
795 | } | ||
796 | break; | ||
797 | } | ||
798 | *tmp = *tmp & ~(1<<31); /* descriptor empty, owned by the drv */ | ||
799 | *(tmp+2) = (u32)dma_tmp; | ||
800 | *(tmp+3) = bufsize; | ||
801 | |||
802 | if (i+1 < count) | ||
803 | *(tmp+4) = (u32)dma_desc+((i+1)*8*4); | ||
804 | else | ||
805 | *(tmp+4) = (u32)dma_desc; | ||
806 | |||
807 | tmp = tmp+8; | ||
808 | } | ||
809 | |||
810 | switch (addr) { | ||
811 | case TX_MANAGEPRIORITY_RING_ADDR: | ||
812 | priv->txmapringdma = dma_desc; | ||
813 | priv->txmapring = desc; | ||
814 | break; | ||
815 | case TX_BKPRIORITY_RING_ADDR: | ||
816 | priv->txbkpringdma = dma_desc; | ||
817 | priv->txbkpring = desc; | ||
818 | break; | ||
819 | case TX_BEPRIORITY_RING_ADDR: | ||
820 | priv->txbepringdma = dma_desc; | ||
821 | priv->txbepring = desc; | ||
822 | break; | ||
823 | case TX_VIPRIORITY_RING_ADDR: | ||
824 | priv->txvipringdma = dma_desc; | ||
825 | priv->txvipring = desc; | ||
826 | break; | ||
827 | case TX_VOPRIORITY_RING_ADDR: | ||
828 | priv->txvopringdma = dma_desc; | ||
829 | priv->txvopring = desc; | ||
830 | break; | ||
831 | case TX_HIGHPRIORITY_RING_ADDR: | ||
832 | priv->txhpringdma = dma_desc; | ||
833 | priv->txhpring = desc; | ||
834 | break; | ||
835 | case TX_BEACON_RING_ADDR: | ||
836 | priv->txbeaconringdma = dma_desc; | ||
837 | priv->txbeaconring = desc; | ||
838 | break; | ||
839 | |||
840 | } | ||
841 | |||
842 | return 0; | ||
843 | } | ||
844 | |||
845 | static void free_tx_desc_rings(struct net_device *dev) | ||
846 | { | ||
847 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
848 | struct pci_dev *pdev = priv->pdev; | ||
849 | int count = priv->txringcount; | ||
850 | |||
851 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
852 | priv->txmapring, priv->txmapringdma); | ||
853 | buffer_free(dev, &(priv->txmapbufs), priv->txbuffsize, 1); | ||
854 | |||
855 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
856 | priv->txbkpring, priv->txbkpringdma); | ||
857 | buffer_free(dev, &(priv->txbkpbufs), priv->txbuffsize, 1); | ||
858 | |||
859 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
860 | priv->txbepring, priv->txbepringdma); | ||
861 | buffer_free(dev, &(priv->txbepbufs), priv->txbuffsize, 1); | ||
862 | |||
863 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
864 | priv->txvipring, priv->txvipringdma); | ||
865 | buffer_free(dev, &(priv->txvipbufs), priv->txbuffsize, 1); | ||
866 | |||
867 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
868 | priv->txvopring, priv->txvopringdma); | ||
869 | buffer_free(dev, &(priv->txvopbufs), priv->txbuffsize, 1); | ||
870 | |||
871 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
872 | priv->txhpring, priv->txhpringdma); | ||
873 | buffer_free(dev, &(priv->txhpbufs), priv->txbuffsize, 1); | ||
874 | |||
875 | count = priv->txbeaconcount; | ||
876 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
877 | priv->txbeaconring, priv->txbeaconringdma); | ||
878 | buffer_free(dev, &(priv->txbeaconbufs), priv->txbuffsize, 1); | ||
879 | } | ||
880 | |||
881 | static void free_rx_desc_ring(struct net_device *dev) | ||
882 | { | ||
883 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
884 | struct pci_dev *pdev = priv->pdev; | ||
885 | int count = priv->rxringcount; | ||
886 | |||
887 | pci_free_consistent(pdev, sizeof(u32)*8*count+256, | ||
888 | priv->rxring, priv->rxringdma); | ||
889 | |||
890 | buffer_free(dev, &(priv->rxbuffer), priv->rxbuffersize, 0); | ||
891 | } | ||
892 | |||
893 | static short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count) | ||
894 | { | ||
895 | int i; | ||
896 | u32 *desc; | ||
897 | u32 *tmp; | ||
898 | dma_addr_t dma_desc, dma_tmp; | ||
899 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
900 | struct pci_dev *pdev = priv->pdev; | ||
901 | void *buf; | ||
902 | u8 rx_desc_size; | ||
903 | |||
904 | rx_desc_size = 8; /* 4*8 = 32 bytes */ | ||
905 | |||
906 | if ((bufsize & 0xfff) != bufsize) { | ||
907 | DMESGE("RX buffer allocation too large"); | ||
908 | return -1; | ||
909 | } | ||
910 | |||
911 | desc = (u32 *)pci_alloc_consistent(pdev, | ||
912 | sizeof(u32) * rx_desc_size * count + 256, &dma_desc); | ||
913 | |||
914 | if (dma_desc & 0xff) | ||
915 | /* | ||
916 | * descriptor's buffer must be 256 byte aligned | ||
917 | * should never happen since we specify the DMA mask | ||
918 | */ | ||
919 | WARN(1, "DMA buffer is not aligned\n"); | ||
920 | |||
921 | priv->rxring = desc; | ||
922 | priv->rxringdma = dma_desc; | ||
923 | tmp = desc; | ||
924 | |||
925 | for (i = 0; i < count; i++) { | ||
926 | buf = kmalloc(bufsize * sizeof(u8), GFP_ATOMIC); | ||
927 | if (buf == NULL) { | ||
928 | DMESGE("Failed to kmalloc RX buffer"); | ||
929 | return -1; | ||
930 | } | ||
931 | |||
932 | dma_tmp = pci_map_single(pdev, buf, bufsize * sizeof(u8), | ||
933 | PCI_DMA_FROMDEVICE); | ||
934 | if (pci_dma_mapping_error(pdev, dma_tmp)) | ||
935 | return -1; | ||
936 | if (-1 == buffer_add(&(priv->rxbuffer), buf, dma_tmp, | ||
937 | &(priv->rxbufferhead))) { | ||
938 | DMESGE("Unable to allocate mem RX buf"); | ||
939 | return -1; | ||
940 | } | ||
941 | *tmp = 0; /* zero pads the header of the descriptor */ | ||
942 | *tmp = *tmp | (bufsize&0xfff); | ||
943 | *(tmp+2) = (u32)dma_tmp; | ||
944 | *tmp = *tmp | (1<<31); /* descriptor void, owned by the NIC */ | ||
945 | |||
946 | tmp = tmp+rx_desc_size; | ||
947 | } | ||
948 | |||
949 | /* this is the last descriptor */ | ||
950 | *(tmp - rx_desc_size) = *(tmp - rx_desc_size) | (1 << 30); | ||
951 | |||
952 | return 0; | ||
953 | } | ||
954 | |||
955 | |||
956 | void set_nic_rxring(struct net_device *dev) | ||
957 | { | ||
958 | u8 pgreg; | ||
959 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
960 | |||
961 | pgreg = read_nic_byte(dev, PGSELECT); | ||
962 | write_nic_byte(dev, PGSELECT, pgreg & ~(1<<PGSELECT_PG_SHIFT)); | ||
963 | |||
964 | write_nic_dword(dev, RXRING_ADDR, priv->rxringdma); | ||
965 | } | ||
966 | |||
967 | void rtl8180_reset(struct net_device *dev) | ||
968 | { | ||
969 | u8 cr; | ||
970 | |||
971 | rtl8180_irq_disable(dev); | ||
972 | |||
973 | cr = read_nic_byte(dev, CMD); | ||
974 | cr = cr & 2; | ||
975 | cr = cr | (1<<CMD_RST_SHIFT); | ||
976 | write_nic_byte(dev, CMD, cr); | ||
977 | |||
978 | force_pci_posting(dev); | ||
979 | |||
980 | mdelay(200); | ||
981 | |||
982 | if (read_nic_byte(dev, CMD) & (1<<CMD_RST_SHIFT)) | ||
983 | DMESGW("Card reset timeout!"); | ||
984 | else | ||
985 | DMESG("Card successfully reset"); | ||
986 | |||
987 | rtl8180_set_mode(dev, EPROM_CMD_LOAD); | ||
988 | force_pci_posting(dev); | ||
989 | mdelay(200); | ||
990 | } | ||
991 | |||
992 | inline u16 ieeerate2rtlrate(int rate) | ||
993 | { | ||
994 | switch (rate) { | ||
995 | case 10: | ||
996 | return 0; | ||
997 | case 20: | ||
998 | return 1; | ||
999 | case 55: | ||
1000 | return 2; | ||
1001 | case 110: | ||
1002 | return 3; | ||
1003 | case 60: | ||
1004 | return 4; | ||
1005 | case 90: | ||
1006 | return 5; | ||
1007 | case 120: | ||
1008 | return 6; | ||
1009 | case 180: | ||
1010 | return 7; | ||
1011 | case 240: | ||
1012 | return 8; | ||
1013 | case 360: | ||
1014 | return 9; | ||
1015 | case 480: | ||
1016 | return 10; | ||
1017 | case 540: | ||
1018 | return 11; | ||
1019 | default: | ||
1020 | return 3; | ||
1021 | } | ||
1022 | } | ||
1023 | |||
1024 | static u16 rtl_rate[] = {10, 20, 55, 110, 60, | ||
1025 | 90, 120, 180, 240, 360, 480, 540, 720}; | ||
1026 | |||
1027 | inline u16 rtl8180_rate2rate(short rate) | ||
1028 | { | ||
1029 | if (rate > 12) | ||
1030 | return 10; | ||
1031 | return rtl_rate[rate]; | ||
1032 | } | ||
1033 | |||
1034 | inline u8 rtl8180_IsWirelessBMode(u16 rate) | ||
1035 | { | ||
1036 | if (((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220)) | ||
1037 | return 1; | ||
1038 | else | ||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1042 | u16 N_DBPSOfRate(u16 DataRate); | ||
1043 | |||
1044 | static u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame, | ||
1045 | u8 bShortPreamble) | ||
1046 | { | ||
1047 | u16 FrameTime; | ||
1048 | u16 N_DBPS; | ||
1049 | u16 Ceiling; | ||
1050 | |||
1051 | if (rtl8180_IsWirelessBMode(DataRate)) { | ||
1052 | if (bManagementFrame || !bShortPreamble || DataRate == 10) | ||
1053 | /* long preamble */ | ||
1054 | FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10))); | ||
1055 | else | ||
1056 | /* short preamble */ | ||
1057 | FrameTime = (u16)(72+24+(FrameLength*8/(DataRate/10))); | ||
1058 | |||
1059 | if ((FrameLength*8 % (DataRate/10)) != 0) /* get the ceilling */ | ||
1060 | FrameTime++; | ||
1061 | } else { /* 802.11g DSSS-OFDM PLCP length field calculation. */ | ||
1062 | N_DBPS = N_DBPSOfRate(DataRate); | ||
1063 | Ceiling = (16 + 8*FrameLength + 6) / N_DBPS | ||
1064 | + (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0); | ||
1065 | FrameTime = (u16)(16 + 4 + 4*Ceiling + 6); | ||
1066 | } | ||
1067 | return FrameTime; | ||
1068 | } | ||
1069 | |||
1070 | u16 N_DBPSOfRate(u16 DataRate) | ||
1071 | { | ||
1072 | u16 N_DBPS = 24; | ||
1073 | |||
1074 | switch (DataRate) { | ||
1075 | case 60: | ||
1076 | N_DBPS = 24; | ||
1077 | break; | ||
1078 | case 90: | ||
1079 | N_DBPS = 36; | ||
1080 | break; | ||
1081 | case 120: | ||
1082 | N_DBPS = 48; | ||
1083 | break; | ||
1084 | case 180: | ||
1085 | N_DBPS = 72; | ||
1086 | break; | ||
1087 | case 240: | ||
1088 | N_DBPS = 96; | ||
1089 | break; | ||
1090 | case 360: | ||
1091 | N_DBPS = 144; | ||
1092 | break; | ||
1093 | case 480: | ||
1094 | N_DBPS = 192; | ||
1095 | break; | ||
1096 | case 540: | ||
1097 | N_DBPS = 216; | ||
1098 | break; | ||
1099 | default: | ||
1100 | break; | ||
1101 | } | ||
1102 | |||
1103 | return N_DBPS; | ||
1104 | } | ||
1105 | |||
1106 | /* | ||
1107 | * For Netgear case, they want good-looking signal strength. | ||
1108 | */ | ||
1109 | static long NetgearSignalStrengthTranslate(long LastSS, long CurrSS) | ||
1110 | { | ||
1111 | long RetSS; | ||
1112 | |||
1113 | /* Step 1. Scale mapping. */ | ||
1114 | if (CurrSS >= 71 && CurrSS <= 100) | ||
1115 | RetSS = 90 + ((CurrSS - 70) / 3); | ||
1116 | else if (CurrSS >= 41 && CurrSS <= 70) | ||
1117 | RetSS = 78 + ((CurrSS - 40) / 3); | ||
1118 | else if (CurrSS >= 31 && CurrSS <= 40) | ||
1119 | RetSS = 66 + (CurrSS - 30); | ||
1120 | else if (CurrSS >= 21 && CurrSS <= 30) | ||
1121 | RetSS = 54 + (CurrSS - 20); | ||
1122 | else if (CurrSS >= 5 && CurrSS <= 20) | ||
1123 | RetSS = 42 + (((CurrSS - 5) * 2) / 3); | ||
1124 | else if (CurrSS == 4) | ||
1125 | RetSS = 36; | ||
1126 | else if (CurrSS == 3) | ||
1127 | RetSS = 27; | ||
1128 | else if (CurrSS == 2) | ||
1129 | RetSS = 18; | ||
1130 | else if (CurrSS == 1) | ||
1131 | RetSS = 9; | ||
1132 | else | ||
1133 | RetSS = CurrSS; | ||
1134 | |||
1135 | /* Step 2. Smoothing. */ | ||
1136 | if (LastSS > 0) | ||
1137 | RetSS = ((LastSS * 5) + (RetSS) + 5) / 6; | ||
1138 | |||
1139 | return RetSS; | ||
1140 | } | ||
1141 | |||
1142 | /* | ||
1143 | * Translate 0-100 signal strength index into dBm. | ||
1144 | */ | ||
1145 | static long TranslateToDbm8185(u8 SignalStrengthIndex) | ||
1146 | { | ||
1147 | long SignalPower; | ||
1148 | |||
1149 | /* Translate to dBm (x=0.5y-95). */ | ||
1150 | SignalPower = (long)((SignalStrengthIndex + 1) >> 1); | ||
1151 | SignalPower -= 95; | ||
1152 | |||
1153 | return SignalPower; | ||
1154 | } | ||
1155 | |||
1156 | /* | ||
1157 | * Perform signal smoothing for dynamic mechanism. | ||
1158 | * This is different with PerformSignalSmoothing8185 in smoothing formula. | ||
1159 | * No dramatic adjustment is applied because dynamic mechanism need some | ||
1160 | * degree of correctness. Ported from 8187B. | ||
1161 | */ | ||
1162 | static void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv, | ||
1163 | bool bCckRate) | ||
1164 | { | ||
1165 | long smoothedSS; | ||
1166 | long smoothedRx; | ||
1167 | |||
1168 | /* Determine the current packet is CCK rate. */ | ||
1169 | priv->bCurCCKPkt = bCckRate; | ||
1170 | |||
1171 | smoothedSS = priv->SignalStrength * 10; | ||
1172 | |||
1173 | if (priv->UndecoratedSmoothedSS >= 0) | ||
1174 | smoothedSS = ((priv->UndecoratedSmoothedSS * 5) + | ||
1175 | smoothedSS) / 6; | ||
1176 | |||
1177 | priv->UndecoratedSmoothedSS = smoothedSS; | ||
1178 | |||
1179 | smoothedRx = ((priv->UndecoratedSmoothedRxPower * 50) + | ||
1180 | (priv->RxPower * 11)) / 60; | ||
1181 | |||
1182 | priv->UndecoratedSmoothedRxPower = smoothedRx; | ||
1183 | |||
1184 | if (bCckRate) | ||
1185 | priv->CurCCKRSSI = priv->RSSI; | ||
1186 | else | ||
1187 | priv->CurCCKRSSI = 0; | ||
1188 | } | ||
1189 | |||
1190 | |||
1191 | /* | ||
1192 | * This is rough RX isr handling routine | ||
1193 | */ | ||
1194 | static void rtl8180_rx(struct net_device *dev) | ||
1195 | { | ||
1196 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1197 | struct sk_buff *tmp_skb; | ||
1198 | short first, last; | ||
1199 | u32 len; | ||
1200 | int lastlen; | ||
1201 | unsigned char quality, signal; | ||
1202 | u8 rate; | ||
1203 | u32 *tmp, *tmp2; | ||
1204 | u8 rx_desc_size; | ||
1205 | u8 padding; | ||
1206 | char rxpower = 0; | ||
1207 | u32 RXAGC = 0; | ||
1208 | long RxAGC_dBm = 0; | ||
1209 | u8 LNA = 0, BB = 0; | ||
1210 | u8 LNA_gain[4] = {02, 17, 29, 39}; | ||
1211 | u8 Antenna = 0; | ||
1212 | struct ieee80211_hdr_4addr *hdr; | ||
1213 | u16 fc, type; | ||
1214 | u8 bHwError = 0, bCRC = 0, bICV = 0; | ||
1215 | bool bCckRate = false; | ||
1216 | u8 RSSI = 0; | ||
1217 | long SignalStrengthIndex = 0; | ||
1218 | struct ieee80211_rx_stats stats = { | ||
1219 | .signal = 0, | ||
1220 | .noise = -98, | ||
1221 | .rate = 0, | ||
1222 | .freq = IEEE80211_24GHZ_BAND, | ||
1223 | }; | ||
1224 | |||
1225 | stats.nic_type = NIC_8185B; | ||
1226 | rx_desc_size = 8; | ||
1227 | |||
1228 | if ((*(priv->rxringtail)) & (1<<31)) { | ||
1229 | /* we have got an RX int, but the descriptor. we are pointing | ||
1230 | * is empty. | ||
1231 | */ | ||
1232 | |||
1233 | priv->stats.rxnodata++; | ||
1234 | priv->ieee80211->stats.rx_errors++; | ||
1235 | |||
1236 | tmp2 = NULL; | ||
1237 | tmp = priv->rxringtail; | ||
1238 | do { | ||
1239 | if (tmp == priv->rxring) | ||
1240 | tmp = priv->rxring + (priv->rxringcount - 1) * | ||
1241 | rx_desc_size; | ||
1242 | else | ||
1243 | tmp -= rx_desc_size; | ||
1244 | |||
1245 | if (!(*tmp & (1<<31))) | ||
1246 | tmp2 = tmp; | ||
1247 | } while (tmp != priv->rxring); | ||
1248 | |||
1249 | if (tmp2) | ||
1250 | priv->rxringtail = tmp2; | ||
1251 | } | ||
1252 | |||
1253 | /* while there are filled descriptors */ | ||
1254 | while (!(*(priv->rxringtail) & (1<<31))) { | ||
1255 | if (*(priv->rxringtail) & (1<<26)) | ||
1256 | DMESGW("RX buffer overflow"); | ||
1257 | if (*(priv->rxringtail) & (1<<12)) | ||
1258 | priv->stats.rxicverr++; | ||
1259 | |||
1260 | if (*(priv->rxringtail) & (1<<27)) { | ||
1261 | priv->stats.rxdmafail++; | ||
1262 | goto drop; | ||
1263 | } | ||
1264 | |||
1265 | pci_dma_sync_single_for_cpu(priv->pdev, | ||
1266 | priv->rxbuffer->dma, | ||
1267 | priv->rxbuffersize * sizeof(u8), | ||
1268 | PCI_DMA_FROMDEVICE); | ||
1269 | |||
1270 | first = *(priv->rxringtail) & (1<<29) ? 1 : 0; | ||
1271 | if (first) | ||
1272 | priv->rx_prevlen = 0; | ||
1273 | |||
1274 | last = *(priv->rxringtail) & (1<<28) ? 1 : 0; | ||
1275 | if (last) { | ||
1276 | lastlen = ((*priv->rxringtail) & 0xfff); | ||
1277 | |||
1278 | /* if the last descriptor (that should tell us the total | ||
1279 | * packet len) tell us something less than the | ||
1280 | * descriptors len we had until now, then there is some | ||
1281 | * problem.. | ||
1282 | * workaround to prevent kernel panic | ||
1283 | */ | ||
1284 | if (lastlen < priv->rx_prevlen) | ||
1285 | len = 0; | ||
1286 | else | ||
1287 | len = lastlen-priv->rx_prevlen; | ||
1288 | |||
1289 | if (*(priv->rxringtail) & (1<<13)) { | ||
1290 | if ((*(priv->rxringtail) & 0xfff) < 500) | ||
1291 | priv->stats.rxcrcerrmin++; | ||
1292 | else if ((*(priv->rxringtail) & 0x0fff) > 1000) | ||
1293 | priv->stats.rxcrcerrmax++; | ||
1294 | else | ||
1295 | priv->stats.rxcrcerrmid++; | ||
1296 | |||
1297 | } | ||
1298 | |||
1299 | } else { | ||
1300 | len = priv->rxbuffersize; | ||
1301 | } | ||
1302 | |||
1303 | if (first && last) { | ||
1304 | padding = ((*(priv->rxringtail+3))&(0x04000000))>>26; | ||
1305 | } else if (first) { | ||
1306 | padding = ((*(priv->rxringtail+3))&(0x04000000))>>26; | ||
1307 | if (padding) | ||
1308 | len -= 2; | ||
1309 | } else { | ||
1310 | padding = 0; | ||
1311 | } | ||
1312 | padding = 0; | ||
1313 | priv->rx_prevlen += len; | ||
1314 | |||
1315 | if (priv->rx_prevlen > MAX_FRAG_THRESHOLD + 100) { | ||
1316 | /* HW is probably passing several buggy frames without | ||
1317 | * FD or LD flag set. | ||
1318 | * Throw this garbage away to prevent skb memory | ||
1319 | * exhausting | ||
1320 | */ | ||
1321 | if (!priv->rx_skb_complete) | ||
1322 | dev_kfree_skb_any(priv->rx_skb); | ||
1323 | priv->rx_skb_complete = 1; | ||
1324 | } | ||
1325 | |||
1326 | signal = (unsigned char)((*(priv->rxringtail + 3) & | ||
1327 | 0x00ff0000) >> 16); | ||
1328 | signal = (signal & 0xfe) >> 1; | ||
1329 | |||
1330 | quality = (unsigned char)((*(priv->rxringtail+3)) & (0xff)); | ||
1331 | |||
1332 | stats.mac_time[0] = *(priv->rxringtail+1); | ||
1333 | stats.mac_time[1] = *(priv->rxringtail+2); | ||
1334 | |||
1335 | rxpower = ((char)((*(priv->rxringtail + 4) & | ||
1336 | 0x00ff0000) >> 16)) / 2 - 42; | ||
1337 | |||
1338 | RSSI = ((u8)((*(priv->rxringtail + 3) & | ||
1339 | 0x0000ff00) >> 8)) & 0x7f; | ||
1340 | |||
1341 | rate = ((*(priv->rxringtail)) & | ||
1342 | ((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20; | ||
1343 | |||
1344 | stats.rate = rtl8180_rate2rate(rate); | ||
1345 | Antenna = (*(priv->rxringtail + 3) & 0x00008000) == 0 ? 0 : 1; | ||
1346 | if (!rtl8180_IsWirelessBMode(stats.rate)) { /* OFDM rate. */ | ||
1347 | RxAGC_dBm = rxpower+1; /* bias */ | ||
1348 | } else { /* CCK rate. */ | ||
1349 | RxAGC_dBm = signal; /* bit 0 discard */ | ||
1350 | |||
1351 | LNA = (u8) (RxAGC_dBm & 0x60) >> 5; /* bit 6~ bit 5 */ | ||
1352 | BB = (u8) (RxAGC_dBm & 0x1F); /* bit 4 ~ bit 0 */ | ||
1353 | |||
1354 | /* Pin_11b=-(LNA_gain+BB_gain) (dBm) */ | ||
1355 | RxAGC_dBm = -(LNA_gain[LNA] + (BB * 2)); | ||
1356 | |||
1357 | RxAGC_dBm += 4; /* bias */ | ||
1358 | } | ||
1359 | |||
1360 | if (RxAGC_dBm & 0x80) /* absolute value */ | ||
1361 | RXAGC = ~(RxAGC_dBm)+1; | ||
1362 | bCckRate = rtl8180_IsWirelessBMode(stats.rate); | ||
1363 | /* Translate RXAGC into 1-100. */ | ||
1364 | if (!rtl8180_IsWirelessBMode(stats.rate)) { /* OFDM rate. */ | ||
1365 | if (RXAGC > 90) | ||
1366 | RXAGC = 90; | ||
1367 | else if (RXAGC < 25) | ||
1368 | RXAGC = 25; | ||
1369 | RXAGC = (90-RXAGC)*100/65; | ||
1370 | } else { /* CCK rate. */ | ||
1371 | if (RXAGC > 95) | ||
1372 | RXAGC = 95; | ||
1373 | else if (RXAGC < 30) | ||
1374 | RXAGC = 30; | ||
1375 | RXAGC = (95-RXAGC)*100/65; | ||
1376 | } | ||
1377 | priv->SignalStrength = (u8)RXAGC; | ||
1378 | priv->RecvSignalPower = RxAGC_dBm; | ||
1379 | priv->RxPower = rxpower; | ||
1380 | priv->RSSI = RSSI; | ||
1381 | /* SQ translation formula is provided by SD3 DZ. 2006.06.27 */ | ||
1382 | if (quality >= 127) | ||
1383 | /* 0 causes epc to show signal zero, walk around now */ | ||
1384 | quality = 1; | ||
1385 | else if (quality < 27) | ||
1386 | quality = 100; | ||
1387 | else | ||
1388 | quality = 127 - quality; | ||
1389 | priv->SignalQuality = quality; | ||
1390 | |||
1391 | stats.signal = (u8) quality; | ||
1392 | |||
1393 | stats.signalstrength = RXAGC; | ||
1394 | if (stats.signalstrength > 100) | ||
1395 | stats.signalstrength = 100; | ||
1396 | stats.signalstrength = (stats.signalstrength * 70) / 100 + 30; | ||
1397 | stats.rssi = priv->wstats.qual.qual = priv->SignalQuality; | ||
1398 | stats.noise = priv->wstats.qual.noise = | ||
1399 | 100 - priv->wstats.qual.qual; | ||
1400 | bHwError = (((*(priv->rxringtail)) & (0x00000fff)) == 4080) | | ||
1401 | (((*(priv->rxringtail)) & (0x04000000)) != 0) | | ||
1402 | (((*(priv->rxringtail)) & (0x08000000)) != 0) | | ||
1403 | (((~(*(priv->rxringtail))) & (0x10000000)) != 0) | | ||
1404 | (((~(*(priv->rxringtail))) & (0x20000000)) != 0); | ||
1405 | bCRC = ((*(priv->rxringtail)) & (0x00002000)) >> 13; | ||
1406 | bICV = ((*(priv->rxringtail)) & (0x00001000)) >> 12; | ||
1407 | hdr = (struct ieee80211_hdr_4addr *)priv->rxbuffer->buf; | ||
1408 | fc = le16_to_cpu(hdr->frame_ctl); | ||
1409 | type = WLAN_FC_GET_TYPE(fc); | ||
1410 | |||
1411 | if (IEEE80211_FTYPE_CTL != type && | ||
1412 | !bHwError && !bCRC && !bICV && | ||
1413 | eqMacAddr(priv->ieee80211->current_network.bssid, | ||
1414 | fc & IEEE80211_FCTL_TODS ? hdr->addr1 : | ||
1415 | fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : | ||
1416 | hdr->addr3)) { | ||
1417 | |||
1418 | /* Perform signal smoothing for dynamic | ||
1419 | * mechanism on demand. This is different | ||
1420 | * with PerformSignalSmoothing8185 in smoothing | ||
1421 | * fomula. No dramatic adjustion is apply | ||
1422 | * because dynamic mechanism need some degree | ||
1423 | * of correctness. */ | ||
1424 | PerformUndecoratedSignalSmoothing8185(priv, bCckRate); | ||
1425 | |||
1426 | /* For good-looking singal strength. */ | ||
1427 | SignalStrengthIndex = NetgearSignalStrengthTranslate( | ||
1428 | priv->LastSignalStrengthInPercent, | ||
1429 | priv->SignalStrength); | ||
1430 | |||
1431 | priv->LastSignalStrengthInPercent = SignalStrengthIndex; | ||
1432 | priv->Stats_SignalStrength = | ||
1433 | TranslateToDbm8185((u8)SignalStrengthIndex); | ||
1434 | |||
1435 | /* | ||
1436 | * We need more correct power of received packets and | ||
1437 | * the "SignalStrength" of RxStats is beautified, so we | ||
1438 | * record the correct power here. | ||
1439 | */ | ||
1440 | |||
1441 | priv->Stats_SignalQuality = (long)( | ||
1442 | priv->Stats_SignalQuality * 5 + | ||
1443 | (long)priv->SignalQuality + 5) / 6; | ||
1444 | |||
1445 | priv->Stats_RecvSignalPower = (long)( | ||
1446 | priv->Stats_RecvSignalPower * 5 + | ||
1447 | priv->RecvSignalPower - 1) / 6; | ||
1448 | |||
1449 | /* | ||
1450 | * Figure out which antenna received the last packet. | ||
1451 | * 0: aux, 1: main | ||
1452 | */ | ||
1453 | priv->LastRxPktAntenna = Antenna ? 1 : 0; | ||
1454 | SwAntennaDiversityRxOk8185(dev, priv->SignalStrength); | ||
1455 | } | ||
1456 | |||
1457 | if (first) { | ||
1458 | if (!priv->rx_skb_complete) { | ||
1459 | /* seems that HW sometimes fails to receive and | ||
1460 | * doesn't provide the last descriptor. | ||
1461 | */ | ||
1462 | dev_kfree_skb_any(priv->rx_skb); | ||
1463 | priv->stats.rxnolast++; | ||
1464 | } | ||
1465 | priv->rx_skb = dev_alloc_skb(len+2); | ||
1466 | if (!priv->rx_skb) | ||
1467 | goto drop; | ||
1468 | |||
1469 | priv->rx_skb_complete = 0; | ||
1470 | priv->rx_skb->dev = dev; | ||
1471 | } else { | ||
1472 | /* if we are here we should have already RXed the first | ||
1473 | * frame. | ||
1474 | * If we get here and the skb is not allocated then | ||
1475 | * we have just throw out garbage (skb not allocated) | ||
1476 | * and we are still rxing garbage.... | ||
1477 | */ | ||
1478 | if (!priv->rx_skb_complete) { | ||
1479 | |||
1480 | tmp_skb = dev_alloc_skb( | ||
1481 | priv->rx_skb->len + len + 2); | ||
1482 | |||
1483 | if (!tmp_skb) | ||
1484 | goto drop; | ||
1485 | |||
1486 | tmp_skb->dev = dev; | ||
1487 | |||
1488 | memcpy(skb_put(tmp_skb, priv->rx_skb->len), | ||
1489 | priv->rx_skb->data, | ||
1490 | priv->rx_skb->len); | ||
1491 | |||
1492 | dev_kfree_skb_any(priv->rx_skb); | ||
1493 | |||
1494 | priv->rx_skb = tmp_skb; | ||
1495 | } | ||
1496 | } | ||
1497 | |||
1498 | if (!priv->rx_skb_complete) { | ||
1499 | memcpy(skb_put(priv->rx_skb, len), ((unsigned char *) | ||
1500 | priv->rxbuffer->buf) + (padding ? 2 : 0), len); | ||
1501 | } | ||
1502 | |||
1503 | if (last && !priv->rx_skb_complete) { | ||
1504 | if (priv->rx_skb->len > 4) | ||
1505 | skb_trim(priv->rx_skb, priv->rx_skb->len-4); | ||
1506 | if (!ieee80211_rtl_rx(priv->ieee80211, | ||
1507 | priv->rx_skb, &stats)) | ||
1508 | dev_kfree_skb_any(priv->rx_skb); | ||
1509 | priv->rx_skb_complete = 1; | ||
1510 | } | ||
1511 | |||
1512 | pci_dma_sync_single_for_device(priv->pdev, | ||
1513 | priv->rxbuffer->dma, | ||
1514 | priv->rxbuffersize * sizeof(u8), | ||
1515 | PCI_DMA_FROMDEVICE); | ||
1516 | |||
1517 | drop: /* this is used when we have not enough mem */ | ||
1518 | /* restore the descriptor */ | ||
1519 | *(priv->rxringtail+2) = priv->rxbuffer->dma; | ||
1520 | *(priv->rxringtail) = *(priv->rxringtail) & ~0xfff; | ||
1521 | *(priv->rxringtail) = | ||
1522 | *(priv->rxringtail) | priv->rxbuffersize; | ||
1523 | |||
1524 | *(priv->rxringtail) = | ||
1525 | *(priv->rxringtail) | (1<<31); | ||
1526 | |||
1527 | priv->rxringtail += rx_desc_size; | ||
1528 | if (priv->rxringtail >= | ||
1529 | (priv->rxring)+(priv->rxringcount)*rx_desc_size) | ||
1530 | priv->rxringtail = priv->rxring; | ||
1531 | |||
1532 | priv->rxbuffer = (priv->rxbuffer->next); | ||
1533 | } | ||
1534 | } | ||
1535 | |||
1536 | |||
1537 | static void rtl8180_dma_kick(struct net_device *dev, int priority) | ||
1538 | { | ||
1539 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1540 | |||
1541 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
1542 | write_nic_byte(dev, TX_DMA_POLLING, | ||
1543 | (1 << (priority + 1)) | priv->dma_poll_mask); | ||
1544 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
1545 | |||
1546 | force_pci_posting(dev); | ||
1547 | } | ||
1548 | |||
1549 | static void rtl8180_data_hard_stop(struct net_device *dev) | ||
1550 | { | ||
1551 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1552 | |||
1553 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
1554 | priv->dma_poll_stop_mask |= TPPOLLSTOP_AC_VIQ; | ||
1555 | write_nic_byte(dev, TPPollStop, priv->dma_poll_stop_mask); | ||
1556 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
1557 | } | ||
1558 | |||
1559 | static void rtl8180_data_hard_resume(struct net_device *dev) | ||
1560 | { | ||
1561 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1562 | |||
1563 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
1564 | priv->dma_poll_stop_mask &= ~(TPPOLLSTOP_AC_VIQ); | ||
1565 | write_nic_byte(dev, TPPollStop, priv->dma_poll_stop_mask); | ||
1566 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
1567 | } | ||
1568 | |||
1569 | /* | ||
1570 | * This function TX data frames when the ieee80211 stack requires this. | ||
1571 | * It checks also if we need to stop the ieee tx queue, eventually do it | ||
1572 | */ | ||
1573 | static void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, | ||
1574 | int rate) | ||
1575 | { | ||
1576 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1577 | int mode; | ||
1578 | struct ieee80211_hdr_3addr *h = (struct ieee80211_hdr_3addr *)skb->data; | ||
1579 | bool morefrag = le16_to_cpu(h->frame_control) & IEEE80211_FCTL_MOREFRAGS; | ||
1580 | unsigned long flags; | ||
1581 | int priority; | ||
1582 | |||
1583 | mode = priv->ieee80211->iw_mode; | ||
1584 | |||
1585 | rate = ieeerate2rtlrate(rate); | ||
1586 | /* | ||
1587 | * This function doesn't require lock because we make sure it's called | ||
1588 | * with the tx_lock already acquired. | ||
1589 | * This come from the kernel's hard_xmit callback (through the ieee | ||
1590 | * stack, or from the try_wake_queue (again through the ieee stack. | ||
1591 | */ | ||
1592 | priority = AC2Q(skb->priority); | ||
1593 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1594 | |||
1595 | if (priv->ieee80211->bHwRadioOff) { | ||
1596 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1597 | |||
1598 | return; | ||
1599 | } | ||
1600 | |||
1601 | if (!check_nic_enought_desc(dev, priority)) { | ||
1602 | DMESGW("Error: no descriptor left by previous TX (avail %d) ", | ||
1603 | get_curr_tx_free_desc(dev, priority)); | ||
1604 | ieee80211_rtl_stop_queue(priv->ieee80211); | ||
1605 | } | ||
1606 | rtl8180_tx(dev, skb->data, skb->len, priority, morefrag, 0, rate); | ||
1607 | if (!check_nic_enought_desc(dev, priority)) | ||
1608 | ieee80211_rtl_stop_queue(priv->ieee80211); | ||
1609 | |||
1610 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1611 | } | ||
1612 | |||
1613 | /* | ||
1614 | * This is a rough attempt to TX a frame | ||
1615 | * This is called by the ieee 80211 stack to TX management frames. | ||
1616 | * If the ring is full packets are dropped (for data frame the queue | ||
1617 | * is stopped before this can happen). For this reason it is better | ||
1618 | * if the descriptors are larger than the largest management frame | ||
1619 | * we intend to TX: i'm unsure what the HW does if it will not find | ||
1620 | * the last fragment of a frame because it has been dropped... | ||
1621 | * Since queues for Management and Data frames are different we | ||
1622 | * might use a different lock than tx_lock (for example mgmt_tx_lock) | ||
1623 | */ | ||
1624 | /* these function may loop if invoked with 0 descriptors or 0 len buffer */ | ||
1625 | static int rtl8180_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1626 | { | ||
1627 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1628 | unsigned long flags; | ||
1629 | int priority; | ||
1630 | |||
1631 | priority = MANAGE_PRIORITY; | ||
1632 | |||
1633 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1634 | |||
1635 | if (priv->ieee80211->bHwRadioOff) { | ||
1636 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1637 | dev_kfree_skb_any(skb); | ||
1638 | return NETDEV_TX_OK; | ||
1639 | } | ||
1640 | |||
1641 | rtl8180_tx(dev, skb->data, skb->len, priority, | ||
1642 | 0, 0, ieeerate2rtlrate(priv->ieee80211->basic_rate)); | ||
1643 | |||
1644 | priv->ieee80211->stats.tx_bytes += skb->len; | ||
1645 | priv->ieee80211->stats.tx_packets++; | ||
1646 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1647 | |||
1648 | dev_kfree_skb_any(skb); | ||
1649 | return NETDEV_TX_OK; | ||
1650 | } | ||
1651 | |||
1652 | static void rtl8180_prepare_beacon(struct net_device *dev) | ||
1653 | { | ||
1654 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1655 | struct sk_buff *skb; | ||
1656 | |||
1657 | u16 word = read_nic_word(dev, BcnItv); | ||
1658 | word &= ~BcnItv_BcnItv; /* clear Bcn_Itv */ | ||
1659 | |||
1660 | /* word |= 0x64; */ | ||
1661 | word |= cpu_to_le16(priv->ieee80211->current_network.beacon_interval); | ||
1662 | |||
1663 | write_nic_word(dev, BcnItv, word); | ||
1664 | |||
1665 | skb = ieee80211_get_beacon(priv->ieee80211); | ||
1666 | if (skb) { | ||
1667 | rtl8180_tx(dev, skb->data, skb->len, BEACON_PRIORITY, | ||
1668 | 0, 0, ieeerate2rtlrate(priv->ieee80211->basic_rate)); | ||
1669 | dev_kfree_skb_any(skb); | ||
1670 | } | ||
1671 | } | ||
1672 | |||
1673 | /* | ||
1674 | * This function do the real dirty work: it enqueues a TX command descriptor in | ||
1675 | * the ring buffer, copyes the frame in a TX buffer and kicks the NIC to ensure | ||
1676 | * it does the DMA transfer. | ||
1677 | */ | ||
1678 | short rtl8180_tx(struct net_device *dev, u8 *txbuf, int len, int priority, | ||
1679 | bool morefrag, short descfrag, int rate) | ||
1680 | { | ||
1681 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1682 | u32 *tail, *temp_tail; | ||
1683 | u32 *begin; | ||
1684 | u32 *buf; | ||
1685 | int i; | ||
1686 | int remain; | ||
1687 | int buflen; | ||
1688 | int count; | ||
1689 | struct buffer *buflist; | ||
1690 | struct ieee80211_hdr_3addr *frag_hdr = | ||
1691 | (struct ieee80211_hdr_3addr *)txbuf; | ||
1692 | u8 dest[ETH_ALEN]; | ||
1693 | u8 bUseShortPreamble = 0; | ||
1694 | u8 bCTSEnable = 0; | ||
1695 | u8 bRTSEnable = 0; | ||
1696 | u16 Duration = 0; | ||
1697 | u16 RtsDur = 0; | ||
1698 | u16 ThisFrameTime = 0; | ||
1699 | u16 TxDescDuration = 0; | ||
1700 | bool ownbit_flag = false; | ||
1701 | |||
1702 | switch (priority) { | ||
1703 | case MANAGE_PRIORITY: | ||
1704 | tail = priv->txmapringtail; | ||
1705 | begin = priv->txmapring; | ||
1706 | buflist = priv->txmapbufstail; | ||
1707 | count = priv->txringcount; | ||
1708 | break; | ||
1709 | case BK_PRIORITY: | ||
1710 | tail = priv->txbkpringtail; | ||
1711 | begin = priv->txbkpring; | ||
1712 | buflist = priv->txbkpbufstail; | ||
1713 | count = priv->txringcount; | ||
1714 | break; | ||
1715 | case BE_PRIORITY: | ||
1716 | tail = priv->txbepringtail; | ||
1717 | begin = priv->txbepring; | ||
1718 | buflist = priv->txbepbufstail; | ||
1719 | count = priv->txringcount; | ||
1720 | break; | ||
1721 | case VI_PRIORITY: | ||
1722 | tail = priv->txvipringtail; | ||
1723 | begin = priv->txvipring; | ||
1724 | buflist = priv->txvipbufstail; | ||
1725 | count = priv->txringcount; | ||
1726 | break; | ||
1727 | case VO_PRIORITY: | ||
1728 | tail = priv->txvopringtail; | ||
1729 | begin = priv->txvopring; | ||
1730 | buflist = priv->txvopbufstail; | ||
1731 | count = priv->txringcount; | ||
1732 | break; | ||
1733 | case HI_PRIORITY: | ||
1734 | tail = priv->txhpringtail; | ||
1735 | begin = priv->txhpring; | ||
1736 | buflist = priv->txhpbufstail; | ||
1737 | count = priv->txringcount; | ||
1738 | break; | ||
1739 | case BEACON_PRIORITY: | ||
1740 | tail = priv->txbeaconringtail; | ||
1741 | begin = priv->txbeaconring; | ||
1742 | buflist = priv->txbeaconbufstail; | ||
1743 | count = priv->txbeaconcount; | ||
1744 | break; | ||
1745 | default: | ||
1746 | return -1; | ||
1747 | break; | ||
1748 | } | ||
1749 | |||
1750 | memcpy(&dest, frag_hdr->addr1, ETH_ALEN); | ||
1751 | if (is_multicast_ether_addr(dest)) { | ||
1752 | Duration = 0; | ||
1753 | RtsDur = 0; | ||
1754 | bRTSEnable = 0; | ||
1755 | bCTSEnable = 0; | ||
1756 | |||
1757 | ThisFrameTime = ComputeTxTime(len + sCrcLng, | ||
1758 | rtl8180_rate2rate(rate), 0, bUseShortPreamble); | ||
1759 | TxDescDuration = ThisFrameTime; | ||
1760 | } else { /* Unicast packet */ | ||
1761 | u16 AckTime; | ||
1762 | |||
1763 | /* for Keep alive */ | ||
1764 | priv->NumTxUnicast++; | ||
1765 | |||
1766 | /* Figure out ACK rate according to BSS basic rate | ||
1767 | * and Tx rate. | ||
1768 | * AckCTSLng = 14 use 1M bps send | ||
1769 | */ | ||
1770 | AckTime = ComputeTxTime(14, 10, 0, 0); | ||
1771 | |||
1772 | if (((len + sCrcLng) > priv->rts) && priv->rts) { /* RTS/CTS. */ | ||
1773 | u16 RtsTime, CtsTime; | ||
1774 | bRTSEnable = 1; | ||
1775 | bCTSEnable = 0; | ||
1776 | |||
1777 | /* Rate and time required for RTS. */ | ||
1778 | RtsTime = ComputeTxTime(sAckCtsLng / 8, | ||
1779 | priv->ieee80211->basic_rate, 0, 0); | ||
1780 | |||
1781 | /* Rate and time required for CTS. | ||
1782 | * AckCTSLng = 14 use 1M bps send | ||
1783 | */ | ||
1784 | CtsTime = ComputeTxTime(14, 10, 0, 0); | ||
1785 | |||
1786 | /* Figure out time required to transmit this frame. */ | ||
1787 | ThisFrameTime = ComputeTxTime(len + sCrcLng, | ||
1788 | rtl8180_rate2rate(rate), 0, | ||
1789 | bUseShortPreamble); | ||
1790 | |||
1791 | /* RTS-CTS-ThisFrame-ACK. */ | ||
1792 | RtsDur = CtsTime + ThisFrameTime + | ||
1793 | AckTime + 3 * aSifsTime; | ||
1794 | |||
1795 | TxDescDuration = RtsTime + RtsDur; | ||
1796 | } else { /* Normal case. */ | ||
1797 | bCTSEnable = 0; | ||
1798 | bRTSEnable = 0; | ||
1799 | RtsDur = 0; | ||
1800 | |||
1801 | ThisFrameTime = ComputeTxTime(len + sCrcLng, | ||
1802 | rtl8180_rate2rate(rate), 0, bUseShortPreamble); | ||
1803 | TxDescDuration = ThisFrameTime + aSifsTime + AckTime; | ||
1804 | } | ||
1805 | |||
1806 | if (!(le16_to_cpu(frag_hdr->frame_control) & IEEE80211_FCTL_MOREFRAGS)) { | ||
1807 | /* ThisFrame-ACK. */ | ||
1808 | Duration = aSifsTime + AckTime; | ||
1809 | } else { /* One or more fragments remained. */ | ||
1810 | u16 NextFragTime; | ||
1811 | |||
1812 | /* pretend following packet length = current packet */ | ||
1813 | NextFragTime = ComputeTxTime(len + sCrcLng, | ||
1814 | rtl8180_rate2rate(rate), 0, bUseShortPreamble); | ||
1815 | |||
1816 | /* ThisFrag-ACk-NextFrag-ACK. */ | ||
1817 | Duration = NextFragTime + 3 * aSifsTime + 2 * AckTime; | ||
1818 | } | ||
1819 | |||
1820 | } /* End of Unicast packet */ | ||
1821 | |||
1822 | frag_hdr->duration_id = Duration; | ||
1823 | |||
1824 | buflen = priv->txbuffsize; | ||
1825 | remain = len; | ||
1826 | temp_tail = tail; | ||
1827 | |||
1828 | while (remain != 0) { | ||
1829 | mb(); | ||
1830 | if (!buflist) { | ||
1831 | DMESGE("TX buffer error, cannot TX frames. pri %d.", | ||
1832 | priority); | ||
1833 | return -1; | ||
1834 | } | ||
1835 | buf = buflist->buf; | ||
1836 | |||
1837 | if ((*tail & (1 << 31)) && (priority != BEACON_PRIORITY)) { | ||
1838 | DMESGW("No more TX desc, returning %x of %x", | ||
1839 | remain, len); | ||
1840 | priv->stats.txrdu++; | ||
1841 | return remain; | ||
1842 | } | ||
1843 | |||
1844 | *tail = 0; /* zeroes header */ | ||
1845 | *(tail+1) = 0; | ||
1846 | *(tail+3) = 0; | ||
1847 | *(tail+5) = 0; | ||
1848 | *(tail+6) = 0; | ||
1849 | *(tail+7) = 0; | ||
1850 | |||
1851 | /* FIXME: should be triggered by HW encryption parameters.*/ | ||
1852 | *tail |= (1<<15); /* no encrypt */ | ||
1853 | |||
1854 | if (remain == len && !descfrag) { | ||
1855 | ownbit_flag = false; | ||
1856 | *tail = *tail | (1 << 29); /* first segment of packet */ | ||
1857 | *tail = *tail | (len); | ||
1858 | } else { | ||
1859 | ownbit_flag = true; | ||
1860 | } | ||
1861 | |||
1862 | for (i = 0; i < buflen && remain > 0; i++, remain--) { | ||
1863 | /* copy data into descriptor pointed DMAble buffer */ | ||
1864 | ((u8 *)buf)[i] = txbuf[i]; | ||
1865 | |||
1866 | if (remain == 4 && i+4 >= buflen) | ||
1867 | break; | ||
1868 | /* ensure the last desc has at least 4 bytes payload */ | ||
1869 | } | ||
1870 | txbuf = txbuf + i; | ||
1871 | *(tail+3) = *(tail+3) & ~0xfff; | ||
1872 | *(tail+3) = *(tail+3) | i; /* buffer length */ | ||
1873 | |||
1874 | if (bCTSEnable) | ||
1875 | *tail |= (1<<18); | ||
1876 | |||
1877 | if (bRTSEnable) { /* rts enable */ | ||
1878 | /* RTS RATE */ | ||
1879 | *tail |= (ieeerate2rtlrate( | ||
1880 | priv->ieee80211->basic_rate) << 19); | ||
1881 | |||
1882 | *tail |= (1<<23); /* rts enable */ | ||
1883 | *(tail+1) |= (RtsDur&0xffff); /* RTS Duration */ | ||
1884 | } | ||
1885 | *(tail+3) |= ((TxDescDuration&0xffff)<<16); /* DURATION */ | ||
1886 | |||
1887 | *(tail + 5) |= (11 << 8); /* retry lim; */ | ||
1888 | |||
1889 | *tail = *tail | ((rate&0xf) << 24); | ||
1890 | |||
1891 | if (morefrag) | ||
1892 | *tail = (*tail) | (1<<17); /* more fragment */ | ||
1893 | if (!remain) | ||
1894 | *tail = (*tail) | (1<<28); /* last segment of frame */ | ||
1895 | |||
1896 | *(tail+5) = *(tail+5)|(2<<27); | ||
1897 | *(tail+7) = *(tail+7)|(1<<4); | ||
1898 | |||
1899 | wmb(); | ||
1900 | if (ownbit_flag) | ||
1901 | /* descriptor ready to be txed */ | ||
1902 | *tail |= (1 << 31); | ||
1903 | |||
1904 | if ((tail - begin)/8 == count-1) | ||
1905 | tail = begin; | ||
1906 | else | ||
1907 | tail = tail+8; | ||
1908 | |||
1909 | buflist = buflist->next; | ||
1910 | |||
1911 | mb(); | ||
1912 | |||
1913 | switch (priority) { | ||
1914 | case MANAGE_PRIORITY: | ||
1915 | priv->txmapringtail = tail; | ||
1916 | priv->txmapbufstail = buflist; | ||
1917 | break; | ||
1918 | case BK_PRIORITY: | ||
1919 | priv->txbkpringtail = tail; | ||
1920 | priv->txbkpbufstail = buflist; | ||
1921 | break; | ||
1922 | case BE_PRIORITY: | ||
1923 | priv->txbepringtail = tail; | ||
1924 | priv->txbepbufstail = buflist; | ||
1925 | break; | ||
1926 | case VI_PRIORITY: | ||
1927 | priv->txvipringtail = tail; | ||
1928 | priv->txvipbufstail = buflist; | ||
1929 | break; | ||
1930 | case VO_PRIORITY: | ||
1931 | priv->txvopringtail = tail; | ||
1932 | priv->txvopbufstail = buflist; | ||
1933 | break; | ||
1934 | case HI_PRIORITY: | ||
1935 | priv->txhpringtail = tail; | ||
1936 | priv->txhpbufstail = buflist; | ||
1937 | break; | ||
1938 | case BEACON_PRIORITY: | ||
1939 | /* | ||
1940 | * The HW seems to be happy with the 1st | ||
1941 | * descriptor filled and the 2nd empty... | ||
1942 | * So always update descriptor 1 and never | ||
1943 | * touch 2nd | ||
1944 | */ | ||
1945 | break; | ||
1946 | } | ||
1947 | } | ||
1948 | *temp_tail = *temp_tail | (1<<31); /* descriptor ready to be txed */ | ||
1949 | rtl8180_dma_kick(dev, priority); | ||
1950 | |||
1951 | return 0; | ||
1952 | } | ||
1953 | |||
1954 | void rtl8180_irq_rx_tasklet(struct r8180_priv *priv); | ||
1955 | |||
1956 | static void rtl8180_link_change(struct net_device *dev) | ||
1957 | { | ||
1958 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1959 | u16 beacon_interval; | ||
1960 | struct ieee80211_network *net = &priv->ieee80211->current_network; | ||
1961 | |||
1962 | rtl8180_update_msr(dev); | ||
1963 | |||
1964 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
1965 | |||
1966 | write_nic_dword(dev, BSSID, ((u32 *)net->bssid)[0]); | ||
1967 | write_nic_word(dev, BSSID+4, ((u16 *)net->bssid)[2]); | ||
1968 | |||
1969 | beacon_interval = read_nic_word(dev, BEACON_INTERVAL); | ||
1970 | beacon_interval &= ~BEACON_INTERVAL_MASK; | ||
1971 | beacon_interval |= net->beacon_interval; | ||
1972 | write_nic_word(dev, BEACON_INTERVAL, beacon_interval); | ||
1973 | |||
1974 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
1975 | |||
1976 | rtl8180_set_chan(dev, priv->chan); | ||
1977 | } | ||
1978 | |||
1979 | static void rtl8180_rq_tx_ack(struct net_device *dev) | ||
1980 | { | ||
1981 | |||
1982 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1983 | |||
1984 | write_nic_byte(dev, CONFIG4, | ||
1985 | read_nic_byte(dev, CONFIG4) | CONFIG4_PWRMGT); | ||
1986 | priv->ack_tx_to_ieee = 1; | ||
1987 | } | ||
1988 | |||
1989 | static short rtl8180_is_tx_queue_empty(struct net_device *dev) | ||
1990 | { | ||
1991 | |||
1992 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1993 | u32 *d; | ||
1994 | |||
1995 | for (d = priv->txmapring; | ||
1996 | d < priv->txmapring + priv->txringcount; d += 8) | ||
1997 | if (*d & (1<<31)) | ||
1998 | return 0; | ||
1999 | |||
2000 | for (d = priv->txbkpring; | ||
2001 | d < priv->txbkpring + priv->txringcount; d += 8) | ||
2002 | if (*d & (1<<31)) | ||
2003 | return 0; | ||
2004 | |||
2005 | for (d = priv->txbepring; | ||
2006 | d < priv->txbepring + priv->txringcount; d += 8) | ||
2007 | if (*d & (1<<31)) | ||
2008 | return 0; | ||
2009 | |||
2010 | for (d = priv->txvipring; | ||
2011 | d < priv->txvipring + priv->txringcount; d += 8) | ||
2012 | if (*d & (1<<31)) | ||
2013 | return 0; | ||
2014 | |||
2015 | for (d = priv->txvopring; | ||
2016 | d < priv->txvopring + priv->txringcount; d += 8) | ||
2017 | if (*d & (1<<31)) | ||
2018 | return 0; | ||
2019 | |||
2020 | for (d = priv->txhpring; | ||
2021 | d < priv->txhpring + priv->txringcount; d += 8) | ||
2022 | if (*d & (1<<31)) | ||
2023 | return 0; | ||
2024 | return 1; | ||
2025 | } | ||
2026 | |||
2027 | static void rtl8180_hw_wakeup(struct net_device *dev) | ||
2028 | { | ||
2029 | unsigned long flags; | ||
2030 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2031 | |||
2032 | spin_lock_irqsave(&priv->ps_lock, flags); | ||
2033 | write_nic_byte(dev, CONFIG4, | ||
2034 | read_nic_byte(dev, CONFIG4) & ~CONFIG4_PWRMGT); | ||
2035 | if (priv->rf_wakeup) | ||
2036 | priv->rf_wakeup(dev); | ||
2037 | spin_unlock_irqrestore(&priv->ps_lock, flags); | ||
2038 | } | ||
2039 | |||
2040 | static void rtl8180_hw_sleep_down(struct net_device *dev) | ||
2041 | { | ||
2042 | unsigned long flags; | ||
2043 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2044 | |||
2045 | spin_lock_irqsave(&priv->ps_lock, flags); | ||
2046 | if (priv->rf_sleep) | ||
2047 | priv->rf_sleep(dev); | ||
2048 | spin_unlock_irqrestore(&priv->ps_lock, flags); | ||
2049 | } | ||
2050 | |||
2051 | static void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl) | ||
2052 | { | ||
2053 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2054 | u32 rb = jiffies; | ||
2055 | unsigned long flags; | ||
2056 | |||
2057 | spin_lock_irqsave(&priv->ps_lock, flags); | ||
2058 | |||
2059 | /* | ||
2060 | * Writing HW register with 0 equals to disable | ||
2061 | * the timer, that is not really what we want | ||
2062 | */ | ||
2063 | tl -= MSECS(4+16+7); | ||
2064 | |||
2065 | /* | ||
2066 | * If the interval in which we are requested to sleep is too | ||
2067 | * short then give up and remain awake | ||
2068 | */ | ||
2069 | if (((tl >= rb) && (tl-rb) <= MSECS(MIN_SLEEP_TIME)) | ||
2070 | || ((rb > tl) && (rb-tl) < MSECS(MIN_SLEEP_TIME))) { | ||
2071 | spin_unlock_irqrestore(&priv->ps_lock, flags); | ||
2072 | netdev_warn(dev, "too short to sleep\n"); | ||
2073 | return; | ||
2074 | } | ||
2075 | |||
2076 | { | ||
2077 | u32 tmp = (tl > rb) ? (tl-rb) : (rb-tl); | ||
2078 | |||
2079 | priv->DozePeriodInPast2Sec += jiffies_to_msecs(tmp); | ||
2080 | /* as tl may be less than rb */ | ||
2081 | queue_delayed_work(priv->ieee80211->wq, | ||
2082 | &priv->ieee80211->hw_wakeup_wq, tmp); | ||
2083 | } | ||
2084 | /* | ||
2085 | * If we suspect the TimerInt is gone beyond tl | ||
2086 | * while setting it, then give up | ||
2087 | */ | ||
2088 | |||
2089 | if (((tl > rb) && ((tl-rb) > MSECS(MAX_SLEEP_TIME))) || | ||
2090 | ((tl < rb) && ((rb-tl) > MSECS(MAX_SLEEP_TIME)))) { | ||
2091 | spin_unlock_irqrestore(&priv->ps_lock, flags); | ||
2092 | return; | ||
2093 | } | ||
2094 | |||
2095 | queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_sleep_wq); | ||
2096 | spin_unlock_irqrestore(&priv->ps_lock, flags); | ||
2097 | } | ||
2098 | |||
2099 | static void rtl8180_wmm_single_param_update(struct net_device *dev, | ||
2100 | u8 mode, AC_CODING eACI, PAC_PARAM param) | ||
2101 | { | ||
2102 | u8 u1bAIFS; | ||
2103 | u32 u4bAcParam; | ||
2104 | |||
2105 | /* Retrieve parameters to update. */ | ||
2106 | /* Mode G/A: slotTimeTimer = 9; Mode B: 20 */ | ||
2107 | u1bAIFS = param->f.AciAifsn.f.AIFSN * ((mode & IEEE_G) == IEEE_G ? | ||
2108 | 9 : 20) + aSifsTime; | ||
2109 | u4bAcParam = (((u32)param->f.TXOPLimit << AC_PARAM_TXOP_LIMIT_OFFSET) | | ||
2110 | ((u32)param->f.Ecw.f.ECWmax << AC_PARAM_ECW_MAX_OFFSET) | | ||
2111 | ((u32)param->f.Ecw.f.ECWmin << AC_PARAM_ECW_MIN_OFFSET) | | ||
2112 | ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); | ||
2113 | |||
2114 | switch (eACI) { | ||
2115 | case AC1_BK: | ||
2116 | write_nic_dword(dev, AC_BK_PARAM, u4bAcParam); | ||
2117 | return; | ||
2118 | case AC0_BE: | ||
2119 | write_nic_dword(dev, AC_BE_PARAM, u4bAcParam); | ||
2120 | return; | ||
2121 | case AC2_VI: | ||
2122 | write_nic_dword(dev, AC_VI_PARAM, u4bAcParam); | ||
2123 | return; | ||
2124 | case AC3_VO: | ||
2125 | write_nic_dword(dev, AC_VO_PARAM, u4bAcParam); | ||
2126 | return; | ||
2127 | default: | ||
2128 | pr_warn("SetHwReg8185(): invalid ACI: %d!\n", eACI); | ||
2129 | return; | ||
2130 | } | ||
2131 | } | ||
2132 | |||
2133 | static void rtl8180_wmm_param_update(struct work_struct *work) | ||
2134 | { | ||
2135 | struct ieee80211_device *ieee = container_of(work, | ||
2136 | struct ieee80211_device, wmm_param_update_wq); | ||
2137 | struct net_device *dev = ieee->dev; | ||
2138 | u8 *ac_param = (u8 *)(ieee->current_network.wmm_param); | ||
2139 | u8 mode = ieee->current_network.mode; | ||
2140 | AC_CODING eACI; | ||
2141 | AC_PARAM AcParam; | ||
2142 | |||
2143 | if (!ieee->current_network.QoS_Enable) { | ||
2144 | /* legacy ac_xx_param update */ | ||
2145 | AcParam.longData = 0; | ||
2146 | AcParam.f.AciAifsn.f.AIFSN = 2; /* Follow 802.11 DIFS. */ | ||
2147 | AcParam.f.AciAifsn.f.ACM = 0; | ||
2148 | AcParam.f.Ecw.f.ECWmin = 3; /* Follow 802.11 CWmin. */ | ||
2149 | AcParam.f.Ecw.f.ECWmax = 7; /* Follow 802.11 CWmax. */ | ||
2150 | AcParam.f.TXOPLimit = 0; | ||
2151 | |||
2152 | for (eACI = 0; eACI < AC_MAX; eACI++) { | ||
2153 | AcParam.f.AciAifsn.f.ACI = (u8)eACI; | ||
2154 | |||
2155 | rtl8180_wmm_single_param_update(dev, mode, eACI, | ||
2156 | (PAC_PARAM)&AcParam); | ||
2157 | } | ||
2158 | return; | ||
2159 | } | ||
2160 | |||
2161 | for (eACI = 0; eACI < AC_MAX; eACI++) { | ||
2162 | rtl8180_wmm_single_param_update(dev, mode, | ||
2163 | ((PAC_PARAM)ac_param)->f.AciAifsn.f.ACI, | ||
2164 | (PAC_PARAM)ac_param); | ||
2165 | |||
2166 | ac_param += sizeof(AC_PARAM); | ||
2167 | } | ||
2168 | } | ||
2169 | |||
2170 | void rtl8180_restart_wq(struct work_struct *work); | ||
2171 | void rtl8180_watch_dog_wq(struct work_struct *work); | ||
2172 | void rtl8180_hw_wakeup_wq(struct work_struct *work); | ||
2173 | void rtl8180_hw_sleep_wq(struct work_struct *work); | ||
2174 | void rtl8180_sw_antenna_wq(struct work_struct *work); | ||
2175 | void rtl8180_watch_dog(struct net_device *dev); | ||
2176 | |||
2177 | static void watch_dog_adaptive(unsigned long data) | ||
2178 | { | ||
2179 | struct r8180_priv *priv = ieee80211_priv((struct net_device *)data); | ||
2180 | |||
2181 | if (!priv->up) { | ||
2182 | DMESG("<----watch_dog_adaptive():driver is not up!\n"); | ||
2183 | return; | ||
2184 | } | ||
2185 | |||
2186 | /* Tx High Power Mechanism. */ | ||
2187 | if (CheckHighPower((struct net_device *)data)) | ||
2188 | queue_work(priv->ieee80211->wq, | ||
2189 | (void *)&priv->ieee80211->tx_pw_wq); | ||
2190 | |||
2191 | /* Tx Power Tracking on 87SE. */ | ||
2192 | if (CheckTxPwrTracking((struct net_device *)data)) | ||
2193 | TxPwrTracking87SE((struct net_device *)data); | ||
2194 | |||
2195 | /* Perform DIG immediately. */ | ||
2196 | if (CheckDig((struct net_device *)data)) | ||
2197 | queue_work(priv->ieee80211->wq, | ||
2198 | (void *)&priv->ieee80211->hw_dig_wq); | ||
2199 | |||
2200 | rtl8180_watch_dog((struct net_device *)data); | ||
2201 | |||
2202 | queue_work(priv->ieee80211->wq, | ||
2203 | (void *)&priv->ieee80211->GPIOChangeRFWorkItem); | ||
2204 | |||
2205 | priv->watch_dog_timer.expires = jiffies + | ||
2206 | MSECS(IEEE80211_WATCH_DOG_TIME); | ||
2207 | |||
2208 | add_timer(&priv->watch_dog_timer); | ||
2209 | } | ||
2210 | |||
2211 | static struct rtl8187se_channel_list channel_plan_list[] = { | ||
2212 | /* FCC */ | ||
2213 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, | ||
2214 | 44, 48, 52, 56, 60, 64}, 19}, | ||
2215 | |||
2216 | /* IC */ | ||
2217 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, | ||
2218 | |||
2219 | /* ETSI */ | ||
2220 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, | ||
2221 | 44, 48, 52, 56, 60, 64}, 21}, | ||
2222 | |||
2223 | /* Spain. Change to ETSI. */ | ||
2224 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, | ||
2225 | 44, 48, 52, 56, 60, 64}, 21}, | ||
2226 | |||
2227 | /* France. Change to ETSI. */ | ||
2228 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, | ||
2229 | 44, 48, 52, 56, 60, 64}, 21}, | ||
2230 | |||
2231 | /* MKK */ | ||
2232 | {{14, 36, 40, 44, 48, 52, 56, 60, 64}, 9}, | ||
2233 | |||
2234 | /* MKK1 */ | ||
2235 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, | ||
2236 | 40, 44, 48, 52, 56, 60, 64}, 22}, | ||
2237 | |||
2238 | /* Israel. */ | ||
2239 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, | ||
2240 | 44, 48, 52, 56, 60, 64}, 21}, | ||
2241 | |||
2242 | /* For 11a , TELEC */ | ||
2243 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 34, 38, 42, 46}, 17}, | ||
2244 | |||
2245 | /* For Global Domain. 1-11 active, 12-14 passive. */ | ||
2246 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14}, | ||
2247 | |||
2248 | /* world wide 13: ch1~ch11 active, ch12~13 passive */ | ||
2249 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13} | ||
2250 | }; | ||
2251 | |||
2252 | static void rtl8180_set_channel_map(u8 channel_plan, | ||
2253 | struct ieee80211_device *ieee) | ||
2254 | { | ||
2255 | int i; | ||
2256 | |||
2257 | ieee->MinPassiveChnlNum = MAX_CHANNEL_NUMBER+1; | ||
2258 | ieee->IbssStartChnl = 0; | ||
2259 | |||
2260 | switch (channel_plan) { | ||
2261 | case COUNTRY_CODE_FCC: | ||
2262 | case COUNTRY_CODE_IC: | ||
2263 | case COUNTRY_CODE_ETSI: | ||
2264 | case COUNTRY_CODE_SPAIN: | ||
2265 | case COUNTRY_CODE_FRANCE: | ||
2266 | case COUNTRY_CODE_MKK: | ||
2267 | case COUNTRY_CODE_MKK1: | ||
2268 | case COUNTRY_CODE_ISRAEL: | ||
2269 | case COUNTRY_CODE_TELEC: | ||
2270 | { | ||
2271 | Dot11d_Init(ieee); | ||
2272 | ieee->bGlobalDomain = false; | ||
2273 | if (channel_plan_list[channel_plan].len != 0) { | ||
2274 | /* Clear old channel map */ | ||
2275 | memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); | ||
2276 | /* Set new channel map */ | ||
2277 | for (i = 0; i < channel_plan_list[channel_plan].len; i++) { | ||
2278 | if (channel_plan_list[channel_plan].channel[i] <= 14) | ||
2279 | GET_DOT11D_INFO(ieee)->channel_map[channel_plan_list[channel_plan].channel[i]] = 1; | ||
2280 | } | ||
2281 | } | ||
2282 | break; | ||
2283 | } | ||
2284 | case COUNTRY_CODE_GLOBAL_DOMAIN: | ||
2285 | { | ||
2286 | GET_DOT11D_INFO(ieee)->bEnabled = false; | ||
2287 | Dot11d_Reset(ieee); | ||
2288 | ieee->bGlobalDomain = true; | ||
2289 | break; | ||
2290 | } | ||
2291 | case COUNTRY_CODE_WORLD_WIDE_13_INDEX: | ||
2292 | { | ||
2293 | ieee->MinPassiveChnlNum = 12; | ||
2294 | ieee->IbssStartChnl = 10; | ||
2295 | break; | ||
2296 | } | ||
2297 | default: | ||
2298 | { | ||
2299 | Dot11d_Init(ieee); | ||
2300 | ieee->bGlobalDomain = false; | ||
2301 | memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); | ||
2302 | for (i = 1; i <= 14; i++) | ||
2303 | GET_DOT11D_INFO(ieee)->channel_map[i] = 1; | ||
2304 | break; | ||
2305 | } | ||
2306 | } | ||
2307 | } | ||
2308 | |||
2309 | void GPIOChangeRFWorkItemCallBack(struct work_struct *work); | ||
2310 | |||
2311 | static void rtl8180_statistics_init(struct stats *pstats) | ||
2312 | { | ||
2313 | memset(pstats, 0, sizeof(struct stats)); | ||
2314 | } | ||
2315 | |||
2316 | static void rtl8180_link_detect_init(struct link_detect_t *plink_detect) | ||
2317 | { | ||
2318 | memset(plink_detect, 0, sizeof(struct link_detect_t)); | ||
2319 | plink_detect->slot_num = DEFAULT_SLOT_NUM; | ||
2320 | } | ||
2321 | |||
2322 | static void rtl8187se_eeprom_register_read(struct eeprom_93cx6 *eeprom) | ||
2323 | { | ||
2324 | struct net_device *dev = eeprom->data; | ||
2325 | u8 reg = read_nic_byte(dev, EPROM_CMD); | ||
2326 | |||
2327 | eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE; | ||
2328 | eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ; | ||
2329 | eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK; | ||
2330 | eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS; | ||
2331 | } | ||
2332 | |||
2333 | static void rtl8187se_eeprom_register_write(struct eeprom_93cx6 *eeprom) | ||
2334 | { | ||
2335 | struct net_device *dev = eeprom->data; | ||
2336 | u8 reg = 2 << 6; | ||
2337 | |||
2338 | if (eeprom->reg_data_in) | ||
2339 | reg |= RTL818X_EEPROM_CMD_WRITE; | ||
2340 | if (eeprom->reg_data_out) | ||
2341 | reg |= RTL818X_EEPROM_CMD_READ; | ||
2342 | if (eeprom->reg_data_clock) | ||
2343 | reg |= RTL818X_EEPROM_CMD_CK; | ||
2344 | if (eeprom->reg_chip_select) | ||
2345 | reg |= RTL818X_EEPROM_CMD_CS; | ||
2346 | |||
2347 | write_nic_byte(dev, EPROM_CMD, reg); | ||
2348 | read_nic_byte(dev, EPROM_CMD); | ||
2349 | udelay(10); | ||
2350 | } | ||
2351 | |||
2352 | static short rtl8180_init(struct net_device *dev) | ||
2353 | { | ||
2354 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2355 | u16 word; | ||
2356 | u16 usValue; | ||
2357 | u16 tmpu16; | ||
2358 | int i, j; | ||
2359 | struct eeprom_93cx6 eeprom; | ||
2360 | u16 eeprom_val; | ||
2361 | |||
2362 | eeprom.data = dev; | ||
2363 | eeprom.register_read = rtl8187se_eeprom_register_read; | ||
2364 | eeprom.register_write = rtl8187se_eeprom_register_write; | ||
2365 | eeprom.width = PCI_EEPROM_WIDTH_93C46; | ||
2366 | |||
2367 | eeprom_93cx6_read(&eeprom, EEPROM_COUNTRY_CODE>>1, &eeprom_val); | ||
2368 | priv->channel_plan = eeprom_val & 0xFF; | ||
2369 | if (priv->channel_plan > COUNTRY_CODE_GLOBAL_DOMAIN) { | ||
2370 | netdev_err(dev, "rtl8180_init: Invalid channel plan! Set to default.\n"); | ||
2371 | priv->channel_plan = 0; | ||
2372 | } | ||
2373 | |||
2374 | DMESG("Channel plan is %d\n", priv->channel_plan); | ||
2375 | rtl8180_set_channel_map(priv->channel_plan, priv->ieee80211); | ||
2376 | |||
2377 | /* FIXME: these constants are placed in a bad pleace. */ | ||
2378 | priv->txbuffsize = 2048; /* 1024; */ | ||
2379 | priv->txringcount = 32; /* 32; */ | ||
2380 | priv->rxbuffersize = 2048; /* 1024; */ | ||
2381 | priv->rxringcount = 64; /* 32; */ | ||
2382 | priv->txbeaconcount = 2; | ||
2383 | priv->rx_skb_complete = 1; | ||
2384 | |||
2385 | priv->RFChangeInProgress = false; | ||
2386 | priv->SetRFPowerStateInProgress = false; | ||
2387 | priv->RFProgType = 0; | ||
2388 | |||
2389 | priv->irq_enabled = 0; | ||
2390 | |||
2391 | rtl8180_statistics_init(&priv->stats); | ||
2392 | rtl8180_link_detect_init(&priv->link_detect); | ||
2393 | |||
2394 | priv->ack_tx_to_ieee = 0; | ||
2395 | priv->ieee80211->current_network.beacon_interval = | ||
2396 | DEFAULT_BEACONINTERVAL; | ||
2397 | priv->ieee80211->iw_mode = IW_MODE_INFRA; | ||
2398 | priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | | ||
2399 | IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | | ||
2400 | IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE; | ||
2401 | priv->ieee80211->active_scan = 1; | ||
2402 | priv->ieee80211->rate = 110; /* 11 mbps */ | ||
2403 | priv->ieee80211->modulation = IEEE80211_CCK_MODULATION; | ||
2404 | priv->ieee80211->host_encrypt = 1; | ||
2405 | priv->ieee80211->host_decrypt = 1; | ||
2406 | priv->ieee80211->sta_wake_up = rtl8180_hw_wakeup; | ||
2407 | priv->ieee80211->ps_request_tx_ack = rtl8180_rq_tx_ack; | ||
2408 | priv->ieee80211->enter_sleep_state = rtl8180_hw_sleep; | ||
2409 | priv->ieee80211->ps_is_queue_empty = rtl8180_is_tx_queue_empty; | ||
2410 | |||
2411 | priv->hw_wep = hwwep; | ||
2412 | priv->dev = dev; | ||
2413 | priv->retry_rts = DEFAULT_RETRY_RTS; | ||
2414 | priv->retry_data = DEFAULT_RETRY_DATA; | ||
2415 | priv->RFChangeInProgress = false; | ||
2416 | priv->SetRFPowerStateInProgress = false; | ||
2417 | priv->RFProgType = 0; | ||
2418 | priv->bInactivePs = true; /* false; */ | ||
2419 | priv->ieee80211->bInactivePs = priv->bInactivePs; | ||
2420 | priv->bSwRfProcessing = false; | ||
2421 | priv->eRFPowerState = RF_OFF; | ||
2422 | priv->RfOffReason = 0; | ||
2423 | priv->led_strategy = SW_LED_MODE0; | ||
2424 | priv->TxPollingTimes = 0; | ||
2425 | priv->bLeisurePs = true; | ||
2426 | priv->dot11PowerSaveMode = ACTIVE; | ||
2427 | priv->AdMinCheckPeriod = 5; | ||
2428 | priv->AdMaxCheckPeriod = 10; | ||
2429 | priv->AdMaxRxSsThreshold = 30; /* 60->30 */ | ||
2430 | priv->AdRxSsThreshold = 20; /* 50->20 */ | ||
2431 | priv->AdCheckPeriod = priv->AdMinCheckPeriod; | ||
2432 | priv->AdTickCount = 0; | ||
2433 | priv->AdRxSignalStrength = -1; | ||
2434 | priv->RegSwAntennaDiversityMechanism = 0; | ||
2435 | priv->RegDefaultAntenna = 0; | ||
2436 | priv->SignalStrength = 0; | ||
2437 | priv->AdRxOkCnt = 0; | ||
2438 | priv->CurrAntennaIndex = 0; | ||
2439 | priv->AdRxSsBeforeSwitched = 0; | ||
2440 | init_timer(&priv->SwAntennaDiversityTimer); | ||
2441 | priv->SwAntennaDiversityTimer.data = (unsigned long)dev; | ||
2442 | priv->SwAntennaDiversityTimer.function = | ||
2443 | (void *)SwAntennaDiversityTimerCallback; | ||
2444 | priv->bDigMechanism = true; | ||
2445 | priv->InitialGain = 6; | ||
2446 | priv->bXtalCalibration = false; | ||
2447 | priv->XtalCal_Xin = 0; | ||
2448 | priv->XtalCal_Xout = 0; | ||
2449 | priv->bTxPowerTrack = false; | ||
2450 | priv->ThermalMeter = 0; | ||
2451 | priv->FalseAlarmRegValue = 0; | ||
2452 | priv->RegDigOfdmFaUpTh = 0xc; /* Upper threshold of OFDM false alarm, | ||
2453 | which is used in DIG. */ | ||
2454 | priv->DIG_NumberFallbackVote = 0; | ||
2455 | priv->DIG_NumberUpgradeVote = 0; | ||
2456 | priv->LastSignalStrengthInPercent = 0; | ||
2457 | priv->Stats_SignalStrength = 0; | ||
2458 | priv->LastRxPktAntenna = 0; | ||
2459 | priv->SignalQuality = 0; /* in 0-100 index. */ | ||
2460 | priv->Stats_SignalQuality = 0; | ||
2461 | priv->RecvSignalPower = 0; /* in dBm. */ | ||
2462 | priv->Stats_RecvSignalPower = 0; | ||
2463 | priv->AdMainAntennaRxOkCnt = 0; | ||
2464 | priv->AdAuxAntennaRxOkCnt = 0; | ||
2465 | priv->bHWAdSwitched = false; | ||
2466 | priv->bRegHighPowerMechanism = true; | ||
2467 | priv->RegHiPwrUpperTh = 77; | ||
2468 | priv->RegHiPwrLowerTh = 75; | ||
2469 | priv->RegRSSIHiPwrUpperTh = 70; | ||
2470 | priv->RegRSSIHiPwrLowerTh = 20; | ||
2471 | priv->bCurCCKPkt = false; | ||
2472 | priv->UndecoratedSmoothedSS = -1; | ||
2473 | priv->bToUpdateTxPwr = false; | ||
2474 | priv->CurCCKRSSI = 0; | ||
2475 | priv->RxPower = 0; | ||
2476 | priv->RSSI = 0; | ||
2477 | priv->NumTxOkTotal = 0; | ||
2478 | priv->NumTxUnicast = 0; | ||
2479 | priv->keepAliveLevel = DEFAULT_KEEP_ALIVE_LEVEL; | ||
2480 | priv->CurrRetryCnt = 0; | ||
2481 | priv->LastRetryCnt = 0; | ||
2482 | priv->LastTxokCnt = 0; | ||
2483 | priv->LastRxokCnt = 0; | ||
2484 | priv->LastRetryRate = 0; | ||
2485 | priv->bTryuping = 0; | ||
2486 | priv->CurrTxRate = 0; | ||
2487 | priv->CurrRetryRate = 0; | ||
2488 | priv->TryupingCount = 0; | ||
2489 | priv->TryupingCountNoData = 0; | ||
2490 | priv->TryDownCountLowData = 0; | ||
2491 | priv->LastTxOKBytes = 0; | ||
2492 | priv->LastFailTxRate = 0; | ||
2493 | priv->LastFailTxRateSS = 0; | ||
2494 | priv->FailTxRateCount = 0; | ||
2495 | priv->LastTxThroughput = 0; | ||
2496 | priv->NumTxOkBytesTotal = 0; | ||
2497 | priv->ForcedDataRate = 0; | ||
2498 | priv->RegBModeGainStage = 1; | ||
2499 | |||
2500 | priv->promisc = (dev->flags & IFF_PROMISC) ? 1 : 0; | ||
2501 | spin_lock_init(&priv->irq_th_lock); | ||
2502 | spin_lock_init(&priv->tx_lock); | ||
2503 | spin_lock_init(&priv->ps_lock); | ||
2504 | spin_lock_init(&priv->rf_ps_lock); | ||
2505 | sema_init(&priv->wx_sem, 1); | ||
2506 | INIT_WORK(&priv->reset_wq, (void *)rtl8180_restart_wq); | ||
2507 | INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq, | ||
2508 | (void *)rtl8180_hw_wakeup_wq); | ||
2509 | INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq, | ||
2510 | (void *)rtl8180_hw_sleep_wq); | ||
2511 | INIT_WORK(&priv->ieee80211->wmm_param_update_wq, | ||
2512 | (void *)rtl8180_wmm_param_update); | ||
2513 | INIT_DELAYED_WORK(&priv->ieee80211->rate_adapter_wq, | ||
2514 | (void *)rtl8180_rate_adapter); | ||
2515 | INIT_DELAYED_WORK(&priv->ieee80211->hw_dig_wq, | ||
2516 | (void *)rtl8180_hw_dig_wq); | ||
2517 | INIT_DELAYED_WORK(&priv->ieee80211->tx_pw_wq, | ||
2518 | (void *)rtl8180_tx_pw_wq); | ||
2519 | INIT_DELAYED_WORK(&priv->ieee80211->GPIOChangeRFWorkItem, | ||
2520 | (void *) GPIOChangeRFWorkItemCallBack); | ||
2521 | tasklet_init(&priv->irq_rx_tasklet, | ||
2522 | (void(*)(unsigned long)) rtl8180_irq_rx_tasklet, | ||
2523 | (unsigned long)priv); | ||
2524 | |||
2525 | init_timer(&priv->watch_dog_timer); | ||
2526 | priv->watch_dog_timer.data = (unsigned long)dev; | ||
2527 | priv->watch_dog_timer.function = watch_dog_adaptive; | ||
2528 | |||
2529 | init_timer(&priv->rateadapter_timer); | ||
2530 | priv->rateadapter_timer.data = (unsigned long)dev; | ||
2531 | priv->rateadapter_timer.function = timer_rate_adaptive; | ||
2532 | priv->RateAdaptivePeriod = RATE_ADAPTIVE_TIMER_PERIOD; | ||
2533 | priv->bEnhanceTxPwr = false; | ||
2534 | |||
2535 | priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit; | ||
2536 | priv->ieee80211->set_chan = rtl8180_set_chan; | ||
2537 | priv->ieee80211->link_change = rtl8180_link_change; | ||
2538 | priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit; | ||
2539 | priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop; | ||
2540 | priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume; | ||
2541 | |||
2542 | priv->ieee80211->init_wmmparam_flag = 0; | ||
2543 | |||
2544 | priv->ieee80211->start_send_beacons = rtl8180_start_tx_beacon; | ||
2545 | priv->ieee80211->stop_send_beacons = rtl8180_beacon_tx_disable; | ||
2546 | priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; | ||
2547 | |||
2548 | priv->ShortRetryLimit = 7; | ||
2549 | priv->LongRetryLimit = 7; | ||
2550 | priv->EarlyRxThreshold = 7; | ||
2551 | |||
2552 | priv->TransmitConfig = (1<<TCR_DurProcMode_OFFSET) | | ||
2553 | (7<<TCR_MXDMA_OFFSET) | | ||
2554 | (priv->ShortRetryLimit<<TCR_SRL_OFFSET) | | ||
2555 | (priv->LongRetryLimit<<TCR_LRL_OFFSET); | ||
2556 | |||
2557 | priv->ReceiveConfig = RCR_AMF | RCR_ADF | RCR_ACF | | ||
2558 | RCR_AB | RCR_AM | RCR_APM | | ||
2559 | (7<<RCR_MXDMA_OFFSET) | | ||
2560 | (priv->EarlyRxThreshold<<RCR_FIFO_OFFSET) | | ||
2561 | (priv->EarlyRxThreshold == 7 ? | ||
2562 | RCR_ONLYERLPKT : 0); | ||
2563 | |||
2564 | priv->IntrMask = IMR_TMGDOK | IMR_TBDER | | ||
2565 | IMR_THPDER | IMR_THPDOK | | ||
2566 | IMR_TVODER | IMR_TVODOK | | ||
2567 | IMR_TVIDER | IMR_TVIDOK | | ||
2568 | IMR_TBEDER | IMR_TBEDOK | | ||
2569 | IMR_TBKDER | IMR_TBKDOK | | ||
2570 | IMR_RDU | | ||
2571 | IMR_RER | IMR_ROK | | ||
2572 | IMR_RQoSOK; | ||
2573 | |||
2574 | priv->InitialGain = 6; | ||
2575 | |||
2576 | DMESG("MAC controller is a RTL8187SE b/g"); | ||
2577 | |||
2578 | priv->ieee80211->modulation |= IEEE80211_OFDM_MODULATION; | ||
2579 | priv->ieee80211->short_slot = 1; | ||
2580 | |||
2581 | eeprom_93cx6_read(&eeprom, EEPROM_SW_REVD_OFFSET, &usValue); | ||
2582 | DMESG("usValue is %#hx\n", usValue); | ||
2583 | /* 3Read AntennaDiversity */ | ||
2584 | |||
2585 | /* SW Antenna Diversity. */ | ||
2586 | priv->EEPROMSwAntennaDiversity = (usValue & EEPROM_SW_AD_MASK) == | ||
2587 | EEPROM_SW_AD_ENABLE; | ||
2588 | |||
2589 | /* Default Antenna to use. */ | ||
2590 | priv->EEPROMDefaultAntenna1 = (usValue & EEPROM_DEF_ANT_MASK) == | ||
2591 | EEPROM_DEF_ANT_1; | ||
2592 | |||
2593 | if (priv->RegSwAntennaDiversityMechanism == 0) /* Auto */ | ||
2594 | /* 0: default from EEPROM. */ | ||
2595 | priv->bSwAntennaDiverity = priv->EEPROMSwAntennaDiversity; | ||
2596 | else | ||
2597 | /* 1:disable antenna diversity, 2: enable antenna diversity. */ | ||
2598 | priv->bSwAntennaDiverity = | ||
2599 | priv->RegSwAntennaDiversityMechanism == 2; | ||
2600 | |||
2601 | if (priv->RegDefaultAntenna == 0) | ||
2602 | /* 0: default from EEPROM. */ | ||
2603 | priv->bDefaultAntenna1 = priv->EEPROMDefaultAntenna1; | ||
2604 | else | ||
2605 | /* 1: main, 2: aux. */ | ||
2606 | priv->bDefaultAntenna1 = priv->RegDefaultAntenna == 2; | ||
2607 | |||
2608 | priv->plcp_preamble_mode = 2; | ||
2609 | /* the eeprom type is stored in RCR register bit #6 */ | ||
2610 | if (RCR_9356SEL & read_nic_dword(dev, RCR)) | ||
2611 | priv->epromtype = EPROM_93c56; | ||
2612 | else | ||
2613 | priv->epromtype = EPROM_93c46; | ||
2614 | |||
2615 | eeprom_93cx6_multiread(&eeprom, 0x7, (__le16 *) | ||
2616 | dev->dev_addr, 3); | ||
2617 | |||
2618 | for (i = 1, j = 0; i < 14; i += 2, j++) { | ||
2619 | eeprom_93cx6_read(&eeprom, EPROM_TXPW_CH1_2 + j, &word); | ||
2620 | priv->chtxpwr[i] = word & 0xff; | ||
2621 | priv->chtxpwr[i+1] = (word & 0xff00)>>8; | ||
2622 | } | ||
2623 | for (i = 1, j = 0; i < 14; i += 2, j++) { | ||
2624 | eeprom_93cx6_read(&eeprom, EPROM_TXPW_OFDM_CH1_2 + j, &word); | ||
2625 | priv->chtxpwr_ofdm[i] = word & 0xff; | ||
2626 | priv->chtxpwr_ofdm[i+1] = (word & 0xff00) >> 8; | ||
2627 | } | ||
2628 | |||
2629 | /* 3Read crystal calibration and thermal meter indication on 87SE. */ | ||
2630 | eeprom_93cx6_read(&eeprom, EEPROM_RSV>>1, &tmpu16); | ||
2631 | |||
2632 | /* Crystal calibration for Xin and Xout resp. */ | ||
2633 | priv->XtalCal_Xout = tmpu16 & EEPROM_XTAL_CAL_XOUT_MASK; | ||
2634 | priv->XtalCal_Xin = (tmpu16 & EEPROM_XTAL_CAL_XIN_MASK) >> 4; | ||
2635 | if ((tmpu16 & EEPROM_XTAL_CAL_ENABLE) >> 12) | ||
2636 | priv->bXtalCalibration = true; | ||
2637 | |||
2638 | /* Thermal meter reference indication. */ | ||
2639 | priv->ThermalMeter = (u8)((tmpu16 & EEPROM_THERMAL_METER_MASK) >> 8); | ||
2640 | if ((tmpu16 & EEPROM_THERMAL_METER_ENABLE) >> 13) | ||
2641 | priv->bTxPowerTrack = true; | ||
2642 | |||
2643 | priv->rf_sleep = rtl8225z4_rf_sleep; | ||
2644 | priv->rf_wakeup = rtl8225z4_rf_wakeup; | ||
2645 | DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!"); | ||
2646 | |||
2647 | priv->rf_close = rtl8225z2_rf_close; | ||
2648 | priv->rf_init = rtl8225z2_rf_init; | ||
2649 | priv->rf_set_chan = rtl8225z2_rf_set_chan; | ||
2650 | priv->rf_set_sens = NULL; | ||
2651 | |||
2652 | if (0 != alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount)) | ||
2653 | return -ENOMEM; | ||
2654 | |||
2655 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2656 | TX_MANAGEPRIORITY_RING_ADDR)) | ||
2657 | return -ENOMEM; | ||
2658 | |||
2659 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2660 | TX_BKPRIORITY_RING_ADDR)) | ||
2661 | return -ENOMEM; | ||
2662 | |||
2663 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2664 | TX_BEPRIORITY_RING_ADDR)) | ||
2665 | return -ENOMEM; | ||
2666 | |||
2667 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2668 | TX_VIPRIORITY_RING_ADDR)) | ||
2669 | return -ENOMEM; | ||
2670 | |||
2671 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2672 | TX_VOPRIORITY_RING_ADDR)) | ||
2673 | return -ENOMEM; | ||
2674 | |||
2675 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, | ||
2676 | TX_HIGHPRIORITY_RING_ADDR)) | ||
2677 | return -ENOMEM; | ||
2678 | |||
2679 | if (0 != alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txbeaconcount, | ||
2680 | TX_BEACON_RING_ADDR)) | ||
2681 | return -ENOMEM; | ||
2682 | |||
2683 | if (request_irq(dev->irq, rtl8180_interrupt, | ||
2684 | IRQF_SHARED, dev->name, dev)) { | ||
2685 | DMESGE("Error allocating IRQ %d", dev->irq); | ||
2686 | return -1; | ||
2687 | } else { | ||
2688 | priv->irq = dev->irq; | ||
2689 | DMESG("IRQ %d", dev->irq); | ||
2690 | } | ||
2691 | |||
2692 | return 0; | ||
2693 | } | ||
2694 | |||
2695 | void rtl8180_no_hw_wep(struct net_device *dev) | ||
2696 | { | ||
2697 | } | ||
2698 | |||
2699 | void rtl8180_set_hw_wep(struct net_device *dev) | ||
2700 | { | ||
2701 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2702 | u8 pgreg; | ||
2703 | u8 security; | ||
2704 | u32 key0_word4; | ||
2705 | |||
2706 | pgreg = read_nic_byte(dev, PGSELECT); | ||
2707 | write_nic_byte(dev, PGSELECT, pgreg & ~(1<<PGSELECT_PG_SHIFT)); | ||
2708 | |||
2709 | key0_word4 = read_nic_dword(dev, KEY0+4+4+4); | ||
2710 | key0_word4 &= ~0xff; | ||
2711 | key0_word4 |= priv->key0[3] & 0xff; | ||
2712 | write_nic_dword(dev, KEY0, (priv->key0[0])); | ||
2713 | write_nic_dword(dev, KEY0+4, (priv->key0[1])); | ||
2714 | write_nic_dword(dev, KEY0+4+4, (priv->key0[2])); | ||
2715 | write_nic_dword(dev, KEY0+4+4+4, (key0_word4)); | ||
2716 | |||
2717 | security = read_nic_byte(dev, SECURITY); | ||
2718 | security |= (1<<SECURITY_WEP_TX_ENABLE_SHIFT); | ||
2719 | security |= (1<<SECURITY_WEP_RX_ENABLE_SHIFT); | ||
2720 | security &= ~SECURITY_ENCRYP_MASK; | ||
2721 | security |= (SECURITY_ENCRYP_104<<SECURITY_ENCRYP_SHIFT); | ||
2722 | |||
2723 | write_nic_byte(dev, SECURITY, security); | ||
2724 | |||
2725 | DMESG("key %x %x %x %x", read_nic_dword(dev, KEY0+4+4+4), | ||
2726 | read_nic_dword(dev, KEY0+4+4), read_nic_dword(dev, KEY0+4), | ||
2727 | read_nic_dword(dev, KEY0)); | ||
2728 | } | ||
2729 | |||
2730 | |||
2731 | void rtl8185_rf_pins_enable(struct net_device *dev) | ||
2732 | { | ||
2733 | write_nic_word(dev, RFPinsEnable, 0x1fff); /* | tmp); */ | ||
2734 | } | ||
2735 | |||
2736 | void rtl8185_set_anaparam2(struct net_device *dev, u32 a) | ||
2737 | { | ||
2738 | u8 conf3; | ||
2739 | |||
2740 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
2741 | |||
2742 | conf3 = read_nic_byte(dev, CONFIG3); | ||
2743 | write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); | ||
2744 | write_nic_dword(dev, ANAPARAM2, a); | ||
2745 | |||
2746 | conf3 = read_nic_byte(dev, CONFIG3); | ||
2747 | write_nic_byte(dev, CONFIG3, conf3 & ~(1<<CONFIG3_ANAPARAM_W_SHIFT)); | ||
2748 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
2749 | } | ||
2750 | |||
2751 | void rtl8180_set_anaparam(struct net_device *dev, u32 a) | ||
2752 | { | ||
2753 | u8 conf3; | ||
2754 | |||
2755 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
2756 | |||
2757 | conf3 = read_nic_byte(dev, CONFIG3); | ||
2758 | write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); | ||
2759 | write_nic_dword(dev, ANAPARAM, a); | ||
2760 | |||
2761 | conf3 = read_nic_byte(dev, CONFIG3); | ||
2762 | write_nic_byte(dev, CONFIG3, conf3 & ~(1<<CONFIG3_ANAPARAM_W_SHIFT)); | ||
2763 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
2764 | } | ||
2765 | |||
2766 | void rtl8185_tx_antenna(struct net_device *dev, u8 ant) | ||
2767 | { | ||
2768 | write_nic_byte(dev, TX_ANTENNA, ant); | ||
2769 | force_pci_posting(dev); | ||
2770 | mdelay(1); | ||
2771 | } | ||
2772 | |||
2773 | static void rtl8185_write_phy(struct net_device *dev, u8 adr, u32 data) | ||
2774 | { | ||
2775 | u32 phyw; | ||
2776 | |||
2777 | adr |= 0x80; | ||
2778 | |||
2779 | phyw = ((data<<8) | adr); | ||
2780 | |||
2781 | /* Note: we must write 0xff7c after 0x7d-0x7f to write BB register. */ | ||
2782 | write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); | ||
2783 | write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); | ||
2784 | write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); | ||
2785 | write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff))); | ||
2786 | } | ||
2787 | |||
2788 | inline void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data) | ||
2789 | { | ||
2790 | data = data & 0xff; | ||
2791 | rtl8185_write_phy(dev, adr, data); | ||
2792 | } | ||
2793 | |||
2794 | void write_phy_cck(struct net_device *dev, u8 adr, u32 data) | ||
2795 | { | ||
2796 | data = data & 0xff; | ||
2797 | rtl8185_write_phy(dev, adr, data | 0x10000); | ||
2798 | } | ||
2799 | |||
2800 | /* | ||
2801 | * This configures registers for beacon tx and enables it via | ||
2802 | * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might | ||
2803 | * be used to stop beacon transmission | ||
2804 | */ | ||
2805 | void rtl8180_start_tx_beacon(struct net_device *dev) | ||
2806 | { | ||
2807 | u16 word; | ||
2808 | |||
2809 | DMESG("Enabling beacon TX"); | ||
2810 | rtl8180_prepare_beacon(dev); | ||
2811 | rtl8180_irq_disable(dev); | ||
2812 | rtl8180_beacon_tx_enable(dev); | ||
2813 | |||
2814 | word = read_nic_word(dev, AtimWnd) & ~AtimWnd_AtimWnd; | ||
2815 | write_nic_word(dev, AtimWnd, word); /* word |= */ | ||
2816 | |||
2817 | word = read_nic_word(dev, BintrItv); | ||
2818 | word &= ~BintrItv_BintrItv; | ||
2819 | word |= 1000; /* priv->ieee80211->current_network.beacon_interval * | ||
2820 | * ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); | ||
2821 | * FIXME: check if correct ^^ worked with 0x3e8; | ||
2822 | */ | ||
2823 | write_nic_word(dev, BintrItv, word); | ||
2824 | |||
2825 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
2826 | |||
2827 | rtl8185b_irq_enable(dev); | ||
2828 | } | ||
2829 | |||
2830 | static struct net_device_stats *rtl8180_stats(struct net_device *dev) | ||
2831 | { | ||
2832 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2833 | |||
2834 | return &priv->ieee80211->stats; | ||
2835 | } | ||
2836 | |||
2837 | /* | ||
2838 | * Change current and default preamble mode. | ||
2839 | */ | ||
2840 | static bool MgntActSet_802_11_PowerSaveMode(struct r8180_priv *priv, | ||
2841 | enum rt_ps_mode rtPsMode) | ||
2842 | { | ||
2843 | /* Currently, we do not change power save mode on IBSS mode. */ | ||
2844 | if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) | ||
2845 | return false; | ||
2846 | |||
2847 | priv->ieee80211->ps = rtPsMode; | ||
2848 | |||
2849 | return true; | ||
2850 | } | ||
2851 | |||
2852 | static void LeisurePSEnter(struct r8180_priv *priv) | ||
2853 | { | ||
2854 | if (priv->bLeisurePs) | ||
2855 | if (priv->ieee80211->ps == IEEE80211_PS_DISABLED) | ||
2856 | /* IEEE80211_PS_ENABLE */ | ||
2857 | MgntActSet_802_11_PowerSaveMode(priv, | ||
2858 | IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST); | ||
2859 | } | ||
2860 | |||
2861 | static void LeisurePSLeave(struct r8180_priv *priv) | ||
2862 | { | ||
2863 | if (priv->bLeisurePs) | ||
2864 | if (priv->ieee80211->ps != IEEE80211_PS_DISABLED) | ||
2865 | MgntActSet_802_11_PowerSaveMode( | ||
2866 | priv, IEEE80211_PS_DISABLED); | ||
2867 | } | ||
2868 | |||
2869 | void rtl8180_hw_wakeup_wq(struct work_struct *work) | ||
2870 | { | ||
2871 | struct delayed_work *dwork = to_delayed_work(work); | ||
2872 | struct ieee80211_device *ieee = container_of( | ||
2873 | dwork, struct ieee80211_device, hw_wakeup_wq); | ||
2874 | struct net_device *dev = ieee->dev; | ||
2875 | |||
2876 | rtl8180_hw_wakeup(dev); | ||
2877 | } | ||
2878 | |||
2879 | void rtl8180_hw_sleep_wq(struct work_struct *work) | ||
2880 | { | ||
2881 | struct delayed_work *dwork = to_delayed_work(work); | ||
2882 | struct ieee80211_device *ieee = container_of( | ||
2883 | dwork, struct ieee80211_device, hw_sleep_wq); | ||
2884 | struct net_device *dev = ieee->dev; | ||
2885 | |||
2886 | rtl8180_hw_sleep_down(dev); | ||
2887 | } | ||
2888 | |||
2889 | static void MgntLinkKeepAlive(struct r8180_priv *priv) | ||
2890 | { | ||
2891 | if (priv->keepAliveLevel == 0) | ||
2892 | return; | ||
2893 | |||
2894 | if (priv->ieee80211->state == IEEE80211_LINKED) { | ||
2895 | /* | ||
2896 | * Keep-Alive. | ||
2897 | */ | ||
2898 | |||
2899 | if ((priv->keepAliveLevel == 2) || | ||
2900 | (priv->link_detect.last_num_tx_unicast == | ||
2901 | priv->NumTxUnicast && | ||
2902 | priv->link_detect.last_num_rx_unicast == | ||
2903 | priv->ieee80211->NumRxUnicast) | ||
2904 | ) { | ||
2905 | priv->link_detect.idle_count++; | ||
2906 | |||
2907 | /* | ||
2908 | * Send a Keep-Alive packet packet to AP if we had | ||
2909 | * been idle for a while. | ||
2910 | */ | ||
2911 | if (priv->link_detect.idle_count >= | ||
2912 | KEEP_ALIVE_INTERVAL / | ||
2913 | CHECK_FOR_HANG_PERIOD - 1) { | ||
2914 | priv->link_detect.idle_count = 0; | ||
2915 | ieee80211_sta_ps_send_null_frame( | ||
2916 | priv->ieee80211, false); | ||
2917 | } | ||
2918 | } else { | ||
2919 | priv->link_detect.idle_count = 0; | ||
2920 | } | ||
2921 | priv->link_detect.last_num_tx_unicast = priv->NumTxUnicast; | ||
2922 | priv->link_detect.last_num_rx_unicast = | ||
2923 | priv->ieee80211->NumRxUnicast; | ||
2924 | } | ||
2925 | } | ||
2926 | |||
2927 | void rtl8180_watch_dog(struct net_device *dev) | ||
2928 | { | ||
2929 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2930 | bool bEnterPS = false; | ||
2931 | bool bBusyTraffic = false; | ||
2932 | u32 TotalRxNum = 0; | ||
2933 | u16 SlotIndex = 0; | ||
2934 | u16 i = 0; | ||
2935 | if (priv->ieee80211->actscanning == false) { | ||
2936 | if ((priv->ieee80211->iw_mode != IW_MODE_ADHOC) && | ||
2937 | (priv->ieee80211->state == IEEE80211_NOLINK) && | ||
2938 | (priv->ieee80211->beinretry == false) && | ||
2939 | (priv->eRFPowerState == RF_ON)) | ||
2940 | IPSEnter(dev); | ||
2941 | } | ||
2942 | if ((priv->ieee80211->state == IEEE80211_LINKED) && | ||
2943 | (priv->ieee80211->iw_mode == IW_MODE_INFRA)) { | ||
2944 | SlotIndex = (priv->link_detect.slot_index++) % | ||
2945 | priv->link_detect.slot_num; | ||
2946 | |||
2947 | priv->link_detect.rx_frame_num[SlotIndex] = | ||
2948 | priv->ieee80211->NumRxDataInPeriod + | ||
2949 | priv->ieee80211->NumRxBcnInPeriod; | ||
2950 | |||
2951 | for (i = 0; i < priv->link_detect.slot_num; i++) | ||
2952 | TotalRxNum += priv->link_detect.rx_frame_num[i]; | ||
2953 | |||
2954 | if (TotalRxNum == 0) { | ||
2955 | priv->ieee80211->state = IEEE80211_ASSOCIATING; | ||
2956 | queue_work(priv->ieee80211->wq, | ||
2957 | &priv->ieee80211->associate_procedure_wq); | ||
2958 | } | ||
2959 | } | ||
2960 | |||
2961 | MgntLinkKeepAlive(priv); | ||
2962 | |||
2963 | LeisurePSLeave(priv); | ||
2964 | |||
2965 | if (priv->ieee80211->state == IEEE80211_LINKED) { | ||
2966 | priv->link_detect.num_rx_ok_in_period = | ||
2967 | priv->ieee80211->NumRxDataInPeriod; | ||
2968 | if (priv->link_detect.num_rx_ok_in_period > 666 || | ||
2969 | priv->link_detect.num_tx_ok_in_period > 666) { | ||
2970 | bBusyTraffic = true; | ||
2971 | } | ||
2972 | if ((priv->link_detect.num_rx_ok_in_period + | ||
2973 | priv->link_detect.num_tx_ok_in_period > 8) | ||
2974 | || (priv->link_detect.num_rx_ok_in_period > 2)) { | ||
2975 | bEnterPS = false; | ||
2976 | } else | ||
2977 | bEnterPS = true; | ||
2978 | |||
2979 | if (bEnterPS) | ||
2980 | LeisurePSEnter(priv); | ||
2981 | else | ||
2982 | LeisurePSLeave(priv); | ||
2983 | } else | ||
2984 | LeisurePSLeave(priv); | ||
2985 | priv->link_detect.b_busy_traffic = bBusyTraffic; | ||
2986 | priv->link_detect.num_rx_ok_in_period = 0; | ||
2987 | priv->link_detect.num_tx_ok_in_period = 0; | ||
2988 | priv->ieee80211->NumRxDataInPeriod = 0; | ||
2989 | priv->ieee80211->NumRxBcnInPeriod = 0; | ||
2990 | } | ||
2991 | |||
2992 | static int _rtl8180_up(struct net_device *dev) | ||
2993 | { | ||
2994 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
2995 | |||
2996 | priv->up = 1; | ||
2997 | |||
2998 | DMESG("Bringing up iface"); | ||
2999 | rtl8185b_adapter_start(dev); | ||
3000 | rtl8185b_rx_enable(dev); | ||
3001 | rtl8185b_tx_enable(dev); | ||
3002 | if (priv->bInactivePs) { | ||
3003 | if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) | ||
3004 | IPSLeave(dev); | ||
3005 | } | ||
3006 | timer_rate_adaptive((unsigned long)dev); | ||
3007 | watch_dog_adaptive((unsigned long)dev); | ||
3008 | if (priv->bSwAntennaDiverity) | ||
3009 | SwAntennaDiversityTimerCallback(dev); | ||
3010 | ieee80211_softmac_start_protocol(priv->ieee80211); | ||
3011 | return 0; | ||
3012 | } | ||
3013 | |||
3014 | static int rtl8180_open(struct net_device *dev) | ||
3015 | { | ||
3016 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3017 | int ret; | ||
3018 | |||
3019 | down(&priv->wx_sem); | ||
3020 | ret = rtl8180_up(dev); | ||
3021 | up(&priv->wx_sem); | ||
3022 | return ret; | ||
3023 | } | ||
3024 | |||
3025 | int rtl8180_up(struct net_device *dev) | ||
3026 | { | ||
3027 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3028 | |||
3029 | if (priv->up == 1) | ||
3030 | return -1; | ||
3031 | |||
3032 | return _rtl8180_up(dev); | ||
3033 | } | ||
3034 | |||
3035 | static int rtl8180_close(struct net_device *dev) | ||
3036 | { | ||
3037 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3038 | int ret; | ||
3039 | |||
3040 | down(&priv->wx_sem); | ||
3041 | ret = rtl8180_down(dev); | ||
3042 | up(&priv->wx_sem); | ||
3043 | |||
3044 | return ret; | ||
3045 | } | ||
3046 | |||
3047 | int rtl8180_down(struct net_device *dev) | ||
3048 | { | ||
3049 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3050 | |||
3051 | if (priv->up == 0) | ||
3052 | return -1; | ||
3053 | |||
3054 | priv->up = 0; | ||
3055 | |||
3056 | ieee80211_softmac_stop_protocol(priv->ieee80211); | ||
3057 | /* FIXME */ | ||
3058 | if (!netif_queue_stopped(dev)) | ||
3059 | netif_stop_queue(dev); | ||
3060 | rtl8180_rtx_disable(dev); | ||
3061 | rtl8180_irq_disable(dev); | ||
3062 | del_timer_sync(&priv->watch_dog_timer); | ||
3063 | del_timer_sync(&priv->rateadapter_timer); | ||
3064 | cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); | ||
3065 | cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq); | ||
3066 | cancel_delayed_work(&priv->ieee80211->hw_sleep_wq); | ||
3067 | cancel_delayed_work(&priv->ieee80211->hw_dig_wq); | ||
3068 | cancel_delayed_work(&priv->ieee80211->tx_pw_wq); | ||
3069 | del_timer_sync(&priv->SwAntennaDiversityTimer); | ||
3070 | SetZebraRFPowerState8185(dev, RF_OFF); | ||
3071 | memset(&priv->ieee80211->current_network, | ||
3072 | 0, sizeof(struct ieee80211_network)); | ||
3073 | priv->ieee80211->state = IEEE80211_NOLINK; | ||
3074 | return 0; | ||
3075 | } | ||
3076 | |||
3077 | void rtl8180_restart_wq(struct work_struct *work) | ||
3078 | { | ||
3079 | struct r8180_priv *priv = container_of( | ||
3080 | work, struct r8180_priv, reset_wq); | ||
3081 | struct net_device *dev = priv->dev; | ||
3082 | |||
3083 | down(&priv->wx_sem); | ||
3084 | |||
3085 | rtl8180_commit(dev); | ||
3086 | |||
3087 | up(&priv->wx_sem); | ||
3088 | } | ||
3089 | |||
3090 | static void rtl8180_restart(struct net_device *dev) | ||
3091 | { | ||
3092 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3093 | |||
3094 | schedule_work(&priv->reset_wq); | ||
3095 | } | ||
3096 | |||
3097 | void rtl8180_commit(struct net_device *dev) | ||
3098 | { | ||
3099 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3100 | |||
3101 | if (priv->up == 0) | ||
3102 | return; | ||
3103 | |||
3104 | del_timer_sync(&priv->watch_dog_timer); | ||
3105 | del_timer_sync(&priv->rateadapter_timer); | ||
3106 | cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); | ||
3107 | cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq); | ||
3108 | cancel_delayed_work(&priv->ieee80211->hw_sleep_wq); | ||
3109 | cancel_delayed_work(&priv->ieee80211->hw_dig_wq); | ||
3110 | cancel_delayed_work(&priv->ieee80211->tx_pw_wq); | ||
3111 | del_timer_sync(&priv->SwAntennaDiversityTimer); | ||
3112 | ieee80211_softmac_stop_protocol(priv->ieee80211); | ||
3113 | rtl8180_irq_disable(dev); | ||
3114 | rtl8180_rtx_disable(dev); | ||
3115 | _rtl8180_up(dev); | ||
3116 | } | ||
3117 | |||
3118 | static void r8180_set_multicast(struct net_device *dev) | ||
3119 | { | ||
3120 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3121 | short promisc; | ||
3122 | |||
3123 | promisc = (dev->flags & IFF_PROMISC) ? 1 : 0; | ||
3124 | |||
3125 | if (promisc != priv->promisc) | ||
3126 | rtl8180_restart(dev); | ||
3127 | |||
3128 | priv->promisc = promisc; | ||
3129 | } | ||
3130 | |||
3131 | static int r8180_set_mac_adr(struct net_device *dev, void *mac) | ||
3132 | { | ||
3133 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3134 | struct sockaddr *addr = mac; | ||
3135 | |||
3136 | down(&priv->wx_sem); | ||
3137 | |||
3138 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | ||
3139 | |||
3140 | if (priv->ieee80211->iw_mode == IW_MODE_MASTER) | ||
3141 | memcpy(priv->ieee80211->current_network.bssid, | ||
3142 | dev->dev_addr, ETH_ALEN); | ||
3143 | |||
3144 | if (priv->up) { | ||
3145 | rtl8180_down(dev); | ||
3146 | rtl8180_up(dev); | ||
3147 | } | ||
3148 | |||
3149 | up(&priv->wx_sem); | ||
3150 | |||
3151 | return 0; | ||
3152 | } | ||
3153 | |||
3154 | /* based on ipw2200 driver */ | ||
3155 | static int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
3156 | { | ||
3157 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
3158 | struct iwreq *wrq = (struct iwreq *) rq; | ||
3159 | int ret = -1; | ||
3160 | |||
3161 | switch (cmd) { | ||
3162 | case RTL_IOCTL_WPA_SUPPLICANT: | ||
3163 | ret = ieee80211_wpa_supplicant_ioctl( | ||
3164 | priv->ieee80211, &wrq->u.data); | ||
3165 | return ret; | ||
3166 | default: | ||
3167 | return -EOPNOTSUPP; | ||
3168 | } | ||
3169 | |||
3170 | return -EOPNOTSUPP; | ||
3171 | } | ||
3172 | |||
3173 | static const struct net_device_ops rtl8180_netdev_ops = { | ||
3174 | .ndo_open = rtl8180_open, | ||
3175 | .ndo_stop = rtl8180_close, | ||
3176 | .ndo_get_stats = rtl8180_stats, | ||
3177 | .ndo_tx_timeout = rtl8180_restart, | ||
3178 | .ndo_do_ioctl = rtl8180_ioctl, | ||
3179 | .ndo_set_rx_mode = r8180_set_multicast, | ||
3180 | .ndo_set_mac_address = r8180_set_mac_adr, | ||
3181 | .ndo_validate_addr = eth_validate_addr, | ||
3182 | .ndo_change_mtu = eth_change_mtu, | ||
3183 | .ndo_start_xmit = ieee80211_rtl_xmit, | ||
3184 | }; | ||
3185 | |||
3186 | static int rtl8180_pci_probe(struct pci_dev *pdev, | ||
3187 | const struct pci_device_id *id) | ||
3188 | { | ||
3189 | unsigned long ioaddr = 0; | ||
3190 | struct net_device *dev = NULL; | ||
3191 | struct r8180_priv *priv = NULL; | ||
3192 | u8 unit = 0; | ||
3193 | int ret = -ENODEV; | ||
3194 | |||
3195 | unsigned long pmem_start, pmem_len, pmem_flags; | ||
3196 | |||
3197 | DMESG("Configuring chip resources"); | ||
3198 | |||
3199 | if (pci_enable_device(pdev)) { | ||
3200 | DMESG("Failed to enable PCI device"); | ||
3201 | return -EIO; | ||
3202 | } | ||
3203 | |||
3204 | pci_set_master(pdev); | ||
3205 | pci_set_dma_mask(pdev, 0xffffff00ULL); | ||
3206 | pci_set_consistent_dma_mask(pdev, 0xffffff00ULL); | ||
3207 | dev = alloc_ieee80211(sizeof(struct r8180_priv)); | ||
3208 | if (!dev) { | ||
3209 | ret = -ENOMEM; | ||
3210 | goto fail_free; | ||
3211 | } | ||
3212 | priv = ieee80211_priv(dev); | ||
3213 | priv->ieee80211 = netdev_priv(dev); | ||
3214 | |||
3215 | pci_set_drvdata(pdev, dev); | ||
3216 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
3217 | |||
3218 | priv = ieee80211_priv(dev); | ||
3219 | priv->pdev = pdev; | ||
3220 | |||
3221 | pmem_start = pci_resource_start(pdev, 1); | ||
3222 | pmem_len = pci_resource_len(pdev, 1); | ||
3223 | pmem_flags = pci_resource_flags(pdev, 1); | ||
3224 | |||
3225 | if (!(pmem_flags & IORESOURCE_MEM)) { | ||
3226 | DMESG("region #1 not a MMIO resource, aborting"); | ||
3227 | goto fail; | ||
3228 | } | ||
3229 | |||
3230 | if (!request_mem_region(pmem_start, pmem_len, RTL8180_MODULE_NAME)) { | ||
3231 | DMESG("request_mem_region failed!"); | ||
3232 | goto fail; | ||
3233 | } | ||
3234 | |||
3235 | ioaddr = (unsigned long)ioremap_nocache(pmem_start, pmem_len); | ||
3236 | if (ioaddr == (unsigned long)NULL) { | ||
3237 | DMESG("ioremap failed!"); | ||
3238 | goto fail1; | ||
3239 | } | ||
3240 | |||
3241 | dev->mem_start = ioaddr; /* shared mem start */ | ||
3242 | dev->mem_end = ioaddr + pci_resource_len(pdev, 0); /* shared mem end */ | ||
3243 | |||
3244 | pci_read_config_byte(pdev, 0x05, &unit); | ||
3245 | pci_write_config_byte(pdev, 0x05, unit & (~0x04)); | ||
3246 | |||
3247 | dev->irq = pdev->irq; | ||
3248 | priv->irq = 0; | ||
3249 | |||
3250 | dev->netdev_ops = &rtl8180_netdev_ops; | ||
3251 | dev->wireless_handlers = &r8180_wx_handlers_def; | ||
3252 | |||
3253 | dev->type = ARPHRD_ETHER; | ||
3254 | dev->watchdog_timeo = HZ*3; | ||
3255 | |||
3256 | if (dev_alloc_name(dev, ifname) < 0) { | ||
3257 | DMESG("Oops: devname already taken! Trying wlan%%d...\n"); | ||
3258 | strcpy(ifname, "wlan%d"); | ||
3259 | dev_alloc_name(dev, ifname); | ||
3260 | } | ||
3261 | |||
3262 | if (rtl8180_init(dev) != 0) { | ||
3263 | DMESG("Initialization failed"); | ||
3264 | goto fail1; | ||
3265 | } | ||
3266 | |||
3267 | netif_carrier_off(dev); | ||
3268 | |||
3269 | if (register_netdev(dev)) | ||
3270 | goto fail1; | ||
3271 | |||
3272 | rtl8180_proc_init_one(dev); | ||
3273 | |||
3274 | DMESG("Driver probe completed\n"); | ||
3275 | return 0; | ||
3276 | fail1: | ||
3277 | if (dev->mem_start != (unsigned long)NULL) { | ||
3278 | iounmap((void __iomem *)dev->mem_start); | ||
3279 | release_mem_region(pci_resource_start(pdev, 1), | ||
3280 | pci_resource_len(pdev, 1)); | ||
3281 | } | ||
3282 | fail: | ||
3283 | if (dev) { | ||
3284 | if (priv->irq) { | ||
3285 | free_irq(dev->irq, dev); | ||
3286 | dev->irq = 0; | ||
3287 | } | ||
3288 | free_ieee80211(dev); | ||
3289 | } | ||
3290 | |||
3291 | fail_free: | ||
3292 | pci_disable_device(pdev); | ||
3293 | |||
3294 | DMESG("wlan driver load failed\n"); | ||
3295 | return ret; | ||
3296 | } | ||
3297 | |||
3298 | static void rtl8180_pci_remove(struct pci_dev *pdev) | ||
3299 | { | ||
3300 | struct r8180_priv *priv; | ||
3301 | struct net_device *dev = pci_get_drvdata(pdev); | ||
3302 | |||
3303 | if (dev) { | ||
3304 | unregister_netdev(dev); | ||
3305 | |||
3306 | priv = ieee80211_priv(dev); | ||
3307 | |||
3308 | rtl8180_proc_remove_one(dev); | ||
3309 | rtl8180_down(dev); | ||
3310 | priv->rf_close(dev); | ||
3311 | rtl8180_reset(dev); | ||
3312 | mdelay(10); | ||
3313 | |||
3314 | if (priv->irq) { | ||
3315 | DMESG("Freeing irq %d", dev->irq); | ||
3316 | free_irq(dev->irq, dev); | ||
3317 | priv->irq = 0; | ||
3318 | } | ||
3319 | |||
3320 | free_rx_desc_ring(dev); | ||
3321 | free_tx_desc_rings(dev); | ||
3322 | |||
3323 | if (dev->mem_start != (unsigned long)NULL) { | ||
3324 | iounmap((void __iomem *)dev->mem_start); | ||
3325 | release_mem_region(pci_resource_start(pdev, 1), | ||
3326 | pci_resource_len(pdev, 1)); | ||
3327 | } | ||
3328 | |||
3329 | free_ieee80211(dev); | ||
3330 | } | ||
3331 | pci_disable_device(pdev); | ||
3332 | |||
3333 | DMESG("wlan driver removed\n"); | ||
3334 | } | ||
3335 | |||
3336 | static int __init rtl8180_pci_module_init(void) | ||
3337 | { | ||
3338 | int ret; | ||
3339 | |||
3340 | ret = ieee80211_crypto_init(); | ||
3341 | if (ret) { | ||
3342 | pr_err("ieee80211_crypto_init() failed %d\n", ret); | ||
3343 | return ret; | ||
3344 | } | ||
3345 | ret = ieee80211_crypto_tkip_init(); | ||
3346 | if (ret) { | ||
3347 | pr_err("ieee80211_crypto_tkip_init() failed %d\n", ret); | ||
3348 | return ret; | ||
3349 | } | ||
3350 | ret = ieee80211_crypto_ccmp_init(); | ||
3351 | if (ret) { | ||
3352 | pr_err("ieee80211_crypto_ccmp_init() failed %d\n", ret); | ||
3353 | return ret; | ||
3354 | } | ||
3355 | ret = ieee80211_crypto_wep_init(); | ||
3356 | if (ret) { | ||
3357 | pr_err("ieee80211_crypto_wep_init() failed %d\n", ret); | ||
3358 | return ret; | ||
3359 | } | ||
3360 | |||
3361 | pr_info("\nLinux kernel driver for RTL8180 / RTL8185 based WLAN cards\n"); | ||
3362 | pr_info("Copyright (c) 2004-2005, Andrea Merello\n"); | ||
3363 | DMESG("Initializing module"); | ||
3364 | DMESG("Wireless extensions version %d", WIRELESS_EXT); | ||
3365 | rtl8180_proc_module_init(); | ||
3366 | |||
3367 | if (pci_register_driver(&rtl8180_pci_driver)) { | ||
3368 | DMESG("No device found"); | ||
3369 | return -ENODEV; | ||
3370 | } | ||
3371 | return 0; | ||
3372 | } | ||
3373 | |||
3374 | static void __exit rtl8180_pci_module_exit(void) | ||
3375 | { | ||
3376 | pci_unregister_driver(&rtl8180_pci_driver); | ||
3377 | rtl8180_proc_module_remove(); | ||
3378 | ieee80211_crypto_tkip_exit(); | ||
3379 | ieee80211_crypto_ccmp_exit(); | ||
3380 | ieee80211_crypto_wep_exit(); | ||
3381 | ieee80211_crypto_deinit(); | ||
3382 | DMESG("Exiting"); | ||
3383 | } | ||
3384 | |||
3385 | static void rtl8180_try_wake_queue(struct net_device *dev, int pri) | ||
3386 | { | ||
3387 | unsigned long flags; | ||
3388 | short enough_desc; | ||
3389 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
3390 | |||
3391 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
3392 | enough_desc = check_nic_enought_desc(dev, pri); | ||
3393 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
3394 | |||
3395 | if (enough_desc) | ||
3396 | ieee80211_rtl_wake_queue(priv->ieee80211); | ||
3397 | } | ||
3398 | |||
3399 | static void rtl8180_tx_isr(struct net_device *dev, int pri, short error) | ||
3400 | { | ||
3401 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
3402 | u32 *tail; /* tail virtual addr */ | ||
3403 | u32 *head; /* head virtual addr */ | ||
3404 | u32 *begin; /* start of ring virtual addr */ | ||
3405 | u32 *nicv; /* nic pointer virtual addr */ | ||
3406 | u32 nic; /* nic pointer physical addr */ | ||
3407 | u32 nicbegin; /* start of ring physical addr */ | ||
3408 | unsigned long flag; | ||
3409 | /* physical addr are ok on 32 bits since we set DMA mask */ | ||
3410 | int offs; | ||
3411 | int j, i; | ||
3412 | int hd; | ||
3413 | if (error) | ||
3414 | priv->stats.txretry++; | ||
3415 | spin_lock_irqsave(&priv->tx_lock, flag); | ||
3416 | switch (pri) { | ||
3417 | case MANAGE_PRIORITY: | ||
3418 | tail = priv->txmapringtail; | ||
3419 | begin = priv->txmapring; | ||
3420 | head = priv->txmapringhead; | ||
3421 | nic = read_nic_dword(dev, TX_MANAGEPRIORITY_RING_ADDR); | ||
3422 | nicbegin = priv->txmapringdma; | ||
3423 | break; | ||
3424 | case BK_PRIORITY: | ||
3425 | tail = priv->txbkpringtail; | ||
3426 | begin = priv->txbkpring; | ||
3427 | head = priv->txbkpringhead; | ||
3428 | nic = read_nic_dword(dev, TX_BKPRIORITY_RING_ADDR); | ||
3429 | nicbegin = priv->txbkpringdma; | ||
3430 | break; | ||
3431 | case BE_PRIORITY: | ||
3432 | tail = priv->txbepringtail; | ||
3433 | begin = priv->txbepring; | ||
3434 | head = priv->txbepringhead; | ||
3435 | nic = read_nic_dword(dev, TX_BEPRIORITY_RING_ADDR); | ||
3436 | nicbegin = priv->txbepringdma; | ||
3437 | break; | ||
3438 | case VI_PRIORITY: | ||
3439 | tail = priv->txvipringtail; | ||
3440 | begin = priv->txvipring; | ||
3441 | head = priv->txvipringhead; | ||
3442 | nic = read_nic_dword(dev, TX_VIPRIORITY_RING_ADDR); | ||
3443 | nicbegin = priv->txvipringdma; | ||
3444 | break; | ||
3445 | case VO_PRIORITY: | ||
3446 | tail = priv->txvopringtail; | ||
3447 | begin = priv->txvopring; | ||
3448 | head = priv->txvopringhead; | ||
3449 | nic = read_nic_dword(dev, TX_VOPRIORITY_RING_ADDR); | ||
3450 | nicbegin = priv->txvopringdma; | ||
3451 | break; | ||
3452 | case HI_PRIORITY: | ||
3453 | tail = priv->txhpringtail; | ||
3454 | begin = priv->txhpring; | ||
3455 | head = priv->txhpringhead; | ||
3456 | nic = read_nic_dword(dev, TX_HIGHPRIORITY_RING_ADDR); | ||
3457 | nicbegin = priv->txhpringdma; | ||
3458 | break; | ||
3459 | |||
3460 | default: | ||
3461 | spin_unlock_irqrestore(&priv->tx_lock, flag); | ||
3462 | return; | ||
3463 | } | ||
3464 | |||
3465 | nicv = (u32 *)((nic - nicbegin) + (u8 *)begin); | ||
3466 | if ((head <= tail && (nicv > tail || nicv < head)) || | ||
3467 | (head > tail && (nicv > tail && nicv < head))) { | ||
3468 | DMESGW("nic has lost pointer"); | ||
3469 | spin_unlock_irqrestore(&priv->tx_lock, flag); | ||
3470 | rtl8180_restart(dev); | ||
3471 | return; | ||
3472 | } | ||
3473 | |||
3474 | /* | ||
3475 | * We check all the descriptors between the head and the nic, | ||
3476 | * but not the currently pointed by the nic (the next to be txed) | ||
3477 | * and the previous of the pointed (might be in process ??) | ||
3478 | */ | ||
3479 | offs = (nic - nicbegin); | ||
3480 | offs = offs / 8 / 4; | ||
3481 | hd = (head - begin) / 8; | ||
3482 | |||
3483 | if (offs >= hd) | ||
3484 | j = offs - hd; | ||
3485 | else | ||
3486 | j = offs + (priv->txringcount-1-hd); | ||
3487 | |||
3488 | j -= 2; | ||
3489 | if (j < 0) | ||
3490 | j = 0; | ||
3491 | |||
3492 | for (i = 0; i < j; i++) { | ||
3493 | if ((*head) & (1<<31)) | ||
3494 | break; | ||
3495 | if (((*head)&(0x10000000)) != 0) { | ||
3496 | priv->CurrRetryCnt += (u16)((*head) & (0x000000ff)); | ||
3497 | if (!error) | ||
3498 | priv->NumTxOkTotal++; | ||
3499 | } | ||
3500 | |||
3501 | if (!error) | ||
3502 | priv->NumTxOkBytesTotal += (*(head+3)) & (0x00000fff); | ||
3503 | |||
3504 | *head = *head & ~(1<<31); | ||
3505 | |||
3506 | if ((head - begin)/8 == priv->txringcount-1) | ||
3507 | head = begin; | ||
3508 | else | ||
3509 | head += 8; | ||
3510 | } | ||
3511 | |||
3512 | /* | ||
3513 | * The head has been moved to the last certainly TXed | ||
3514 | * (or at least processed by the nic) packet. | ||
3515 | * The driver take forcefully owning of all these packets | ||
3516 | * If the packet previous of the nic pointer has been | ||
3517 | * processed this doesn't matter: it will be checked | ||
3518 | * here at the next round. Anyway if no more packet are | ||
3519 | * TXed no memory leak occur at all. | ||
3520 | */ | ||
3521 | |||
3522 | switch (pri) { | ||
3523 | case MANAGE_PRIORITY: | ||
3524 | priv->txmapringhead = head; | ||
3525 | |||
3526 | if (priv->ack_tx_to_ieee) { | ||
3527 | if (rtl8180_is_tx_queue_empty(dev)) { | ||
3528 | priv->ack_tx_to_ieee = 0; | ||
3529 | ieee80211_ps_tx_ack(priv->ieee80211, !error); | ||
3530 | } | ||
3531 | } | ||
3532 | break; | ||
3533 | case BK_PRIORITY: | ||
3534 | priv->txbkpringhead = head; | ||
3535 | break; | ||
3536 | case BE_PRIORITY: | ||
3537 | priv->txbepringhead = head; | ||
3538 | break; | ||
3539 | case VI_PRIORITY: | ||
3540 | priv->txvipringhead = head; | ||
3541 | break; | ||
3542 | case VO_PRIORITY: | ||
3543 | priv->txvopringhead = head; | ||
3544 | break; | ||
3545 | case HI_PRIORITY: | ||
3546 | priv->txhpringhead = head; | ||
3547 | break; | ||
3548 | } | ||
3549 | |||
3550 | spin_unlock_irqrestore(&priv->tx_lock, flag); | ||
3551 | } | ||
3552 | |||
3553 | static irqreturn_t rtl8180_interrupt(int irq, void *netdev) | ||
3554 | { | ||
3555 | struct net_device *dev = (struct net_device *) netdev; | ||
3556 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
3557 | unsigned long flags; | ||
3558 | u32 inta; | ||
3559 | |||
3560 | /* We should return IRQ_NONE, but for now let me keep this */ | ||
3561 | if (priv->irq_enabled == 0) | ||
3562 | return IRQ_HANDLED; | ||
3563 | |||
3564 | spin_lock_irqsave(&priv->irq_th_lock, flags); | ||
3565 | |||
3566 | /* ISR: 4bytes */ | ||
3567 | inta = read_nic_dword(dev, ISR); | ||
3568 | write_nic_dword(dev, ISR, inta); /* reset int situation */ | ||
3569 | |||
3570 | priv->stats.shints++; | ||
3571 | |||
3572 | if (!inta) { | ||
3573 | spin_unlock_irqrestore(&priv->irq_th_lock, flags); | ||
3574 | return IRQ_HANDLED; | ||
3575 | /* | ||
3576 | * most probably we can safely return IRQ_NONE, | ||
3577 | * but for now is better to avoid problems | ||
3578 | */ | ||
3579 | } | ||
3580 | |||
3581 | if (inta == 0xffff) { | ||
3582 | /* HW disappeared */ | ||
3583 | spin_unlock_irqrestore(&priv->irq_th_lock, flags); | ||
3584 | return IRQ_HANDLED; | ||
3585 | } | ||
3586 | |||
3587 | priv->stats.ints++; | ||
3588 | |||
3589 | if (!netif_running(dev)) { | ||
3590 | spin_unlock_irqrestore(&priv->irq_th_lock, flags); | ||
3591 | return IRQ_HANDLED; | ||
3592 | } | ||
3593 | |||
3594 | if (inta & ISR_TimeOut) | ||
3595 | write_nic_dword(dev, TimerInt, 0); | ||
3596 | |||
3597 | if (inta & ISR_TBDOK) | ||
3598 | priv->stats.txbeacon++; | ||
3599 | |||
3600 | if (inta & ISR_TBDER) | ||
3601 | priv->stats.txbeaconerr++; | ||
3602 | |||
3603 | if (inta & IMR_TMGDOK) | ||
3604 | rtl8180_tx_isr(dev, MANAGE_PRIORITY, 0); | ||
3605 | |||
3606 | if (inta & ISR_THPDER) { | ||
3607 | priv->stats.txhperr++; | ||
3608 | rtl8180_tx_isr(dev, HI_PRIORITY, 1); | ||
3609 | priv->ieee80211->stats.tx_errors++; | ||
3610 | } | ||
3611 | |||
3612 | if (inta & ISR_THPDOK) { /* High priority tx ok */ | ||
3613 | priv->link_detect.num_tx_ok_in_period++; | ||
3614 | priv->stats.txhpokint++; | ||
3615 | rtl8180_tx_isr(dev, HI_PRIORITY, 0); | ||
3616 | } | ||
3617 | |||
3618 | if (inta & ISR_RER) | ||
3619 | priv->stats.rxerr++; | ||
3620 | |||
3621 | if (inta & ISR_TBKDER) { /* corresponding to BK_PRIORITY */ | ||
3622 | priv->stats.txbkperr++; | ||
3623 | priv->ieee80211->stats.tx_errors++; | ||
3624 | rtl8180_tx_isr(dev, BK_PRIORITY, 1); | ||
3625 | rtl8180_try_wake_queue(dev, BK_PRIORITY); | ||
3626 | } | ||
3627 | |||
3628 | if (inta & ISR_TBEDER) { /* corresponding to BE_PRIORITY */ | ||
3629 | priv->stats.txbeperr++; | ||
3630 | priv->ieee80211->stats.tx_errors++; | ||
3631 | rtl8180_tx_isr(dev, BE_PRIORITY, 1); | ||
3632 | rtl8180_try_wake_queue(dev, BE_PRIORITY); | ||
3633 | } | ||
3634 | if (inta & ISR_TNPDER) { /* corresponding to VO_PRIORITY */ | ||
3635 | priv->stats.txnperr++; | ||
3636 | priv->ieee80211->stats.tx_errors++; | ||
3637 | rtl8180_tx_isr(dev, NORM_PRIORITY, 1); | ||
3638 | rtl8180_try_wake_queue(dev, NORM_PRIORITY); | ||
3639 | } | ||
3640 | |||
3641 | if (inta & ISR_TLPDER) { /* corresponding to VI_PRIORITY */ | ||
3642 | priv->stats.txlperr++; | ||
3643 | priv->ieee80211->stats.tx_errors++; | ||
3644 | rtl8180_tx_isr(dev, LOW_PRIORITY, 1); | ||
3645 | rtl8180_try_wake_queue(dev, LOW_PRIORITY); | ||
3646 | } | ||
3647 | |||
3648 | if (inta & ISR_ROK) { | ||
3649 | priv->stats.rxint++; | ||
3650 | tasklet_schedule(&priv->irq_rx_tasklet); | ||
3651 | } | ||
3652 | |||
3653 | if (inta & ISR_RQoSOK) { | ||
3654 | priv->stats.rxint++; | ||
3655 | tasklet_schedule(&priv->irq_rx_tasklet); | ||
3656 | } | ||
3657 | |||
3658 | if (inta & ISR_BcnInt) | ||
3659 | rtl8180_prepare_beacon(dev); | ||
3660 | |||
3661 | if (inta & ISR_RDU) { | ||
3662 | DMESGW("No RX descriptor available"); | ||
3663 | priv->stats.rxrdu++; | ||
3664 | tasklet_schedule(&priv->irq_rx_tasklet); | ||
3665 | } | ||
3666 | |||
3667 | if (inta & ISR_RXFOVW) { | ||
3668 | priv->stats.rxoverflow++; | ||
3669 | tasklet_schedule(&priv->irq_rx_tasklet); | ||
3670 | } | ||
3671 | |||
3672 | if (inta & ISR_TXFOVW) | ||
3673 | priv->stats.txoverflow++; | ||
3674 | |||
3675 | if (inta & ISR_TNPDOK) { /* Normal priority tx ok */ | ||
3676 | priv->link_detect.num_tx_ok_in_period++; | ||
3677 | priv->stats.txnpokint++; | ||
3678 | rtl8180_tx_isr(dev, NORM_PRIORITY, 0); | ||
3679 | rtl8180_try_wake_queue(dev, NORM_PRIORITY); | ||
3680 | } | ||
3681 | |||
3682 | if (inta & ISR_TLPDOK) { /* Low priority tx ok */ | ||
3683 | priv->link_detect.num_tx_ok_in_period++; | ||
3684 | priv->stats.txlpokint++; | ||
3685 | rtl8180_tx_isr(dev, LOW_PRIORITY, 0); | ||
3686 | rtl8180_try_wake_queue(dev, LOW_PRIORITY); | ||
3687 | } | ||
3688 | |||
3689 | if (inta & ISR_TBKDOK) { /* corresponding to BK_PRIORITY */ | ||
3690 | priv->stats.txbkpokint++; | ||
3691 | priv->link_detect.num_tx_ok_in_period++; | ||
3692 | rtl8180_tx_isr(dev, BK_PRIORITY, 0); | ||
3693 | rtl8180_try_wake_queue(dev, BE_PRIORITY); | ||
3694 | } | ||
3695 | |||
3696 | if (inta & ISR_TBEDOK) { /* corresponding to BE_PRIORITY */ | ||
3697 | priv->stats.txbeperr++; | ||
3698 | priv->link_detect.num_tx_ok_in_period++; | ||
3699 | rtl8180_tx_isr(dev, BE_PRIORITY, 0); | ||
3700 | rtl8180_try_wake_queue(dev, BE_PRIORITY); | ||
3701 | } | ||
3702 | force_pci_posting(dev); | ||
3703 | spin_unlock_irqrestore(&priv->irq_th_lock, flags); | ||
3704 | |||
3705 | return IRQ_HANDLED; | ||
3706 | } | ||
3707 | |||
3708 | void rtl8180_irq_rx_tasklet(struct r8180_priv *priv) | ||
3709 | { | ||
3710 | rtl8180_rx(priv->dev); | ||
3711 | } | ||
3712 | |||
3713 | void GPIOChangeRFWorkItemCallBack(struct work_struct *work) | ||
3714 | { | ||
3715 | struct ieee80211_device *ieee = container_of( | ||
3716 | work, struct ieee80211_device, GPIOChangeRFWorkItem.work); | ||
3717 | struct net_device *dev = ieee->dev; | ||
3718 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
3719 | u8 btPSR; | ||
3720 | u8 btConfig0; | ||
3721 | enum rt_rf_power_state eRfPowerStateToSet; | ||
3722 | bool bActuallySet = false; | ||
3723 | |||
3724 | char *argv[3]; | ||
3725 | static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh"; | ||
3726 | static char *envp[] = {"HOME=/", "TERM=linux", | ||
3727 | "PATH=/usr/bin:/bin", NULL}; | ||
3728 | static int readf_count; | ||
3729 | |||
3730 | readf_count = (readf_count+1)%0xffff; | ||
3731 | /* We should turn off LED before polling FF51[4]. */ | ||
3732 | |||
3733 | /* Turn off LED. */ | ||
3734 | btPSR = read_nic_byte(dev, PSR); | ||
3735 | write_nic_byte(dev, PSR, (btPSR & ~BIT3)); | ||
3736 | |||
3737 | /* It need to delay 4us suggested */ | ||
3738 | udelay(4); | ||
3739 | |||
3740 | /* HW radio On/Off according to the value of FF51[4](config0) */ | ||
3741 | btConfig0 = btPSR = read_nic_byte(dev, CONFIG0); | ||
3742 | |||
3743 | eRfPowerStateToSet = (btConfig0 & BIT4) ? RF_ON : RF_OFF; | ||
3744 | |||
3745 | /* Turn LED back on when radio enabled */ | ||
3746 | if (eRfPowerStateToSet == RF_ON) | ||
3747 | write_nic_byte(dev, PSR, btPSR | BIT3); | ||
3748 | |||
3749 | if ((priv->ieee80211->bHwRadioOff == true) && | ||
3750 | (eRfPowerStateToSet == RF_ON)) { | ||
3751 | priv->ieee80211->bHwRadioOff = false; | ||
3752 | bActuallySet = true; | ||
3753 | } else if ((priv->ieee80211->bHwRadioOff == false) && | ||
3754 | (eRfPowerStateToSet == RF_OFF)) { | ||
3755 | priv->ieee80211->bHwRadioOff = true; | ||
3756 | bActuallySet = true; | ||
3757 | } | ||
3758 | |||
3759 | if (bActuallySet) { | ||
3760 | MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); | ||
3761 | |||
3762 | /* To update the UI status for Power status changed */ | ||
3763 | if (priv->ieee80211->bHwRadioOff == true) | ||
3764 | argv[1] = "RFOFF"; | ||
3765 | else | ||
3766 | argv[1] = "RFON"; | ||
3767 | argv[0] = RadioPowerPath; | ||
3768 | argv[2] = NULL; | ||
3769 | |||
3770 | call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); | ||
3771 | } | ||
3772 | } | ||
3773 | |||
3774 | module_init(rtl8180_pci_module_init); | ||
3775 | module_exit(rtl8180_pci_module_exit); | ||
diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c deleted file mode 100644 index 8c020e064869..000000000000 --- a/drivers/staging/rtl8187se/r8180_dm.c +++ /dev/null | |||
@@ -1,1139 +0,0 @@ | |||
1 | #include "r8180_dm.h" | ||
2 | #include "r8180_hw.h" | ||
3 | #include "r8180_93cx6.h" | ||
4 | |||
5 | /* Return TRUE if we shall perform High Power Mechanism, FALSE otherwise. */ | ||
6 | #define RATE_ADAPTIVE_TIMER_PERIOD 300 | ||
7 | |||
8 | bool CheckHighPower(struct net_device *dev) | ||
9 | { | ||
10 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
11 | struct ieee80211_device *ieee = priv->ieee80211; | ||
12 | |||
13 | if (!priv->bRegHighPowerMechanism) | ||
14 | return false; | ||
15 | |||
16 | if (ieee->state == IEEE80211_LINKED_SCANNING) | ||
17 | return false; | ||
18 | |||
19 | return true; | ||
20 | } | ||
21 | |||
22 | /* | ||
23 | * Description: | ||
24 | * Update Tx power level if necessary. | ||
25 | * See also DoRxHighPower() and SetTxPowerLevel8185() for reference. | ||
26 | * | ||
27 | * Note: | ||
28 | * The reason why we udpate Tx power level here instead of DoRxHighPower() | ||
29 | * is the number of IO to change Tx power is much more than channel TR switch | ||
30 | * and they are related to OFDM and MAC registers. | ||
31 | * So, we don't want to update it so frequently in per-Rx packet base. | ||
32 | */ | ||
33 | static void DoTxHighPower(struct net_device *dev) | ||
34 | { | ||
35 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
36 | u16 HiPwrUpperTh = 0; | ||
37 | u16 HiPwrLowerTh = 0; | ||
38 | u8 RSSIHiPwrUpperTh; | ||
39 | u8 RSSIHiPwrLowerTh; | ||
40 | u8 u1bTmp; | ||
41 | char OfdmTxPwrIdx, CckTxPwrIdx; | ||
42 | |||
43 | HiPwrUpperTh = priv->RegHiPwrUpperTh; | ||
44 | HiPwrLowerTh = priv->RegHiPwrLowerTh; | ||
45 | |||
46 | HiPwrUpperTh = HiPwrUpperTh * 10; | ||
47 | HiPwrLowerTh = HiPwrLowerTh * 10; | ||
48 | RSSIHiPwrUpperTh = priv->RegRSSIHiPwrUpperTh; | ||
49 | RSSIHiPwrLowerTh = priv->RegRSSIHiPwrLowerTh; | ||
50 | |||
51 | /* lzm add 080826 */ | ||
52 | OfdmTxPwrIdx = priv->chtxpwr_ofdm[priv->ieee80211->current_network.channel]; | ||
53 | CckTxPwrIdx = priv->chtxpwr[priv->ieee80211->current_network.channel]; | ||
54 | |||
55 | if ((priv->UndecoratedSmoothedSS > HiPwrUpperTh) || | ||
56 | (priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) { | ||
57 | /* Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah */ | ||
58 | |||
59 | priv->bToUpdateTxPwr = true; | ||
60 | u1bTmp = read_nic_byte(dev, CCK_TXAGC); | ||
61 | |||
62 | /* If it never enter High Power. */ | ||
63 | if (CckTxPwrIdx == u1bTmp) { | ||
64 | u1bTmp = (u1bTmp > 16) ? (u1bTmp - 16) : 0; /* 8dbm */ | ||
65 | write_nic_byte(dev, CCK_TXAGC, u1bTmp); | ||
66 | |||
67 | u1bTmp = read_nic_byte(dev, OFDM_TXAGC); | ||
68 | u1bTmp = (u1bTmp > 16) ? (u1bTmp - 16) : 0; /* 8dbm */ | ||
69 | write_nic_byte(dev, OFDM_TXAGC, u1bTmp); | ||
70 | } | ||
71 | |||
72 | } else if ((priv->UndecoratedSmoothedSS < HiPwrLowerTh) && | ||
73 | (!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) { | ||
74 | if (priv->bToUpdateTxPwr) { | ||
75 | priv->bToUpdateTxPwr = false; | ||
76 | /* SD3 required. */ | ||
77 | u1bTmp = read_nic_byte(dev, CCK_TXAGC); | ||
78 | if (u1bTmp < CckTxPwrIdx) { | ||
79 | write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx); | ||
80 | } | ||
81 | |||
82 | u1bTmp = read_nic_byte(dev, OFDM_TXAGC); | ||
83 | if (u1bTmp < OfdmTxPwrIdx) { | ||
84 | write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx); | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
90 | |||
91 | /* | ||
92 | * Description: | ||
93 | * Callback function of UpdateTxPowerWorkItem. | ||
94 | * Because of some event happened, e.g. CCX TPC, High Power Mechanism, | ||
95 | * We update Tx power of current channel again. | ||
96 | */ | ||
97 | void rtl8180_tx_pw_wq(struct work_struct *work) | ||
98 | { | ||
99 | struct delayed_work *dwork = to_delayed_work(work); | ||
100 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, tx_pw_wq); | ||
101 | struct net_device *dev = ieee->dev; | ||
102 | |||
103 | DoTxHighPower(dev); | ||
104 | } | ||
105 | |||
106 | |||
107 | /* | ||
108 | * Return TRUE if we shall perform DIG Mechanism, FALSE otherwise. | ||
109 | */ | ||
110 | bool CheckDig(struct net_device *dev) | ||
111 | { | ||
112 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
113 | struct ieee80211_device *ieee = priv->ieee80211; | ||
114 | |||
115 | if (!priv->bDigMechanism) | ||
116 | return false; | ||
117 | |||
118 | if (ieee->state != IEEE80211_LINKED) | ||
119 | return false; | ||
120 | |||
121 | if ((priv->ieee80211->rate / 5) < 36) /* Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. */ | ||
122 | return false; | ||
123 | return true; | ||
124 | } | ||
125 | /* | ||
126 | * Implementation of DIG for Zebra and Zebra2. | ||
127 | */ | ||
128 | static void DIG_Zebra(struct net_device *dev) | ||
129 | { | ||
130 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
131 | u16 CCKFalseAlarm, OFDMFalseAlarm; | ||
132 | u16 OfdmFA1, OfdmFA2; | ||
133 | int InitialGainStep = 7; /* The number of initial gain stages. */ | ||
134 | int LowestGainStage = 4; /* The capable lowest stage of performing dig workitem. */ | ||
135 | u32 AwakePeriodIn2Sec = 0; | ||
136 | |||
137 | CCKFalseAlarm = (u16)(priv->FalseAlarmRegValue & 0x0000ffff); | ||
138 | OFDMFalseAlarm = (u16)((priv->FalseAlarmRegValue >> 16) & 0x0000ffff); | ||
139 | OfdmFA1 = 0x15; | ||
140 | OfdmFA2 = ((u16)(priv->RegDigOfdmFaUpTh)) << 8; | ||
141 | |||
142 | /* The number of initial gain steps is different, by Bruce, 2007-04-13. */ | ||
143 | if (priv->InitialGain == 0) { /* autoDIG */ | ||
144 | /* Advised from SD3 DZ */ | ||
145 | priv->InitialGain = 4; /* In 87B, m74dBm means State 4 (m82dBm) */ | ||
146 | } | ||
147 | /* Advised from SD3 DZ */ | ||
148 | OfdmFA1 = 0x20; | ||
149 | |||
150 | #if 1 /* lzm reserved 080826 */ | ||
151 | AwakePeriodIn2Sec = (2000 - priv->DozePeriodInPast2Sec); | ||
152 | priv->DozePeriodInPast2Sec = 0; | ||
153 | |||
154 | if (AwakePeriodIn2Sec) { | ||
155 | OfdmFA1 = (u16)((OfdmFA1 * AwakePeriodIn2Sec) / 2000); | ||
156 | OfdmFA2 = (u16)((OfdmFA2 * AwakePeriodIn2Sec) / 2000); | ||
157 | } else { | ||
158 | ; | ||
159 | } | ||
160 | #endif | ||
161 | |||
162 | InitialGainStep = 8; | ||
163 | LowestGainStage = priv->RegBModeGainStage; /* Lowest gain stage. */ | ||
164 | |||
165 | if (OFDMFalseAlarm > OfdmFA1) { | ||
166 | if (OFDMFalseAlarm > OfdmFA2) { | ||
167 | priv->DIG_NumberFallbackVote++; | ||
168 | if (priv->DIG_NumberFallbackVote > 1) { | ||
169 | /* serious OFDM False Alarm, need fallback */ | ||
170 | if (priv->InitialGain < InitialGainStep) { | ||
171 | priv->InitialGainBackUp = priv->InitialGain; | ||
172 | |||
173 | priv->InitialGain = (priv->InitialGain + 1); | ||
174 | UpdateInitialGain(dev); | ||
175 | } | ||
176 | priv->DIG_NumberFallbackVote = 0; | ||
177 | priv->DIG_NumberUpgradeVote = 0; | ||
178 | } | ||
179 | } else { | ||
180 | if (priv->DIG_NumberFallbackVote) | ||
181 | priv->DIG_NumberFallbackVote--; | ||
182 | } | ||
183 | priv->DIG_NumberUpgradeVote = 0; | ||
184 | } else { | ||
185 | if (priv->DIG_NumberFallbackVote) | ||
186 | priv->DIG_NumberFallbackVote--; | ||
187 | priv->DIG_NumberUpgradeVote++; | ||
188 | |||
189 | if (priv->DIG_NumberUpgradeVote > 9) { | ||
190 | if (priv->InitialGain > LowestGainStage) { /* In 87B, m78dBm means State 4 (m864dBm) */ | ||
191 | priv->InitialGainBackUp = priv->InitialGain; | ||
192 | |||
193 | priv->InitialGain = (priv->InitialGain - 1); | ||
194 | UpdateInitialGain(dev); | ||
195 | } | ||
196 | priv->DIG_NumberFallbackVote = 0; | ||
197 | priv->DIG_NumberUpgradeVote = 0; | ||
198 | } | ||
199 | } | ||
200 | } | ||
201 | |||
202 | /* | ||
203 | * Dispatch DIG implementation according to RF. | ||
204 | */ | ||
205 | static void DynamicInitGain(struct net_device *dev) | ||
206 | { | ||
207 | DIG_Zebra(dev); | ||
208 | } | ||
209 | |||
210 | void rtl8180_hw_dig_wq(struct work_struct *work) | ||
211 | { | ||
212 | struct delayed_work *dwork = to_delayed_work(work); | ||
213 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, hw_dig_wq); | ||
214 | struct net_device *dev = ieee->dev; | ||
215 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
216 | |||
217 | /* Read CCK and OFDM False Alarm. */ | ||
218 | priv->FalseAlarmRegValue = read_nic_dword(dev, CCK_FALSE_ALARM); | ||
219 | |||
220 | |||
221 | /* Adjust Initial Gain dynamically. */ | ||
222 | DynamicInitGain(dev); | ||
223 | |||
224 | } | ||
225 | |||
226 | static int IncludedInSupportedRates(struct r8180_priv *priv, u8 TxRate) | ||
227 | { | ||
228 | u8 rate_len; | ||
229 | u8 rate_ex_len; | ||
230 | u8 RateMask = 0x7F; | ||
231 | u8 idx; | ||
232 | unsigned short Found = 0; | ||
233 | u8 NaiveTxRate = TxRate&RateMask; | ||
234 | |||
235 | rate_len = priv->ieee80211->current_network.rates_len; | ||
236 | rate_ex_len = priv->ieee80211->current_network.rates_ex_len; | ||
237 | for (idx = 0; idx < rate_len; idx++) { | ||
238 | if ((priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate) { | ||
239 | Found = 1; | ||
240 | goto found_rate; | ||
241 | } | ||
242 | } | ||
243 | for (idx = 0; idx < rate_ex_len; idx++) { | ||
244 | if ((priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate) { | ||
245 | Found = 1; | ||
246 | goto found_rate; | ||
247 | } | ||
248 | } | ||
249 | return Found; | ||
250 | found_rate: | ||
251 | return Found; | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * Get the Tx rate one degree up form the input rate in the supported rates. | ||
256 | * Return the upgrade rate if it is successed, otherwise return the input rate. | ||
257 | */ | ||
258 | static u8 GetUpgradeTxRate(struct net_device *dev, u8 rate) | ||
259 | { | ||
260 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
261 | u8 UpRate; | ||
262 | |||
263 | /* Upgrade 1 degree. */ | ||
264 | switch (rate) { | ||
265 | case 108: /* Up to 54Mbps. */ | ||
266 | UpRate = 108; | ||
267 | break; | ||
268 | |||
269 | case 96: /* Up to 54Mbps. */ | ||
270 | UpRate = 108; | ||
271 | break; | ||
272 | |||
273 | case 72: /* Up to 48Mbps. */ | ||
274 | UpRate = 96; | ||
275 | break; | ||
276 | |||
277 | case 48: /* Up to 36Mbps. */ | ||
278 | UpRate = 72; | ||
279 | break; | ||
280 | |||
281 | case 36: /* Up to 24Mbps. */ | ||
282 | UpRate = 48; | ||
283 | break; | ||
284 | |||
285 | case 22: /* Up to 18Mbps. */ | ||
286 | UpRate = 36; | ||
287 | break; | ||
288 | |||
289 | case 11: /* Up to 11Mbps. */ | ||
290 | UpRate = 22; | ||
291 | break; | ||
292 | |||
293 | case 4: /* Up to 5.5Mbps. */ | ||
294 | UpRate = 11; | ||
295 | break; | ||
296 | |||
297 | case 2: /* Up to 2Mbps. */ | ||
298 | UpRate = 4; | ||
299 | break; | ||
300 | |||
301 | default: | ||
302 | printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate); | ||
303 | return rate; | ||
304 | } | ||
305 | /* Check if the rate is valid. */ | ||
306 | if (IncludedInSupportedRates(priv, UpRate)) { | ||
307 | return UpRate; | ||
308 | } else { | ||
309 | return rate; | ||
310 | } | ||
311 | return rate; | ||
312 | } | ||
313 | /* | ||
314 | * Get the Tx rate one degree down form the input rate in the supported rates. | ||
315 | * Return the degrade rate if it is successed, otherwise return the input rate. | ||
316 | */ | ||
317 | |||
318 | static u8 GetDegradeTxRate(struct net_device *dev, u8 rate) | ||
319 | { | ||
320 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
321 | u8 DownRate; | ||
322 | |||
323 | /* Upgrade 1 degree. */ | ||
324 | switch (rate) { | ||
325 | case 108: /* Down to 48Mbps. */ | ||
326 | DownRate = 96; | ||
327 | break; | ||
328 | |||
329 | case 96: /* Down to 36Mbps. */ | ||
330 | DownRate = 72; | ||
331 | break; | ||
332 | |||
333 | case 72: /* Down to 24Mbps. */ | ||
334 | DownRate = 48; | ||
335 | break; | ||
336 | |||
337 | case 48: /* Down to 18Mbps. */ | ||
338 | DownRate = 36; | ||
339 | break; | ||
340 | |||
341 | case 36: /* Down to 11Mbps. */ | ||
342 | DownRate = 22; | ||
343 | break; | ||
344 | |||
345 | case 22: /* Down to 5.5Mbps. */ | ||
346 | DownRate = 11; | ||
347 | break; | ||
348 | |||
349 | case 11: /* Down to 2Mbps. */ | ||
350 | DownRate = 4; | ||
351 | break; | ||
352 | |||
353 | case 4: /* Down to 1Mbps. */ | ||
354 | DownRate = 2; | ||
355 | break; | ||
356 | |||
357 | case 2: /* Down to 1Mbps. */ | ||
358 | DownRate = 2; | ||
359 | break; | ||
360 | |||
361 | default: | ||
362 | printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate); | ||
363 | return rate; | ||
364 | } | ||
365 | /* Check if the rate is valid. */ | ||
366 | if (IncludedInSupportedRates(priv, DownRate)) { | ||
367 | return DownRate; | ||
368 | } else { | ||
369 | return rate; | ||
370 | } | ||
371 | return rate; | ||
372 | } | ||
373 | /* | ||
374 | * Helper function to determine if specified data rate is | ||
375 | * CCK rate. | ||
376 | */ | ||
377 | |||
378 | static bool MgntIsCckRate(u16 rate) | ||
379 | { | ||
380 | bool bReturn = false; | ||
381 | |||
382 | if ((rate <= 22) && (rate != 12) && (rate != 18)) { | ||
383 | bReturn = true; | ||
384 | } | ||
385 | |||
386 | return bReturn; | ||
387 | } | ||
388 | /* | ||
389 | * Description: | ||
390 | * Tx Power tracking mechanism routine on 87SE. | ||
391 | */ | ||
392 | void TxPwrTracking87SE(struct net_device *dev) | ||
393 | { | ||
394 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
395 | u8 tmpu1Byte, CurrentThermal, Idx; | ||
396 | char CckTxPwrIdx, OfdmTxPwrIdx; | ||
397 | |||
398 | tmpu1Byte = read_nic_byte(dev, EN_LPF_CAL); | ||
399 | CurrentThermal = (tmpu1Byte & 0xf0) >> 4; /*[ 7:4]: thermal meter indication. */ | ||
400 | CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c : CurrentThermal;/* lzm add 080826 */ | ||
401 | |||
402 | if (CurrentThermal != priv->ThermalMeter) { | ||
403 | /* Update Tx Power level on each channel. */ | ||
404 | for (Idx = 1; Idx < 15; Idx++) { | ||
405 | CckTxPwrIdx = priv->chtxpwr[Idx]; | ||
406 | OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx]; | ||
407 | |||
408 | if (CurrentThermal > priv->ThermalMeter) { | ||
409 | /* higher thermal meter. */ | ||
410 | CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2; | ||
411 | OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2; | ||
412 | |||
413 | if (CckTxPwrIdx > 35) | ||
414 | CckTxPwrIdx = 35; /* Force TxPower to maximal index. */ | ||
415 | if (OfdmTxPwrIdx > 35) | ||
416 | OfdmTxPwrIdx = 35; | ||
417 | } else { | ||
418 | /* lower thermal meter. */ | ||
419 | CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2; | ||
420 | OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2; | ||
421 | |||
422 | if (CckTxPwrIdx < 0) | ||
423 | CckTxPwrIdx = 0; | ||
424 | if (OfdmTxPwrIdx < 0) | ||
425 | OfdmTxPwrIdx = 0; | ||
426 | } | ||
427 | |||
428 | /* Update TxPower level on CCK and OFDM resp. */ | ||
429 | priv->chtxpwr[Idx] = CckTxPwrIdx; | ||
430 | priv->chtxpwr_ofdm[Idx] = OfdmTxPwrIdx; | ||
431 | } | ||
432 | |||
433 | /* Update TxPower level immediately. */ | ||
434 | rtl8225z2_SetTXPowerLevel(dev, priv->ieee80211->current_network.channel); | ||
435 | } | ||
436 | priv->ThermalMeter = CurrentThermal; | ||
437 | } | ||
438 | static void StaRateAdaptive87SE(struct net_device *dev) | ||
439 | { | ||
440 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
441 | unsigned long CurrTxokCnt; | ||
442 | u16 CurrRetryCnt; | ||
443 | u16 CurrRetryRate; | ||
444 | unsigned long CurrRxokCnt; | ||
445 | bool bTryUp = false; | ||
446 | bool bTryDown = false; | ||
447 | u8 TryUpTh = 1; | ||
448 | u8 TryDownTh = 2; | ||
449 | u32 TxThroughput; | ||
450 | long CurrSignalStrength; | ||
451 | bool bUpdateInitialGain = false; | ||
452 | u8 u1bOfdm = 0, u1bCck = 0; | ||
453 | char OfdmTxPwrIdx, CckTxPwrIdx; | ||
454 | |||
455 | priv->RateAdaptivePeriod = RATE_ADAPTIVE_TIMER_PERIOD; | ||
456 | |||
457 | |||
458 | CurrRetryCnt = priv->CurrRetryCnt; | ||
459 | CurrTxokCnt = priv->NumTxOkTotal - priv->LastTxokCnt; | ||
460 | CurrRxokCnt = priv->ieee80211->NumRxOkTotal - priv->LastRxokCnt; | ||
461 | CurrSignalStrength = priv->Stats_RecvSignalPower; | ||
462 | TxThroughput = (u32)(priv->NumTxOkBytesTotal - priv->LastTxOKBytes); | ||
463 | priv->LastTxOKBytes = priv->NumTxOkBytesTotal; | ||
464 | priv->CurrentOperaRate = priv->ieee80211->rate / 5; | ||
465 | /* 2 Compute retry ratio. */ | ||
466 | if (CurrTxokCnt > 0) { | ||
467 | CurrRetryRate = (u16)(CurrRetryCnt * 100 / CurrTxokCnt); | ||
468 | } else { | ||
469 | /* It may be serious retry. To distinguish serious retry or no packets modified by Bruce */ | ||
470 | CurrRetryRate = (u16)(CurrRetryCnt * 100 / 1); | ||
471 | } | ||
472 | |||
473 | priv->LastRetryCnt = priv->CurrRetryCnt; | ||
474 | priv->LastTxokCnt = priv->NumTxOkTotal; | ||
475 | priv->LastRxokCnt = priv->ieee80211->NumRxOkTotal; | ||
476 | priv->CurrRetryCnt = 0; | ||
477 | |||
478 | /* 2No Tx packets, return to init_rate or not? */ | ||
479 | if (CurrRetryRate == 0 && CurrTxokCnt == 0) { | ||
480 | /* | ||
481 | * After 9 (30*300ms) seconds in this condition, we try to raise rate. | ||
482 | */ | ||
483 | priv->TryupingCountNoData++; | ||
484 | |||
485 | /* [TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00 */ | ||
486 | if (priv->TryupingCountNoData > 30) { | ||
487 | priv->TryupingCountNoData = 0; | ||
488 | priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate); | ||
489 | /* Reset Fail Record */ | ||
490 | priv->LastFailTxRate = 0; | ||
491 | priv->LastFailTxRateSS = -200; | ||
492 | priv->FailTxRateCount = 0; | ||
493 | } | ||
494 | goto SetInitialGain; | ||
495 | } else { | ||
496 | priv->TryupingCountNoData = 0; /*Reset trying up times. */ | ||
497 | } | ||
498 | |||
499 | |||
500 | /* | ||
501 | * For Netgear case, I comment out the following signal strength estimation, | ||
502 | * which can results in lower rate to transmit when sample is NOT enough (e.g. PING request). | ||
503 | * | ||
504 | * Restructure rate adaptive as the following main stages: | ||
505 | * (1) Add retry threshold in 54M upgrading condition with signal strength. | ||
506 | * (2) Add the mechanism to degrade to CCK rate according to signal strength | ||
507 | * and retry rate. | ||
508 | * (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated | ||
509 | * situation, Initial Gain Update is upon on DIG mechanism except CCK rate. | ||
510 | * (4) Add the mechanism of trying to upgrade tx rate. | ||
511 | * (5) Record the information of upping tx rate to avoid trying upping tx rate constantly. | ||
512 | * | ||
513 | */ | ||
514 | |||
515 | /* | ||
516 | * 11Mbps or 36Mbps | ||
517 | * Check more times in these rate(key rates). | ||
518 | */ | ||
519 | if (priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72) | ||
520 | TryUpTh += 9; | ||
521 | /* | ||
522 | * Let these rates down more difficult. | ||
523 | */ | ||
524 | if (MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36) | ||
525 | TryDownTh += 1; | ||
526 | |||
527 | /* 1 Adjust Rate. */ | ||
528 | if (priv->bTryuping == true) { | ||
529 | /* 2 For Test Upgrading mechanism | ||
530 | * Note: | ||
531 | * Sometimes the throughput is upon on the capability between the AP and NIC, | ||
532 | * thus the low data rate does not improve the performance. | ||
533 | * We randomly upgrade the data rate and check if the retry rate is improved. | ||
534 | */ | ||
535 | |||
536 | /* Upgrading rate did not improve the retry rate, fallback to the original rate. */ | ||
537 | if ((CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) { | ||
538 | /*Not necessary raising rate, fall back rate. */ | ||
539 | bTryDown = true; | ||
540 | } else { | ||
541 | priv->bTryuping = false; | ||
542 | } | ||
543 | } else if (CurrSignalStrength > -47 && (CurrRetryRate < 50)) { | ||
544 | /* | ||
545 | * 2For High Power | ||
546 | * | ||
547 | * Return to highest data rate, if signal strength is good enough. | ||
548 | * SignalStrength threshold(-50dbm) is for RTL8186. | ||
549 | * Revise SignalStrength threshold to -51dbm. | ||
550 | */ | ||
551 | /* Also need to check retry rate for safety, by Bruce, 2007-06-05. */ | ||
552 | if (priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate) { | ||
553 | bTryUp = true; | ||
554 | /* Upgrade Tx Rate directly. */ | ||
555 | priv->TryupingCount += TryUpTh; | ||
556 | } | ||
557 | |||
558 | } else if (CurrTxokCnt > 9 && CurrTxokCnt < 100 && CurrRetryRate >= 600) { | ||
559 | /* | ||
560 | *2 For Serious Retry | ||
561 | * | ||
562 | * Traffic is not busy but our Tx retry is serious. | ||
563 | */ | ||
564 | bTryDown = true; | ||
565 | /* Let Rate Mechanism to degrade tx rate directly. */ | ||
566 | priv->TryDownCountLowData += TryDownTh; | ||
567 | } else if (priv->CurrentOperaRate == 108) { | ||
568 | /* 2For 54Mbps */ | ||
569 | /* Air Link */ | ||
570 | if ((CurrRetryRate > 26) && (priv->LastRetryRate > 25)) { | ||
571 | bTryDown = true; | ||
572 | } | ||
573 | /* Cable Link */ | ||
574 | else if ((CurrRetryRate > 17) && (priv->LastRetryRate > 16) && (CurrSignalStrength > -72)) { | ||
575 | bTryDown = true; | ||
576 | } | ||
577 | |||
578 | if (bTryDown && (CurrSignalStrength < -75)) /* cable link */ | ||
579 | priv->TryDownCountLowData += TryDownTh; | ||
580 | } else if (priv->CurrentOperaRate == 96) { | ||
581 | /* 2For 48Mbps */ | ||
582 | /* Air Link */ | ||
583 | if (((CurrRetryRate > 48) && (priv->LastRetryRate > 47))) { | ||
584 | bTryDown = true; | ||
585 | } else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { /* Cable Link */ | ||
586 | /* Down to rate 36Mbps. */ | ||
587 | bTryDown = true; | ||
588 | } else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) { | ||
589 | bTryDown = true; | ||
590 | priv->TryDownCountLowData += TryDownTh; | ||
591 | } else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { /* TO DO: need to consider (RSSI) */ | ||
592 | bTryUp = true; | ||
593 | } | ||
594 | |||
595 | if (bTryDown && (CurrSignalStrength < -75)) { | ||
596 | priv->TryDownCountLowData += TryDownTh; | ||
597 | } | ||
598 | } else if (priv->CurrentOperaRate == 72) { | ||
599 | /* 2For 36Mbps */ | ||
600 | if ((CurrRetryRate > 43) && (priv->LastRetryRate > 41)) { | ||
601 | /* Down to rate 24Mbps. */ | ||
602 | bTryDown = true; | ||
603 | } else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) { | ||
604 | bTryDown = true; | ||
605 | priv->TryDownCountLowData += TryDownTh; | ||
606 | } else if ((CurrRetryRate < 15) && (priv->LastRetryRate < 16)) { /* TO DO: need to consider (RSSI) */ | ||
607 | bTryUp = true; | ||
608 | } | ||
609 | |||
610 | if (bTryDown && (CurrSignalStrength < -80)) | ||
611 | priv->TryDownCountLowData += TryDownTh; | ||
612 | |||
613 | } else if (priv->CurrentOperaRate == 48) { | ||
614 | /* 2For 24Mbps */ | ||
615 | /* Air Link */ | ||
616 | if (((CurrRetryRate > 63) && (priv->LastRetryRate > 62))) { | ||
617 | bTryDown = true; | ||
618 | } else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { /* Cable Link */ | ||
619 | bTryDown = true; | ||
620 | } else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) { | ||
621 | bTryDown = true; | ||
622 | priv->TryDownCountLowData += TryDownTh; | ||
623 | } else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { /* TO DO: need to consider (RSSI) */ | ||
624 | bTryUp = true; | ||
625 | } | ||
626 | |||
627 | if (bTryDown && (CurrSignalStrength < -82)) | ||
628 | priv->TryDownCountLowData += TryDownTh; | ||
629 | |||
630 | } else if (priv->CurrentOperaRate == 36) { | ||
631 | if (((CurrRetryRate > 85) && (priv->LastRetryRate > 86))) { | ||
632 | bTryDown = true; | ||
633 | } else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) { | ||
634 | bTryDown = true; | ||
635 | priv->TryDownCountLowData += TryDownTh; | ||
636 | } else if ((CurrRetryRate < 22) && (priv->LastRetryRate < 23)) { /* TO DO: need to consider (RSSI) */ | ||
637 | bTryUp = true; | ||
638 | } | ||
639 | } else if (priv->CurrentOperaRate == 22) { | ||
640 | /* 2For 11Mbps */ | ||
641 | if (CurrRetryRate > 95) { | ||
642 | bTryDown = true; | ||
643 | } else if ((CurrRetryRate < 29) && (priv->LastRetryRate < 30)) { /*TO DO: need to consider (RSSI) */ | ||
644 | bTryUp = true; | ||
645 | } | ||
646 | } else if (priv->CurrentOperaRate == 11) { | ||
647 | /* 2For 5.5Mbps */ | ||
648 | if (CurrRetryRate > 149) { | ||
649 | bTryDown = true; | ||
650 | } else if ((CurrRetryRate < 60) && (priv->LastRetryRate < 65)) { | ||
651 | bTryUp = true; | ||
652 | } | ||
653 | } else if (priv->CurrentOperaRate == 4) { | ||
654 | /* 2For 2 Mbps */ | ||
655 | if ((CurrRetryRate > 99) && (priv->LastRetryRate > 99)) { | ||
656 | bTryDown = true; | ||
657 | } else if ((CurrRetryRate < 65) && (priv->LastRetryRate < 70)) { | ||
658 | bTryUp = true; | ||
659 | } | ||
660 | } else if (priv->CurrentOperaRate == 2) { | ||
661 | /* 2For 1 Mbps */ | ||
662 | if ((CurrRetryRate < 70) && (priv->LastRetryRate < 75)) { | ||
663 | bTryUp = true; | ||
664 | } | ||
665 | } | ||
666 | |||
667 | if (bTryUp && bTryDown) | ||
668 | printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n"); | ||
669 | |||
670 | /* 1 Test Upgrading Tx Rate | ||
671 | * Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC. | ||
672 | * To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate. | ||
673 | */ | ||
674 | if (!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0) | ||
675 | && priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate && priv->FailTxRateCount < 2) { | ||
676 | if (jiffies % (CurrRetryRate + 101) == 0) { | ||
677 | bTryUp = true; | ||
678 | priv->bTryuping = true; | ||
679 | } | ||
680 | } | ||
681 | |||
682 | /* 1 Rate Mechanism */ | ||
683 | if (bTryUp) { | ||
684 | priv->TryupingCount++; | ||
685 | priv->TryDownCountLowData = 0; | ||
686 | |||
687 | /* | ||
688 | * Check more times if we need to upgrade indeed. | ||
689 | * Because the largest value of pHalData->TryupingCount is 0xFFFF and | ||
690 | * the largest value of pHalData->FailTxRateCount is 0x14, | ||
691 | * this condition will be satisfied at most every 2 min. | ||
692 | */ | ||
693 | |||
694 | if ((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) || | ||
695 | (CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping) { | ||
696 | priv->TryupingCount = 0; | ||
697 | /* | ||
698 | * When transferring from CCK to OFDM, DIG is an important issue. | ||
699 | */ | ||
700 | if (priv->CurrentOperaRate == 22) | ||
701 | bUpdateInitialGain = true; | ||
702 | |||
703 | /* | ||
704 | * The difference in throughput between 48Mbps and 36Mbps is 8M. | ||
705 | * So, we must be careful in this rate scale. Isaiah 2008-02-15. | ||
706 | */ | ||
707 | if (((priv->CurrentOperaRate == 72) || (priv->CurrentOperaRate == 48) || (priv->CurrentOperaRate == 36)) && | ||
708 | (priv->FailTxRateCount > 2)) | ||
709 | priv->RateAdaptivePeriod = (RATE_ADAPTIVE_TIMER_PERIOD / 2); | ||
710 | |||
711 | /* (1)To avoid upgrade frequently to the fail tx rate, add the FailTxRateCount into the threshold. */ | ||
712 | /* (2)If the signal strength is increased, it may be able to upgrade. */ | ||
713 | |||
714 | priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate); | ||
715 | |||
716 | if (priv->CurrentOperaRate == 36) { | ||
717 | priv->bUpdateARFR = true; | ||
718 | write_nic_word(dev, ARFR, 0x0F8F); /* bypass 12/9/6 */ | ||
719 | } else if (priv->bUpdateARFR) { | ||
720 | priv->bUpdateARFR = false; | ||
721 | write_nic_word(dev, ARFR, 0x0FFF); /* set 1M ~ 54Mbps. */ | ||
722 | } | ||
723 | |||
724 | /* Update Fail Tx rate and count. */ | ||
725 | if (priv->LastFailTxRate != priv->CurrentOperaRate) { | ||
726 | priv->LastFailTxRate = priv->CurrentOperaRate; | ||
727 | priv->FailTxRateCount = 0; | ||
728 | priv->LastFailTxRateSS = -200; /* Set lowest power. */ | ||
729 | } | ||
730 | } | ||
731 | } else { | ||
732 | if (priv->TryupingCount > 0) | ||
733 | priv->TryupingCount--; | ||
734 | } | ||
735 | |||
736 | if (bTryDown) { | ||
737 | priv->TryDownCountLowData++; | ||
738 | priv->TryupingCount = 0; | ||
739 | |||
740 | /* Check if Tx rate can be degraded or Test trying upgrading should fallback. */ | ||
741 | if (priv->TryDownCountLowData > TryDownTh || priv->bTryuping) { | ||
742 | priv->TryDownCountLowData = 0; | ||
743 | priv->bTryuping = false; | ||
744 | /* Update fail information. */ | ||
745 | if (priv->LastFailTxRate == priv->CurrentOperaRate) { | ||
746 | priv->FailTxRateCount++; | ||
747 | /* Record the Tx fail rate signal strength. */ | ||
748 | if (CurrSignalStrength > priv->LastFailTxRateSS) | ||
749 | priv->LastFailTxRateSS = CurrSignalStrength; | ||
750 | } else { | ||
751 | priv->LastFailTxRate = priv->CurrentOperaRate; | ||
752 | priv->FailTxRateCount = 1; | ||
753 | priv->LastFailTxRateSS = CurrSignalStrength; | ||
754 | } | ||
755 | priv->CurrentOperaRate = GetDegradeTxRate(dev, priv->CurrentOperaRate); | ||
756 | |||
757 | /* Reduce chariot training time at weak signal strength situation. SD3 ED demand. */ | ||
758 | if ((CurrSignalStrength < -80) && (priv->CurrentOperaRate > 72)) { | ||
759 | priv->CurrentOperaRate = 72; | ||
760 | } | ||
761 | |||
762 | if (priv->CurrentOperaRate == 36) { | ||
763 | priv->bUpdateARFR = true; | ||
764 | write_nic_word(dev, ARFR, 0x0F8F); /* bypass 12/9/6 */ | ||
765 | } else if (priv->bUpdateARFR) { | ||
766 | priv->bUpdateARFR = false; | ||
767 | write_nic_word(dev, ARFR, 0x0FFF); /* set 1M ~ 54Mbps. */ | ||
768 | } | ||
769 | |||
770 | /* | ||
771 | * When it is CCK rate, it may need to update initial gain to receive lower power packets. | ||
772 | */ | ||
773 | if (MgntIsCckRate(priv->CurrentOperaRate)) { | ||
774 | bUpdateInitialGain = true; | ||
775 | } | ||
776 | } | ||
777 | } else { | ||
778 | if (priv->TryDownCountLowData > 0) | ||
779 | priv->TryDownCountLowData--; | ||
780 | } | ||
781 | |||
782 | /* | ||
783 | * Keep the Tx fail rate count to equal to 0x15 at most. | ||
784 | * Reduce the fail count at least to 10 sec if tx rate is tending stable. | ||
785 | */ | ||
786 | if (priv->FailTxRateCount >= 0x15 || | ||
787 | (!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6)) { | ||
788 | priv->FailTxRateCount--; | ||
789 | } | ||
790 | |||
791 | |||
792 | OfdmTxPwrIdx = priv->chtxpwr_ofdm[priv->ieee80211->current_network.channel]; | ||
793 | CckTxPwrIdx = priv->chtxpwr[priv->ieee80211->current_network.channel]; | ||
794 | |||
795 | /* Mac0x9e increase 2 level in 36M~18M situation */ | ||
796 | if ((priv->CurrentOperaRate < 96) && (priv->CurrentOperaRate > 22)) { | ||
797 | u1bCck = read_nic_byte(dev, CCK_TXAGC); | ||
798 | u1bOfdm = read_nic_byte(dev, OFDM_TXAGC); | ||
799 | |||
800 | /* case 1: Never enter High power */ | ||
801 | if (u1bCck == CckTxPwrIdx) { | ||
802 | if (u1bOfdm != (OfdmTxPwrIdx + 2)) { | ||
803 | priv->bEnhanceTxPwr = true; | ||
804 | u1bOfdm = ((u1bOfdm + 2) > 35) ? 35 : (u1bOfdm + 2); | ||
805 | write_nic_byte(dev, OFDM_TXAGC, u1bOfdm); | ||
806 | } | ||
807 | } else if (u1bCck < CckTxPwrIdx) { | ||
808 | /* case 2: enter high power */ | ||
809 | if (!priv->bEnhanceTxPwr) { | ||
810 | priv->bEnhanceTxPwr = true; | ||
811 | u1bOfdm = ((u1bOfdm + 2) > 35) ? 35 : (u1bOfdm + 2); | ||
812 | write_nic_byte(dev, OFDM_TXAGC, u1bOfdm); | ||
813 | } | ||
814 | } | ||
815 | } else if (priv->bEnhanceTxPwr) { /* 54/48/11/5.5/2/1 */ | ||
816 | u1bCck = read_nic_byte(dev, CCK_TXAGC); | ||
817 | u1bOfdm = read_nic_byte(dev, OFDM_TXAGC); | ||
818 | |||
819 | /* case 1: Never enter High power */ | ||
820 | if (u1bCck == CckTxPwrIdx) { | ||
821 | priv->bEnhanceTxPwr = false; | ||
822 | write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx); | ||
823 | } | ||
824 | /* case 2: enter high power */ | ||
825 | else if (u1bCck < CckTxPwrIdx) { | ||
826 | priv->bEnhanceTxPwr = false; | ||
827 | u1bOfdm = ((u1bOfdm - 2) > 0) ? (u1bOfdm - 2) : 0; | ||
828 | write_nic_byte(dev, OFDM_TXAGC, u1bOfdm); | ||
829 | } | ||
830 | } | ||
831 | |||
832 | /* | ||
833 | * We need update initial gain when we set tx rate "from OFDM to CCK" or | ||
834 | * "from CCK to OFDM". | ||
835 | */ | ||
836 | SetInitialGain: | ||
837 | if (bUpdateInitialGain) { | ||
838 | if (MgntIsCckRate(priv->CurrentOperaRate)) { /* CCK */ | ||
839 | if (priv->InitialGain > priv->RegBModeGainStage) { | ||
840 | priv->InitialGainBackUp = priv->InitialGain; | ||
841 | |||
842 | if (CurrSignalStrength < -85) /* Low power, OFDM [0x17] = 26. */ | ||
843 | /* SD3 SYs suggest that CurrSignalStrength < -65, ofdm 0x17=26. */ | ||
844 | priv->InitialGain = priv->RegBModeGainStage; | ||
845 | |||
846 | else if (priv->InitialGain > priv->RegBModeGainStage + 1) | ||
847 | priv->InitialGain -= 2; | ||
848 | |||
849 | else | ||
850 | priv->InitialGain--; | ||
851 | |||
852 | printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n", priv->InitialGain, priv->CurrentOperaRate); | ||
853 | UpdateInitialGain(dev); | ||
854 | } | ||
855 | } else { /* OFDM */ | ||
856 | if (priv->InitialGain < 4) { | ||
857 | priv->InitialGainBackUp = priv->InitialGain; | ||
858 | |||
859 | priv->InitialGain++; | ||
860 | printk("StaRateAdaptive87SE(): update init_gain to index %d for date rate %d\n", priv->InitialGain, priv->CurrentOperaRate); | ||
861 | UpdateInitialGain(dev); | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | |||
866 | /* Record the related info */ | ||
867 | priv->LastRetryRate = CurrRetryRate; | ||
868 | priv->LastTxThroughput = TxThroughput; | ||
869 | priv->ieee80211->rate = priv->CurrentOperaRate * 5; | ||
870 | } | ||
871 | |||
872 | void rtl8180_rate_adapter(struct work_struct *work) | ||
873 | { | ||
874 | struct delayed_work *dwork = to_delayed_work(work); | ||
875 | struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, rate_adapter_wq); | ||
876 | struct net_device *dev = ieee->dev; | ||
877 | StaRateAdaptive87SE(dev); | ||
878 | } | ||
879 | void timer_rate_adaptive(unsigned long data) | ||
880 | { | ||
881 | struct r8180_priv *priv = ieee80211_priv((struct net_device *)data); | ||
882 | if (!priv->up) { | ||
883 | return; | ||
884 | } | ||
885 | if ((priv->ieee80211->iw_mode != IW_MODE_MASTER) | ||
886 | && (priv->ieee80211->state == IEEE80211_LINKED) && | ||
887 | (priv->ForcedDataRate == 0)) { | ||
888 | queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq); | ||
889 | } | ||
890 | priv->rateadapter_timer.expires = jiffies + MSECS(priv->RateAdaptivePeriod); | ||
891 | add_timer(&priv->rateadapter_timer); | ||
892 | } | ||
893 | |||
894 | void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength) | ||
895 | { | ||
896 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
897 | |||
898 | priv->AdRxOkCnt++; | ||
899 | |||
900 | if (priv->AdRxSignalStrength != -1) { | ||
901 | priv->AdRxSignalStrength = ((priv->AdRxSignalStrength * 7) + (SignalStrength * 3)) / 10; | ||
902 | } else { /* Initialization case. */ | ||
903 | priv->AdRxSignalStrength = SignalStrength; | ||
904 | } | ||
905 | |||
906 | if (priv->LastRxPktAntenna) /* Main antenna. */ | ||
907 | priv->AdMainAntennaRxOkCnt++; | ||
908 | else /* Aux antenna. */ | ||
909 | priv->AdAuxAntennaRxOkCnt++; | ||
910 | } | ||
911 | /* Change Antenna Switch. */ | ||
912 | bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex) | ||
913 | { | ||
914 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
915 | bool bAntennaSwitched = false; | ||
916 | |||
917 | switch (u1bAntennaIndex) { | ||
918 | case 0: | ||
919 | /* Mac register, main antenna */ | ||
920 | write_nic_byte(dev, ANTSEL, 0x03); | ||
921 | /* base band */ | ||
922 | write_phy_cck(dev, 0x11, 0x9b); /* Config CCK RX antenna. */ | ||
923 | write_phy_ofdm(dev, 0x0d, 0x5c); /* Config OFDM RX antenna. */ | ||
924 | |||
925 | bAntennaSwitched = true; | ||
926 | break; | ||
927 | |||
928 | case 1: | ||
929 | /* Mac register, aux antenna */ | ||
930 | write_nic_byte(dev, ANTSEL, 0x00); | ||
931 | /* base band */ | ||
932 | write_phy_cck(dev, 0x11, 0xbb); /* Config CCK RX antenna. */ | ||
933 | write_phy_ofdm(dev, 0x0d, 0x54); /* Config OFDM RX antenna. */ | ||
934 | |||
935 | bAntennaSwitched = true; | ||
936 | |||
937 | break; | ||
938 | |||
939 | default: | ||
940 | printk("SetAntenna8185: unknown u1bAntennaIndex(%d)\n", u1bAntennaIndex); | ||
941 | break; | ||
942 | } | ||
943 | |||
944 | if (bAntennaSwitched) | ||
945 | priv->CurrAntennaIndex = u1bAntennaIndex; | ||
946 | |||
947 | return bAntennaSwitched; | ||
948 | } | ||
949 | /* Toggle Antenna switch. */ | ||
950 | bool SwitchAntenna(struct net_device *dev) | ||
951 | { | ||
952 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
953 | |||
954 | bool bResult; | ||
955 | |||
956 | if (priv->CurrAntennaIndex == 0) { | ||
957 | bResult = SetAntenna8185(dev, 1); | ||
958 | } else { | ||
959 | bResult = SetAntenna8185(dev, 0); | ||
960 | } | ||
961 | |||
962 | return bResult; | ||
963 | } | ||
964 | /* | ||
965 | * Engine of SW Antenna Diversity mechanism. | ||
966 | * Since 8187 has no Tx part information, | ||
967 | * this implementation is only dependend on Rx part information. | ||
968 | */ | ||
969 | void SwAntennaDiversity(struct net_device *dev) | ||
970 | { | ||
971 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
972 | bool bSwCheckSS = false; | ||
973 | if (bSwCheckSS) { | ||
974 | priv->AdTickCount++; | ||
975 | |||
976 | printk("(1) AdTickCount: %d, AdCheckPeriod: %d\n", | ||
977 | priv->AdTickCount, priv->AdCheckPeriod); | ||
978 | printk("(2) AdRxSignalStrength: %ld, AdRxSsThreshold: %ld\n", | ||
979 | priv->AdRxSignalStrength, priv->AdRxSsThreshold); | ||
980 | } | ||
981 | |||
982 | /* Case 1. No Link. */ | ||
983 | if (priv->ieee80211->state != IEEE80211_LINKED) { | ||
984 | priv->bAdSwitchedChecking = false; | ||
985 | /* I switch antenna here to prevent any one of antenna is broken before link established, 2006.04.18, by rcnjko.. */ | ||
986 | SwitchAntenna(dev); | ||
987 | |||
988 | /* Case 2. Linked but no packet receive.d */ | ||
989 | } else if (priv->AdRxOkCnt == 0) { | ||
990 | priv->bAdSwitchedChecking = false; | ||
991 | SwitchAntenna(dev); | ||
992 | |||
993 | /* Case 3. Evaluate last antenna switch action and undo it if necessary. */ | ||
994 | } else if (priv->bAdSwitchedChecking == true) { | ||
995 | priv->bAdSwitchedChecking = false; | ||
996 | |||
997 | /* Adjust Rx signal strength threshold. */ | ||
998 | priv->AdRxSsThreshold = (priv->AdRxSignalStrength + priv->AdRxSsBeforeSwitched) / 2; | ||
999 | |||
1000 | priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ? | ||
1001 | priv->AdMaxRxSsThreshold : priv->AdRxSsThreshold; | ||
1002 | if (priv->AdRxSignalStrength < priv->AdRxSsBeforeSwitched) { | ||
1003 | /* Rx signal strength is not improved after we swtiched antenna. => Swich back. */ | ||
1004 | /* Increase Antenna Diversity checking period due to bad decision. */ | ||
1005 | priv->AdCheckPeriod *= 2; | ||
1006 | /* Increase Antenna Diversity checking period. */ | ||
1007 | if (priv->AdCheckPeriod > priv->AdMaxCheckPeriod) | ||
1008 | priv->AdCheckPeriod = priv->AdMaxCheckPeriod; | ||
1009 | |||
1010 | /* Wrong decision => switch back. */ | ||
1011 | SwitchAntenna(dev); | ||
1012 | } else { | ||
1013 | /* Rx Signal Strength is improved. */ | ||
1014 | |||
1015 | /* Reset Antenna Diversity checking period to its min value. */ | ||
1016 | priv->AdCheckPeriod = priv->AdMinCheckPeriod; | ||
1017 | } | ||
1018 | |||
1019 | } | ||
1020 | /* Case 4. Evaluate if we shall switch antenna now. */ | ||
1021 | /* Cause Table Speed is very fast in TRC Dell Lab, we check it every time. */ | ||
1022 | else { | ||
1023 | priv->AdTickCount = 0; | ||
1024 | |||
1025 | /* | ||
1026 | * <Roger_Notes> We evaluate RxOk counts for each antenna first and than | ||
1027 | * evaluate signal strength. | ||
1028 | * The following operation can overcome the disability of CCA on both two antennas | ||
1029 | * When signal strength was extremely low or high. | ||
1030 | * 2008.01.30. | ||
1031 | */ | ||
1032 | |||
1033 | /* | ||
1034 | * Evaluate RxOk count from each antenna if we shall switch default antenna now. | ||
1035 | */ | ||
1036 | if ((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt) | ||
1037 | && (priv->CurrAntennaIndex == 0)) { | ||
1038 | /* We set Main antenna as default but RxOk count was less than Aux ones. */ | ||
1039 | |||
1040 | /* Switch to Aux antenna. */ | ||
1041 | SwitchAntenna(dev); | ||
1042 | priv->bHWAdSwitched = true; | ||
1043 | } else if ((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt) | ||
1044 | && (priv->CurrAntennaIndex == 1)) { | ||
1045 | /* We set Aux antenna as default but RxOk count was less than Main ones. */ | ||
1046 | |||
1047 | /* Switch to Main antenna. */ | ||
1048 | SwitchAntenna(dev); | ||
1049 | priv->bHWAdSwitched = true; | ||
1050 | } else { | ||
1051 | /* Default antenna is better. */ | ||
1052 | |||
1053 | /* Still need to check current signal strength. */ | ||
1054 | priv->bHWAdSwitched = false; | ||
1055 | } | ||
1056 | /* | ||
1057 | * <Roger_Notes> We evaluate Rx signal strength ONLY when default antenna | ||
1058 | * didn't change by HW evaluation. | ||
1059 | * 2008.02.27. | ||
1060 | * | ||
1061 | * [TRC Dell Lab] SignalStrength is inaccuracy. Isaiah 2008-03-05 | ||
1062 | * For example, Throughput of aux is better than main antenna(about 10M v.s 2M), | ||
1063 | * but AdRxSignalStrength is less than main. | ||
1064 | * Our guess is that main antenna have lower throughput and get many change | ||
1065 | * to receive more CCK packets(ex.Beacon) which have stronger SignalStrength. | ||
1066 | */ | ||
1067 | if ((!priv->bHWAdSwitched) && (bSwCheckSS)) { | ||
1068 | /* Evaluate Rx signal strength if we shall switch antenna now. */ | ||
1069 | if (priv->AdRxSignalStrength < priv->AdRxSsThreshold) { | ||
1070 | /* Rx signal strength is weak => Switch Antenna. */ | ||
1071 | priv->AdRxSsBeforeSwitched = priv->AdRxSignalStrength; | ||
1072 | priv->bAdSwitchedChecking = true; | ||
1073 | |||
1074 | SwitchAntenna(dev); | ||
1075 | } else { | ||
1076 | /* Rx signal strength is OK. */ | ||
1077 | priv->bAdSwitchedChecking = false; | ||
1078 | /* Increase Rx signal strength threshold if necessary. */ | ||
1079 | if ((priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && /* Signal is much stronger than current threshold */ | ||
1080 | priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) { /* Current threhold is not yet reach upper limit. */ | ||
1081 | |||
1082 | priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2; | ||
1083 | priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ? | ||
1084 | priv->AdMaxRxSsThreshold : priv->AdRxSsThreshold;/* +by amy 080312 */ | ||
1085 | } | ||
1086 | |||
1087 | /* Reduce Antenna Diversity checking period if possible. */ | ||
1088 | if (priv->AdCheckPeriod > priv->AdMinCheckPeriod) | ||
1089 | priv->AdCheckPeriod /= 2; | ||
1090 | } | ||
1091 | } | ||
1092 | } | ||
1093 | /* Reset antenna diversity Rx related statistics. */ | ||
1094 | priv->AdRxOkCnt = 0; | ||
1095 | priv->AdMainAntennaRxOkCnt = 0; | ||
1096 | priv->AdAuxAntennaRxOkCnt = 0; | ||
1097 | } | ||
1098 | |||
1099 | /* Return TRUE if we shall perform Tx Power Tracking Mechanism, FALSE otherwise. */ | ||
1100 | bool CheckTxPwrTracking(struct net_device *dev) | ||
1101 | { | ||
1102 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1103 | |||
1104 | if (!priv->bTxPowerTrack) | ||
1105 | return false; | ||
1106 | |||
1107 | /* if 87SE is in High Power , don't do Tx Power Tracking. asked by SD3 ED. 2008-08-08 Isaiah */ | ||
1108 | if (priv->bToUpdateTxPwr) | ||
1109 | return false; | ||
1110 | |||
1111 | return true; | ||
1112 | } | ||
1113 | |||
1114 | |||
1115 | /* Timer callback function of SW Antenna Diversity. */ | ||
1116 | void SwAntennaDiversityTimerCallback(struct net_device *dev) | ||
1117 | { | ||
1118 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1119 | enum rt_rf_power_state rtState; | ||
1120 | |||
1121 | /* We do NOT need to switch antenna while RF is off. */ | ||
1122 | rtState = priv->eRFPowerState; | ||
1123 | do { | ||
1124 | if (rtState == RF_OFF) { | ||
1125 | break; | ||
1126 | } else if (rtState == RF_SLEEP) { | ||
1127 | /* Don't access BB/RF under Disable PLL situation. */ | ||
1128 | break; | ||
1129 | } | ||
1130 | SwAntennaDiversity(dev); | ||
1131 | |||
1132 | } while (false); | ||
1133 | |||
1134 | if (priv->up) { | ||
1135 | priv->SwAntennaDiversityTimer.expires = jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD); | ||
1136 | add_timer(&priv->SwAntennaDiversityTimer); | ||
1137 | } | ||
1138 | } | ||
1139 | |||
diff --git a/drivers/staging/rtl8187se/r8180_dm.h b/drivers/staging/rtl8187se/r8180_dm.h deleted file mode 100644 index cb4046f346ef..000000000000 --- a/drivers/staging/rtl8187se/r8180_dm.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #ifndef R8180_DM_H | ||
2 | #define R8180_DM_H | ||
3 | |||
4 | #include "r8180.h" | ||
5 | /* #include "r8180_hw.h" */ | ||
6 | /* #include "r8180_93cx6.h" */ | ||
7 | void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength); | ||
8 | bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex); | ||
9 | bool SwitchAntenna(struct net_device *dev); | ||
10 | void SwAntennaDiversity(struct net_device *dev); | ||
11 | void SwAntennaDiversityTimerCallback(struct net_device *dev); | ||
12 | bool CheckDig(struct net_device *dev); | ||
13 | bool CheckHighPower(struct net_device *dev); | ||
14 | void rtl8180_hw_dig_wq(struct work_struct *work); | ||
15 | void rtl8180_tx_pw_wq(struct work_struct *work); | ||
16 | void rtl8180_rate_adapter(struct work_struct *work); | ||
17 | void TxPwrTracking87SE(struct net_device *dev); | ||
18 | bool CheckTxPwrTracking(struct net_device *dev); | ||
19 | void rtl8180_rate_adapter(struct work_struct *work); | ||
20 | void timer_rate_adaptive(unsigned long data); | ||
21 | |||
22 | |||
23 | #endif | ||
diff --git a/drivers/staging/rtl8187se/r8180_hw.h b/drivers/staging/rtl8187se/r8180_hw.h deleted file mode 100644 index e59d74f8ecfc..000000000000 --- a/drivers/staging/rtl8187se/r8180_hw.h +++ /dev/null | |||
@@ -1,588 +0,0 @@ | |||
1 | /* | ||
2 | This is part of rtl8180 OpenSource driver. | ||
3 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> | ||
4 | Released under the terms of GPL (General Public Licence) | ||
5 | |||
6 | Parts of this driver are based on the GPL part of the | ||
7 | official Realtek driver. | ||
8 | Parts of this driver are based on the rtl8180 driver skeleton | ||
9 | from Patric Schenke & Andres Salomon. | ||
10 | Parts of this driver are based on the Intel Pro Wireless | ||
11 | 2100 GPL driver. | ||
12 | |||
13 | We want to tanks the Authors of those projects | ||
14 | and the Ndiswrapper project Authors. | ||
15 | */ | ||
16 | |||
17 | /* Mariusz Matuszek added full registers definition with Realtek's name */ | ||
18 | |||
19 | /* this file contains register definitions for the rtl8180 MAC controller */ | ||
20 | #ifndef R8180_HW | ||
21 | #define R8180_HW | ||
22 | |||
23 | |||
24 | #define BIT0 0x00000001 | ||
25 | #define BIT1 0x00000002 | ||
26 | #define BIT2 0x00000004 | ||
27 | #define BIT3 0x00000008 | ||
28 | #define BIT4 0x00000010 | ||
29 | #define BIT5 0x00000020 | ||
30 | #define BIT6 0x00000040 | ||
31 | #define BIT7 0x00000080 | ||
32 | #define BIT9 0x00000200 | ||
33 | #define BIT11 0x00000800 | ||
34 | #define BIT13 0x00002000 | ||
35 | #define BIT15 0x00008000 | ||
36 | #define BIT20 0x00100000 | ||
37 | #define BIT21 0x00200000 | ||
38 | #define BIT22 0x00400000 | ||
39 | #define BIT23 0x00800000 | ||
40 | #define BIT24 0x01000000 | ||
41 | #define BIT25 0x02000000 | ||
42 | #define BIT26 0x04000000 | ||
43 | #define BIT27 0x08000000 | ||
44 | #define BIT28 0x10000000 | ||
45 | #define BIT29 0x20000000 | ||
46 | #define BIT30 0x40000000 | ||
47 | #define BIT31 0x80000000 | ||
48 | |||
49 | #define MAX_SLEEP_TIME (10000) | ||
50 | #define MIN_SLEEP_TIME (50) | ||
51 | |||
52 | #define BB_HOST_BANG_EN (1<<2) | ||
53 | #define BB_HOST_BANG_CLK (1<<1) | ||
54 | |||
55 | #define MAC0 0 | ||
56 | #define MAC4 4 | ||
57 | |||
58 | #define CMD 0x37 | ||
59 | #define CMD_RST_SHIFT 4 | ||
60 | #define CMD_RX_ENABLE_SHIFT 3 | ||
61 | #define CMD_TX_ENABLE_SHIFT 2 | ||
62 | |||
63 | #define EPROM_CMD 0x50 | ||
64 | #define EPROM_CMD_RESERVED_MASK ((1<<5)|(1<<4)) | ||
65 | #define EPROM_CMD_OPERATING_MODE_SHIFT 6 | ||
66 | #define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) | ||
67 | #define EPROM_CMD_CONFIG 0x3 | ||
68 | #define EPROM_CMD_NORMAL 0 | ||
69 | #define EPROM_CMD_LOAD 1 | ||
70 | #define EPROM_CMD_PROGRAM 2 | ||
71 | #define EPROM_CS_SHIFT 3 | ||
72 | #define EPROM_CK_SHIFT 2 | ||
73 | #define EPROM_W_SHIFT 1 | ||
74 | #define EPROM_R_SHIFT 0 | ||
75 | #define CONFIG2_DMA_POLLING_MODE_SHIFT 3 | ||
76 | |||
77 | #define INTA_TXOVERFLOW (1<<15) | ||
78 | #define INTA_TIMEOUT (1<<14) | ||
79 | #define INTA_HIPRIORITYDESCERR (1<<9) | ||
80 | #define INTA_HIPRIORITYDESCOK (1<<8) | ||
81 | #define INTA_NORMPRIORITYDESCERR (1<<7) | ||
82 | #define INTA_NORMPRIORITYDESCOK (1<<6) | ||
83 | #define INTA_RXOVERFLOW (1<<5) | ||
84 | #define INTA_RXDESCERR (1<<4) | ||
85 | #define INTA_LOWPRIORITYDESCERR (1<<3) | ||
86 | #define INTA_LOWPRIORITYDESCOK (1<<2) | ||
87 | #define INTA_RXOK (1) | ||
88 | #define INTA_MASK 0x3c | ||
89 | |||
90 | #define RXRING_ADDR 0xe4 /* page 0 */ | ||
91 | #define PGSELECT 0x5e | ||
92 | #define PGSELECT_PG_SHIFT 0 | ||
93 | #define RX_CONF 0x44 | ||
94 | #define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \ | ||
95 | (1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)) | ||
96 | #define RX_CHECK_BSSID_SHIFT 23 | ||
97 | #define ACCEPT_PWR_FRAME_SHIFT 22 | ||
98 | #define ACCEPT_MNG_FRAME_SHIFT 20 | ||
99 | #define ACCEPT_CTL_FRAME_SHIFT 19 | ||
100 | #define ACCEPT_DATA_FRAME_SHIFT 18 | ||
101 | #define ACCEPT_ICVERR_FRAME_SHIFT 12 | ||
102 | #define ACCEPT_CRCERR_FRAME_SHIFT 5 | ||
103 | #define ACCEPT_BCAST_FRAME_SHIFT 3 | ||
104 | #define ACCEPT_MCAST_FRAME_SHIFT 2 | ||
105 | #define ACCEPT_ALLMAC_FRAME_SHIFT 0 | ||
106 | #define ACCEPT_NICMAC_FRAME_SHIFT 1 | ||
107 | |||
108 | #define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15)) | ||
109 | #define RX_FIFO_THRESHOLD_SHIFT 13 | ||
110 | #define RX_FIFO_THRESHOLD_NONE 7 | ||
111 | #define RX_AUTORESETPHY_SHIFT 28 | ||
112 | |||
113 | #define TX_CONF 0x40 | ||
114 | #define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30 | ||
115 | #define TX_LOOPBACK_SHIFT 17 | ||
116 | #define TX_LOOPBACK_NONE 0 | ||
117 | #define TX_LOOPBACK_CONTINUE 3 | ||
118 | #define TX_LOOPBACK_MASK ((1<<17)|(1<<18)) | ||
119 | #define TX_DPRETRY_SHIFT 0 | ||
120 | #define R8180_MAX_RETRY 255 | ||
121 | #define TX_RTSRETRY_SHIFT 8 | ||
122 | #define TX_NOICV_SHIFT 19 | ||
123 | #define TX_NOCRC_SHIFT 16 | ||
124 | #define TX_DMA_POLLING 0xd9 | ||
125 | #define TX_DMA_POLLING_BEACON_SHIFT 7 | ||
126 | #define TX_DMA_POLLING_HIPRIORITY_SHIFT 6 | ||
127 | #define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5 | ||
128 | #define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4 | ||
129 | #define TX_MANAGEPRIORITY_RING_ADDR 0x0C | ||
130 | #define TX_BKPRIORITY_RING_ADDR 0x10 | ||
131 | #define TX_BEPRIORITY_RING_ADDR 0x14 | ||
132 | #define TX_VIPRIORITY_RING_ADDR 0x20 | ||
133 | #define TX_VOPRIORITY_RING_ADDR 0x24 | ||
134 | #define TX_HIGHPRIORITY_RING_ADDR 0x28 | ||
135 | #define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10)) | ||
136 | #define MAX_RX_DMA_2048 7 | ||
137 | #define MAX_RX_DMA_1024 6 | ||
138 | #define MAX_RX_DMA_SHIFT 10 | ||
139 | #define INT_TIMEOUT 0x48 | ||
140 | #define CONFIG3_CLKRUN_SHIFT 2 | ||
141 | #define CONFIG3_ANAPARAM_W_SHIFT 6 | ||
142 | #define ANAPARAM 0x54 | ||
143 | #define BEACON_INTERVAL 0x70 | ||
144 | #define BEACON_INTERVAL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)| \ | ||
145 | (1<<6)|(1<<7)|(1<<8)|(1<<9)) | ||
146 | #define ATIM_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)| \ | ||
147 | (1<<8)|(1<<9)) | ||
148 | #define ATIM 0x72 | ||
149 | #define EPROM_CS_SHIFT 3 | ||
150 | #define EPROM_CK_SHIFT 2 | ||
151 | #define PHY_ADR 0x7c | ||
152 | #define SECURITY 0x5f /* 1209 this is sth wrong */ | ||
153 | #define SECURITY_WEP_TX_ENABLE_SHIFT 1 | ||
154 | #define SECURITY_WEP_RX_ENABLE_SHIFT 0 | ||
155 | #define SECURITY_ENCRYP_104 1 | ||
156 | #define SECURITY_ENCRYP_SHIFT 4 | ||
157 | #define SECURITY_ENCRYP_MASK ((1<<4)|(1<<5)) | ||
158 | #define KEY0 0x90 /* 1209 this is sth wrong */ | ||
159 | #define CONFIG2_ANTENNA_SHIFT 6 | ||
160 | #define TX_BEACON_RING_ADDR 0x4c | ||
161 | #define CONFIG0_WEP40_SHIFT 7 | ||
162 | #define CONFIG0_WEP104_SHIFT 6 | ||
163 | #define AGCRESET_SHIFT 5 | ||
164 | |||
165 | |||
166 | |||
167 | /* | ||
168 | * Operational registers offsets in PCI (I/O) space. | ||
169 | * RealTek names are used. | ||
170 | */ | ||
171 | |||
172 | #define TSFTR 0x0018 | ||
173 | |||
174 | #define TLPDA 0x0020 | ||
175 | |||
176 | #define BSSID 0x002E | ||
177 | |||
178 | #define CR 0x0037 | ||
179 | |||
180 | #define RF_SW_CONFIG 0x8 /* store data which is transmitted to RF for driver */ | ||
181 | #define RF_SW_CFG_SI BIT1 | ||
182 | #define EIFS 0x2D /* Extended InterFrame Space Timer, in unit of 4 us. */ | ||
183 | |||
184 | #define BRSR 0x34 /* Basic rate set */ | ||
185 | |||
186 | #define IMR 0x006C | ||
187 | #define ISR 0x003C | ||
188 | |||
189 | #define TCR 0x0040 | ||
190 | |||
191 | #define RCR 0x0044 | ||
192 | |||
193 | #define TimerInt 0x0048 | ||
194 | |||
195 | #define CR9346 0x0050 | ||
196 | |||
197 | #define CONFIG0 0x0051 | ||
198 | #define CONFIG2 0x0053 | ||
199 | |||
200 | #define MSR 0x0058 | ||
201 | |||
202 | #define CONFIG3 0x0059 | ||
203 | #define CONFIG4 0x005A | ||
204 | /* SD3 szuyitasi: Mac0x57= CC -> B0 Mac0x60= D1 -> C6 */ | ||
205 | /* Mac0x60 = 0x000004C6 power save parameters */ | ||
206 | #define ANAPARM_ASIC_ON 0xB0054D00 | ||
207 | #define ANAPARM2_ASIC_ON 0x000004C6 | ||
208 | |||
209 | #define ANAPARM_ON ANAPARM_ASIC_ON | ||
210 | #define ANAPARM2_ON ANAPARM2_ASIC_ON | ||
211 | |||
212 | #define TESTR 0x005B | ||
213 | |||
214 | #define PSR 0x005E | ||
215 | |||
216 | #define BcnItv 0x0070 | ||
217 | |||
218 | #define AtimWnd 0x0072 | ||
219 | |||
220 | #define BintrItv 0x0074 | ||
221 | |||
222 | #define PhyAddr 0x007C | ||
223 | #define PhyDataR 0x007E | ||
224 | |||
225 | /* following are for rtl8185 */ | ||
226 | #define RFPinsOutput 0x80 | ||
227 | #define RFPinsEnable 0x82 | ||
228 | #define RF_TIMING 0x8c | ||
229 | #define RFPinsSelect 0x84 | ||
230 | #define ANAPARAM2 0x60 | ||
231 | #define RF_PARA 0x88 | ||
232 | #define RFPinsInput 0x86 | ||
233 | #define GP_ENABLE 0x90 | ||
234 | #define GPIO 0x91 | ||
235 | #define SW_CONTROL_GPIO 0x400 | ||
236 | #define TX_ANTENNA 0x9f | ||
237 | #define TX_GAIN_OFDM 0x9e | ||
238 | #define TX_GAIN_CCK 0x9d | ||
239 | #define WPA_CONFIG 0xb0 | ||
240 | #define TX_AGC_CTL 0x9c | ||
241 | #define TX_AGC_CTL_PERPACKET_GAIN_SHIFT 0 | ||
242 | #define TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT 1 | ||
243 | #define TX_AGC_CTL_FEEDBACK_ANT 2 | ||
244 | #define RESP_RATE 0x34 | ||
245 | #define SIFS 0xb4 | ||
246 | #define DIFS 0xb5 | ||
247 | |||
248 | #define SLOT 0xb6 | ||
249 | #define CW_CONF 0xbc | ||
250 | #define CW_CONF_PERPACKET_RETRY_SHIFT 1 | ||
251 | #define CW_CONF_PERPACKET_CW_SHIFT 0 | ||
252 | #define CW_VAL 0xbd | ||
253 | #define MAX_RESP_RATE_SHIFT 4 | ||
254 | #define MIN_RESP_RATE_SHIFT 0 | ||
255 | #define RATE_FALLBACK 0xbe | ||
256 | |||
257 | #define CONFIG5 0x00D8 | ||
258 | |||
259 | #define PHYPR 0xDA /* 0xDA - 0x0B PHY Parameter Register. */ | ||
260 | |||
261 | #define FEMR 0x1D4 /* Function Event Mask register */ | ||
262 | |||
263 | #define FFER 0x00FC | ||
264 | #define FFER_END 0x00FF | ||
265 | |||
266 | |||
267 | |||
268 | /* | ||
269 | * Bitmasks for specific register functions. | ||
270 | * Names are derived from the register name and function name. | ||
271 | * | ||
272 | * <REGISTER>_<FUNCTION>[<bit>] | ||
273 | * | ||
274 | * this leads to some awkward names... | ||
275 | */ | ||
276 | |||
277 | #define BRSR_BPLCP ((1 << 8)) | ||
278 | #define BRSR_MBR ((1 << 1)|(1 << 0)) | ||
279 | #define BRSR_MBR_8185 ((1 << 11)|(1 << 10)|(1 << 9)|(1 << 8)|(1 << 7)|(1 << 6)|(1 << 5)|(1 << 4)|(1 << 3)|(1 << 2)|(1 << 1)|(1 << 0)) | ||
280 | #define BRSR_MBR0 ((1 << 0)) | ||
281 | #define BRSR_MBR1 ((1 << 1)) | ||
282 | |||
283 | #define CR_RST ((1 << 4)) | ||
284 | #define CR_RE ((1 << 3)) | ||
285 | #define CR_TE ((1 << 2)) | ||
286 | #define CR_MulRW ((1 << 0)) | ||
287 | |||
288 | #define IMR_Dot11hInt ((1 << 25)) /*802.11h Measurement Interrupt */ | ||
289 | #define IMR_BcnDmaInt ((1 << 24)) /*Beacon DMA Interrupt */ /*What differenct between BcnDmaInt and BcnInt??? */ | ||
290 | #define IMR_WakeInt ((1 << 23)) /*Wake Up Interrupt */ | ||
291 | #define IMR_TXFOVW ((1 << 22)) /*Tx FIFO Overflow Interrupt */ | ||
292 | #define IMR_TimeOut1 ((1 << 21)) /*Time Out Interrupt 1 */ | ||
293 | #define IMR_BcnInt ((1 << 20)) /*Beacon Time out Interrupt */ | ||
294 | #define IMR_ATIMInt ((1 << 19)) /*ATIM Time Out Interrupt */ | ||
295 | #define IMR_TBDER ((1 << 18)) /*Tx Beacon Descriptor Error Interrupt */ | ||
296 | #define IMR_TBDOK ((1 << 17)) /*Tx Beacon Descriptor OK Interrupt */ | ||
297 | #define IMR_THPDER ((1 << 16)) /*Tx High Priority Descriptor Error Interrupt */ | ||
298 | #define IMR_THPDOK ((1 << 15)) /*Tx High Priority Descriptor OK Interrupt */ | ||
299 | #define IMR_TVODER ((1 << 14)) /*Tx AC_VO Descriptor Error Interrupt */ | ||
300 | #define IMR_TVODOK ((1 << 13)) /*Tx AC_VO Descriptor OK Interrupt */ | ||
301 | #define IMR_FOVW ((1 << 12)) /*Rx FIFO Overflow Interrupt */ | ||
302 | #define IMR_RDU ((1 << 11)) /*Rx Descriptor Unavailable Interrupt */ | ||
303 | #define IMR_TVIDER ((1 << 10)) /*Tx AC_VI Descriptor Error Interrupt */ | ||
304 | #define IMR_TVIDOK ((1 << 9)) /*Tx AC_VI Descriptor OK Interrupt */ | ||
305 | #define IMR_RER ((1 << 8)) /*Rx Error Interrupt */ | ||
306 | #define IMR_ROK ((1 << 7)) /*Receive OK Interrupt */ | ||
307 | #define IMR_TBEDER ((1 << 6)) /*Tx AC_BE Descriptor Error Interrupt */ | ||
308 | #define IMR_TBEDOK ((1 << 5)) /*Tx AC_BE Descriptor OK Interrupt */ | ||
309 | #define IMR_TBKDER ((1 << 4)) /*Tx AC_BK Descriptor Error Interrupt */ | ||
310 | #define IMR_TBKDOK ((1 << 3)) /*Tx AC_BK Descriptor OK Interrupt */ | ||
311 | #define IMR_RQoSOK ((1 << 2)) /*Rx QoS OK Interrupt */ | ||
312 | #define IMR_TimeOut2 ((1 << 1)) /*Time Out Interrupt 2 */ | ||
313 | #define IMR_TimeOut3 ((1 << 0)) /*Time Out Interrupt 3 */ | ||
314 | #define IMR_TMGDOK ((1 << 30)) | ||
315 | #define ISR_Dot11hInt ((1 << 25)) /*802.11h Measurement Interrupt */ | ||
316 | #define ISR_BcnDmaInt ((1 << 24)) /*Beacon DMA Interrupt */ /*What differenct between BcnDmaInt and BcnInt??? */ | ||
317 | #define ISR_WakeInt ((1 << 23)) /*Wake Up Interrupt */ | ||
318 | #define ISR_TXFOVW ((1 << 22)) /*Tx FIFO Overflow Interrupt */ | ||
319 | #define ISR_TimeOut1 ((1 << 21)) /*Time Out Interrupt 1 */ | ||
320 | #define ISR_BcnInt ((1 << 20)) /*Beacon Time out Interrupt */ | ||
321 | #define ISR_ATIMInt ((1 << 19)) /*ATIM Time Out Interrupt */ | ||
322 | #define ISR_TBDER ((1 << 18)) /*Tx Beacon Descriptor Error Interrupt */ | ||
323 | #define ISR_TBDOK ((1 << 17)) /*Tx Beacon Descriptor OK Interrupt */ | ||
324 | #define ISR_THPDER ((1 << 16)) /*Tx High Priority Descriptor Error Interrupt */ | ||
325 | #define ISR_THPDOK ((1 << 15)) /*Tx High Priority Descriptor OK Interrupt */ | ||
326 | #define ISR_TVODER ((1 << 14)) /*Tx AC_VO Descriptor Error Interrupt */ | ||
327 | #define ISR_TVODOK ((1 << 13)) /*Tx AC_VO Descriptor OK Interrupt */ | ||
328 | #define ISR_FOVW ((1 << 12)) /*Rx FIFO Overflow Interrupt */ | ||
329 | #define ISR_RDU ((1 << 11)) /*Rx Descriptor Unavailable Interrupt */ | ||
330 | #define ISR_TVIDER ((1 << 10)) /*Tx AC_VI Descriptor Error Interrupt */ | ||
331 | #define ISR_TVIDOK ((1 << 9)) /*Tx AC_VI Descriptor OK Interrupt */ | ||
332 | #define ISR_RER ((1 << 8)) /*Rx Error Interrupt */ | ||
333 | #define ISR_ROK ((1 << 7)) /*Receive OK Interrupt */ | ||
334 | #define ISR_TBEDER ((1 << 6)) /*Tx AC_BE Descriptor Error Interrupt */ | ||
335 | #define ISR_TBEDOK ((1 << 5)) /*Tx AC_BE Descriptor OK Interrupt */ | ||
336 | #define ISR_TBKDER ((1 << 4)) /*Tx AC_BK Descriptor Error Interrupt */ | ||
337 | #define ISR_TBKDOK ((1 << 3)) /*Tx AC_BK Descriptor OK Interrupt */ | ||
338 | #define ISR_RQoSOK ((1 << 2)) /*Rx QoS OK Interrupt */ | ||
339 | #define ISR_TimeOut2 ((1 << 1)) /*Time Out Interrupt 2 */ | ||
340 | #define ISR_TimeOut3 ((1 << 0)) /*Time Out Interrupt 3 */ | ||
341 | |||
342 | /* these definition is used for Tx/Rx test temporarily */ | ||
343 | #define ISR_TLPDER ISR_TVIDER | ||
344 | #define ISR_TLPDOK ISR_TVIDOK | ||
345 | #define ISR_TNPDER ISR_TVODER | ||
346 | #define ISR_TNPDOK ISR_TVODOK | ||
347 | #define ISR_TimeOut ISR_TimeOut1 | ||
348 | #define ISR_RXFOVW ISR_FOVW | ||
349 | |||
350 | |||
351 | #define HW_VERID_R8180_F 3 | ||
352 | #define HW_VERID_R8180_ABCD 2 | ||
353 | #define HW_VERID_R8185_ABC 4 | ||
354 | #define HW_VERID_R8185_D 5 | ||
355 | #define HW_VERID_R8185B_B 6 | ||
356 | |||
357 | #define TCR_CWMIN ((1 << 31)) | ||
358 | #define TCR_SWSEQ ((1 << 30)) | ||
359 | #define TCR_HWVERID_MASK ((1 << 27)|(1 << 26)|(1 << 25)) | ||
360 | #define TCR_HWVERID_SHIFT 25 | ||
361 | #define TCR_SAT ((1 << 24)) | ||
362 | #define TCR_PLCP_LEN TCR_SAT /* rtl8180 */ | ||
363 | #define TCR_MXDMA_MASK ((1 << 23)|(1 << 22)|(1 << 21)) | ||
364 | #define TCR_MXDMA_1024 6 | ||
365 | #define TCR_MXDMA_2048 7 | ||
366 | #define TCR_MXDMA_SHIFT 21 | ||
367 | #define TCR_DISCW ((1 << 20)) | ||
368 | #define TCR_ICV ((1 << 19)) | ||
369 | #define TCR_LBK ((1 << 18)|(1 << 17)) | ||
370 | #define TCR_LBK1 ((1 << 18)) | ||
371 | #define TCR_LBK0 ((1 << 17)) | ||
372 | #define TCR_CRC ((1 << 16)) | ||
373 | #define TCR_DPRETRY_MASK ((1 << 15)|(1 << 14)|(1 << 13)|(1 << 12)|(1 << 11)|(1 << 10)|(1 << 9)|(1 << 8)) | ||
374 | #define TCR_RTSRETRY_MASK ((1 << 0)|(1 << 1)|(1 << 2)|(1 << 3)|(1 << 4)|(1 << 5)|(1 << 6)|(1 << 7)) | ||
375 | #define TCR_PROBE_NOTIMESTAMP_SHIFT 29 /* rtl8185 */ | ||
376 | |||
377 | #define RCR_ONLYERLPKT ((1 << 31)) | ||
378 | #define RCR_CS_SHIFT 29 | ||
379 | #define RCR_CS_MASK ((1 << 30) | (1 << 29)) | ||
380 | #define RCR_ENMARP ((1 << 28)) | ||
381 | #define RCR_CBSSID ((1 << 23)) | ||
382 | #define RCR_APWRMGT ((1 << 22)) | ||
383 | #define RCR_ADD3 ((1 << 21)) | ||
384 | #define RCR_AMF ((1 << 20)) | ||
385 | #define RCR_ACF ((1 << 19)) | ||
386 | #define RCR_ADF ((1 << 18)) | ||
387 | #define RCR_RXFTH ((1 << 15)|(1 << 14)|(1 << 13)) | ||
388 | #define RCR_RXFTH2 ((1 << 15)) | ||
389 | #define RCR_RXFTH1 ((1 << 14)) | ||
390 | #define RCR_RXFTH0 ((1 << 13)) | ||
391 | #define RCR_AICV ((1 << 12)) | ||
392 | #define RCR_MXDMA ((1 << 10)|(1 << 9)|(1 << 8)) | ||
393 | #define RCR_MXDMA2 ((1 << 10)) | ||
394 | #define RCR_MXDMA1 ((1 << 9)) | ||
395 | #define RCR_MXDMA0 ((1 << 8)) | ||
396 | #define RCR_9356SEL ((1 << 6)) | ||
397 | #define RCR_ACRC32 ((1 << 5)) | ||
398 | #define RCR_AB ((1 << 3)) | ||
399 | #define RCR_AM ((1 << 2)) | ||
400 | #define RCR_APM ((1 << 1)) | ||
401 | #define RCR_AAP ((1 << 0)) | ||
402 | |||
403 | #define CR9346_EEM ((1 << 7)|(1 << 6)) | ||
404 | #define CR9346_EEM1 ((1 << 7)) | ||
405 | #define CR9346_EEM0 ((1 << 6)) | ||
406 | #define CR9346_EECS ((1 << 3)) | ||
407 | #define CR9346_EESK ((1 << 2)) | ||
408 | #define CR9346_EED1 ((1 << 1)) | ||
409 | #define CR9346_EED0 ((1 << 0)) | ||
410 | |||
411 | #define CONFIG3_PARM_En ((1 << 6)) | ||
412 | #define CONFIG3_FuncRegEn ((1 << 1)) | ||
413 | |||
414 | #define CONFIG4_PWRMGT ((1 << 5)) | ||
415 | |||
416 | #define MSR_LINK_MASK ((1 << 2)|(1 << 3)) | ||
417 | #define MSR_LINK_MANAGED 2 | ||
418 | #define MSR_LINK_NONE 0 | ||
419 | #define MSR_LINK_SHIFT 2 | ||
420 | #define MSR_LINK_ADHOC 1 | ||
421 | #define MSR_LINK_MASTER 3 | ||
422 | |||
423 | #define BcnItv_BcnItv (0x01FF) | ||
424 | |||
425 | #define AtimWnd_AtimWnd (0x01FF) | ||
426 | |||
427 | #define BintrItv_BintrItv (0x01FF) | ||
428 | |||
429 | #define FEMR_INTR ((1 << 15)) | ||
430 | #define FEMR_WKUP ((1 << 14)) | ||
431 | #define FEMR_GWAKE ((1 << 4)) | ||
432 | |||
433 | #define FFER_INTR ((1 << 15)) | ||
434 | #define FFER_GWAKE ((1 << 4)) | ||
435 | |||
436 | /* Three wire mode. */ | ||
437 | #define SW_THREE_WIRE 0 | ||
438 | #define HW_THREE_WIRE 2 | ||
439 | /* RTL8187S by amy */ | ||
440 | #define HW_THREE_WIRE_PI 5 | ||
441 | #define HW_THREE_WIRE_SI 6 | ||
442 | /* by amy */ | ||
443 | #define TCR_LRL_OFFSET 0 | ||
444 | #define TCR_SRL_OFFSET 8 | ||
445 | #define TCR_MXDMA_OFFSET 21 | ||
446 | #define TCR_DISReqQsize_OFFSET 28 | ||
447 | #define TCR_DurProcMode_OFFSET 30 | ||
448 | |||
449 | #define RCR_MXDMA_OFFSET 8 | ||
450 | #define RCR_FIFO_OFFSET 13 | ||
451 | |||
452 | #define AckTimeOutReg 0x79 /* ACK timeout register, in unit of 4 us. */ | ||
453 | |||
454 | #define RFTiming 0x8C | ||
455 | |||
456 | #define TPPollStop 0x93 | ||
457 | |||
458 | #define TXAGC_CTL 0x9C /*< RJ_TODO_8185B> TX_AGC_CONTROL (0x9C seems be removed at 8185B, see p37). */ | ||
459 | #define CCK_TXAGC 0x9D | ||
460 | #define OFDM_TXAGC 0x9E | ||
461 | #define ANTSEL 0x9F | ||
462 | |||
463 | #define ACM_CONTROL 0x00BF /* ACM Control Registe */ | ||
464 | |||
465 | #define IntMig 0xE2 /* Interrupt Migration (0xE2 ~ 0xE3) */ | ||
466 | |||
467 | #define TID_AC_MAP 0xE8 /* TID to AC Mapping Register */ | ||
468 | |||
469 | #define ANAPARAM3 0xEE /* <RJ_TODO_8185B> How to use it? */ | ||
470 | |||
471 | #define AC_VO_PARAM 0xF0 /* AC_VO Parameters Record */ | ||
472 | #define AC_VI_PARAM 0xF4 /* AC_VI Parameters Record */ | ||
473 | #define AC_BE_PARAM 0xF8 /* AC_BE Parameters Record */ | ||
474 | #define AC_BK_PARAM 0xFC /* AC_BK Parameters Record */ | ||
475 | |||
476 | #define GPIOCtrl 0x16B /*GPIO Control Register. */ | ||
477 | #define ARFR 0x1E0 /* Auto Rate Fallback Register (0x1e0 ~ 0x1e2) */ | ||
478 | |||
479 | #define RFSW_CTRL 0x272 /* 0x272-0x273. */ | ||
480 | #define SW_3W_DB0 0x274 /* Software 3-wire data buffer bit 31~0. */ | ||
481 | #define SW_3W_DB1 0x278 /* Software 3-wire data buffer bit 63~32. */ | ||
482 | #define SW_3W_CMD0 0x27C /* Software 3-wire Control/Status Register. */ | ||
483 | #define SW_3W_CMD1 0x27D /* Software 3-wire Control/Status Register. */ | ||
484 | |||
485 | #define PI_DATA_READ 0X360 /* 0x360 - 0x361 Parallel Interface Data Register. */ | ||
486 | #define SI_DATA_READ 0x362 /* 0x362 - 0x363 Serial Interface Data Register. */ | ||
487 | |||
488 | /* | ||
489 | ---------------------------------------------------------------------------- | ||
490 | 8185B TPPollStop bits (offset 0x93, 1 byte) | ||
491 | ---------------------------------------------------------------------------- | ||
492 | */ | ||
493 | #define TPPOLLSTOP_BQ (0x01 << 7) | ||
494 | #define TPPOLLSTOP_AC_VIQ (0x01 << 4) | ||
495 | |||
496 | #define MSR_LINK_ENEDCA (1<<4) | ||
497 | |||
498 | /* | ||
499 | ---------------------------------------------------------------------------- | ||
500 | 8187B AC_XX_PARAM bits | ||
501 | ---------------------------------------------------------------------------- | ||
502 | */ | ||
503 | #define AC_PARAM_TXOP_LIMIT_OFFSET 16 | ||
504 | #define AC_PARAM_ECW_MAX_OFFSET 12 | ||
505 | #define AC_PARAM_ECW_MIN_OFFSET 8 | ||
506 | #define AC_PARAM_AIFS_OFFSET 0 | ||
507 | |||
508 | /* | ||
509 | ---------------------------------------------------------------------------- | ||
510 | 8187B ACM_CONTROL bits (Offset 0xBF, 1 Byte) | ||
511 | ---------------------------------------------------------------------------- | ||
512 | */ | ||
513 | #define VOQ_ACM_EN (0x01 << 7) /*BIT7 */ | ||
514 | #define VIQ_ACM_EN (0x01 << 6) /*BIT6 */ | ||
515 | #define BEQ_ACM_EN (0x01 << 5) /*BIT5 */ | ||
516 | #define ACM_HW_EN (0x01 << 4) /*BIT4 */ | ||
517 | #define VOQ_ACM_CTL (0x01 << 2) /*BIT2 */ /* Set to 1 when AC_VO used time reaches or exceeds the admitted time */ | ||
518 | #define VIQ_ACM_CTL (0x01 << 1) /*BIT1 */ /* Set to 1 when AC_VI used time reaches or exceeds the admitted time */ | ||
519 | #define BEQ_ACM_CTL (0x01 << 0) /*BIT0 */ /* Set to 1 when AC_BE used time reaches or exceeds the admitted time */ | ||
520 | |||
521 | |||
522 | /* | ||
523 | ---------------------------------------------------------------------------- | ||
524 | 8185B SW_3W_CMD bits (Offset 0x27C-0x27D, 16bit) | ||
525 | ---------------------------------------------------------------------------- | ||
526 | */ | ||
527 | #define SW_3W_CMD0_HOLD ((1 << 7)) | ||
528 | #define SW_3W_CMD1_RE ((1 << 0)) /* BIT8 */ | ||
529 | #define SW_3W_CMD1_WE ((1 << 1)) /* BIT9 */ | ||
530 | #define SW_3W_CMD1_DONE ((1 << 2)) /* BIT10 */ | ||
531 | |||
532 | #define BB_HOST_BANG_RW (1 << 3) | ||
533 | |||
534 | /* | ||
535 | ---------------------------------------------------------------------------- | ||
536 | 8185B RATE_FALLBACK_CTL bits (Offset 0xBE, 8bit) | ||
537 | ---------------------------------------------------------------------------- | ||
538 | */ | ||
539 | #define RATE_FALLBACK_CTL_ENABLE ((1 << 7)) | ||
540 | #define RATE_FALLBACK_CTL_ENABLE_RTSCTS ((1 << 6)) | ||
541 | /* Auto rate fallback per 2^n retry. */ | ||
542 | #define RATE_FALLBACK_CTL_AUTO_STEP0 0x00 | ||
543 | #define RATE_FALLBACK_CTL_AUTO_STEP1 0x01 | ||
544 | #define RATE_FALLBACK_CTL_AUTO_STEP2 0x02 | ||
545 | #define RATE_FALLBACK_CTL_AUTO_STEP3 0x03 | ||
546 | |||
547 | |||
548 | #define RTL8225z2_ANAPARAM_OFF 0x55480658 | ||
549 | #define RTL8225z2_ANAPARAM2_OFF 0x72003f70 | ||
550 | /* by amy for power save */ | ||
551 | #define RF_CHANGE_BY_HW BIT30 | ||
552 | #define RF_CHANGE_BY_PS BIT29 | ||
553 | #define RF_CHANGE_BY_IPS BIT28 | ||
554 | /* by amy for power save */ | ||
555 | /* by amy for antenna */ | ||
556 | #define EEPROM_SW_REVD_OFFSET 0x3f | ||
557 | |||
558 | /* BIT[8-9] is for SW Antenna Diversity. | ||
559 | * Only the value EEPROM_SW_AD_ENABLE means enable, other values are disable. | ||
560 | */ | ||
561 | #define EEPROM_SW_AD_MASK 0x0300 | ||
562 | #define EEPROM_SW_AD_ENABLE 0x0100 | ||
563 | |||
564 | /* BIT[10-11] determine if Antenna 1 is the Default Antenna. | ||
565 | * Only the value EEPROM_DEF_ANT_1 means TRUE, other values are FALSE. | ||
566 | */ | ||
567 | #define EEPROM_DEF_ANT_MASK 0x0C00 | ||
568 | #define EEPROM_DEF_ANT_1 0x0400 | ||
569 | /*by amy for antenna */ | ||
570 | /* {by amy 080312 */ | ||
571 | /* 0x7C, 0x7D Crystal calibration and Tx Power tracking mechanism. Added by Roger. 2007.12.10. */ | ||
572 | #define EEPROM_RSV 0x7C | ||
573 | #define EEPROM_XTAL_CAL_XOUT_MASK 0x0F /* 0x7C[3:0], Crystal calibration for Xout. */ | ||
574 | #define EEPROM_XTAL_CAL_XIN_MASK 0xF0 /* 0x7C[7:4], Crystal calibration for Xin. */ | ||
575 | #define EEPROM_THERMAL_METER_MASK 0x0F00 /* 0x7D[3:0], Thermal meter reference level. */ | ||
576 | #define EEPROM_XTAL_CAL_ENABLE 0x1000 /* 0x7D[4], Crystal calibration enabled/disabled BIT. */ | ||
577 | #define EEPROM_THERMAL_METER_ENABLE 0x2000 /* 0x7D[5], Thermal meter enabled/disabled BIT. */ | ||
578 | #define EN_LPF_CAL 0x238 /* Enable LPF Calibration. */ | ||
579 | #define PWR_METER_EN BIT1 | ||
580 | /* <RJ_TODO_8185B> where are false alarm counters in 8185B? */ | ||
581 | #define CCK_FALSE_ALARM 0xD0 | ||
582 | /* by amy 080312} */ | ||
583 | |||
584 | /* YJ,add for Country IE, 080630 */ | ||
585 | #define EEPROM_COUNTRY_CODE 0x2E | ||
586 | /* YJ,add,080630,end */ | ||
587 | |||
588 | #endif | ||
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225.h b/drivers/staging/rtl8187se/r8180_rtl8225.h deleted file mode 100644 index 7df73927b3cc..000000000000 --- a/drivers/staging/rtl8187se/r8180_rtl8225.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* | ||
2 | * This is part of the rtl8180-sa2400 driver released under the GPL (See file | ||
3 | * COPYING for details). | ||
4 | * | ||
5 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> | ||
6 | * | ||
7 | * This files contains programming code for the rtl8225 radio frontend. | ||
8 | * | ||
9 | * *Many* thanks to Realtek Corp. for their great support! | ||
10 | */ | ||
11 | |||
12 | #include "r8180.h" | ||
13 | |||
14 | #define RTL8225_ANAPARAM_ON 0xa0000b59 | ||
15 | #define RTL8225_ANAPARAM_OFF 0xa00beb59 | ||
16 | #define RTL8225_ANAPARAM2_OFF 0x840dec11 | ||
17 | #define RTL8225_ANAPARAM2_ON 0x860dec11 | ||
18 | #define RTL8225_ANAPARAM_SLEEP 0xa00bab59 | ||
19 | #define RTL8225_ANAPARAM2_SLEEP 0x840dec11 | ||
20 | |||
21 | void rtl8225z2_rf_init(struct net_device *dev); | ||
22 | void rtl8225z2_rf_set_chan(struct net_device *dev, short ch); | ||
23 | void rtl8225z2_rf_close(struct net_device *dev); | ||
24 | |||
25 | void RF_WriteReg(struct net_device *dev, u8 offset, u16 data); | ||
26 | u16 RF_ReadReg(struct net_device *dev, u8 offset); | ||
27 | |||
28 | void rtl8180_set_mode(struct net_device *dev, int mode); | ||
29 | void rtl8180_set_mode(struct net_device *dev, int mode); | ||
30 | bool SetZebraRFPowerState8185(struct net_device *dev, | ||
31 | enum rt_rf_power_state eRFPowerState); | ||
32 | void rtl8225z4_rf_sleep(struct net_device *dev); | ||
33 | void rtl8225z4_rf_wakeup(struct net_device *dev); | ||
34 | |||
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c deleted file mode 100644 index 47104fa05c55..000000000000 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ /dev/null | |||
@@ -1,811 +0,0 @@ | |||
1 | /* | ||
2 | * This is part of the rtl8180-sa2400 driver | ||
3 | * released under the GPL (See file COPYING for details). | ||
4 | * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> | ||
5 | * | ||
6 | * This files contains programming code for the rtl8225 | ||
7 | * radio frontend. | ||
8 | * | ||
9 | * *Many* thanks to Realtek Corp. for their great support! | ||
10 | */ | ||
11 | |||
12 | #include "r8180_hw.h" | ||
13 | #include "r8180_rtl8225.h" | ||
14 | #include "r8180_93cx6.h" | ||
15 | |||
16 | #include "ieee80211/dot11d.h" | ||
17 | |||
18 | static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) | ||
19 | { | ||
20 | int i; | ||
21 | u16 out, select; | ||
22 | u8 bit; | ||
23 | u32 bangdata = (data << 4) | (adr & 0xf); | ||
24 | |||
25 | out = read_nic_word(dev, RFPinsOutput) & 0xfff3; | ||
26 | |||
27 | write_nic_word(dev, RFPinsEnable, | ||
28 | (read_nic_word(dev, RFPinsEnable) | 0x7)); | ||
29 | |||
30 | select = read_nic_word(dev, RFPinsSelect); | ||
31 | |||
32 | write_nic_word(dev, RFPinsSelect, select | 0x7 | | ||
33 | SW_CONTROL_GPIO); | ||
34 | |||
35 | force_pci_posting(dev); | ||
36 | udelay(10); | ||
37 | |||
38 | write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); | ||
39 | |||
40 | force_pci_posting(dev); | ||
41 | udelay(2); | ||
42 | |||
43 | write_nic_word(dev, RFPinsOutput, out); | ||
44 | |||
45 | force_pci_posting(dev); | ||
46 | udelay(10); | ||
47 | |||
48 | for (i = 15; i >= 0; i--) { | ||
49 | bit = (bangdata & (1 << i)) >> i; | ||
50 | |||
51 | write_nic_word(dev, RFPinsOutput, bit | out); | ||
52 | |||
53 | write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); | ||
54 | write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); | ||
55 | |||
56 | i--; | ||
57 | bit = (bangdata & (1 << i)) >> i; | ||
58 | |||
59 | write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); | ||
60 | write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); | ||
61 | |||
62 | write_nic_word(dev, RFPinsOutput, bit | out); | ||
63 | |||
64 | } | ||
65 | |||
66 | write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); | ||
67 | |||
68 | force_pci_posting(dev); | ||
69 | udelay(10); | ||
70 | |||
71 | write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); | ||
72 | |||
73 | write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO); | ||
74 | |||
75 | rtl8185_rf_pins_enable(dev); | ||
76 | } | ||
77 | |||
78 | static const u8 rtl8225_agc[] = { | ||
79 | 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, | ||
80 | 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, | ||
81 | 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e, | ||
82 | 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, | ||
83 | 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, | ||
84 | 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36, | ||
85 | 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e, | ||
86 | 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, | ||
87 | 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, | ||
88 | 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, | ||
89 | 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, | ||
90 | 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, | ||
91 | 0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, | ||
92 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
93 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
94 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
95 | }; | ||
96 | |||
97 | static const u32 rtl8225_chan[] = { | ||
98 | 0, | ||
99 | 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380, | ||
100 | 0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x074A, | ||
101 | }; | ||
102 | |||
103 | static const u8 rtl8225z2_gain_bg[] = { | ||
104 | 0x23, 0x15, 0xa5, /* -82-1dBm */ | ||
105 | 0x23, 0x15, 0xb5, /* -82-2dBm */ | ||
106 | 0x23, 0x15, 0xc5, /* -82-3dBm */ | ||
107 | 0x33, 0x15, 0xc5, /* -78dBm */ | ||
108 | 0x43, 0x15, 0xc5, /* -74dBm */ | ||
109 | 0x53, 0x15, 0xc5, /* -70dBm */ | ||
110 | 0x63, 0x15, 0xc5, /* -66dBm */ | ||
111 | }; | ||
112 | |||
113 | static const u8 rtl8225z2_gain_a[] = { | ||
114 | 0x13, 0x27, 0x5a, /* -82dBm */ | ||
115 | 0x23, 0x23, 0x58, /* -82dBm */ | ||
116 | 0x33, 0x1f, 0x56, /* -82dBm */ | ||
117 | 0x43, 0x1b, 0x54, /* -78dBm */ | ||
118 | 0x53, 0x17, 0x51, /* -74dBm */ | ||
119 | 0x63, 0x24, 0x4f, /* -70dBm */ | ||
120 | 0x73, 0x0f, 0x4c, /* -66dBm */ | ||
121 | }; | ||
122 | |||
123 | static const u16 rtl8225z2_rxgain[] = { | ||
124 | 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, | ||
125 | 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, | ||
126 | 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, | ||
127 | 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, | ||
128 | 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, | ||
129 | 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, | ||
130 | 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, | ||
131 | 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, | ||
132 | 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, | ||
133 | 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, | ||
134 | 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, | ||
135 | 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb | ||
136 | |||
137 | }; | ||
138 | |||
139 | static void rtl8225z2_set_gain(struct net_device *dev, short gain) | ||
140 | { | ||
141 | const u8 *rtl8225_gain; | ||
142 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
143 | u8 mode = priv->ieee80211->mode; | ||
144 | |||
145 | if (mode == IEEE_B || mode == IEEE_G) | ||
146 | rtl8225_gain = rtl8225z2_gain_bg; | ||
147 | else | ||
148 | rtl8225_gain = rtl8225z2_gain_a; | ||
149 | |||
150 | write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]); | ||
151 | write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]); | ||
152 | write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]); | ||
153 | write_phy_ofdm(dev, 0x21, 0x37); | ||
154 | } | ||
155 | |||
156 | static u32 read_rtl8225(struct net_device *dev, u8 adr) | ||
157 | { | ||
158 | u32 data2Write = ((u32)(adr & 0x1f)) << 27; | ||
159 | u32 dataRead; | ||
160 | u32 mask; | ||
161 | u16 oval, oval2, oval3, tmp; | ||
162 | int i; | ||
163 | short bit, rw; | ||
164 | u8 wLength = 6; | ||
165 | u8 rLength = 12; | ||
166 | u8 low2high = 0; | ||
167 | |||
168 | oval = read_nic_word(dev, RFPinsOutput); | ||
169 | oval2 = read_nic_word(dev, RFPinsEnable); | ||
170 | oval3 = read_nic_word(dev, RFPinsSelect); | ||
171 | |||
172 | write_nic_word(dev, RFPinsEnable, (oval2|0xf)); | ||
173 | write_nic_word(dev, RFPinsSelect, (oval3|0xf)); | ||
174 | |||
175 | dataRead = 0; | ||
176 | |||
177 | oval &= ~0xf; | ||
178 | |||
179 | write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN); | ||
180 | udelay(4); | ||
181 | |||
182 | write_nic_word(dev, RFPinsOutput, oval); | ||
183 | udelay(5); | ||
184 | |||
185 | rw = 0; | ||
186 | |||
187 | mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1)); | ||
188 | |||
189 | for (i = 0; i < wLength/2; i++) { | ||
190 | bit = ((data2Write&mask) != 0) ? 1 : 0; | ||
191 | write_nic_word(dev, RFPinsOutput, bit | oval | rw); | ||
192 | udelay(1); | ||
193 | |||
194 | write_nic_word(dev, RFPinsOutput, | ||
195 | bit | oval | BB_HOST_BANG_CLK | rw); | ||
196 | udelay(2); | ||
197 | write_nic_word(dev, RFPinsOutput, | ||
198 | bit | oval | BB_HOST_BANG_CLK | rw); | ||
199 | udelay(2); | ||
200 | |||
201 | mask = (low2high) ? (mask<<1) : (mask>>1); | ||
202 | |||
203 | if (i == 2) { | ||
204 | rw = BB_HOST_BANG_RW; | ||
205 | write_nic_word(dev, RFPinsOutput, | ||
206 | bit | oval | BB_HOST_BANG_CLK | rw); | ||
207 | udelay(2); | ||
208 | write_nic_word(dev, RFPinsOutput, bit | oval | rw); | ||
209 | udelay(2); | ||
210 | break; | ||
211 | } | ||
212 | |||
213 | bit = ((data2Write&mask) != 0) ? 1 : 0; | ||
214 | |||
215 | write_nic_word(dev, RFPinsOutput, | ||
216 | oval | bit | rw | BB_HOST_BANG_CLK); | ||
217 | udelay(2); | ||
218 | write_nic_word(dev, RFPinsOutput, | ||
219 | oval | bit | rw | BB_HOST_BANG_CLK); | ||
220 | udelay(2); | ||
221 | |||
222 | write_nic_word(dev, RFPinsOutput, oval | bit | rw); | ||
223 | udelay(1); | ||
224 | |||
225 | mask = (low2high) ? (mask<<1) : (mask>>1); | ||
226 | } | ||
227 | |||
228 | write_nic_word(dev, RFPinsOutput, rw|oval); | ||
229 | udelay(2); | ||
230 | mask = (low2high) ? 0x01 : (((u32)0x01) << (12-1)); | ||
231 | |||
232 | /* | ||
233 | * We must set data pin to HW controlled, otherwise RF can't driver it | ||
234 | * and value RF register won't be able to read back properly. | ||
235 | */ | ||
236 | write_nic_word(dev, RFPinsEnable, (oval2 & (~0x01))); | ||
237 | |||
238 | for (i = 0; i < rLength; i++) { | ||
239 | write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1); | ||
240 | |||
241 | write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); | ||
242 | udelay(2); | ||
243 | write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); | ||
244 | udelay(2); | ||
245 | write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); | ||
246 | udelay(2); | ||
247 | tmp = read_nic_word(dev, RFPinsInput); | ||
248 | |||
249 | dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0); | ||
250 | |||
251 | write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2); | ||
252 | |||
253 | mask = (low2high) ? (mask<<1) : (mask>>1); | ||
254 | } | ||
255 | |||
256 | write_nic_word(dev, RFPinsOutput, | ||
257 | BB_HOST_BANG_EN | BB_HOST_BANG_RW | oval); | ||
258 | udelay(2); | ||
259 | |||
260 | write_nic_word(dev, RFPinsEnable, oval2); | ||
261 | write_nic_word(dev, RFPinsSelect, oval3); /* Set To SW Switch */ | ||
262 | write_nic_word(dev, RFPinsOutput, 0x3a0); | ||
263 | |||
264 | return dataRead; | ||
265 | } | ||
266 | |||
267 | void rtl8225z2_rf_close(struct net_device *dev) | ||
268 | { | ||
269 | RF_WriteReg(dev, 0x4, 0x1f); | ||
270 | |||
271 | force_pci_posting(dev); | ||
272 | mdelay(1); | ||
273 | |||
274 | rtl8180_set_anaparam(dev, RTL8225z2_ANAPARAM_OFF); | ||
275 | rtl8185_set_anaparam2(dev, RTL8225z2_ANAPARAM2_OFF); | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | * Map dBm into Tx power index according to current HW model, for example, | ||
280 | * RF and PA, and current wireless mode. | ||
281 | */ | ||
282 | static s8 DbmToTxPwrIdx(struct r8180_priv *priv, | ||
283 | enum wireless_mode mode, s32 PowerInDbm) | ||
284 | { | ||
285 | bool bUseDefault = true; | ||
286 | s8 TxPwrIdx = 0; | ||
287 | |||
288 | /* | ||
289 | * OFDM Power in dBm = Index * 0.5 + 0 | ||
290 | * CCK Power in dBm = Index * 0.25 + 13 | ||
291 | */ | ||
292 | s32 tmp = 0; | ||
293 | |||
294 | if (mode == WIRELESS_MODE_G) { | ||
295 | bUseDefault = false; | ||
296 | tmp = (2 * PowerInDbm); | ||
297 | |||
298 | if (tmp < 0) | ||
299 | TxPwrIdx = 0; | ||
300 | else if (tmp > 40) /* 40 means 20 dBm. */ | ||
301 | TxPwrIdx = 40; | ||
302 | else | ||
303 | TxPwrIdx = (s8)tmp; | ||
304 | } else if (mode == WIRELESS_MODE_B) { | ||
305 | bUseDefault = false; | ||
306 | tmp = (4 * PowerInDbm) - 52; | ||
307 | |||
308 | if (tmp < 0) | ||
309 | TxPwrIdx = 0; | ||
310 | else if (tmp > 28) /* 28 means 20 dBm. */ | ||
311 | TxPwrIdx = 28; | ||
312 | else | ||
313 | TxPwrIdx = (s8)tmp; | ||
314 | } | ||
315 | |||
316 | /* | ||
317 | * TRUE if we want to use a default implementation. | ||
318 | * We shall set it to FALSE when we have exact translation formula | ||
319 | * for target IC. 070622, by rcnjko. | ||
320 | */ | ||
321 | if (bUseDefault) { | ||
322 | if (PowerInDbm < 0) | ||
323 | TxPwrIdx = 0; | ||
324 | else if (PowerInDbm > 35) | ||
325 | TxPwrIdx = 35; | ||
326 | else | ||
327 | TxPwrIdx = (u8)PowerInDbm; | ||
328 | } | ||
329 | |||
330 | return TxPwrIdx; | ||
331 | } | ||
332 | |||
333 | void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch) | ||
334 | { | ||
335 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
336 | u8 max_cck_power_level; | ||
337 | u8 max_ofdm_power_level; | ||
338 | u8 min_ofdm_power_level; | ||
339 | char cck_power_level = (char)(0xff & priv->chtxpwr[ch]); | ||
340 | char ofdm_power_level = (char)(0xff & priv->chtxpwr_ofdm[ch]); | ||
341 | |||
342 | if (IS_DOT11D_ENABLE(priv->ieee80211) && | ||
343 | IS_DOT11D_STATE_DONE(priv->ieee80211)) { | ||
344 | u8 MaxTxPwrInDbm = DOT11D_GetMaxTxPwrInDbm(priv->ieee80211, ch); | ||
345 | u8 CckMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_B, | ||
346 | MaxTxPwrInDbm); | ||
347 | u8 OfdmMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_G, | ||
348 | MaxTxPwrInDbm); | ||
349 | |||
350 | if (cck_power_level > CckMaxPwrIdx) | ||
351 | cck_power_level = CckMaxPwrIdx; | ||
352 | if (ofdm_power_level > OfdmMaxPwrIdx) | ||
353 | ofdm_power_level = OfdmMaxPwrIdx; | ||
354 | } | ||
355 | |||
356 | max_cck_power_level = 15; | ||
357 | max_ofdm_power_level = 25; | ||
358 | min_ofdm_power_level = 10; | ||
359 | |||
360 | if (cck_power_level > 35) | ||
361 | cck_power_level = 35; | ||
362 | |||
363 | write_nic_byte(dev, CCK_TXAGC, cck_power_level); | ||
364 | force_pci_posting(dev); | ||
365 | mdelay(1); | ||
366 | |||
367 | if (ofdm_power_level > 35) | ||
368 | ofdm_power_level = 35; | ||
369 | |||
370 | if (priv->up == 0) { | ||
371 | write_phy_ofdm(dev, 2, 0x42); | ||
372 | write_phy_ofdm(dev, 5, 0x00); | ||
373 | write_phy_ofdm(dev, 6, 0x40); | ||
374 | write_phy_ofdm(dev, 7, 0x00); | ||
375 | write_phy_ofdm(dev, 8, 0x40); | ||
376 | } | ||
377 | |||
378 | write_nic_byte(dev, OFDM_TXAGC, ofdm_power_level); | ||
379 | |||
380 | if (ofdm_power_level <= 11) { | ||
381 | write_phy_ofdm(dev, 0x07, 0x5c); | ||
382 | write_phy_ofdm(dev, 0x09, 0x5c); | ||
383 | } | ||
384 | |||
385 | if (ofdm_power_level <= 17) { | ||
386 | write_phy_ofdm(dev, 0x07, 0x54); | ||
387 | write_phy_ofdm(dev, 0x09, 0x54); | ||
388 | } else { | ||
389 | write_phy_ofdm(dev, 0x07, 0x50); | ||
390 | write_phy_ofdm(dev, 0x09, 0x50); | ||
391 | } | ||
392 | |||
393 | force_pci_posting(dev); | ||
394 | mdelay(1); | ||
395 | } | ||
396 | |||
397 | void rtl8225z2_rf_set_chan(struct net_device *dev, short ch) | ||
398 | { | ||
399 | rtl8225z2_SetTXPowerLevel(dev, ch); | ||
400 | |||
401 | RF_WriteReg(dev, 0x7, rtl8225_chan[ch]); | ||
402 | |||
403 | if ((RF_ReadReg(dev, 0x7) & 0x0F80) != rtl8225_chan[ch]) | ||
404 | RF_WriteReg(dev, 0x7, rtl8225_chan[ch]); | ||
405 | |||
406 | mdelay(1); | ||
407 | |||
408 | force_pci_posting(dev); | ||
409 | mdelay(10); | ||
410 | } | ||
411 | |||
412 | static void rtl8225_host_pci_init(struct net_device *dev) | ||
413 | { | ||
414 | write_nic_word(dev, RFPinsOutput, 0x480); | ||
415 | |||
416 | rtl8185_rf_pins_enable(dev); | ||
417 | |||
418 | write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); | ||
419 | |||
420 | write_nic_byte(dev, GP_ENABLE, 0); | ||
421 | |||
422 | force_pci_posting(dev); | ||
423 | mdelay(200); | ||
424 | |||
425 | /* bit 6 is for RF on/off detection */ | ||
426 | write_nic_word(dev, GP_ENABLE, 0xff & (~(1 << 6))); | ||
427 | } | ||
428 | |||
429 | void rtl8225z2_rf_init(struct net_device *dev) | ||
430 | { | ||
431 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
432 | int i; | ||
433 | short channel = 1; | ||
434 | u16 brsr; | ||
435 | u32 data; | ||
436 | |||
437 | priv->chan = channel; | ||
438 | |||
439 | rtl8225_host_pci_init(dev); | ||
440 | |||
441 | write_nic_dword(dev, RF_TIMING, 0x000a8008); | ||
442 | |||
443 | brsr = read_nic_word(dev, BRSR); | ||
444 | |||
445 | write_nic_word(dev, BRSR, 0xffff); | ||
446 | |||
447 | write_nic_dword(dev, RF_PARA, 0x100044); | ||
448 | |||
449 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); | ||
450 | write_nic_byte(dev, CONFIG3, 0x44); | ||
451 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); | ||
452 | |||
453 | rtl8185_rf_pins_enable(dev); | ||
454 | |||
455 | write_rtl8225(dev, 0x0, 0x2bf); mdelay(1); | ||
456 | write_rtl8225(dev, 0x1, 0xee0); mdelay(1); | ||
457 | write_rtl8225(dev, 0x2, 0x44d); mdelay(1); | ||
458 | write_rtl8225(dev, 0x3, 0x441); mdelay(1); | ||
459 | write_rtl8225(dev, 0x4, 0x8c3); mdelay(1); | ||
460 | write_rtl8225(dev, 0x5, 0xc72); mdelay(1); | ||
461 | write_rtl8225(dev, 0x6, 0xe6); mdelay(1); | ||
462 | write_rtl8225(dev, 0x7, rtl8225_chan[channel]); mdelay(1); | ||
463 | write_rtl8225(dev, 0x8, 0x3f); mdelay(1); | ||
464 | write_rtl8225(dev, 0x9, 0x335); mdelay(1); | ||
465 | write_rtl8225(dev, 0xa, 0x9d4); mdelay(1); | ||
466 | write_rtl8225(dev, 0xb, 0x7bb); mdelay(1); | ||
467 | write_rtl8225(dev, 0xc, 0x850); mdelay(1); | ||
468 | write_rtl8225(dev, 0xd, 0xcdf); mdelay(1); | ||
469 | write_rtl8225(dev, 0xe, 0x2b); mdelay(1); | ||
470 | write_rtl8225(dev, 0xf, 0x114); | ||
471 | |||
472 | mdelay(100); | ||
473 | |||
474 | write_rtl8225(dev, 0x0, 0x1b7); | ||
475 | |||
476 | for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) { | ||
477 | write_rtl8225(dev, 0x1, i + 1); | ||
478 | write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]); | ||
479 | } | ||
480 | |||
481 | write_rtl8225(dev, 0x3, 0x80); | ||
482 | write_rtl8225(dev, 0x5, 0x4); | ||
483 | |||
484 | write_rtl8225(dev, 0x0, 0xb7); | ||
485 | |||
486 | write_rtl8225(dev, 0x2, 0xc4d); | ||
487 | |||
488 | /* FIXME!! rtl8187 we have to check if calibrarion | ||
489 | * is successful and eventually cal. again (repeat | ||
490 | * the two write on reg 2) | ||
491 | */ | ||
492 | data = read_rtl8225(dev, 6); | ||
493 | if (!(data & 0x00000080)) { | ||
494 | write_rtl8225(dev, 0x02, 0x0c4d); | ||
495 | force_pci_posting(dev); mdelay(200); | ||
496 | write_rtl8225(dev, 0x02, 0x044d); | ||
497 | force_pci_posting(dev); mdelay(100); | ||
498 | data = read_rtl8225(dev, 6); | ||
499 | if (!(data & 0x00000080)) | ||
500 | DMESGW("RF Calibration Failed!!!!\n"); | ||
501 | } | ||
502 | |||
503 | mdelay(200); | ||
504 | |||
505 | write_rtl8225(dev, 0x0, 0x2bf); | ||
506 | |||
507 | for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { | ||
508 | write_phy_ofdm(dev, 0xb, rtl8225_agc[i]); | ||
509 | mdelay(1); | ||
510 | |||
511 | /* enable writing AGC table */ | ||
512 | write_phy_ofdm(dev, 0xa, i + 0x80); | ||
513 | mdelay(1); | ||
514 | } | ||
515 | |||
516 | force_pci_posting(dev); | ||
517 | mdelay(1); | ||
518 | |||
519 | write_phy_ofdm(dev, 0x00, 0x01); mdelay(1); | ||
520 | write_phy_ofdm(dev, 0x01, 0x02); mdelay(1); | ||
521 | write_phy_ofdm(dev, 0x02, 0x62); mdelay(1); | ||
522 | write_phy_ofdm(dev, 0x03, 0x00); mdelay(1); | ||
523 | write_phy_ofdm(dev, 0x04, 0x00); mdelay(1); | ||
524 | write_phy_ofdm(dev, 0x05, 0x00); mdelay(1); | ||
525 | write_phy_ofdm(dev, 0x06, 0x40); mdelay(1); | ||
526 | write_phy_ofdm(dev, 0x07, 0x00); mdelay(1); | ||
527 | write_phy_ofdm(dev, 0x08, 0x40); mdelay(1); | ||
528 | write_phy_ofdm(dev, 0x09, 0xfe); mdelay(1); | ||
529 | write_phy_ofdm(dev, 0x0a, 0x08); mdelay(1); | ||
530 | write_phy_ofdm(dev, 0x0b, 0x80); mdelay(1); | ||
531 | write_phy_ofdm(dev, 0x0c, 0x01); mdelay(1); | ||
532 | write_phy_ofdm(dev, 0x0d, 0x43); | ||
533 | write_phy_ofdm(dev, 0x0e, 0xd3); mdelay(1); | ||
534 | write_phy_ofdm(dev, 0x0f, 0x38); mdelay(1); | ||
535 | write_phy_ofdm(dev, 0x10, 0x84); mdelay(1); | ||
536 | write_phy_ofdm(dev, 0x11, 0x07); mdelay(1); | ||
537 | write_phy_ofdm(dev, 0x12, 0x20); mdelay(1); | ||
538 | write_phy_ofdm(dev, 0x13, 0x20); mdelay(1); | ||
539 | write_phy_ofdm(dev, 0x14, 0x00); mdelay(1); | ||
540 | write_phy_ofdm(dev, 0x15, 0x40); mdelay(1); | ||
541 | write_phy_ofdm(dev, 0x16, 0x00); mdelay(1); | ||
542 | write_phy_ofdm(dev, 0x17, 0x40); mdelay(1); | ||
543 | write_phy_ofdm(dev, 0x18, 0xef); mdelay(1); | ||
544 | write_phy_ofdm(dev, 0x19, 0x19); mdelay(1); | ||
545 | write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1); | ||
546 | write_phy_ofdm(dev, 0x1b, 0x15); mdelay(1); | ||
547 | write_phy_ofdm(dev, 0x1c, 0x04); mdelay(1); | ||
548 | write_phy_ofdm(dev, 0x1d, 0xc5); mdelay(1); | ||
549 | write_phy_ofdm(dev, 0x1e, 0x95); mdelay(1); | ||
550 | write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1); | ||
551 | write_phy_ofdm(dev, 0x20, 0x1f); mdelay(1); | ||
552 | write_phy_ofdm(dev, 0x21, 0x17); mdelay(1); | ||
553 | write_phy_ofdm(dev, 0x22, 0x16); mdelay(1); | ||
554 | write_phy_ofdm(dev, 0x23, 0x80); mdelay(1); /* FIXME maybe not needed */ | ||
555 | write_phy_ofdm(dev, 0x24, 0x46); mdelay(1); | ||
556 | write_phy_ofdm(dev, 0x25, 0x00); mdelay(1); | ||
557 | write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); | ||
558 | write_phy_ofdm(dev, 0x27, 0x88); mdelay(1); | ||
559 | |||
560 | rtl8225z2_set_gain(dev, 4); | ||
561 | |||
562 | write_phy_cck(dev, 0x0, 0x98); mdelay(1); | ||
563 | write_phy_cck(dev, 0x3, 0x20); mdelay(1); | ||
564 | write_phy_cck(dev, 0x4, 0x7e); mdelay(1); | ||
565 | write_phy_cck(dev, 0x5, 0x12); mdelay(1); | ||
566 | write_phy_cck(dev, 0x6, 0xfc); mdelay(1); | ||
567 | write_phy_cck(dev, 0x7, 0x78); mdelay(1); | ||
568 | write_phy_cck(dev, 0x8, 0x2e); mdelay(1); | ||
569 | write_phy_cck(dev, 0x10, 0x93); mdelay(1); | ||
570 | write_phy_cck(dev, 0x11, 0x88); mdelay(1); | ||
571 | write_phy_cck(dev, 0x12, 0x47); mdelay(1); | ||
572 | write_phy_cck(dev, 0x13, 0xd0); | ||
573 | write_phy_cck(dev, 0x19, 0x00); | ||
574 | write_phy_cck(dev, 0x1a, 0xa0); | ||
575 | write_phy_cck(dev, 0x1b, 0x08); | ||
576 | write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ | ||
577 | write_phy_cck(dev, 0x41, 0x8d); mdelay(1); | ||
578 | write_phy_cck(dev, 0x42, 0x15); mdelay(1); | ||
579 | write_phy_cck(dev, 0x43, 0x18); mdelay(1); | ||
580 | write_phy_cck(dev, 0x44, 0x36); mdelay(1); | ||
581 | write_phy_cck(dev, 0x45, 0x35); mdelay(1); | ||
582 | write_phy_cck(dev, 0x46, 0x2e); mdelay(1); | ||
583 | write_phy_cck(dev, 0x47, 0x25); mdelay(1); | ||
584 | write_phy_cck(dev, 0x48, 0x1c); mdelay(1); | ||
585 | write_phy_cck(dev, 0x49, 0x12); mdelay(1); | ||
586 | write_phy_cck(dev, 0x4a, 0x09); mdelay(1); | ||
587 | write_phy_cck(dev, 0x4b, 0x04); mdelay(1); | ||
588 | write_phy_cck(dev, 0x4c, 0x05); mdelay(1); | ||
589 | |||
590 | write_nic_byte(dev, 0x5b, 0x0d); mdelay(1); | ||
591 | |||
592 | rtl8225z2_SetTXPowerLevel(dev, channel); | ||
593 | |||
594 | /* RX antenna default to A */ | ||
595 | write_phy_cck(dev, 0x11, 0x9b); mdelay(1); /* B: 0xDB */ | ||
596 | write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* B: 0x10 */ | ||
597 | |||
598 | rtl8185_tx_antenna(dev, 0x03); /* B: 0x00 */ | ||
599 | |||
600 | /* switch to high-speed 3-wire | ||
601 | * last digit. 2 for both cck and ofdm | ||
602 | */ | ||
603 | write_nic_dword(dev, 0x94, 0x15c00002); | ||
604 | rtl8185_rf_pins_enable(dev); | ||
605 | |||
606 | rtl8225z2_rf_set_chan(dev, priv->chan); | ||
607 | } | ||
608 | |||
609 | #define MAX_DOZE_WAITING_TIMES_85B 20 | ||
610 | #define MAX_POLLING_24F_TIMES_87SE 10 | ||
611 | #define LPS_MAX_SLEEP_WAITING_TIMES_87SE 5 | ||
612 | |||
613 | bool SetZebraRFPowerState8185(struct net_device *dev, | ||
614 | enum rt_rf_power_state eRFPowerState) | ||
615 | { | ||
616 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
617 | u8 btCR9346, btConfig3; | ||
618 | bool bActionAllowed = true, bTurnOffBB = true; | ||
619 | u8 u1bTmp; | ||
620 | int i; | ||
621 | bool bResult = true; | ||
622 | u8 QueueID; | ||
623 | |||
624 | if (priv->SetRFPowerStateInProgress == true) | ||
625 | return false; | ||
626 | |||
627 | priv->SetRFPowerStateInProgress = true; | ||
628 | |||
629 | btCR9346 = read_nic_byte(dev, CR9346); | ||
630 | write_nic_byte(dev, CR9346, (btCR9346 | 0xC0)); | ||
631 | |||
632 | btConfig3 = read_nic_byte(dev, CONFIG3); | ||
633 | write_nic_byte(dev, CONFIG3, (btConfig3 | CONFIG3_PARM_En)); | ||
634 | |||
635 | switch (eRFPowerState) { | ||
636 | case RF_ON: | ||
637 | write_nic_word(dev, 0x37C, 0x00EC); | ||
638 | |||
639 | /* turn on AFE */ | ||
640 | write_nic_byte(dev, 0x54, 0x00); | ||
641 | write_nic_byte(dev, 0x62, 0x00); | ||
642 | |||
643 | /* turn on RF */ | ||
644 | RF_WriteReg(dev, 0x0, 0x009f); udelay(500); | ||
645 | RF_WriteReg(dev, 0x4, 0x0972); udelay(500); | ||
646 | |||
647 | /* turn on RF again */ | ||
648 | RF_WriteReg(dev, 0x0, 0x009f); udelay(500); | ||
649 | RF_WriteReg(dev, 0x4, 0x0972); udelay(500); | ||
650 | |||
651 | /* turn on BB */ | ||
652 | write_phy_ofdm(dev, 0x10, 0x40); | ||
653 | write_phy_ofdm(dev, 0x12, 0x40); | ||
654 | |||
655 | /* Avoid power down at init time. */ | ||
656 | write_nic_byte(dev, CONFIG4, priv->RFProgType); | ||
657 | |||
658 | u1bTmp = read_nic_byte(dev, 0x24E); | ||
659 | write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6)))); | ||
660 | break; | ||
661 | case RF_SLEEP: | ||
662 | for (QueueID = 0, i = 0; QueueID < 6;) { | ||
663 | if (get_curr_tx_free_desc(dev, QueueID) == | ||
664 | priv->txringcount) { | ||
665 | QueueID++; | ||
666 | continue; | ||
667 | } else { | ||
668 | priv->TxPollingTimes++; | ||
669 | if (priv->TxPollingTimes >= | ||
670 | LPS_MAX_SLEEP_WAITING_TIMES_87SE) { | ||
671 | bActionAllowed = false; | ||
672 | break; | ||
673 | } else | ||
674 | udelay(10); | ||
675 | } | ||
676 | } | ||
677 | |||
678 | if (bActionAllowed) { | ||
679 | /* turn off BB RXIQ matrix to cut off rx signal */ | ||
680 | write_phy_ofdm(dev, 0x10, 0x00); | ||
681 | write_phy_ofdm(dev, 0x12, 0x00); | ||
682 | |||
683 | /* turn off RF */ | ||
684 | RF_WriteReg(dev, 0x4, 0x0000); | ||
685 | RF_WriteReg(dev, 0x0, 0x0000); | ||
686 | |||
687 | /* turn off AFE except PLL */ | ||
688 | write_nic_byte(dev, 0x62, 0xff); | ||
689 | write_nic_byte(dev, 0x54, 0xec); | ||
690 | |||
691 | mdelay(1); | ||
692 | |||
693 | { | ||
694 | int i = 0; | ||
695 | while (true) { | ||
696 | u8 tmp24F = read_nic_byte(dev, 0x24f); | ||
697 | |||
698 | if ((tmp24F == 0x01) || | ||
699 | (tmp24F == 0x09)) { | ||
700 | bTurnOffBB = true; | ||
701 | break; | ||
702 | } else { | ||
703 | udelay(10); | ||
704 | i++; | ||
705 | priv->TxPollingTimes++; | ||
706 | |||
707 | if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) { | ||
708 | bTurnOffBB = false; | ||
709 | break; | ||
710 | } else | ||
711 | udelay(10); | ||
712 | } | ||
713 | } | ||
714 | } | ||
715 | |||
716 | if (bTurnOffBB) { | ||
717 | /* turn off BB */ | ||
718 | u1bTmp = read_nic_byte(dev, 0x24E); | ||
719 | write_nic_byte(dev, 0x24E, | ||
720 | (u1bTmp | BIT5 | BIT6)); | ||
721 | |||
722 | /* turn off AFE PLL */ | ||
723 | write_nic_byte(dev, 0x54, 0xFC); | ||
724 | write_nic_word(dev, 0x37C, 0x00FC); | ||
725 | } | ||
726 | } | ||
727 | break; | ||
728 | case RF_OFF: | ||
729 | for (QueueID = 0, i = 0; QueueID < 6;) { | ||
730 | if (get_curr_tx_free_desc(dev, QueueID) == | ||
731 | priv->txringcount) { | ||
732 | QueueID++; | ||
733 | continue; | ||
734 | } else { | ||
735 | udelay(10); | ||
736 | i++; | ||
737 | } | ||
738 | |||
739 | if (i >= MAX_DOZE_WAITING_TIMES_85B) | ||
740 | break; | ||
741 | } | ||
742 | |||
743 | /* turn off BB RXIQ matrix to cut off rx signal */ | ||
744 | write_phy_ofdm(dev, 0x10, 0x00); | ||
745 | write_phy_ofdm(dev, 0x12, 0x00); | ||
746 | |||
747 | /* turn off RF */ | ||
748 | RF_WriteReg(dev, 0x4, 0x0000); | ||
749 | RF_WriteReg(dev, 0x0, 0x0000); | ||
750 | |||
751 | /* turn off AFE except PLL */ | ||
752 | write_nic_byte(dev, 0x62, 0xff); | ||
753 | write_nic_byte(dev, 0x54, 0xec); | ||
754 | |||
755 | mdelay(1); | ||
756 | |||
757 | { | ||
758 | int i = 0; | ||
759 | |||
760 | while (true) { | ||
761 | u8 tmp24F = read_nic_byte(dev, 0x24f); | ||
762 | |||
763 | if ((tmp24F == 0x01) || (tmp24F == 0x09)) { | ||
764 | bTurnOffBB = true; | ||
765 | break; | ||
766 | } else { | ||
767 | bTurnOffBB = false; | ||
768 | udelay(10); | ||
769 | i++; | ||
770 | } | ||
771 | |||
772 | if (i > MAX_POLLING_24F_TIMES_87SE) | ||
773 | break; | ||
774 | } | ||
775 | } | ||
776 | |||
777 | if (bTurnOffBB) { | ||
778 | /* turn off BB */ | ||
779 | u1bTmp = read_nic_byte(dev, 0x24E); | ||
780 | write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6)); | ||
781 | |||
782 | /* turn off AFE PLL (80M) */ | ||
783 | write_nic_byte(dev, 0x54, 0xFC); | ||
784 | write_nic_word(dev, 0x37C, 0x00FC); | ||
785 | } | ||
786 | break; | ||
787 | } | ||
788 | |||
789 | btConfig3 &= ~(CONFIG3_PARM_En); | ||
790 | write_nic_byte(dev, CONFIG3, btConfig3); | ||
791 | |||
792 | btCR9346 &= ~(0xC0); | ||
793 | write_nic_byte(dev, CR9346, btCR9346); | ||
794 | |||
795 | if (bResult && bActionAllowed) | ||
796 | priv->eRFPowerState = eRFPowerState; | ||
797 | |||
798 | priv->SetRFPowerStateInProgress = false; | ||
799 | |||
800 | return bResult && bActionAllowed; | ||
801 | } | ||
802 | |||
803 | void rtl8225z4_rf_sleep(struct net_device *dev) | ||
804 | { | ||
805 | MgntActSet_RF_State(dev, RF_SLEEP, RF_CHANGE_BY_PS); | ||
806 | } | ||
807 | |||
808 | void rtl8225z4_rf_wakeup(struct net_device *dev) | ||
809 | { | ||
810 | MgntActSet_RF_State(dev, RF_ON, RF_CHANGE_BY_PS); | ||
811 | } | ||
diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c deleted file mode 100644 index b55249170f18..000000000000 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ /dev/null | |||
@@ -1,1409 +0,0 @@ | |||
1 | /* | ||
2 | This file contains wireless extension handlers. | ||
3 | |||
4 | This is part of rtl8180 OpenSource driver. | ||
5 | Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> | ||
6 | Released under the terms of GPL (General Public Licence) | ||
7 | |||
8 | Parts of this driver are based on the GPL part | ||
9 | of the official realtek driver. | ||
10 | |||
11 | Parts of this driver are based on the rtl8180 driver skeleton | ||
12 | from Patric Schenke & Andres Salomon. | ||
13 | |||
14 | Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. | ||
15 | |||
16 | We want to thanks the Authors of those projects and the Ndiswrapper | ||
17 | project Authors. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #include "r8180.h" | ||
22 | #include "r8180_hw.h" | ||
23 | |||
24 | #include <net/iw_handler.h> | ||
25 | #include "ieee80211/dot11d.h" | ||
26 | |||
27 | static u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000, | ||
28 | 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000}; | ||
29 | |||
30 | #define RATE_COUNT ARRAY_SIZE(rtl8180_rates) | ||
31 | |||
32 | static struct rtl8187se_channel_list default_channel_plan[] = { | ||
33 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64}, 19}, /* FCC */ | ||
34 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* IC */ | ||
35 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* ETSI */ | ||
36 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* Spain. Change to ETSI. */ | ||
37 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* France. Change to ETSI. */ | ||
38 | {{14, 36, 40, 44, 48, 52, 56, 60, 64}, 9}, /* MKK */ | ||
39 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MKK1 */ | ||
40 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* Israel */ | ||
41 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 34, 38, 42, 46}, 17}, /* For 11a , TELEC */ | ||
42 | {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14} /* For Global Domain. 1-11:active scan, 12-14 passive scan.*/ /* +YJ, 080626 */ | ||
43 | }; | ||
44 | static int r8180_wx_get_freq(struct net_device *dev, | ||
45 | struct iw_request_info *a, | ||
46 | union iwreq_data *wrqu, char *b) | ||
47 | { | ||
48 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
49 | |||
50 | return ieee80211_wx_get_freq(priv->ieee80211, a, wrqu, b); | ||
51 | } | ||
52 | |||
53 | |||
54 | static int r8180_wx_set_key(struct net_device *dev, | ||
55 | struct iw_request_info *info, | ||
56 | union iwreq_data *wrqu, char *key) | ||
57 | { | ||
58 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
59 | struct iw_point *erq = &(wrqu->encoding); | ||
60 | |||
61 | if (priv->ieee80211->bHwRadioOff) | ||
62 | return 0; | ||
63 | |||
64 | if (erq->length > 0) { | ||
65 | u32 *tkey = (u32 *) key; | ||
66 | priv->key0[0] = tkey[0]; | ||
67 | priv->key0[1] = tkey[1]; | ||
68 | priv->key0[2] = tkey[2]; | ||
69 | priv->key0[3] = tkey[3] & 0xff; | ||
70 | DMESG("Setting wep key to %x %x %x %x", | ||
71 | tkey[0], tkey[1], tkey[2], tkey[3]); | ||
72 | rtl8180_set_hw_wep(dev); | ||
73 | } | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | |||
78 | static int r8180_wx_set_beaconinterval(struct net_device *dev, | ||
79 | struct iw_request_info *aa, | ||
80 | union iwreq_data *wrqu, char *b) | ||
81 | { | ||
82 | int *parms = (int *)b; | ||
83 | int bi = parms[0]; | ||
84 | |||
85 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
86 | |||
87 | if (priv->ieee80211->bHwRadioOff) | ||
88 | return 0; | ||
89 | |||
90 | down(&priv->wx_sem); | ||
91 | DMESG("setting beacon interval to %x", bi); | ||
92 | |||
93 | priv->ieee80211->current_network.beacon_interval = bi; | ||
94 | rtl8180_commit(dev); | ||
95 | up(&priv->wx_sem); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | |||
101 | |||
102 | static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a, | ||
103 | union iwreq_data *wrqu, char *b) | ||
104 | { | ||
105 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
106 | return ieee80211_wx_get_mode(priv->ieee80211, a, wrqu, b); | ||
107 | } | ||
108 | |||
109 | |||
110 | |||
111 | static int r8180_wx_get_rate(struct net_device *dev, | ||
112 | struct iw_request_info *info, | ||
113 | union iwreq_data *wrqu, char *extra) | ||
114 | { | ||
115 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
116 | return ieee80211_wx_get_rate(priv->ieee80211, info, wrqu, extra); | ||
117 | } | ||
118 | |||
119 | |||
120 | |||
121 | static int r8180_wx_set_rate(struct net_device *dev, | ||
122 | struct iw_request_info *info, | ||
123 | union iwreq_data *wrqu, char *extra) | ||
124 | { | ||
125 | int ret; | ||
126 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
127 | |||
128 | |||
129 | if (priv->ieee80211->bHwRadioOff) | ||
130 | return 0; | ||
131 | |||
132 | down(&priv->wx_sem); | ||
133 | |||
134 | ret = ieee80211_wx_set_rate(priv->ieee80211, info, wrqu, extra); | ||
135 | |||
136 | up(&priv->wx_sem); | ||
137 | |||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | |||
142 | static int r8180_wx_set_crcmon(struct net_device *dev, | ||
143 | struct iw_request_info *info, | ||
144 | union iwreq_data *wrqu, char *extra) | ||
145 | { | ||
146 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
147 | int *parms = (int *)extra; | ||
148 | int enable = (parms[0] > 0); | ||
149 | short prev = priv->crcmon; | ||
150 | |||
151 | |||
152 | if (priv->ieee80211->bHwRadioOff) | ||
153 | return 0; | ||
154 | |||
155 | down(&priv->wx_sem); | ||
156 | |||
157 | if (enable) | ||
158 | priv->crcmon = 1; | ||
159 | else | ||
160 | priv->crcmon = 0; | ||
161 | |||
162 | DMESG("bad CRC in monitor mode are %s", | ||
163 | priv->crcmon ? "accepted" : "rejected"); | ||
164 | |||
165 | if (prev != priv->crcmon && priv->up) { | ||
166 | rtl8180_down(dev); | ||
167 | rtl8180_up(dev); | ||
168 | } | ||
169 | |||
170 | up(&priv->wx_sem); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | |||
176 | static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a, | ||
177 | union iwreq_data *wrqu, char *b) | ||
178 | { | ||
179 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
180 | int ret; | ||
181 | |||
182 | |||
183 | if (priv->ieee80211->bHwRadioOff) | ||
184 | return 0; | ||
185 | |||
186 | down(&priv->wx_sem); | ||
187 | if (priv->bInactivePs) { | ||
188 | if (wrqu->mode == IW_MODE_ADHOC) | ||
189 | IPSLeave(dev); | ||
190 | } | ||
191 | ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b); | ||
192 | |||
193 | up(&priv->wx_sem); | ||
194 | return ret; | ||
195 | } | ||
196 | |||
197 | /* YJ,add,080819,for hidden ap */ | ||
198 | struct iw_range_with_scan_capa { | ||
199 | /* Informative stuff (to choose between different interface) */ | ||
200 | |||
201 | __u32 throughput; /* To give an idea... */ | ||
202 | |||
203 | /* In theory this value should be the maximum benchmarked | ||
204 | * TCP/IP throughput, because with most of these devices the | ||
205 | * bit rate is meaningless (overhead an co) to estimate how | ||
206 | * fast the connection will go and pick the fastest one. | ||
207 | * I suggest people to play with Netperf or any benchmark... | ||
208 | */ | ||
209 | |||
210 | /* NWID (or domain id) */ | ||
211 | __u32 min_nwid; /* Minimal NWID we are able to set */ | ||
212 | __u32 max_nwid; /* Maximal NWID we are able to set */ | ||
213 | |||
214 | /* Old Frequency (backward compat - moved lower ) */ | ||
215 | __u16 old_num_channels; | ||
216 | __u8 old_num_frequency; | ||
217 | |||
218 | /* Scan capabilities */ | ||
219 | __u8 scan_capa; | ||
220 | }; | ||
221 | /* YJ,add,080819,for hidden ap */ | ||
222 | |||
223 | |||
224 | static int rtl8180_wx_get_range(struct net_device *dev, | ||
225 | struct iw_request_info *info, | ||
226 | union iwreq_data *wrqu, char *extra) | ||
227 | { | ||
228 | struct iw_range *range = (struct iw_range *)extra; | ||
229 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
230 | u16 val; | ||
231 | int i; | ||
232 | |||
233 | wrqu->data.length = sizeof(*range); | ||
234 | memset(range, 0, sizeof(*range)); | ||
235 | |||
236 | /* Let's try to keep this struct in the same order as in | ||
237 | * linux/include/wireless.h | ||
238 | */ | ||
239 | |||
240 | /* TODO: See what values we can set, and remove the ones we can't | ||
241 | * set, or fill them with some default data. | ||
242 | */ | ||
243 | |||
244 | /* ~5 Mb/s real (802.11b) */ | ||
245 | range->throughput = 5 * 1000 * 1000; | ||
246 | |||
247 | /* TODO: Not used in 802.11b? */ | ||
248 | /* range->min_nwid; */ /* Minimal NWID we are able to set */ | ||
249 | /* TODO: Not used in 802.11b? */ | ||
250 | /* range->max_nwid; */ /* Maximal NWID we are able to set */ | ||
251 | |||
252 | /* Old Frequency (backward compat - moved lower ) */ | ||
253 | /* range->old_num_channels; */ | ||
254 | /* range->old_num_frequency; */ | ||
255 | /* range->old_freq[6]; */ /* Filler to keep "version" at the same offset */ | ||
256 | if (priv->rf_set_sens != NULL) | ||
257 | range->sensitivity = priv->max_sens; /* signal level threshold range */ | ||
258 | |||
259 | range->max_qual.qual = 100; | ||
260 | /* TODO: Find real max RSSI and stick here */ | ||
261 | range->max_qual.level = 0; | ||
262 | range->max_qual.noise = -98; | ||
263 | range->max_qual.updated = 7; /* Updated all three */ | ||
264 | |||
265 | range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ | ||
266 | /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ | ||
267 | range->avg_qual.level = 20 + -98; | ||
268 | range->avg_qual.noise = 0; | ||
269 | range->avg_qual.updated = 7; /* Updated all three */ | ||
270 | |||
271 | range->num_bitrates = RATE_COUNT; | ||
272 | |||
273 | for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) | ||
274 | range->bitrate[i] = rtl8180_rates[i]; | ||
275 | |||
276 | range->min_frag = MIN_FRAG_THRESHOLD; | ||
277 | range->max_frag = MAX_FRAG_THRESHOLD; | ||
278 | |||
279 | range->pm_capa = 0; | ||
280 | |||
281 | range->we_version_compiled = WIRELESS_EXT; | ||
282 | range->we_version_source = 16; | ||
283 | |||
284 | range->num_channels = 14; | ||
285 | |||
286 | for (i = 0, val = 0; i < 14; i++) { | ||
287 | |||
288 | /* Include only legal frequencies for some countries */ | ||
289 | if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) { | ||
290 | range->freq[val].i = i + 1; | ||
291 | range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; | ||
292 | range->freq[val].e = 1; | ||
293 | val++; | ||
294 | } else { | ||
295 | /* FIXME: do we need to set anything for channels */ | ||
296 | /* we don't use ? */ | ||
297 | } | ||
298 | |||
299 | if (val == IW_MAX_FREQUENCIES) | ||
300 | break; | ||
301 | } | ||
302 | |||
303 | range->num_frequency = val; | ||
304 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
305 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | |||
311 | static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a, | ||
312 | union iwreq_data *wrqu, char *b) | ||
313 | { | ||
314 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
315 | int ret; | ||
316 | struct ieee80211_device *ieee = priv->ieee80211; | ||
317 | |||
318 | |||
319 | if (priv->ieee80211->bHwRadioOff) | ||
320 | return 0; | ||
321 | |||
322 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | ||
323 | struct iw_scan_req *req = (struct iw_scan_req *)b; | ||
324 | if (req->essid_len) { | ||
325 | ieee->current_network.ssid_len = req->essid_len; | ||
326 | memcpy(ieee->current_network.ssid, req->essid, req->essid_len); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | down(&priv->wx_sem); | ||
331 | if (priv->up) { | ||
332 | priv->ieee80211->actscanning = true; | ||
333 | if (priv->bInactivePs && (priv->ieee80211->state != IEEE80211_LINKED)) { | ||
334 | IPSLeave(dev); | ||
335 | ieee80211_softmac_ips_scan_syncro(priv->ieee80211); | ||
336 | ret = 0; | ||
337 | } else { | ||
338 | /* prevent scan in BusyTraffic */ | ||
339 | /* FIXME: Need to consider last scan time */ | ||
340 | if ((priv->link_detect.b_busy_traffic) && (true)) { | ||
341 | ret = 0; | ||
342 | printk("Now traffic is busy, please try later!\n"); | ||
343 | } else | ||
344 | /* prevent scan in BusyTraffic,end */ | ||
345 | ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b); | ||
346 | } | ||
347 | } else | ||
348 | ret = -1; | ||
349 | |||
350 | up(&priv->wx_sem); | ||
351 | |||
352 | return ret; | ||
353 | } | ||
354 | |||
355 | |||
356 | static int r8180_wx_get_scan(struct net_device *dev, struct iw_request_info *a, | ||
357 | union iwreq_data *wrqu, char *b) | ||
358 | { | ||
359 | |||
360 | int ret; | ||
361 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
362 | |||
363 | down(&priv->wx_sem); | ||
364 | if (priv->up) | ||
365 | ret = ieee80211_wx_get_scan(priv->ieee80211, a, wrqu, b); | ||
366 | else | ||
367 | ret = -1; | ||
368 | |||
369 | up(&priv->wx_sem); | ||
370 | return ret; | ||
371 | } | ||
372 | |||
373 | |||
374 | static int r8180_wx_set_essid(struct net_device *dev, | ||
375 | struct iw_request_info *a, | ||
376 | union iwreq_data *wrqu, char *b) | ||
377 | { | ||
378 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
379 | |||
380 | int ret; | ||
381 | |||
382 | if (priv->ieee80211->bHwRadioOff) | ||
383 | return 0; | ||
384 | |||
385 | down(&priv->wx_sem); | ||
386 | if (priv->bInactivePs) | ||
387 | IPSLeave(dev); | ||
388 | |||
389 | ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b); | ||
390 | |||
391 | up(&priv->wx_sem); | ||
392 | return ret; | ||
393 | } | ||
394 | |||
395 | |||
396 | static int r8180_wx_get_essid(struct net_device *dev, | ||
397 | struct iw_request_info *a, | ||
398 | union iwreq_data *wrqu, char *b) | ||
399 | { | ||
400 | int ret; | ||
401 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
402 | |||
403 | down(&priv->wx_sem); | ||
404 | |||
405 | ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b); | ||
406 | |||
407 | up(&priv->wx_sem); | ||
408 | |||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | |||
413 | static int r8180_wx_set_freq(struct net_device *dev, struct iw_request_info *a, | ||
414 | union iwreq_data *wrqu, char *b) | ||
415 | { | ||
416 | int ret; | ||
417 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
418 | |||
419 | |||
420 | if (priv->ieee80211->bHwRadioOff) | ||
421 | return 0; | ||
422 | |||
423 | down(&priv->wx_sem); | ||
424 | |||
425 | ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); | ||
426 | |||
427 | up(&priv->wx_sem); | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | |||
432 | static int r8180_wx_get_name(struct net_device *dev, | ||
433 | struct iw_request_info *info, | ||
434 | union iwreq_data *wrqu, char *extra) | ||
435 | { | ||
436 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
437 | return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra); | ||
438 | } | ||
439 | |||
440 | static int r8180_wx_set_frag(struct net_device *dev, | ||
441 | struct iw_request_info *info, | ||
442 | union iwreq_data *wrqu, char *extra) | ||
443 | { | ||
444 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
445 | |||
446 | if (priv->ieee80211->bHwRadioOff) | ||
447 | return 0; | ||
448 | |||
449 | if (wrqu->frag.disabled) | ||
450 | priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; | ||
451 | else { | ||
452 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || | ||
453 | wrqu->frag.value > MAX_FRAG_THRESHOLD) | ||
454 | return -EINVAL; | ||
455 | |||
456 | priv->ieee80211->fts = wrqu->frag.value & ~0x1; | ||
457 | } | ||
458 | |||
459 | return 0; | ||
460 | } | ||
461 | |||
462 | |||
463 | static int r8180_wx_get_frag(struct net_device *dev, | ||
464 | struct iw_request_info *info, | ||
465 | union iwreq_data *wrqu, char *extra) | ||
466 | { | ||
467 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
468 | |||
469 | wrqu->frag.value = priv->ieee80211->fts; | ||
470 | wrqu->frag.fixed = 0; /* no auto select */ | ||
471 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD); | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | |||
477 | static int r8180_wx_set_wap(struct net_device *dev, | ||
478 | struct iw_request_info *info, | ||
479 | union iwreq_data *awrq, char *extra) | ||
480 | { | ||
481 | int ret; | ||
482 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
483 | |||
484 | if (priv->ieee80211->bHwRadioOff) | ||
485 | return 0; | ||
486 | |||
487 | down(&priv->wx_sem); | ||
488 | |||
489 | ret = ieee80211_wx_set_wap(priv->ieee80211, info, awrq, extra); | ||
490 | |||
491 | up(&priv->wx_sem); | ||
492 | return ret; | ||
493 | |||
494 | } | ||
495 | |||
496 | |||
497 | static int r8180_wx_get_wap(struct net_device *dev, | ||
498 | struct iw_request_info *info, | ||
499 | union iwreq_data *wrqu, char *extra) | ||
500 | { | ||
501 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
502 | |||
503 | return ieee80211_wx_get_wap(priv->ieee80211, info, wrqu, extra); | ||
504 | } | ||
505 | |||
506 | |||
507 | static int r8180_wx_set_enc(struct net_device *dev, | ||
508 | struct iw_request_info *info, | ||
509 | union iwreq_data *wrqu, char *key) | ||
510 | { | ||
511 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
512 | int ret; | ||
513 | |||
514 | if (priv->ieee80211->bHwRadioOff) | ||
515 | return 0; | ||
516 | |||
517 | |||
518 | down(&priv->wx_sem); | ||
519 | |||
520 | if (priv->hw_wep) | ||
521 | ret = r8180_wx_set_key(dev, info, wrqu, key); | ||
522 | else { | ||
523 | DMESG("Setting SW wep key"); | ||
524 | ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key); | ||
525 | } | ||
526 | |||
527 | up(&priv->wx_sem); | ||
528 | return ret; | ||
529 | } | ||
530 | |||
531 | |||
532 | static int r8180_wx_get_enc(struct net_device *dev, | ||
533 | struct iw_request_info *info, | ||
534 | union iwreq_data *wrqu, char *key) | ||
535 | { | ||
536 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
537 | |||
538 | return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key); | ||
539 | } | ||
540 | |||
541 | |||
542 | static int r8180_wx_set_scan_type(struct net_device *dev, | ||
543 | struct iw_request_info *aa, | ||
544 | union iwreq_data *wrqu, char *p) | ||
545 | { | ||
546 | |||
547 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
548 | int *parms = (int *)p; | ||
549 | int mode = parms[0]; | ||
550 | |||
551 | if (priv->ieee80211->bHwRadioOff) | ||
552 | return 0; | ||
553 | |||
554 | priv->ieee80211->active_scan = mode; | ||
555 | |||
556 | return 1; | ||
557 | } | ||
558 | |||
559 | static int r8180_wx_set_retry(struct net_device *dev, | ||
560 | struct iw_request_info *info, | ||
561 | union iwreq_data *wrqu, char *extra) | ||
562 | { | ||
563 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
564 | int err = 0; | ||
565 | |||
566 | if (priv->ieee80211->bHwRadioOff) | ||
567 | return 0; | ||
568 | |||
569 | down(&priv->wx_sem); | ||
570 | |||
571 | if (wrqu->retry.flags & IW_RETRY_LIFETIME || | ||
572 | wrqu->retry.disabled) { | ||
573 | err = -EINVAL; | ||
574 | goto exit; | ||
575 | } | ||
576 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) { | ||
577 | err = -EINVAL; | ||
578 | goto exit; | ||
579 | } | ||
580 | |||
581 | if (wrqu->retry.value > R8180_MAX_RETRY) { | ||
582 | err = -EINVAL; | ||
583 | goto exit; | ||
584 | } | ||
585 | if (wrqu->retry.flags & IW_RETRY_MAX) { | ||
586 | priv->retry_rts = wrqu->retry.value; | ||
587 | DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); | ||
588 | |||
589 | } else { | ||
590 | priv->retry_data = wrqu->retry.value; | ||
591 | DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); | ||
592 | } | ||
593 | |||
594 | /* FIXME ! | ||
595 | * We might try to write directly the TX config register | ||
596 | * or to restart just the (R)TX process. | ||
597 | * I'm unsure if whole reset is really needed | ||
598 | */ | ||
599 | |||
600 | rtl8180_commit(dev); | ||
601 | exit: | ||
602 | up(&priv->wx_sem); | ||
603 | |||
604 | return err; | ||
605 | } | ||
606 | |||
607 | static int r8180_wx_get_retry(struct net_device *dev, | ||
608 | struct iw_request_info *info, | ||
609 | union iwreq_data *wrqu, char *extra) | ||
610 | { | ||
611 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
612 | |||
613 | |||
614 | wrqu->retry.disabled = 0; /* can't be disabled */ | ||
615 | |||
616 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == | ||
617 | IW_RETRY_LIFETIME) | ||
618 | return -EINVAL; | ||
619 | |||
620 | if (wrqu->retry.flags & IW_RETRY_MAX) { | ||
621 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; | ||
622 | wrqu->retry.value = priv->retry_rts; | ||
623 | } else { | ||
624 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; | ||
625 | wrqu->retry.value = priv->retry_data; | ||
626 | } | ||
627 | |||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | static int r8180_wx_get_sens(struct net_device *dev, | ||
632 | struct iw_request_info *info, | ||
633 | union iwreq_data *wrqu, char *extra) | ||
634 | { | ||
635 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
636 | if (priv->rf_set_sens == NULL) | ||
637 | return -1; /* we have not this support for this radio */ | ||
638 | wrqu->sens.value = priv->sens; | ||
639 | return 0; | ||
640 | } | ||
641 | |||
642 | |||
643 | static int r8180_wx_set_sens(struct net_device *dev, | ||
644 | struct iw_request_info *info, | ||
645 | union iwreq_data *wrqu, char *extra) | ||
646 | { | ||
647 | |||
648 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
649 | |||
650 | short err = 0; | ||
651 | |||
652 | if (priv->ieee80211->bHwRadioOff) | ||
653 | return 0; | ||
654 | |||
655 | down(&priv->wx_sem); | ||
656 | if (priv->rf_set_sens == NULL) { | ||
657 | err = -1; /* we have not this support for this radio */ | ||
658 | goto exit; | ||
659 | } | ||
660 | if (priv->rf_set_sens(dev, wrqu->sens.value) == 0) | ||
661 | priv->sens = wrqu->sens.value; | ||
662 | else | ||
663 | err = -EINVAL; | ||
664 | |||
665 | exit: | ||
666 | up(&priv->wx_sem); | ||
667 | |||
668 | return err; | ||
669 | } | ||
670 | |||
671 | |||
672 | static int r8180_wx_set_rawtx(struct net_device *dev, | ||
673 | struct iw_request_info *info, | ||
674 | union iwreq_data *wrqu, char *extra) | ||
675 | { | ||
676 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
677 | int ret; | ||
678 | |||
679 | if (priv->ieee80211->bHwRadioOff) | ||
680 | return 0; | ||
681 | |||
682 | down(&priv->wx_sem); | ||
683 | |||
684 | ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra); | ||
685 | |||
686 | up(&priv->wx_sem); | ||
687 | |||
688 | return ret; | ||
689 | |||
690 | } | ||
691 | |||
692 | static int r8180_wx_get_power(struct net_device *dev, | ||
693 | struct iw_request_info *info, | ||
694 | union iwreq_data *wrqu, char *extra) | ||
695 | { | ||
696 | int ret; | ||
697 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
698 | |||
699 | down(&priv->wx_sem); | ||
700 | |||
701 | ret = ieee80211_wx_get_power(priv->ieee80211, info, wrqu, extra); | ||
702 | |||
703 | up(&priv->wx_sem); | ||
704 | |||
705 | return ret; | ||
706 | } | ||
707 | |||
708 | static int r8180_wx_set_power(struct net_device *dev, | ||
709 | struct iw_request_info *info, | ||
710 | union iwreq_data *wrqu, char *extra) | ||
711 | { | ||
712 | int ret; | ||
713 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
714 | |||
715 | |||
716 | if (priv->ieee80211->bHwRadioOff) | ||
717 | return 0; | ||
718 | |||
719 | down(&priv->wx_sem); | ||
720 | printk("=>>>>>>>>>>=============================>set power:%d, %d!\n", wrqu->power.disabled, wrqu->power.flags); | ||
721 | if (wrqu->power.disabled == 0) { | ||
722 | wrqu->power.flags |= IW_POWER_ALL_R; | ||
723 | wrqu->power.flags |= IW_POWER_TIMEOUT; | ||
724 | wrqu->power.value = 1000; | ||
725 | } | ||
726 | |||
727 | ret = ieee80211_wx_set_power(priv->ieee80211, info, wrqu, extra); | ||
728 | |||
729 | up(&priv->wx_sem); | ||
730 | |||
731 | return ret; | ||
732 | } | ||
733 | |||
734 | static int r8180_wx_set_rts(struct net_device *dev, | ||
735 | struct iw_request_info *info, | ||
736 | union iwreq_data *wrqu, char *extra) | ||
737 | { | ||
738 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
739 | |||
740 | |||
741 | if (priv->ieee80211->bHwRadioOff) | ||
742 | return 0; | ||
743 | |||
744 | if (wrqu->rts.disabled) | ||
745 | priv->rts = DEFAULT_RTS_THRESHOLD; | ||
746 | else { | ||
747 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || | ||
748 | wrqu->rts.value > MAX_RTS_THRESHOLD) | ||
749 | return -EINVAL; | ||
750 | |||
751 | priv->rts = wrqu->rts.value; | ||
752 | } | ||
753 | |||
754 | return 0; | ||
755 | } | ||
756 | static int r8180_wx_get_rts(struct net_device *dev, | ||
757 | struct iw_request_info *info, | ||
758 | union iwreq_data *wrqu, char *extra) | ||
759 | { | ||
760 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
761 | |||
762 | |||
763 | |||
764 | wrqu->rts.value = priv->rts; | ||
765 | wrqu->rts.fixed = 0; /* no auto select */ | ||
766 | wrqu->rts.disabled = (wrqu->rts.value == 0); | ||
767 | |||
768 | return 0; | ||
769 | } | ||
770 | static int dummy(struct net_device *dev, struct iw_request_info *a, | ||
771 | union iwreq_data *wrqu, char *b) | ||
772 | { | ||
773 | return -1; | ||
774 | } | ||
775 | |||
776 | static int r8180_wx_get_iwmode(struct net_device *dev, | ||
777 | struct iw_request_info *info, | ||
778 | union iwreq_data *wrqu, char *extra) | ||
779 | { | ||
780 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
781 | struct ieee80211_device *ieee; | ||
782 | int ret = 0; | ||
783 | |||
784 | |||
785 | |||
786 | down(&priv->wx_sem); | ||
787 | |||
788 | ieee = priv->ieee80211; | ||
789 | |||
790 | strcpy(extra, "802.11"); | ||
791 | if (ieee->modulation & IEEE80211_CCK_MODULATION) { | ||
792 | strcat(extra, "b"); | ||
793 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) | ||
794 | strcat(extra, "/g"); | ||
795 | } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) | ||
796 | strcat(extra, "g"); | ||
797 | |||
798 | up(&priv->wx_sem); | ||
799 | |||
800 | return ret; | ||
801 | } | ||
802 | static int r8180_wx_set_iwmode(struct net_device *dev, | ||
803 | struct iw_request_info *info, | ||
804 | union iwreq_data *wrqu, char *extra) | ||
805 | { | ||
806 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
807 | struct ieee80211_device *ieee = priv->ieee80211; | ||
808 | int *param = (int *)extra; | ||
809 | int ret = 0; | ||
810 | int modulation = 0, mode = 0; | ||
811 | |||
812 | |||
813 | if (priv->ieee80211->bHwRadioOff) | ||
814 | return 0; | ||
815 | |||
816 | down(&priv->wx_sem); | ||
817 | |||
818 | if (*param == 1) { | ||
819 | modulation |= IEEE80211_CCK_MODULATION; | ||
820 | mode = IEEE_B; | ||
821 | printk(KERN_INFO "B mode!\n"); | ||
822 | } else if (*param == 2) { | ||
823 | modulation |= IEEE80211_OFDM_MODULATION; | ||
824 | mode = IEEE_G; | ||
825 | printk(KERN_INFO "G mode!\n"); | ||
826 | } else if (*param == 3) { | ||
827 | modulation |= IEEE80211_CCK_MODULATION; | ||
828 | modulation |= IEEE80211_OFDM_MODULATION; | ||
829 | mode = IEEE_B|IEEE_G; | ||
830 | printk(KERN_INFO "B/G mode!\n"); | ||
831 | } | ||
832 | |||
833 | if (ieee->proto_started) { | ||
834 | ieee80211_stop_protocol(ieee); | ||
835 | ieee->mode = mode; | ||
836 | ieee->modulation = modulation; | ||
837 | ieee80211_start_protocol(ieee); | ||
838 | } else { | ||
839 | ieee->mode = mode; | ||
840 | ieee->modulation = modulation; | ||
841 | } | ||
842 | |||
843 | up(&priv->wx_sem); | ||
844 | |||
845 | return ret; | ||
846 | } | ||
847 | static int r8180_wx_get_preamble(struct net_device *dev, | ||
848 | struct iw_request_info *info, | ||
849 | union iwreq_data *wrqu, char *extra) | ||
850 | { | ||
851 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
852 | |||
853 | |||
854 | |||
855 | down(&priv->wx_sem); | ||
856 | |||
857 | |||
858 | |||
859 | *extra = (char) priv->plcp_preamble_mode; /* 0:auto 1:short 2:long */ | ||
860 | up(&priv->wx_sem); | ||
861 | |||
862 | return 0; | ||
863 | } | ||
864 | static int r8180_wx_set_preamble(struct net_device *dev, | ||
865 | struct iw_request_info *info, | ||
866 | union iwreq_data *wrqu, char *extra) | ||
867 | { | ||
868 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
869 | int ret = 0; | ||
870 | |||
871 | |||
872 | if (priv->ieee80211->bHwRadioOff) | ||
873 | return 0; | ||
874 | |||
875 | down(&priv->wx_sem); | ||
876 | if (*extra < 0 || *extra > 2) | ||
877 | ret = -1; | ||
878 | else | ||
879 | priv->plcp_preamble_mode = *((short *)extra); | ||
880 | |||
881 | |||
882 | |||
883 | up(&priv->wx_sem); | ||
884 | |||
885 | return ret; | ||
886 | } | ||
887 | static int r8180_wx_get_siglevel(struct net_device *dev, | ||
888 | struct iw_request_info *info, | ||
889 | union iwreq_data *wrqu, char *extra) | ||
890 | { | ||
891 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
892 | int ret = 0; | ||
893 | |||
894 | |||
895 | |||
896 | down(&priv->wx_sem); | ||
897 | /* Modify by hikaru 6.5 */ | ||
898 | *((int *)extra) = priv->wstats.qual.level;/*for interface test ,it should be the priv->wstats.qual.level; */ | ||
899 | |||
900 | |||
901 | |||
902 | up(&priv->wx_sem); | ||
903 | |||
904 | return ret; | ||
905 | } | ||
906 | static int r8180_wx_get_sigqual(struct net_device *dev, | ||
907 | struct iw_request_info *info, | ||
908 | union iwreq_data *wrqu, char *extra) | ||
909 | { | ||
910 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
911 | int ret = 0; | ||
912 | |||
913 | |||
914 | |||
915 | down(&priv->wx_sem); | ||
916 | /* Modify by hikaru 6.5 */ | ||
917 | *((int *)extra) = priv->wstats.qual.qual;/* for interface test ,it should be the priv->wstats.qual.qual; */ | ||
918 | |||
919 | |||
920 | |||
921 | up(&priv->wx_sem); | ||
922 | |||
923 | return ret; | ||
924 | } | ||
925 | static int r8180_wx_reset_stats(struct net_device *dev, | ||
926 | struct iw_request_info *info, | ||
927 | union iwreq_data *wrqu, char *extra) | ||
928 | { | ||
929 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
930 | down(&priv->wx_sem); | ||
931 | |||
932 | priv->stats.txrdu = 0; | ||
933 | priv->stats.rxrdu = 0; | ||
934 | priv->stats.rxnolast = 0; | ||
935 | priv->stats.rxnodata = 0; | ||
936 | priv->stats.rxnopointer = 0; | ||
937 | priv->stats.txnperr = 0; | ||
938 | priv->stats.txresumed = 0; | ||
939 | priv->stats.rxerr = 0; | ||
940 | priv->stats.rxoverflow = 0; | ||
941 | priv->stats.rxint = 0; | ||
942 | |||
943 | priv->stats.txnpokint = 0; | ||
944 | priv->stats.txhpokint = 0; | ||
945 | priv->stats.txhperr = 0; | ||
946 | priv->stats.ints = 0; | ||
947 | priv->stats.shints = 0; | ||
948 | priv->stats.txoverflow = 0; | ||
949 | priv->stats.rxdmafail = 0; | ||
950 | priv->stats.txbeacon = 0; | ||
951 | priv->stats.txbeaconerr = 0; | ||
952 | priv->stats.txlpokint = 0; | ||
953 | priv->stats.txlperr = 0; | ||
954 | priv->stats.txretry = 0;/* 20060601 */ | ||
955 | priv->stats.rxcrcerrmin = 0 ; | ||
956 | priv->stats.rxcrcerrmid = 0; | ||
957 | priv->stats.rxcrcerrmax = 0; | ||
958 | priv->stats.rxicverr = 0; | ||
959 | |||
960 | up(&priv->wx_sem); | ||
961 | |||
962 | return 0; | ||
963 | |||
964 | } | ||
965 | static int r8180_wx_radio_on(struct net_device *dev, | ||
966 | struct iw_request_info *info, | ||
967 | union iwreq_data *wrqu, char *extra) | ||
968 | { | ||
969 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
970 | |||
971 | if (priv->ieee80211->bHwRadioOff) | ||
972 | return 0; | ||
973 | |||
974 | |||
975 | down(&priv->wx_sem); | ||
976 | priv->rf_wakeup(dev); | ||
977 | |||
978 | up(&priv->wx_sem); | ||
979 | |||
980 | return 0; | ||
981 | |||
982 | } | ||
983 | |||
984 | static int r8180_wx_radio_off(struct net_device *dev, | ||
985 | struct iw_request_info *info, | ||
986 | union iwreq_data *wrqu, char *extra) | ||
987 | { | ||
988 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
989 | |||
990 | if (priv->ieee80211->bHwRadioOff) | ||
991 | return 0; | ||
992 | |||
993 | |||
994 | down(&priv->wx_sem); | ||
995 | priv->rf_sleep(dev); | ||
996 | |||
997 | up(&priv->wx_sem); | ||
998 | |||
999 | return 0; | ||
1000 | |||
1001 | } | ||
1002 | static int r8180_wx_get_channelplan(struct net_device *dev, | ||
1003 | struct iw_request_info *info, | ||
1004 | union iwreq_data *wrqu, char *extra) | ||
1005 | { | ||
1006 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1007 | |||
1008 | |||
1009 | |||
1010 | down(&priv->wx_sem); | ||
1011 | *extra = priv->channel_plan; | ||
1012 | |||
1013 | |||
1014 | |||
1015 | up(&priv->wx_sem); | ||
1016 | |||
1017 | return 0; | ||
1018 | } | ||
1019 | static int r8180_wx_set_channelplan(struct net_device *dev, | ||
1020 | struct iw_request_info *info, | ||
1021 | union iwreq_data *wrqu, char *extra) | ||
1022 | { | ||
1023 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1024 | int *val = (int *)extra; | ||
1025 | int i; | ||
1026 | printk("-----in fun %s\n", __func__); | ||
1027 | |||
1028 | if (priv->ieee80211->bHwRadioOff) | ||
1029 | return 0; | ||
1030 | |||
1031 | /* unsigned long flags; */ | ||
1032 | down(&priv->wx_sem); | ||
1033 | if (default_channel_plan[*val].len != 0) { | ||
1034 | priv->channel_plan = *val; | ||
1035 | /* Clear old channel map 8 */ | ||
1036 | for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) | ||
1037 | GET_DOT11D_INFO(priv->ieee80211)->channel_map[i] = 0; | ||
1038 | |||
1039 | /* Set new channel map */ | ||
1040 | for (i = 1; i <= default_channel_plan[*val].len; i++) | ||
1041 | GET_DOT11D_INFO(priv->ieee80211)->channel_map[default_channel_plan[*val].channel[i-1]] = 1; | ||
1042 | |||
1043 | } | ||
1044 | up(&priv->wx_sem); | ||
1045 | |||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
1049 | static int r8180_wx_get_version(struct net_device *dev, | ||
1050 | struct iw_request_info *info, | ||
1051 | union iwreq_data *wrqu, char *extra) | ||
1052 | { | ||
1053 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1054 | /* struct ieee80211_device *ieee; */ | ||
1055 | |||
1056 | down(&priv->wx_sem); | ||
1057 | strcpy(extra, "1020.0808"); | ||
1058 | up(&priv->wx_sem); | ||
1059 | |||
1060 | return 0; | ||
1061 | } | ||
1062 | |||
1063 | /* added by amy 080818 */ | ||
1064 | /*receive datarate from user typing valid rate is from 2 to 108 (1 - 54M), if input 0, return to normal rate adaptive. */ | ||
1065 | static int r8180_wx_set_forcerate(struct net_device *dev, | ||
1066 | struct iw_request_info *info, | ||
1067 | union iwreq_data *wrqu, char *extra) | ||
1068 | { | ||
1069 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1070 | u8 forcerate = *extra; | ||
1071 | |||
1072 | down(&priv->wx_sem); | ||
1073 | |||
1074 | printk("==============>%s(): forcerate is %d\n", __func__, forcerate); | ||
1075 | if ((forcerate == 2) || (forcerate == 4) || (forcerate == 11) || (forcerate == 22) || (forcerate == 12) || | ||
1076 | (forcerate == 18) || (forcerate == 24) || (forcerate == 36) || (forcerate == 48) || (forcerate == 72) || | ||
1077 | (forcerate == 96) || (forcerate == 108)) { | ||
1078 | priv->ForcedDataRate = 1; | ||
1079 | priv->ieee80211->rate = forcerate * 5; | ||
1080 | } else if (forcerate == 0) { | ||
1081 | priv->ForcedDataRate = 0; | ||
1082 | printk("OK! return rate adaptive\n"); | ||
1083 | } else | ||
1084 | printk("ERR: wrong rate\n"); | ||
1085 | up(&priv->wx_sem); | ||
1086 | return 0; | ||
1087 | } | ||
1088 | |||
1089 | static int r8180_wx_set_enc_ext(struct net_device *dev, | ||
1090 | struct iw_request_info *info, | ||
1091 | union iwreq_data *wrqu, char *extra) | ||
1092 | { | ||
1093 | |||
1094 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1095 | |||
1096 | int ret = 0; | ||
1097 | |||
1098 | if (priv->ieee80211->bHwRadioOff) | ||
1099 | return 0; | ||
1100 | |||
1101 | down(&priv->wx_sem); | ||
1102 | ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra); | ||
1103 | up(&priv->wx_sem); | ||
1104 | return ret; | ||
1105 | |||
1106 | } | ||
1107 | static int r8180_wx_set_auth(struct net_device *dev, | ||
1108 | struct iw_request_info *info, | ||
1109 | union iwreq_data *wrqu, char *extra) | ||
1110 | { | ||
1111 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1112 | int ret = 0; | ||
1113 | |||
1114 | if (priv->ieee80211->bHwRadioOff) | ||
1115 | return 0; | ||
1116 | |||
1117 | down(&priv->wx_sem); | ||
1118 | ret = ieee80211_wx_set_auth(priv->ieee80211, info, &wrqu->param, extra); | ||
1119 | up(&priv->wx_sem); | ||
1120 | return ret; | ||
1121 | } | ||
1122 | |||
1123 | static int r8180_wx_set_mlme(struct net_device *dev, | ||
1124 | struct iw_request_info *info, | ||
1125 | union iwreq_data *wrqu, char *extra) | ||
1126 | { | ||
1127 | int ret = 0; | ||
1128 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1129 | |||
1130 | |||
1131 | if (priv->ieee80211->bHwRadioOff) | ||
1132 | return 0; | ||
1133 | |||
1134 | |||
1135 | down(&priv->wx_sem); | ||
1136 | #if 1 | ||
1137 | ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); | ||
1138 | #endif | ||
1139 | up(&priv->wx_sem); | ||
1140 | return ret; | ||
1141 | } | ||
1142 | static int r8180_wx_set_gen_ie(struct net_device *dev, | ||
1143 | struct iw_request_info *info, | ||
1144 | union iwreq_data *wrqu, char *extra) | ||
1145 | { | ||
1146 | int ret = 0; | ||
1147 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1148 | |||
1149 | |||
1150 | if (priv->ieee80211->bHwRadioOff) | ||
1151 | return 0; | ||
1152 | |||
1153 | down(&priv->wx_sem); | ||
1154 | #if 1 | ||
1155 | ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, wrqu->data.length); | ||
1156 | #endif | ||
1157 | up(&priv->wx_sem); | ||
1158 | return ret; | ||
1159 | |||
1160 | |||
1161 | } | ||
1162 | |||
1163 | static const iw_handler r8180_wx_handlers[] = { | ||
1164 | IW_HANDLER(SIOCGIWNAME, r8180_wx_get_name), | ||
1165 | IW_HANDLER(SIOCSIWNWID, dummy), | ||
1166 | IW_HANDLER(SIOCGIWNWID, dummy), | ||
1167 | IW_HANDLER(SIOCSIWFREQ, r8180_wx_set_freq), | ||
1168 | IW_HANDLER(SIOCGIWFREQ, r8180_wx_get_freq), | ||
1169 | IW_HANDLER(SIOCSIWMODE, r8180_wx_set_mode), | ||
1170 | IW_HANDLER(SIOCGIWMODE, r8180_wx_get_mode), | ||
1171 | IW_HANDLER(SIOCSIWSENS, r8180_wx_set_sens), | ||
1172 | IW_HANDLER(SIOCGIWSENS, r8180_wx_get_sens), | ||
1173 | IW_HANDLER(SIOCGIWRANGE, rtl8180_wx_get_range), | ||
1174 | IW_HANDLER(SIOCSIWSPY, dummy), | ||
1175 | IW_HANDLER(SIOCGIWSPY, dummy), | ||
1176 | IW_HANDLER(SIOCSIWAP, r8180_wx_set_wap), | ||
1177 | IW_HANDLER(SIOCGIWAP, r8180_wx_get_wap), | ||
1178 | IW_HANDLER(SIOCSIWMLME, r8180_wx_set_mlme), | ||
1179 | IW_HANDLER(SIOCGIWAPLIST, dummy), /* deprecated */ | ||
1180 | IW_HANDLER(SIOCSIWSCAN, r8180_wx_set_scan), | ||
1181 | IW_HANDLER(SIOCGIWSCAN, r8180_wx_get_scan), | ||
1182 | IW_HANDLER(SIOCSIWESSID, r8180_wx_set_essid), | ||
1183 | IW_HANDLER(SIOCGIWESSID, r8180_wx_get_essid), | ||
1184 | IW_HANDLER(SIOCSIWNICKN, dummy), | ||
1185 | IW_HANDLER(SIOCGIWNICKN, dummy), | ||
1186 | IW_HANDLER(SIOCSIWRATE, r8180_wx_set_rate), | ||
1187 | IW_HANDLER(SIOCGIWRATE, r8180_wx_get_rate), | ||
1188 | IW_HANDLER(SIOCSIWRTS, r8180_wx_set_rts), | ||
1189 | IW_HANDLER(SIOCGIWRTS, r8180_wx_get_rts), | ||
1190 | IW_HANDLER(SIOCSIWFRAG, r8180_wx_set_frag), | ||
1191 | IW_HANDLER(SIOCGIWFRAG, r8180_wx_get_frag), | ||
1192 | IW_HANDLER(SIOCSIWTXPOW, dummy), | ||
1193 | IW_HANDLER(SIOCGIWTXPOW, dummy), | ||
1194 | IW_HANDLER(SIOCSIWRETRY, r8180_wx_set_retry), | ||
1195 | IW_HANDLER(SIOCGIWRETRY, r8180_wx_get_retry), | ||
1196 | IW_HANDLER(SIOCSIWENCODE, r8180_wx_set_enc), | ||
1197 | IW_HANDLER(SIOCGIWENCODE, r8180_wx_get_enc), | ||
1198 | IW_HANDLER(SIOCSIWPOWER, r8180_wx_set_power), | ||
1199 | IW_HANDLER(SIOCGIWPOWER, r8180_wx_get_power), | ||
1200 | IW_HANDLER(SIOCSIWGENIE, r8180_wx_set_gen_ie), | ||
1201 | IW_HANDLER(SIOCSIWAUTH, r8180_wx_set_auth), | ||
1202 | IW_HANDLER(SIOCSIWENCODEEXT, r8180_wx_set_enc_ext), | ||
1203 | }; | ||
1204 | |||
1205 | static const struct iw_priv_args r8180_private_args[] = { | ||
1206 | { | ||
1207 | SIOCIWFIRSTPRIV + 0x0, | ||
1208 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" | ||
1209 | }, | ||
1210 | { SIOCIWFIRSTPRIV + 0x1, | ||
1211 | 0, 0, "dummy" | ||
1212 | |||
1213 | }, | ||
1214 | { | ||
1215 | SIOCIWFIRSTPRIV + 0x2, | ||
1216 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "beaconint" | ||
1217 | }, | ||
1218 | { SIOCIWFIRSTPRIV + 0x3, | ||
1219 | 0, 0, "dummy" | ||
1220 | |||
1221 | }, | ||
1222 | { | ||
1223 | SIOCIWFIRSTPRIV + 0x4, | ||
1224 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" | ||
1225 | |||
1226 | }, | ||
1227 | { SIOCIWFIRSTPRIV + 0x5, | ||
1228 | 0, 0, "dummy" | ||
1229 | |||
1230 | }, | ||
1231 | { | ||
1232 | SIOCIWFIRSTPRIV + 0x6, | ||
1233 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" | ||
1234 | |||
1235 | }, | ||
1236 | { SIOCIWFIRSTPRIV + 0x7, | ||
1237 | 0, 0, "dummy" | ||
1238 | |||
1239 | }, | ||
1240 | { | ||
1241 | SIOCIWFIRSTPRIV + 0x8, | ||
1242 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setiwmode" | ||
1243 | }, | ||
1244 | { | ||
1245 | SIOCIWFIRSTPRIV + 0x9, | ||
1246 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 32, "getiwmode" | ||
1247 | }, | ||
1248 | { | ||
1249 | SIOCIWFIRSTPRIV + 0xA, | ||
1250 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setpreamble" | ||
1251 | }, | ||
1252 | { | ||
1253 | SIOCIWFIRSTPRIV + 0xB, | ||
1254 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getpreamble" | ||
1255 | }, | ||
1256 | { SIOCIWFIRSTPRIV + 0xC, | ||
1257 | 0, 0, "dummy" | ||
1258 | }, | ||
1259 | { | ||
1260 | SIOCIWFIRSTPRIV + 0xD, | ||
1261 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getrssi" | ||
1262 | }, | ||
1263 | { SIOCIWFIRSTPRIV + 0xE, | ||
1264 | 0, 0, "dummy" | ||
1265 | }, | ||
1266 | { | ||
1267 | SIOCIWFIRSTPRIV + 0xF, | ||
1268 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getlinkqual" | ||
1269 | }, | ||
1270 | { | ||
1271 | SIOCIWFIRSTPRIV + 0x10, | ||
1272 | 0, 0, "resetstats" | ||
1273 | }, | ||
1274 | { | ||
1275 | SIOCIWFIRSTPRIV + 0x11, | ||
1276 | 0, 0, "dummy" | ||
1277 | }, | ||
1278 | { | ||
1279 | SIOCIWFIRSTPRIV + 0x12, | ||
1280 | 0, 0, "radioon" | ||
1281 | }, | ||
1282 | { | ||
1283 | SIOCIWFIRSTPRIV + 0x13, | ||
1284 | 0, 0, "radiooff" | ||
1285 | }, | ||
1286 | { | ||
1287 | SIOCIWFIRSTPRIV + 0x14, | ||
1288 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setchannel" | ||
1289 | }, | ||
1290 | { | ||
1291 | SIOCIWFIRSTPRIV + 0x15, | ||
1292 | 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getchannel" | ||
1293 | }, | ||
1294 | { | ||
1295 | SIOCIWFIRSTPRIV + 0x16, | ||
1296 | 0, 0, "dummy" | ||
1297 | }, | ||
1298 | { | ||
1299 | SIOCIWFIRSTPRIV + 0x17, | ||
1300 | 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 32, "getversion" | ||
1301 | }, | ||
1302 | { | ||
1303 | SIOCIWFIRSTPRIV + 0x18, | ||
1304 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setrate" | ||
1305 | }, | ||
1306 | }; | ||
1307 | |||
1308 | |||
1309 | static iw_handler r8180_private_handler[] = { | ||
1310 | r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ | ||
1311 | dummy, | ||
1312 | r8180_wx_set_beaconinterval, | ||
1313 | dummy, | ||
1314 | /* r8180_wx_set_monitor_type, */ | ||
1315 | r8180_wx_set_scan_type, | ||
1316 | dummy, | ||
1317 | r8180_wx_set_rawtx, | ||
1318 | dummy, | ||
1319 | r8180_wx_set_iwmode, | ||
1320 | r8180_wx_get_iwmode, | ||
1321 | r8180_wx_set_preamble, | ||
1322 | r8180_wx_get_preamble, | ||
1323 | dummy, | ||
1324 | r8180_wx_get_siglevel, | ||
1325 | dummy, | ||
1326 | r8180_wx_get_sigqual, | ||
1327 | r8180_wx_reset_stats, | ||
1328 | dummy,/* r8180_wx_get_stats */ | ||
1329 | r8180_wx_radio_on, | ||
1330 | r8180_wx_radio_off, | ||
1331 | r8180_wx_set_channelplan, | ||
1332 | r8180_wx_get_channelplan, | ||
1333 | dummy, | ||
1334 | r8180_wx_get_version, | ||
1335 | r8180_wx_set_forcerate, | ||
1336 | }; | ||
1337 | |||
1338 | static inline int is_same_network(struct ieee80211_network *src, | ||
1339 | struct ieee80211_network *dst, | ||
1340 | struct ieee80211_device *ieee) | ||
1341 | { | ||
1342 | /* A network is only a duplicate if the channel, BSSID, ESSID | ||
1343 | * and the capability field (in particular IBSS and BSS) all match. | ||
1344 | * We treat all <hidden> with the same BSSID and channel | ||
1345 | * as one network | ||
1346 | */ | ||
1347 | if (src->channel != dst->channel) | ||
1348 | return 0; | ||
1349 | |||
1350 | if (memcmp(src->bssid, dst->bssid, ETH_ALEN) != 0) | ||
1351 | return 0; | ||
1352 | |||
1353 | if (ieee->iw_mode != IW_MODE_INFRA) { | ||
1354 | if (src->ssid_len != dst->ssid_len) | ||
1355 | return 0; | ||
1356 | if (memcmp(src->ssid, dst->ssid, src->ssid_len) != 0) | ||
1357 | return 0; | ||
1358 | } | ||
1359 | |||
1360 | if ((src->capability & WLAN_CAPABILITY_IBSS) != | ||
1361 | (dst->capability & WLAN_CAPABILITY_IBSS)) | ||
1362 | return 0; | ||
1363 | if ((src->capability & WLAN_CAPABILITY_BSS) != | ||
1364 | (dst->capability & WLAN_CAPABILITY_BSS)) | ||
1365 | return 0; | ||
1366 | |||
1367 | return 1; | ||
1368 | } | ||
1369 | |||
1370 | /* WB modified to show signal to GUI on 18-01-2008 */ | ||
1371 | static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) | ||
1372 | { | ||
1373 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1374 | struct ieee80211_device *ieee = priv->ieee80211; | ||
1375 | struct iw_statistics *wstats = &priv->wstats; | ||
1376 | int tmp_level = 0; | ||
1377 | int tmp_qual = 0; | ||
1378 | int tmp_noise = 0; | ||
1379 | |||
1380 | if (ieee->state < IEEE80211_LINKED) { | ||
1381 | wstats->qual.qual = 0; | ||
1382 | wstats->qual.level = 0; | ||
1383 | wstats->qual.noise = 0; | ||
1384 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; | ||
1385 | return wstats; | ||
1386 | } | ||
1387 | |||
1388 | tmp_level = (&ieee->current_network)->stats.signal; | ||
1389 | tmp_qual = (&ieee->current_network)->stats.signalstrength; | ||
1390 | tmp_noise = (&ieee->current_network)->stats.noise; | ||
1391 | |||
1392 | wstats->qual.level = tmp_level; | ||
1393 | wstats->qual.qual = tmp_qual; | ||
1394 | wstats->qual.noise = tmp_noise; | ||
1395 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; | ||
1396 | return wstats; | ||
1397 | } | ||
1398 | |||
1399 | struct iw_handler_def r8180_wx_handlers_def = { | ||
1400 | .standard = r8180_wx_handlers, | ||
1401 | .num_standard = ARRAY_SIZE(r8180_wx_handlers), | ||
1402 | .private = r8180_private_handler, | ||
1403 | .num_private = ARRAY_SIZE(r8180_private_handler), | ||
1404 | .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args), | ||
1405 | .get_wireless_stats = r8180_get_wireless_stats, | ||
1406 | .private_args = (struct iw_priv_args *)r8180_private_args, | ||
1407 | }; | ||
1408 | |||
1409 | |||
diff --git a/drivers/staging/rtl8187se/r8180_wx.h b/drivers/staging/rtl8187se/r8180_wx.h deleted file mode 100644 index d471520ac772..000000000000 --- a/drivers/staging/rtl8187se/r8180_wx.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* | ||
2 | This is part of rtl8180 OpenSource driver - v 0.3 | ||
3 | Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> | ||
4 | Released under the terms of GPL (General Public Licence) | ||
5 | |||
6 | Parts of this driver are based on the GPL part of the official realtek driver | ||
7 | Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon | ||
8 | Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver | ||
9 | |||
10 | We want to thanks the Authors of such projects and the Ndiswrapper project Authors. | ||
11 | */ | ||
12 | |||
13 | /* this file (will) contains wireless extension handlers*/ | ||
14 | |||
15 | #ifndef R8180_WX_H | ||
16 | #define R8180_WX_H | ||
17 | #include <linux/wireless.h> | ||
18 | #include "ieee80211/ieee80211.h" | ||
19 | extern struct iw_handler_def r8180_wx_handlers_def; | ||
20 | |||
21 | #endif | ||
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c deleted file mode 100644 index cc6f100814f3..000000000000 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ /dev/null | |||
@@ -1,1464 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Realtek Semiconductor Corp. All rights reserved. | ||
3 | * | ||
4 | * Module Name: | ||
5 | * r8185b_init.c | ||
6 | * | ||
7 | * Abstract: | ||
8 | * Hardware Initialization and Hardware IO for RTL8185B | ||
9 | * | ||
10 | * Major Change History: | ||
11 | * When Who What | ||
12 | * ---------- --------------- ------------------------------- | ||
13 | * 2006-11-15 Xiong Created | ||
14 | * | ||
15 | * Notes: | ||
16 | * This file is ported from RTL8185B Windows driver. | ||
17 | * | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | /*--------------------------Include File------------------------------------*/ | ||
22 | #include <linux/spinlock.h> | ||
23 | #include "r8180_hw.h" | ||
24 | #include "r8180.h" | ||
25 | #include "r8180_rtl8225.h" /* RTL8225 Radio frontend */ | ||
26 | #include "r8180_93cx6.h" /* Card EEPROM */ | ||
27 | #include "r8180_wx.h" | ||
28 | #include "ieee80211/dot11d.h" | ||
29 | /* #define CONFIG_RTL8180_IO_MAP */ | ||
30 | #define TC_3W_POLL_MAX_TRY_CNT 5 | ||
31 | |||
32 | static u8 MAC_REG_TABLE[][2] = { | ||
33 | /* | ||
34 | * PAGE 0: | ||
35 | * 0x34(BRSR), 0xBE(RATE_FALLBACK_CTL), 0x1E0(ARFR) would set in | ||
36 | * HwConfigureRTL8185() | ||
37 | * 0x272(RFSW_CTRL), 0x1CE(AESMSK_QC) set in InitializeAdapter8185(). | ||
38 | * 0x1F0~0x1F8 set in MacConfig_85BASIC() | ||
39 | */ | ||
40 | {0x08, 0xae}, {0x0a, 0x72}, {0x5b, 0x42}, | ||
41 | {0x84, 0x88}, {0x85, 0x24}, {0x88, 0x54}, {0x8b, 0xb8}, {0x8c, 0x03}, | ||
42 | {0x8d, 0x40}, {0x8e, 0x00}, {0x8f, 0x00}, {0x5b, 0x18}, {0x91, 0x03}, | ||
43 | {0x94, 0x0F}, {0x95, 0x32}, | ||
44 | {0x96, 0x00}, {0x97, 0x07}, {0xb4, 0x22}, {0xdb, 0x00}, | ||
45 | {0xf0, 0x32}, {0xf1, 0x32}, {0xf2, 0x00}, {0xf3, 0x00}, {0xf4, 0x32}, | ||
46 | {0xf5, 0x43}, {0xf6, 0x00}, {0xf7, 0x00}, {0xf8, 0x46}, {0xf9, 0xa4}, | ||
47 | {0xfa, 0x00}, {0xfb, 0x00}, {0xfc, 0x96}, {0xfd, 0xa4}, {0xfe, 0x00}, | ||
48 | {0xff, 0x00}, | ||
49 | |||
50 | /* | ||
51 | * PAGE 1: | ||
52 | * For Flextronics system Logo PCIHCT failure: | ||
53 | * 0x1C4~0x1CD set no-zero value to avoid PCI configuration | ||
54 | * space 0x45[7]=1 | ||
55 | */ | ||
56 | {0x5e, 0x01}, | ||
57 | {0x58, 0x00}, {0x59, 0x00}, {0x5a, 0x04}, {0x5b, 0x00}, {0x60, 0x24}, | ||
58 | {0x61, 0x97}, {0x62, 0xF0}, {0x63, 0x09}, {0x80, 0x0F}, {0x81, 0xFF}, | ||
59 | {0x82, 0xFF}, {0x83, 0x03}, | ||
60 | /* lzm add 080826 */ | ||
61 | {0xC4, 0x22}, {0xC5, 0x22}, {0xC6, 0x22}, {0xC7, 0x22}, {0xC8, 0x22}, | ||
62 | /* lzm add 080826 */ | ||
63 | {0xC9, 0x22}, {0xCA, 0x22}, {0xCB, 0x22}, {0xCC, 0x22}, {0xCD, 0x22}, | ||
64 | {0xe2, 0x00}, | ||
65 | |||
66 | |||
67 | /* PAGE 2: */ | ||
68 | {0x5e, 0x02}, | ||
69 | {0x0c, 0x04}, {0x4c, 0x30}, {0x4d, 0x08}, {0x50, 0x05}, {0x51, 0xf5}, | ||
70 | {0x52, 0x04}, {0x53, 0xa0}, {0x54, 0xff}, {0x55, 0xff}, {0x56, 0xff}, | ||
71 | {0x57, 0xff}, {0x58, 0x08}, {0x59, 0x08}, {0x5a, 0x08}, {0x5b, 0x08}, | ||
72 | {0x60, 0x08}, {0x61, 0x08}, {0x62, 0x08}, {0x63, 0x08}, {0x64, 0x2f}, | ||
73 | {0x8c, 0x3f}, {0x8d, 0x3f}, {0x8e, 0x3f}, | ||
74 | {0x8f, 0x3f}, {0xc4, 0xff}, {0xc5, 0xff}, {0xc6, 0xff}, {0xc7, 0xff}, | ||
75 | {0xc8, 0x00}, {0xc9, 0x00}, {0xca, 0x80}, {0xcb, 0x00}, | ||
76 | |||
77 | /* PAGE 0: */ | ||
78 | {0x5e, 0x00}, {0x9f, 0x03} | ||
79 | }; | ||
80 | |||
81 | |||
82 | static u8 ZEBRA_AGC[] = { | ||
83 | 0, | ||
84 | 0x7E, 0x7E, 0x7E, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78, 0x77, 0x76, | ||
85 | 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, | ||
86 | 0x69, 0x68, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x48, 0x47, 0x46, 0x45, | ||
87 | 0x44, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x08, 0x07, | ||
88 | 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
89 | 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, | ||
90 | 0x0f, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x15, 0x16, 0x17, 0x17, 0x18, 0x18, | ||
91 | 0x19, 0x1a, 0x1a, 0x1b, 0x1b, 0x1c, 0x1c, 0x1d, 0x1d, 0x1d, 0x1e, 0x1e, | ||
92 | 0x1f, 0x1f, 0x1f, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x22, 0x22, | ||
93 | 0x22, 0x23, 0x23, 0x24, 0x24, 0x25, 0x25, 0x25, 0x26, 0x26, 0x27, 0x27, | ||
94 | 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F | ||
95 | }; | ||
96 | |||
97 | static u32 ZEBRA_RF_RX_GAIN_TABLE[] = { | ||
98 | 0x0096, 0x0076, 0x0056, 0x0036, 0x0016, 0x01f6, 0x01d6, 0x01b6, | ||
99 | 0x0196, 0x0176, 0x00F7, 0x00D7, 0x00B7, 0x0097, 0x0077, 0x0057, | ||
100 | 0x0037, 0x00FB, 0x00DB, 0x00BB, 0x00FF, 0x00E3, 0x00C3, 0x00A3, | ||
101 | 0x0083, 0x0063, 0x0043, 0x0023, 0x0003, 0x01E3, 0x01C3, 0x01A3, | ||
102 | 0x0183, 0x0163, 0x0143, 0x0123, 0x0103 | ||
103 | }; | ||
104 | |||
105 | static u8 OFDM_CONFIG[] = { | ||
106 | /* OFDM reg0x06[7:0]=0xFF: Enable power saving mode in RX */ | ||
107 | /* OFDM reg0x3C[4]=1'b1: Enable RX power saving mode */ | ||
108 | /* ofdm 0x3a = 0x7b ,(original : 0xfb) For ECS shielding room TP test */ | ||
109 | /* 0x00 */ | ||
110 | 0x10, 0x0F, 0x0A, 0x0C, 0x14, 0xFA, 0xFF, 0x50, | ||
111 | 0x00, 0x50, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, | ||
112 | /* 0x10 */ | ||
113 | 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xA8, 0x26, | ||
114 | 0x32, 0x33, 0x06, 0xA5, 0x6F, 0x55, 0xC8, 0xBB, | ||
115 | /* 0x20 */ | ||
116 | 0x0A, 0xE1, 0x2C, 0x4A, 0x86, 0x83, 0x34, 0x00, | ||
117 | 0x4F, 0x24, 0x6F, 0xC2, 0x03, 0x40, 0x80, 0x00, | ||
118 | /* 0x30 */ | ||
119 | 0xC0, 0xC1, 0x58, 0xF1, 0x00, 0xC4, 0x90, 0x3e, | ||
120 | 0xD8, 0x3C, 0x7B, 0x10, 0x10 | ||
121 | }; | ||
122 | |||
123 | /*--------------------------------------------------------------- | ||
124 | * Hardware IO | ||
125 | * the code is ported from Windows source code | ||
126 | *--------------------------------------------------------------- | ||
127 | */ | ||
128 | |||
129 | static u8 PlatformIORead1Byte(struct net_device *dev, u32 offset) | ||
130 | { | ||
131 | return read_nic_byte(dev, offset); | ||
132 | } | ||
133 | |||
134 | static void PlatformIOWrite1Byte(struct net_device *dev, u32 offset, u8 data) | ||
135 | { | ||
136 | write_nic_byte(dev, offset, data); | ||
137 | /* | ||
138 | * To make sure write operation is completed, | ||
139 | * 2005.11.09, by rcnjko. | ||
140 | */ | ||
141 | read_nic_byte(dev, offset); | ||
142 | } | ||
143 | |||
144 | static void PlatformIOWrite2Byte(struct net_device *dev, u32 offset, u16 data) | ||
145 | { | ||
146 | write_nic_word(dev, offset, data); | ||
147 | /* | ||
148 | * To make sure write operation is completed, | ||
149 | * 2005.11.09, by rcnjko. | ||
150 | */ | ||
151 | read_nic_word(dev, offset); | ||
152 | } | ||
153 | |||
154 | static void PlatformIOWrite4Byte(struct net_device *dev, u32 offset, u32 data) | ||
155 | { | ||
156 | if (offset == PhyAddr) { | ||
157 | /* For Base Band configuration. */ | ||
158 | unsigned char cmdByte; | ||
159 | unsigned long dataBytes; | ||
160 | unsigned char idx; | ||
161 | u8 u1bTmp; | ||
162 | |||
163 | cmdByte = (u8)(data & 0x000000ff); | ||
164 | dataBytes = data>>8; | ||
165 | |||
166 | /* | ||
167 | * 071010, rcnjko: | ||
168 | * The critical section is only BB read/write race | ||
169 | * condition. Assumption: | ||
170 | * 1. We assume NO one will access BB at DIRQL, otherwise, | ||
171 | * system will crash for | ||
172 | * acquiring the spinlock in such context. | ||
173 | * 2. PlatformIOWrite4Byte() MUST NOT be recursive. | ||
174 | */ | ||
175 | /* NdisAcquireSpinLock( &(pDevice->IoSpinLock) ); */ | ||
176 | |||
177 | for (idx = 0; idx < 30; idx++) { | ||
178 | /* Make sure command bit is clear before access it. */ | ||
179 | u1bTmp = PlatformIORead1Byte(dev, PhyAddr); | ||
180 | if ((u1bTmp & BIT7) == 0) | ||
181 | break; | ||
182 | else | ||
183 | mdelay(10); | ||
184 | } | ||
185 | |||
186 | for (idx = 0; idx < 3; idx++) | ||
187 | PlatformIOWrite1Byte(dev, offset+1+idx, | ||
188 | ((u8 *)&dataBytes)[idx]); | ||
189 | |||
190 | write_nic_byte(dev, offset, cmdByte); | ||
191 | |||
192 | /* NdisReleaseSpinLock( &(pDevice->IoSpinLock) ); */ | ||
193 | } else { | ||
194 | write_nic_dword(dev, offset, data); | ||
195 | /* | ||
196 | * To make sure write operation is completed, 2005.11.09, | ||
197 | * by rcnjko. | ||
198 | */ | ||
199 | read_nic_dword(dev, offset); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | static void SetOutputEnableOfRfPins(struct net_device *dev) | ||
204 | { | ||
205 | write_nic_word(dev, RFPinsEnable, 0x1bff); | ||
206 | } | ||
207 | |||
208 | static bool HwHSSIThreeWire(struct net_device *dev, | ||
209 | u8 *pDataBuf, | ||
210 | bool write) | ||
211 | { | ||
212 | u8 TryCnt; | ||
213 | u8 u1bTmp; | ||
214 | |||
215 | /* Check if WE and RE are cleared. */ | ||
216 | for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { | ||
217 | u1bTmp = read_nic_byte(dev, SW_3W_CMD1); | ||
218 | if ((u1bTmp & (SW_3W_CMD1_RE|SW_3W_CMD1_WE)) == 0) | ||
219 | break; | ||
220 | |||
221 | udelay(10); | ||
222 | } | ||
223 | if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { | ||
224 | netdev_err(dev, | ||
225 | "HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n", | ||
226 | u1bTmp); | ||
227 | return false; | ||
228 | } | ||
229 | |||
230 | /* RTL8187S HSSI Read/Write Function */ | ||
231 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); | ||
232 | u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */ | ||
233 | write_nic_byte(dev, RF_SW_CONFIG, u1bTmp); | ||
234 | |||
235 | /* jong: HW SI read must set reg84[3]=0. */ | ||
236 | u1bTmp = read_nic_byte(dev, RFPinsSelect); | ||
237 | u1bTmp &= ~BIT3; | ||
238 | write_nic_byte(dev, RFPinsSelect, u1bTmp); | ||
239 | /* Fill up data buffer for write operation. */ | ||
240 | |||
241 | /* SI - reg274[3:0] : RF register's Address */ | ||
242 | if (write) | ||
243 | write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); | ||
244 | else | ||
245 | write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); | ||
246 | |||
247 | /* Set up command: WE or RE. */ | ||
248 | if (write) | ||
249 | write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE); | ||
250 | else | ||
251 | write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE); | ||
252 | |||
253 | |||
254 | /* Check if DONE is set. */ | ||
255 | for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { | ||
256 | u1bTmp = read_nic_byte(dev, SW_3W_CMD1); | ||
257 | if (u1bTmp & SW_3W_CMD1_DONE) | ||
258 | break; | ||
259 | |||
260 | udelay(10); | ||
261 | } | ||
262 | |||
263 | write_nic_byte(dev, SW_3W_CMD1, 0); | ||
264 | |||
265 | /* Read back data for read operation. */ | ||
266 | if (!write) { | ||
267 | /* Serial Interface : reg363_362[11:0] */ | ||
268 | *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ); | ||
269 | *((u16 *)pDataBuf) &= 0x0FFF; | ||
270 | } | ||
271 | |||
272 | return true; | ||
273 | } | ||
274 | |||
275 | void RF_WriteReg(struct net_device *dev, u8 offset, u16 data) | ||
276 | { | ||
277 | u16 reg = (data << 4) | (offset & 0x0f); | ||
278 | HwHSSIThreeWire(dev, (u8 *)®, true); | ||
279 | } | ||
280 | |||
281 | u16 RF_ReadReg(struct net_device *dev, u8 offset) | ||
282 | { | ||
283 | u16 reg = offset & 0x0f; | ||
284 | HwHSSIThreeWire(dev, (u8 *)®, false); | ||
285 | return reg; | ||
286 | } | ||
287 | |||
288 | static u8 ReadBBPortUchar(struct net_device *dev, u32 addr) | ||
289 | { | ||
290 | PlatformIOWrite4Byte(dev, PhyAddr, addr & 0xffffff7f); | ||
291 | return PlatformIORead1Byte(dev, PhyDataR); | ||
292 | } | ||
293 | |||
294 | /* by Owen on 04/07/14 for writing BB register successfully */ | ||
295 | static void WriteBBPortUchar(struct net_device *dev, u32 Data) | ||
296 | { | ||
297 | PlatformIOWrite4Byte(dev, PhyAddr, Data); | ||
298 | ReadBBPortUchar(dev, Data); | ||
299 | } | ||
300 | |||
301 | /* | ||
302 | * Description: | ||
303 | * Perform Antenna settings with antenna diversity on 87SE. | ||
304 | * Created by Roger, 2008.01.25. | ||
305 | */ | ||
306 | bool SetAntennaConfig87SE(struct net_device *dev, | ||
307 | u8 DefaultAnt, /* 0: Main, 1: Aux. */ | ||
308 | bool bAntDiversity) /* 1:Enable, 0: Disable. */ | ||
309 | { | ||
310 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
311 | bool bAntennaSwitched = true; | ||
312 | /* 0x00 = disabled, 0x80 = enabled */ | ||
313 | u8 ant_diversity_offset = 0x00; | ||
314 | |||
315 | /* | ||
316 | * printk("SetAntennaConfig87SE(): DefaultAnt(%d), bAntDiversity(%d)\n", | ||
317 | * DefaultAnt, bAntDiversity); | ||
318 | */ | ||
319 | |||
320 | /* Threshold for antenna diversity. */ | ||
321 | write_phy_cck(dev, 0x0c, 0x09); /* Reg0c : 09 */ | ||
322 | |||
323 | if (bAntDiversity) /* Enable Antenna Diversity. */ | ||
324 | ant_diversity_offset = 0x80; | ||
325 | |||
326 | if (DefaultAnt == 1) { /* aux Antenna */ | ||
327 | /* Mac register, aux antenna */ | ||
328 | write_nic_byte(dev, ANTSEL, 0x00); | ||
329 | |||
330 | /* Config CCK RX antenna. */ | ||
331 | write_phy_cck(dev, 0x11, 0xbb); /* Reg11 : bb */ | ||
332 | |||
333 | /* Reg01 : 47 | ant_diversity_offset */ | ||
334 | write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); | ||
335 | |||
336 | /* Config OFDM RX antenna. */ | ||
337 | write_phy_ofdm(dev, 0x0D, 0x54); /* Reg0d : 54 */ | ||
338 | /* Reg18 : 32 */ | ||
339 | write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset); | ||
340 | } else { /* main Antenna */ | ||
341 | /* Mac register, main antenna */ | ||
342 | write_nic_byte(dev, ANTSEL, 0x03); | ||
343 | |||
344 | /* Config CCK RX antenna. */ | ||
345 | write_phy_cck(dev, 0x11, 0x9b); /* Reg11 : 9b */ | ||
346 | /* Reg01 : 47 */ | ||
347 | write_phy_cck(dev, 0x01, 0x47|ant_diversity_offset); | ||
348 | |||
349 | /* Config OFDM RX antenna. */ | ||
350 | write_phy_ofdm(dev, 0x0D, 0x5c); /* Reg0d : 5c */ | ||
351 | /*Reg18 : 32 */ | ||
352 | write_phy_ofdm(dev, 0x18, 0x32|ant_diversity_offset); | ||
353 | } | ||
354 | priv->CurrAntennaIndex = DefaultAnt; /* Update default settings. */ | ||
355 | return bAntennaSwitched; | ||
356 | } | ||
357 | /* | ||
358 | *-------------------------------------------------------------- | ||
359 | * Hardware Initialization. | ||
360 | * the code is ported from Windows source code | ||
361 | *-------------------------------------------------------------- | ||
362 | */ | ||
363 | |||
364 | static void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev) | ||
365 | { | ||
366 | |||
367 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
368 | u32 i; | ||
369 | u32 addr, data; | ||
370 | u32 u4bRegOffset, u4bRegValue; | ||
371 | u16 u4bRF23, u4bRF24; | ||
372 | u8 u1b24E; | ||
373 | int d_cut = 0; | ||
374 | |||
375 | |||
376 | /* | ||
377 | *=========================================================================== | ||
378 | * 87S_PCIE :: RADIOCFG.TXT | ||
379 | *=========================================================================== | ||
380 | */ | ||
381 | |||
382 | |||
383 | /* Page1 : reg16-reg30 */ | ||
384 | RF_WriteReg(dev, 0x00, 0x013f); mdelay(1); /* switch to page1 */ | ||
385 | u4bRF23 = RF_ReadReg(dev, 0x08); mdelay(1); | ||
386 | u4bRF24 = RF_ReadReg(dev, 0x09); mdelay(1); | ||
387 | |||
388 | if (u4bRF23 == 0x818 && u4bRF24 == 0x70C) { | ||
389 | d_cut = 1; | ||
390 | netdev_info(dev, "card type changed from C- to D-cut\n"); | ||
391 | } | ||
392 | |||
393 | /* Page0 : reg0-reg15 */ | ||
394 | |||
395 | RF_WriteReg(dev, 0x00, 0x009f); mdelay(1);/* 1 */ | ||
396 | RF_WriteReg(dev, 0x01, 0x06e0); mdelay(1); | ||
397 | RF_WriteReg(dev, 0x02, 0x004d); mdelay(1);/* 2 */ | ||
398 | RF_WriteReg(dev, 0x03, 0x07f1); mdelay(1);/* 3 */ | ||
399 | RF_WriteReg(dev, 0x04, 0x0975); mdelay(1); | ||
400 | RF_WriteReg(dev, 0x05, 0x0c72); mdelay(1); | ||
401 | RF_WriteReg(dev, 0x06, 0x0ae6); mdelay(1); | ||
402 | RF_WriteReg(dev, 0x07, 0x00ca); mdelay(1); | ||
403 | RF_WriteReg(dev, 0x08, 0x0e1c); mdelay(1); | ||
404 | RF_WriteReg(dev, 0x09, 0x02f0); mdelay(1); | ||
405 | RF_WriteReg(dev, 0x0a, 0x09d0); mdelay(1); | ||
406 | RF_WriteReg(dev, 0x0b, 0x01ba); mdelay(1); | ||
407 | RF_WriteReg(dev, 0x0c, 0x0640); mdelay(1); | ||
408 | RF_WriteReg(dev, 0x0d, 0x08df); mdelay(1); | ||
409 | RF_WriteReg(dev, 0x0e, 0x0020); mdelay(1); | ||
410 | RF_WriteReg(dev, 0x0f, 0x0990); mdelay(1); | ||
411 | |||
412 | /* Page1 : reg16-reg30 */ | ||
413 | RF_WriteReg(dev, 0x00, 0x013f); mdelay(1); | ||
414 | RF_WriteReg(dev, 0x03, 0x0806); mdelay(1); | ||
415 | RF_WriteReg(dev, 0x04, 0x03a7); mdelay(1); | ||
416 | RF_WriteReg(dev, 0x05, 0x059b); mdelay(1); | ||
417 | RF_WriteReg(dev, 0x06, 0x0081); mdelay(1); | ||
418 | RF_WriteReg(dev, 0x07, 0x01A0); mdelay(1); | ||
419 | /* | ||
420 | * Don't write RF23/RF24 to make a difference between 87S C cut and D cut. | ||
421 | * asked by SD3 stevenl. | ||
422 | */ | ||
423 | RF_WriteReg(dev, 0x0a, 0x0001); mdelay(1); | ||
424 | RF_WriteReg(dev, 0x0b, 0x0418); mdelay(1); | ||
425 | |||
426 | if (d_cut) { | ||
427 | RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); | ||
428 | RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); | ||
429 | /* RX LO buffer */ | ||
430 | RF_WriteReg(dev, 0x0e, 0x0807); mdelay(1); | ||
431 | } else { | ||
432 | RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); | ||
433 | RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); | ||
434 | /* RX LO buffer */ | ||
435 | RF_WriteReg(dev, 0x0e, 0x0806); mdelay(1); | ||
436 | } | ||
437 | |||
438 | RF_WriteReg(dev, 0x0f, 0x0acc); mdelay(1); | ||
439 | RF_WriteReg(dev, 0x00, 0x01d7); mdelay(1); /* 6 */ | ||
440 | RF_WriteReg(dev, 0x03, 0x0e00); mdelay(1); | ||
441 | RF_WriteReg(dev, 0x04, 0x0e50); mdelay(1); | ||
442 | |||
443 | for (i = 0; i <= 36; i++) { | ||
444 | RF_WriteReg(dev, 0x01, i); mdelay(1); | ||
445 | RF_WriteReg(dev, 0x02, ZEBRA_RF_RX_GAIN_TABLE[i]); mdelay(1); | ||
446 | } | ||
447 | |||
448 | RF_WriteReg(dev, 0x05, 0x0203); mdelay(1); /* 203, 343 */ | ||
449 | RF_WriteReg(dev, 0x06, 0x0200); mdelay(1); /* 400 */ | ||
450 | /* switch to reg16-reg30, and HSSI disable 137 */ | ||
451 | RF_WriteReg(dev, 0x00, 0x0137); mdelay(1); | ||
452 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
453 | |||
454 | /* Z4 synthesizer loop filter setting, 392 */ | ||
455 | RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); | ||
456 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
457 | |||
458 | /* switch to reg0-reg15, and HSSI disable */ | ||
459 | RF_WriteReg(dev, 0x00, 0x0037); mdelay(1); | ||
460 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
461 | |||
462 | /* CBC on, Tx Rx disable, High gain */ | ||
463 | RF_WriteReg(dev, 0x04, 0x0160); mdelay(1); | ||
464 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
465 | |||
466 | /* Z4 setted channel 1 */ | ||
467 | RF_WriteReg(dev, 0x07, 0x0080); mdelay(1); | ||
468 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
469 | |||
470 | RF_WriteReg(dev, 0x02, 0x088D); mdelay(1); /* LC calibration */ | ||
471 | mdelay(200); /* Deay 200 ms. */ /* 0xfd */ | ||
472 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
473 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
474 | |||
475 | /* switch to reg16-reg30 137, and HSSI disable 137 */ | ||
476 | RF_WriteReg(dev, 0x00, 0x0137); mdelay(1); | ||
477 | mdelay(10); /* Deay 10 ms. */ /* 0xfd */ | ||
478 | |||
479 | RF_WriteReg(dev, 0x07, 0x0000); mdelay(1); | ||
480 | RF_WriteReg(dev, 0x07, 0x0180); mdelay(1); | ||
481 | RF_WriteReg(dev, 0x07, 0x0220); mdelay(1); | ||
482 | RF_WriteReg(dev, 0x07, 0x03E0); mdelay(1); | ||
483 | |||
484 | /* DAC calibration off 20070702 */ | ||
485 | RF_WriteReg(dev, 0x06, 0x00c1); mdelay(1); | ||
486 | RF_WriteReg(dev, 0x0a, 0x0001); mdelay(1); | ||
487 | /* For crystal calibration, added by Roger, 2007.12.11. */ | ||
488 | if (priv->bXtalCalibration) { /* reg 30. */ | ||
489 | /* | ||
490 | * enable crystal calibration. | ||
491 | * RF Reg[30], (1)Xin:[12:9], Xout:[8:5], addr[4:0]. | ||
492 | * (2)PA Pwr delay timer[15:14], default: 2.4us, | ||
493 | * set BIT15=0 | ||
494 | * (3)RF signal on/off when calibration[13], default: on, | ||
495 | * set BIT13=0. | ||
496 | * So we should minus 4 BITs offset. | ||
497 | */ | ||
498 | RF_WriteReg(dev, 0x0f, (priv->XtalCal_Xin<<5) | | ||
499 | (priv->XtalCal_Xout<<1) | BIT11 | BIT9); mdelay(1); | ||
500 | netdev_info(dev, "ZEBRA_Config_85BASIC_HardCode(): (%02x)\n", | ||
501 | (priv->XtalCal_Xin<<5) | (priv->XtalCal_Xout<<1) | | ||
502 | BIT11 | BIT9); | ||
503 | } else { | ||
504 | /* using default value. Xin=6, Xout=6. */ | ||
505 | RF_WriteReg(dev, 0x0f, 0x0acc); mdelay(1); | ||
506 | } | ||
507 | /* switch to reg0-reg15, and HSSI enable */ | ||
508 | RF_WriteReg(dev, 0x00, 0x00bf); mdelay(1); | ||
509 | /* Rx BB start calibration, 00c//+edward */ | ||
510 | RF_WriteReg(dev, 0x0d, 0x08df); mdelay(1); | ||
511 | /* temperature meter off */ | ||
512 | RF_WriteReg(dev, 0x02, 0x004d); mdelay(1); | ||
513 | RF_WriteReg(dev, 0x04, 0x0975); mdelay(1); /* Rx mode */ | ||
514 | mdelay(10); /* Deay 10 ms.*/ /* 0xfe */ | ||
515 | mdelay(10); /* Deay 10 ms.*/ /* 0xfe */ | ||
516 | mdelay(10); /* Deay 10 ms.*/ /* 0xfe */ | ||
517 | /* Rx mode*/ /*+edward */ | ||
518 | RF_WriteReg(dev, 0x00, 0x0197); mdelay(1); | ||
519 | /* Rx mode*/ /*+edward */ | ||
520 | RF_WriteReg(dev, 0x05, 0x05ab); mdelay(1); | ||
521 | /* Rx mode*/ /*+edward */ | ||
522 | RF_WriteReg(dev, 0x00, 0x009f); mdelay(1); | ||
523 | /* Rx mode*/ /*+edward */ | ||
524 | RF_WriteReg(dev, 0x01, 0x0000); mdelay(1); | ||
525 | /* Rx mode*/ /*+edward */ | ||
526 | RF_WriteReg(dev, 0x02, 0x0000); mdelay(1); | ||
527 | /* power save parameters. */ | ||
528 | u1b24E = read_nic_byte(dev, 0x24E); | ||
529 | write_nic_byte(dev, 0x24E, (u1b24E & (~(BIT5|BIT6)))); | ||
530 | |||
531 | /*====================================================================== | ||
532 | * | ||
533 | *====================================================================== | ||
534 | * CCKCONF.TXT | ||
535 | *====================================================================== | ||
536 | * | ||
537 | * [POWER SAVE] Power Saving Parameters by jong. 2007-11-27 | ||
538 | * CCK reg0x00[7]=1'b1 :power saving for TX (default) | ||
539 | * CCK reg0x00[6]=1'b1: power saving for RX (default) | ||
540 | * CCK reg0x06[4]=1'b1: turn off channel estimation related | ||
541 | * circuits if not doing channel estimation. | ||
542 | * CCK reg0x06[3]=1'b1: turn off unused circuits before cca = 1 | ||
543 | * CCK reg0x06[2]=1'b1: turn off cck's circuit if macrst =0 | ||
544 | */ | ||
545 | |||
546 | write_phy_cck(dev, 0x00, 0xc8); | ||
547 | write_phy_cck(dev, 0x06, 0x1c); | ||
548 | write_phy_cck(dev, 0x10, 0x78); | ||
549 | write_phy_cck(dev, 0x2e, 0xd0); | ||
550 | write_phy_cck(dev, 0x2f, 0x06); | ||
551 | write_phy_cck(dev, 0x01, 0x46); | ||
552 | |||
553 | /* power control */ | ||
554 | write_nic_byte(dev, CCK_TXAGC, 0x10); | ||
555 | write_nic_byte(dev, OFDM_TXAGC, 0x1B); | ||
556 | write_nic_byte(dev, ANTSEL, 0x03); | ||
557 | |||
558 | |||
559 | |||
560 | /* | ||
561 | *====================================================================== | ||
562 | * AGC.txt | ||
563 | *====================================================================== | ||
564 | */ | ||
565 | |||
566 | write_phy_ofdm(dev, 0x00, 0x12); | ||
567 | |||
568 | for (i = 0; i < 128; i++) { | ||
569 | |||
570 | data = ZEBRA_AGC[i+1]; | ||
571 | data = data << 8; | ||
572 | data = data | 0x0000008F; | ||
573 | |||
574 | addr = i + 0x80; /* enable writing AGC table */ | ||
575 | addr = addr << 8; | ||
576 | addr = addr | 0x0000008E; | ||
577 | |||
578 | WriteBBPortUchar(dev, data); | ||
579 | WriteBBPortUchar(dev, addr); | ||
580 | WriteBBPortUchar(dev, 0x0000008E); | ||
581 | } | ||
582 | |||
583 | PlatformIOWrite4Byte(dev, PhyAddr, 0x00001080); /* Annie, 2006-05-05 */ | ||
584 | |||
585 | /* | ||
586 | *====================================================================== | ||
587 | * | ||
588 | *====================================================================== | ||
589 | * OFDMCONF.TXT | ||
590 | *====================================================================== | ||
591 | */ | ||
592 | |||
593 | for (i = 0; i < 60; i++) { | ||
594 | u4bRegOffset = i; | ||
595 | u4bRegValue = OFDM_CONFIG[i]; | ||
596 | |||
597 | WriteBBPortUchar(dev, | ||
598 | (0x00000080 | | ||
599 | (u4bRegOffset & 0x7f) | | ||
600 | ((u4bRegValue & 0xff) << 8))); | ||
601 | } | ||
602 | |||
603 | /* | ||
604 | *====================================================================== | ||
605 | * by amy for antenna | ||
606 | *====================================================================== | ||
607 | */ | ||
608 | /* | ||
609 | * Config Sw/Hw Combinational Antenna Diversity. Added by Roger, | ||
610 | * 2008.02.26. | ||
611 | */ | ||
612 | SetAntennaConfig87SE(dev, priv->bDefaultAntenna1, | ||
613 | priv->bSwAntennaDiverity); | ||
614 | } | ||
615 | |||
616 | |||
617 | void UpdateInitialGain(struct net_device *dev) | ||
618 | { | ||
619 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
620 | |||
621 | /* lzm add 080826 */ | ||
622 | if (priv->eRFPowerState != RF_ON) { | ||
623 | /* Don't access BB/RF under disable PLL situation. | ||
624 | * RT_TRACE(COMP_DIG, DBG_LOUD, ("UpdateInitialGain - | ||
625 | * pHalData->eRFPowerState!=RF_ON\n")); | ||
626 | * Back to the original state | ||
627 | */ | ||
628 | priv->InitialGain = priv->InitialGainBackUp; | ||
629 | return; | ||
630 | } | ||
631 | |||
632 | switch (priv->InitialGain) { | ||
633 | case 1: /* m861dBm */ | ||
634 | write_phy_ofdm(dev, 0x17, 0x26); mdelay(1); | ||
635 | write_phy_ofdm(dev, 0x24, 0x86); mdelay(1); | ||
636 | write_phy_ofdm(dev, 0x05, 0xfa); mdelay(1); | ||
637 | break; | ||
638 | |||
639 | case 2: /* m862dBm */ | ||
640 | write_phy_ofdm(dev, 0x17, 0x36); mdelay(1); | ||
641 | write_phy_ofdm(dev, 0x24, 0x86); mdelay(1); | ||
642 | write_phy_ofdm(dev, 0x05, 0xfa); mdelay(1); | ||
643 | break; | ||
644 | |||
645 | case 3: /* m863dBm */ | ||
646 | write_phy_ofdm(dev, 0x17, 0x36); mdelay(1); | ||
647 | write_phy_ofdm(dev, 0x24, 0x86); mdelay(1); | ||
648 | write_phy_ofdm(dev, 0x05, 0xfb); mdelay(1); | ||
649 | break; | ||
650 | |||
651 | case 4: /* m864dBm */ | ||
652 | write_phy_ofdm(dev, 0x17, 0x46); mdelay(1); | ||
653 | write_phy_ofdm(dev, 0x24, 0x86); mdelay(1); | ||
654 | write_phy_ofdm(dev, 0x05, 0xfb); mdelay(1); | ||
655 | break; | ||
656 | |||
657 | case 5: /* m82dBm */ | ||
658 | write_phy_ofdm(dev, 0x17, 0x46); mdelay(1); | ||
659 | write_phy_ofdm(dev, 0x24, 0x96); mdelay(1); | ||
660 | write_phy_ofdm(dev, 0x05, 0xfb); mdelay(1); | ||
661 | break; | ||
662 | |||
663 | case 6: /* m78dBm */ | ||
664 | write_phy_ofdm(dev, 0x17, 0x56); mdelay(1); | ||
665 | write_phy_ofdm(dev, 0x24, 0x96); mdelay(1); | ||
666 | write_phy_ofdm(dev, 0x05, 0xfc); mdelay(1); | ||
667 | break; | ||
668 | |||
669 | case 7: /* m74dBm */ | ||
670 | write_phy_ofdm(dev, 0x17, 0x56); mdelay(1); | ||
671 | write_phy_ofdm(dev, 0x24, 0xa6); mdelay(1); | ||
672 | write_phy_ofdm(dev, 0x05, 0xfc); mdelay(1); | ||
673 | break; | ||
674 | |||
675 | case 8: | ||
676 | write_phy_ofdm(dev, 0x17, 0x66); mdelay(1); | ||
677 | write_phy_ofdm(dev, 0x24, 0xb6); mdelay(1); | ||
678 | write_phy_ofdm(dev, 0x05, 0xfc); mdelay(1); | ||
679 | break; | ||
680 | |||
681 | default: /* MP */ | ||
682 | write_phy_ofdm(dev, 0x17, 0x26); mdelay(1); | ||
683 | write_phy_ofdm(dev, 0x24, 0x86); mdelay(1); | ||
684 | write_phy_ofdm(dev, 0x05, 0xfa); mdelay(1); | ||
685 | break; | ||
686 | } | ||
687 | } | ||
688 | /* | ||
689 | * Description: | ||
690 | * Tx Power tracking mechanism routine on 87SE. | ||
691 | * Created by Roger, 2007.12.11. | ||
692 | */ | ||
693 | static void InitTxPwrTracking87SE(struct net_device *dev) | ||
694 | { | ||
695 | u32 u4bRfReg; | ||
696 | |||
697 | u4bRfReg = RF_ReadReg(dev, 0x02); | ||
698 | |||
699 | /* Enable Thermal meter indication. */ | ||
700 | RF_WriteReg(dev, 0x02, u4bRfReg|PWR_METER_EN); mdelay(1); | ||
701 | } | ||
702 | |||
703 | static void PhyConfig8185(struct net_device *dev) | ||
704 | { | ||
705 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
706 | write_nic_dword(dev, RCR, priv->ReceiveConfig); | ||
707 | priv->RFProgType = read_nic_byte(dev, CONFIG4) & 0x03; | ||
708 | /* RF config */ | ||
709 | ZEBRA_Config_85BASIC_HardCode(dev); | ||
710 | /* Set default initial gain state to 4, approved by SD3 DZ, by Bruce, | ||
711 | * 2007-06-06. | ||
712 | */ | ||
713 | if (priv->bDigMechanism) { | ||
714 | if (priv->InitialGain == 0) | ||
715 | priv->InitialGain = 4; | ||
716 | } | ||
717 | |||
718 | /* | ||
719 | * Enable thermal meter indication to implement TxPower tracking | ||
720 | * on 87SE. We initialize thermal meter here to avoid unsuccessful | ||
721 | * configuration. Added by Roger, 2007.12.11. | ||
722 | */ | ||
723 | if (priv->bTxPowerTrack) | ||
724 | InitTxPwrTracking87SE(dev); | ||
725 | |||
726 | priv->InitialGainBackUp = priv->InitialGain; | ||
727 | UpdateInitialGain(dev); | ||
728 | |||
729 | return; | ||
730 | } | ||
731 | |||
732 | static void HwConfigureRTL8185(struct net_device *dev) | ||
733 | { | ||
734 | /* | ||
735 | * RTL8185_TODO: Determine Retrylimit, TxAGC, | ||
736 | * AutoRateFallback control. | ||
737 | */ | ||
738 | u8 bUNIVERSAL_CONTROL_RL = 0; | ||
739 | u8 bUNIVERSAL_CONTROL_AGC = 1; | ||
740 | u8 bUNIVERSAL_CONTROL_ANT = 1; | ||
741 | u8 bAUTO_RATE_FALLBACK_CTL = 1; | ||
742 | u8 val8; | ||
743 | write_nic_word(dev, BRSR, 0x0fff); | ||
744 | /* Retry limit */ | ||
745 | val8 = read_nic_byte(dev, CW_CONF); | ||
746 | |||
747 | if (bUNIVERSAL_CONTROL_RL) | ||
748 | val8 = val8 & 0xfd; | ||
749 | else | ||
750 | val8 = val8 | 0x02; | ||
751 | |||
752 | write_nic_byte(dev, CW_CONF, val8); | ||
753 | |||
754 | /* Tx AGC */ | ||
755 | val8 = read_nic_byte(dev, TXAGC_CTL); | ||
756 | if (bUNIVERSAL_CONTROL_AGC) { | ||
757 | write_nic_byte(dev, CCK_TXAGC, 128); | ||
758 | write_nic_byte(dev, OFDM_TXAGC, 128); | ||
759 | val8 = val8 & 0xfe; | ||
760 | } else { | ||
761 | val8 = val8 | 0x01; | ||
762 | } | ||
763 | |||
764 | |||
765 | write_nic_byte(dev, TXAGC_CTL, val8); | ||
766 | |||
767 | /* Tx Antenna including Feedback control */ | ||
768 | val8 = read_nic_byte(dev, TXAGC_CTL); | ||
769 | |||
770 | if (bUNIVERSAL_CONTROL_ANT) { | ||
771 | write_nic_byte(dev, ANTSEL, 0x00); | ||
772 | val8 = val8 & 0xfd; | ||
773 | } else { | ||
774 | val8 = val8 & (val8|0x02); /* xiong-2006-11-15 */ | ||
775 | } | ||
776 | |||
777 | write_nic_byte(dev, TXAGC_CTL, val8); | ||
778 | |||
779 | /* Auto Rate fallback control */ | ||
780 | val8 = read_nic_byte(dev, RATE_FALLBACK); | ||
781 | val8 &= 0x7c; | ||
782 | if (bAUTO_RATE_FALLBACK_CTL) { | ||
783 | val8 |= RATE_FALLBACK_CTL_ENABLE | RATE_FALLBACK_CTL_AUTO_STEP1; | ||
784 | |||
785 | /* <RJ_TODO_8185B> We shall set up the ARFR according | ||
786 | * to user's setting. | ||
787 | */ | ||
788 | PlatformIOWrite2Byte(dev, ARFR, 0x0fff); /* set 1M ~ 54Mbps. */ | ||
789 | } | ||
790 | write_nic_byte(dev, RATE_FALLBACK, val8); | ||
791 | } | ||
792 | |||
793 | static void MacConfig_85BASIC_HardCode(struct net_device *dev) | ||
794 | { | ||
795 | /* | ||
796 | *====================================================================== | ||
797 | * MACREG.TXT | ||
798 | *====================================================================== | ||
799 | */ | ||
800 | int nLinesRead = 0; | ||
801 | u32 u4bRegOffset, u4bRegValue, u4bPageIndex = 0; | ||
802 | int i; | ||
803 | |||
804 | nLinesRead = sizeof(MAC_REG_TABLE)/2; | ||
805 | |||
806 | for (i = 0; i < nLinesRead; i++) { /* nLinesRead=101 */ | ||
807 | u4bRegOffset = MAC_REG_TABLE[i][0]; | ||
808 | u4bRegValue = MAC_REG_TABLE[i][1]; | ||
809 | |||
810 | if (u4bRegOffset == 0x5e) | ||
811 | u4bPageIndex = u4bRegValue; | ||
812 | else | ||
813 | u4bRegOffset |= (u4bPageIndex << 8); | ||
814 | |||
815 | write_nic_byte(dev, u4bRegOffset, (u8)u4bRegValue); | ||
816 | } | ||
817 | /* ================================================================= */ | ||
818 | } | ||
819 | |||
820 | static void MacConfig_85BASIC(struct net_device *dev) | ||
821 | { | ||
822 | |||
823 | u8 u1DA; | ||
824 | MacConfig_85BASIC_HardCode(dev); | ||
825 | |||
826 | /* ================================================================= */ | ||
827 | |||
828 | /* Follow TID_AC_MAP of WMac. */ | ||
829 | write_nic_word(dev, TID_AC_MAP, 0xfa50); | ||
830 | |||
831 | /* Interrupt Migration, Jong suggested we use set 0x0000 first, | ||
832 | * 2005.12.14, by rcnjko. | ||
833 | */ | ||
834 | write_nic_word(dev, IntMig, 0x0000); | ||
835 | |||
836 | /* Prevent TPC to cause CRC error. Added by Annie, 2006-06-10. */ | ||
837 | PlatformIOWrite4Byte(dev, 0x1F0, 0x00000000); | ||
838 | PlatformIOWrite4Byte(dev, 0x1F4, 0x00000000); | ||
839 | PlatformIOWrite1Byte(dev, 0x1F8, 0x00); | ||
840 | |||
841 | /* Asked for by SD3 CM Lin, 2006.06.27, by rcnjko. */ | ||
842 | |||
843 | /* | ||
844 | * power save parameter based on | ||
845 | * "87SE power save parameters 20071127.doc", as follow. | ||
846 | */ | ||
847 | |||
848 | /* Enable DA10 TX power saving */ | ||
849 | u1DA = read_nic_byte(dev, PHYPR); | ||
850 | write_nic_byte(dev, PHYPR, (u1DA | BIT2)); | ||
851 | |||
852 | /* POWER: */ | ||
853 | write_nic_word(dev, 0x360, 0x1000); | ||
854 | write_nic_word(dev, 0x362, 0x1000); | ||
855 | |||
856 | /* AFE. */ | ||
857 | write_nic_word(dev, 0x370, 0x0560); | ||
858 | write_nic_word(dev, 0x372, 0x0560); | ||
859 | write_nic_word(dev, 0x374, 0x0DA4); | ||
860 | write_nic_word(dev, 0x376, 0x0DA4); | ||
861 | write_nic_word(dev, 0x378, 0x0560); | ||
862 | write_nic_word(dev, 0x37A, 0x0560); | ||
863 | write_nic_word(dev, 0x37C, 0x00EC); | ||
864 | write_nic_word(dev, 0x37E, 0x00EC); /* +edward */ | ||
865 | write_nic_byte(dev, 0x24E, 0x01); | ||
866 | } | ||
867 | |||
868 | static u8 GetSupportedWirelessMode8185(struct net_device *dev) | ||
869 | { | ||
870 | return WIRELESS_MODE_B | WIRELESS_MODE_G; | ||
871 | } | ||
872 | |||
873 | static void | ||
874 | ActUpdateChannelAccessSetting(struct net_device *dev, | ||
875 | enum wireless_mode mode, | ||
876 | struct chnl_access_setting *chnl_access_setting) | ||
877 | { | ||
878 | AC_CODING eACI; | ||
879 | |||
880 | /* | ||
881 | * <RJ_TODO_8185B> | ||
882 | * TODO: We still don't know how to set up these registers, | ||
883 | * just follow WMAC to verify 8185B FPAG. | ||
884 | * | ||
885 | * <RJ_TODO_8185B> | ||
886 | * Jong said CWmin/CWmax register are not functional in 8185B, | ||
887 | * so we shall fill channel access realted register into AC | ||
888 | * parameter registers, | ||
889 | * even in nQBss. | ||
890 | */ | ||
891 | |||
892 | /* Suggested by Jong, 2005.12.08. */ | ||
893 | chnl_access_setting->sifs_timer = 0x22; | ||
894 | chnl_access_setting->difs_timer = 0x1C; /* 2006.06.02, by rcnjko. */ | ||
895 | chnl_access_setting->slot_time_timer = 9; /* 2006.06.02, by rcnjko. */ | ||
896 | /* | ||
897 | * Suggested by wcchu, it is the default value of EIFS register, | ||
898 | * 2005.12.08. | ||
899 | */ | ||
900 | chnl_access_setting->eifs_timer = 0x5B; | ||
901 | chnl_access_setting->cwmin_index = 3; /* 2006.06.02, by rcnjko. */ | ||
902 | chnl_access_setting->cwmax_index = 7; /* 2006.06.02, by rcnjko. */ | ||
903 | |||
904 | write_nic_byte(dev, SIFS, chnl_access_setting->sifs_timer); | ||
905 | /* | ||
906 | * Rewrited from directly use PlatformEFIOWrite1Byte(), | ||
907 | * by Annie, 2006-03-29. | ||
908 | */ | ||
909 | write_nic_byte(dev, SLOT, chnl_access_setting->slot_time_timer); | ||
910 | |||
911 | write_nic_byte(dev, EIFS, chnl_access_setting->eifs_timer); | ||
912 | |||
913 | /* | ||
914 | * <RJ_EXPR_QOS> Suggested by wcchu, it is the default value of EIFS | ||
915 | * register, 2005.12.08. | ||
916 | */ | ||
917 | write_nic_byte(dev, AckTimeOutReg, 0x5B); | ||
918 | |||
919 | for (eACI = 0; eACI < AC_MAX; eACI++) | ||
920 | write_nic_byte(dev, ACM_CONTROL, 0); | ||
921 | } | ||
922 | |||
923 | static void ActSetWirelessMode8185(struct net_device *dev, u8 btWirelessMode) | ||
924 | { | ||
925 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
926 | struct ieee80211_device *ieee = priv->ieee80211; | ||
927 | u8 btSupportedWirelessMode = GetSupportedWirelessMode8185(dev); | ||
928 | |||
929 | if ((btWirelessMode & btSupportedWirelessMode) == 0) { | ||
930 | /* | ||
931 | * Don't switch to unsupported wireless mode, 2006.02.15, | ||
932 | * by rcnjko. | ||
933 | */ | ||
934 | DMESGW("ActSetWirelessMode8185(): WirelessMode(%d) is not supported (%d)!\n", | ||
935 | btWirelessMode, btSupportedWirelessMode); | ||
936 | return; | ||
937 | } | ||
938 | |||
939 | /* 1. Assign wireless mode to switch if necessary. */ | ||
940 | if (btWirelessMode == WIRELESS_MODE_AUTO) { | ||
941 | if ((btSupportedWirelessMode & WIRELESS_MODE_A)) { | ||
942 | btWirelessMode = WIRELESS_MODE_A; | ||
943 | } else if (btSupportedWirelessMode & WIRELESS_MODE_G) { | ||
944 | btWirelessMode = WIRELESS_MODE_G; | ||
945 | |||
946 | } else if ((btSupportedWirelessMode & WIRELESS_MODE_B)) { | ||
947 | btWirelessMode = WIRELESS_MODE_B; | ||
948 | } else { | ||
949 | DMESGW("ActSetWirelessMode8185(): No valid wireless mode supported, btSupportedWirelessMode(%x)!!!\n", | ||
950 | btSupportedWirelessMode); | ||
951 | btWirelessMode = WIRELESS_MODE_B; | ||
952 | } | ||
953 | } | ||
954 | |||
955 | /* | ||
956 | * 2. Swtich band: RF or BB specific actions, | ||
957 | * for example, refresh tables in omc8255, or change initial gain if | ||
958 | * necessary. Nothing to do for Zebra to switch band. Update current | ||
959 | * wireless mode if we switch to specified band successfully. | ||
960 | */ | ||
961 | |||
962 | ieee->mode = (enum wireless_mode)btWirelessMode; | ||
963 | |||
964 | /* 3. Change related setting. */ | ||
965 | if (ieee->mode == WIRELESS_MODE_A) | ||
966 | DMESG("WIRELESS_MODE_A\n"); | ||
967 | else if (ieee->mode == WIRELESS_MODE_B) | ||
968 | DMESG("WIRELESS_MODE_B\n"); | ||
969 | else if (ieee->mode == WIRELESS_MODE_G) | ||
970 | DMESG("WIRELESS_MODE_G\n"); | ||
971 | |||
972 | ActUpdateChannelAccessSetting(dev, ieee->mode, | ||
973 | &priv->ChannelAccessSetting); | ||
974 | } | ||
975 | |||
976 | void rtl8185b_irq_enable(struct net_device *dev) | ||
977 | { | ||
978 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
979 | |||
980 | priv->irq_enabled = 1; | ||
981 | write_nic_dword(dev, IMR, priv->IntrMask); | ||
982 | } | ||
983 | |||
984 | static void MgntDisconnectIBSS(struct net_device *dev) | ||
985 | { | ||
986 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
987 | u8 i; | ||
988 | |||
989 | for (i = 0; i < 6; i++) | ||
990 | priv->ieee80211->current_network.bssid[i] = 0x55; | ||
991 | |||
992 | |||
993 | |||
994 | priv->ieee80211->state = IEEE80211_NOLINK; | ||
995 | /* | ||
996 | * Stop Beacon. | ||
997 | * | ||
998 | * Vista add a Adhoc profile, HW radio off until | ||
999 | * OID_DOT11_RESET_REQUEST Driver would set MSR=NO_LINK, | ||
1000 | * then HW Radio ON, MgntQueue Stuck. Because Bcn DMA isn't | ||
1001 | * complete, mgnt queue would stuck until Bcn packet send. | ||
1002 | * | ||
1003 | * Disable Beacon Queue Own bit, suggested by jong | ||
1004 | */ | ||
1005 | ieee80211_stop_send_beacons(priv->ieee80211); | ||
1006 | |||
1007 | priv->ieee80211->link_change(dev); | ||
1008 | notify_wx_assoc_event(priv->ieee80211); | ||
1009 | } | ||
1010 | |||
1011 | static void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn) | ||
1012 | { | ||
1013 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1014 | u8 i; | ||
1015 | |||
1016 | SendDisassociation(priv->ieee80211, asSta, asRsn); | ||
1017 | |||
1018 | if (memcmp(priv->ieee80211->current_network.bssid, asSta, 6) == 0) { | ||
1019 | /* ShuChen TODO: change media status. */ | ||
1020 | |||
1021 | for (i = 0; i < 6; i++) | ||
1022 | priv->ieee80211->current_network.bssid[i] = 0x22; | ||
1023 | |||
1024 | ieee80211_disassociate(priv->ieee80211); | ||
1025 | } | ||
1026 | } | ||
1027 | |||
1028 | static void MgntDisconnectAP(struct net_device *dev, u8 asRsn) | ||
1029 | { | ||
1030 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1031 | |||
1032 | /* | ||
1033 | * Commented out by rcnjko, 2005.01.27: | ||
1034 | * I move SecClearAllKeys() to MgntActSet_802_11_DISASSOCIATE(). | ||
1035 | * | ||
1036 | * 2004/09/15, kcwu, the key should be cleared, or the new | ||
1037 | * handshaking will not success | ||
1038 | * | ||
1039 | * In WPA WPA2 need to Clear all key ... because new key will set | ||
1040 | * after new handshaking. 2004.10.11, by rcnjko. | ||
1041 | */ | ||
1042 | MlmeDisassociateRequest(dev, priv->ieee80211->current_network.bssid, | ||
1043 | asRsn); | ||
1044 | |||
1045 | priv->ieee80211->state = IEEE80211_NOLINK; | ||
1046 | } | ||
1047 | |||
1048 | static bool MgntDisconnect(struct net_device *dev, u8 asRsn) | ||
1049 | { | ||
1050 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1051 | /* | ||
1052 | * Schedule an workitem to wake up for ps mode, 070109, by rcnjko. | ||
1053 | */ | ||
1054 | |||
1055 | if (IS_DOT11D_ENABLE(priv->ieee80211)) | ||
1056 | Dot11d_Reset(priv->ieee80211); | ||
1057 | /* In adhoc mode, update beacon frame. */ | ||
1058 | if (priv->ieee80211->state == IEEE80211_LINKED) { | ||
1059 | if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) | ||
1060 | MgntDisconnectIBSS(dev); | ||
1061 | |||
1062 | if (priv->ieee80211->iw_mode == IW_MODE_INFRA) { | ||
1063 | /* | ||
1064 | * We clear key here instead of MgntDisconnectAP() | ||
1065 | * because that MgntActSet_802_11_DISASSOCIATE() | ||
1066 | * is an interface called by OS, e.g. | ||
1067 | * OID_802_11_DISASSOCIATE in Windows while as | ||
1068 | * MgntDisconnectAP() is used to handle | ||
1069 | * disassociation related things to AP, e.g. send | ||
1070 | * Disassoc frame to AP. 2005.01.27, by rcnjko. | ||
1071 | */ | ||
1072 | MgntDisconnectAP(dev, asRsn); | ||
1073 | } | ||
1074 | /* Indicate Disconnect, 2005.02.23, by rcnjko. */ | ||
1075 | } | ||
1076 | return true; | ||
1077 | } | ||
1078 | /* | ||
1079 | * Description: | ||
1080 | * Chang RF Power State. | ||
1081 | * Note that, only MgntActSet_RF_State() is allowed to set | ||
1082 | * HW_VAR_RF_STATE. | ||
1083 | * | ||
1084 | * Assumption: | ||
1085 | * PASSIVE LEVEL. | ||
1086 | */ | ||
1087 | static bool SetRFPowerState(struct net_device *dev, | ||
1088 | enum rt_rf_power_state eRFPowerState) | ||
1089 | { | ||
1090 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1091 | bool bResult = false; | ||
1092 | |||
1093 | if (eRFPowerState == priv->eRFPowerState) | ||
1094 | return bResult; | ||
1095 | |||
1096 | bResult = SetZebraRFPowerState8185(dev, eRFPowerState); | ||
1097 | |||
1098 | return bResult; | ||
1099 | } | ||
1100 | |||
1101 | bool MgntActSet_RF_State(struct net_device *dev, enum rt_rf_power_state StateToSet, | ||
1102 | u32 ChangeSource) | ||
1103 | { | ||
1104 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1105 | bool bActionAllowed = false; | ||
1106 | bool bConnectBySSID = false; | ||
1107 | enum rt_rf_power_state rtState; | ||
1108 | u16 RFWaitCounter = 0; | ||
1109 | unsigned long flag; | ||
1110 | /* | ||
1111 | * Prevent the race condition of RF state change. By Bruce, | ||
1112 | * 2007-11-28. Only one thread can change the RF state at one time, | ||
1113 | * and others should wait to be executed. | ||
1114 | */ | ||
1115 | while (true) { | ||
1116 | spin_lock_irqsave(&priv->rf_ps_lock, flag); | ||
1117 | if (priv->RFChangeInProgress) { | ||
1118 | spin_unlock_irqrestore(&priv->rf_ps_lock, flag); | ||
1119 | /* Set RF after the previous action is done. */ | ||
1120 | while (priv->RFChangeInProgress) { | ||
1121 | RFWaitCounter++; | ||
1122 | udelay(1000); /* 1 ms */ | ||
1123 | |||
1124 | /* | ||
1125 | * Wait too long, return FALSE to avoid | ||
1126 | * to be stuck here. | ||
1127 | */ | ||
1128 | if (RFWaitCounter > 1000) { /* 1sec */ | ||
1129 | netdev_info(dev, "MgntActSet_RF_State(): Wait too long to set RF\n"); | ||
1130 | /* TODO: Reset RF state? */ | ||
1131 | return false; | ||
1132 | } | ||
1133 | } | ||
1134 | } else { | ||
1135 | priv->RFChangeInProgress = true; | ||
1136 | spin_unlock_irqrestore(&priv->rf_ps_lock, flag); | ||
1137 | break; | ||
1138 | } | ||
1139 | } | ||
1140 | rtState = priv->eRFPowerState; | ||
1141 | |||
1142 | switch (StateToSet) { | ||
1143 | case RF_ON: | ||
1144 | /* | ||
1145 | * Turn On RF no matter the IPS setting because we need to | ||
1146 | * update the RF state to Ndis under Vista, or the Windows | ||
1147 | * does not allow the driver to perform site survey any | ||
1148 | * more. By Bruce, 2007-10-02. | ||
1149 | */ | ||
1150 | priv->RfOffReason &= (~ChangeSource); | ||
1151 | |||
1152 | if (!priv->RfOffReason) { | ||
1153 | priv->RfOffReason = 0; | ||
1154 | bActionAllowed = true; | ||
1155 | |||
1156 | if (rtState == RF_OFF && | ||
1157 | ChangeSource >= RF_CHANGE_BY_HW) | ||
1158 | bConnectBySSID = true; | ||
1159 | } | ||
1160 | break; | ||
1161 | |||
1162 | case RF_OFF: | ||
1163 | /* 070125, rcnjko: we always keep connected in AP mode. */ | ||
1164 | |||
1165 | if (priv->RfOffReason > RF_CHANGE_BY_IPS) { | ||
1166 | /* | ||
1167 | * 060808, Annie: | ||
1168 | * Disconnect to current BSS when radio off. | ||
1169 | * Asked by QuanTa. | ||
1170 | * | ||
1171 | * Calling MgntDisconnect() instead of | ||
1172 | * MgntActSet_802_11_DISASSOCIATE(), because | ||
1173 | * we do NOT need to set ssid to dummy ones. | ||
1174 | */ | ||
1175 | MgntDisconnect(dev, disas_lv_ss); | ||
1176 | /* | ||
1177 | * Clear content of bssDesc[] and bssDesc4Query[] | ||
1178 | * to avoid reporting old bss to UI. | ||
1179 | */ | ||
1180 | } | ||
1181 | |||
1182 | priv->RfOffReason |= ChangeSource; | ||
1183 | bActionAllowed = true; | ||
1184 | break; | ||
1185 | case RF_SLEEP: | ||
1186 | priv->RfOffReason |= ChangeSource; | ||
1187 | bActionAllowed = true; | ||
1188 | break; | ||
1189 | default: | ||
1190 | break; | ||
1191 | } | ||
1192 | |||
1193 | if (bActionAllowed) { | ||
1194 | /* Config HW to the specified mode. */ | ||
1195 | SetRFPowerState(dev, StateToSet); | ||
1196 | } | ||
1197 | |||
1198 | /* Release RF spinlock */ | ||
1199 | spin_lock_irqsave(&priv->rf_ps_lock, flag); | ||
1200 | priv->RFChangeInProgress = false; | ||
1201 | spin_unlock_irqrestore(&priv->rf_ps_lock, flag); | ||
1202 | return bActionAllowed; | ||
1203 | } | ||
1204 | |||
1205 | static void InactivePowerSave(struct net_device *dev) | ||
1206 | { | ||
1207 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1208 | /* | ||
1209 | * This flag "bSwRfProcessing", indicates the status of IPS | ||
1210 | * procedure, should be set if the IPS workitem is really | ||
1211 | * scheduled. The old code, sets this flag before scheduling the | ||
1212 | * IPS workitem and however, at the same time the previous IPS | ||
1213 | * workitem did not end yet, fails to schedule the current | ||
1214 | * workitem. Thus, bSwRfProcessing blocks the IPS procedure of | ||
1215 | * switching RF. | ||
1216 | */ | ||
1217 | priv->bSwRfProcessing = true; | ||
1218 | |||
1219 | MgntActSet_RF_State(dev, priv->eInactivePowerState, RF_CHANGE_BY_IPS); | ||
1220 | |||
1221 | /* | ||
1222 | * To solve CAM values miss in RF OFF, rewrite CAM values after | ||
1223 | * RF ON. By Bruce, 2007-09-20. | ||
1224 | */ | ||
1225 | |||
1226 | priv->bSwRfProcessing = false; | ||
1227 | } | ||
1228 | |||
1229 | /* | ||
1230 | * Description: | ||
1231 | * Enter the inactive power save mode. RF will be off | ||
1232 | */ | ||
1233 | void IPSEnter(struct net_device *dev) | ||
1234 | { | ||
1235 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1236 | enum rt_rf_power_state rtState; | ||
1237 | if (priv->bInactivePs) { | ||
1238 | rtState = priv->eRFPowerState; | ||
1239 | |||
1240 | /* | ||
1241 | * Do not enter IPS in the following conditions: | ||
1242 | * (1) RF is already OFF or | ||
1243 | * Sleep (2) bSwRfProcessing (indicates the IPS is still | ||
1244 | * under going) (3) Connected (only disconnected can | ||
1245 | * trigger IPS)(4) IBSS (send Beacon) | ||
1246 | * (5) AP mode (send Beacon) | ||
1247 | */ | ||
1248 | if (rtState == RF_ON && !priv->bSwRfProcessing | ||
1249 | && (priv->ieee80211->state != IEEE80211_LINKED)) { | ||
1250 | priv->eInactivePowerState = RF_OFF; | ||
1251 | InactivePowerSave(dev); | ||
1252 | } | ||
1253 | } | ||
1254 | } | ||
1255 | void IPSLeave(struct net_device *dev) | ||
1256 | { | ||
1257 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1258 | enum rt_rf_power_state rtState; | ||
1259 | if (priv->bInactivePs) { | ||
1260 | rtState = priv->eRFPowerState; | ||
1261 | if ((rtState == RF_OFF || rtState == RF_SLEEP) && | ||
1262 | !priv->bSwRfProcessing | ||
1263 | && priv->RfOffReason <= RF_CHANGE_BY_IPS) { | ||
1264 | priv->eInactivePowerState = RF_ON; | ||
1265 | InactivePowerSave(dev); | ||
1266 | } | ||
1267 | } | ||
1268 | } | ||
1269 | |||
1270 | void rtl8185b_adapter_start(struct net_device *dev) | ||
1271 | { | ||
1272 | struct r8180_priv *priv = ieee80211_priv(dev); | ||
1273 | struct ieee80211_device *ieee = priv->ieee80211; | ||
1274 | |||
1275 | u8 SupportedWirelessMode; | ||
1276 | u8 InitWirelessMode; | ||
1277 | u8 bInvalidWirelessMode = 0; | ||
1278 | u8 tmpu8; | ||
1279 | u8 btCR9346; | ||
1280 | u8 TmpU1b; | ||
1281 | u8 btPSR; | ||
1282 | |||
1283 | write_nic_byte(dev, 0x24e, (BIT5|BIT6|BIT0)); | ||
1284 | rtl8180_reset(dev); | ||
1285 | |||
1286 | priv->dma_poll_mask = 0; | ||
1287 | priv->dma_poll_stop_mask = 0; | ||
1288 | |||
1289 | HwConfigureRTL8185(dev); | ||
1290 | write_nic_dword(dev, MAC0, ((u32 *)dev->dev_addr)[0]); | ||
1291 | write_nic_word(dev, MAC4, ((u32 *)dev->dev_addr)[1] & 0xffff); | ||
1292 | /* default network type to 'No Link' */ | ||
1293 | write_nic_byte(dev, MSR, read_nic_byte(dev, MSR) & 0xf3); | ||
1294 | write_nic_word(dev, BcnItv, 100); | ||
1295 | write_nic_word(dev, AtimWnd, 2); | ||
1296 | PlatformIOWrite2Byte(dev, FEMR, 0xFFFF); | ||
1297 | write_nic_byte(dev, WPA_CONFIG, 0); | ||
1298 | MacConfig_85BASIC(dev); | ||
1299 | /* Override the RFSW_CTRL (MAC offset 0x272-0x273), 2006.06.07, | ||
1300 | * by rcnjko. | ||
1301 | */ | ||
1302 | /* BT_DEMO_BOARD type */ | ||
1303 | PlatformIOWrite2Byte(dev, RFSW_CTRL, 0x569a); | ||
1304 | |||
1305 | /* | ||
1306 | *--------------------------------------------------------------------- | ||
1307 | * Set up PHY related. | ||
1308 | *--------------------------------------------------------------------- | ||
1309 | */ | ||
1310 | /* Enable Config3.PARAM_En to revise AnaaParm. */ | ||
1311 | write_nic_byte(dev, CR9346, 0xc0); /* enable config register write */ | ||
1312 | tmpu8 = read_nic_byte(dev, CONFIG3); | ||
1313 | write_nic_byte(dev, CONFIG3, (tmpu8 | CONFIG3_PARM_En)); | ||
1314 | /* Turn on Analog power. */ | ||
1315 | /* Asked for by William, otherwise, MAC 3-wire can't work, | ||
1316 | * 2006.06.27, by rcnjko. | ||
1317 | */ | ||
1318 | write_nic_dword(dev, ANAPARAM2, ANAPARM2_ASIC_ON); | ||
1319 | write_nic_dword(dev, ANAPARAM, ANAPARM_ASIC_ON); | ||
1320 | write_nic_word(dev, ANAPARAM3, 0x0010); | ||
1321 | |||
1322 | write_nic_byte(dev, CONFIG3, tmpu8); | ||
1323 | write_nic_byte(dev, CR9346, 0x00); | ||
1324 | /* enable EEM0 and EEM1 in 9346CR */ | ||
1325 | btCR9346 = read_nic_byte(dev, CR9346); | ||
1326 | write_nic_byte(dev, CR9346, (btCR9346 | 0xC0)); | ||
1327 | |||
1328 | /* B cut use LED1 to control HW RF on/off */ | ||
1329 | TmpU1b = read_nic_byte(dev, CONFIG5); | ||
1330 | TmpU1b = TmpU1b & ~BIT3; | ||
1331 | write_nic_byte(dev, CONFIG5, TmpU1b); | ||
1332 | |||
1333 | /* disable EEM0 and EEM1 in 9346CR */ | ||
1334 | btCR9346 &= ~(0xC0); | ||
1335 | write_nic_byte(dev, CR9346, btCR9346); | ||
1336 | |||
1337 | /* Enable Led (suggested by Jong) */ | ||
1338 | /* B-cut RF Radio on/off 5e[3]=0 */ | ||
1339 | btPSR = read_nic_byte(dev, PSR); | ||
1340 | write_nic_byte(dev, PSR, (btPSR | BIT3)); | ||
1341 | /* setup initial timing for RFE. */ | ||
1342 | write_nic_word(dev, RFPinsOutput, 0x0480); | ||
1343 | SetOutputEnableOfRfPins(dev); | ||
1344 | write_nic_word(dev, RFPinsSelect, 0x2488); | ||
1345 | |||
1346 | /* PHY config. */ | ||
1347 | PhyConfig8185(dev); | ||
1348 | |||
1349 | /* | ||
1350 | * We assume RegWirelessMode has already been initialized before, | ||
1351 | * however, we has to validate the wireless mode here and provide a | ||
1352 | * reasonable initialized value if necessary. 2005.01.13, | ||
1353 | * by rcnjko. | ||
1354 | */ | ||
1355 | SupportedWirelessMode = GetSupportedWirelessMode8185(dev); | ||
1356 | if ((ieee->mode != WIRELESS_MODE_B) && | ||
1357 | (ieee->mode != WIRELESS_MODE_G) && | ||
1358 | (ieee->mode != WIRELESS_MODE_A) && | ||
1359 | (ieee->mode != WIRELESS_MODE_AUTO)) { | ||
1360 | /* It should be one of B, G, A, or AUTO. */ | ||
1361 | bInvalidWirelessMode = 1; | ||
1362 | } else { | ||
1363 | /* One of B, G, A, or AUTO. */ | ||
1364 | /* Check if the wireless mode is supported by RF. */ | ||
1365 | if ((ieee->mode != WIRELESS_MODE_AUTO) && | ||
1366 | (ieee->mode & SupportedWirelessMode) == 0) { | ||
1367 | bInvalidWirelessMode = 1; | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | if (bInvalidWirelessMode || ieee->mode == WIRELESS_MODE_AUTO) { | ||
1372 | /* Auto or other invalid value. */ | ||
1373 | /* Assigne a wireless mode to initialize. */ | ||
1374 | if ((SupportedWirelessMode & WIRELESS_MODE_A)) { | ||
1375 | InitWirelessMode = WIRELESS_MODE_A; | ||
1376 | } else if ((SupportedWirelessMode & WIRELESS_MODE_G)) { | ||
1377 | InitWirelessMode = WIRELESS_MODE_G; | ||
1378 | } else if ((SupportedWirelessMode & WIRELESS_MODE_B)) { | ||
1379 | InitWirelessMode = WIRELESS_MODE_B; | ||
1380 | } else { | ||
1381 | DMESGW("InitializeAdapter8185(): No valid wireless mode supported, SupportedWirelessMode(%x)!!!\n", | ||
1382 | SupportedWirelessMode); | ||
1383 | InitWirelessMode = WIRELESS_MODE_B; | ||
1384 | } | ||
1385 | |||
1386 | /* Initialize RegWirelessMode if it is not a valid one. */ | ||
1387 | if (bInvalidWirelessMode) | ||
1388 | ieee->mode = (enum wireless_mode)InitWirelessMode; | ||
1389 | |||
1390 | } else { | ||
1391 | /* One of B, G, A. */ | ||
1392 | InitWirelessMode = ieee->mode; | ||
1393 | } | ||
1394 | priv->eRFPowerState = RF_OFF; | ||
1395 | priv->RfOffReason = 0; | ||
1396 | { | ||
1397 | MgntActSet_RF_State(dev, RF_ON, 0); | ||
1398 | } | ||
1399 | /* | ||
1400 | * If inactive power mode is enabled, disable rf while in | ||
1401 | * disconnected state. | ||
1402 | */ | ||
1403 | if (priv->bInactivePs) | ||
1404 | MgntActSet_RF_State(dev , RF_OFF, RF_CHANGE_BY_IPS); | ||
1405 | |||
1406 | ActSetWirelessMode8185(dev, (u8)(InitWirelessMode)); | ||
1407 | |||
1408 | /* ----------------------------------------------------------------- */ | ||
1409 | |||
1410 | rtl8185b_irq_enable(dev); | ||
1411 | |||
1412 | netif_start_queue(dev); | ||
1413 | } | ||
1414 | |||
1415 | void rtl8185b_rx_enable(struct net_device *dev) | ||
1416 | { | ||
1417 | u8 cmd; | ||
1418 | /* for now we accept data, management & ctl frame*/ | ||
1419 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1420 | |||
1421 | |||
1422 | if (dev->flags & IFF_PROMISC) | ||
1423 | DMESG("NIC in promisc mode"); | ||
1424 | |||
1425 | if (priv->ieee80211->iw_mode == IW_MODE_MONITOR || dev->flags & | ||
1426 | IFF_PROMISC) { | ||
1427 | priv->ReceiveConfig = priv->ReceiveConfig & (~RCR_APM); | ||
1428 | priv->ReceiveConfig = priv->ReceiveConfig | RCR_AAP; | ||
1429 | } | ||
1430 | |||
1431 | if (priv->ieee80211->iw_mode == IW_MODE_MONITOR) | ||
1432 | priv->ReceiveConfig = priv->ReceiveConfig | RCR_ACF | | ||
1433 | RCR_APWRMGT | RCR_AICV; | ||
1434 | |||
1435 | |||
1436 | if (priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) | ||
1437 | priv->ReceiveConfig = priv->ReceiveConfig | RCR_ACRC32; | ||
1438 | |||
1439 | write_nic_dword(dev, RCR, priv->ReceiveConfig); | ||
1440 | |||
1441 | fix_rx_fifo(dev); | ||
1442 | |||
1443 | cmd = read_nic_byte(dev, CMD); | ||
1444 | write_nic_byte(dev, CMD, cmd | (1<<CMD_RX_ENABLE_SHIFT)); | ||
1445 | |||
1446 | } | ||
1447 | |||
1448 | void rtl8185b_tx_enable(struct net_device *dev) | ||
1449 | { | ||
1450 | u8 cmd; | ||
1451 | u8 byte; | ||
1452 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | ||
1453 | |||
1454 | write_nic_dword(dev, TCR, priv->TransmitConfig); | ||
1455 | byte = read_nic_byte(dev, MSR); | ||
1456 | byte |= MSR_LINK_ENEDCA; | ||
1457 | write_nic_byte(dev, MSR, byte); | ||
1458 | |||
1459 | fix_tx_fifo(dev); | ||
1460 | |||
1461 | cmd = read_nic_byte(dev, CMD); | ||
1462 | write_nic_byte(dev, CMD, cmd | (1<<CMD_TX_ENABLE_SHIFT)); | ||
1463 | } | ||
1464 | |||
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 636ec553ae83..e305d43ebd06 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c | |||
@@ -545,20 +545,18 @@ static struct recv_frame *decryptor(struct adapter *padapter, | |||
545 | static struct recv_frame *portctrl(struct adapter *adapter, | 545 | static struct recv_frame *portctrl(struct adapter *adapter, |
546 | struct recv_frame *precv_frame) | 546 | struct recv_frame *precv_frame) |
547 | { | 547 | { |
548 | u8 *psta_addr = NULL, *ptr; | 548 | u8 *psta_addr, *ptr; |
549 | uint auth_alg; | 549 | uint auth_alg; |
550 | struct recv_frame *pfhdr; | 550 | struct recv_frame *pfhdr; |
551 | struct sta_info *psta; | 551 | struct sta_info *psta; |
552 | struct sta_priv *pstapriv; | 552 | struct sta_priv *pstapriv; |
553 | struct recv_frame *prtnframe; | 553 | struct recv_frame *prtnframe; |
554 | u16 ether_type = 0; | 554 | u16 ether_type; |
555 | u16 eapol_type = 0x888e;/* for Funia BD's WPA issue */ | 555 | u16 eapol_type = 0x888e;/* for Funia BD's WPA issue */ |
556 | struct rx_pkt_attrib *pattrib; | 556 | struct rx_pkt_attrib *pattrib; |
557 | __be16 be_tmp; | ||
558 | 557 | ||
559 | 558 | ||
560 | pstapriv = &adapter->stapriv; | 559 | pstapriv = &adapter->stapriv; |
561 | psta = rtw_get_stainfo(pstapriv, psta_addr); | ||
562 | 560 | ||
563 | auth_alg = adapter->securitypriv.dot11AuthAlgrthm; | 561 | auth_alg = adapter->securitypriv.dot11AuthAlgrthm; |
564 | 562 | ||
@@ -566,24 +564,23 @@ static struct recv_frame *portctrl(struct adapter *adapter, | |||
566 | pfhdr = precv_frame; | 564 | pfhdr = precv_frame; |
567 | pattrib = &pfhdr->attrib; | 565 | pattrib = &pfhdr->attrib; |
568 | psta_addr = pattrib->ta; | 566 | psta_addr = pattrib->ta; |
567 | psta = rtw_get_stainfo(pstapriv, psta_addr); | ||
569 | 568 | ||
570 | prtnframe = NULL; | 569 | prtnframe = NULL; |
571 | 570 | ||
572 | RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm=%d\n", adapter->securitypriv.dot11AuthAlgrthm)); | 571 | RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm=%d\n", adapter->securitypriv.dot11AuthAlgrthm)); |
573 | 572 | ||
574 | if (auth_alg == 2) { | 573 | if (auth_alg == 2) { |
574 | /* get ether_type */ | ||
575 | ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; | ||
576 | memcpy(ðer_type, ptr, 2); | ||
577 | ether_type = ntohs((unsigned short)ether_type); | ||
578 | |||
575 | if ((psta != NULL) && (psta->ieee8021x_blocked)) { | 579 | if ((psta != NULL) && (psta->ieee8021x_blocked)) { |
576 | /* blocked */ | 580 | /* blocked */ |
577 | /* only accept EAPOL frame */ | 581 | /* only accept EAPOL frame */ |
578 | RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:psta->ieee8021x_blocked==1\n")); | 582 | RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:psta->ieee8021x_blocked==1\n")); |
579 | 583 | ||
580 | prtnframe = precv_frame; | ||
581 | |||
582 | /* get ether_type */ | ||
583 | ptr = ptr+pfhdr->attrib.hdrlen+pfhdr->attrib.iv_len+LLC_HEADER_SIZE; | ||
584 | memcpy(&be_tmp, ptr, 2); | ||
585 | ether_type = ntohs(be_tmp); | ||
586 | |||
587 | if (ether_type == eapol_type) { | 584 | if (ether_type == eapol_type) { |
588 | prtnframe = precv_frame; | 585 | prtnframe = precv_frame; |
589 | } else { | 586 | } else { |
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index 2636e7f3dbb8..cf30a08912d1 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | |||
@@ -359,7 +359,7 @@ static char *translate_scan(struct adapter *padapter, | |||
359 | if (wpa_len > 0) { | 359 | if (wpa_len > 0) { |
360 | p = buf; | 360 | p = buf; |
361 | _rtw_memset(buf, 0, MAX_WPA_IE_LEN); | 361 | _rtw_memset(buf, 0, MAX_WPA_IE_LEN); |
362 | p += sprintf(p, "wpa_ie ="); | 362 | p += sprintf(p, "wpa_ie="); |
363 | for (i = 0; i < wpa_len; i++) | 363 | for (i = 0; i < wpa_len; i++) |
364 | p += sprintf(p, "%02x", wpa_ie[i]); | 364 | p += sprintf(p, "%02x", wpa_ie[i]); |
365 | 365 | ||
@@ -376,7 +376,7 @@ static char *translate_scan(struct adapter *padapter, | |||
376 | if (rsn_len > 0) { | 376 | if (rsn_len > 0) { |
377 | p = buf; | 377 | p = buf; |
378 | _rtw_memset(buf, 0, MAX_WPA_IE_LEN); | 378 | _rtw_memset(buf, 0, MAX_WPA_IE_LEN); |
379 | p += sprintf(p, "rsn_ie ="); | 379 | p += sprintf(p, "rsn_ie="); |
380 | for (i = 0; i < rsn_len; i++) | 380 | for (i = 0; i < rsn_len; i++) |
381 | p += sprintf(p, "%02x", rsn_ie[i]); | 381 | p += sprintf(p, "%02x", rsn_ie[i]); |
382 | _rtw_memset(&iwe, 0, sizeof(iwe)); | 382 | _rtw_memset(&iwe, 0, sizeof(iwe)); |
@@ -2899,7 +2899,7 @@ static int rtw_p2p_get_status(struct net_device *dev, | |||
2899 | /* Commented by Albert 2010/10/12 */ | 2899 | /* Commented by Albert 2010/10/12 */ |
2900 | /* Because of the output size limitation, I had removed the "Role" information. */ | 2900 | /* Because of the output size limitation, I had removed the "Role" information. */ |
2901 | /* About the "Role" information, we will use the new private IOCTL to get the "Role" information. */ | 2901 | /* About the "Role" information, we will use the new private IOCTL to get the "Role" information. */ |
2902 | sprintf(extra, "\n\nStatus =%.2d\n", rtw_p2p_state(pwdinfo)); | 2902 | sprintf(extra, "\n\nStatus=%.2d\n", rtw_p2p_state(pwdinfo)); |
2903 | wrqu->data.length = strlen(extra); | 2903 | wrqu->data.length = strlen(extra); |
2904 | 2904 | ||
2905 | return ret; | 2905 | return ret; |
@@ -2918,7 +2918,7 @@ static int rtw_p2p_get_req_cm(struct net_device *dev, | |||
2918 | struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); | 2918 | struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); |
2919 | struct wifidirect_info *pwdinfo = &(padapter->wdinfo); | 2919 | struct wifidirect_info *pwdinfo = &(padapter->wdinfo); |
2920 | 2920 | ||
2921 | sprintf(extra, "\n\nCM =%s\n", pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req); | 2921 | sprintf(extra, "\n\nCM=%s\n", pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req); |
2922 | wrqu->data.length = strlen(extra); | 2922 | wrqu->data.length = strlen(extra); |
2923 | return ret; | 2923 | return ret; |
2924 | } | 2924 | } |
@@ -2935,7 +2935,7 @@ static int rtw_p2p_get_role(struct net_device *dev, | |||
2935 | pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], pwdinfo->p2p_peer_interface_addr[2], | 2935 | pwdinfo->p2p_peer_interface_addr[0], pwdinfo->p2p_peer_interface_addr[1], pwdinfo->p2p_peer_interface_addr[2], |
2936 | pwdinfo->p2p_peer_interface_addr[3], pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5]); | 2936 | pwdinfo->p2p_peer_interface_addr[3], pwdinfo->p2p_peer_interface_addr[4], pwdinfo->p2p_peer_interface_addr[5]); |
2937 | 2937 | ||
2938 | sprintf(extra, "\n\nRole =%.2d\n", rtw_p2p_role(pwdinfo)); | 2938 | sprintf(extra, "\n\nRole=%.2d\n", rtw_p2p_role(pwdinfo)); |
2939 | wrqu->data.length = strlen(extra); | 2939 | wrqu->data.length = strlen(extra); |
2940 | return ret; | 2940 | return ret; |
2941 | } | 2941 | } |
@@ -3022,7 +3022,7 @@ static int rtw_p2p_get_op_ch(struct net_device *dev, | |||
3022 | 3022 | ||
3023 | DBG_88E("[%s] Op_ch = %02x\n", __func__, pwdinfo->operating_channel); | 3023 | DBG_88E("[%s] Op_ch = %02x\n", __func__, pwdinfo->operating_channel); |
3024 | 3024 | ||
3025 | sprintf(extra, "\n\nOp_ch =%.2d\n", pwdinfo->operating_channel); | 3025 | sprintf(extra, "\n\nOp_ch=%.2d\n", pwdinfo->operating_channel); |
3026 | wrqu->data.length = strlen(extra); | 3026 | wrqu->data.length = strlen(extra); |
3027 | return ret; | 3027 | return ret; |
3028 | } | 3028 | } |
@@ -3043,7 +3043,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, | |||
3043 | u8 blnMatch = 0; | 3043 | u8 blnMatch = 0; |
3044 | u16 attr_content = 0; | 3044 | u16 attr_content = 0; |
3045 | uint attr_contentlen = 0; | 3045 | uint attr_contentlen = 0; |
3046 | /* 6 is the string "wpsCM =", 17 is the MAC addr, we have to clear it at wrqu->data.pointer */ | 3046 | /* 6 is the string "wpsCM=", 17 is the MAC addr, we have to clear it at wrqu->data.pointer */ |
3047 | u8 attr_content_str[6 + 17] = {0x00}; | 3047 | u8 attr_content_str[6 + 17] = {0x00}; |
3048 | 3048 | ||
3049 | /* Commented by Albert 20110727 */ | 3049 | /* Commented by Albert 20110727 */ |
@@ -3079,7 +3079,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, | |||
3079 | rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8 *) &be_tmp, &attr_contentlen); | 3079 | rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8 *) &be_tmp, &attr_contentlen); |
3080 | if (attr_contentlen) { | 3080 | if (attr_contentlen) { |
3081 | attr_content = be16_to_cpu(be_tmp); | 3081 | attr_content = be16_to_cpu(be_tmp); |
3082 | sprintf(attr_content_str, "\n\nM =%.4d", attr_content); | 3082 | sprintf(attr_content_str, "\n\nM=%.4d", attr_content); |
3083 | blnMatch = 1; | 3083 | blnMatch = 1; |
3084 | } | 3084 | } |
3085 | } | 3085 | } |
@@ -3091,7 +3091,7 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, | |||
3091 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3091 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
3092 | 3092 | ||
3093 | if (!blnMatch) | 3093 | if (!blnMatch) |
3094 | sprintf(attr_content_str, "\n\nM = 0000"); | 3094 | sprintf(attr_content_str, "\n\nM=0000"); |
3095 | 3095 | ||
3096 | if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) | 3096 | if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) |
3097 | return -EFAULT; | 3097 | return -EFAULT; |
@@ -3172,9 +3172,9 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, | |||
3172 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3172 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
3173 | 3173 | ||
3174 | if (!blnMatch) | 3174 | if (!blnMatch) |
3175 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add = NULL"); | 3175 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add=NULL"); |
3176 | else | 3176 | else |
3177 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", | 3177 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add=%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", |
3178 | attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]); | 3178 | attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]); |
3179 | 3179 | ||
3180 | if (copy_to_user(wrqu->data.pointer, go_devadd_str, sizeof(go_devadd_str))) | 3180 | if (copy_to_user(wrqu->data.pointer, go_devadd_str, sizeof(go_devadd_str))) |
@@ -3198,7 +3198,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, | |||
3198 | u8 blnMatch = 0; | 3198 | u8 blnMatch = 0; |
3199 | u8 dev_type[8] = {0x00}; | 3199 | u8 dev_type[8] = {0x00}; |
3200 | uint dev_type_len = 0; | 3200 | uint dev_type_len = 0; |
3201 | u8 dev_type_str[17 + 9] = {0x00}; /* +9 is for the str "dev_type =", we have to clear it at wrqu->data.pointer */ | 3201 | u8 dev_type_str[17 + 9] = {0x00}; /* +9 is for the str "dev_type=", we have to clear it at wrqu->data.pointer */ |
3202 | 3202 | ||
3203 | /* Commented by Albert 20121209 */ | 3203 | /* Commented by Albert 20121209 */ |
3204 | /* The input data is the MAC address which the application wants to know its device type. */ | 3204 | /* The input data is the MAC address which the application wants to know its device type. */ |
@@ -3239,7 +3239,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, | |||
3239 | 3239 | ||
3240 | memcpy(&be_tmp, dev_type, 2); | 3240 | memcpy(&be_tmp, dev_type, 2); |
3241 | type = be16_to_cpu(be_tmp); | 3241 | type = be16_to_cpu(be_tmp); |
3242 | sprintf(dev_type_str, "\n\nN =%.2d", type); | 3242 | sprintf(dev_type_str, "\n\nN=%.2d", type); |
3243 | blnMatch = 1; | 3243 | blnMatch = 1; |
3244 | } | 3244 | } |
3245 | } | 3245 | } |
@@ -3252,7 +3252,7 @@ static int rtw_p2p_get_device_type(struct net_device *dev, | |||
3252 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3252 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
3253 | 3253 | ||
3254 | if (!blnMatch) | 3254 | if (!blnMatch) |
3255 | sprintf(dev_type_str, "\n\nN = 00"); | 3255 | sprintf(dev_type_str, "\n\nN=00"); |
3256 | 3256 | ||
3257 | if (copy_to_user(wrqu->data.pointer, dev_type_str, 9 + 17)) { | 3257 | if (copy_to_user(wrqu->data.pointer, dev_type_str, 9 + 17)) { |
3258 | return -EFAULT; | 3258 | return -EFAULT; |
@@ -3277,7 +3277,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, | |||
3277 | u8 blnMatch = 0; | 3277 | u8 blnMatch = 0; |
3278 | u8 dev_name[WPS_MAX_DEVICE_NAME_LEN] = {0x00}; | 3278 | u8 dev_name[WPS_MAX_DEVICE_NAME_LEN] = {0x00}; |
3279 | uint dev_len = 0; | 3279 | uint dev_len = 0; |
3280 | u8 dev_name_str[WPS_MAX_DEVICE_NAME_LEN + 5] = {0x00}; /* +5 is for the str "devN =", we have to clear it at wrqu->data.pointer */ | 3280 | u8 dev_name_str[WPS_MAX_DEVICE_NAME_LEN + 5] = {0x00}; /* +5 is for the str "devN=", we have to clear it at wrqu->data.pointer */ |
3281 | 3281 | ||
3282 | /* Commented by Albert 20121225 */ | 3282 | /* Commented by Albert 20121225 */ |
3283 | /* The input data is the MAC address which the application wants to know its device name. */ | 3283 | /* The input data is the MAC address which the application wants to know its device name. */ |
@@ -3310,7 +3310,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, | |||
3310 | if (wpsie) { | 3310 | if (wpsie) { |
3311 | rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_DEVICE_NAME, dev_name, &dev_len); | 3311 | rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_DEVICE_NAME, dev_name, &dev_len); |
3312 | if (dev_len) { | 3312 | if (dev_len) { |
3313 | sprintf(dev_name_str, "\n\nN =%s", dev_name); | 3313 | sprintf(dev_name_str, "\n\nN=%s", dev_name); |
3314 | blnMatch = 1; | 3314 | blnMatch = 1; |
3315 | } | 3315 | } |
3316 | } | 3316 | } |
@@ -3323,7 +3323,7 @@ static int rtw_p2p_get_device_name(struct net_device *dev, | |||
3323 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3323 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
3324 | 3324 | ||
3325 | if (!blnMatch) | 3325 | if (!blnMatch) |
3326 | sprintf(dev_name_str, "\n\nN = 0000"); | 3326 | sprintf(dev_name_str, "\n\nN=0000"); |
3327 | 3327 | ||
3328 | if (copy_to_user(wrqu->data.pointer, dev_name_str, 5 + ((dev_len > 17) ? dev_len : 17))) | 3328 | if (copy_to_user(wrqu->data.pointer, dev_name_str, 5 + ((dev_len > 17) ? dev_len : 17))) |
3329 | return -EFAULT; | 3329 | return -EFAULT; |
@@ -3349,7 +3349,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, | |||
3349 | u8 attr_content[2] = {0x00}; | 3349 | u8 attr_content[2] = {0x00}; |
3350 | 3350 | ||
3351 | u8 inv_proc_str[17 + 8] = {0x00}; | 3351 | u8 inv_proc_str[17 + 8] = {0x00}; |
3352 | /* +8 is for the str "InvProc =", we have to clear it at wrqu->data.pointer */ | 3352 | /* +8 is for the str "InvProc=", we have to clear it at wrqu->data.pointer */ |
3353 | 3353 | ||
3354 | /* Commented by Ouden 20121226 */ | 3354 | /* Commented by Ouden 20121226 */ |
3355 | /* The application wants to know P2P initiation procedure is supported or not. */ | 3355 | /* The application wants to know P2P initiation procedure is supported or not. */ |
@@ -3397,12 +3397,12 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, | |||
3397 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3397 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
3398 | 3398 | ||
3399 | if (!blnMatch) { | 3399 | if (!blnMatch) { |
3400 | sprintf(inv_proc_str, "\nIP =-1"); | 3400 | sprintf(inv_proc_str, "\nIP=-1"); |
3401 | } else { | 3401 | } else { |
3402 | if (attr_content[0] & 0x20) | 3402 | if (attr_content[0] & 0x20) |
3403 | sprintf(inv_proc_str, "\nIP = 1"); | 3403 | sprintf(inv_proc_str, "\nIP=1"); |
3404 | else | 3404 | else |
3405 | sprintf(inv_proc_str, "\nIP = 0"); | 3405 | sprintf(inv_proc_str, "\nIP=0"); |
3406 | } | 3406 | } |
3407 | if (copy_to_user(wrqu->data.pointer, inv_proc_str, 8 + 17)) | 3407 | if (copy_to_user(wrqu->data.pointer, inv_proc_str, 8 + 17)) |
3408 | return -EFAULT; | 3408 | return -EFAULT; |
@@ -3512,7 +3512,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, | |||
3512 | /* The input data contains two informations. */ | 3512 | /* The input data contains two informations. */ |
3513 | /* 1. First information is the P2P device address which you want to send to. */ | 3513 | /* 1. First information is the P2P device address which you want to send to. */ |
3514 | /* 2. Second information is the group id which combines with GO's mac address, space and GO's ssid. */ | 3514 | /* 2. Second information is the group id which combines with GO's mac address, space and GO's ssid. */ |
3515 | /* Command line sample: iwpriv wlan0 p2p_set invite ="00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy" */ | 3515 | /* Command line sample: iwpriv wlan0 p2p_set invite="00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy" */ |
3516 | /* Format: 00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy */ | 3516 | /* Format: 00:11:22:33:44:55 00:E0:4C:00:00:05 DIRECT-xy */ |
3517 | 3517 | ||
3518 | DBG_88E("[%s] data = %s\n", __func__, extra); | 3518 | DBG_88E("[%s] data = %s\n", __func__, extra); |
@@ -3805,48 +3805,48 @@ static int rtw_p2p_set(struct net_device *dev, | |||
3805 | 3805 | ||
3806 | #ifdef CONFIG_88EU_P2P | 3806 | #ifdef CONFIG_88EU_P2P |
3807 | DBG_88E("[%s] extra = %s\n", __func__, extra); | 3807 | DBG_88E("[%s] extra = %s\n", __func__, extra); |
3808 | if (!memcmp(extra, "enable =", 7)) { | 3808 | if (!memcmp(extra, "enable=", 7)) { |
3809 | rtw_wext_p2p_enable(dev, info, wrqu, &extra[7]); | 3809 | rtw_wext_p2p_enable(dev, info, wrqu, &extra[7]); |
3810 | } else if (!memcmp(extra, "setDN =", 6)) { | 3810 | } else if (!memcmp(extra, "setDN=", 6)) { |
3811 | wrqu->data.length -= 6; | 3811 | wrqu->data.length -= 6; |
3812 | rtw_p2p_setDN(dev, info, wrqu, &extra[6]); | 3812 | rtw_p2p_setDN(dev, info, wrqu, &extra[6]); |
3813 | } else if (!memcmp(extra, "profilefound =", 13)) { | 3813 | } else if (!memcmp(extra, "profilefound=", 13)) { |
3814 | wrqu->data.length -= 13; | 3814 | wrqu->data.length -= 13; |
3815 | rtw_p2p_profilefound(dev, info, wrqu, &extra[13]); | 3815 | rtw_p2p_profilefound(dev, info, wrqu, &extra[13]); |
3816 | } else if (!memcmp(extra, "prov_disc =", 10)) { | 3816 | } else if (!memcmp(extra, "prov_disc=", 10)) { |
3817 | wrqu->data.length -= 10; | 3817 | wrqu->data.length -= 10; |
3818 | rtw_p2p_prov_disc(dev, info, wrqu, &extra[10]); | 3818 | rtw_p2p_prov_disc(dev, info, wrqu, &extra[10]); |
3819 | } else if (!memcmp(extra, "nego =", 5)) { | 3819 | } else if (!memcmp(extra, "nego=", 5)) { |
3820 | wrqu->data.length -= 5; | 3820 | wrqu->data.length -= 5; |
3821 | rtw_p2p_connect(dev, info, wrqu, &extra[5]); | 3821 | rtw_p2p_connect(dev, info, wrqu, &extra[5]); |
3822 | } else if (!memcmp(extra, "intent =", 7)) { | 3822 | } else if (!memcmp(extra, "intent=", 7)) { |
3823 | /* Commented by Albert 2011/03/23 */ | 3823 | /* Commented by Albert 2011/03/23 */ |
3824 | /* The wrqu->data.length will include the null character */ | 3824 | /* The wrqu->data.length will include the null character */ |
3825 | /* So, we will decrease 7 + 1 */ | 3825 | /* So, we will decrease 7 + 1 */ |
3826 | wrqu->data.length -= 8; | 3826 | wrqu->data.length -= 8; |
3827 | rtw_p2p_set_intent(dev, info, wrqu, &extra[7]); | 3827 | rtw_p2p_set_intent(dev, info, wrqu, &extra[7]); |
3828 | } else if (!memcmp(extra, "ssid =", 5)) { | 3828 | } else if (!memcmp(extra, "ssid=", 5)) { |
3829 | wrqu->data.length -= 5; | 3829 | wrqu->data.length -= 5; |
3830 | rtw_p2p_set_go_nego_ssid(dev, info, wrqu, &extra[5]); | 3830 | rtw_p2p_set_go_nego_ssid(dev, info, wrqu, &extra[5]); |
3831 | } else if (!memcmp(extra, "got_wpsinfo =", 12)) { | 3831 | } else if (!memcmp(extra, "got_wpsinfo=", 12)) { |
3832 | wrqu->data.length -= 12; | 3832 | wrqu->data.length -= 12; |
3833 | rtw_p2p_got_wpsinfo(dev, info, wrqu, &extra[12]); | 3833 | rtw_p2p_got_wpsinfo(dev, info, wrqu, &extra[12]); |
3834 | } else if (!memcmp(extra, "listen_ch =", 10)) { | 3834 | } else if (!memcmp(extra, "listen_ch=", 10)) { |
3835 | /* Commented by Albert 2011/05/24 */ | 3835 | /* Commented by Albert 2011/05/24 */ |
3836 | /* The wrqu->data.length will include the null character */ | 3836 | /* The wrqu->data.length will include the null character */ |
3837 | /* So, we will decrease (10 + 1) */ | 3837 | /* So, we will decrease (10 + 1) */ |
3838 | wrqu->data.length -= 11; | 3838 | wrqu->data.length -= 11; |
3839 | rtw_p2p_set_listen_ch(dev, info, wrqu, &extra[10]); | 3839 | rtw_p2p_set_listen_ch(dev, info, wrqu, &extra[10]); |
3840 | } else if (!memcmp(extra, "op_ch =", 6)) { | 3840 | } else if (!memcmp(extra, "op_ch=", 6)) { |
3841 | /* Commented by Albert 2011/05/24 */ | 3841 | /* Commented by Albert 2011/05/24 */ |
3842 | /* The wrqu->data.length will include the null character */ | 3842 | /* The wrqu->data.length will include the null character */ |
3843 | /* So, we will decrease (6 + 1) */ | 3843 | /* So, we will decrease (6 + 1) */ |
3844 | wrqu->data.length -= 7; | 3844 | wrqu->data.length -= 7; |
3845 | rtw_p2p_set_op_ch(dev, info, wrqu, &extra[6]); | 3845 | rtw_p2p_set_op_ch(dev, info, wrqu, &extra[6]); |
3846 | } else if (!memcmp(extra, "invite =", 7)) { | 3846 | } else if (!memcmp(extra, "invite=", 7)) { |
3847 | wrqu->data.length -= 8; | 3847 | wrqu->data.length -= 8; |
3848 | rtw_p2p_invite_req(dev, info, wrqu, &extra[7]); | 3848 | rtw_p2p_invite_req(dev, info, wrqu, &extra[7]); |
3849 | } else if (!memcmp(extra, "persistent =", 11)) { | 3849 | } else if (!memcmp(extra, "persistent=", 11)) { |
3850 | wrqu->data.length -= 11; | 3850 | wrqu->data.length -= 11; |
3851 | rtw_p2p_set_persistent(dev, info, wrqu, &extra[11]); | 3851 | rtw_p2p_set_persistent(dev, info, wrqu, &extra[11]); |
3852 | } | 3852 | } |
@@ -3887,7 +3887,7 @@ static int rtw_p2p_get(struct net_device *dev, | |||
3887 | "group_id", 8)) { | 3887 | "group_id", 8)) { |
3888 | rtw_p2p_get_groupid(dev, info, wrqu, extra); | 3888 | rtw_p2p_get_groupid(dev, info, wrqu, extra); |
3889 | } else if (!memcmp((__force const char *)wrqu->data.pointer, | 3889 | } else if (!memcmp((__force const char *)wrqu->data.pointer, |
3890 | "peer_deva_inv", 9)) { | 3890 | "peer_deva_inv", 13)) { |
3891 | /* Get the P2P device address when receiving the P2P Invitation request frame. */ | 3891 | /* Get the P2P device address when receiving the P2P Invitation request frame. */ |
3892 | rtw_p2p_get_peer_devaddr_by_invitation(dev, info, wrqu, extra); | 3892 | rtw_p2p_get_peer_devaddr_by_invitation(dev, info, wrqu, extra); |
3893 | } else if (!memcmp((__force const char *)wrqu->data.pointer, | 3893 | } else if (!memcmp((__force const char *)wrqu->data.pointer, |
@@ -6920,7 +6920,7 @@ static int rtw_mp_ctx(struct net_device *dev, | |||
6920 | 6920 | ||
6921 | DBG_88E("%s: in =%s\n", __func__, extra); | 6921 | DBG_88E("%s: in =%s\n", __func__, extra); |
6922 | 6922 | ||
6923 | countPkTx = strncmp(extra, "count =", 5); /* strncmp true is 0 */ | 6923 | countPkTx = strncmp(extra, "count=", 6); /* strncmp true is 0 */ |
6924 | cotuTx = strncmp(extra, "background", 20); | 6924 | cotuTx = strncmp(extra, "background", 20); |
6925 | CarrSprTx = strncmp(extra, "background, cs", 20); | 6925 | CarrSprTx = strncmp(extra, "background, cs", 20); |
6926 | scTx = strncmp(extra, "background, sc", 20); | 6926 | scTx = strncmp(extra, "background, sc", 20); |
@@ -7044,7 +7044,7 @@ static int rtw_mp_arx(struct net_device *dev, | |||
7044 | DBG_88E("%s: %s\n", __func__, input); | 7044 | DBG_88E("%s: %s\n", __func__, input); |
7045 | 7045 | ||
7046 | bStartRx = (strncmp(input, "start", 5) == 0) ? 1 : 0; /* strncmp true is 0 */ | 7046 | bStartRx = (strncmp(input, "start", 5) == 0) ? 1 : 0; /* strncmp true is 0 */ |
7047 | bStopRx = (strncmp(input, "stop", 5) == 0) ? 1 : 0; /* strncmp true is 0 */ | 7047 | bStopRx = (strncmp(input, "stop", 4) == 0) ? 1 : 0; /* strncmp true is 0 */ |
7048 | bQueryPhy = (strncmp(input, "phy", 3) == 0) ? 1 : 0; /* strncmp true is 0 */ | 7048 | bQueryPhy = (strncmp(input, "phy", 3) == 0) ? 1 : 0; /* strncmp true is 0 */ |
7049 | 7049 | ||
7050 | if (bStartRx) { | 7050 | if (bStartRx) { |
diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 23ec684b60e1..274c359279ef 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c | |||
@@ -254,7 +254,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, | |||
254 | struct sta_info *psta; | 254 | struct sta_info *psta; |
255 | struct sta_priv *pstapriv; | 255 | struct sta_priv *pstapriv; |
256 | union recv_frame *prtnframe; | 256 | union recv_frame *prtnframe; |
257 | u16 ether_type = 0; | 257 | u16 ether_type; |
258 | 258 | ||
259 | pstapriv = &adapter->stapriv; | 259 | pstapriv = &adapter->stapriv; |
260 | ptr = get_recvframe_data(precv_frame); | 260 | ptr = get_recvframe_data(precv_frame); |
@@ -263,15 +263,14 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, | |||
263 | psta = r8712_get_stainfo(pstapriv, psta_addr); | 263 | psta = r8712_get_stainfo(pstapriv, psta_addr); |
264 | auth_alg = adapter->securitypriv.AuthAlgrthm; | 264 | auth_alg = adapter->securitypriv.AuthAlgrthm; |
265 | if (auth_alg == 2) { | 265 | if (auth_alg == 2) { |
266 | /* get ether_type */ | ||
267 | ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; | ||
268 | memcpy(ðer_type, ptr, 2); | ||
269 | ether_type = ntohs((unsigned short)ether_type); | ||
270 | |||
266 | if ((psta != NULL) && (psta->ieee8021x_blocked)) { | 271 | if ((psta != NULL) && (psta->ieee8021x_blocked)) { |
267 | /* blocked | 272 | /* blocked |
268 | * only accept EAPOL frame */ | 273 | * only accept EAPOL frame */ |
269 | prtnframe = precv_frame; | ||
270 | /*get ether_type */ | ||
271 | ptr = ptr + pfhdr->attrib.hdrlen + | ||
272 | pfhdr->attrib.iv_len + LLC_HEADER_SIZE; | ||
273 | memcpy(ðer_type, ptr, 2); | ||
274 | ether_type = ntohs((unsigned short)ether_type); | ||
275 | if (ether_type == 0x888e) | 274 | if (ether_type == 0x888e) |
276 | prtnframe = precv_frame; | 275 | prtnframe = precv_frame; |
277 | else { | 276 | else { |
diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index 780631fd3b6d..a48ab25a7d8a 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c | |||
@@ -1496,45 +1496,23 @@ void rtw_wlan_bssid_ex_remove_p2p_attr23a(struct wlan_bssid_ex *bss_ex, u8 attr_ | |||
1496 | int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) | 1496 | int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) |
1497 | { | 1497 | { |
1498 | int match; | 1498 | int match; |
1499 | uint cnt = 0; | 1499 | const u8 *ie; |
1500 | u8 eid, wfd_oui[4] = {0x50, 0x6F, 0x9A, 0x0A}; | ||
1501 | 1500 | ||
1502 | match = false; | 1501 | match = 0; |
1503 | 1502 | ||
1504 | if (in_len < 0) { | 1503 | if (in_len < 0) |
1505 | return match; | 1504 | return match; |
1506 | } | ||
1507 | |||
1508 | while (cnt < in_len) | ||
1509 | { | ||
1510 | eid = in_ie[cnt]; | ||
1511 | 1505 | ||
1512 | if ((eid == _VENDOR_SPECIFIC_IE_) && | 1506 | ie = cfg80211_find_vendor_ie(0x506F9A, 0x0A, in_ie, in_len); |
1513 | !memcmp(&in_ie[cnt+2], wfd_oui, 4)) { | 1507 | if (ie && (ie[1] <= (MAX_WFD_IE_LEN - 2))) { |
1514 | if (wfd_ie != NULL) { | 1508 | if (wfd_ie) { |
1515 | memcpy(wfd_ie, &in_ie[cnt], in_ie[cnt + 1] + 2); | 1509 | *wfd_ielen = ie[1] + 2; |
1516 | 1510 | memcpy(wfd_ie, ie, ie[1] + 2); | |
1517 | } else { | 1511 | } else |
1518 | if (wfd_ielen != NULL) { | 1512 | if (wfd_ielen) |
1519 | *wfd_ielen = 0; | 1513 | *wfd_ielen = 0; |
1520 | } | ||
1521 | } | ||
1522 | |||
1523 | if (wfd_ielen != NULL) { | ||
1524 | *wfd_ielen = in_ie[cnt + 1] + 2; | ||
1525 | } | ||
1526 | |||
1527 | cnt += in_ie[cnt + 1] + 2; | ||
1528 | |||
1529 | match = true; | ||
1530 | break; | ||
1531 | } else { | ||
1532 | cnt += in_ie[cnt + 1] +2; /* goto next */ | ||
1533 | } | ||
1534 | } | ||
1535 | 1514 | ||
1536 | if (match == true) { | 1515 | match = 1; |
1537 | match = cnt; | ||
1538 | } | 1516 | } |
1539 | 1517 | ||
1540 | return match; | 1518 | return match; |
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 4c753639ea5a..1f3e8a0aece4 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c | |||
@@ -1281,7 +1281,7 @@ unsigned int OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *prec | |||
1281 | u8 p2p_status_code = P2P_STATUS_SUCCESS; | 1281 | u8 p2p_status_code = P2P_STATUS_SUCCESS; |
1282 | u8 *p2pie; | 1282 | u8 *p2pie; |
1283 | u32 p2pielen = 0; | 1283 | u32 p2pielen = 0; |
1284 | u8 wfd_ie[ 128 ] = { 0x00 }; | 1284 | u8 wfd_ie[MAX_WFD_IE_LEN] = { 0x00 }; |
1285 | u32 wfd_ielen = 0; | 1285 | u32 wfd_ielen = 0; |
1286 | #endif /* CONFIG_8723AU_P2P */ | 1286 | #endif /* CONFIG_8723AU_P2P */ |
1287 | 1287 | ||
diff --git a/drivers/staging/rtl8723au/core/rtw_p2p.c b/drivers/staging/rtl8723au/core/rtw_p2p.c index 27a6cc76973d..1a961e3f3a55 100644 --- a/drivers/staging/rtl8723au/core/rtw_p2p.c +++ b/drivers/staging/rtl8723au/core/rtw_p2p.c | |||
@@ -2535,7 +2535,7 @@ u8 process_p2p_group_negotation_req23a(struct wifidirect_info *pwdinfo, u8 *pfra | |||
2535 | u16 wps_devicepassword_id = 0x0000; | 2535 | u16 wps_devicepassword_id = 0x0000; |
2536 | uint wps_devicepassword_id_len = 0; | 2536 | uint wps_devicepassword_id_len = 0; |
2537 | #ifdef CONFIG_8723AU_P2P | 2537 | #ifdef CONFIG_8723AU_P2P |
2538 | u8 wfd_ie[ 128 ] = { 0x00 }; | 2538 | u8 wfd_ie[MAX_WFD_IE_LEN] = { 0x00 }; |
2539 | u32 wfd_ielen = 0; | 2539 | u32 wfd_ielen = 0; |
2540 | #endif /* CONFIG_8723AU_P2P */ | 2540 | #endif /* CONFIG_8723AU_P2P */ |
2541 | 2541 | ||
@@ -2741,7 +2741,7 @@ u8 process_p2p_group_negotation_resp23a(struct wifidirect_info *pwdinfo, u8 *pfr | |||
2741 | u32 ies_len; | 2741 | u32 ies_len; |
2742 | u8 * p2p_ie; | 2742 | u8 * p2p_ie; |
2743 | #ifdef CONFIG_8723AU_P2P | 2743 | #ifdef CONFIG_8723AU_P2P |
2744 | u8 wfd_ie[ 128 ] = { 0x00 }; | 2744 | u8 wfd_ie[MAX_WFD_IE_LEN] = { 0x00 }; |
2745 | u32 wfd_ielen = 0; | 2745 | u32 wfd_ielen = 0; |
2746 | #endif /* CONFIG_8723AU_P2P */ | 2746 | #endif /* CONFIG_8723AU_P2P */ |
2747 | 2747 | ||
diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 0dfcfbce3b52..99d81e612e7b 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c | |||
@@ -570,7 +570,7 @@ void flush_all_cam_entry23a(struct rtw_adapter *padapter) | |||
570 | int WFD_info_handler(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE) | 570 | int WFD_info_handler(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE) |
571 | { | 571 | { |
572 | struct wifidirect_info *pwdinfo; | 572 | struct wifidirect_info *pwdinfo; |
573 | u8 wfd_ie[128] = {0x00}; | 573 | u8 wfd_ie[MAX_WFD_IE_LEN] = {0x00}; |
574 | u32 wfd_ielen = 0; | 574 | u32 wfd_ielen = 0; |
575 | 575 | ||
576 | pwdinfo = &padapter->wdinfo; | 576 | pwdinfo = &padapter->wdinfo; |
@@ -681,7 +681,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) | |||
681 | inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; | 681 | inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; |
682 | 682 | ||
683 | if (pregpriv->wifi_spec == 1) { | 683 | if (pregpriv->wifi_spec == 1) { |
684 | u32 j, tmp, change_inx; | 684 | u32 j, tmp, change_inx = false; |
685 | 685 | ||
686 | /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ | 686 | /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ |
687 | for (i = 0; i < 4; i++) { | 687 | for (i = 0; i < 4; i++) { |
diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c index e5073fe24770..a4c9cc437bc6 100644 --- a/drivers/staging/rtl8821ae/base.c +++ b/drivers/staging/rtl8821ae/base.c | |||
@@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) | |||
388 | 388 | ||
389 | } | 389 | } |
390 | 390 | ||
391 | static void _rtl_init_deferred_work(struct ieee80211_hw *hw) | 391 | static int _rtl_init_deferred_work(struct ieee80211_hw *hw) |
392 | { | 392 | { |
393 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 393 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
394 | 394 | ||
@@ -410,6 +410,9 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) | |||
410 | rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name); | 410 | rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name); |
411 | #endif | 411 | #endif |
412 | /*<delete in kernel end>*/ | 412 | /*<delete in kernel end>*/ |
413 | if (!rtlpriv->works.rtl_wq) | ||
414 | return -ENOMEM; | ||
415 | |||
413 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, | 416 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
414 | (void *)rtl_watchdog_wq_callback); | 417 | (void *)rtl_watchdog_wq_callback); |
415 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, | 418 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
@@ -421,6 +424,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) | |||
421 | INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, | 424 | INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, |
422 | (void *)rtl_fwevt_wq_callback); | 425 | (void *)rtl_fwevt_wq_callback); |
423 | 426 | ||
427 | return 0; | ||
428 | |||
424 | } | 429 | } |
425 | 430 | ||
426 | void rtl_deinit_deferred_work(struct ieee80211_hw *hw) | 431 | void rtl_deinit_deferred_work(struct ieee80211_hw *hw) |
@@ -519,7 +524,8 @@ int rtl_init_core(struct ieee80211_hw *hw) | |||
519 | INIT_LIST_HEAD(&rtlpriv->entry_list); | 524 | INIT_LIST_HEAD(&rtlpriv->entry_list); |
520 | 525 | ||
521 | /* <6> init deferred work */ | 526 | /* <6> init deferred work */ |
522 | _rtl_init_deferred_work(hw); | 527 | if (_rtl_init_deferred_work(hw)) |
528 | return 1; | ||
523 | 529 | ||
524 | /* <7> */ | 530 | /* <7> */ |
525 | #ifdef VIF_TODO | 531 | #ifdef VIF_TODO |
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index ef5933b93590..3b6e5358c723 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c | |||
@@ -1855,8 +1855,9 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) | |||
1855 | { | 1855 | { |
1856 | static u_char goto_buf[8]; | 1856 | static u_char goto_buf[8]; |
1857 | static int num; | 1857 | static int num; |
1858 | int maxlen, go_pos; | 1858 | int maxlen; |
1859 | char *cp; | 1859 | char *cp; |
1860 | |||
1860 | if (type == KT_SPKUP && ch == SPEAKUP_GOTO) | 1861 | if (type == KT_SPKUP && ch == SPEAKUP_GOTO) |
1861 | goto do_goto; | 1862 | goto do_goto; |
1862 | if (type == KT_LATIN && ch == '\n') | 1863 | if (type == KT_LATIN && ch == '\n') |
@@ -1891,25 +1892,24 @@ oops: | |||
1891 | spk_special_handler = NULL; | 1892 | spk_special_handler = NULL; |
1892 | return 1; | 1893 | return 1; |
1893 | } | 1894 | } |
1894 | go_pos = kstrtol(goto_buf, 10, (long *)&cp); | 1895 | |
1895 | goto_pos = (u_long) go_pos; | 1896 | goto_pos = simple_strtoul(goto_buf, &cp, 10); |
1897 | |||
1896 | if (*cp == 'x') { | 1898 | if (*cp == 'x') { |
1897 | if (*goto_buf < '0') | 1899 | if (*goto_buf < '0') |
1898 | goto_pos += spk_x; | 1900 | goto_pos += spk_x; |
1899 | else | 1901 | else if (goto_pos > 0) |
1900 | goto_pos--; | 1902 | goto_pos--; |
1901 | if (goto_pos < 0) | 1903 | |
1902 | goto_pos = 0; | ||
1903 | if (goto_pos >= vc->vc_cols) | 1904 | if (goto_pos >= vc->vc_cols) |
1904 | goto_pos = vc->vc_cols - 1; | 1905 | goto_pos = vc->vc_cols - 1; |
1905 | goto_x = 1; | 1906 | goto_x = 1; |
1906 | } else { | 1907 | } else { |
1907 | if (*goto_buf < '0') | 1908 | if (*goto_buf < '0') |
1908 | goto_pos += spk_y; | 1909 | goto_pos += spk_y; |
1909 | else | 1910 | else if (goto_pos > 0) |
1910 | goto_pos--; | 1911 | goto_pos--; |
1911 | if (goto_pos < 0) | 1912 | |
1912 | goto_pos = 0; | ||
1913 | if (goto_pos >= vc->vc_rows) | 1913 | if (goto_pos >= vc->vc_rows) |
1914 | goto_pos = vc->vc_rows - 1; | 1914 | goto_pos = vc->vc_rows - 1; |
1915 | goto_x = 0; | 1915 | goto_x = 0; |
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 8ea9c46e56ae..3152a2180c45 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c | |||
@@ -381,17 +381,17 @@ create_bus(CONTROLVM_MESSAGE *msg, char *buf) | |||
381 | cmd.add_vbus.busTypeGuid = msg->cmd.createBus.busDataTypeGuid; | 381 | cmd.add_vbus.busTypeGuid = msg->cmd.createBus.busDataTypeGuid; |
382 | cmd.add_vbus.busInstGuid = msg->cmd.createBus.busInstGuid; | 382 | cmd.add_vbus.busInstGuid = msg->cmd.createBus.busInstGuid; |
383 | if (!VirtControlChanFunc) { | 383 | if (!VirtControlChanFunc) { |
384 | kfree(bus); | ||
385 | LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); | 384 | LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); |
386 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, | 385 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, |
387 | POSTCODE_SEVERITY_ERR); | 386 | POSTCODE_SEVERITY_ERR); |
387 | kfree(bus); | ||
388 | return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; | 388 | return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; |
389 | } | 389 | } |
390 | if (!VirtControlChanFunc(&cmd)) { | 390 | if (!VirtControlChanFunc(&cmd)) { |
391 | kfree(bus); | ||
392 | LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); | 391 | LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); |
393 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, | 392 | POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->busNo, |
394 | POSTCODE_SEVERITY_ERR); | 393 | POSTCODE_SEVERITY_ERR); |
394 | kfree(bus); | ||
395 | return | 395 | return |
396 | CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; | 396 | CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; |
397 | } | 397 | } |
diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index d4bf203cdfdf..d95825dc5414 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h | |||
@@ -104,9 +104,9 @@ finddevice(struct list_head *list, U32 busNo, U32 devNo) | |||
104 | 104 | ||
105 | static inline void delbusdevices(struct list_head *list, U32 busNo) | 105 | static inline void delbusdevices(struct list_head *list, U32 busNo) |
106 | { | 106 | { |
107 | VISORCHIPSET_DEVICE_INFO *p; | 107 | VISORCHIPSET_DEVICE_INFO *p, *tmp; |
108 | 108 | ||
109 | list_for_each_entry(p, list, entry) { | 109 | list_for_each_entry_safe(p, tmp, list, entry) { |
110 | if (p->busNo == busNo) { | 110 | if (p->busNo == busNo) { |
111 | list_del(&p->entry); | 111 | list_del(&p->entry); |
112 | kfree(p); | 112 | kfree(p); |
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 257c6e59b460..c475e256e34b 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c | |||
@@ -605,16 +605,16 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); | |||
605 | static void | 605 | static void |
606 | cleanup_controlvm_structures(void) | 606 | cleanup_controlvm_structures(void) |
607 | { | 607 | { |
608 | VISORCHIPSET_BUS_INFO *bi; | 608 | VISORCHIPSET_BUS_INFO *bi, *tmp_bi; |
609 | VISORCHIPSET_DEVICE_INFO *di; | 609 | VISORCHIPSET_DEVICE_INFO *di, *tmp_di; |
610 | 610 | ||
611 | list_for_each_entry(bi, &BusInfoList, entry) { | 611 | list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { |
612 | busInfo_clear(bi); | 612 | busInfo_clear(bi); |
613 | list_del(&bi->entry); | 613 | list_del(&bi->entry); |
614 | kfree(bi); | 614 | kfree(bi); |
615 | } | 615 | } |
616 | 616 | ||
617 | list_for_each_entry(di, &DevInfoList, entry) { | 617 | list_for_each_entry_safe(di, tmp_di, &DevInfoList, entry) { |
618 | devInfo_clear(di); | 618 | devInfo_clear(di); |
619 | list_del(&di->entry); | 619 | list_del(&di->entry); |
620 | kfree(di); | 620 | kfree(di); |
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c b/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c index c5bf60b135b9..92caef7474c7 100644 --- a/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_host_driver.c | |||
@@ -118,6 +118,7 @@ static int refresh_exported_devices(void) | |||
118 | struct udev_list_entry *devices, *dev_list_entry; | 118 | struct udev_list_entry *devices, *dev_list_entry; |
119 | struct udev_device *dev; | 119 | struct udev_device *dev; |
120 | const char *path; | 120 | const char *path; |
121 | const char *driver; | ||
121 | 122 | ||
122 | enumerate = udev_enumerate_new(udev_context); | 123 | enumerate = udev_enumerate_new(udev_context); |
123 | udev_enumerate_add_match_subsystem(enumerate, "usb"); | 124 | udev_enumerate_add_match_subsystem(enumerate, "usb"); |
@@ -128,10 +129,12 @@ static int refresh_exported_devices(void) | |||
128 | udev_list_entry_foreach(dev_list_entry, devices) { | 129 | udev_list_entry_foreach(dev_list_entry, devices) { |
129 | path = udev_list_entry_get_name(dev_list_entry); | 130 | path = udev_list_entry_get_name(dev_list_entry); |
130 | dev = udev_device_new_from_syspath(udev_context, path); | 131 | dev = udev_device_new_from_syspath(udev_context, path); |
132 | if (dev == NULL) | ||
133 | continue; | ||
131 | 134 | ||
132 | /* Check whether device uses usbip-host driver. */ | 135 | /* Check whether device uses usbip-host driver. */ |
133 | if (!strcmp(udev_device_get_driver(dev), | 136 | driver = udev_device_get_driver(dev); |
134 | USBIP_HOST_DRV_NAME)) { | 137 | if (driver != NULL && !strcmp(driver, USBIP_HOST_DRV_NAME)) { |
135 | edev = usbip_exported_device_new(path); | 138 | edev = usbip_exported_device_new(path); |
136 | if (!edev) { | 139 | if (!edev) { |
137 | dbg("usbip_exported_device_new failed"); | 140 | dbg("usbip_exported_device_new failed"); |
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index 47bddcdde0a6..211f43f67ea2 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c | |||
@@ -184,7 +184,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, | |||
184 | * @devid: unique device identifier in a remote host | 184 | * @devid: unique device identifier in a remote host |
185 | * @speed: usb device speed in a remote host | 185 | * @speed: usb device speed in a remote host |
186 | */ | 186 | */ |
187 | if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1) | 187 | if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 4) |
188 | return -EINVAL; | 188 | return -EINVAL; |
189 | 189 | ||
190 | usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n", | 190 | usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n", |
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 792792715673..ffb4eeefdddb 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c | |||
@@ -776,7 +776,8 @@ static int vme_user_probe(struct vme_dev *vdev) | |||
776 | image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL); | 776 | image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL); |
777 | if (image[i].kern_buf == NULL) { | 777 | if (image[i].kern_buf == NULL) { |
778 | err = -ENOMEM; | 778 | err = -ENOMEM; |
779 | goto err_master_buf; | 779 | vme_master_free(image[i].resource); |
780 | goto err_master; | ||
780 | } | 781 | } |
781 | } | 782 | } |
782 | 783 | ||
@@ -819,8 +820,6 @@ static int vme_user_probe(struct vme_dev *vdev) | |||
819 | 820 | ||
820 | return 0; | 821 | return 0; |
821 | 822 | ||
822 | /* Ensure counter set correcty to destroy all sysfs devices */ | ||
823 | i = VME_DEVS; | ||
824 | err_sysfs: | 823 | err_sysfs: |
825 | while (i > 0) { | 824 | while (i > 0) { |
826 | i--; | 825 | i--; |
@@ -830,12 +829,10 @@ err_sysfs: | |||
830 | 829 | ||
831 | /* Ensure counter set correcty to unalloc all master windows */ | 830 | /* Ensure counter set correcty to unalloc all master windows */ |
832 | i = MASTER_MAX + 1; | 831 | i = MASTER_MAX + 1; |
833 | err_master_buf: | ||
834 | for (i = MASTER_MINOR; i < (MASTER_MAX + 1); i++) | ||
835 | kfree(image[i].kern_buf); | ||
836 | err_master: | 832 | err_master: |
837 | while (i > MASTER_MINOR) { | 833 | while (i > MASTER_MINOR) { |
838 | i--; | 834 | i--; |
835 | kfree(image[i].kern_buf); | ||
839 | vme_master_free(image[i].resource); | 836 | vme_master_free(image[i].resource); |
840 | } | 837 | } |
841 | 838 | ||
diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h index 5c739bebd8a5..949f0e5eed8d 100644 --- a/drivers/staging/xgifb/vb_def.h +++ b/drivers/staging/xgifb/vb_def.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _VB_DEF_ | 1 | #ifndef _VB_DEF_ |
2 | #define _VB_DEF_ | 2 | #define _VB_DEF_ |
3 | #include "../../video/sis/initdef.h" | 3 | #include "../../video/fbdev/sis/initdef.h" |
4 | 4 | ||
5 | #define VB_XGI301C 0x0020 /* for 301C */ | 5 | #define VB_XGI301C 0x0020 /* for 301C */ |
6 | 6 | ||
diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index c08ff5b2d6ee..0d27594554ca 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _VB_STRUCT_ | 1 | #ifndef _VB_STRUCT_ |
2 | #define _VB_STRUCT_ | 2 | #define _VB_STRUCT_ |
3 | #include "../../video/sis/vstruct.h" | 3 | #include "../../video/fbdev/sis/vstruct.h" |
4 | 4 | ||
5 | struct XGI_LVDSCRT1HDataStruct { | 5 | struct XGI_LVDSCRT1HDataStruct { |
6 | unsigned char Reg[8]; | 6 | unsigned char Reg[8]; |
diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h index ddf7776c295b..264351441f99 100644 --- a/drivers/staging/xgifb/vgatypes.h +++ b/drivers/staging/xgifb/vgatypes.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define _VGATYPES_ | 2 | #define _VGATYPES_ |
3 | 3 | ||
4 | #include <linux/fb.h> /* for struct fb_var_screeninfo for sis.h */ | 4 | #include <linux/fb.h> /* for struct fb_var_screeninfo for sis.h */ |
5 | #include "../../video/sis/vgatypes.h" | 5 | #include "../../video/fbdev/sis/vgatypes.h" |
6 | #include "../../video/sis/sis.h" /* for LCD_TYPE */ | 6 | #include "../../video/fbdev/sis/sis.h" /* for LCD_TYPE */ |
7 | 7 | ||
8 | #ifndef XGI_VB_CHIP_TYPE | 8 | #ifndef XGI_VB_CHIP_TYPE |
9 | enum XGI_VB_CHIP_TYPE { | 9 | enum XGI_VB_CHIP_TYPE { |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 2e6d8ddc4425..5d9b01aa54f4 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1226,6 +1226,7 @@ config SERIAL_BFIN_SPORT3_UART_CTSRTS | |||
1226 | config SERIAL_TIMBERDALE | 1226 | config SERIAL_TIMBERDALE |
1227 | tristate "Support for timberdale UART" | 1227 | tristate "Support for timberdale UART" |
1228 | select SERIAL_CORE | 1228 | select SERIAL_CORE |
1229 | depends on X86_32 || COMPILE_TEST | ||
1229 | ---help--- | 1230 | ---help--- |
1230 | Add support for UART controller on timberdale. | 1231 | Add support for UART controller on timberdale. |
1231 | 1232 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index d4eda24aa68b..dacf0a09ab24 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -318,7 +318,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port * | |||
318 | .src_addr = uap->port.mapbase + UART01x_DR, | 318 | .src_addr = uap->port.mapbase + UART01x_DR, |
319 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | 319 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, |
320 | .direction = DMA_DEV_TO_MEM, | 320 | .direction = DMA_DEV_TO_MEM, |
321 | .src_maxburst = uap->fifosize >> 1, | 321 | .src_maxburst = uap->fifosize >> 2, |
322 | .device_fc = false, | 322 | .device_fc = false, |
323 | }; | 323 | }; |
324 | 324 | ||
@@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2176 | static int pl011_remove(struct amba_device *dev) | 2176 | static int pl011_remove(struct amba_device *dev) |
2177 | { | 2177 | { |
2178 | struct uart_amba_port *uap = amba_get_drvdata(dev); | 2178 | struct uart_amba_port *uap = amba_get_drvdata(dev); |
2179 | bool busy = false; | ||
2179 | int i; | 2180 | int i; |
2180 | 2181 | ||
2181 | uart_remove_one_port(&amba_reg, &uap->port); | 2182 | uart_remove_one_port(&amba_reg, &uap->port); |
@@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev) | |||
2183 | for (i = 0; i < ARRAY_SIZE(amba_ports); i++) | 2184 | for (i = 0; i < ARRAY_SIZE(amba_ports); i++) |
2184 | if (amba_ports[i] == uap) | 2185 | if (amba_ports[i] == uap) |
2185 | amba_ports[i] = NULL; | 2186 | amba_ports[i] = NULL; |
2187 | else if (amba_ports[i]) | ||
2188 | busy = true; | ||
2186 | 2189 | ||
2187 | pl011_dma_remove(uap); | 2190 | pl011_dma_remove(uap); |
2188 | uart_unregister_driver(&amba_reg); | 2191 | if (!busy) |
2192 | uart_unregister_driver(&amba_reg); | ||
2189 | return 0; | 2193 | return 0; |
2190 | } | 2194 | } |
2191 | 2195 | ||
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 5e6fdb1ea73b..14aaea0d4131 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -368,16 +368,12 @@ static const struct uart_ops uart_clps711x_ops = { | |||
368 | static void uart_clps711x_console_putchar(struct uart_port *port, int ch) | 368 | static void uart_clps711x_console_putchar(struct uart_port *port, int ch) |
369 | { | 369 | { |
370 | struct clps711x_port *s = dev_get_drvdata(port->dev); | 370 | struct clps711x_port *s = dev_get_drvdata(port->dev); |
371 | u32 sysflg = 0; | ||
371 | 372 | ||
372 | /* Wait for FIFO is not full */ | 373 | /* Wait for FIFO is not full */ |
373 | while (1) { | 374 | do { |
374 | u32 sysflg = 0; | ||
375 | |||
376 | regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); | 375 | regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); |
377 | if (!(sysflg & SYSFLG_UTXFF)) | 376 | } while (sysflg & SYSFLG_UTXFF); |
378 | break; | ||
379 | cond_resched(); | ||
380 | } | ||
381 | 377 | ||
382 | writew(ch, port->membase + UARTDR_OFFSET); | 378 | writew(ch, port->membase + UARTDR_OFFSET); |
383 | } | 379 | } |
@@ -387,18 +383,14 @@ static void uart_clps711x_console_write(struct console *co, const char *c, | |||
387 | { | 383 | { |
388 | struct uart_port *port = clps711x_uart.state[co->index].uart_port; | 384 | struct uart_port *port = clps711x_uart.state[co->index].uart_port; |
389 | struct clps711x_port *s = dev_get_drvdata(port->dev); | 385 | struct clps711x_port *s = dev_get_drvdata(port->dev); |
386 | u32 sysflg = 0; | ||
390 | 387 | ||
391 | uart_console_write(port, c, n, uart_clps711x_console_putchar); | 388 | uart_console_write(port, c, n, uart_clps711x_console_putchar); |
392 | 389 | ||
393 | /* Wait for transmitter to become empty */ | 390 | /* Wait for transmitter to become empty */ |
394 | while (1) { | 391 | do { |
395 | u32 sysflg = 0; | ||
396 | |||
397 | regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); | 392 | regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); |
398 | if (!(sysflg & SYSFLG_UBUSY)) | 393 | } while (sysflg & SYSFLG_UBUSY); |
399 | break; | ||
400 | cond_resched(); | ||
401 | } | ||
402 | } | 394 | } |
403 | 395 | ||
404 | static int uart_clps711x_console_setup(struct console *co, char *options) | 396 | static int uart_clps711x_console_setup(struct console *co, char *options) |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index 028582e924a5..c167a710dc39 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
@@ -798,6 +798,9 @@ static int efm32_uart_remove(struct platform_device *pdev) | |||
798 | 798 | ||
799 | static const struct of_device_id efm32_uart_dt_ids[] = { | 799 | static const struct of_device_id efm32_uart_dt_ids[] = { |
800 | { | 800 | { |
801 | .compatible = "energymicro,efm32-uart", | ||
802 | }, { | ||
803 | /* doesn't follow the "vendor,device" scheme, don't use */ | ||
801 | .compatible = "efm32,uart", | 804 | .compatible = "efm32,uart", |
802 | }, { | 805 | }, { |
803 | /* sentinel */ | 806 | /* sentinel */ |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index dd8b1a5458ff..08b6b9419f0d 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -225,14 +225,19 @@ static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up, | |||
225 | if (enable) | 225 | if (enable) |
226 | enable_irq(up->wakeirq); | 226 | enable_irq(up->wakeirq); |
227 | else | 227 | else |
228 | disable_irq(up->wakeirq); | 228 | disable_irq_nosync(up->wakeirq); |
229 | } | 229 | } |
230 | 230 | ||
231 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) | 231 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) |
232 | { | 232 | { |
233 | struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); | 233 | struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); |
234 | 234 | ||
235 | if (enable == up->wakeups_enabled) | ||
236 | return; | ||
237 | |||
235 | serial_omap_enable_wakeirq(up, enable); | 238 | serial_omap_enable_wakeirq(up, enable); |
239 | up->wakeups_enabled = enable; | ||
240 | |||
236 | if (!pdata || !pdata->enable_wakeup) | 241 | if (!pdata || !pdata->enable_wakeup) |
237 | return; | 242 | return; |
238 | 243 | ||
@@ -1495,6 +1500,11 @@ static int serial_omap_suspend(struct device *dev) | |||
1495 | uart_suspend_port(&serial_omap_reg, &up->port); | 1500 | uart_suspend_port(&serial_omap_reg, &up->port); |
1496 | flush_work(&up->qos_work); | 1501 | flush_work(&up->qos_work); |
1497 | 1502 | ||
1503 | if (device_may_wakeup(dev)) | ||
1504 | serial_omap_enable_wakeup(up, true); | ||
1505 | else | ||
1506 | serial_omap_enable_wakeup(up, false); | ||
1507 | |||
1498 | return 0; | 1508 | return 0; |
1499 | } | 1509 | } |
1500 | 1510 | ||
@@ -1502,6 +1512,9 @@ static int serial_omap_resume(struct device *dev) | |||
1502 | { | 1512 | { |
1503 | struct uart_omap_port *up = dev_get_drvdata(dev); | 1513 | struct uart_omap_port *up = dev_get_drvdata(dev); |
1504 | 1514 | ||
1515 | if (device_may_wakeup(dev)) | ||
1516 | serial_omap_enable_wakeup(up, false); | ||
1517 | |||
1505 | uart_resume_port(&serial_omap_reg, &up->port); | 1518 | uart_resume_port(&serial_omap_reg, &up->port); |
1506 | 1519 | ||
1507 | return 0; | 1520 | return 0; |
@@ -1789,6 +1802,7 @@ static int serial_omap_remove(struct platform_device *dev) | |||
1789 | pm_runtime_disable(up->dev); | 1802 | pm_runtime_disable(up->dev); |
1790 | uart_remove_one_port(&serial_omap_reg, &up->port); | 1803 | uart_remove_one_port(&serial_omap_reg, &up->port); |
1791 | pm_qos_remove_request(&up->pm_qos_request); | 1804 | pm_qos_remove_request(&up->pm_qos_request); |
1805 | device_init_wakeup(&dev->dev, false); | ||
1792 | 1806 | ||
1793 | return 0; | 1807 | return 0; |
1794 | } | 1808 | } |
@@ -1877,17 +1891,7 @@ static int serial_omap_runtime_suspend(struct device *dev) | |||
1877 | 1891 | ||
1878 | up->context_loss_cnt = serial_omap_get_context_loss_count(up); | 1892 | up->context_loss_cnt = serial_omap_get_context_loss_count(up); |
1879 | 1893 | ||
1880 | if (device_may_wakeup(dev)) { | 1894 | serial_omap_enable_wakeup(up, true); |
1881 | if (!up->wakeups_enabled) { | ||
1882 | serial_omap_enable_wakeup(up, true); | ||
1883 | up->wakeups_enabled = true; | ||
1884 | } | ||
1885 | } else { | ||
1886 | if (up->wakeups_enabled) { | ||
1887 | serial_omap_enable_wakeup(up, false); | ||
1888 | up->wakeups_enabled = false; | ||
1889 | } | ||
1890 | } | ||
1891 | 1895 | ||
1892 | up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; | 1896 | up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; |
1893 | schedule_work(&up->qos_work); | 1897 | schedule_work(&up->qos_work); |
@@ -1901,6 +1905,8 @@ static int serial_omap_runtime_resume(struct device *dev) | |||
1901 | 1905 | ||
1902 | int loss_cnt = serial_omap_get_context_loss_count(up); | 1906 | int loss_cnt = serial_omap_get_context_loss_count(up); |
1903 | 1907 | ||
1908 | serial_omap_enable_wakeup(up, false); | ||
1909 | |||
1904 | if (loss_cnt < 0) { | 1910 | if (loss_cnt < 0) { |
1905 | dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n", | 1911 | dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n", |
1906 | loss_cnt); | 1912 | loss_cnt); |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 2cf5649a6dc0..f26834d262b3 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -89,8 +89,7 @@ static void __uart_start(struct tty_struct *tty) | |||
89 | struct uart_state *state = tty->driver_data; | 89 | struct uart_state *state = tty->driver_data; |
90 | struct uart_port *port = state->uart_port; | 90 | struct uart_port *port = state->uart_port; |
91 | 91 | ||
92 | if (!uart_circ_empty(&state->xmit) && state->xmit.buf && | 92 | if (!tty->stopped && !tty->hw_stopped) |
93 | !tty->stopped && !tty->hw_stopped) | ||
94 | port->ops->start_tx(port); | 93 | port->ops->start_tx(port); |
95 | } | 94 | } |
96 | 95 | ||
@@ -1452,6 +1451,8 @@ static void uart_hangup(struct tty_struct *tty) | |||
1452 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); | 1451 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); |
1453 | spin_unlock_irqrestore(&port->lock, flags); | 1452 | spin_unlock_irqrestore(&port->lock, flags); |
1454 | tty_port_tty_set(port, NULL); | 1453 | tty_port_tty_set(port, NULL); |
1454 | if (!uart_console(state->uart_port)) | ||
1455 | uart_change_pm(state, UART_PM_STATE_OFF); | ||
1455 | wake_up_interruptible(&port->open_wait); | 1456 | wake_up_interruptible(&port->open_wait); |
1456 | wake_up_interruptible(&port->delta_msr_wait); | 1457 | wake_up_interruptible(&port->delta_msr_wait); |
1457 | } | 1458 | } |
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 21e6e84c0df8..dd3a96e07026 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c | |||
@@ -295,7 +295,7 @@ static void asc_receive_chars(struct uart_port *port) | |||
295 | status & ASC_STA_OE) { | 295 | status & ASC_STA_OE) { |
296 | 296 | ||
297 | if (c & ASC_RXBUF_FE) { | 297 | if (c & ASC_RXBUF_FE) { |
298 | if (c == ASC_RXBUF_FE) { | 298 | if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) { |
299 | port->icount.brk++; | 299 | port->icount.brk++; |
300 | if (uart_handle_break(port)) | 300 | if (uart_handle_break(port)) |
301 | continue; | 301 | continue; |
@@ -325,7 +325,7 @@ static void asc_receive_chars(struct uart_port *port) | |||
325 | flag = TTY_FRAME; | 325 | flag = TTY_FRAME; |
326 | } | 326 | } |
327 | 327 | ||
328 | if (uart_handle_sysrq_char(port, c)) | 328 | if (uart_handle_sysrq_char(port, c & 0xff)) |
329 | continue; | 329 | continue; |
330 | 330 | ||
331 | uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag); | 331 | uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag); |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index d3448a90f0f9..34110719fe03 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -878,9 +878,8 @@ void disassociate_ctty(int on_exit) | |||
878 | spin_lock_irq(¤t->sighand->siglock); | 878 | spin_lock_irq(¤t->sighand->siglock); |
879 | put_pid(current->signal->tty_old_pgrp); | 879 | put_pid(current->signal->tty_old_pgrp); |
880 | current->signal->tty_old_pgrp = NULL; | 880 | current->signal->tty_old_pgrp = NULL; |
881 | spin_unlock_irq(¤t->sighand->siglock); | ||
882 | 881 | ||
883 | tty = get_current_tty(); | 882 | tty = tty_kref_get(current->signal->tty); |
884 | if (tty) { | 883 | if (tty) { |
885 | unsigned long flags; | 884 | unsigned long flags; |
886 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 885 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
@@ -897,6 +896,7 @@ void disassociate_ctty(int on_exit) | |||
897 | #endif | 896 | #endif |
898 | } | 897 | } |
899 | 898 | ||
899 | spin_unlock_irq(¤t->sighand->siglock); | ||
900 | /* Now clear signal->tty under the lock */ | 900 | /* Now clear signal->tty under the lock */ |
901 | read_lock(&tasklist_lock); | 901 | read_lock(&tasklist_lock); |
902 | session_clear_tty(task_session(current)); | 902 | session_clear_tty(task_session(current)); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 900f7ff805ee..904efb6035b0 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -518,13 +518,16 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
518 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { | 518 | if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { |
519 | dev_err(&acm->control->dev, | 519 | dev_err(&acm->control->dev, |
520 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); | 520 | "%s - usb_submit_urb(ctrl irq) failed\n", __func__); |
521 | usb_autopm_put_interface(acm->control); | ||
521 | goto error_submit_urb; | 522 | goto error_submit_urb; |
522 | } | 523 | } |
523 | 524 | ||
524 | acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS; | 525 | acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS; |
525 | if (acm_set_control(acm, acm->ctrlout) < 0 && | 526 | if (acm_set_control(acm, acm->ctrlout) < 0 && |
526 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) | 527 | (acm->ctrl_caps & USB_CDC_CAP_LINE)) { |
528 | usb_autopm_put_interface(acm->control); | ||
527 | goto error_set_control; | 529 | goto error_set_control; |
530 | } | ||
528 | 531 | ||
529 | usb_autopm_put_interface(acm->control); | 532 | usb_autopm_put_interface(acm->control); |
530 | 533 | ||
@@ -549,7 +552,6 @@ error_submit_read_urbs: | |||
549 | error_set_control: | 552 | error_set_control: |
550 | usb_kill_urb(acm->ctrlurb); | 553 | usb_kill_urb(acm->ctrlurb); |
551 | error_submit_urb: | 554 | error_submit_urb: |
552 | usb_autopm_put_interface(acm->control); | ||
553 | error_get_interface: | 555 | error_get_interface: |
554 | disconnected: | 556 | disconnected: |
555 | mutex_unlock(&acm->mutex); | 557 | mutex_unlock(&acm->mutex); |
@@ -1652,13 +1654,27 @@ static const struct usb_device_id acm_ids[] = { | |||
1652 | }, | 1654 | }, |
1653 | /* Motorola H24 HSPA module: */ | 1655 | /* Motorola H24 HSPA module: */ |
1654 | { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ | 1656 | { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ |
1655 | { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */ | 1657 | { USB_DEVICE(0x22b8, 0x2d92), /* modem + diagnostics */ |
1656 | { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */ | 1658 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ |
1657 | { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */ | 1659 | }, |
1658 | { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */ | 1660 | { USB_DEVICE(0x22b8, 0x2d93), /* modem + AT port */ |
1659 | { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */ | 1661 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ |
1660 | { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */ | 1662 | }, |
1661 | { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */ | 1663 | { USB_DEVICE(0x22b8, 0x2d95), /* modem + AT port + diagnostics */ |
1664 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ | ||
1665 | }, | ||
1666 | { USB_DEVICE(0x22b8, 0x2d96), /* modem + NMEA */ | ||
1667 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ | ||
1668 | }, | ||
1669 | { USB_DEVICE(0x22b8, 0x2d97), /* modem + diagnostics + NMEA */ | ||
1670 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ | ||
1671 | }, | ||
1672 | { USB_DEVICE(0x22b8, 0x2d99), /* modem + AT port + NMEA */ | ||
1673 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ | ||
1674 | }, | ||
1675 | { USB_DEVICE(0x22b8, 0x2d9a), /* modem + AT port + diagnostics + NMEA */ | ||
1676 | .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ | ||
1677 | }, | ||
1662 | 1678 | ||
1663 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | 1679 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ |
1664 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on | 1680 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index d59d99347d54..1f02e65fe305 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -75,7 +75,7 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd, | |||
75 | PCI_SLOT(companion->devfn) != slot) | 75 | PCI_SLOT(companion->devfn) != slot) |
76 | continue; | 76 | continue; |
77 | companion_hcd = pci_get_drvdata(companion); | 77 | companion_hcd = pci_get_drvdata(companion); |
78 | if (!companion_hcd) | 78 | if (!companion_hcd || !companion_hcd->self.root_hub) |
79 | continue; | 79 | continue; |
80 | fn(pdev, hcd, companion, companion_hcd); | 80 | fn(pdev, hcd, companion, companion_hcd); |
81 | } | 81 | } |
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index d1d8c47777c5..7f425acd9be5 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c | |||
@@ -212,6 +212,8 @@ static int exynos_ehci_suspend(struct device *dev) | |||
212 | int rc; | 212 | int rc; |
213 | 213 | ||
214 | rc = ehci_suspend(hcd, do_wakeup); | 214 | rc = ehci_suspend(hcd, do_wakeup); |
215 | if (rc) | ||
216 | return rc; | ||
215 | 217 | ||
216 | if (exynos_ehci->otg) | 218 | if (exynos_ehci->otg) |
217 | exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); | 219 | exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); |
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index b3a0e11073aa..c7dd93aad20c 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -303,6 +303,8 @@ static int ehci_platform_suspend(struct device *dev) | |||
303 | int ret; | 303 | int ret; |
304 | 304 | ||
305 | ret = ehci_suspend(hcd, do_wakeup); | 305 | ret = ehci_suspend(hcd, do_wakeup); |
306 | if (ret) | ||
307 | return ret; | ||
306 | 308 | ||
307 | if (pdata->power_suspend) | 309 | if (pdata->power_suspend) |
308 | pdata->power_suspend(pdev); | 310 | pdata->power_suspend(pdev); |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 27ac6ad53c3d..7ef00ecb0da1 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -509,8 +509,31 @@ static struct platform_driver tegra_ehci_driver = { | |||
509 | } | 509 | } |
510 | }; | 510 | }; |
511 | 511 | ||
512 | static int tegra_ehci_reset(struct usb_hcd *hcd) | ||
513 | { | ||
514 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
515 | int retval; | ||
516 | int txfifothresh; | ||
517 | |||
518 | retval = ehci_setup(hcd); | ||
519 | if (retval) | ||
520 | return retval; | ||
521 | |||
522 | /* | ||
523 | * We should really pull this value out of tegra_ehci_soc_config, but | ||
524 | * to avoid needing access to it, make use of the fact that Tegra20 is | ||
525 | * the only one so far that needs a value of 10, and Tegra20 is the | ||
526 | * only one which doesn't set has_hostpc. | ||
527 | */ | ||
528 | txfifothresh = ehci->has_hostpc ? 0x10 : 10; | ||
529 | ehci_writel(ehci, txfifothresh << 16, &ehci->regs->txfill_tuning); | ||
530 | |||
531 | return 0; | ||
532 | } | ||
533 | |||
512 | static const struct ehci_driver_overrides tegra_overrides __initconst = { | 534 | static const struct ehci_driver_overrides tegra_overrides __initconst = { |
513 | .extra_priv_size = sizeof(struct tegra_ehci_hcd), | 535 | .extra_priv_size = sizeof(struct tegra_ehci_hcd), |
536 | .reset = tegra_ehci_reset, | ||
514 | }; | 537 | }; |
515 | 538 | ||
516 | static int __init ehci_tegra_init(void) | 539 | static int __init ehci_tegra_init(void) |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index af8dc1b92d75..c2c221a332eb 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c | |||
@@ -82,14 +82,14 @@ static int ohci_jz4740_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
82 | u16 wIndex, char *buf, u16 wLength) | 82 | u16 wIndex, char *buf, u16 wLength) |
83 | { | 83 | { |
84 | struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd); | 84 | struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd); |
85 | int ret; | 85 | int ret = 0; |
86 | 86 | ||
87 | switch (typeReq) { | 87 | switch (typeReq) { |
88 | case SetHubFeature: | 88 | case SetPortFeature: |
89 | if (wValue == USB_PORT_FEAT_POWER) | 89 | if (wValue == USB_PORT_FEAT_POWER) |
90 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, true); | 90 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, true); |
91 | break; | 91 | break; |
92 | case ClearHubFeature: | 92 | case ClearPortFeature: |
93 | if (wValue == USB_PORT_FEAT_POWER) | 93 | if (wValue == USB_PORT_FEAT_POWER) |
94 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, false); | 94 | ret = ohci_jz4740_set_vbus_power(jz4740_ohci, false); |
95 | break; | 95 | break; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 95fa1217afdd..762e4a5f5ae9 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -104,6 +104,7 @@ static const struct usb_device_id id_table[] = { | |||
104 | { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ | 104 | { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ |
105 | { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ | 105 | { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ |
106 | { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ | 106 | { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ |
107 | { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ | ||
107 | { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ | 108 | { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ |
108 | { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ | 109 | { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ |
109 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | 110 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 44ab12986805..7c6e1dedeb06 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -909,6 +909,39 @@ static const struct usb_device_id id_table_combined[] = { | |||
909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, | 909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, |
910 | /* Cressi Devices */ | 910 | /* Cressi Devices */ |
911 | { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, | 911 | { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, |
912 | /* Brainboxes Devices */ | ||
913 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) }, | ||
914 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_012_PID) }, | ||
915 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) }, | ||
916 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) }, | ||
917 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) }, | ||
918 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) }, | ||
919 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) }, | ||
920 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) }, | ||
921 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_4_PID) }, | ||
922 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_5_PID) }, | ||
923 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) }, | ||
924 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) }, | ||
925 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) }, | ||
926 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) }, | ||
927 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) }, | ||
928 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) }, | ||
929 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) }, | ||
930 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) }, | ||
931 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) }, | ||
932 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) }, | ||
933 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) }, | ||
934 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) }, | ||
935 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_357_PID) }, | ||
936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_1_PID) }, | ||
937 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_2_PID) }, | ||
938 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_3_PID) }, | ||
939 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_1_PID) }, | ||
940 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_2_PID) }, | ||
941 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_1_PID) }, | ||
942 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, | ||
943 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, | ||
944 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, | ||
912 | { } /* Terminating entry */ | 945 | { } /* Terminating entry */ |
913 | }; | 946 | }; |
914 | 947 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index e599fbfcde5f..993c93df6874 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1326,3 +1326,40 @@ | |||
1326 | * Manufacturer: Cressi | 1326 | * Manufacturer: Cressi |
1327 | */ | 1327 | */ |
1328 | #define FTDI_CRESSI_PID 0x87d0 | 1328 | #define FTDI_CRESSI_PID 0x87d0 |
1329 | |||
1330 | /* | ||
1331 | * Brainboxes devices | ||
1332 | */ | ||
1333 | #define BRAINBOXES_VID 0x05d1 | ||
1334 | #define BRAINBOXES_VX_001_PID 0x1001 /* VX-001 ExpressCard 1 Port RS232 */ | ||
1335 | #define BRAINBOXES_VX_012_PID 0x1002 /* VX-012 ExpressCard 2 Port RS232 */ | ||
1336 | #define BRAINBOXES_VX_023_PID 0x1003 /* VX-023 ExpressCard 1 Port RS422/485 */ | ||
1337 | #define BRAINBOXES_VX_034_PID 0x1004 /* VX-034 ExpressCard 2 Port RS422/485 */ | ||
1338 | #define BRAINBOXES_US_101_PID 0x1011 /* US-101 1xRS232 */ | ||
1339 | #define BRAINBOXES_US_324_PID 0x1013 /* US-324 1xRS422/485 1Mbaud */ | ||
1340 | #define BRAINBOXES_US_606_1_PID 0x2001 /* US-606 6 Port RS232 Serial Port 1 and 2 */ | ||
1341 | #define BRAINBOXES_US_606_2_PID 0x2002 /* US-606 6 Port RS232 Serial Port 3 and 4 */ | ||
1342 | #define BRAINBOXES_US_606_3_PID 0x2003 /* US-606 6 Port RS232 Serial Port 4 and 6 */ | ||
1343 | #define BRAINBOXES_US_701_1_PID 0x2011 /* US-701 4xRS232 1Mbaud Port 1 and 2 */ | ||
1344 | #define BRAINBOXES_US_701_2_PID 0x2012 /* US-701 4xRS422 1Mbaud Port 3 and 4 */ | ||
1345 | #define BRAINBOXES_US_279_1_PID 0x2021 /* US-279 8xRS422 1Mbaud Port 1 and 2 */ | ||
1346 | #define BRAINBOXES_US_279_2_PID 0x2022 /* US-279 8xRS422 1Mbaud Port 3 and 4 */ | ||
1347 | #define BRAINBOXES_US_279_3_PID 0x2023 /* US-279 8xRS422 1Mbaud Port 5 and 6 */ | ||
1348 | #define BRAINBOXES_US_279_4_PID 0x2024 /* US-279 8xRS422 1Mbaud Port 7 and 8 */ | ||
1349 | #define BRAINBOXES_US_346_1_PID 0x3011 /* US-346 4xRS422/485 1Mbaud Port 1 and 2 */ | ||
1350 | #define BRAINBOXES_US_346_2_PID 0x3012 /* US-346 4xRS422/485 1Mbaud Port 3 and 4 */ | ||
1351 | #define BRAINBOXES_US_257_PID 0x5001 /* US-257 2xRS232 1Mbaud */ | ||
1352 | #define BRAINBOXES_US_313_PID 0x6001 /* US-313 2xRS422/485 1Mbaud */ | ||
1353 | #define BRAINBOXES_US_357_PID 0x7001 /* US_357 1xRS232/422/485 */ | ||
1354 | #define BRAINBOXES_US_842_1_PID 0x8001 /* US-842 8xRS422/485 1Mbaud Port 1 and 2 */ | ||
1355 | #define BRAINBOXES_US_842_2_PID 0x8002 /* US-842 8xRS422/485 1Mbaud Port 3 and 4 */ | ||
1356 | #define BRAINBOXES_US_842_3_PID 0x8003 /* US-842 8xRS422/485 1Mbaud Port 5 and 6 */ | ||
1357 | #define BRAINBOXES_US_842_4_PID 0x8004 /* US-842 8xRS422/485 1Mbaud Port 7 and 8 */ | ||
1358 | #define BRAINBOXES_US_160_1_PID 0x9001 /* US-160 16xRS232 1Mbaud Port 1 and 2 */ | ||
1359 | #define BRAINBOXES_US_160_2_PID 0x9002 /* US-160 16xRS232 1Mbaud Port 3 and 4 */ | ||
1360 | #define BRAINBOXES_US_160_3_PID 0x9003 /* US-160 16xRS232 1Mbaud Port 5 and 6 */ | ||
1361 | #define BRAINBOXES_US_160_4_PID 0x9004 /* US-160 16xRS232 1Mbaud Port 7 and 8 */ | ||
1362 | #define BRAINBOXES_US_160_5_PID 0x9005 /* US-160 16xRS232 1Mbaud Port 9 and 10 */ | ||
1363 | #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ | ||
1364 | #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ | ||
1365 | #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 68fc9fe65936..367c7f08b27c 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -243,6 +243,7 @@ static void option_instat_callback(struct urb *urb); | |||
243 | #define TELIT_PRODUCT_CC864_DUAL 0x1005 | 243 | #define TELIT_PRODUCT_CC864_DUAL 0x1005 |
244 | #define TELIT_PRODUCT_CC864_SINGLE 0x1006 | 244 | #define TELIT_PRODUCT_CC864_SINGLE 0x1006 |
245 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 | 245 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 |
246 | #define TELIT_PRODUCT_UE910_V2 0x1012 | ||
246 | #define TELIT_PRODUCT_LE920 0x1200 | 247 | #define TELIT_PRODUCT_LE920 0x1200 |
247 | 248 | ||
248 | /* ZTE PRODUCTS */ | 249 | /* ZTE PRODUCTS */ |
@@ -1041,6 +1042,7 @@ static const struct usb_device_id option_ids[] = { | |||
1041 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, | 1042 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, |
1042 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, | 1043 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
1043 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, | 1044 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
1045 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, | ||
1044 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), | 1046 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
1045 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, | 1047 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, |
1046 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ | 1048 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2e22fc22c382..b3d5a35c0d4b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -83,6 +83,9 @@ static const struct usb_device_id id_table[] = { | |||
83 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, | 83 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, |
84 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, | 84 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, |
85 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, | 85 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
86 | { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, | ||
87 | { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, | ||
88 | { USB_DEVICE(HP_VENDOR_ID, HP_LCM960_PRODUCT_ID) }, | ||
86 | { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, | 89 | { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, |
87 | { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) }, | 90 | { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) }, |
88 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, | 91 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index c38b8c00c06f..42bc082896ac 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -121,8 +121,11 @@ | |||
121 | #define SUPERIAL_VENDOR_ID 0x5372 | 121 | #define SUPERIAL_VENDOR_ID 0x5372 |
122 | #define SUPERIAL_PRODUCT_ID 0x2303 | 122 | #define SUPERIAL_PRODUCT_ID 0x2303 |
123 | 123 | ||
124 | /* Hewlett-Packard LD220-HP POS Pole Display */ | 124 | /* Hewlett-Packard POS Pole Displays */ |
125 | #define HP_VENDOR_ID 0x03f0 | 125 | #define HP_VENDOR_ID 0x03f0 |
126 | #define HP_LD960_PRODUCT_ID 0x0b39 | ||
127 | #define HP_LCM220_PRODUCT_ID 0x3139 | ||
128 | #define HP_LCM960_PRODUCT_ID 0x3239 | ||
126 | #define HP_LD220_PRODUCT_ID 0x3524 | 129 | #define HP_LD220_PRODUCT_ID 0x3524 |
127 | 130 | ||
128 | /* Cressi Edy (diving computer) PC interface */ | 131 | /* Cressi Edy (diving computer) PC interface */ |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index a9eb6221a815..6b192e602ce0 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -291,7 +291,6 @@ static const struct usb_device_id id_table[] = { | |||
291 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | 291 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ |
292 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 292 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
293 | }, | 293 | }, |
294 | { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ | ||
295 | 294 | ||
296 | { } | 295 | { } |
297 | }; | 296 | }; |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 640fe0173236..b078440e822f 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -466,6 +466,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port) | |||
466 | int err; | 466 | int err; |
467 | int i; | 467 | int i; |
468 | 468 | ||
469 | if (!port->bulk_in_size || !port->bulk_out_size) | ||
470 | return -ENODEV; | ||
471 | |||
469 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | 472 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
470 | if (!portdata) | 473 | if (!portdata) |
471 | return -ENOMEM; | 474 | return -ENOMEM; |
@@ -473,9 +476,6 @@ int usb_wwan_port_probe(struct usb_serial_port *port) | |||
473 | init_usb_anchor(&portdata->delayed); | 476 | init_usb_anchor(&portdata->delayed); |
474 | 477 | ||
475 | for (i = 0; i < N_IN_URB; i++) { | 478 | for (i = 0; i < N_IN_URB; i++) { |
476 | if (!port->bulk_in_size) | ||
477 | break; | ||
478 | |||
479 | buffer = (u8 *)__get_free_page(GFP_KERNEL); | 479 | buffer = (u8 *)__get_free_page(GFP_KERNEL); |
480 | if (!buffer) | 480 | if (!buffer) |
481 | goto bail_out_error; | 481 | goto bail_out_error; |
@@ -489,9 +489,6 @@ int usb_wwan_port_probe(struct usb_serial_port *port) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | for (i = 0; i < N_OUT_URB; i++) { | 491 | for (i = 0; i < N_OUT_URB; i++) { |
492 | if (!port->bulk_out_size) | ||
493 | break; | ||
494 | |||
495 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); | 492 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); |
496 | if (!buffer) | 493 | if (!buffer) |
497 | goto bail_out_error2; | 494 | goto bail_out_error2; |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index a7ac97cc5949..511b22953167 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -137,7 +137,7 @@ static void uas_do_work(struct work_struct *work) | |||
137 | if (!(cmdinfo->state & IS_IN_WORK_LIST)) | 137 | if (!(cmdinfo->state & IS_IN_WORK_LIST)) |
138 | continue; | 138 | continue; |
139 | 139 | ||
140 | err = uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_NOIO); | 140 | err = uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_ATOMIC); |
141 | if (!err) | 141 | if (!err) |
142 | cmdinfo->state &= ~IS_IN_WORK_LIST; | 142 | cmdinfo->state &= ~IS_IN_WORK_LIST; |
143 | else | 143 | else |
@@ -803,7 +803,7 @@ static int uas_eh_task_mgmt(struct scsi_cmnd *cmnd, | |||
803 | 803 | ||
804 | devinfo->running_task = 1; | 804 | devinfo->running_task = 1; |
805 | memset(&devinfo->response, 0, sizeof(devinfo->response)); | 805 | memset(&devinfo->response, 0, sizeof(devinfo->response)); |
806 | sense_urb = uas_submit_sense_urb(cmnd, GFP_NOIO, | 806 | sense_urb = uas_submit_sense_urb(cmnd, GFP_ATOMIC, |
807 | devinfo->use_streams ? tag : 0); | 807 | devinfo->use_streams ? tag : 0); |
808 | if (!sense_urb) { | 808 | if (!sense_urb) { |
809 | shost_printk(KERN_INFO, shost, | 809 | shost_printk(KERN_INFO, shost, |
@@ -813,7 +813,7 @@ static int uas_eh_task_mgmt(struct scsi_cmnd *cmnd, | |||
813 | spin_unlock_irqrestore(&devinfo->lock, flags); | 813 | spin_unlock_irqrestore(&devinfo->lock, flags); |
814 | return FAILED; | 814 | return FAILED; |
815 | } | 815 | } |
816 | if (uas_submit_task_urb(cmnd, GFP_NOIO, function, tag)) { | 816 | if (uas_submit_task_urb(cmnd, GFP_ATOMIC, function, tag)) { |
817 | shost_printk(KERN_INFO, shost, | 817 | shost_printk(KERN_INFO, shost, |
818 | "%s: %s: submit task mgmt urb failed\n", | 818 | "%s: %s: submit task mgmt urb failed\n", |
819 | __func__, fname); | 819 | __func__, fname); |
@@ -1030,7 +1030,7 @@ static int uas_configure_endpoints(struct uas_dev_info *devinfo) | |||
1030 | devinfo->use_streams = 0; | 1030 | devinfo->use_streams = 0; |
1031 | } else { | 1031 | } else { |
1032 | devinfo->qdepth = usb_alloc_streams(devinfo->intf, eps + 1, | 1032 | devinfo->qdepth = usb_alloc_streams(devinfo->intf, eps + 1, |
1033 | 3, 256, GFP_KERNEL); | 1033 | 3, 256, GFP_NOIO); |
1034 | if (devinfo->qdepth < 0) | 1034 | if (devinfo->qdepth < 0) |
1035 | return devinfo->qdepth; | 1035 | return devinfo->qdepth; |
1036 | devinfo->use_streams = 1; | 1036 | devinfo->use_streams = 1; |
@@ -1047,7 +1047,7 @@ static void uas_free_streams(struct uas_dev_info *devinfo) | |||
1047 | eps[0] = usb_pipe_endpoint(udev, devinfo->status_pipe); | 1047 | eps[0] = usb_pipe_endpoint(udev, devinfo->status_pipe); |
1048 | eps[1] = usb_pipe_endpoint(udev, devinfo->data_in_pipe); | 1048 | eps[1] = usb_pipe_endpoint(udev, devinfo->data_in_pipe); |
1049 | eps[2] = usb_pipe_endpoint(udev, devinfo->data_out_pipe); | 1049 | eps[2] = usb_pipe_endpoint(udev, devinfo->data_out_pipe); |
1050 | usb_free_streams(devinfo->intf, eps, 3, GFP_KERNEL); | 1050 | usb_free_streams(devinfo->intf, eps, 3, GFP_NOIO); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1053 | static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) |
@@ -1096,16 +1096,17 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1096 | if (result) | 1096 | if (result) |
1097 | goto free_streams; | 1097 | goto free_streams; |
1098 | 1098 | ||
1099 | usb_set_intfdata(intf, shost); | ||
1099 | result = scsi_add_host(shost, &intf->dev); | 1100 | result = scsi_add_host(shost, &intf->dev); |
1100 | if (result) | 1101 | if (result) |
1101 | goto free_streams; | 1102 | goto free_streams; |
1102 | 1103 | ||
1103 | scsi_scan_host(shost); | 1104 | scsi_scan_host(shost); |
1104 | usb_set_intfdata(intf, shost); | ||
1105 | return result; | 1105 | return result; |
1106 | 1106 | ||
1107 | free_streams: | 1107 | free_streams: |
1108 | uas_free_streams(devinfo); | 1108 | uas_free_streams(devinfo); |
1109 | usb_set_intfdata(intf, NULL); | ||
1109 | set_alt0: | 1110 | set_alt0: |
1110 | usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); | 1111 | usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); |
1111 | if (shost) | 1112 | if (shost) |
diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c index d771870a819e..6dfd30a863c7 100644 --- a/drivers/usb/usb-common.c +++ b/drivers/usb/usb-common.c | |||
@@ -69,7 +69,7 @@ const char *usb_state_string(enum usb_device_state state) | |||
69 | [USB_STATE_RECONNECTING] = "reconnecting", | 69 | [USB_STATE_RECONNECTING] = "reconnecting", |
70 | [USB_STATE_UNAUTHENTICATED] = "unauthenticated", | 70 | [USB_STATE_UNAUTHENTICATED] = "unauthenticated", |
71 | [USB_STATE_DEFAULT] = "default", | 71 | [USB_STATE_DEFAULT] = "default", |
72 | [USB_STATE_ADDRESS] = "addresssed", | 72 | [USB_STATE_ADDRESS] = "addressed", |
73 | [USB_STATE_CONFIGURED] = "configured", | 73 | [USB_STATE_CONFIGURED] = "configured", |
74 | [USB_STATE_SUSPENDED] = "suspended", | 74 | [USB_STATE_SUSPENDED] = "suspended", |
75 | }; | 75 | }; |
diff --git a/drivers/uwb/drp.c b/drivers/uwb/drp.c index 16ada8341c46..1a2fd9795367 100644 --- a/drivers/uwb/drp.c +++ b/drivers/uwb/drp.c | |||
@@ -599,8 +599,11 @@ static void uwb_drp_handle_alien_drp(struct uwb_rc *rc, struct uwb_ie_drp *drp_i | |||
599 | 599 | ||
600 | /* alloc and initialize new uwb_cnflt_alien */ | 600 | /* alloc and initialize new uwb_cnflt_alien */ |
601 | cnflt = kzalloc(sizeof(struct uwb_cnflt_alien), GFP_KERNEL); | 601 | cnflt = kzalloc(sizeof(struct uwb_cnflt_alien), GFP_KERNEL); |
602 | if (!cnflt) | 602 | if (!cnflt) { |
603 | dev_err(dev, "failed to alloc uwb_cnflt_alien struct\n"); | 603 | dev_err(dev, "failed to alloc uwb_cnflt_alien struct\n"); |
604 | return; | ||
605 | } | ||
606 | |||
604 | INIT_LIST_HEAD(&cnflt->rc_node); | 607 | INIT_LIST_HEAD(&cnflt->rc_node); |
605 | init_timer(&cnflt->timer); | 608 | init_timer(&cnflt->timer); |
606 | cnflt->timer.function = uwb_cnflt_timer; | 609 | cnflt->timer.function = uwb_cnflt_timer; |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6c793bc683d9..c7b4f0f927b1 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -21,7 +21,15 @@ source "drivers/gpu/vga/Kconfig" | |||
21 | 21 | ||
22 | source "drivers/gpu/host1x/Kconfig" | 22 | source "drivers/gpu/host1x/Kconfig" |
23 | 23 | ||
24 | menu "Direct Rendering Manager" | ||
24 | source "drivers/gpu/drm/Kconfig" | 25 | source "drivers/gpu/drm/Kconfig" |
26 | endmenu | ||
27 | |||
28 | menu "Frame buffer Devices" | ||
29 | source "drivers/video/fbdev/Kconfig" | ||
30 | endmenu | ||
31 | |||
32 | source "drivers/video/backlight/Kconfig" | ||
25 | 33 | ||
26 | config VGASTATE | 34 | config VGASTATE |
27 | tristate | 35 | tristate |
@@ -33,2482 +41,14 @@ config VIDEOMODE_HELPERS | |||
33 | config HDMI | 41 | config HDMI |
34 | bool | 42 | bool |
35 | 43 | ||
36 | menuconfig FB | ||
37 | tristate "Support for frame buffer devices" | ||
38 | ---help--- | ||
39 | The frame buffer device provides an abstraction for the graphics | ||
40 | hardware. It represents the frame buffer of some video hardware and | ||
41 | allows application software to access the graphics hardware through | ||
42 | a well-defined interface, so the software doesn't need to know | ||
43 | anything about the low-level (hardware register) stuff. | ||
44 | |||
45 | Frame buffer devices work identically across the different | ||
46 | architectures supported by Linux and make the implementation of | ||
47 | application programs easier and more portable; at this point, an X | ||
48 | server exists which uses the frame buffer device exclusively. | ||
49 | On several non-X86 architectures, the frame buffer device is the | ||
50 | only way to use the graphics hardware. | ||
51 | |||
52 | The device is accessed through special device nodes, usually located | ||
53 | in the /dev directory, i.e. /dev/fb*. | ||
54 | |||
55 | You need an utility program called fbset to make full use of frame | ||
56 | buffer devices. Please read <file:Documentation/fb/framebuffer.txt> | ||
57 | and the Framebuffer-HOWTO at | ||
58 | <http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.3.html> for more | ||
59 | information. | ||
60 | |||
61 | Say Y here and to the driver for your graphics board below if you | ||
62 | are compiling a kernel for a non-x86 architecture. | ||
63 | |||
64 | If you are compiling for the x86 architecture, you can say Y if you | ||
65 | want to play with it, but it is not essential. Please note that | ||
66 | running graphical applications that directly touch the hardware | ||
67 | (e.g. an accelerated X server) and that are not frame buffer | ||
68 | device-aware may cause unexpected results. If unsure, say N. | ||
69 | |||
70 | config FIRMWARE_EDID | ||
71 | bool "Enable firmware EDID" | ||
72 | depends on FB | ||
73 | default n | ||
74 | ---help--- | ||
75 | This enables access to the EDID transferred from the firmware. | ||
76 | On the i386, this is from the Video BIOS. Enable this if DDC/I2C | ||
77 | transfers do not work for your driver and if you are using | ||
78 | nvidiafb, i810fb or savagefb. | ||
79 | |||
80 | In general, choosing Y for this option is safe. If you | ||
81 | experience extremely long delays while booting before you get | ||
82 | something on your display, try setting this to N. Matrox cards in | ||
83 | combination with certain motherboards and monitors are known to | ||
84 | suffer from this problem. | ||
85 | |||
86 | config FB_DDC | ||
87 | tristate | ||
88 | depends on FB | ||
89 | select I2C_ALGOBIT | ||
90 | select I2C | ||
91 | default n | ||
92 | |||
93 | config FB_BOOT_VESA_SUPPORT | ||
94 | bool | ||
95 | depends on FB | ||
96 | default n | ||
97 | ---help--- | ||
98 | If true, at least one selected framebuffer driver can take advantage | ||
99 | of VESA video modes set at an early boot stage via the vga= parameter. | ||
100 | |||
101 | config FB_CFB_FILLRECT | ||
102 | tristate | ||
103 | depends on FB | ||
104 | default n | ||
105 | ---help--- | ||
106 | Include the cfb_fillrect function for generic software rectangle | ||
107 | filling. This is used by drivers that don't provide their own | ||
108 | (accelerated) version. | ||
109 | |||
110 | config FB_CFB_COPYAREA | ||
111 | tristate | ||
112 | depends on FB | ||
113 | default n | ||
114 | ---help--- | ||
115 | Include the cfb_copyarea function for generic software area copying. | ||
116 | This is used by drivers that don't provide their own (accelerated) | ||
117 | version. | ||
118 | |||
119 | config FB_CFB_IMAGEBLIT | ||
120 | tristate | ||
121 | depends on FB | ||
122 | default n | ||
123 | ---help--- | ||
124 | Include the cfb_imageblit function for generic software image | ||
125 | blitting. This is used by drivers that don't provide their own | ||
126 | (accelerated) version. | ||
127 | |||
128 | config FB_CFB_REV_PIXELS_IN_BYTE | ||
129 | bool | ||
130 | depends on FB | ||
131 | default n | ||
132 | ---help--- | ||
133 | Allow generic frame-buffer functions to work on displays with 1, 2 | ||
134 | and 4 bits per pixel depths which has opposite order of pixels in | ||
135 | byte order to bytes in long order. | ||
136 | |||
137 | config FB_SYS_FILLRECT | ||
138 | tristate | ||
139 | depends on FB | ||
140 | default n | ||
141 | ---help--- | ||
142 | Include the sys_fillrect function for generic software rectangle | ||
143 | filling. This is used by drivers that don't provide their own | ||
144 | (accelerated) version and the framebuffer is in system RAM. | ||
145 | |||
146 | config FB_SYS_COPYAREA | ||
147 | tristate | ||
148 | depends on FB | ||
149 | default n | ||
150 | ---help--- | ||
151 | Include the sys_copyarea function for generic software area copying. | ||
152 | This is used by drivers that don't provide their own (accelerated) | ||
153 | version and the framebuffer is in system RAM. | ||
154 | |||
155 | config FB_SYS_IMAGEBLIT | ||
156 | tristate | ||
157 | depends on FB | ||
158 | default n | ||
159 | ---help--- | ||
160 | Include the sys_imageblit function for generic software image | ||
161 | blitting. This is used by drivers that don't provide their own | ||
162 | (accelerated) version and the framebuffer is in system RAM. | ||
163 | |||
164 | menuconfig FB_FOREIGN_ENDIAN | ||
165 | bool "Framebuffer foreign endianness support" | ||
166 | depends on FB | ||
167 | ---help--- | ||
168 | This menu will let you enable support for the framebuffers with | ||
169 | non-native endianness (e.g. Little-Endian framebuffer on a | ||
170 | Big-Endian machine). Most probably you don't have such hardware, | ||
171 | so it's safe to say "n" here. | ||
172 | |||
173 | choice | ||
174 | prompt "Choice endianness support" | ||
175 | depends on FB_FOREIGN_ENDIAN | ||
176 | |||
177 | config FB_BOTH_ENDIAN | ||
178 | bool "Support for Big- and Little-Endian framebuffers" | ||
179 | |||
180 | config FB_BIG_ENDIAN | ||
181 | bool "Support for Big-Endian framebuffers only" | ||
182 | |||
183 | config FB_LITTLE_ENDIAN | ||
184 | bool "Support for Little-Endian framebuffers only" | ||
185 | |||
186 | endchoice | ||
187 | |||
188 | config FB_SYS_FOPS | ||
189 | tristate | ||
190 | depends on FB | ||
191 | default n | ||
192 | |||
193 | config FB_DEFERRED_IO | ||
194 | bool | ||
195 | depends on FB | ||
196 | |||
197 | config FB_HECUBA | ||
198 | tristate | ||
199 | depends on FB | ||
200 | depends on FB_DEFERRED_IO | ||
201 | |||
202 | config FB_SVGALIB | ||
203 | tristate | ||
204 | depends on FB | ||
205 | default n | ||
206 | ---help--- | ||
207 | Common utility functions useful to fbdev drivers of VGA-based | ||
208 | cards. | ||
209 | |||
210 | config FB_MACMODES | ||
211 | tristate | ||
212 | depends on FB | ||
213 | default n | ||
214 | |||
215 | config FB_BACKLIGHT | ||
216 | bool | ||
217 | depends on FB | ||
218 | select BACKLIGHT_LCD_SUPPORT | ||
219 | select BACKLIGHT_CLASS_DEVICE | ||
220 | default n | ||
221 | |||
222 | config FB_MODE_HELPERS | ||
223 | bool "Enable Video Mode Handling Helpers" | ||
224 | depends on FB | ||
225 | default n | ||
226 | ---help--- | ||
227 | This enables functions for handling video modes using the | ||
228 | Generalized Timing Formula and the EDID parser. A few drivers rely | ||
229 | on this feature such as the radeonfb, rivafb, and the i810fb. If | ||
230 | your driver does not take advantage of this feature, choosing Y will | ||
231 | just increase the kernel size by about 5K. | ||
232 | |||
233 | config FB_TILEBLITTING | ||
234 | bool "Enable Tile Blitting Support" | ||
235 | depends on FB | ||
236 | default n | ||
237 | ---help--- | ||
238 | This enables tile blitting. Tile blitting is a drawing technique | ||
239 | where the screen is divided into rectangular sections (tiles), whereas | ||
240 | the standard blitting divides the screen into pixels. Because the | ||
241 | default drawing element is a tile, drawing functions will be passed | ||
242 | parameters in terms of number of tiles instead of number of pixels. | ||
243 | For example, to draw a single character, instead of using bitmaps, | ||
244 | an index to an array of bitmaps will be used. To clear or move a | ||
245 | rectangular section of a screen, the rectangle will be described in | ||
246 | terms of number of tiles in the x- and y-axis. | ||
247 | |||
248 | This is particularly important to one driver, matroxfb. If | ||
249 | unsure, say N. | ||
250 | |||
251 | comment "Frame buffer hardware drivers" | ||
252 | depends on FB | ||
253 | |||
254 | config FB_GRVGA | ||
255 | tristate "Aeroflex Gaisler framebuffer support" | ||
256 | depends on FB && SPARC | ||
257 | select FB_CFB_FILLRECT | ||
258 | select FB_CFB_COPYAREA | ||
259 | select FB_CFB_IMAGEBLIT | ||
260 | ---help--- | ||
261 | This enables support for the SVGACTRL framebuffer in the GRLIB IP library from Aeroflex Gaisler. | ||
262 | |||
263 | config FB_CIRRUS | ||
264 | tristate "Cirrus Logic support" | ||
265 | depends on FB && (ZORRO || PCI) | ||
266 | select FB_CFB_FILLRECT | ||
267 | select FB_CFB_COPYAREA | ||
268 | select FB_CFB_IMAGEBLIT | ||
269 | ---help--- | ||
270 | This enables support for Cirrus Logic GD542x/543x based boards on | ||
271 | Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum. | ||
272 | |||
273 | If you have a PCI-based system, this enables support for these | ||
274 | chips: GD-543x, GD-544x, GD-5480. | ||
275 | |||
276 | Please read the file <file:Documentation/fb/cirrusfb.txt>. | ||
277 | |||
278 | Say N unless you have such a graphics board or plan to get one | ||
279 | before you next recompile the kernel. | ||
280 | |||
281 | config FB_PM2 | ||
282 | tristate "Permedia2 support" | ||
283 | depends on FB && ((AMIGA && BROKEN) || PCI) | ||
284 | select FB_CFB_FILLRECT | ||
285 | select FB_CFB_COPYAREA | ||
286 | select FB_CFB_IMAGEBLIT | ||
287 | help | ||
288 | This is the frame buffer device driver for cards based on | ||
289 | the 3D Labs Permedia, Permedia 2 and Permedia 2V chips. | ||
290 | The driver was tested on the following cards: | ||
291 | Diamond FireGL 1000 PRO AGP | ||
292 | ELSA Gloria Synergy PCI | ||
293 | Appian Jeronimo PRO (both heads) PCI | ||
294 | 3DLabs Oxygen ACX aka EONtronics Picasso P2 PCI | ||
295 | Techsource Raptor GFX-8P (aka Sun PGX-32) on SPARC | ||
296 | ASK Graphic Blaster Exxtreme AGP | ||
297 | |||
298 | To compile this driver as a module, choose M here: the | ||
299 | module will be called pm2fb. | ||
300 | |||
301 | config FB_PM2_FIFO_DISCONNECT | ||
302 | bool "enable FIFO disconnect feature" | ||
303 | depends on FB_PM2 && PCI | ||
304 | help | ||
305 | Support the Permedia2 FIFO disconnect feature. | ||
306 | |||
307 | config FB_ARMCLCD | ||
308 | tristate "ARM PrimeCell PL110 support" | ||
309 | depends on ARM || ARM64 || COMPILE_TEST | ||
310 | depends on FB && ARM_AMBA | ||
311 | select FB_CFB_FILLRECT | ||
312 | select FB_CFB_COPYAREA | ||
313 | select FB_CFB_IMAGEBLIT | ||
314 | help | ||
315 | This framebuffer device driver is for the ARM PrimeCell PL110 | ||
316 | Colour LCD controller. ARM PrimeCells provide the building | ||
317 | blocks for System on a Chip devices. | ||
318 | |||
319 | If you want to compile this as a module (=code which can be | ||
320 | inserted into and removed from the running kernel), say M | ||
321 | here and read <file:Documentation/kbuild/modules.txt>. The module | ||
322 | will be called amba-clcd. | ||
323 | |||
324 | config FB_ACORN | ||
325 | bool "Acorn VIDC support" | ||
326 | depends on (FB = y) && ARM && ARCH_ACORN | ||
327 | select FB_CFB_FILLRECT | ||
328 | select FB_CFB_COPYAREA | ||
329 | select FB_CFB_IMAGEBLIT | ||
330 | help | ||
331 | This is the frame buffer device driver for the Acorn VIDC graphics | ||
332 | hardware found in Acorn RISC PCs and other ARM-based machines. If | ||
333 | unsure, say N. | ||
334 | |||
335 | config FB_CLPS711X | ||
336 | bool "CLPS711X LCD support" | ||
337 | depends on (FB = y) && ARM && ARCH_CLPS711X | ||
338 | select FB_CFB_FILLRECT | ||
339 | select FB_CFB_COPYAREA | ||
340 | select FB_CFB_IMAGEBLIT | ||
341 | help | ||
342 | Say Y to enable the Framebuffer driver for the CLPS7111 and | ||
343 | EP7212 processors. | ||
344 | |||
345 | config FB_SA1100 | ||
346 | bool "SA-1100 LCD support" | ||
347 | depends on (FB = y) && ARM && ARCH_SA1100 | ||
348 | select FB_CFB_FILLRECT | ||
349 | select FB_CFB_COPYAREA | ||
350 | select FB_CFB_IMAGEBLIT | ||
351 | help | ||
352 | This is a framebuffer device for the SA-1100 LCD Controller. | ||
353 | See <http://www.linux-fbdev.org/> for information on framebuffer | ||
354 | devices. | ||
355 | |||
356 | If you plan to use the LCD display with your SA-1100 system, say | ||
357 | Y here. | ||
358 | |||
359 | config FB_IMX | ||
360 | tristate "Freescale i.MX1/21/25/27 LCD support" | ||
361 | depends on FB && ARCH_MXC | ||
362 | select FB_CFB_FILLRECT | ||
363 | select FB_CFB_COPYAREA | ||
364 | select FB_CFB_IMAGEBLIT | ||
365 | select FB_MODE_HELPERS | ||
366 | select VIDEOMODE_HELPERS | ||
367 | |||
368 | config FB_CYBER2000 | ||
369 | tristate "CyberPro 2000/2010/5000 support" | ||
370 | depends on FB && PCI && (BROKEN || !SPARC64) | ||
371 | select FB_CFB_FILLRECT | ||
372 | select FB_CFB_COPYAREA | ||
373 | select FB_CFB_IMAGEBLIT | ||
374 | help | ||
375 | This enables support for the Integraphics CyberPro 20x0 and 5000 | ||
376 | VGA chips used in the Rebel.com Netwinder and other machines. | ||
377 | Say Y if you have a NetWinder or a graphics card containing this | ||
378 | device, otherwise say N. | ||
379 | |||
380 | config FB_CYBER2000_DDC | ||
381 | bool "DDC for CyberPro support" | ||
382 | depends on FB_CYBER2000 | ||
383 | select FB_DDC | ||
384 | default y | ||
385 | help | ||
386 | Say Y here if you want DDC support for your CyberPro graphics | ||
387 | card. This is only I2C bus support, driver does not use EDID. | ||
388 | |||
389 | config FB_CYBER2000_I2C | ||
390 | bool "CyberPro 2000/2010/5000 I2C support" | ||
391 | depends on FB_CYBER2000 && I2C && ARCH_NETWINDER | ||
392 | select I2C_ALGOBIT | ||
393 | help | ||
394 | Enable support for the I2C video decoder interface on the | ||
395 | Integraphics CyberPro 20x0 and 5000 VGA chips. This is used | ||
396 | on the Netwinder machines for the SAA7111 video capture. | ||
397 | |||
398 | config FB_APOLLO | ||
399 | bool | ||
400 | depends on (FB = y) && APOLLO | ||
401 | default y | ||
402 | select FB_CFB_FILLRECT | ||
403 | select FB_CFB_IMAGEBLIT | ||
404 | |||
405 | config FB_Q40 | ||
406 | bool | ||
407 | depends on (FB = y) && Q40 | ||
408 | default y | ||
409 | select FB_CFB_FILLRECT | ||
410 | select FB_CFB_COPYAREA | ||
411 | select FB_CFB_IMAGEBLIT | ||
412 | |||
413 | config FB_AMIGA | ||
414 | tristate "Amiga native chipset support" | ||
415 | depends on FB && AMIGA | ||
416 | help | ||
417 | This is the frame buffer device driver for the builtin graphics | ||
418 | chipset found in Amigas. | ||
419 | |||
420 | To compile this driver as a module, choose M here: the | ||
421 | module will be called amifb. | ||
422 | |||
423 | config FB_AMIGA_OCS | ||
424 | bool "Amiga OCS chipset support" | ||
425 | depends on FB_AMIGA | ||
426 | help | ||
427 | This enables support for the original Agnus and Denise video chips, | ||
428 | found in the Amiga 1000 and most A500's and A2000's. If you intend | ||
429 | to run Linux on any of these systems, say Y; otherwise say N. | ||
430 | |||
431 | config FB_AMIGA_ECS | ||
432 | bool "Amiga ECS chipset support" | ||
433 | depends on FB_AMIGA | ||
434 | help | ||
435 | This enables support for the Enhanced Chip Set, found in later | ||
436 | A500's, later A2000's, the A600, the A3000, the A3000T and CDTV. If | ||
437 | you intend to run Linux on any of these systems, say Y; otherwise | ||
438 | say N. | ||
439 | |||
440 | config FB_AMIGA_AGA | ||
441 | bool "Amiga AGA chipset support" | ||
442 | depends on FB_AMIGA | ||
443 | help | ||
444 | This enables support for the Advanced Graphics Architecture (also | ||
445 | known as the AGA or AA) Chip Set, found in the A1200, A4000, A4000T | ||
446 | and CD32. If you intend to run Linux on any of these systems, say Y; | ||
447 | otherwise say N. | ||
448 | |||
449 | config FB_FM2 | ||
450 | bool "Amiga FrameMaster II/Rainbow II support" | ||
451 | depends on (FB = y) && ZORRO | ||
452 | select FB_CFB_FILLRECT | ||
453 | select FB_CFB_COPYAREA | ||
454 | select FB_CFB_IMAGEBLIT | ||
455 | help | ||
456 | This is the frame buffer device driver for the Amiga FrameMaster | ||
457 | card from BSC (exhibited 1992 but not shipped as a CBM product). | ||
458 | |||
459 | config FB_ARC | ||
460 | tristate "Arc Monochrome LCD board support" | ||
461 | depends on FB && X86 | ||
462 | select FB_SYS_FILLRECT | ||
463 | select FB_SYS_COPYAREA | ||
464 | select FB_SYS_IMAGEBLIT | ||
465 | select FB_SYS_FOPS | ||
466 | help | ||
467 | This enables support for the Arc Monochrome LCD board. The board | ||
468 | is based on the KS-108 lcd controller and is typically a matrix | ||
469 | of 2*n chips. This driver was tested with a 128x64 panel. This | ||
470 | driver supports it for use with x86 SBCs through a 16 bit GPIO | ||
471 | interface (8 bit data, 8 bit control). If you anticipate using | ||
472 | this driver, say Y or M; otherwise say N. You must specify the | ||
473 | GPIO IO address to be used for setting control and data. | ||
474 | |||
475 | config FB_ATARI | ||
476 | bool "Atari native chipset support" | ||
477 | depends on (FB = y) && ATARI | ||
478 | select FB_CFB_FILLRECT | ||
479 | select FB_CFB_COPYAREA | ||
480 | select FB_CFB_IMAGEBLIT | ||
481 | help | ||
482 | This is the frame buffer device driver for the builtin graphics | ||
483 | chipset found in Ataris. | ||
484 | |||
485 | config FB_OF | ||
486 | bool "Open Firmware frame buffer device support" | ||
487 | depends on (FB = y) && (PPC64 || PPC_OF) && (!PPC_PSERIES || PCI) | ||
488 | select FB_CFB_FILLRECT | ||
489 | select FB_CFB_COPYAREA | ||
490 | select FB_CFB_IMAGEBLIT | ||
491 | select FB_MACMODES | ||
492 | help | ||
493 | Say Y if you want support with Open Firmware for your graphics | ||
494 | board. | ||
495 | |||
496 | config FB_CONTROL | ||
497 | bool "Apple \"control\" display support" | ||
498 | depends on (FB = y) && PPC_PMAC && PPC32 | ||
499 | select FB_CFB_FILLRECT | ||
500 | select FB_CFB_COPYAREA | ||
501 | select FB_CFB_IMAGEBLIT | ||
502 | select FB_MACMODES | ||
503 | help | ||
504 | This driver supports a frame buffer for the graphics adapter in the | ||
505 | Power Macintosh 7300 and others. | ||
506 | |||
507 | config FB_PLATINUM | ||
508 | bool "Apple \"platinum\" display support" | ||
509 | depends on (FB = y) && PPC_PMAC && PPC32 | ||
510 | select FB_CFB_FILLRECT | ||
511 | select FB_CFB_COPYAREA | ||
512 | select FB_CFB_IMAGEBLIT | ||
513 | select FB_MACMODES | ||
514 | help | ||
515 | This driver supports a frame buffer for the "platinum" graphics | ||
516 | adapter in some Power Macintoshes. | ||
517 | |||
518 | config FB_VALKYRIE | ||
519 | bool "Apple \"valkyrie\" display support" | ||
520 | depends on (FB = y) && (MAC || (PPC_PMAC && PPC32)) | ||
521 | select FB_CFB_FILLRECT | ||
522 | select FB_CFB_COPYAREA | ||
523 | select FB_CFB_IMAGEBLIT | ||
524 | select FB_MACMODES | ||
525 | help | ||
526 | This driver supports a frame buffer for the "valkyrie" graphics | ||
527 | adapter in some Power Macintoshes. | ||
528 | |||
529 | config FB_CT65550 | ||
530 | bool "Chips 65550 display support" | ||
531 | depends on (FB = y) && PPC32 && PCI | ||
532 | select FB_CFB_FILLRECT | ||
533 | select FB_CFB_COPYAREA | ||
534 | select FB_CFB_IMAGEBLIT | ||
535 | help | ||
536 | This is the frame buffer device driver for the Chips & Technologies | ||
537 | 65550 graphics chip in PowerBooks. | ||
538 | |||
539 | config FB_ASILIANT | ||
540 | bool "Asiliant (Chips) 69000 display support" | ||
541 | depends on (FB = y) && PCI | ||
542 | select FB_CFB_FILLRECT | ||
543 | select FB_CFB_COPYAREA | ||
544 | select FB_CFB_IMAGEBLIT | ||
545 | help | ||
546 | This is the frame buffer device driver for the Asiliant 69030 chipset | ||
547 | |||
548 | config FB_IMSTT | ||
549 | bool "IMS Twin Turbo display support" | ||
550 | depends on (FB = y) && PCI | ||
551 | select FB_CFB_IMAGEBLIT | ||
552 | select FB_MACMODES if PPC | ||
553 | help | ||
554 | The IMS Twin Turbo is a PCI-based frame buffer card bundled with | ||
555 | many Macintosh and compatible computers. | ||
556 | |||
557 | config FB_VGA16 | ||
558 | tristate "VGA 16-color graphics support" | ||
559 | depends on FB && (X86 || PPC) | ||
560 | select FB_CFB_FILLRECT | ||
561 | select FB_CFB_COPYAREA | ||
562 | select FB_CFB_IMAGEBLIT | ||
563 | select VGASTATE | ||
564 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
565 | help | ||
566 | This is the frame buffer device driver for VGA 16 color graphic | ||
567 | cards. Say Y if you have such a card. | ||
568 | |||
569 | To compile this driver as a module, choose M here: the | ||
570 | module will be called vga16fb. | ||
571 | |||
572 | config FB_BF54X_LQ043 | ||
573 | tristate "SHARP LQ043 TFT LCD (BF548 EZKIT)" | ||
574 | depends on FB && (BF54x) && !BF542 | ||
575 | select FB_CFB_FILLRECT | ||
576 | select FB_CFB_COPYAREA | ||
577 | select FB_CFB_IMAGEBLIT | ||
578 | help | ||
579 | This is the framebuffer device driver for a SHARP LQ043T1DG01 TFT LCD | ||
580 | |||
581 | config FB_BFIN_T350MCQB | ||
582 | tristate "Varitronix COG-T350MCQB TFT LCD display (BF527 EZKIT)" | ||
583 | depends on FB && BLACKFIN | ||
584 | select BFIN_GPTIMERS | ||
585 | select FB_CFB_FILLRECT | ||
586 | select FB_CFB_COPYAREA | ||
587 | select FB_CFB_IMAGEBLIT | ||
588 | help | ||
589 | This is the framebuffer device driver for a Varitronix VL-PS-COG-T350MCQB-01 display TFT LCD | ||
590 | This display is a QVGA 320x240 24-bit RGB display interfaced by an 8-bit wide PPI | ||
591 | It uses PPI[0..7] PPI_FS1, PPI_FS2 and PPI_CLK. | ||
592 | |||
593 | config FB_BFIN_LQ035Q1 | ||
594 | tristate "SHARP LQ035Q1DH02 TFT LCD" | ||
595 | depends on FB && BLACKFIN && SPI | ||
596 | select FB_CFB_FILLRECT | ||
597 | select FB_CFB_COPYAREA | ||
598 | select FB_CFB_IMAGEBLIT | ||
599 | select BFIN_GPTIMERS | ||
600 | help | ||
601 | This is the framebuffer device driver for a SHARP LQ035Q1DH02 TFT display found on | ||
602 | the Blackfin Landscape LCD EZ-Extender Card. | ||
603 | This display is a QVGA 320x240 18-bit RGB display interfaced by an 16-bit wide PPI | ||
604 | It uses PPI[0..15] PPI_FS1, PPI_FS2 and PPI_CLK. | ||
605 | |||
606 | To compile this driver as a module, choose M here: the | ||
607 | module will be called bfin-lq035q1-fb. | ||
608 | |||
609 | config FB_BF537_LQ035 | ||
610 | tristate "SHARP LQ035 TFT LCD (BF537 STAMP)" | ||
611 | depends on FB && (BF534 || BF536 || BF537) && I2C_BLACKFIN_TWI | ||
612 | select FB_CFB_FILLRECT | ||
613 | select FB_CFB_COPYAREA | ||
614 | select FB_CFB_IMAGEBLIT | ||
615 | select BFIN_GPTIMERS | ||
616 | help | ||
617 | This is the framebuffer device for a SHARP LQ035Q7DB03 TFT LCD | ||
618 | attached to a BF537. | ||
619 | |||
620 | To compile this driver as a module, choose M here: the | ||
621 | module will be called bf537-lq035. | ||
622 | |||
623 | config FB_BFIN_7393 | ||
624 | tristate "Blackfin ADV7393 Video encoder" | ||
625 | depends on FB && BLACKFIN | ||
626 | select I2C | ||
627 | select FB_CFB_FILLRECT | ||
628 | select FB_CFB_COPYAREA | ||
629 | select FB_CFB_IMAGEBLIT | ||
630 | help | ||
631 | This is the framebuffer device for a ADV7393 video encoder | ||
632 | attached to a Blackfin on the PPI port. | ||
633 | If your Blackfin board has a ADV7393 select Y. | ||
634 | |||
635 | To compile this driver as a module, choose M here: the | ||
636 | module will be called bfin_adv7393fb. | ||
637 | |||
638 | choice | ||
639 | prompt "Video mode support" | ||
640 | depends on FB_BFIN_7393 | ||
641 | default NTSC | ||
642 | |||
643 | config NTSC | ||
644 | bool 'NTSC 720x480' | ||
645 | |||
646 | config PAL | ||
647 | bool 'PAL 720x576' | ||
648 | |||
649 | config NTSC_640x480 | ||
650 | bool 'NTSC 640x480 (Experimental)' | ||
651 | |||
652 | config PAL_640x480 | ||
653 | bool 'PAL 640x480 (Experimental)' | ||
654 | |||
655 | config NTSC_YCBCR | ||
656 | bool 'NTSC 720x480 YCbCR input' | ||
657 | |||
658 | config PAL_YCBCR | ||
659 | bool 'PAL 720x576 YCbCR input' | ||
660 | |||
661 | endchoice | ||
662 | |||
663 | choice | ||
664 | prompt "Size of ADV7393 frame buffer memory Single/Double Size" | ||
665 | depends on (FB_BFIN_7393) | ||
666 | default ADV7393_1XMEM | ||
667 | |||
668 | config ADV7393_1XMEM | ||
669 | bool 'Single' | ||
670 | |||
671 | config ADV7393_2XMEM | ||
672 | bool 'Double' | ||
673 | endchoice | ||
674 | |||
675 | config FB_STI | ||
676 | tristate "HP STI frame buffer device support" | ||
677 | depends on FB && PARISC | ||
678 | select FB_CFB_FILLRECT | ||
679 | select FB_CFB_COPYAREA | ||
680 | select FB_CFB_IMAGEBLIT | ||
681 | select STI_CONSOLE | ||
682 | select VT | ||
683 | default y | ||
684 | ---help--- | ||
685 | STI refers to the HP "Standard Text Interface" which is a set of | ||
686 | BIOS routines contained in a ROM chip in HP PA-RISC based machines. | ||
687 | Enabling this option will implement the linux framebuffer device | ||
688 | using calls to the STI BIOS routines for initialisation. | ||
689 | |||
690 | If you enable this option, you will get a planar framebuffer device | ||
691 | /dev/fb which will work on the most common HP graphic cards of the | ||
692 | NGLE family, including the artist chips (in the 7xx and Bxxx series), | ||
693 | HCRX, HCRX24, CRX, CRX24 and VisEG series. | ||
694 | |||
695 | It is safe to enable this option, so you should probably say "Y". | ||
696 | |||
697 | config FB_MAC | ||
698 | bool "Generic Macintosh display support" | ||
699 | depends on (FB = y) && MAC | ||
700 | select FB_CFB_FILLRECT | ||
701 | select FB_CFB_COPYAREA | ||
702 | select FB_CFB_IMAGEBLIT | ||
703 | select FB_MACMODES | ||
704 | |||
705 | config FB_HP300 | ||
706 | bool | ||
707 | depends on (FB = y) && DIO | ||
708 | select FB_CFB_IMAGEBLIT | ||
709 | default y | ||
710 | |||
711 | config FB_TGA | ||
712 | tristate "TGA/SFB+ framebuffer support" | ||
713 | depends on FB && (ALPHA || TC) | ||
714 | select FB_CFB_FILLRECT | ||
715 | select FB_CFB_COPYAREA | ||
716 | select FB_CFB_IMAGEBLIT | ||
717 | select BITREVERSE | ||
718 | ---help--- | ||
719 | This is the frame buffer device driver for generic TGA and SFB+ | ||
720 | graphic cards. These include DEC ZLXp-E1, -E2 and -E3 PCI cards, | ||
721 | also known as PBXGA-A, -B and -C, and DEC ZLX-E1, -E2 and -E3 | ||
722 | TURBOchannel cards, also known as PMAGD-A, -B and -C. | ||
723 | |||
724 | Due to hardware limitations ZLX-E2 and E3 cards are not supported | ||
725 | for DECstation 5000/200 systems. Additionally due to firmware | ||
726 | limitations these cards may cause troubles with booting DECstation | ||
727 | 5000/240 and /260 systems, but are fully supported under Linux if | ||
728 | you manage to get it going. ;-) | ||
729 | |||
730 | Say Y if you have one of those. | ||
731 | |||
732 | config FB_UVESA | ||
733 | tristate "Userspace VESA VGA graphics support" | ||
734 | depends on FB && CONNECTOR | ||
735 | select FB_CFB_FILLRECT | ||
736 | select FB_CFB_COPYAREA | ||
737 | select FB_CFB_IMAGEBLIT | ||
738 | select FB_MODE_HELPERS | ||
739 | help | ||
740 | This is the frame buffer driver for generic VBE 2.0 compliant | ||
741 | graphic cards. It can also take advantage of VBE 3.0 features, | ||
742 | such as refresh rate adjustment. | ||
743 | |||
744 | This driver generally provides more features than vesafb but | ||
745 | requires a userspace helper application called 'v86d'. See | ||
746 | <file:Documentation/fb/uvesafb.txt> for more information. | ||
747 | |||
748 | If unsure, say N. | ||
749 | |||
750 | config FB_VESA | ||
751 | bool "VESA VGA graphics support" | ||
752 | depends on (FB = y) && X86 | ||
753 | select FB_CFB_FILLRECT | ||
754 | select FB_CFB_COPYAREA | ||
755 | select FB_CFB_IMAGEBLIT | ||
756 | select FB_BOOT_VESA_SUPPORT | ||
757 | help | ||
758 | This is the frame buffer device driver for generic VESA 2.0 | ||
759 | compliant graphic cards. The older VESA 1.2 cards are not supported. | ||
760 | You will get a boot time penguin logo at no additional cost. Please | ||
761 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. | ||
762 | |||
763 | config FB_EFI | ||
764 | bool "EFI-based Framebuffer Support" | ||
765 | depends on (FB = y) && X86 && EFI | ||
766 | select FB_CFB_FILLRECT | ||
767 | select FB_CFB_COPYAREA | ||
768 | select FB_CFB_IMAGEBLIT | ||
769 | help | ||
770 | This is the EFI frame buffer device driver. If the firmware on | ||
771 | your platform is EFI 1.10 or UEFI 2.0, select Y to add support for | ||
772 | using the EFI framebuffer as your console. | ||
773 | |||
774 | config FB_N411 | ||
775 | tristate "N411 Apollo/Hecuba devkit support" | ||
776 | depends on FB && X86 && MMU | ||
777 | select FB_SYS_FILLRECT | ||
778 | select FB_SYS_COPYAREA | ||
779 | select FB_SYS_IMAGEBLIT | ||
780 | select FB_SYS_FOPS | ||
781 | select FB_DEFERRED_IO | ||
782 | select FB_HECUBA | ||
783 | help | ||
784 | This enables support for the Apollo display controller in its | ||
785 | Hecuba form using the n411 devkit. | ||
786 | |||
787 | config FB_HGA | ||
788 | tristate "Hercules mono graphics support" | ||
789 | depends on FB && X86 | ||
790 | help | ||
791 | Say Y here if you have a Hercules mono graphics card. | ||
792 | |||
793 | To compile this driver as a module, choose M here: the | ||
794 | module will be called hgafb. | ||
795 | |||
796 | As this card technology is at least 25 years old, | ||
797 | most people will answer N here. | ||
798 | |||
799 | config FB_GBE | ||
800 | bool "SGI Graphics Backend frame buffer support" | ||
801 | depends on (FB = y) && SGI_IP32 | ||
802 | select FB_CFB_FILLRECT | ||
803 | select FB_CFB_COPYAREA | ||
804 | select FB_CFB_IMAGEBLIT | ||
805 | help | ||
806 | This is the frame buffer device driver for SGI Graphics Backend. | ||
807 | This chip is used in SGI O2 and Visual Workstation 320/540. | ||
808 | |||
809 | config FB_GBE_MEM | ||
810 | int "Video memory size in MB" | ||
811 | depends on FB_GBE | ||
812 | default 4 | ||
813 | help | ||
814 | This is the amount of memory reserved for the framebuffer, | ||
815 | which can be any value between 1MB and 8MB. | ||
816 | |||
817 | config FB_SBUS | ||
818 | bool "SBUS and UPA framebuffers" | ||
819 | depends on (FB = y) && SPARC | ||
820 | help | ||
821 | Say Y if you want support for SBUS or UPA based frame buffer device. | ||
822 | |||
823 | config FB_BW2 | ||
824 | bool "BWtwo support" | ||
825 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
826 | select FB_CFB_FILLRECT | ||
827 | select FB_CFB_COPYAREA | ||
828 | select FB_CFB_IMAGEBLIT | ||
829 | help | ||
830 | This is the frame buffer device driver for the BWtwo frame buffer. | ||
831 | |||
832 | config FB_CG3 | ||
833 | bool "CGthree support" | ||
834 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
835 | select FB_CFB_FILLRECT | ||
836 | select FB_CFB_COPYAREA | ||
837 | select FB_CFB_IMAGEBLIT | ||
838 | help | ||
839 | This is the frame buffer device driver for the CGthree frame buffer. | ||
840 | |||
841 | config FB_CG6 | ||
842 | bool "CGsix (GX,TurboGX) support" | ||
843 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
844 | select FB_CFB_COPYAREA | ||
845 | select FB_CFB_IMAGEBLIT | ||
846 | help | ||
847 | This is the frame buffer device driver for the CGsix (GX, TurboGX) | ||
848 | frame buffer. | ||
849 | |||
850 | config FB_FFB | ||
851 | bool "Creator/Creator3D/Elite3D support" | ||
852 | depends on FB_SBUS && SPARC64 | ||
853 | select FB_CFB_COPYAREA | ||
854 | select FB_CFB_IMAGEBLIT | ||
855 | help | ||
856 | This is the frame buffer device driver for the Creator, Creator3D, | ||
857 | and Elite3D graphics boards. | ||
858 | |||
859 | config FB_TCX | ||
860 | bool "TCX (SS4/SS5 only) support" | ||
861 | depends on FB_SBUS | ||
862 | select FB_CFB_FILLRECT | ||
863 | select FB_CFB_COPYAREA | ||
864 | select FB_CFB_IMAGEBLIT | ||
865 | help | ||
866 | This is the frame buffer device driver for the TCX 24/8bit frame | ||
867 | buffer. | ||
868 | |||
869 | config FB_CG14 | ||
870 | bool "CGfourteen (SX) support" | ||
871 | depends on FB_SBUS | ||
872 | select FB_CFB_FILLRECT | ||
873 | select FB_CFB_COPYAREA | ||
874 | select FB_CFB_IMAGEBLIT | ||
875 | help | ||
876 | This is the frame buffer device driver for the CGfourteen frame | ||
877 | buffer on Desktop SPARCsystems with the SX graphics option. | ||
878 | |||
879 | config FB_P9100 | ||
880 | bool "P9100 (Sparcbook 3 only) support" | ||
881 | depends on FB_SBUS | ||
882 | select FB_CFB_FILLRECT | ||
883 | select FB_CFB_COPYAREA | ||
884 | select FB_CFB_IMAGEBLIT | ||
885 | help | ||
886 | This is the frame buffer device driver for the P9100 card | ||
887 | supported on Sparcbook 3 machines. | ||
888 | |||
889 | config FB_LEO | ||
890 | bool "Leo (ZX) support" | ||
891 | depends on FB_SBUS | ||
892 | select FB_CFB_FILLRECT | ||
893 | select FB_CFB_COPYAREA | ||
894 | select FB_CFB_IMAGEBLIT | ||
895 | help | ||
896 | This is the frame buffer device driver for the SBUS-based Sun ZX | ||
897 | (leo) frame buffer cards. | ||
898 | |||
899 | config FB_IGA | ||
900 | bool "IGA 168x display support" | ||
901 | depends on (FB = y) && SPARC32 | ||
902 | select FB_CFB_FILLRECT | ||
903 | select FB_CFB_COPYAREA | ||
904 | select FB_CFB_IMAGEBLIT | ||
905 | help | ||
906 | This is the framebuffer device for the INTERGRAPHICS 1680 and | ||
907 | successor frame buffer cards. | ||
908 | |||
909 | config FB_XVR500 | ||
910 | bool "Sun XVR-500 3DLABS Wildcat support" | ||
911 | depends on (FB = y) && PCI && SPARC64 | ||
912 | select FB_CFB_FILLRECT | ||
913 | select FB_CFB_COPYAREA | ||
914 | select FB_CFB_IMAGEBLIT | ||
915 | help | ||
916 | This is the framebuffer device for the Sun XVR-500 and similar | ||
917 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
918 | only works on sparc64 systems where the system firmware has | ||
919 | mostly initialized the card already. It is treated as a | ||
920 | completely dumb framebuffer device. | ||
921 | |||
922 | config FB_XVR2500 | ||
923 | bool "Sun XVR-2500 3DLABS Wildcat support" | ||
924 | depends on (FB = y) && PCI && SPARC64 | ||
925 | select FB_CFB_FILLRECT | ||
926 | select FB_CFB_COPYAREA | ||
927 | select FB_CFB_IMAGEBLIT | ||
928 | help | ||
929 | This is the framebuffer device for the Sun XVR-2500 and similar | ||
930 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
931 | only works on sparc64 systems where the system firmware has | ||
932 | mostly initialized the card already. It is treated as a | ||
933 | completely dumb framebuffer device. | ||
934 | |||
935 | config FB_XVR1000 | ||
936 | bool "Sun XVR-1000 support" | ||
937 | depends on (FB = y) && SPARC64 | ||
938 | select FB_CFB_FILLRECT | ||
939 | select FB_CFB_COPYAREA | ||
940 | select FB_CFB_IMAGEBLIT | ||
941 | help | ||
942 | This is the framebuffer device for the Sun XVR-1000 and similar | ||
943 | graphics cards. The driver only works on sparc64 systems where | ||
944 | the system firmware has mostly initialized the card already. It | ||
945 | is treated as a completely dumb framebuffer device. | ||
946 | |||
947 | config FB_PVR2 | ||
948 | tristate "NEC PowerVR 2 display support" | ||
949 | depends on FB && SH_DREAMCAST | ||
950 | select FB_CFB_FILLRECT | ||
951 | select FB_CFB_COPYAREA | ||
952 | select FB_CFB_IMAGEBLIT | ||
953 | ---help--- | ||
954 | Say Y here if you have a PowerVR 2 card in your box. If you plan to | ||
955 | run linux on your Dreamcast, you will have to say Y here. | ||
956 | This driver may or may not work on other PowerVR 2 cards, but is | ||
957 | totally untested. Use at your own risk. If unsure, say N. | ||
958 | |||
959 | To compile this driver as a module, choose M here: the | ||
960 | module will be called pvr2fb. | ||
961 | |||
962 | You can pass several parameters to the driver at boot time or at | ||
963 | module load time. The parameters look like "video=pvr2:XXX", where | ||
964 | the meaning of XXX can be found at the end of the main source file | ||
965 | (<file:drivers/video/pvr2fb.c>). Please see the file | ||
966 | <file:Documentation/fb/pvr2fb.txt>. | ||
967 | |||
968 | config FB_OPENCORES | ||
969 | tristate "OpenCores VGA/LCD core 2.0 framebuffer support" | ||
970 | depends on FB && HAS_DMA | ||
971 | select FB_CFB_FILLRECT | ||
972 | select FB_CFB_COPYAREA | ||
973 | select FB_CFB_IMAGEBLIT | ||
974 | help | ||
975 | This enables support for the OpenCores VGA/LCD core. | ||
976 | |||
977 | The OpenCores VGA/LCD core is typically used together with | ||
978 | softcore CPUs (e.g. OpenRISC or Microblaze) or hard processor | ||
979 | systems (e.g. Altera socfpga or Xilinx Zynq) on FPGAs. | ||
980 | |||
981 | The source code and specification for the core is available at | ||
982 | <http://opencores.org/project,vga_lcd> | ||
983 | |||
984 | config FB_S1D13XXX | ||
985 | tristate "Epson S1D13XXX framebuffer support" | ||
986 | depends on FB | ||
987 | select FB_CFB_FILLRECT | ||
988 | select FB_CFB_COPYAREA | ||
989 | select FB_CFB_IMAGEBLIT | ||
990 | help | ||
991 | Support for S1D13XXX framebuffer device family (currently only | ||
992 | working with S1D13806). Product specs at | ||
993 | <http://vdc.epson.com/> | ||
994 | |||
995 | config FB_ATMEL | ||
996 | tristate "AT91/AT32 LCD Controller support" | ||
997 | depends on FB && HAVE_FB_ATMEL | ||
998 | select FB_CFB_FILLRECT | ||
999 | select FB_CFB_COPYAREA | ||
1000 | select FB_CFB_IMAGEBLIT | ||
1001 | select FB_MODE_HELPERS | ||
1002 | select VIDEOMODE_HELPERS | ||
1003 | help | ||
1004 | This enables support for the AT91/AT32 LCD Controller. | ||
1005 | |||
1006 | config FB_INTSRAM | ||
1007 | bool "Frame Buffer in internal SRAM" | ||
1008 | depends on FB_ATMEL && ARCH_AT91SAM9261 | ||
1009 | help | ||
1010 | Say Y if you want to map Frame Buffer in internal SRAM. Say N if you want | ||
1011 | to let frame buffer in external SDRAM. | ||
1012 | |||
1013 | config FB_ATMEL_STN | ||
1014 | bool "Use a STN display with AT91/AT32 LCD Controller" | ||
1015 | depends on FB_ATMEL && (MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK) | ||
1016 | default n | ||
1017 | help | ||
1018 | Say Y if you want to connect a STN LCD display to the AT91/AT32 LCD | ||
1019 | Controller. Say N if you want to connect a TFT. | ||
1020 | |||
1021 | If unsure, say N. | ||
1022 | |||
1023 | config FB_NVIDIA | ||
1024 | tristate "nVidia Framebuffer Support" | ||
1025 | depends on FB && PCI | ||
1026 | select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT | ||
1027 | select FB_MODE_HELPERS | ||
1028 | select FB_CFB_FILLRECT | ||
1029 | select FB_CFB_COPYAREA | ||
1030 | select FB_CFB_IMAGEBLIT | ||
1031 | select BITREVERSE | ||
1032 | select VGASTATE | ||
1033 | help | ||
1034 | This driver supports graphics boards with the nVidia chips, TNT | ||
1035 | and newer. For very old chipsets, such as the RIVA128, then use | ||
1036 | the rivafb. | ||
1037 | Say Y if you have such a graphics board. | ||
1038 | |||
1039 | To compile this driver as a module, choose M here: the | ||
1040 | module will be called nvidiafb. | ||
1041 | |||
1042 | config FB_NVIDIA_I2C | ||
1043 | bool "Enable DDC Support" | ||
1044 | depends on FB_NVIDIA | ||
1045 | select FB_DDC | ||
1046 | help | ||
1047 | This enables I2C support for nVidia Chipsets. This is used | ||
1048 | only for getting EDID information from the attached display | ||
1049 | allowing for robust video mode handling and switching. | ||
1050 | |||
1051 | Because fbdev-2.6 requires that drivers must be able to | ||
1052 | independently validate video mode parameters, you should say Y | ||
1053 | here. | ||
1054 | |||
1055 | config FB_NVIDIA_DEBUG | ||
1056 | bool "Lots of debug output" | ||
1057 | depends on FB_NVIDIA | ||
1058 | default n | ||
1059 | help | ||
1060 | Say Y here if you want the nVidia driver to output all sorts | ||
1061 | of debugging information to provide to the maintainer when | ||
1062 | something goes wrong. | ||
1063 | |||
1064 | config FB_NVIDIA_BACKLIGHT | ||
1065 | bool "Support for backlight control" | ||
1066 | depends on FB_NVIDIA | ||
1067 | default y | ||
1068 | help | ||
1069 | Say Y here if you want to control the backlight of your display. | ||
1070 | |||
1071 | config FB_RIVA | ||
1072 | tristate "nVidia Riva support" | ||
1073 | depends on FB && PCI | ||
1074 | select FB_BACKLIGHT if FB_RIVA_BACKLIGHT | ||
1075 | select FB_MODE_HELPERS | ||
1076 | select FB_CFB_FILLRECT | ||
1077 | select FB_CFB_COPYAREA | ||
1078 | select FB_CFB_IMAGEBLIT | ||
1079 | select BITREVERSE | ||
1080 | select VGASTATE | ||
1081 | help | ||
1082 | This driver supports graphics boards with the nVidia Riva/Geforce | ||
1083 | chips. | ||
1084 | Say Y if you have such a graphics board. | ||
1085 | |||
1086 | To compile this driver as a module, choose M here: the | ||
1087 | module will be called rivafb. | ||
1088 | |||
1089 | config FB_RIVA_I2C | ||
1090 | bool "Enable DDC Support" | ||
1091 | depends on FB_RIVA | ||
1092 | select FB_DDC | ||
1093 | help | ||
1094 | This enables I2C support for nVidia Chipsets. This is used | ||
1095 | only for getting EDID information from the attached display | ||
1096 | allowing for robust video mode handling and switching. | ||
1097 | |||
1098 | Because fbdev-2.6 requires that drivers must be able to | ||
1099 | independently validate video mode parameters, you should say Y | ||
1100 | here. | ||
1101 | |||
1102 | config FB_RIVA_DEBUG | ||
1103 | bool "Lots of debug output" | ||
1104 | depends on FB_RIVA | ||
1105 | default n | ||
1106 | help | ||
1107 | Say Y here if you want the Riva driver to output all sorts | ||
1108 | of debugging information to provide to the maintainer when | ||
1109 | something goes wrong. | ||
1110 | |||
1111 | config FB_RIVA_BACKLIGHT | ||
1112 | bool "Support for backlight control" | ||
1113 | depends on FB_RIVA | ||
1114 | default y | ||
1115 | help | ||
1116 | Say Y here if you want to control the backlight of your display. | ||
1117 | |||
1118 | config FB_I740 | ||
1119 | tristate "Intel740 support" | ||
1120 | depends on FB && PCI | ||
1121 | select FB_MODE_HELPERS | ||
1122 | select FB_CFB_FILLRECT | ||
1123 | select FB_CFB_COPYAREA | ||
1124 | select FB_CFB_IMAGEBLIT | ||
1125 | select VGASTATE | ||
1126 | select FB_DDC | ||
1127 | help | ||
1128 | This driver supports graphics cards based on Intel740 chip. | ||
1129 | |||
1130 | config FB_I810 | ||
1131 | tristate "Intel 810/815 support" | ||
1132 | depends on FB && PCI && X86_32 && AGP_INTEL | ||
1133 | select FB_MODE_HELPERS | ||
1134 | select FB_CFB_FILLRECT | ||
1135 | select FB_CFB_COPYAREA | ||
1136 | select FB_CFB_IMAGEBLIT | ||
1137 | select VGASTATE | ||
1138 | help | ||
1139 | This driver supports the on-board graphics built in to the Intel 810 | ||
1140 | and 815 chipsets. Say Y if you have and plan to use such a board. | ||
1141 | |||
1142 | To compile this driver as a module, choose M here: the | ||
1143 | module will be called i810fb. | ||
1144 | |||
1145 | For more information, please read | ||
1146 | <file:Documentation/fb/intel810.txt> | ||
1147 | |||
1148 | config FB_I810_GTF | ||
1149 | bool "use VESA Generalized Timing Formula" | ||
1150 | depends on FB_I810 | ||
1151 | help | ||
1152 | If you say Y, then the VESA standard, Generalized Timing Formula | ||
1153 | or GTF, will be used to calculate the required video timing values | ||
1154 | per video mode. Since the GTF allows nondiscrete timings | ||
1155 | (nondiscrete being a range of values as opposed to discrete being a | ||
1156 | set of values), you'll be able to use any combination of horizontal | ||
1157 | and vertical resolutions, and vertical refresh rates without having | ||
1158 | to specify your own timing parameters. This is especially useful | ||
1159 | to maximize the performance of an aging display, or if you just | ||
1160 | have a display with nonstandard dimensions. A VESA compliant | ||
1161 | monitor is recommended, but can still work with non-compliant ones. | ||
1162 | If you need or want this, then select this option. The timings may | ||
1163 | not be compliant with Intel's recommended values. Use at your own | ||
1164 | risk. | ||
1165 | |||
1166 | If you say N, the driver will revert to discrete video timings | ||
1167 | using a set recommended by Intel in their documentation. | ||
1168 | |||
1169 | If unsure, say N. | ||
1170 | |||
1171 | config FB_I810_I2C | ||
1172 | bool "Enable DDC Support" | ||
1173 | depends on FB_I810 && FB_I810_GTF | ||
1174 | select FB_DDC | ||
1175 | help | ||
1176 | |||
1177 | config FB_LE80578 | ||
1178 | tristate "Intel LE80578 (Vermilion) support" | ||
1179 | depends on FB && PCI && X86 | ||
1180 | select FB_MODE_HELPERS | ||
1181 | select FB_CFB_FILLRECT | ||
1182 | select FB_CFB_COPYAREA | ||
1183 | select FB_CFB_IMAGEBLIT | ||
1184 | help | ||
1185 | This driver supports the LE80578 (Vermilion Range) chipset | ||
1186 | |||
1187 | config FB_CARILLO_RANCH | ||
1188 | tristate "Intel Carillo Ranch support" | ||
1189 | depends on FB_LE80578 && FB && PCI && X86 | ||
1190 | help | ||
1191 | This driver supports the LE80578 (Carillo Ranch) board | ||
1192 | |||
1193 | config FB_INTEL | ||
1194 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" | ||
1195 | depends on FB && PCI && X86 && AGP_INTEL && EXPERT | ||
1196 | select FB_MODE_HELPERS | ||
1197 | select FB_CFB_FILLRECT | ||
1198 | select FB_CFB_COPYAREA | ||
1199 | select FB_CFB_IMAGEBLIT | ||
1200 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y | ||
1201 | depends on !DRM_I915 | ||
1202 | help | ||
1203 | This driver supports the on-board graphics built in to the Intel | ||
1204 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. | ||
1205 | Say Y if you have and plan to use such a board. | ||
1206 | |||
1207 | To make FB_INTELFB=Y work you need to say AGP_INTEL=y too. | ||
1208 | |||
1209 | To compile this driver as a module, choose M here: the | ||
1210 | module will be called intelfb. | ||
1211 | |||
1212 | For more information, please read <file:Documentation/fb/intelfb.txt> | ||
1213 | |||
1214 | config FB_INTEL_DEBUG | ||
1215 | bool "Intel driver Debug Messages" | ||
1216 | depends on FB_INTEL | ||
1217 | ---help--- | ||
1218 | Say Y here if you want the Intel driver to output all sorts | ||
1219 | of debugging information to provide to the maintainer when | ||
1220 | something goes wrong. | ||
1221 | |||
1222 | config FB_INTEL_I2C | ||
1223 | bool "DDC/I2C for Intel framebuffer support" | ||
1224 | depends on FB_INTEL | ||
1225 | select FB_DDC | ||
1226 | default y | ||
1227 | help | ||
1228 | Say Y here if you want DDC/I2C support for your on-board Intel graphics. | ||
1229 | |||
1230 | config FB_MATROX | ||
1231 | tristate "Matrox acceleration" | ||
1232 | depends on FB && PCI | ||
1233 | select FB_CFB_FILLRECT | ||
1234 | select FB_CFB_COPYAREA | ||
1235 | select FB_CFB_IMAGEBLIT | ||
1236 | select FB_TILEBLITTING | ||
1237 | select FB_MACMODES if PPC_PMAC | ||
1238 | ---help--- | ||
1239 | Say Y here if you have a Matrox Millennium, Matrox Millennium II, | ||
1240 | Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox | ||
1241 | Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video, | ||
1242 | Matrox G400, G450 or G550 card in your box. | ||
1243 | |||
1244 | To compile this driver as a module, choose M here: the | ||
1245 | module will be called matroxfb. | ||
1246 | |||
1247 | You can pass several parameters to the driver at boot time or at | ||
1248 | module load time. The parameters look like "video=matroxfb:XXX", and | ||
1249 | are described in <file:Documentation/fb/matroxfb.txt>. | ||
1250 | |||
1251 | config FB_MATROX_MILLENIUM | ||
1252 | bool "Millennium I/II support" | ||
1253 | depends on FB_MATROX | ||
1254 | help | ||
1255 | Say Y here if you have a Matrox Millennium or Matrox Millennium II | ||
1256 | video card. If you select "Advanced lowlevel driver options" below, | ||
1257 | you should check 4 bpp packed pixel, 8 bpp packed pixel, 16 bpp | ||
1258 | packed pixel, 24 bpp packed pixel and 32 bpp packed pixel. You can | ||
1259 | also use font widths different from 8. | ||
1260 | |||
1261 | config FB_MATROX_MYSTIQUE | ||
1262 | bool "Mystique support" | ||
1263 | depends on FB_MATROX | ||
1264 | help | ||
1265 | Say Y here if you have a Matrox Mystique or Matrox Mystique 220 | ||
1266 | video card. If you select "Advanced lowlevel driver options" below, | ||
1267 | you should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp | ||
1268 | packed pixel and 32 bpp packed pixel. You can also use font widths | ||
1269 | different from 8. | ||
1270 | |||
1271 | config FB_MATROX_G | ||
1272 | bool "G100/G200/G400/G450/G550 support" | ||
1273 | depends on FB_MATROX | ||
1274 | ---help--- | ||
1275 | Say Y here if you have a Matrox G100, G200, G400, G450 or G550 based | ||
1276 | video card. If you select "Advanced lowlevel driver options", you | ||
1277 | should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp packed | ||
1278 | pixel and 32 bpp packed pixel. You can also use font widths | ||
1279 | different from 8. | ||
1280 | |||
1281 | If you need support for G400 secondary head, you must say Y to | ||
1282 | "Matrox I2C support" and "G400 second head support" right below. | ||
1283 | G450/G550 secondary head and digital output are supported without | ||
1284 | additional modules. | ||
1285 | |||
1286 | The driver starts in monitor mode. You must use the matroxset tool | ||
1287 | (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to | ||
1288 | swap primary and secondary head outputs, or to change output mode. | ||
1289 | Secondary head driver always start in 640x480 resolution and you | ||
1290 | must use fbset to change it. | ||
1291 | |||
1292 | Do not forget that second head supports only 16 and 32 bpp | ||
1293 | packed pixels, so it is a good idea to compile them into the kernel | ||
1294 | too. You can use only some font widths, as the driver uses generic | ||
1295 | painting procedures (the secondary head does not use acceleration | ||
1296 | engine). | ||
1297 | |||
1298 | G450/G550 hardware can display TV picture only from secondary CRTC, | ||
1299 | and it performs no scaling, so picture must have 525 or 625 lines. | ||
1300 | |||
1301 | config FB_MATROX_I2C | ||
1302 | tristate "Matrox I2C support" | ||
1303 | depends on FB_MATROX | ||
1304 | select FB_DDC | ||
1305 | ---help--- | ||
1306 | This drivers creates I2C buses which are needed for accessing the | ||
1307 | DDC (I2C) bus present on all Matroxes, an I2C bus which | ||
1308 | interconnects Matrox optional devices, like MGA-TVO on G200 and | ||
1309 | G400, and the secondary head DDC bus, present on G400 only. | ||
1310 | |||
1311 | You can say Y or M here if you want to experiment with monitor | ||
1312 | detection code. You must say Y or M here if you want to use either | ||
1313 | second head of G400 or MGA-TVO on G200 or G400. | ||
1314 | |||
1315 | If you compile it as module, it will create a module named | ||
1316 | i2c-matroxfb. | ||
1317 | |||
1318 | config FB_MATROX_MAVEN | ||
1319 | tristate "G400 second head support" | ||
1320 | depends on FB_MATROX_G && FB_MATROX_I2C | ||
1321 | ---help--- | ||
1322 | WARNING !!! This support does not work with G450 !!! | ||
1323 | |||
1324 | Say Y or M here if you want to use a secondary head (meaning two | ||
1325 | monitors in parallel) on G400 or MGA-TVO add-on on G200. Secondary | ||
1326 | head is not compatible with accelerated XFree 3.3.x SVGA servers - | ||
1327 | secondary head output is blanked while you are in X. With XFree | ||
1328 | 3.9.17 preview you can use both heads if you use SVGA over fbdev or | ||
1329 | the fbdev driver on first head and the fbdev driver on second head. | ||
1330 | |||
1331 | If you compile it as module, two modules are created, | ||
1332 | matroxfb_crtc2 and matroxfb_maven. Matroxfb_maven is needed for | ||
1333 | both G200 and G400, matroxfb_crtc2 is needed only by G400. You must | ||
1334 | also load i2c-matroxfb to get it to run. | ||
1335 | |||
1336 | The driver starts in monitor mode and you must use the matroxset | ||
1337 | tool (available at | ||
1338 | <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to switch it to | ||
1339 | PAL or NTSC or to swap primary and secondary head outputs. | ||
1340 | Secondary head driver also always start in 640x480 resolution, you | ||
1341 | must use fbset to change it. | ||
1342 | |||
1343 | Also do not forget that second head supports only 16 and 32 bpp | ||
1344 | packed pixels, so it is a good idea to compile them into the kernel | ||
1345 | too. You can use only some font widths, as the driver uses generic | ||
1346 | painting procedures (the secondary head does not use acceleration | ||
1347 | engine). | ||
1348 | |||
1349 | config FB_RADEON | ||
1350 | tristate "ATI Radeon display support" | ||
1351 | depends on FB && PCI | ||
1352 | select FB_BACKLIGHT if FB_RADEON_BACKLIGHT | ||
1353 | select FB_MODE_HELPERS | ||
1354 | select FB_CFB_FILLRECT | ||
1355 | select FB_CFB_COPYAREA | ||
1356 | select FB_CFB_IMAGEBLIT | ||
1357 | select FB_MACMODES if PPC_OF | ||
1358 | help | ||
1359 | Choose this option if you want to use an ATI Radeon graphics card as | ||
1360 | a framebuffer device. There are both PCI and AGP versions. You | ||
1361 | don't need to choose this to run the Radeon in plain VGA mode. | ||
1362 | |||
1363 | There is a product page at | ||
1364 | http://products.amd.com/en-us/GraphicCardResult.aspx | ||
1365 | |||
1366 | config FB_RADEON_I2C | ||
1367 | bool "DDC/I2C for ATI Radeon support" | ||
1368 | depends on FB_RADEON | ||
1369 | select FB_DDC | ||
1370 | default y | ||
1371 | help | ||
1372 | Say Y here if you want DDC/I2C support for your Radeon board. | ||
1373 | |||
1374 | config FB_RADEON_BACKLIGHT | ||
1375 | bool "Support for backlight control" | ||
1376 | depends on FB_RADEON | ||
1377 | default y | ||
1378 | help | ||
1379 | Say Y here if you want to control the backlight of your display. | ||
1380 | |||
1381 | config FB_RADEON_DEBUG | ||
1382 | bool "Lots of debug output from Radeon driver" | ||
1383 | depends on FB_RADEON | ||
1384 | default n | ||
1385 | help | ||
1386 | Say Y here if you want the Radeon driver to output all sorts | ||
1387 | of debugging information to provide to the maintainer when | ||
1388 | something goes wrong. | ||
1389 | |||
1390 | config FB_ATY128 | ||
1391 | tristate "ATI Rage128 display support" | ||
1392 | depends on FB && PCI | ||
1393 | select FB_CFB_FILLRECT | ||
1394 | select FB_CFB_COPYAREA | ||
1395 | select FB_CFB_IMAGEBLIT | ||
1396 | select FB_BACKLIGHT if FB_ATY128_BACKLIGHT | ||
1397 | select FB_MACMODES if PPC_PMAC | ||
1398 | help | ||
1399 | This driver supports graphics boards with the ATI Rage128 chips. | ||
1400 | Say Y if you have such a graphics board and read | ||
1401 | <file:Documentation/fb/aty128fb.txt>. | ||
1402 | |||
1403 | To compile this driver as a module, choose M here: the | ||
1404 | module will be called aty128fb. | ||
1405 | |||
1406 | config FB_ATY128_BACKLIGHT | ||
1407 | bool "Support for backlight control" | ||
1408 | depends on FB_ATY128 | ||
1409 | default y | ||
1410 | help | ||
1411 | Say Y here if you want to control the backlight of your display. | ||
1412 | |||
1413 | config FB_ATY | ||
1414 | tristate "ATI Mach64 display support" if PCI || ATARI | ||
1415 | depends on FB && !SPARC32 | ||
1416 | select FB_CFB_FILLRECT | ||
1417 | select FB_CFB_COPYAREA | ||
1418 | select FB_CFB_IMAGEBLIT | ||
1419 | select FB_BACKLIGHT if FB_ATY_BACKLIGHT | ||
1420 | select FB_MACMODES if PPC | ||
1421 | help | ||
1422 | This driver supports graphics boards with the ATI Mach64 chips. | ||
1423 | Say Y if you have such a graphics board. | ||
1424 | |||
1425 | To compile this driver as a module, choose M here: the | ||
1426 | module will be called atyfb. | ||
1427 | |||
1428 | config FB_ATY_CT | ||
1429 | bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" | ||
1430 | depends on PCI && FB_ATY | ||
1431 | default y if SPARC64 && PCI | ||
1432 | help | ||
1433 | Say Y here to support use of ATI's 64-bit Rage boards (or other | ||
1434 | boards based on the Mach64 CT, VT, GT, and LT chipsets) as a | ||
1435 | framebuffer device. The ATI product support page for these boards | ||
1436 | is at <http://support.ati.com/products/pc/mach64/mach64.html>. | ||
1437 | |||
1438 | config FB_ATY_GENERIC_LCD | ||
1439 | bool "Mach64 generic LCD support" | ||
1440 | depends on FB_ATY_CT | ||
1441 | help | ||
1442 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, | ||
1443 | Rage XC, or Rage XL chipset. | ||
1444 | |||
1445 | config FB_ATY_GX | ||
1446 | bool "Mach64 GX support" if PCI | ||
1447 | depends on FB_ATY | ||
1448 | default y if ATARI | ||
1449 | help | ||
1450 | Say Y here to support use of the ATI Mach64 Graphics Expression | ||
1451 | board (or other boards based on the Mach64 GX chipset) as a | ||
1452 | framebuffer device. The ATI product support page for these boards | ||
1453 | is at | ||
1454 | <http://support.ati.com/products/pc/mach64/graphics_xpression.html>. | ||
1455 | |||
1456 | config FB_ATY_BACKLIGHT | ||
1457 | bool "Support for backlight control" | ||
1458 | depends on FB_ATY | ||
1459 | default y | ||
1460 | help | ||
1461 | Say Y here if you want to control the backlight of your display. | ||
1462 | |||
1463 | config FB_S3 | ||
1464 | tristate "S3 Trio/Virge support" | ||
1465 | depends on FB && PCI | ||
1466 | select FB_CFB_FILLRECT | ||
1467 | select FB_CFB_COPYAREA | ||
1468 | select FB_CFB_IMAGEBLIT | ||
1469 | select FB_TILEBLITTING | ||
1470 | select FB_SVGALIB | ||
1471 | select VGASTATE | ||
1472 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1473 | ---help--- | ||
1474 | Driver for graphics boards with S3 Trio / S3 Virge chip. | ||
1475 | |||
1476 | config FB_S3_DDC | ||
1477 | bool "DDC for S3 support" | ||
1478 | depends on FB_S3 | ||
1479 | select FB_DDC | ||
1480 | default y | ||
1481 | help | ||
1482 | Say Y here if you want DDC support for your S3 graphics card. | ||
1483 | |||
1484 | config FB_SAVAGE | ||
1485 | tristate "S3 Savage support" | ||
1486 | depends on FB && PCI | ||
1487 | select FB_MODE_HELPERS | ||
1488 | select FB_CFB_FILLRECT | ||
1489 | select FB_CFB_COPYAREA | ||
1490 | select FB_CFB_IMAGEBLIT | ||
1491 | select VGASTATE | ||
1492 | help | ||
1493 | This driver supports notebooks and computers with S3 Savage PCI/AGP | ||
1494 | chips. | ||
1495 | |||
1496 | Say Y if you have such a graphics card. | ||
1497 | |||
1498 | To compile this driver as a module, choose M here; the module | ||
1499 | will be called savagefb. | ||
1500 | |||
1501 | config FB_SAVAGE_I2C | ||
1502 | bool "Enable DDC2 Support" | ||
1503 | depends on FB_SAVAGE | ||
1504 | select FB_DDC | ||
1505 | help | ||
1506 | This enables I2C support for S3 Savage Chipsets. This is used | ||
1507 | only for getting EDID information from the attached display | ||
1508 | allowing for robust video mode handling and switching. | ||
1509 | |||
1510 | Because fbdev-2.6 requires that drivers must be able to | ||
1511 | independently validate video mode parameters, you should say Y | ||
1512 | here. | ||
1513 | |||
1514 | config FB_SAVAGE_ACCEL | ||
1515 | bool "Enable Console Acceleration" | ||
1516 | depends on FB_SAVAGE | ||
1517 | default n | ||
1518 | help | ||
1519 | This option will compile in console acceleration support. If | ||
1520 | the resulting framebuffer console has bothersome glitches, then | ||
1521 | choose N here. | ||
1522 | |||
1523 | config FB_SIS | ||
1524 | tristate "SiS/XGI display support" | ||
1525 | depends on FB && PCI | ||
1526 | select FB_CFB_FILLRECT | ||
1527 | select FB_CFB_COPYAREA | ||
1528 | select FB_CFB_IMAGEBLIT | ||
1529 | select FB_BOOT_VESA_SUPPORT if FB_SIS = y | ||
1530 | help | ||
1531 | This is the frame buffer device driver for the SiS 300, 315, 330 | ||
1532 | and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. | ||
1533 | Specs available at <http://www.sis.com> and <http://www.xgitech.com>. | ||
1534 | |||
1535 | To compile this driver as a module, choose M here; the module | ||
1536 | will be called sisfb. | ||
1537 | |||
1538 | config FB_SIS_300 | ||
1539 | bool "SiS 300 series support" | ||
1540 | depends on FB_SIS | ||
1541 | help | ||
1542 | Say Y here to support use of the SiS 300/305, 540, 630 and 730. | ||
1543 | |||
1544 | config FB_SIS_315 | ||
1545 | bool "SiS 315/330/340 series and XGI support" | ||
1546 | depends on FB_SIS | ||
1547 | help | ||
1548 | Say Y here to support use of the SiS 315, 330 and 340 series | ||
1549 | (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760, 761) as well | ||
1550 | as XGI V3XT, V5, V8 and Z7. | ||
1551 | |||
1552 | config FB_VIA | ||
1553 | tristate "VIA UniChrome (Pro) and Chrome9 display support" | ||
1554 | depends on FB && PCI && X86 | ||
1555 | select FB_CFB_FILLRECT | ||
1556 | select FB_CFB_COPYAREA | ||
1557 | select FB_CFB_IMAGEBLIT | ||
1558 | select I2C_ALGOBIT | ||
1559 | select I2C | ||
1560 | select GPIOLIB | ||
1561 | help | ||
1562 | This is the frame buffer device driver for Graphics chips of VIA | ||
1563 | UniChrome (Pro) Family (CLE266,PM800/CN400,P4M800CE/P4M800Pro/ | ||
1564 | CN700/VN800,CX700/VX700,P4M890) and Chrome9 Family (K8M890,CN896 | ||
1565 | /P4M900,VX800) | ||
1566 | Say Y if you have a VIA UniChrome graphics board. | ||
1567 | |||
1568 | To compile this driver as a module, choose M here: the | ||
1569 | module will be called viafb. | ||
1570 | |||
1571 | if FB_VIA | ||
1572 | |||
1573 | config FB_VIA_DIRECT_PROCFS | ||
1574 | bool "direct hardware access via procfs (DEPRECATED)(DANGEROUS)" | ||
1575 | depends on FB_VIA | ||
1576 | default n | ||
1577 | help | ||
1578 | Allow direct hardware access to some output registers via procfs. | ||
1579 | This is dangerous but may provide the only chance to get the | ||
1580 | correct output device configuration. | ||
1581 | Its use is strongly discouraged. | ||
1582 | |||
1583 | config FB_VIA_X_COMPATIBILITY | ||
1584 | bool "X server compatibility" | ||
1585 | depends on FB_VIA | ||
1586 | default n | ||
1587 | help | ||
1588 | This option reduces the functionality (power saving, ...) of the | ||
1589 | framebuffer to avoid negative impact on the OpenChrome X server. | ||
1590 | If you use any X server other than fbdev you should enable this | ||
1591 | otherwise it should be safe to disable it and allow using all | ||
1592 | features. | ||
1593 | |||
1594 | endif | ||
1595 | |||
1596 | config FB_NEOMAGIC | ||
1597 | tristate "NeoMagic display support" | ||
1598 | depends on FB && PCI | ||
1599 | select FB_MODE_HELPERS | ||
1600 | select FB_CFB_FILLRECT | ||
1601 | select FB_CFB_COPYAREA | ||
1602 | select FB_CFB_IMAGEBLIT | ||
1603 | select VGASTATE | ||
1604 | help | ||
1605 | This driver supports notebooks with NeoMagic PCI chips. | ||
1606 | Say Y if you have such a graphics card. | ||
1607 | |||
1608 | To compile this driver as a module, choose M here: the | ||
1609 | module will be called neofb. | ||
1610 | |||
1611 | config FB_KYRO | ||
1612 | tristate "IMG Kyro support" | ||
1613 | depends on FB && PCI | ||
1614 | select FB_CFB_FILLRECT | ||
1615 | select FB_CFB_COPYAREA | ||
1616 | select FB_CFB_IMAGEBLIT | ||
1617 | help | ||
1618 | Say Y here if you have a STG4000 / Kyro / PowerVR 3 based | ||
1619 | graphics board. | ||
1620 | |||
1621 | To compile this driver as a module, choose M here: the | ||
1622 | module will be called kyrofb. | ||
1623 | |||
1624 | config FB_3DFX | ||
1625 | tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support" | ||
1626 | depends on FB && PCI | ||
1627 | select FB_CFB_IMAGEBLIT | ||
1628 | select FB_CFB_FILLRECT | ||
1629 | select FB_CFB_COPYAREA | ||
1630 | select FB_MODE_HELPERS | ||
1631 | help | ||
1632 | This driver supports graphics boards with the 3Dfx Banshee, | ||
1633 | Voodoo3 or VSA-100 (aka Voodoo4/5) chips. Say Y if you have | ||
1634 | such a graphics board. | ||
1635 | |||
1636 | To compile this driver as a module, choose M here: the | ||
1637 | module will be called tdfxfb. | ||
1638 | |||
1639 | config FB_3DFX_ACCEL | ||
1640 | bool "3Dfx Acceleration functions" | ||
1641 | depends on FB_3DFX | ||
1642 | ---help--- | ||
1643 | This will compile the 3Dfx Banshee/Voodoo3/VSA-100 frame buffer | ||
1644 | device driver with acceleration functions. | ||
1645 | |||
1646 | config FB_3DFX_I2C | ||
1647 | bool "Enable DDC/I2C support" | ||
1648 | depends on FB_3DFX | ||
1649 | select FB_DDC | ||
1650 | default y | ||
1651 | help | ||
1652 | Say Y here if you want DDC/I2C support for your 3dfx Voodoo3. | ||
1653 | |||
1654 | config FB_VOODOO1 | ||
1655 | tristate "3Dfx Voodoo Graphics (sst1) support" | ||
1656 | depends on FB && PCI | ||
1657 | select FB_CFB_FILLRECT | ||
1658 | select FB_CFB_COPYAREA | ||
1659 | select FB_CFB_IMAGEBLIT | ||
1660 | ---help--- | ||
1661 | Say Y here if you have a 3Dfx Voodoo Graphics (Voodoo1/sst1) or | ||
1662 | Voodoo2 (cvg) based graphics card. | ||
1663 | |||
1664 | To compile this driver as a module, choose M here: the | ||
1665 | module will be called sstfb. | ||
1666 | |||
1667 | WARNING: Do not use any application that uses the 3D engine | ||
1668 | (namely glide) while using this driver. | ||
1669 | Please read the <file:Documentation/fb/sstfb.txt> for supported | ||
1670 | options and other important info support. | ||
1671 | |||
1672 | config FB_VT8623 | ||
1673 | tristate "VIA VT8623 support" | ||
1674 | depends on FB && PCI | ||
1675 | select FB_CFB_FILLRECT | ||
1676 | select FB_CFB_COPYAREA | ||
1677 | select FB_CFB_IMAGEBLIT | ||
1678 | select FB_TILEBLITTING | ||
1679 | select FB_SVGALIB | ||
1680 | select VGASTATE | ||
1681 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1682 | ---help--- | ||
1683 | Driver for CastleRock integrated graphics core in the | ||
1684 | VIA VT8623 [Apollo CLE266] chipset. | ||
1685 | |||
1686 | config FB_TRIDENT | ||
1687 | tristate "Trident/CyberXXX/CyberBlade support" | ||
1688 | depends on FB && PCI | ||
1689 | select FB_CFB_FILLRECT | ||
1690 | select FB_CFB_COPYAREA | ||
1691 | select FB_CFB_IMAGEBLIT | ||
1692 | ---help--- | ||
1693 | This is the frame buffer device driver for Trident PCI/AGP chipsets. | ||
1694 | Supported chipset families are TGUI 9440/96XX, 3DImage, Blade3D | ||
1695 | and Blade XP. | ||
1696 | There are also integrated versions of these chips called CyberXXXX, | ||
1697 | CyberImage or CyberBlade. These chips are mostly found in laptops | ||
1698 | but also on some motherboards including early VIA EPIA motherboards. | ||
1699 | For more information, read <file:Documentation/fb/tridentfb.txt> | ||
1700 | |||
1701 | Say Y if you have such a graphics board. | ||
1702 | |||
1703 | To compile this driver as a module, choose M here: the | ||
1704 | module will be called tridentfb. | ||
1705 | |||
1706 | config FB_ARK | ||
1707 | tristate "ARK 2000PV support" | ||
1708 | depends on FB && PCI | ||
1709 | select FB_CFB_FILLRECT | ||
1710 | select FB_CFB_COPYAREA | ||
1711 | select FB_CFB_IMAGEBLIT | ||
1712 | select FB_TILEBLITTING | ||
1713 | select FB_SVGALIB | ||
1714 | select VGASTATE | ||
1715 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1716 | ---help--- | ||
1717 | Driver for PCI graphics boards with ARK 2000PV chip | ||
1718 | and ICS 5342 RAMDAC. | ||
1719 | |||
1720 | config FB_PM3 | ||
1721 | tristate "Permedia3 support" | ||
1722 | depends on FB && PCI | ||
1723 | select FB_CFB_FILLRECT | ||
1724 | select FB_CFB_COPYAREA | ||
1725 | select FB_CFB_IMAGEBLIT | ||
1726 | help | ||
1727 | This is the frame buffer device driver for the 3DLabs Permedia3 | ||
1728 | chipset, used in Formac ProFormance III, 3DLabs Oxygen VX1 & | ||
1729 | similar boards, 3DLabs Permedia3 Create!, Appian Jeronimo 2000 | ||
1730 | and maybe other boards. | ||
1731 | |||
1732 | config FB_CARMINE | ||
1733 | tristate "Fujitsu carmine frame buffer support" | ||
1734 | depends on FB && PCI | ||
1735 | select FB_CFB_FILLRECT | ||
1736 | select FB_CFB_COPYAREA | ||
1737 | select FB_CFB_IMAGEBLIT | ||
1738 | help | ||
1739 | This is the frame buffer device driver for the Fujitsu Carmine chip. | ||
1740 | The driver provides two independent frame buffer devices. | ||
1741 | |||
1742 | choice | ||
1743 | depends on FB_CARMINE | ||
1744 | prompt "DRAM timing" | ||
1745 | default FB_CARMINE_DRAM_EVAL | ||
1746 | |||
1747 | config FB_CARMINE_DRAM_EVAL | ||
1748 | bool "Eval board timings" | ||
1749 | help | ||
1750 | Use timings which work on the eval card. | ||
1751 | |||
1752 | config CARMINE_DRAM_CUSTOM | ||
1753 | bool "Custom board timings" | ||
1754 | help | ||
1755 | Use custom board timings. | ||
1756 | endchoice | ||
1757 | |||
1758 | config FB_AU1100 | ||
1759 | bool "Au1100 LCD Driver" | ||
1760 | depends on (FB = y) && MIPS_ALCHEMY | ||
1761 | select FB_CFB_FILLRECT | ||
1762 | select FB_CFB_COPYAREA | ||
1763 | select FB_CFB_IMAGEBLIT | ||
1764 | help | ||
1765 | This is the framebuffer driver for the AMD Au1100 SOC. It can drive | ||
1766 | various panels and CRTs by passing in kernel cmd line option | ||
1767 | au1100fb:panel=<name>. | ||
1768 | |||
1769 | config FB_AU1200 | ||
1770 | bool "Au1200/Au1300 LCD Driver" | ||
1771 | depends on (FB = y) && MIPS_ALCHEMY | ||
1772 | select FB_SYS_FILLRECT | ||
1773 | select FB_SYS_COPYAREA | ||
1774 | select FB_SYS_IMAGEBLIT | ||
1775 | select FB_SYS_FOPS | ||
1776 | help | ||
1777 | This is the framebuffer driver for the Au1200/Au1300 SOCs. | ||
1778 | It can drive various panels and CRTs by passing in kernel cmd line | ||
1779 | option au1200fb:panel=<name>. | ||
1780 | |||
1781 | config FB_VT8500 | ||
1782 | bool "VIA VT8500 framebuffer support" | ||
1783 | depends on (FB = y) && ARM && ARCH_VT8500 | ||
1784 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | ||
1785 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1786 | select FB_SYS_IMAGEBLIT | ||
1787 | select FB_MODE_HELPERS | ||
1788 | select VIDEOMODE_HELPERS | ||
1789 | help | ||
1790 | This is the framebuffer driver for VIA VT8500 integrated LCD | ||
1791 | controller. | ||
1792 | |||
1793 | config FB_WM8505 | ||
1794 | bool "Wondermedia WM8xxx-series frame buffer support" | ||
1795 | depends on (FB = y) && ARM && ARCH_VT8500 | ||
1796 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | ||
1797 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1798 | select FB_SYS_IMAGEBLIT | ||
1799 | select FB_MODE_HELPERS | ||
1800 | select VIDEOMODE_HELPERS | ||
1801 | help | ||
1802 | This is the framebuffer driver for WonderMedia WM8xxx-series | ||
1803 | integrated LCD controller. This driver covers the WM8505, WM8650 | ||
1804 | and WM8850 SoCs. | ||
1805 | |||
1806 | config FB_WMT_GE_ROPS | ||
1807 | bool "VT8500/WM8xxx accelerated raster ops support" | ||
1808 | depends on (FB = y) && (FB_VT8500 || FB_WM8505) | ||
1809 | default n | ||
1810 | help | ||
1811 | This adds support for accelerated raster operations on the | ||
1812 | VIA VT8500 and Wondermedia 85xx series SoCs. | ||
1813 | |||
1814 | source "drivers/video/geode/Kconfig" | ||
1815 | |||
1816 | config FB_HIT | ||
1817 | tristate "HD64461 Frame Buffer support" | ||
1818 | depends on FB && HD64461 | ||
1819 | select FB_CFB_FILLRECT | ||
1820 | select FB_CFB_COPYAREA | ||
1821 | select FB_CFB_IMAGEBLIT | ||
1822 | help | ||
1823 | This is the frame buffer device driver for the Hitachi HD64461 LCD | ||
1824 | frame buffer card. | ||
1825 | |||
1826 | config FB_PMAG_AA | ||
1827 | bool "PMAG-AA TURBOchannel framebuffer support" | ||
1828 | depends on (FB = y) && TC | ||
1829 | select FB_CFB_FILLRECT | ||
1830 | select FB_CFB_COPYAREA | ||
1831 | select FB_CFB_IMAGEBLIT | ||
1832 | help | ||
1833 | Support for the PMAG-AA TURBOchannel framebuffer card (1280x1024x1) | ||
1834 | used mainly in the MIPS-based DECstation series. | ||
1835 | |||
1836 | config FB_PMAG_BA | ||
1837 | tristate "PMAG-BA TURBOchannel framebuffer support" | ||
1838 | depends on FB && TC | ||
1839 | select FB_CFB_FILLRECT | ||
1840 | select FB_CFB_COPYAREA | ||
1841 | select FB_CFB_IMAGEBLIT | ||
1842 | help | ||
1843 | Support for the PMAG-BA TURBOchannel framebuffer card (1024x864x8) | ||
1844 | used mainly in the MIPS-based DECstation series. | ||
1845 | |||
1846 | config FB_PMAGB_B | ||
1847 | tristate "PMAGB-B TURBOchannel framebuffer support" | ||
1848 | depends on FB && TC | ||
1849 | select FB_CFB_FILLRECT | ||
1850 | select FB_CFB_COPYAREA | ||
1851 | select FB_CFB_IMAGEBLIT | ||
1852 | help | ||
1853 | Support for the PMAGB-B TURBOchannel framebuffer card used mainly | ||
1854 | in the MIPS-based DECstation series. The card is currently only | ||
1855 | supported in 1280x1024x8 mode. | ||
1856 | |||
1857 | config FB_MAXINE | ||
1858 | bool "Maxine (Personal DECstation) onboard framebuffer support" | ||
1859 | depends on (FB = y) && MACH_DECSTATION | ||
1860 | select FB_CFB_FILLRECT | ||
1861 | select FB_CFB_COPYAREA | ||
1862 | select FB_CFB_IMAGEBLIT | ||
1863 | help | ||
1864 | Support for the onboard framebuffer (1024x768x8) in the Personal | ||
1865 | DECstation series (Personal DECstation 5000/20, /25, /33, /50, | ||
1866 | Codename "Maxine"). | ||
1867 | |||
1868 | config FB_G364 | ||
1869 | bool "G364 frame buffer support" | ||
1870 | depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700) | ||
1871 | select FB_CFB_FILLRECT | ||
1872 | select FB_CFB_COPYAREA | ||
1873 | select FB_CFB_IMAGEBLIT | ||
1874 | help | ||
1875 | The G364 driver is the framebuffer used in MIPS Magnum 4000 and | ||
1876 | Olivetti M700-10 systems. | ||
1877 | |||
1878 | config FB_68328 | ||
1879 | bool "Motorola 68328 native frame buffer support" | ||
1880 | depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328) | ||
1881 | select FB_CFB_FILLRECT | ||
1882 | select FB_CFB_COPYAREA | ||
1883 | select FB_CFB_IMAGEBLIT | ||
1884 | help | ||
1885 | Say Y here if you want to support the built-in frame buffer of | ||
1886 | the Motorola 68328 CPU family. | ||
1887 | |||
1888 | config FB_PXA168 | ||
1889 | tristate "PXA168/910 LCD framebuffer support" | ||
1890 | depends on FB && (CPU_PXA168 || CPU_PXA910) | ||
1891 | select FB_CFB_FILLRECT | ||
1892 | select FB_CFB_COPYAREA | ||
1893 | select FB_CFB_IMAGEBLIT | ||
1894 | ---help--- | ||
1895 | Frame buffer driver for the built-in LCD controller in the Marvell | ||
1896 | MMP processor. | ||
1897 | |||
1898 | config FB_PXA | ||
1899 | tristate "PXA LCD framebuffer support" | ||
1900 | depends on FB && ARCH_PXA | ||
1901 | select FB_CFB_FILLRECT | ||
1902 | select FB_CFB_COPYAREA | ||
1903 | select FB_CFB_IMAGEBLIT | ||
1904 | ---help--- | ||
1905 | Frame buffer driver for the built-in LCD controller in the Intel | ||
1906 | PXA2x0 processor. | ||
1907 | |||
1908 | This driver is also available as a module ( = code which can be | ||
1909 | inserted and removed from the running kernel whenever you want). The | ||
1910 | module will be called pxafb. If you want to compile it as a module, | ||
1911 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
1912 | |||
1913 | If unsure, say N. | ||
1914 | |||
1915 | config FB_PXA_OVERLAY | ||
1916 | bool "Support PXA27x/PXA3xx Overlay(s) as framebuffer" | ||
1917 | default n | ||
1918 | depends on FB_PXA && (PXA27x || PXA3xx) | ||
1919 | |||
1920 | config FB_PXA_SMARTPANEL | ||
1921 | bool "PXA Smartpanel LCD support" | ||
1922 | default n | ||
1923 | depends on FB_PXA | ||
1924 | |||
1925 | config FB_PXA_PARAMETERS | ||
1926 | bool "PXA LCD command line parameters" | ||
1927 | default n | ||
1928 | depends on FB_PXA | ||
1929 | ---help--- | ||
1930 | Enable the use of kernel command line or module parameters | ||
1931 | to configure the physical properties of the LCD panel when | ||
1932 | using the PXA LCD driver. | ||
1933 | |||
1934 | This option allows you to override the panel parameters | ||
1935 | supplied by the platform in order to support multiple | ||
1936 | different models of flatpanel. If you will only be using a | ||
1937 | single model of flatpanel then you can safely leave this | ||
1938 | option disabled. | ||
1939 | |||
1940 | <file:Documentation/fb/pxafb.txt> describes the available parameters. | ||
1941 | |||
1942 | config PXA3XX_GCU | ||
1943 | tristate "PXA3xx 2D graphics accelerator driver" | ||
1944 | depends on FB_PXA | ||
1945 | help | ||
1946 | Kernelspace driver for the 2D graphics controller unit (GCU) | ||
1947 | found on PXA3xx processors. There is a counterpart driver in the | ||
1948 | DirectFB suite, see http://www.directfb.org/ | ||
1949 | |||
1950 | If you compile this as a module, it will be called pxa3xx_gcu. | ||
1951 | |||
1952 | config FB_MBX | ||
1953 | tristate "2700G LCD framebuffer support" | ||
1954 | depends on FB && ARCH_PXA | ||
1955 | select FB_CFB_FILLRECT | ||
1956 | select FB_CFB_COPYAREA | ||
1957 | select FB_CFB_IMAGEBLIT | ||
1958 | ---help--- | ||
1959 | Framebuffer driver for the Intel 2700G (Marathon) Graphics | ||
1960 | Accelerator | ||
1961 | |||
1962 | config FB_MBX_DEBUG | ||
1963 | bool "Enable debugging info via debugfs" | ||
1964 | depends on FB_MBX && DEBUG_FS | ||
1965 | default n | ||
1966 | ---help--- | ||
1967 | Enable this if you want debugging information using the debug | ||
1968 | filesystem (debugfs) | ||
1969 | |||
1970 | If unsure, say N. | ||
1971 | |||
1972 | config FB_FSL_DIU | ||
1973 | tristate "Freescale DIU framebuffer support" | ||
1974 | depends on FB && FSL_SOC | ||
1975 | select FB_MODE_HELPERS | ||
1976 | select FB_CFB_FILLRECT | ||
1977 | select FB_CFB_COPYAREA | ||
1978 | select FB_CFB_IMAGEBLIT | ||
1979 | select PPC_LIB_RHEAP | ||
1980 | ---help--- | ||
1981 | Framebuffer driver for the Freescale SoC DIU | ||
1982 | |||
1983 | config FB_W100 | ||
1984 | tristate "W100 frame buffer support" | ||
1985 | depends on FB && ARCH_PXA | ||
1986 | select FB_CFB_FILLRECT | ||
1987 | select FB_CFB_COPYAREA | ||
1988 | select FB_CFB_IMAGEBLIT | ||
1989 | ---help--- | ||
1990 | Frame buffer driver for the w100 as found on the Sharp SL-Cxx series. | ||
1991 | It can also drive the w3220 chip found on iPAQ hx4700. | ||
1992 | |||
1993 | This driver is also available as a module ( = code which can be | ||
1994 | inserted and removed from the running kernel whenever you want). The | ||
1995 | module will be called w100fb. If you want to compile it as a module, | ||
1996 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
1997 | |||
1998 | If unsure, say N. | ||
1999 | |||
2000 | config FB_SH_MOBILE_LCDC | ||
2001 | tristate "SuperH Mobile LCDC framebuffer support" | ||
2002 | depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK | ||
2003 | select FB_SYS_FILLRECT | ||
2004 | select FB_SYS_COPYAREA | ||
2005 | select FB_SYS_IMAGEBLIT | ||
2006 | select FB_SYS_FOPS | ||
2007 | select FB_DEFERRED_IO | ||
2008 | select FB_BACKLIGHT | ||
2009 | select SH_MIPI_DSI if SH_LCD_MIPI_DSI | ||
2010 | ---help--- | ||
2011 | Frame buffer driver for the on-chip SH-Mobile LCD controller. | ||
2012 | |||
2013 | config FB_SH_MOBILE_HDMI | ||
2014 | tristate "SuperH Mobile HDMI controller support" | ||
2015 | depends on FB_SH_MOBILE_LCDC | ||
2016 | select FB_MODE_HELPERS | ||
2017 | select SOUND | ||
2018 | select SND | ||
2019 | select SND_SOC | ||
2020 | ---help--- | ||
2021 | Driver for the on-chip SH-Mobile HDMI controller. | ||
2022 | |||
2023 | config FB_TMIO | ||
2024 | tristate "Toshiba Mobile IO FrameBuffer support" | ||
2025 | depends on FB && MFD_CORE | ||
2026 | select FB_CFB_FILLRECT | ||
2027 | select FB_CFB_COPYAREA | ||
2028 | select FB_CFB_IMAGEBLIT | ||
2029 | ---help--- | ||
2030 | Frame buffer driver for the Toshiba Mobile IO integrated as found | ||
2031 | on the Sharp SL-6000 series | ||
2032 | |||
2033 | This driver is also available as a module ( = code which can be | ||
2034 | inserted and removed from the running kernel whenever you want). The | ||
2035 | module will be called tmiofb. If you want to compile it as a module, | ||
2036 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2037 | |||
2038 | If unsure, say N. | ||
2039 | |||
2040 | config FB_TMIO_ACCELL | ||
2041 | bool "tmiofb acceleration" | ||
2042 | depends on FB_TMIO | ||
2043 | default y | ||
2044 | |||
2045 | config FB_S3C | ||
2046 | tristate "Samsung S3C framebuffer support" | ||
2047 | depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || ARCH_S5P64X0 || \ | ||
2048 | ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) | ||
2049 | select FB_CFB_FILLRECT | ||
2050 | select FB_CFB_COPYAREA | ||
2051 | select FB_CFB_IMAGEBLIT | ||
2052 | ---help--- | ||
2053 | Frame buffer driver for the built-in FB controller in the Samsung | ||
2054 | SoC line from the S3C2443 onwards, including the S3C2416, S3C2450, | ||
2055 | and the S3C64XX series such as the S3C6400 and S3C6410. | ||
2056 | |||
2057 | These chips all have the same basic framebuffer design with the | ||
2058 | actual capabilities depending on the chip. For instance the S3C6400 | ||
2059 | and S3C6410 support 4 hardware windows whereas the S3C24XX series | ||
2060 | currently only have two. | ||
2061 | |||
2062 | Currently the support is only for the S3C6400 and S3C6410 SoCs. | ||
2063 | |||
2064 | config FB_S3C_DEBUG_REGWRITE | ||
2065 | bool "Debug register writes" | ||
2066 | depends on FB_S3C | ||
2067 | ---help--- | ||
2068 | Show all register writes via pr_debug() | ||
2069 | |||
2070 | config FB_S3C2410 | ||
2071 | tristate "S3C2410 LCD framebuffer support" | ||
2072 | depends on FB && ARCH_S3C24XX | ||
2073 | select FB_CFB_FILLRECT | ||
2074 | select FB_CFB_COPYAREA | ||
2075 | select FB_CFB_IMAGEBLIT | ||
2076 | ---help--- | ||
2077 | Frame buffer driver for the built-in LCD controller in the Samsung | ||
2078 | S3C2410 processor. | ||
2079 | |||
2080 | This driver is also available as a module ( = code which can be | ||
2081 | inserted and removed from the running kernel whenever you want). The | ||
2082 | module will be called s3c2410fb. If you want to compile it as a module, | ||
2083 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2084 | |||
2085 | If unsure, say N. | ||
2086 | config FB_S3C2410_DEBUG | ||
2087 | bool "S3C2410 lcd debug messages" | ||
2088 | depends on FB_S3C2410 | ||
2089 | help | ||
2090 | Turn on debugging messages. Note that you can set/unset at run time | ||
2091 | through sysfs | ||
2092 | |||
2093 | config FB_NUC900 | ||
2094 | bool "NUC900 LCD framebuffer support" | ||
2095 | depends on FB && ARCH_W90X900 | ||
2096 | select FB_CFB_FILLRECT | ||
2097 | select FB_CFB_COPYAREA | ||
2098 | select FB_CFB_IMAGEBLIT | ||
2099 | ---help--- | ||
2100 | Frame buffer driver for the built-in LCD controller in the Nuvoton | ||
2101 | NUC900 processor | ||
2102 | |||
2103 | config GPM1040A0_320X240 | ||
2104 | bool "Giantplus Technology GPM1040A0 320x240 Color TFT LCD" | ||
2105 | depends on FB_NUC900 | ||
2106 | |||
2107 | config FB_SM501 | ||
2108 | tristate "Silicon Motion SM501 framebuffer support" | ||
2109 | depends on FB && MFD_SM501 | ||
2110 | select FB_CFB_FILLRECT | ||
2111 | select FB_CFB_COPYAREA | ||
2112 | select FB_CFB_IMAGEBLIT | ||
2113 | ---help--- | ||
2114 | Frame buffer driver for the CRT and LCD controllers in the Silicon | ||
2115 | Motion SM501. | ||
2116 | |||
2117 | This driver is also available as a module ( = code which can be | ||
2118 | inserted and removed from the running kernel whenever you want). The | ||
2119 | module will be called sm501fb. If you want to compile it as a module, | ||
2120 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2121 | |||
2122 | If unsure, say N. | ||
2123 | |||
2124 | config FB_SMSCUFX | ||
2125 | tristate "SMSC UFX6000/7000 USB Framebuffer support" | ||
2126 | depends on FB && USB | ||
2127 | select FB_MODE_HELPERS | ||
2128 | select FB_SYS_FILLRECT | ||
2129 | select FB_SYS_COPYAREA | ||
2130 | select FB_SYS_IMAGEBLIT | ||
2131 | select FB_SYS_FOPS | ||
2132 | select FB_DEFERRED_IO | ||
2133 | ---help--- | ||
2134 | This is a kernel framebuffer driver for SMSC UFX USB devices. | ||
2135 | Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and | ||
2136 | mplayer -vo fbdev. Supports both UFX6000 (USB 2.0) and UFX7000 | ||
2137 | (USB 3.0) devices. | ||
2138 | To compile as a module, choose M here: the module name is smscufx. | ||
2139 | |||
2140 | config FB_UDL | ||
2141 | tristate "Displaylink USB Framebuffer support" | ||
2142 | depends on FB && USB | ||
2143 | select FB_MODE_HELPERS | ||
2144 | select FB_SYS_FILLRECT | ||
2145 | select FB_SYS_COPYAREA | ||
2146 | select FB_SYS_IMAGEBLIT | ||
2147 | select FB_SYS_FOPS | ||
2148 | select FB_DEFERRED_IO | ||
2149 | ---help--- | ||
2150 | This is a kernel framebuffer driver for DisplayLink USB devices. | ||
2151 | Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and | ||
2152 | mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices. | ||
2153 | To compile as a module, choose M here: the module name is udlfb. | ||
2154 | |||
2155 | config FB_IBM_GXT4500 | ||
2156 | tristate "Framebuffer support for IBM GXT4000P/4500P/6000P/6500P adaptors" | ||
2157 | depends on FB && PPC | ||
2158 | select FB_CFB_FILLRECT | ||
2159 | select FB_CFB_COPYAREA | ||
2160 | select FB_CFB_IMAGEBLIT | ||
2161 | ---help--- | ||
2162 | Say Y here to enable support for the IBM GXT4000P/6000P and | ||
2163 | GXT4500P/6500P display adaptor based on Raster Engine RC1000, | ||
2164 | found on some IBM System P (pSeries) machines. This driver | ||
2165 | doesn't use Geometry Engine GT1000. | ||
2166 | |||
2167 | config FB_PS3 | ||
2168 | tristate "PS3 GPU framebuffer driver" | ||
2169 | depends on FB && PS3_PS3AV | ||
2170 | select FB_SYS_FILLRECT | ||
2171 | select FB_SYS_COPYAREA | ||
2172 | select FB_SYS_IMAGEBLIT | ||
2173 | select FB_SYS_FOPS | ||
2174 | select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE | ||
2175 | ---help--- | ||
2176 | Include support for the virtual frame buffer in the PS3 platform. | ||
2177 | |||
2178 | config FB_PS3_DEFAULT_SIZE_M | ||
2179 | int "PS3 default frame buffer size (in MiB)" | ||
2180 | depends on FB_PS3 | ||
2181 | default 9 | ||
2182 | ---help--- | ||
2183 | This is the default size (in MiB) of the virtual frame buffer in | ||
2184 | the PS3. | ||
2185 | The default value can be overridden on the kernel command line | ||
2186 | using the "ps3fb" option (e.g. "ps3fb=9M"); | ||
2187 | |||
2188 | config FB_XILINX | ||
2189 | tristate "Xilinx frame buffer support" | ||
2190 | depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ) | ||
2191 | select FB_CFB_FILLRECT | ||
2192 | select FB_CFB_COPYAREA | ||
2193 | select FB_CFB_IMAGEBLIT | ||
2194 | ---help--- | ||
2195 | Include support for the Xilinx ML300/ML403 reference design | ||
2196 | framebuffer. ML300 carries a 640*480 LCD display on the board, | ||
2197 | ML403 uses a standard DB15 VGA connector. | ||
2198 | |||
2199 | config FB_GOLDFISH | ||
2200 | tristate "Goldfish Framebuffer" | ||
2201 | depends on FB && HAS_DMA | ||
2202 | select FB_CFB_FILLRECT | ||
2203 | select FB_CFB_COPYAREA | ||
2204 | select FB_CFB_IMAGEBLIT | ||
2205 | ---help--- | ||
2206 | Framebuffer driver for Goldfish Virtual Platform | ||
2207 | |||
2208 | config FB_COBALT | ||
2209 | tristate "Cobalt server LCD frame buffer support" | ||
2210 | depends on FB && (MIPS_COBALT || MIPS_SEAD3) | ||
2211 | |||
2212 | config FB_SH7760 | ||
2213 | bool "SH7760/SH7763/SH7720/SH7721 LCDC support" | ||
2214 | depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ | ||
2215 | || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721) | ||
2216 | select FB_CFB_FILLRECT | ||
2217 | select FB_CFB_COPYAREA | ||
2218 | select FB_CFB_IMAGEBLIT | ||
2219 | ---help--- | ||
2220 | Support for the SH7760/SH7763/SH7720/SH7721 integrated | ||
2221 | (D)STN/TFT LCD Controller. | ||
2222 | Supports display resolutions up to 1024x1024 pixel, grayscale and | ||
2223 | color operation, with depths ranging from 1 bpp to 8 bpp monochrome | ||
2224 | and 8, 15 or 16 bpp color; 90 degrees clockwise display rotation for | ||
2225 | panels <= 320 pixel horizontal resolution. | ||
2226 | |||
2227 | config FB_DA8XX | ||
2228 | tristate "DA8xx/OMAP-L1xx/AM335x Framebuffer support" | ||
2229 | depends on FB && (ARCH_DAVINCI_DA8XX || SOC_AM33XX) | ||
2230 | select FB_CFB_FILLRECT | ||
2231 | select FB_CFB_COPYAREA | ||
2232 | select FB_CFB_IMAGEBLIT | ||
2233 | select FB_CFB_REV_PIXELS_IN_BYTE | ||
2234 | select FB_MODE_HELPERS | ||
2235 | select VIDEOMODE_HELPERS | ||
2236 | ---help--- | ||
2237 | This is the frame buffer device driver for the TI LCD controller | ||
2238 | found on DA8xx/OMAP-L1xx/AM335x SoCs. | ||
2239 | If unsure, say N. | ||
2240 | |||
2241 | config FB_VIRTUAL | ||
2242 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" | ||
2243 | depends on FB | ||
2244 | select FB_SYS_FILLRECT | ||
2245 | select FB_SYS_COPYAREA | ||
2246 | select FB_SYS_IMAGEBLIT | ||
2247 | select FB_SYS_FOPS | ||
2248 | ---help--- | ||
2249 | This is a `virtual' frame buffer device. It operates on a chunk of | ||
2250 | unswappable kernel memory instead of on the memory of a graphics | ||
2251 | board. This means you cannot see any output sent to this frame | ||
2252 | buffer device, while it does consume precious memory. The main use | ||
2253 | of this frame buffer device is testing and debugging the frame | ||
2254 | buffer subsystem. Do NOT enable it for normal systems! To protect | ||
2255 | the innocent, it has to be enabled explicitly at boot time using the | ||
2256 | kernel option `video=vfb:'. | ||
2257 | |||
2258 | To compile this driver as a module, choose M here: the | ||
2259 | module will be called vfb. In order to load it, you must use | ||
2260 | the vfb_enable=1 option. | ||
2261 | |||
2262 | If unsure, say N. | ||
2263 | |||
2264 | config XEN_FBDEV_FRONTEND | ||
2265 | tristate "Xen virtual frame buffer support" | ||
2266 | depends on FB && XEN | ||
2267 | select FB_SYS_FILLRECT | ||
2268 | select FB_SYS_COPYAREA | ||
2269 | select FB_SYS_IMAGEBLIT | ||
2270 | select FB_SYS_FOPS | ||
2271 | select FB_DEFERRED_IO | ||
2272 | select INPUT_XEN_KBDDEV_FRONTEND if INPUT_MISC | ||
2273 | select XEN_XENBUS_FRONTEND | ||
2274 | default y | ||
2275 | help | ||
2276 | This driver implements the front-end of the Xen virtual | ||
2277 | frame buffer driver. It communicates with a back-end | ||
2278 | in another domain. | ||
2279 | |||
2280 | config FB_METRONOME | ||
2281 | tristate "E-Ink Metronome/8track controller support" | ||
2282 | depends on FB | ||
2283 | select FB_SYS_FILLRECT | ||
2284 | select FB_SYS_COPYAREA | ||
2285 | select FB_SYS_IMAGEBLIT | ||
2286 | select FB_SYS_FOPS | ||
2287 | select FB_DEFERRED_IO | ||
2288 | help | ||
2289 | This driver implements support for the E-Ink Metronome | ||
2290 | controller. The pre-release name for this device was 8track | ||
2291 | and could also have been called by some vendors as PVI-nnnn. | ||
2292 | |||
2293 | config FB_MB862XX | ||
2294 | tristate "Fujitsu MB862xx GDC support" | ||
2295 | depends on FB | ||
2296 | depends on PCI || (OF && PPC) | ||
2297 | select FB_CFB_FILLRECT | ||
2298 | select FB_CFB_COPYAREA | ||
2299 | select FB_CFB_IMAGEBLIT | ||
2300 | ---help--- | ||
2301 | Frame buffer driver for Fujitsu Carmine/Coral-P(A)/Lime controllers. | ||
2302 | |||
2303 | choice | ||
2304 | prompt "GDC variant" | ||
2305 | depends on FB_MB862XX | ||
2306 | |||
2307 | config FB_MB862XX_PCI_GDC | ||
2308 | bool "Carmine/Coral-P(A) GDC" | ||
2309 | depends on PCI | ||
2310 | ---help--- | ||
2311 | This enables framebuffer support for Fujitsu Carmine/Coral-P(A) | ||
2312 | PCI graphics controller devices. | ||
2313 | |||
2314 | config FB_MB862XX_LIME | ||
2315 | bool "Lime GDC" | ||
2316 | depends on OF && PPC | ||
2317 | select FB_FOREIGN_ENDIAN | ||
2318 | select FB_LITTLE_ENDIAN | ||
2319 | ---help--- | ||
2320 | Framebuffer support for Fujitsu Lime GDC on host CPU bus. | ||
2321 | |||
2322 | endchoice | ||
2323 | |||
2324 | config FB_MB862XX_I2C | ||
2325 | bool "Support I2C bus on MB862XX GDC" | ||
2326 | depends on FB_MB862XX && I2C | ||
2327 | default y | ||
2328 | help | ||
2329 | Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter | ||
2330 | driver to support accessing I2C devices on controller's I2C bus. | ||
2331 | These are usually some video decoder chips. | ||
2332 | |||
2333 | config FB_EP93XX | ||
2334 | tristate "EP93XX frame buffer support" | ||
2335 | depends on FB && ARCH_EP93XX | ||
2336 | select FB_CFB_FILLRECT | ||
2337 | select FB_CFB_COPYAREA | ||
2338 | select FB_CFB_IMAGEBLIT | ||
2339 | ---help--- | ||
2340 | Framebuffer driver for the Cirrus Logic EP93XX series of processors. | ||
2341 | This driver is also available as a module. The module will be called | ||
2342 | ep93xx-fb. | ||
2343 | |||
2344 | config FB_PRE_INIT_FB | ||
2345 | bool "Don't reinitialize, use bootloader's GDC/Display configuration" | ||
2346 | depends on FB && FB_MB862XX_LIME | ||
2347 | ---help--- | ||
2348 | Select this option if display contents should be inherited as set by | ||
2349 | the bootloader. | ||
2350 | |||
2351 | config FB_MSM | ||
2352 | tristate "MSM Framebuffer support" | ||
2353 | depends on FB && ARCH_MSM | ||
2354 | select FB_CFB_FILLRECT | ||
2355 | select FB_CFB_COPYAREA | ||
2356 | select FB_CFB_IMAGEBLIT | ||
2357 | |||
2358 | config FB_MX3 | ||
2359 | tristate "MX3 Framebuffer support" | ||
2360 | depends on FB && MX3_IPU | ||
2361 | select FB_CFB_FILLRECT | ||
2362 | select FB_CFB_COPYAREA | ||
2363 | select FB_CFB_IMAGEBLIT | ||
2364 | default y | ||
2365 | help | ||
2366 | This is a framebuffer device for the i.MX31 LCD Controller. So | ||
2367 | far only synchronous displays are supported. If you plan to use | ||
2368 | an LCD display with your i.MX31 system, say Y here. | ||
2369 | |||
2370 | config FB_BROADSHEET | ||
2371 | tristate "E-Ink Broadsheet/Epson S1D13521 controller support" | ||
2372 | depends on FB | ||
2373 | select FB_SYS_FILLRECT | ||
2374 | select FB_SYS_COPYAREA | ||
2375 | select FB_SYS_IMAGEBLIT | ||
2376 | select FB_SYS_FOPS | ||
2377 | select FB_DEFERRED_IO | ||
2378 | help | ||
2379 | This driver implements support for the E-Ink Broadsheet | ||
2380 | controller. The release name for this device was Epson S1D13521 | ||
2381 | and could also have been called by other names when coupled with | ||
2382 | a bridge adapter. | ||
2383 | |||
2384 | config FB_AUO_K190X | ||
2385 | tristate "AUO-K190X EPD controller support" | ||
2386 | depends on FB | ||
2387 | select FB_SYS_FILLRECT | ||
2388 | select FB_SYS_COPYAREA | ||
2389 | select FB_SYS_IMAGEBLIT | ||
2390 | select FB_SYS_FOPS | ||
2391 | select FB_DEFERRED_IO | ||
2392 | help | ||
2393 | Provides support for epaper controllers from the K190X series | ||
2394 | of AUO. These controllers can be used to drive epaper displays | ||
2395 | from Sipix. | ||
2396 | |||
2397 | This option enables the common support, shared by the individual | ||
2398 | controller drivers. You will also have to enable the driver | ||
2399 | for the controller type used in your device. | ||
2400 | |||
2401 | config FB_AUO_K1900 | ||
2402 | tristate "AUO-K1900 EPD controller support" | ||
2403 | depends on FB && FB_AUO_K190X | ||
2404 | help | ||
2405 | This driver implements support for the AUO K1900 epd-controller. | ||
2406 | This controller can drive Sipix epaper displays but can only do | ||
2407 | serial updates, reducing the number of possible frames per second. | ||
2408 | |||
2409 | config FB_AUO_K1901 | ||
2410 | tristate "AUO-K1901 EPD controller support" | ||
2411 | depends on FB && FB_AUO_K190X | ||
2412 | help | ||
2413 | This driver implements support for the AUO K1901 epd-controller. | ||
2414 | This controller can drive Sipix epaper displays and supports | ||
2415 | concurrent updates, making higher frames per second possible. | ||
2416 | |||
2417 | config FB_JZ4740 | ||
2418 | tristate "JZ4740 LCD framebuffer support" | ||
2419 | depends on FB && MACH_JZ4740 | ||
2420 | select FB_SYS_FILLRECT | ||
2421 | select FB_SYS_COPYAREA | ||
2422 | select FB_SYS_IMAGEBLIT | ||
2423 | help | ||
2424 | Framebuffer support for the JZ4740 SoC. | ||
2425 | |||
2426 | config FB_MXS | ||
2427 | tristate "MXS LCD framebuffer support" | ||
2428 | depends on FB && ARCH_MXS | ||
2429 | select FB_CFB_FILLRECT | ||
2430 | select FB_CFB_COPYAREA | ||
2431 | select FB_CFB_IMAGEBLIT | ||
2432 | select FB_MODE_HELPERS | ||
2433 | select VIDEOMODE_HELPERS | ||
2434 | help | ||
2435 | Framebuffer support for the MXS SoC. | ||
2436 | |||
2437 | config FB_PUV3_UNIGFX | ||
2438 | tristate "PKUnity v3 Unigfx framebuffer support" | ||
2439 | depends on FB && UNICORE32 && ARCH_PUV3 | ||
2440 | select FB_SYS_FILLRECT | ||
2441 | select FB_SYS_COPYAREA | ||
2442 | select FB_SYS_IMAGEBLIT | ||
2443 | select FB_SYS_FOPS | ||
2444 | help | ||
2445 | Choose this option if you want to use the Unigfx device as a | ||
2446 | framebuffer device. Without the support of PCI & AGP. | ||
2447 | |||
2448 | config FB_HYPERV | ||
2449 | tristate "Microsoft Hyper-V Synthetic Video support" | ||
2450 | depends on FB && HYPERV | ||
2451 | select FB_CFB_FILLRECT | ||
2452 | select FB_CFB_COPYAREA | ||
2453 | select FB_CFB_IMAGEBLIT | ||
2454 | help | ||
2455 | This framebuffer driver supports Microsoft Hyper-V Synthetic Video. | ||
2456 | |||
2457 | config FB_SIMPLE | ||
2458 | bool "Simple framebuffer support" | ||
2459 | depends on (FB = y) | ||
2460 | select FB_CFB_FILLRECT | ||
2461 | select FB_CFB_COPYAREA | ||
2462 | select FB_CFB_IMAGEBLIT | ||
2463 | help | ||
2464 | Say Y if you want support for a simple frame-buffer. | ||
2465 | |||
2466 | This driver assumes that the display hardware has been initialized | ||
2467 | before the kernel boots, and the kernel will simply render to the | ||
2468 | pre-allocated frame buffer surface. | ||
2469 | |||
2470 | Configuration re: surface address, size, and format must be provided | ||
2471 | through device tree, or plain old platform data. | ||
2472 | |||
2473 | source "drivers/video/omap/Kconfig" | ||
2474 | source "drivers/video/omap2/Kconfig" | ||
2475 | source "drivers/video/exynos/Kconfig" | ||
2476 | source "drivers/video/mmp/Kconfig" | ||
2477 | source "drivers/video/backlight/Kconfig" | ||
2478 | |||
2479 | if VT | 44 | if VT |
2480 | source "drivers/video/console/Kconfig" | 45 | source "drivers/video/console/Kconfig" |
2481 | endif | 46 | endif |
2482 | 47 | ||
2483 | if FB || SGI_NEWPORT_CONSOLE | 48 | if FB || SGI_NEWPORT_CONSOLE |
2484 | source "drivers/video/logo/Kconfig" | 49 | source "drivers/video/logo/Kconfig" |
2485 | endif | ||
2486 | 50 | ||
2487 | config FB_SH_MOBILE_MERAM | 51 | endif |
2488 | tristate "SuperH Mobile MERAM read ahead support" | ||
2489 | depends on (SUPERH || ARCH_SHMOBILE) | ||
2490 | select GENERIC_ALLOCATOR | ||
2491 | ---help--- | ||
2492 | Enable MERAM support for the SuperH controller. | ||
2493 | |||
2494 | This will allow for caching of the framebuffer to provide more | ||
2495 | reliable access under heavy main memory bus traffic situations. | ||
2496 | Up to 4 memory channels can be configured, allowing 4 RGB or | ||
2497 | 2 YCbCr framebuffers to be configured. | ||
2498 | 52 | ||
2499 | config FB_SSD1307 | ||
2500 | tristate "Solomon SSD1307 framebuffer support" | ||
2501 | depends on FB && I2C | ||
2502 | depends on OF | ||
2503 | depends on GPIOLIB | ||
2504 | select FB_SYS_FOPS | ||
2505 | select FB_SYS_FILLRECT | ||
2506 | select FB_SYS_COPYAREA | ||
2507 | select FB_SYS_IMAGEBLIT | ||
2508 | select FB_DEFERRED_IO | ||
2509 | select PWM | ||
2510 | help | ||
2511 | This driver implements support for the Solomon SSD1307 | ||
2512 | OLED controller over I2C. | ||
2513 | 53 | ||
2514 | endmenu | 54 | endmenu |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 1be26fe10592..9ad3c17d6456 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -1,175 +1,11 @@ | |||
1 | # Makefile for the Linux video drivers. | ||
2 | # 5 Aug 1999, James Simmons, <mailto:jsimmons@users.sf.net> | ||
3 | # Rewritten to use lists instead of if-statements. | ||
4 | |||
5 | # Each configuration option enables a list of files. | ||
6 | |||
7 | obj-$(CONFIG_VGASTATE) += vgastate.o | 1 | obj-$(CONFIG_VGASTATE) += vgastate.o |
8 | obj-$(CONFIG_HDMI) += hdmi.o | 2 | obj-$(CONFIG_HDMI) += hdmi.o |
9 | obj-y += fb_notify.o | ||
10 | obj-$(CONFIG_FB) += fb.o | ||
11 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ | ||
12 | modedb.o fbcvt.o | ||
13 | fb-objs := $(fb-y) | ||
14 | 3 | ||
15 | obj-$(CONFIG_VT) += console/ | 4 | obj-$(CONFIG_VT) += console/ |
16 | obj-$(CONFIG_LOGO) += logo/ | 5 | obj-$(CONFIG_LOGO) += logo/ |
17 | obj-y += backlight/ | 6 | obj-y += backlight/ |
18 | 7 | ||
19 | obj-$(CONFIG_EXYNOS_VIDEO) += exynos/ | 8 | obj-y += fbdev/ |
20 | |||
21 | obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o | ||
22 | obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o | ||
23 | obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o | ||
24 | obj-$(CONFIG_FB_SYS_FILLRECT) += sysfillrect.o | ||
25 | obj-$(CONFIG_FB_SYS_COPYAREA) += syscopyarea.o | ||
26 | obj-$(CONFIG_FB_SYS_IMAGEBLIT) += sysimgblt.o | ||
27 | obj-$(CONFIG_FB_SYS_FOPS) += fb_sys_fops.o | ||
28 | obj-$(CONFIG_FB_SVGALIB) += svgalib.o | ||
29 | obj-$(CONFIG_FB_MACMODES) += macmodes.o | ||
30 | obj-$(CONFIG_FB_DDC) += fb_ddc.o | ||
31 | obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o | ||
32 | obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o | ||
33 | |||
34 | # Hardware specific drivers go first | ||
35 | obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o | ||
36 | obj-$(CONFIG_FB_ARC) += arcfb.o | ||
37 | obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o | ||
38 | obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o | ||
39 | obj-$(CONFIG_FB_GRVGA) += grvga.o | ||
40 | obj-$(CONFIG_FB_PM2) += pm2fb.o | ||
41 | obj-$(CONFIG_FB_PM3) += pm3fb.o | ||
42 | |||
43 | obj-$(CONFIG_FB_I740) += i740fb.o | ||
44 | obj-$(CONFIG_FB_MATROX) += matrox/ | ||
45 | obj-$(CONFIG_FB_RIVA) += riva/ | ||
46 | obj-$(CONFIG_FB_NVIDIA) += nvidia/ | ||
47 | obj-$(CONFIG_FB_ATY) += aty/ macmodes.o | ||
48 | obj-$(CONFIG_FB_ATY128) += aty/ macmodes.o | ||
49 | obj-$(CONFIG_FB_RADEON) += aty/ | ||
50 | obj-$(CONFIG_FB_SIS) += sis/ | ||
51 | obj-$(CONFIG_FB_VIA) += via/ | ||
52 | obj-$(CONFIG_FB_KYRO) += kyro/ | ||
53 | obj-$(CONFIG_FB_SAVAGE) += savage/ | ||
54 | obj-$(CONFIG_FB_GEODE) += geode/ | ||
55 | obj-$(CONFIG_FB_MBX) += mbx/ | ||
56 | obj-$(CONFIG_FB_NEOMAGIC) += neofb.o | ||
57 | obj-$(CONFIG_FB_3DFX) += tdfxfb.o | ||
58 | obj-$(CONFIG_FB_CONTROL) += controlfb.o | ||
59 | obj-$(CONFIG_FB_PLATINUM) += platinumfb.o | ||
60 | obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o | ||
61 | obj-$(CONFIG_FB_CT65550) += chipsfb.o | ||
62 | obj-$(CONFIG_FB_IMSTT) += imsttfb.o | ||
63 | obj-$(CONFIG_FB_FM2) += fm2fb.o | ||
64 | obj-$(CONFIG_FB_VT8623) += vt8623fb.o | ||
65 | obj-$(CONFIG_FB_TRIDENT) += tridentfb.o | ||
66 | obj-$(CONFIG_FB_LE80578) += vermilion/ | ||
67 | obj-$(CONFIG_FB_S3) += s3fb.o | ||
68 | obj-$(CONFIG_FB_ARK) += arkfb.o | ||
69 | obj-$(CONFIG_FB_STI) += stifb.o | ||
70 | obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o | ||
71 | obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o | ||
72 | obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o | ||
73 | obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o | ||
74 | obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o | ||
75 | obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o | ||
76 | obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o | ||
77 | obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o | ||
78 | obj-$(CONFIG_FB_ACORN) += acornfb.o | ||
79 | obj-$(CONFIG_FB_ATARI) += atafb.o c2p_iplan2.o atafb_mfb.o \ | ||
80 | atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o | ||
81 | obj-$(CONFIG_FB_MAC) += macfb.o | ||
82 | obj-$(CONFIG_FB_HECUBA) += hecubafb.o | ||
83 | obj-$(CONFIG_FB_N411) += n411.o | ||
84 | obj-$(CONFIG_FB_HGA) += hgafb.o | ||
85 | obj-$(CONFIG_FB_XVR500) += sunxvr500.o | ||
86 | obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o | ||
87 | obj-$(CONFIG_FB_XVR1000) += sunxvr1000.o | ||
88 | obj-$(CONFIG_FB_IGA) += igafb.o | ||
89 | obj-$(CONFIG_FB_APOLLO) += dnfb.o | ||
90 | obj-$(CONFIG_FB_Q40) += q40fb.o | ||
91 | obj-$(CONFIG_FB_TGA) += tgafb.o | ||
92 | obj-$(CONFIG_FB_HP300) += hpfb.o | ||
93 | obj-$(CONFIG_FB_G364) += g364fb.o | ||
94 | obj-$(CONFIG_FB_EP93XX) += ep93xx-fb.o | ||
95 | obj-$(CONFIG_FB_SA1100) += sa1100fb.o | ||
96 | obj-$(CONFIG_FB_HIT) += hitfb.o | ||
97 | obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o | ||
98 | obj-$(CONFIG_FB_PVR2) += pvr2fb.o | ||
99 | obj-$(CONFIG_FB_VOODOO1) += sstfb.o | ||
100 | obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o | ||
101 | obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o | ||
102 | obj-$(CONFIG_FB_68328) += 68328fb.o | ||
103 | obj-$(CONFIG_FB_GBE) += gbefb.o | ||
104 | obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o | ||
105 | obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o | ||
106 | obj-$(CONFIG_FB_PXA) += pxafb.o | ||
107 | obj-$(CONFIG_FB_PXA168) += pxa168fb.o | ||
108 | obj-$(CONFIG_PXA3XX_GCU) += pxa3xx-gcu.o | ||
109 | obj-$(CONFIG_MMP_DISP) += mmp/ | ||
110 | obj-$(CONFIG_FB_W100) += w100fb.o | ||
111 | obj-$(CONFIG_FB_TMIO) += tmiofb.o | ||
112 | obj-$(CONFIG_FB_AU1100) += au1100fb.o | ||
113 | obj-$(CONFIG_FB_AU1200) += au1200fb.o | ||
114 | obj-$(CONFIG_FB_VT8500) += vt8500lcdfb.o | ||
115 | obj-$(CONFIG_FB_WM8505) += wm8505fb.o | ||
116 | obj-$(CONFIG_FB_PMAG_AA) += pmag-aa-fb.o | ||
117 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o | ||
118 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o | ||
119 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o | ||
120 | obj-$(CONFIG_FB_METRONOME) += metronomefb.o | ||
121 | obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o | ||
122 | obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o | ||
123 | obj-$(CONFIG_FB_AUO_K1900) += auo_k1900fb.o | ||
124 | obj-$(CONFIG_FB_AUO_K1901) += auo_k1901fb.o | ||
125 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o | ||
126 | obj-$(CONFIG_FB_SH7760) += sh7760fb.o | ||
127 | obj-$(CONFIG_FB_IMX) += imxfb.o | ||
128 | obj-$(CONFIG_FB_S3C) += s3c-fb.o | ||
129 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o | ||
130 | obj-$(CONFIG_FB_FSL_DIU) += fsl-diu-fb.o | ||
131 | obj-$(CONFIG_FB_COBALT) += cobalt_lcdfb.o | ||
132 | obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o | ||
133 | obj-$(CONFIG_FB_PS3) += ps3fb.o | ||
134 | obj-$(CONFIG_FB_SM501) += sm501fb.o | ||
135 | obj-$(CONFIG_FB_UDL) += udlfb.o | ||
136 | obj-$(CONFIG_FB_SMSCUFX) += smscufx.o | ||
137 | obj-$(CONFIG_FB_XILINX) += xilinxfb.o | ||
138 | obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o | ||
139 | obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o | ||
140 | obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o | ||
141 | obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o | ||
142 | obj-$(CONFIG_FB_OMAP) += omap/ | ||
143 | obj-y += omap2/ | ||
144 | obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o | ||
145 | obj-$(CONFIG_FB_CARMINE) += carminefb.o | ||
146 | obj-$(CONFIG_FB_MB862XX) += mb862xx/ | ||
147 | obj-$(CONFIG_FB_MSM) += msm/ | ||
148 | obj-$(CONFIG_FB_NUC900) += nuc900fb.o | ||
149 | obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o | ||
150 | obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o | ||
151 | obj-$(CONFIG_FB_HYPERV) += hyperv_fb.o | ||
152 | obj-$(CONFIG_FB_OPENCORES) += ocfb.o | ||
153 | |||
154 | # Platform or fallback drivers go here | ||
155 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | ||
156 | obj-$(CONFIG_FB_VESA) += vesafb.o | ||
157 | obj-$(CONFIG_FB_EFI) += efifb.o | ||
158 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | ||
159 | obj-$(CONFIG_FB_OF) += offb.o | ||
160 | obj-$(CONFIG_FB_BF537_LQ035) += bf537-lq035.o | ||
161 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o | ||
162 | obj-$(CONFIG_FB_BFIN_LQ035Q1) += bfin-lq035q1-fb.o | ||
163 | obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o | ||
164 | obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o | ||
165 | obj-$(CONFIG_FB_MX3) += mx3fb.o | ||
166 | obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o | ||
167 | obj-$(CONFIG_FB_MXS) += mxsfb.o | ||
168 | obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o | ||
169 | obj-$(CONFIG_FB_SIMPLE) += simplefb.o | ||
170 | |||
171 | # the test framebuffer is last | ||
172 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o | ||
173 | 9 | ||
174 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o | 10 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o |
175 | ifeq ($(CONFIG_OF),y) | 11 | ifeq ($(CONFIG_OF),y) |
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c index 5f65ca3d8564..026fd1215933 100644 --- a/drivers/video/console/sticon.c +++ b/drivers/video/console/sticon.c | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #include <asm/io.h> | 47 | #include <asm/io.h> |
48 | 48 | ||
49 | #include "../sticore.h" | 49 | #include "../fbdev/sticore.h" |
50 | 50 | ||
51 | /* switching to graphics mode */ | 51 | /* switching to graphics mode */ |
52 | #define BLANK 0 | 52 | #define BLANK 0 |
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index cecd3de01c24..7da1ad03acb5 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
29 | #include <asm/grfioctl.h> | 29 | #include <asm/grfioctl.h> |
30 | 30 | ||
31 | #include "../sticore.h" | 31 | #include "../fbdev/sticore.h" |
32 | 32 | ||
33 | #define STI_DRIVERVERSION "Version 0.9b" | 33 | #define STI_DRIVERVERSION "Version 0.9b" |
34 | 34 | ||
diff --git a/drivers/video/68328fb.c b/drivers/video/fbdev/68328fb.c index 552258c8f99d..552258c8f99d 100644 --- a/drivers/video/68328fb.c +++ b/drivers/video/fbdev/68328fb.c | |||
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig new file mode 100644 index 000000000000..e1f47272fdea --- /dev/null +++ b/drivers/video/fbdev/Kconfig | |||
@@ -0,0 +1,2474 @@ | |||
1 | # | ||
2 | # fbdev configuration | ||
3 | # | ||
4 | |||
5 | menuconfig FB | ||
6 | tristate "Support for frame buffer devices" | ||
7 | ---help--- | ||
8 | The frame buffer device provides an abstraction for the graphics | ||
9 | hardware. It represents the frame buffer of some video hardware and | ||
10 | allows application software to access the graphics hardware through | ||
11 | a well-defined interface, so the software doesn't need to know | ||
12 | anything about the low-level (hardware register) stuff. | ||
13 | |||
14 | Frame buffer devices work identically across the different | ||
15 | architectures supported by Linux and make the implementation of | ||
16 | application programs easier and more portable; at this point, an X | ||
17 | server exists which uses the frame buffer device exclusively. | ||
18 | On several non-X86 architectures, the frame buffer device is the | ||
19 | only way to use the graphics hardware. | ||
20 | |||
21 | The device is accessed through special device nodes, usually located | ||
22 | in the /dev directory, i.e. /dev/fb*. | ||
23 | |||
24 | You need an utility program called fbset to make full use of frame | ||
25 | buffer devices. Please read <file:Documentation/fb/framebuffer.txt> | ||
26 | and the Framebuffer-HOWTO at | ||
27 | <http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.3.html> for more | ||
28 | information. | ||
29 | |||
30 | Say Y here and to the driver for your graphics board below if you | ||
31 | are compiling a kernel for a non-x86 architecture. | ||
32 | |||
33 | If you are compiling for the x86 architecture, you can say Y if you | ||
34 | want to play with it, but it is not essential. Please note that | ||
35 | running graphical applications that directly touch the hardware | ||
36 | (e.g. an accelerated X server) and that are not frame buffer | ||
37 | device-aware may cause unexpected results. If unsure, say N. | ||
38 | |||
39 | config FIRMWARE_EDID | ||
40 | bool "Enable firmware EDID" | ||
41 | depends on FB | ||
42 | default n | ||
43 | ---help--- | ||
44 | This enables access to the EDID transferred from the firmware. | ||
45 | On the i386, this is from the Video BIOS. Enable this if DDC/I2C | ||
46 | transfers do not work for your driver and if you are using | ||
47 | nvidiafb, i810fb or savagefb. | ||
48 | |||
49 | In general, choosing Y for this option is safe. If you | ||
50 | experience extremely long delays while booting before you get | ||
51 | something on your display, try setting this to N. Matrox cards in | ||
52 | combination with certain motherboards and monitors are known to | ||
53 | suffer from this problem. | ||
54 | |||
55 | config FB_DDC | ||
56 | tristate | ||
57 | depends on FB | ||
58 | select I2C_ALGOBIT | ||
59 | select I2C | ||
60 | default n | ||
61 | |||
62 | config FB_BOOT_VESA_SUPPORT | ||
63 | bool | ||
64 | depends on FB | ||
65 | default n | ||
66 | ---help--- | ||
67 | If true, at least one selected framebuffer driver can take advantage | ||
68 | of VESA video modes set at an early boot stage via the vga= parameter. | ||
69 | |||
70 | config FB_CFB_FILLRECT | ||
71 | tristate | ||
72 | depends on FB | ||
73 | default n | ||
74 | ---help--- | ||
75 | Include the cfb_fillrect function for generic software rectangle | ||
76 | filling. This is used by drivers that don't provide their own | ||
77 | (accelerated) version. | ||
78 | |||
79 | config FB_CFB_COPYAREA | ||
80 | tristate | ||
81 | depends on FB | ||
82 | default n | ||
83 | ---help--- | ||
84 | Include the cfb_copyarea function for generic software area copying. | ||
85 | This is used by drivers that don't provide their own (accelerated) | ||
86 | version. | ||
87 | |||
88 | config FB_CFB_IMAGEBLIT | ||
89 | tristate | ||
90 | depends on FB | ||
91 | default n | ||
92 | ---help--- | ||
93 | Include the cfb_imageblit function for generic software image | ||
94 | blitting. This is used by drivers that don't provide their own | ||
95 | (accelerated) version. | ||
96 | |||
97 | config FB_CFB_REV_PIXELS_IN_BYTE | ||
98 | bool | ||
99 | depends on FB | ||
100 | default n | ||
101 | ---help--- | ||
102 | Allow generic frame-buffer functions to work on displays with 1, 2 | ||
103 | and 4 bits per pixel depths which has opposite order of pixels in | ||
104 | byte order to bytes in long order. | ||
105 | |||
106 | config FB_SYS_FILLRECT | ||
107 | tristate | ||
108 | depends on FB | ||
109 | default n | ||
110 | ---help--- | ||
111 | Include the sys_fillrect function for generic software rectangle | ||
112 | filling. This is used by drivers that don't provide their own | ||
113 | (accelerated) version and the framebuffer is in system RAM. | ||
114 | |||
115 | config FB_SYS_COPYAREA | ||
116 | tristate | ||
117 | depends on FB | ||
118 | default n | ||
119 | ---help--- | ||
120 | Include the sys_copyarea function for generic software area copying. | ||
121 | This is used by drivers that don't provide their own (accelerated) | ||
122 | version and the framebuffer is in system RAM. | ||
123 | |||
124 | config FB_SYS_IMAGEBLIT | ||
125 | tristate | ||
126 | depends on FB | ||
127 | default n | ||
128 | ---help--- | ||
129 | Include the sys_imageblit function for generic software image | ||
130 | blitting. This is used by drivers that don't provide their own | ||
131 | (accelerated) version and the framebuffer is in system RAM. | ||
132 | |||
133 | menuconfig FB_FOREIGN_ENDIAN | ||
134 | bool "Framebuffer foreign endianness support" | ||
135 | depends on FB | ||
136 | ---help--- | ||
137 | This menu will let you enable support for the framebuffers with | ||
138 | non-native endianness (e.g. Little-Endian framebuffer on a | ||
139 | Big-Endian machine). Most probably you don't have such hardware, | ||
140 | so it's safe to say "n" here. | ||
141 | |||
142 | choice | ||
143 | prompt "Choice endianness support" | ||
144 | depends on FB_FOREIGN_ENDIAN | ||
145 | |||
146 | config FB_BOTH_ENDIAN | ||
147 | bool "Support for Big- and Little-Endian framebuffers" | ||
148 | |||
149 | config FB_BIG_ENDIAN | ||
150 | bool "Support for Big-Endian framebuffers only" | ||
151 | |||
152 | config FB_LITTLE_ENDIAN | ||
153 | bool "Support for Little-Endian framebuffers only" | ||
154 | |||
155 | endchoice | ||
156 | |||
157 | config FB_SYS_FOPS | ||
158 | tristate | ||
159 | depends on FB | ||
160 | default n | ||
161 | |||
162 | config FB_DEFERRED_IO | ||
163 | bool | ||
164 | depends on FB | ||
165 | |||
166 | config FB_HECUBA | ||
167 | tristate | ||
168 | depends on FB | ||
169 | depends on FB_DEFERRED_IO | ||
170 | |||
171 | config FB_SVGALIB | ||
172 | tristate | ||
173 | depends on FB | ||
174 | default n | ||
175 | ---help--- | ||
176 | Common utility functions useful to fbdev drivers of VGA-based | ||
177 | cards. | ||
178 | |||
179 | config FB_MACMODES | ||
180 | tristate | ||
181 | depends on FB | ||
182 | default n | ||
183 | |||
184 | config FB_BACKLIGHT | ||
185 | bool | ||
186 | depends on FB | ||
187 | select BACKLIGHT_LCD_SUPPORT | ||
188 | select BACKLIGHT_CLASS_DEVICE | ||
189 | default n | ||
190 | |||
191 | config FB_MODE_HELPERS | ||
192 | bool "Enable Video Mode Handling Helpers" | ||
193 | depends on FB | ||
194 | default n | ||
195 | ---help--- | ||
196 | This enables functions for handling video modes using the | ||
197 | Generalized Timing Formula and the EDID parser. A few drivers rely | ||
198 | on this feature such as the radeonfb, rivafb, and the i810fb. If | ||
199 | your driver does not take advantage of this feature, choosing Y will | ||
200 | just increase the kernel size by about 5K. | ||
201 | |||
202 | config FB_TILEBLITTING | ||
203 | bool "Enable Tile Blitting Support" | ||
204 | depends on FB | ||
205 | default n | ||
206 | ---help--- | ||
207 | This enables tile blitting. Tile blitting is a drawing technique | ||
208 | where the screen is divided into rectangular sections (tiles), whereas | ||
209 | the standard blitting divides the screen into pixels. Because the | ||
210 | default drawing element is a tile, drawing functions will be passed | ||
211 | parameters in terms of number of tiles instead of number of pixels. | ||
212 | For example, to draw a single character, instead of using bitmaps, | ||
213 | an index to an array of bitmaps will be used. To clear or move a | ||
214 | rectangular section of a screen, the rectangle will be described in | ||
215 | terms of number of tiles in the x- and y-axis. | ||
216 | |||
217 | This is particularly important to one driver, matroxfb. If | ||
218 | unsure, say N. | ||
219 | |||
220 | comment "Frame buffer hardware drivers" | ||
221 | depends on FB | ||
222 | |||
223 | config FB_GRVGA | ||
224 | tristate "Aeroflex Gaisler framebuffer support" | ||
225 | depends on FB && SPARC | ||
226 | select FB_CFB_FILLRECT | ||
227 | select FB_CFB_COPYAREA | ||
228 | select FB_CFB_IMAGEBLIT | ||
229 | ---help--- | ||
230 | This enables support for the SVGACTRL framebuffer in the GRLIB IP library from Aeroflex Gaisler. | ||
231 | |||
232 | config FB_CIRRUS | ||
233 | tristate "Cirrus Logic support" | ||
234 | depends on FB && (ZORRO || PCI) | ||
235 | select FB_CFB_FILLRECT | ||
236 | select FB_CFB_COPYAREA | ||
237 | select FB_CFB_IMAGEBLIT | ||
238 | ---help--- | ||
239 | This enables support for Cirrus Logic GD542x/543x based boards on | ||
240 | Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum. | ||
241 | |||
242 | If you have a PCI-based system, this enables support for these | ||
243 | chips: GD-543x, GD-544x, GD-5480. | ||
244 | |||
245 | Please read the file <file:Documentation/fb/cirrusfb.txt>. | ||
246 | |||
247 | Say N unless you have such a graphics board or plan to get one | ||
248 | before you next recompile the kernel. | ||
249 | |||
250 | config FB_PM2 | ||
251 | tristate "Permedia2 support" | ||
252 | depends on FB && ((AMIGA && BROKEN) || PCI) | ||
253 | select FB_CFB_FILLRECT | ||
254 | select FB_CFB_COPYAREA | ||
255 | select FB_CFB_IMAGEBLIT | ||
256 | help | ||
257 | This is the frame buffer device driver for cards based on | ||
258 | the 3D Labs Permedia, Permedia 2 and Permedia 2V chips. | ||
259 | The driver was tested on the following cards: | ||
260 | Diamond FireGL 1000 PRO AGP | ||
261 | ELSA Gloria Synergy PCI | ||
262 | Appian Jeronimo PRO (both heads) PCI | ||
263 | 3DLabs Oxygen ACX aka EONtronics Picasso P2 PCI | ||
264 | Techsource Raptor GFX-8P (aka Sun PGX-32) on SPARC | ||
265 | ASK Graphic Blaster Exxtreme AGP | ||
266 | |||
267 | To compile this driver as a module, choose M here: the | ||
268 | module will be called pm2fb. | ||
269 | |||
270 | config FB_PM2_FIFO_DISCONNECT | ||
271 | bool "enable FIFO disconnect feature" | ||
272 | depends on FB_PM2 && PCI | ||
273 | help | ||
274 | Support the Permedia2 FIFO disconnect feature. | ||
275 | |||
276 | config FB_ARMCLCD | ||
277 | tristate "ARM PrimeCell PL110 support" | ||
278 | depends on ARM || ARM64 || COMPILE_TEST | ||
279 | depends on FB && ARM_AMBA | ||
280 | select FB_CFB_FILLRECT | ||
281 | select FB_CFB_COPYAREA | ||
282 | select FB_CFB_IMAGEBLIT | ||
283 | help | ||
284 | This framebuffer device driver is for the ARM PrimeCell PL110 | ||
285 | Colour LCD controller. ARM PrimeCells provide the building | ||
286 | blocks for System on a Chip devices. | ||
287 | |||
288 | If you want to compile this as a module (=code which can be | ||
289 | inserted into and removed from the running kernel), say M | ||
290 | here and read <file:Documentation/kbuild/modules.txt>. The module | ||
291 | will be called amba-clcd. | ||
292 | |||
293 | config FB_ACORN | ||
294 | bool "Acorn VIDC support" | ||
295 | depends on (FB = y) && ARM && ARCH_ACORN | ||
296 | select FB_CFB_FILLRECT | ||
297 | select FB_CFB_COPYAREA | ||
298 | select FB_CFB_IMAGEBLIT | ||
299 | help | ||
300 | This is the frame buffer device driver for the Acorn VIDC graphics | ||
301 | hardware found in Acorn RISC PCs and other ARM-based machines. If | ||
302 | unsure, say N. | ||
303 | |||
304 | config FB_CLPS711X | ||
305 | bool "CLPS711X LCD support" | ||
306 | depends on (FB = y) && ARM && ARCH_CLPS711X | ||
307 | select FB_CFB_FILLRECT | ||
308 | select FB_CFB_COPYAREA | ||
309 | select FB_CFB_IMAGEBLIT | ||
310 | help | ||
311 | Say Y to enable the Framebuffer driver for the CLPS7111 and | ||
312 | EP7212 processors. | ||
313 | |||
314 | config FB_SA1100 | ||
315 | bool "SA-1100 LCD support" | ||
316 | depends on (FB = y) && ARM && ARCH_SA1100 | ||
317 | select FB_CFB_FILLRECT | ||
318 | select FB_CFB_COPYAREA | ||
319 | select FB_CFB_IMAGEBLIT | ||
320 | help | ||
321 | This is a framebuffer device for the SA-1100 LCD Controller. | ||
322 | See <http://www.linux-fbdev.org/> for information on framebuffer | ||
323 | devices. | ||
324 | |||
325 | If you plan to use the LCD display with your SA-1100 system, say | ||
326 | Y here. | ||
327 | |||
328 | config FB_IMX | ||
329 | tristate "Freescale i.MX1/21/25/27 LCD support" | ||
330 | depends on FB && ARCH_MXC | ||
331 | select BACKLIGHT_LCD_SUPPORT | ||
332 | select LCD_CLASS_DEVICE | ||
333 | select FB_CFB_FILLRECT | ||
334 | select FB_CFB_COPYAREA | ||
335 | select FB_CFB_IMAGEBLIT | ||
336 | select FB_MODE_HELPERS | ||
337 | select VIDEOMODE_HELPERS | ||
338 | |||
339 | config FB_CYBER2000 | ||
340 | tristate "CyberPro 2000/2010/5000 support" | ||
341 | depends on FB && PCI && (BROKEN || !SPARC64) | ||
342 | select FB_CFB_FILLRECT | ||
343 | select FB_CFB_COPYAREA | ||
344 | select FB_CFB_IMAGEBLIT | ||
345 | help | ||
346 | This enables support for the Integraphics CyberPro 20x0 and 5000 | ||
347 | VGA chips used in the Rebel.com Netwinder and other machines. | ||
348 | Say Y if you have a NetWinder or a graphics card containing this | ||
349 | device, otherwise say N. | ||
350 | |||
351 | config FB_CYBER2000_DDC | ||
352 | bool "DDC for CyberPro support" | ||
353 | depends on FB_CYBER2000 | ||
354 | select FB_DDC | ||
355 | default y | ||
356 | help | ||
357 | Say Y here if you want DDC support for your CyberPro graphics | ||
358 | card. This is only I2C bus support, driver does not use EDID. | ||
359 | |||
360 | config FB_CYBER2000_I2C | ||
361 | bool "CyberPro 2000/2010/5000 I2C support" | ||
362 | depends on FB_CYBER2000 && I2C && ARCH_NETWINDER | ||
363 | select I2C_ALGOBIT | ||
364 | help | ||
365 | Enable support for the I2C video decoder interface on the | ||
366 | Integraphics CyberPro 20x0 and 5000 VGA chips. This is used | ||
367 | on the Netwinder machines for the SAA7111 video capture. | ||
368 | |||
369 | config FB_APOLLO | ||
370 | bool | ||
371 | depends on (FB = y) && APOLLO | ||
372 | default y | ||
373 | select FB_CFB_FILLRECT | ||
374 | select FB_CFB_IMAGEBLIT | ||
375 | |||
376 | config FB_Q40 | ||
377 | bool | ||
378 | depends on (FB = y) && Q40 | ||
379 | default y | ||
380 | select FB_CFB_FILLRECT | ||
381 | select FB_CFB_COPYAREA | ||
382 | select FB_CFB_IMAGEBLIT | ||
383 | |||
384 | config FB_AMIGA | ||
385 | tristate "Amiga native chipset support" | ||
386 | depends on FB && AMIGA | ||
387 | help | ||
388 | This is the frame buffer device driver for the builtin graphics | ||
389 | chipset found in Amigas. | ||
390 | |||
391 | To compile this driver as a module, choose M here: the | ||
392 | module will be called amifb. | ||
393 | |||
394 | config FB_AMIGA_OCS | ||
395 | bool "Amiga OCS chipset support" | ||
396 | depends on FB_AMIGA | ||
397 | help | ||
398 | This enables support for the original Agnus and Denise video chips, | ||
399 | found in the Amiga 1000 and most A500's and A2000's. If you intend | ||
400 | to run Linux on any of these systems, say Y; otherwise say N. | ||
401 | |||
402 | config FB_AMIGA_ECS | ||
403 | bool "Amiga ECS chipset support" | ||
404 | depends on FB_AMIGA | ||
405 | help | ||
406 | This enables support for the Enhanced Chip Set, found in later | ||
407 | A500's, later A2000's, the A600, the A3000, the A3000T and CDTV. If | ||
408 | you intend to run Linux on any of these systems, say Y; otherwise | ||
409 | say N. | ||
410 | |||
411 | config FB_AMIGA_AGA | ||
412 | bool "Amiga AGA chipset support" | ||
413 | depends on FB_AMIGA | ||
414 | help | ||
415 | This enables support for the Advanced Graphics Architecture (also | ||
416 | known as the AGA or AA) Chip Set, found in the A1200, A4000, A4000T | ||
417 | and CD32. If you intend to run Linux on any of these systems, say Y; | ||
418 | otherwise say N. | ||
419 | |||
420 | config FB_FM2 | ||
421 | bool "Amiga FrameMaster II/Rainbow II support" | ||
422 | depends on (FB = y) && ZORRO | ||
423 | select FB_CFB_FILLRECT | ||
424 | select FB_CFB_COPYAREA | ||
425 | select FB_CFB_IMAGEBLIT | ||
426 | help | ||
427 | This is the frame buffer device driver for the Amiga FrameMaster | ||
428 | card from BSC (exhibited 1992 but not shipped as a CBM product). | ||
429 | |||
430 | config FB_ARC | ||
431 | tristate "Arc Monochrome LCD board support" | ||
432 | depends on FB && X86 | ||
433 | select FB_SYS_FILLRECT | ||
434 | select FB_SYS_COPYAREA | ||
435 | select FB_SYS_IMAGEBLIT | ||
436 | select FB_SYS_FOPS | ||
437 | help | ||
438 | This enables support for the Arc Monochrome LCD board. The board | ||
439 | is based on the KS-108 lcd controller and is typically a matrix | ||
440 | of 2*n chips. This driver was tested with a 128x64 panel. This | ||
441 | driver supports it for use with x86 SBCs through a 16 bit GPIO | ||
442 | interface (8 bit data, 8 bit control). If you anticipate using | ||
443 | this driver, say Y or M; otherwise say N. You must specify the | ||
444 | GPIO IO address to be used for setting control and data. | ||
445 | |||
446 | config FB_ATARI | ||
447 | bool "Atari native chipset support" | ||
448 | depends on (FB = y) && ATARI | ||
449 | select FB_CFB_FILLRECT | ||
450 | select FB_CFB_COPYAREA | ||
451 | select FB_CFB_IMAGEBLIT | ||
452 | help | ||
453 | This is the frame buffer device driver for the builtin graphics | ||
454 | chipset found in Ataris. | ||
455 | |||
456 | config FB_OF | ||
457 | bool "Open Firmware frame buffer device support" | ||
458 | depends on (FB = y) && (PPC64 || PPC_OF) && (!PPC_PSERIES || PCI) | ||
459 | select FB_CFB_FILLRECT | ||
460 | select FB_CFB_COPYAREA | ||
461 | select FB_CFB_IMAGEBLIT | ||
462 | select FB_MACMODES | ||
463 | help | ||
464 | Say Y if you want support with Open Firmware for your graphics | ||
465 | board. | ||
466 | |||
467 | config FB_CONTROL | ||
468 | bool "Apple \"control\" display support" | ||
469 | depends on (FB = y) && PPC_PMAC && PPC32 | ||
470 | select FB_CFB_FILLRECT | ||
471 | select FB_CFB_COPYAREA | ||
472 | select FB_CFB_IMAGEBLIT | ||
473 | select FB_MACMODES | ||
474 | help | ||
475 | This driver supports a frame buffer for the graphics adapter in the | ||
476 | Power Macintosh 7300 and others. | ||
477 | |||
478 | config FB_PLATINUM | ||
479 | bool "Apple \"platinum\" display support" | ||
480 | depends on (FB = y) && PPC_PMAC && PPC32 | ||
481 | select FB_CFB_FILLRECT | ||
482 | select FB_CFB_COPYAREA | ||
483 | select FB_CFB_IMAGEBLIT | ||
484 | select FB_MACMODES | ||
485 | help | ||
486 | This driver supports a frame buffer for the "platinum" graphics | ||
487 | adapter in some Power Macintoshes. | ||
488 | |||
489 | config FB_VALKYRIE | ||
490 | bool "Apple \"valkyrie\" display support" | ||
491 | depends on (FB = y) && (MAC || (PPC_PMAC && PPC32)) | ||
492 | select FB_CFB_FILLRECT | ||
493 | select FB_CFB_COPYAREA | ||
494 | select FB_CFB_IMAGEBLIT | ||
495 | select FB_MACMODES | ||
496 | help | ||
497 | This driver supports a frame buffer for the "valkyrie" graphics | ||
498 | adapter in some Power Macintoshes. | ||
499 | |||
500 | config FB_CT65550 | ||
501 | bool "Chips 65550 display support" | ||
502 | depends on (FB = y) && PPC32 && PCI | ||
503 | select FB_CFB_FILLRECT | ||
504 | select FB_CFB_COPYAREA | ||
505 | select FB_CFB_IMAGEBLIT | ||
506 | help | ||
507 | This is the frame buffer device driver for the Chips & Technologies | ||
508 | 65550 graphics chip in PowerBooks. | ||
509 | |||
510 | config FB_ASILIANT | ||
511 | bool "Asiliant (Chips) 69000 display support" | ||
512 | depends on (FB = y) && PCI | ||
513 | select FB_CFB_FILLRECT | ||
514 | select FB_CFB_COPYAREA | ||
515 | select FB_CFB_IMAGEBLIT | ||
516 | help | ||
517 | This is the frame buffer device driver for the Asiliant 69030 chipset | ||
518 | |||
519 | config FB_IMSTT | ||
520 | bool "IMS Twin Turbo display support" | ||
521 | depends on (FB = y) && PCI | ||
522 | select FB_CFB_IMAGEBLIT | ||
523 | select FB_MACMODES if PPC | ||
524 | help | ||
525 | The IMS Twin Turbo is a PCI-based frame buffer card bundled with | ||
526 | many Macintosh and compatible computers. | ||
527 | |||
528 | config FB_VGA16 | ||
529 | tristate "VGA 16-color graphics support" | ||
530 | depends on FB && (X86 || PPC) | ||
531 | select FB_CFB_FILLRECT | ||
532 | select FB_CFB_COPYAREA | ||
533 | select FB_CFB_IMAGEBLIT | ||
534 | select VGASTATE | ||
535 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
536 | help | ||
537 | This is the frame buffer device driver for VGA 16 color graphic | ||
538 | cards. Say Y if you have such a card. | ||
539 | |||
540 | To compile this driver as a module, choose M here: the | ||
541 | module will be called vga16fb. | ||
542 | |||
543 | config FB_BF54X_LQ043 | ||
544 | tristate "SHARP LQ043 TFT LCD (BF548 EZKIT)" | ||
545 | depends on FB && (BF54x) && !BF542 | ||
546 | select FB_CFB_FILLRECT | ||
547 | select FB_CFB_COPYAREA | ||
548 | select FB_CFB_IMAGEBLIT | ||
549 | help | ||
550 | This is the framebuffer device driver for a SHARP LQ043T1DG01 TFT LCD | ||
551 | |||
552 | config FB_BFIN_T350MCQB | ||
553 | tristate "Varitronix COG-T350MCQB TFT LCD display (BF527 EZKIT)" | ||
554 | depends on FB && BLACKFIN | ||
555 | select BFIN_GPTIMERS | ||
556 | select FB_CFB_FILLRECT | ||
557 | select FB_CFB_COPYAREA | ||
558 | select FB_CFB_IMAGEBLIT | ||
559 | help | ||
560 | This is the framebuffer device driver for a Varitronix VL-PS-COG-T350MCQB-01 display TFT LCD | ||
561 | This display is a QVGA 320x240 24-bit RGB display interfaced by an 8-bit wide PPI | ||
562 | It uses PPI[0..7] PPI_FS1, PPI_FS2 and PPI_CLK. | ||
563 | |||
564 | config FB_BFIN_LQ035Q1 | ||
565 | tristate "SHARP LQ035Q1DH02 TFT LCD" | ||
566 | depends on FB && BLACKFIN && SPI | ||
567 | select FB_CFB_FILLRECT | ||
568 | select FB_CFB_COPYAREA | ||
569 | select FB_CFB_IMAGEBLIT | ||
570 | select BFIN_GPTIMERS | ||
571 | help | ||
572 | This is the framebuffer device driver for a SHARP LQ035Q1DH02 TFT display found on | ||
573 | the Blackfin Landscape LCD EZ-Extender Card. | ||
574 | This display is a QVGA 320x240 18-bit RGB display interfaced by an 16-bit wide PPI | ||
575 | It uses PPI[0..15] PPI_FS1, PPI_FS2 and PPI_CLK. | ||
576 | |||
577 | To compile this driver as a module, choose M here: the | ||
578 | module will be called bfin-lq035q1-fb. | ||
579 | |||
580 | config FB_BF537_LQ035 | ||
581 | tristate "SHARP LQ035 TFT LCD (BF537 STAMP)" | ||
582 | depends on FB && (BF534 || BF536 || BF537) && I2C_BLACKFIN_TWI | ||
583 | select FB_CFB_FILLRECT | ||
584 | select FB_CFB_COPYAREA | ||
585 | select FB_CFB_IMAGEBLIT | ||
586 | select BFIN_GPTIMERS | ||
587 | help | ||
588 | This is the framebuffer device for a SHARP LQ035Q7DB03 TFT LCD | ||
589 | attached to a BF537. | ||
590 | |||
591 | To compile this driver as a module, choose M here: the | ||
592 | module will be called bf537-lq035. | ||
593 | |||
594 | config FB_BFIN_7393 | ||
595 | tristate "Blackfin ADV7393 Video encoder" | ||
596 | depends on FB && BLACKFIN | ||
597 | select I2C | ||
598 | select FB_CFB_FILLRECT | ||
599 | select FB_CFB_COPYAREA | ||
600 | select FB_CFB_IMAGEBLIT | ||
601 | help | ||
602 | This is the framebuffer device for a ADV7393 video encoder | ||
603 | attached to a Blackfin on the PPI port. | ||
604 | If your Blackfin board has a ADV7393 select Y. | ||
605 | |||
606 | To compile this driver as a module, choose M here: the | ||
607 | module will be called bfin_adv7393fb. | ||
608 | |||
609 | choice | ||
610 | prompt "Video mode support" | ||
611 | depends on FB_BFIN_7393 | ||
612 | default NTSC | ||
613 | |||
614 | config NTSC | ||
615 | bool 'NTSC 720x480' | ||
616 | |||
617 | config PAL | ||
618 | bool 'PAL 720x576' | ||
619 | |||
620 | config NTSC_640x480 | ||
621 | bool 'NTSC 640x480 (Experimental)' | ||
622 | |||
623 | config PAL_640x480 | ||
624 | bool 'PAL 640x480 (Experimental)' | ||
625 | |||
626 | config NTSC_YCBCR | ||
627 | bool 'NTSC 720x480 YCbCR input' | ||
628 | |||
629 | config PAL_YCBCR | ||
630 | bool 'PAL 720x576 YCbCR input' | ||
631 | |||
632 | endchoice | ||
633 | |||
634 | choice | ||
635 | prompt "Size of ADV7393 frame buffer memory Single/Double Size" | ||
636 | depends on (FB_BFIN_7393) | ||
637 | default ADV7393_1XMEM | ||
638 | |||
639 | config ADV7393_1XMEM | ||
640 | bool 'Single' | ||
641 | |||
642 | config ADV7393_2XMEM | ||
643 | bool 'Double' | ||
644 | endchoice | ||
645 | |||
646 | config FB_STI | ||
647 | tristate "HP STI frame buffer device support" | ||
648 | depends on FB && PARISC | ||
649 | select FB_CFB_FILLRECT | ||
650 | select FB_CFB_COPYAREA | ||
651 | select FB_CFB_IMAGEBLIT | ||
652 | select STI_CONSOLE | ||
653 | select VT | ||
654 | default y | ||
655 | ---help--- | ||
656 | STI refers to the HP "Standard Text Interface" which is a set of | ||
657 | BIOS routines contained in a ROM chip in HP PA-RISC based machines. | ||
658 | Enabling this option will implement the linux framebuffer device | ||
659 | using calls to the STI BIOS routines for initialisation. | ||
660 | |||
661 | If you enable this option, you will get a planar framebuffer device | ||
662 | /dev/fb which will work on the most common HP graphic cards of the | ||
663 | NGLE family, including the artist chips (in the 7xx and Bxxx series), | ||
664 | HCRX, HCRX24, CRX, CRX24 and VisEG series. | ||
665 | |||
666 | It is safe to enable this option, so you should probably say "Y". | ||
667 | |||
668 | config FB_MAC | ||
669 | bool "Generic Macintosh display support" | ||
670 | depends on (FB = y) && MAC | ||
671 | select FB_CFB_FILLRECT | ||
672 | select FB_CFB_COPYAREA | ||
673 | select FB_CFB_IMAGEBLIT | ||
674 | select FB_MACMODES | ||
675 | |||
676 | config FB_HP300 | ||
677 | bool | ||
678 | depends on (FB = y) && DIO | ||
679 | select FB_CFB_IMAGEBLIT | ||
680 | default y | ||
681 | |||
682 | config FB_TGA | ||
683 | tristate "TGA/SFB+ framebuffer support" | ||
684 | depends on FB && (ALPHA || TC) | ||
685 | select FB_CFB_FILLRECT | ||
686 | select FB_CFB_COPYAREA | ||
687 | select FB_CFB_IMAGEBLIT | ||
688 | select BITREVERSE | ||
689 | ---help--- | ||
690 | This is the frame buffer device driver for generic TGA and SFB+ | ||
691 | graphic cards. These include DEC ZLXp-E1, -E2 and -E3 PCI cards, | ||
692 | also known as PBXGA-A, -B and -C, and DEC ZLX-E1, -E2 and -E3 | ||
693 | TURBOchannel cards, also known as PMAGD-A, -B and -C. | ||
694 | |||
695 | Due to hardware limitations ZLX-E2 and E3 cards are not supported | ||
696 | for DECstation 5000/200 systems. Additionally due to firmware | ||
697 | limitations these cards may cause troubles with booting DECstation | ||
698 | 5000/240 and /260 systems, but are fully supported under Linux if | ||
699 | you manage to get it going. ;-) | ||
700 | |||
701 | Say Y if you have one of those. | ||
702 | |||
703 | config FB_UVESA | ||
704 | tristate "Userspace VESA VGA graphics support" | ||
705 | depends on FB && CONNECTOR | ||
706 | select FB_CFB_FILLRECT | ||
707 | select FB_CFB_COPYAREA | ||
708 | select FB_CFB_IMAGEBLIT | ||
709 | select FB_MODE_HELPERS | ||
710 | help | ||
711 | This is the frame buffer driver for generic VBE 2.0 compliant | ||
712 | graphic cards. It can also take advantage of VBE 3.0 features, | ||
713 | such as refresh rate adjustment. | ||
714 | |||
715 | This driver generally provides more features than vesafb but | ||
716 | requires a userspace helper application called 'v86d'. See | ||
717 | <file:Documentation/fb/uvesafb.txt> for more information. | ||
718 | |||
719 | If unsure, say N. | ||
720 | |||
721 | config FB_VESA | ||
722 | bool "VESA VGA graphics support" | ||
723 | depends on (FB = y) && X86 | ||
724 | select FB_CFB_FILLRECT | ||
725 | select FB_CFB_COPYAREA | ||
726 | select FB_CFB_IMAGEBLIT | ||
727 | select FB_BOOT_VESA_SUPPORT | ||
728 | help | ||
729 | This is the frame buffer device driver for generic VESA 2.0 | ||
730 | compliant graphic cards. The older VESA 1.2 cards are not supported. | ||
731 | You will get a boot time penguin logo at no additional cost. Please | ||
732 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. | ||
733 | |||
734 | config FB_EFI | ||
735 | bool "EFI-based Framebuffer Support" | ||
736 | depends on (FB = y) && X86 && EFI | ||
737 | select FB_CFB_FILLRECT | ||
738 | select FB_CFB_COPYAREA | ||
739 | select FB_CFB_IMAGEBLIT | ||
740 | help | ||
741 | This is the EFI frame buffer device driver. If the firmware on | ||
742 | your platform is EFI 1.10 or UEFI 2.0, select Y to add support for | ||
743 | using the EFI framebuffer as your console. | ||
744 | |||
745 | config FB_N411 | ||
746 | tristate "N411 Apollo/Hecuba devkit support" | ||
747 | depends on FB && X86 && MMU | ||
748 | select FB_SYS_FILLRECT | ||
749 | select FB_SYS_COPYAREA | ||
750 | select FB_SYS_IMAGEBLIT | ||
751 | select FB_SYS_FOPS | ||
752 | select FB_DEFERRED_IO | ||
753 | select FB_HECUBA | ||
754 | help | ||
755 | This enables support for the Apollo display controller in its | ||
756 | Hecuba form using the n411 devkit. | ||
757 | |||
758 | config FB_HGA | ||
759 | tristate "Hercules mono graphics support" | ||
760 | depends on FB && X86 | ||
761 | help | ||
762 | Say Y here if you have a Hercules mono graphics card. | ||
763 | |||
764 | To compile this driver as a module, choose M here: the | ||
765 | module will be called hgafb. | ||
766 | |||
767 | As this card technology is at least 25 years old, | ||
768 | most people will answer N here. | ||
769 | |||
770 | config FB_GBE | ||
771 | bool "SGI Graphics Backend frame buffer support" | ||
772 | depends on (FB = y) && SGI_IP32 | ||
773 | select FB_CFB_FILLRECT | ||
774 | select FB_CFB_COPYAREA | ||
775 | select FB_CFB_IMAGEBLIT | ||
776 | help | ||
777 | This is the frame buffer device driver for SGI Graphics Backend. | ||
778 | This chip is used in SGI O2 and Visual Workstation 320/540. | ||
779 | |||
780 | config FB_GBE_MEM | ||
781 | int "Video memory size in MB" | ||
782 | depends on FB_GBE | ||
783 | default 4 | ||
784 | help | ||
785 | This is the amount of memory reserved for the framebuffer, | ||
786 | which can be any value between 1MB and 8MB. | ||
787 | |||
788 | config FB_SBUS | ||
789 | bool "SBUS and UPA framebuffers" | ||
790 | depends on (FB = y) && SPARC | ||
791 | help | ||
792 | Say Y if you want support for SBUS or UPA based frame buffer device. | ||
793 | |||
794 | config FB_BW2 | ||
795 | bool "BWtwo support" | ||
796 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
797 | select FB_CFB_FILLRECT | ||
798 | select FB_CFB_COPYAREA | ||
799 | select FB_CFB_IMAGEBLIT | ||
800 | help | ||
801 | This is the frame buffer device driver for the BWtwo frame buffer. | ||
802 | |||
803 | config FB_CG3 | ||
804 | bool "CGthree support" | ||
805 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
806 | select FB_CFB_FILLRECT | ||
807 | select FB_CFB_COPYAREA | ||
808 | select FB_CFB_IMAGEBLIT | ||
809 | help | ||
810 | This is the frame buffer device driver for the CGthree frame buffer. | ||
811 | |||
812 | config FB_CG6 | ||
813 | bool "CGsix (GX,TurboGX) support" | ||
814 | depends on (FB = y) && (SPARC && FB_SBUS) | ||
815 | select FB_CFB_COPYAREA | ||
816 | select FB_CFB_IMAGEBLIT | ||
817 | help | ||
818 | This is the frame buffer device driver for the CGsix (GX, TurboGX) | ||
819 | frame buffer. | ||
820 | |||
821 | config FB_FFB | ||
822 | bool "Creator/Creator3D/Elite3D support" | ||
823 | depends on FB_SBUS && SPARC64 | ||
824 | select FB_CFB_COPYAREA | ||
825 | select FB_CFB_IMAGEBLIT | ||
826 | help | ||
827 | This is the frame buffer device driver for the Creator, Creator3D, | ||
828 | and Elite3D graphics boards. | ||
829 | |||
830 | config FB_TCX | ||
831 | bool "TCX (SS4/SS5 only) support" | ||
832 | depends on FB_SBUS | ||
833 | select FB_CFB_FILLRECT | ||
834 | select FB_CFB_COPYAREA | ||
835 | select FB_CFB_IMAGEBLIT | ||
836 | help | ||
837 | This is the frame buffer device driver for the TCX 24/8bit frame | ||
838 | buffer. | ||
839 | |||
840 | config FB_CG14 | ||
841 | bool "CGfourteen (SX) support" | ||
842 | depends on FB_SBUS | ||
843 | select FB_CFB_FILLRECT | ||
844 | select FB_CFB_COPYAREA | ||
845 | select FB_CFB_IMAGEBLIT | ||
846 | help | ||
847 | This is the frame buffer device driver for the CGfourteen frame | ||
848 | buffer on Desktop SPARCsystems with the SX graphics option. | ||
849 | |||
850 | config FB_P9100 | ||
851 | bool "P9100 (Sparcbook 3 only) support" | ||
852 | depends on FB_SBUS | ||
853 | select FB_CFB_FILLRECT | ||
854 | select FB_CFB_COPYAREA | ||
855 | select FB_CFB_IMAGEBLIT | ||
856 | help | ||
857 | This is the frame buffer device driver for the P9100 card | ||
858 | supported on Sparcbook 3 machines. | ||
859 | |||
860 | config FB_LEO | ||
861 | bool "Leo (ZX) support" | ||
862 | depends on FB_SBUS | ||
863 | select FB_CFB_FILLRECT | ||
864 | select FB_CFB_COPYAREA | ||
865 | select FB_CFB_IMAGEBLIT | ||
866 | help | ||
867 | This is the frame buffer device driver for the SBUS-based Sun ZX | ||
868 | (leo) frame buffer cards. | ||
869 | |||
870 | config FB_IGA | ||
871 | bool "IGA 168x display support" | ||
872 | depends on (FB = y) && SPARC32 | ||
873 | select FB_CFB_FILLRECT | ||
874 | select FB_CFB_COPYAREA | ||
875 | select FB_CFB_IMAGEBLIT | ||
876 | help | ||
877 | This is the framebuffer device for the INTERGRAPHICS 1680 and | ||
878 | successor frame buffer cards. | ||
879 | |||
880 | config FB_XVR500 | ||
881 | bool "Sun XVR-500 3DLABS Wildcat support" | ||
882 | depends on (FB = y) && PCI && SPARC64 | ||
883 | select FB_CFB_FILLRECT | ||
884 | select FB_CFB_COPYAREA | ||
885 | select FB_CFB_IMAGEBLIT | ||
886 | help | ||
887 | This is the framebuffer device for the Sun XVR-500 and similar | ||
888 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
889 | only works on sparc64 systems where the system firmware has | ||
890 | mostly initialized the card already. It is treated as a | ||
891 | completely dumb framebuffer device. | ||
892 | |||
893 | config FB_XVR2500 | ||
894 | bool "Sun XVR-2500 3DLABS Wildcat support" | ||
895 | depends on (FB = y) && PCI && SPARC64 | ||
896 | select FB_CFB_FILLRECT | ||
897 | select FB_CFB_COPYAREA | ||
898 | select FB_CFB_IMAGEBLIT | ||
899 | help | ||
900 | This is the framebuffer device for the Sun XVR-2500 and similar | ||
901 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
902 | only works on sparc64 systems where the system firmware has | ||
903 | mostly initialized the card already. It is treated as a | ||
904 | completely dumb framebuffer device. | ||
905 | |||
906 | config FB_XVR1000 | ||
907 | bool "Sun XVR-1000 support" | ||
908 | depends on (FB = y) && SPARC64 | ||
909 | select FB_CFB_FILLRECT | ||
910 | select FB_CFB_COPYAREA | ||
911 | select FB_CFB_IMAGEBLIT | ||
912 | help | ||
913 | This is the framebuffer device for the Sun XVR-1000 and similar | ||
914 | graphics cards. The driver only works on sparc64 systems where | ||
915 | the system firmware has mostly initialized the card already. It | ||
916 | is treated as a completely dumb framebuffer device. | ||
917 | |||
918 | config FB_PVR2 | ||
919 | tristate "NEC PowerVR 2 display support" | ||
920 | depends on FB && SH_DREAMCAST | ||
921 | select FB_CFB_FILLRECT | ||
922 | select FB_CFB_COPYAREA | ||
923 | select FB_CFB_IMAGEBLIT | ||
924 | ---help--- | ||
925 | Say Y here if you have a PowerVR 2 card in your box. If you plan to | ||
926 | run linux on your Dreamcast, you will have to say Y here. | ||
927 | This driver may or may not work on other PowerVR 2 cards, but is | ||
928 | totally untested. Use at your own risk. If unsure, say N. | ||
929 | |||
930 | To compile this driver as a module, choose M here: the | ||
931 | module will be called pvr2fb. | ||
932 | |||
933 | You can pass several parameters to the driver at boot time or at | ||
934 | module load time. The parameters look like "video=pvr2:XXX", where | ||
935 | the meaning of XXX can be found at the end of the main source file | ||
936 | (<file:drivers/video/pvr2fb.c>). Please see the file | ||
937 | <file:Documentation/fb/pvr2fb.txt>. | ||
938 | |||
939 | config FB_OPENCORES | ||
940 | tristate "OpenCores VGA/LCD core 2.0 framebuffer support" | ||
941 | depends on FB && HAS_DMA | ||
942 | select FB_CFB_FILLRECT | ||
943 | select FB_CFB_COPYAREA | ||
944 | select FB_CFB_IMAGEBLIT | ||
945 | help | ||
946 | This enables support for the OpenCores VGA/LCD core. | ||
947 | |||
948 | The OpenCores VGA/LCD core is typically used together with | ||
949 | softcore CPUs (e.g. OpenRISC or Microblaze) or hard processor | ||
950 | systems (e.g. Altera socfpga or Xilinx Zynq) on FPGAs. | ||
951 | |||
952 | The source code and specification for the core is available at | ||
953 | <http://opencores.org/project,vga_lcd> | ||
954 | |||
955 | config FB_S1D13XXX | ||
956 | tristate "Epson S1D13XXX framebuffer support" | ||
957 | depends on FB | ||
958 | select FB_CFB_FILLRECT | ||
959 | select FB_CFB_COPYAREA | ||
960 | select FB_CFB_IMAGEBLIT | ||
961 | help | ||
962 | Support for S1D13XXX framebuffer device family (currently only | ||
963 | working with S1D13806). Product specs at | ||
964 | <http://vdc.epson.com/> | ||
965 | |||
966 | config FB_ATMEL | ||
967 | tristate "AT91/AT32 LCD Controller support" | ||
968 | depends on FB && HAVE_FB_ATMEL | ||
969 | select FB_CFB_FILLRECT | ||
970 | select FB_CFB_COPYAREA | ||
971 | select FB_CFB_IMAGEBLIT | ||
972 | select FB_MODE_HELPERS | ||
973 | select VIDEOMODE_HELPERS | ||
974 | help | ||
975 | This enables support for the AT91/AT32 LCD Controller. | ||
976 | |||
977 | config FB_INTSRAM | ||
978 | bool "Frame Buffer in internal SRAM" | ||
979 | depends on FB_ATMEL && ARCH_AT91SAM9261 | ||
980 | help | ||
981 | Say Y if you want to map Frame Buffer in internal SRAM. Say N if you want | ||
982 | to let frame buffer in external SDRAM. | ||
983 | |||
984 | config FB_ATMEL_STN | ||
985 | bool "Use a STN display with AT91/AT32 LCD Controller" | ||
986 | depends on FB_ATMEL && (MACH_AT91SAM9261EK || MACH_AT91SAM9G10EK) | ||
987 | default n | ||
988 | help | ||
989 | Say Y if you want to connect a STN LCD display to the AT91/AT32 LCD | ||
990 | Controller. Say N if you want to connect a TFT. | ||
991 | |||
992 | If unsure, say N. | ||
993 | |||
994 | config FB_NVIDIA | ||
995 | tristate "nVidia Framebuffer Support" | ||
996 | depends on FB && PCI | ||
997 | select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT | ||
998 | select FB_MODE_HELPERS | ||
999 | select FB_CFB_FILLRECT | ||
1000 | select FB_CFB_COPYAREA | ||
1001 | select FB_CFB_IMAGEBLIT | ||
1002 | select BITREVERSE | ||
1003 | select VGASTATE | ||
1004 | help | ||
1005 | This driver supports graphics boards with the nVidia chips, TNT | ||
1006 | and newer. For very old chipsets, such as the RIVA128, then use | ||
1007 | the rivafb. | ||
1008 | Say Y if you have such a graphics board. | ||
1009 | |||
1010 | To compile this driver as a module, choose M here: the | ||
1011 | module will be called nvidiafb. | ||
1012 | |||
1013 | config FB_NVIDIA_I2C | ||
1014 | bool "Enable DDC Support" | ||
1015 | depends on FB_NVIDIA | ||
1016 | select FB_DDC | ||
1017 | help | ||
1018 | This enables I2C support for nVidia Chipsets. This is used | ||
1019 | only for getting EDID information from the attached display | ||
1020 | allowing for robust video mode handling and switching. | ||
1021 | |||
1022 | Because fbdev-2.6 requires that drivers must be able to | ||
1023 | independently validate video mode parameters, you should say Y | ||
1024 | here. | ||
1025 | |||
1026 | config FB_NVIDIA_DEBUG | ||
1027 | bool "Lots of debug output" | ||
1028 | depends on FB_NVIDIA | ||
1029 | default n | ||
1030 | help | ||
1031 | Say Y here if you want the nVidia driver to output all sorts | ||
1032 | of debugging information to provide to the maintainer when | ||
1033 | something goes wrong. | ||
1034 | |||
1035 | config FB_NVIDIA_BACKLIGHT | ||
1036 | bool "Support for backlight control" | ||
1037 | depends on FB_NVIDIA | ||
1038 | default y | ||
1039 | help | ||
1040 | Say Y here if you want to control the backlight of your display. | ||
1041 | |||
1042 | config FB_RIVA | ||
1043 | tristate "nVidia Riva support" | ||
1044 | depends on FB && PCI | ||
1045 | select FB_BACKLIGHT if FB_RIVA_BACKLIGHT | ||
1046 | select FB_MODE_HELPERS | ||
1047 | select FB_CFB_FILLRECT | ||
1048 | select FB_CFB_COPYAREA | ||
1049 | select FB_CFB_IMAGEBLIT | ||
1050 | select BITREVERSE | ||
1051 | select VGASTATE | ||
1052 | help | ||
1053 | This driver supports graphics boards with the nVidia Riva/Geforce | ||
1054 | chips. | ||
1055 | Say Y if you have such a graphics board. | ||
1056 | |||
1057 | To compile this driver as a module, choose M here: the | ||
1058 | module will be called rivafb. | ||
1059 | |||
1060 | config FB_RIVA_I2C | ||
1061 | bool "Enable DDC Support" | ||
1062 | depends on FB_RIVA | ||
1063 | select FB_DDC | ||
1064 | help | ||
1065 | This enables I2C support for nVidia Chipsets. This is used | ||
1066 | only for getting EDID information from the attached display | ||
1067 | allowing for robust video mode handling and switching. | ||
1068 | |||
1069 | Because fbdev-2.6 requires that drivers must be able to | ||
1070 | independently validate video mode parameters, you should say Y | ||
1071 | here. | ||
1072 | |||
1073 | config FB_RIVA_DEBUG | ||
1074 | bool "Lots of debug output" | ||
1075 | depends on FB_RIVA | ||
1076 | default n | ||
1077 | help | ||
1078 | Say Y here if you want the Riva driver to output all sorts | ||
1079 | of debugging information to provide to the maintainer when | ||
1080 | something goes wrong. | ||
1081 | |||
1082 | config FB_RIVA_BACKLIGHT | ||
1083 | bool "Support for backlight control" | ||
1084 | depends on FB_RIVA | ||
1085 | default y | ||
1086 | help | ||
1087 | Say Y here if you want to control the backlight of your display. | ||
1088 | |||
1089 | config FB_I740 | ||
1090 | tristate "Intel740 support" | ||
1091 | depends on FB && PCI | ||
1092 | select FB_MODE_HELPERS | ||
1093 | select FB_CFB_FILLRECT | ||
1094 | select FB_CFB_COPYAREA | ||
1095 | select FB_CFB_IMAGEBLIT | ||
1096 | select VGASTATE | ||
1097 | select FB_DDC | ||
1098 | help | ||
1099 | This driver supports graphics cards based on Intel740 chip. | ||
1100 | |||
1101 | config FB_I810 | ||
1102 | tristate "Intel 810/815 support" | ||
1103 | depends on FB && PCI && X86_32 && AGP_INTEL | ||
1104 | select FB_MODE_HELPERS | ||
1105 | select FB_CFB_FILLRECT | ||
1106 | select FB_CFB_COPYAREA | ||
1107 | select FB_CFB_IMAGEBLIT | ||
1108 | select VGASTATE | ||
1109 | help | ||
1110 | This driver supports the on-board graphics built in to the Intel 810 | ||
1111 | and 815 chipsets. Say Y if you have and plan to use such a board. | ||
1112 | |||
1113 | To compile this driver as a module, choose M here: the | ||
1114 | module will be called i810fb. | ||
1115 | |||
1116 | For more information, please read | ||
1117 | <file:Documentation/fb/intel810.txt> | ||
1118 | |||
1119 | config FB_I810_GTF | ||
1120 | bool "use VESA Generalized Timing Formula" | ||
1121 | depends on FB_I810 | ||
1122 | help | ||
1123 | If you say Y, then the VESA standard, Generalized Timing Formula | ||
1124 | or GTF, will be used to calculate the required video timing values | ||
1125 | per video mode. Since the GTF allows nondiscrete timings | ||
1126 | (nondiscrete being a range of values as opposed to discrete being a | ||
1127 | set of values), you'll be able to use any combination of horizontal | ||
1128 | and vertical resolutions, and vertical refresh rates without having | ||
1129 | to specify your own timing parameters. This is especially useful | ||
1130 | to maximize the performance of an aging display, or if you just | ||
1131 | have a display with nonstandard dimensions. A VESA compliant | ||
1132 | monitor is recommended, but can still work with non-compliant ones. | ||
1133 | If you need or want this, then select this option. The timings may | ||
1134 | not be compliant with Intel's recommended values. Use at your own | ||
1135 | risk. | ||
1136 | |||
1137 | If you say N, the driver will revert to discrete video timings | ||
1138 | using a set recommended by Intel in their documentation. | ||
1139 | |||
1140 | If unsure, say N. | ||
1141 | |||
1142 | config FB_I810_I2C | ||
1143 | bool "Enable DDC Support" | ||
1144 | depends on FB_I810 && FB_I810_GTF | ||
1145 | select FB_DDC | ||
1146 | help | ||
1147 | |||
1148 | config FB_LE80578 | ||
1149 | tristate "Intel LE80578 (Vermilion) support" | ||
1150 | depends on FB && PCI && X86 | ||
1151 | select FB_MODE_HELPERS | ||
1152 | select FB_CFB_FILLRECT | ||
1153 | select FB_CFB_COPYAREA | ||
1154 | select FB_CFB_IMAGEBLIT | ||
1155 | help | ||
1156 | This driver supports the LE80578 (Vermilion Range) chipset | ||
1157 | |||
1158 | config FB_CARILLO_RANCH | ||
1159 | tristate "Intel Carillo Ranch support" | ||
1160 | depends on FB_LE80578 && FB && PCI && X86 | ||
1161 | help | ||
1162 | This driver supports the LE80578 (Carillo Ranch) board | ||
1163 | |||
1164 | config FB_INTEL | ||
1165 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" | ||
1166 | depends on FB && PCI && X86 && AGP_INTEL && EXPERT | ||
1167 | select FB_MODE_HELPERS | ||
1168 | select FB_CFB_FILLRECT | ||
1169 | select FB_CFB_COPYAREA | ||
1170 | select FB_CFB_IMAGEBLIT | ||
1171 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y | ||
1172 | depends on !DRM_I915 | ||
1173 | help | ||
1174 | This driver supports the on-board graphics built in to the Intel | ||
1175 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. | ||
1176 | Say Y if you have and plan to use such a board. | ||
1177 | |||
1178 | To make FB_INTELFB=Y work you need to say AGP_INTEL=y too. | ||
1179 | |||
1180 | To compile this driver as a module, choose M here: the | ||
1181 | module will be called intelfb. | ||
1182 | |||
1183 | For more information, please read <file:Documentation/fb/intelfb.txt> | ||
1184 | |||
1185 | config FB_INTEL_DEBUG | ||
1186 | bool "Intel driver Debug Messages" | ||
1187 | depends on FB_INTEL | ||
1188 | ---help--- | ||
1189 | Say Y here if you want the Intel driver to output all sorts | ||
1190 | of debugging information to provide to the maintainer when | ||
1191 | something goes wrong. | ||
1192 | |||
1193 | config FB_INTEL_I2C | ||
1194 | bool "DDC/I2C for Intel framebuffer support" | ||
1195 | depends on FB_INTEL | ||
1196 | select FB_DDC | ||
1197 | default y | ||
1198 | help | ||
1199 | Say Y here if you want DDC/I2C support for your on-board Intel graphics. | ||
1200 | |||
1201 | config FB_MATROX | ||
1202 | tristate "Matrox acceleration" | ||
1203 | depends on FB && PCI | ||
1204 | select FB_CFB_FILLRECT | ||
1205 | select FB_CFB_COPYAREA | ||
1206 | select FB_CFB_IMAGEBLIT | ||
1207 | select FB_TILEBLITTING | ||
1208 | select FB_MACMODES if PPC_PMAC | ||
1209 | ---help--- | ||
1210 | Say Y here if you have a Matrox Millennium, Matrox Millennium II, | ||
1211 | Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox | ||
1212 | Mystique G200, Matrox Millennium G200, Matrox Marvel G200 video, | ||
1213 | Matrox G400, G450 or G550 card in your box. | ||
1214 | |||
1215 | To compile this driver as a module, choose M here: the | ||
1216 | module will be called matroxfb. | ||
1217 | |||
1218 | You can pass several parameters to the driver at boot time or at | ||
1219 | module load time. The parameters look like "video=matroxfb:XXX", and | ||
1220 | are described in <file:Documentation/fb/matroxfb.txt>. | ||
1221 | |||
1222 | config FB_MATROX_MILLENIUM | ||
1223 | bool "Millennium I/II support" | ||
1224 | depends on FB_MATROX | ||
1225 | help | ||
1226 | Say Y here if you have a Matrox Millennium or Matrox Millennium II | ||
1227 | video card. If you select "Advanced lowlevel driver options" below, | ||
1228 | you should check 4 bpp packed pixel, 8 bpp packed pixel, 16 bpp | ||
1229 | packed pixel, 24 bpp packed pixel and 32 bpp packed pixel. You can | ||
1230 | also use font widths different from 8. | ||
1231 | |||
1232 | config FB_MATROX_MYSTIQUE | ||
1233 | bool "Mystique support" | ||
1234 | depends on FB_MATROX | ||
1235 | help | ||
1236 | Say Y here if you have a Matrox Mystique or Matrox Mystique 220 | ||
1237 | video card. If you select "Advanced lowlevel driver options" below, | ||
1238 | you should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp | ||
1239 | packed pixel and 32 bpp packed pixel. You can also use font widths | ||
1240 | different from 8. | ||
1241 | |||
1242 | config FB_MATROX_G | ||
1243 | bool "G100/G200/G400/G450/G550 support" | ||
1244 | depends on FB_MATROX | ||
1245 | ---help--- | ||
1246 | Say Y here if you have a Matrox G100, G200, G400, G450 or G550 based | ||
1247 | video card. If you select "Advanced lowlevel driver options", you | ||
1248 | should check 8 bpp packed pixel, 16 bpp packed pixel, 24 bpp packed | ||
1249 | pixel and 32 bpp packed pixel. You can also use font widths | ||
1250 | different from 8. | ||
1251 | |||
1252 | If you need support for G400 secondary head, you must say Y to | ||
1253 | "Matrox I2C support" and "G400 second head support" right below. | ||
1254 | G450/G550 secondary head and digital output are supported without | ||
1255 | additional modules. | ||
1256 | |||
1257 | The driver starts in monitor mode. You must use the matroxset tool | ||
1258 | (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to | ||
1259 | swap primary and secondary head outputs, or to change output mode. | ||
1260 | Secondary head driver always start in 640x480 resolution and you | ||
1261 | must use fbset to change it. | ||
1262 | |||
1263 | Do not forget that second head supports only 16 and 32 bpp | ||
1264 | packed pixels, so it is a good idea to compile them into the kernel | ||
1265 | too. You can use only some font widths, as the driver uses generic | ||
1266 | painting procedures (the secondary head does not use acceleration | ||
1267 | engine). | ||
1268 | |||
1269 | G450/G550 hardware can display TV picture only from secondary CRTC, | ||
1270 | and it performs no scaling, so picture must have 525 or 625 lines. | ||
1271 | |||
1272 | config FB_MATROX_I2C | ||
1273 | tristate "Matrox I2C support" | ||
1274 | depends on FB_MATROX | ||
1275 | select FB_DDC | ||
1276 | ---help--- | ||
1277 | This drivers creates I2C buses which are needed for accessing the | ||
1278 | DDC (I2C) bus present on all Matroxes, an I2C bus which | ||
1279 | interconnects Matrox optional devices, like MGA-TVO on G200 and | ||
1280 | G400, and the secondary head DDC bus, present on G400 only. | ||
1281 | |||
1282 | You can say Y or M here if you want to experiment with monitor | ||
1283 | detection code. You must say Y or M here if you want to use either | ||
1284 | second head of G400 or MGA-TVO on G200 or G400. | ||
1285 | |||
1286 | If you compile it as module, it will create a module named | ||
1287 | i2c-matroxfb. | ||
1288 | |||
1289 | config FB_MATROX_MAVEN | ||
1290 | tristate "G400 second head support" | ||
1291 | depends on FB_MATROX_G && FB_MATROX_I2C | ||
1292 | ---help--- | ||
1293 | WARNING !!! This support does not work with G450 !!! | ||
1294 | |||
1295 | Say Y or M here if you want to use a secondary head (meaning two | ||
1296 | monitors in parallel) on G400 or MGA-TVO add-on on G200. Secondary | ||
1297 | head is not compatible with accelerated XFree 3.3.x SVGA servers - | ||
1298 | secondary head output is blanked while you are in X. With XFree | ||
1299 | 3.9.17 preview you can use both heads if you use SVGA over fbdev or | ||
1300 | the fbdev driver on first head and the fbdev driver on second head. | ||
1301 | |||
1302 | If you compile it as module, two modules are created, | ||
1303 | matroxfb_crtc2 and matroxfb_maven. Matroxfb_maven is needed for | ||
1304 | both G200 and G400, matroxfb_crtc2 is needed only by G400. You must | ||
1305 | also load i2c-matroxfb to get it to run. | ||
1306 | |||
1307 | The driver starts in monitor mode and you must use the matroxset | ||
1308 | tool (available at | ||
1309 | <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to switch it to | ||
1310 | PAL or NTSC or to swap primary and secondary head outputs. | ||
1311 | Secondary head driver also always start in 640x480 resolution, you | ||
1312 | must use fbset to change it. | ||
1313 | |||
1314 | Also do not forget that second head supports only 16 and 32 bpp | ||
1315 | packed pixels, so it is a good idea to compile them into the kernel | ||
1316 | too. You can use only some font widths, as the driver uses generic | ||
1317 | painting procedures (the secondary head does not use acceleration | ||
1318 | engine). | ||
1319 | |||
1320 | config FB_RADEON | ||
1321 | tristate "ATI Radeon display support" | ||
1322 | depends on FB && PCI | ||
1323 | select FB_BACKLIGHT if FB_RADEON_BACKLIGHT | ||
1324 | select FB_MODE_HELPERS | ||
1325 | select FB_CFB_FILLRECT | ||
1326 | select FB_CFB_COPYAREA | ||
1327 | select FB_CFB_IMAGEBLIT | ||
1328 | select FB_MACMODES if PPC_OF | ||
1329 | help | ||
1330 | Choose this option if you want to use an ATI Radeon graphics card as | ||
1331 | a framebuffer device. There are both PCI and AGP versions. You | ||
1332 | don't need to choose this to run the Radeon in plain VGA mode. | ||
1333 | |||
1334 | There is a product page at | ||
1335 | http://products.amd.com/en-us/GraphicCardResult.aspx | ||
1336 | |||
1337 | config FB_RADEON_I2C | ||
1338 | bool "DDC/I2C for ATI Radeon support" | ||
1339 | depends on FB_RADEON | ||
1340 | select FB_DDC | ||
1341 | default y | ||
1342 | help | ||
1343 | Say Y here if you want DDC/I2C support for your Radeon board. | ||
1344 | |||
1345 | config FB_RADEON_BACKLIGHT | ||
1346 | bool "Support for backlight control" | ||
1347 | depends on FB_RADEON | ||
1348 | default y | ||
1349 | help | ||
1350 | Say Y here if you want to control the backlight of your display. | ||
1351 | |||
1352 | config FB_RADEON_DEBUG | ||
1353 | bool "Lots of debug output from Radeon driver" | ||
1354 | depends on FB_RADEON | ||
1355 | default n | ||
1356 | help | ||
1357 | Say Y here if you want the Radeon driver to output all sorts | ||
1358 | of debugging information to provide to the maintainer when | ||
1359 | something goes wrong. | ||
1360 | |||
1361 | config FB_ATY128 | ||
1362 | tristate "ATI Rage128 display support" | ||
1363 | depends on FB && PCI | ||
1364 | select FB_CFB_FILLRECT | ||
1365 | select FB_CFB_COPYAREA | ||
1366 | select FB_CFB_IMAGEBLIT | ||
1367 | select FB_BACKLIGHT if FB_ATY128_BACKLIGHT | ||
1368 | select FB_MACMODES if PPC_PMAC | ||
1369 | help | ||
1370 | This driver supports graphics boards with the ATI Rage128 chips. | ||
1371 | Say Y if you have such a graphics board and read | ||
1372 | <file:Documentation/fb/aty128fb.txt>. | ||
1373 | |||
1374 | To compile this driver as a module, choose M here: the | ||
1375 | module will be called aty128fb. | ||
1376 | |||
1377 | config FB_ATY128_BACKLIGHT | ||
1378 | bool "Support for backlight control" | ||
1379 | depends on FB_ATY128 | ||
1380 | default y | ||
1381 | help | ||
1382 | Say Y here if you want to control the backlight of your display. | ||
1383 | |||
1384 | config FB_ATY | ||
1385 | tristate "ATI Mach64 display support" if PCI || ATARI | ||
1386 | depends on FB && !SPARC32 | ||
1387 | select FB_CFB_FILLRECT | ||
1388 | select FB_CFB_COPYAREA | ||
1389 | select FB_CFB_IMAGEBLIT | ||
1390 | select FB_BACKLIGHT if FB_ATY_BACKLIGHT | ||
1391 | select FB_MACMODES if PPC | ||
1392 | help | ||
1393 | This driver supports graphics boards with the ATI Mach64 chips. | ||
1394 | Say Y if you have such a graphics board. | ||
1395 | |||
1396 | To compile this driver as a module, choose M here: the | ||
1397 | module will be called atyfb. | ||
1398 | |||
1399 | config FB_ATY_CT | ||
1400 | bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" | ||
1401 | depends on PCI && FB_ATY | ||
1402 | default y if SPARC64 && PCI | ||
1403 | help | ||
1404 | Say Y here to support use of ATI's 64-bit Rage boards (or other | ||
1405 | boards based on the Mach64 CT, VT, GT, and LT chipsets) as a | ||
1406 | framebuffer device. The ATI product support page for these boards | ||
1407 | is at <http://support.ati.com/products/pc/mach64/mach64.html>. | ||
1408 | |||
1409 | config FB_ATY_GENERIC_LCD | ||
1410 | bool "Mach64 generic LCD support" | ||
1411 | depends on FB_ATY_CT | ||
1412 | help | ||
1413 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, | ||
1414 | Rage XC, or Rage XL chipset. | ||
1415 | |||
1416 | config FB_ATY_GX | ||
1417 | bool "Mach64 GX support" if PCI | ||
1418 | depends on FB_ATY | ||
1419 | default y if ATARI | ||
1420 | help | ||
1421 | Say Y here to support use of the ATI Mach64 Graphics Expression | ||
1422 | board (or other boards based on the Mach64 GX chipset) as a | ||
1423 | framebuffer device. The ATI product support page for these boards | ||
1424 | is at | ||
1425 | <http://support.ati.com/products/pc/mach64/graphics_xpression.html>. | ||
1426 | |||
1427 | config FB_ATY_BACKLIGHT | ||
1428 | bool "Support for backlight control" | ||
1429 | depends on FB_ATY | ||
1430 | default y | ||
1431 | help | ||
1432 | Say Y here if you want to control the backlight of your display. | ||
1433 | |||
1434 | config FB_S3 | ||
1435 | tristate "S3 Trio/Virge support" | ||
1436 | depends on FB && PCI | ||
1437 | select FB_CFB_FILLRECT | ||
1438 | select FB_CFB_COPYAREA | ||
1439 | select FB_CFB_IMAGEBLIT | ||
1440 | select FB_TILEBLITTING | ||
1441 | select FB_SVGALIB | ||
1442 | select VGASTATE | ||
1443 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1444 | ---help--- | ||
1445 | Driver for graphics boards with S3 Trio / S3 Virge chip. | ||
1446 | |||
1447 | config FB_S3_DDC | ||
1448 | bool "DDC for S3 support" | ||
1449 | depends on FB_S3 | ||
1450 | select FB_DDC | ||
1451 | default y | ||
1452 | help | ||
1453 | Say Y here if you want DDC support for your S3 graphics card. | ||
1454 | |||
1455 | config FB_SAVAGE | ||
1456 | tristate "S3 Savage support" | ||
1457 | depends on FB && PCI | ||
1458 | select FB_MODE_HELPERS | ||
1459 | select FB_CFB_FILLRECT | ||
1460 | select FB_CFB_COPYAREA | ||
1461 | select FB_CFB_IMAGEBLIT | ||
1462 | select VGASTATE | ||
1463 | help | ||
1464 | This driver supports notebooks and computers with S3 Savage PCI/AGP | ||
1465 | chips. | ||
1466 | |||
1467 | Say Y if you have such a graphics card. | ||
1468 | |||
1469 | To compile this driver as a module, choose M here; the module | ||
1470 | will be called savagefb. | ||
1471 | |||
1472 | config FB_SAVAGE_I2C | ||
1473 | bool "Enable DDC2 Support" | ||
1474 | depends on FB_SAVAGE | ||
1475 | select FB_DDC | ||
1476 | help | ||
1477 | This enables I2C support for S3 Savage Chipsets. This is used | ||
1478 | only for getting EDID information from the attached display | ||
1479 | allowing for robust video mode handling and switching. | ||
1480 | |||
1481 | Because fbdev-2.6 requires that drivers must be able to | ||
1482 | independently validate video mode parameters, you should say Y | ||
1483 | here. | ||
1484 | |||
1485 | config FB_SAVAGE_ACCEL | ||
1486 | bool "Enable Console Acceleration" | ||
1487 | depends on FB_SAVAGE | ||
1488 | default n | ||
1489 | help | ||
1490 | This option will compile in console acceleration support. If | ||
1491 | the resulting framebuffer console has bothersome glitches, then | ||
1492 | choose N here. | ||
1493 | |||
1494 | config FB_SIS | ||
1495 | tristate "SiS/XGI display support" | ||
1496 | depends on FB && PCI | ||
1497 | select FB_CFB_FILLRECT | ||
1498 | select FB_CFB_COPYAREA | ||
1499 | select FB_CFB_IMAGEBLIT | ||
1500 | select FB_BOOT_VESA_SUPPORT if FB_SIS = y | ||
1501 | help | ||
1502 | This is the frame buffer device driver for the SiS 300, 315, 330 | ||
1503 | and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. | ||
1504 | Specs available at <http://www.sis.com> and <http://www.xgitech.com>. | ||
1505 | |||
1506 | To compile this driver as a module, choose M here; the module | ||
1507 | will be called sisfb. | ||
1508 | |||
1509 | config FB_SIS_300 | ||
1510 | bool "SiS 300 series support" | ||
1511 | depends on FB_SIS | ||
1512 | help | ||
1513 | Say Y here to support use of the SiS 300/305, 540, 630 and 730. | ||
1514 | |||
1515 | config FB_SIS_315 | ||
1516 | bool "SiS 315/330/340 series and XGI support" | ||
1517 | depends on FB_SIS | ||
1518 | help | ||
1519 | Say Y here to support use of the SiS 315, 330 and 340 series | ||
1520 | (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760, 761) as well | ||
1521 | as XGI V3XT, V5, V8 and Z7. | ||
1522 | |||
1523 | config FB_VIA | ||
1524 | tristate "VIA UniChrome (Pro) and Chrome9 display support" | ||
1525 | depends on FB && PCI && X86 | ||
1526 | select FB_CFB_FILLRECT | ||
1527 | select FB_CFB_COPYAREA | ||
1528 | select FB_CFB_IMAGEBLIT | ||
1529 | select I2C_ALGOBIT | ||
1530 | select I2C | ||
1531 | select GPIOLIB | ||
1532 | help | ||
1533 | This is the frame buffer device driver for Graphics chips of VIA | ||
1534 | UniChrome (Pro) Family (CLE266,PM800/CN400,P4M800CE/P4M800Pro/ | ||
1535 | CN700/VN800,CX700/VX700,P4M890) and Chrome9 Family (K8M890,CN896 | ||
1536 | /P4M900,VX800) | ||
1537 | Say Y if you have a VIA UniChrome graphics board. | ||
1538 | |||
1539 | To compile this driver as a module, choose M here: the | ||
1540 | module will be called viafb. | ||
1541 | |||
1542 | if FB_VIA | ||
1543 | |||
1544 | config FB_VIA_DIRECT_PROCFS | ||
1545 | bool "direct hardware access via procfs (DEPRECATED)(DANGEROUS)" | ||
1546 | depends on FB_VIA | ||
1547 | default n | ||
1548 | help | ||
1549 | Allow direct hardware access to some output registers via procfs. | ||
1550 | This is dangerous but may provide the only chance to get the | ||
1551 | correct output device configuration. | ||
1552 | Its use is strongly discouraged. | ||
1553 | |||
1554 | config FB_VIA_X_COMPATIBILITY | ||
1555 | bool "X server compatibility" | ||
1556 | depends on FB_VIA | ||
1557 | default n | ||
1558 | help | ||
1559 | This option reduces the functionality (power saving, ...) of the | ||
1560 | framebuffer to avoid negative impact on the OpenChrome X server. | ||
1561 | If you use any X server other than fbdev you should enable this | ||
1562 | otherwise it should be safe to disable it and allow using all | ||
1563 | features. | ||
1564 | |||
1565 | endif | ||
1566 | |||
1567 | config FB_NEOMAGIC | ||
1568 | tristate "NeoMagic display support" | ||
1569 | depends on FB && PCI | ||
1570 | select FB_MODE_HELPERS | ||
1571 | select FB_CFB_FILLRECT | ||
1572 | select FB_CFB_COPYAREA | ||
1573 | select FB_CFB_IMAGEBLIT | ||
1574 | select VGASTATE | ||
1575 | help | ||
1576 | This driver supports notebooks with NeoMagic PCI chips. | ||
1577 | Say Y if you have such a graphics card. | ||
1578 | |||
1579 | To compile this driver as a module, choose M here: the | ||
1580 | module will be called neofb. | ||
1581 | |||
1582 | config FB_KYRO | ||
1583 | tristate "IMG Kyro support" | ||
1584 | depends on FB && PCI | ||
1585 | select FB_CFB_FILLRECT | ||
1586 | select FB_CFB_COPYAREA | ||
1587 | select FB_CFB_IMAGEBLIT | ||
1588 | help | ||
1589 | Say Y here if you have a STG4000 / Kyro / PowerVR 3 based | ||
1590 | graphics board. | ||
1591 | |||
1592 | To compile this driver as a module, choose M here: the | ||
1593 | module will be called kyrofb. | ||
1594 | |||
1595 | config FB_3DFX | ||
1596 | tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support" | ||
1597 | depends on FB && PCI | ||
1598 | select FB_CFB_IMAGEBLIT | ||
1599 | select FB_CFB_FILLRECT | ||
1600 | select FB_CFB_COPYAREA | ||
1601 | select FB_MODE_HELPERS | ||
1602 | help | ||
1603 | This driver supports graphics boards with the 3Dfx Banshee, | ||
1604 | Voodoo3 or VSA-100 (aka Voodoo4/5) chips. Say Y if you have | ||
1605 | such a graphics board. | ||
1606 | |||
1607 | To compile this driver as a module, choose M here: the | ||
1608 | module will be called tdfxfb. | ||
1609 | |||
1610 | config FB_3DFX_ACCEL | ||
1611 | bool "3Dfx Acceleration functions" | ||
1612 | depends on FB_3DFX | ||
1613 | ---help--- | ||
1614 | This will compile the 3Dfx Banshee/Voodoo3/VSA-100 frame buffer | ||
1615 | device driver with acceleration functions. | ||
1616 | |||
1617 | config FB_3DFX_I2C | ||
1618 | bool "Enable DDC/I2C support" | ||
1619 | depends on FB_3DFX | ||
1620 | select FB_DDC | ||
1621 | default y | ||
1622 | help | ||
1623 | Say Y here if you want DDC/I2C support for your 3dfx Voodoo3. | ||
1624 | |||
1625 | config FB_VOODOO1 | ||
1626 | tristate "3Dfx Voodoo Graphics (sst1) support" | ||
1627 | depends on FB && PCI | ||
1628 | select FB_CFB_FILLRECT | ||
1629 | select FB_CFB_COPYAREA | ||
1630 | select FB_CFB_IMAGEBLIT | ||
1631 | ---help--- | ||
1632 | Say Y here if you have a 3Dfx Voodoo Graphics (Voodoo1/sst1) or | ||
1633 | Voodoo2 (cvg) based graphics card. | ||
1634 | |||
1635 | To compile this driver as a module, choose M here: the | ||
1636 | module will be called sstfb. | ||
1637 | |||
1638 | WARNING: Do not use any application that uses the 3D engine | ||
1639 | (namely glide) while using this driver. | ||
1640 | Please read the <file:Documentation/fb/sstfb.txt> for supported | ||
1641 | options and other important info support. | ||
1642 | |||
1643 | config FB_VT8623 | ||
1644 | tristate "VIA VT8623 support" | ||
1645 | depends on FB && PCI | ||
1646 | select FB_CFB_FILLRECT | ||
1647 | select FB_CFB_COPYAREA | ||
1648 | select FB_CFB_IMAGEBLIT | ||
1649 | select FB_TILEBLITTING | ||
1650 | select FB_SVGALIB | ||
1651 | select VGASTATE | ||
1652 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1653 | ---help--- | ||
1654 | Driver for CastleRock integrated graphics core in the | ||
1655 | VIA VT8623 [Apollo CLE266] chipset. | ||
1656 | |||
1657 | config FB_TRIDENT | ||
1658 | tristate "Trident/CyberXXX/CyberBlade support" | ||
1659 | depends on FB && PCI | ||
1660 | select FB_CFB_FILLRECT | ||
1661 | select FB_CFB_COPYAREA | ||
1662 | select FB_CFB_IMAGEBLIT | ||
1663 | ---help--- | ||
1664 | This is the frame buffer device driver for Trident PCI/AGP chipsets. | ||
1665 | Supported chipset families are TGUI 9440/96XX, 3DImage, Blade3D | ||
1666 | and Blade XP. | ||
1667 | There are also integrated versions of these chips called CyberXXXX, | ||
1668 | CyberImage or CyberBlade. These chips are mostly found in laptops | ||
1669 | but also on some motherboards including early VIA EPIA motherboards. | ||
1670 | For more information, read <file:Documentation/fb/tridentfb.txt> | ||
1671 | |||
1672 | Say Y if you have such a graphics board. | ||
1673 | |||
1674 | To compile this driver as a module, choose M here: the | ||
1675 | module will be called tridentfb. | ||
1676 | |||
1677 | config FB_ARK | ||
1678 | tristate "ARK 2000PV support" | ||
1679 | depends on FB && PCI | ||
1680 | select FB_CFB_FILLRECT | ||
1681 | select FB_CFB_COPYAREA | ||
1682 | select FB_CFB_IMAGEBLIT | ||
1683 | select FB_TILEBLITTING | ||
1684 | select FB_SVGALIB | ||
1685 | select VGASTATE | ||
1686 | select FONT_8x16 if FRAMEBUFFER_CONSOLE | ||
1687 | ---help--- | ||
1688 | Driver for PCI graphics boards with ARK 2000PV chip | ||
1689 | and ICS 5342 RAMDAC. | ||
1690 | |||
1691 | config FB_PM3 | ||
1692 | tristate "Permedia3 support" | ||
1693 | depends on FB && PCI | ||
1694 | select FB_CFB_FILLRECT | ||
1695 | select FB_CFB_COPYAREA | ||
1696 | select FB_CFB_IMAGEBLIT | ||
1697 | help | ||
1698 | This is the frame buffer device driver for the 3DLabs Permedia3 | ||
1699 | chipset, used in Formac ProFormance III, 3DLabs Oxygen VX1 & | ||
1700 | similar boards, 3DLabs Permedia3 Create!, Appian Jeronimo 2000 | ||
1701 | and maybe other boards. | ||
1702 | |||
1703 | config FB_CARMINE | ||
1704 | tristate "Fujitsu carmine frame buffer support" | ||
1705 | depends on FB && PCI | ||
1706 | select FB_CFB_FILLRECT | ||
1707 | select FB_CFB_COPYAREA | ||
1708 | select FB_CFB_IMAGEBLIT | ||
1709 | help | ||
1710 | This is the frame buffer device driver for the Fujitsu Carmine chip. | ||
1711 | The driver provides two independent frame buffer devices. | ||
1712 | |||
1713 | choice | ||
1714 | depends on FB_CARMINE | ||
1715 | prompt "DRAM timing" | ||
1716 | default FB_CARMINE_DRAM_EVAL | ||
1717 | |||
1718 | config FB_CARMINE_DRAM_EVAL | ||
1719 | bool "Eval board timings" | ||
1720 | help | ||
1721 | Use timings which work on the eval card. | ||
1722 | |||
1723 | config CARMINE_DRAM_CUSTOM | ||
1724 | bool "Custom board timings" | ||
1725 | help | ||
1726 | Use custom board timings. | ||
1727 | endchoice | ||
1728 | |||
1729 | config FB_AU1100 | ||
1730 | bool "Au1100 LCD Driver" | ||
1731 | depends on (FB = y) && MIPS_ALCHEMY | ||
1732 | select FB_CFB_FILLRECT | ||
1733 | select FB_CFB_COPYAREA | ||
1734 | select FB_CFB_IMAGEBLIT | ||
1735 | help | ||
1736 | This is the framebuffer driver for the AMD Au1100 SOC. It can drive | ||
1737 | various panels and CRTs by passing in kernel cmd line option | ||
1738 | au1100fb:panel=<name>. | ||
1739 | |||
1740 | config FB_AU1200 | ||
1741 | bool "Au1200/Au1300 LCD Driver" | ||
1742 | depends on (FB = y) && MIPS_ALCHEMY | ||
1743 | select FB_SYS_FILLRECT | ||
1744 | select FB_SYS_COPYAREA | ||
1745 | select FB_SYS_IMAGEBLIT | ||
1746 | select FB_SYS_FOPS | ||
1747 | help | ||
1748 | This is the framebuffer driver for the Au1200/Au1300 SOCs. | ||
1749 | It can drive various panels and CRTs by passing in kernel cmd line | ||
1750 | option au1200fb:panel=<name>. | ||
1751 | |||
1752 | config FB_VT8500 | ||
1753 | bool "VIA VT8500 framebuffer support" | ||
1754 | depends on (FB = y) && ARM && ARCH_VT8500 | ||
1755 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | ||
1756 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1757 | select FB_SYS_IMAGEBLIT | ||
1758 | select FB_MODE_HELPERS | ||
1759 | select VIDEOMODE_HELPERS | ||
1760 | help | ||
1761 | This is the framebuffer driver for VIA VT8500 integrated LCD | ||
1762 | controller. | ||
1763 | |||
1764 | config FB_WM8505 | ||
1765 | bool "Wondermedia WM8xxx-series frame buffer support" | ||
1766 | depends on (FB = y) && ARM && ARCH_VT8500 | ||
1767 | select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) | ||
1768 | select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) | ||
1769 | select FB_SYS_IMAGEBLIT | ||
1770 | select FB_MODE_HELPERS | ||
1771 | select VIDEOMODE_HELPERS | ||
1772 | help | ||
1773 | This is the framebuffer driver for WonderMedia WM8xxx-series | ||
1774 | integrated LCD controller. This driver covers the WM8505, WM8650 | ||
1775 | and WM8850 SoCs. | ||
1776 | |||
1777 | config FB_WMT_GE_ROPS | ||
1778 | bool "VT8500/WM8xxx accelerated raster ops support" | ||
1779 | depends on (FB = y) && (FB_VT8500 || FB_WM8505) | ||
1780 | default n | ||
1781 | help | ||
1782 | This adds support for accelerated raster operations on the | ||
1783 | VIA VT8500 and Wondermedia 85xx series SoCs. | ||
1784 | |||
1785 | source "drivers/video/fbdev/geode/Kconfig" | ||
1786 | |||
1787 | config FB_HIT | ||
1788 | tristate "HD64461 Frame Buffer support" | ||
1789 | depends on FB && HD64461 | ||
1790 | select FB_CFB_FILLRECT | ||
1791 | select FB_CFB_COPYAREA | ||
1792 | select FB_CFB_IMAGEBLIT | ||
1793 | help | ||
1794 | This is the frame buffer device driver for the Hitachi HD64461 LCD | ||
1795 | frame buffer card. | ||
1796 | |||
1797 | config FB_PMAG_AA | ||
1798 | bool "PMAG-AA TURBOchannel framebuffer support" | ||
1799 | depends on (FB = y) && TC | ||
1800 | select FB_CFB_FILLRECT | ||
1801 | select FB_CFB_COPYAREA | ||
1802 | select FB_CFB_IMAGEBLIT | ||
1803 | help | ||
1804 | Support for the PMAG-AA TURBOchannel framebuffer card (1280x1024x1) | ||
1805 | used mainly in the MIPS-based DECstation series. | ||
1806 | |||
1807 | config FB_PMAG_BA | ||
1808 | tristate "PMAG-BA TURBOchannel framebuffer support" | ||
1809 | depends on FB && TC | ||
1810 | select FB_CFB_FILLRECT | ||
1811 | select FB_CFB_COPYAREA | ||
1812 | select FB_CFB_IMAGEBLIT | ||
1813 | help | ||
1814 | Support for the PMAG-BA TURBOchannel framebuffer card (1024x864x8) | ||
1815 | used mainly in the MIPS-based DECstation series. | ||
1816 | |||
1817 | config FB_PMAGB_B | ||
1818 | tristate "PMAGB-B TURBOchannel framebuffer support" | ||
1819 | depends on FB && TC | ||
1820 | select FB_CFB_FILLRECT | ||
1821 | select FB_CFB_COPYAREA | ||
1822 | select FB_CFB_IMAGEBLIT | ||
1823 | help | ||
1824 | Support for the PMAGB-B TURBOchannel framebuffer card used mainly | ||
1825 | in the MIPS-based DECstation series. The card is currently only | ||
1826 | supported in 1280x1024x8 mode. | ||
1827 | |||
1828 | config FB_MAXINE | ||
1829 | bool "Maxine (Personal DECstation) onboard framebuffer support" | ||
1830 | depends on (FB = y) && MACH_DECSTATION | ||
1831 | select FB_CFB_FILLRECT | ||
1832 | select FB_CFB_COPYAREA | ||
1833 | select FB_CFB_IMAGEBLIT | ||
1834 | help | ||
1835 | Support for the onboard framebuffer (1024x768x8) in the Personal | ||
1836 | DECstation series (Personal DECstation 5000/20, /25, /33, /50, | ||
1837 | Codename "Maxine"). | ||
1838 | |||
1839 | config FB_G364 | ||
1840 | bool "G364 frame buffer support" | ||
1841 | depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700) | ||
1842 | select FB_CFB_FILLRECT | ||
1843 | select FB_CFB_COPYAREA | ||
1844 | select FB_CFB_IMAGEBLIT | ||
1845 | help | ||
1846 | The G364 driver is the framebuffer used in MIPS Magnum 4000 and | ||
1847 | Olivetti M700-10 systems. | ||
1848 | |||
1849 | config FB_68328 | ||
1850 | bool "Motorola 68328 native frame buffer support" | ||
1851 | depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328) | ||
1852 | select FB_CFB_FILLRECT | ||
1853 | select FB_CFB_COPYAREA | ||
1854 | select FB_CFB_IMAGEBLIT | ||
1855 | help | ||
1856 | Say Y here if you want to support the built-in frame buffer of | ||
1857 | the Motorola 68328 CPU family. | ||
1858 | |||
1859 | config FB_PXA168 | ||
1860 | tristate "PXA168/910 LCD framebuffer support" | ||
1861 | depends on FB && (CPU_PXA168 || CPU_PXA910) | ||
1862 | select FB_CFB_FILLRECT | ||
1863 | select FB_CFB_COPYAREA | ||
1864 | select FB_CFB_IMAGEBLIT | ||
1865 | ---help--- | ||
1866 | Frame buffer driver for the built-in LCD controller in the Marvell | ||
1867 | MMP processor. | ||
1868 | |||
1869 | config FB_PXA | ||
1870 | tristate "PXA LCD framebuffer support" | ||
1871 | depends on FB && ARCH_PXA | ||
1872 | select FB_CFB_FILLRECT | ||
1873 | select FB_CFB_COPYAREA | ||
1874 | select FB_CFB_IMAGEBLIT | ||
1875 | ---help--- | ||
1876 | Frame buffer driver for the built-in LCD controller in the Intel | ||
1877 | PXA2x0 processor. | ||
1878 | |||
1879 | This driver is also available as a module ( = code which can be | ||
1880 | inserted and removed from the running kernel whenever you want). The | ||
1881 | module will be called pxafb. If you want to compile it as a module, | ||
1882 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
1883 | |||
1884 | If unsure, say N. | ||
1885 | |||
1886 | config FB_PXA_OVERLAY | ||
1887 | bool "Support PXA27x/PXA3xx Overlay(s) as framebuffer" | ||
1888 | default n | ||
1889 | depends on FB_PXA && (PXA27x || PXA3xx) | ||
1890 | |||
1891 | config FB_PXA_SMARTPANEL | ||
1892 | bool "PXA Smartpanel LCD support" | ||
1893 | default n | ||
1894 | depends on FB_PXA | ||
1895 | |||
1896 | config FB_PXA_PARAMETERS | ||
1897 | bool "PXA LCD command line parameters" | ||
1898 | default n | ||
1899 | depends on FB_PXA | ||
1900 | ---help--- | ||
1901 | Enable the use of kernel command line or module parameters | ||
1902 | to configure the physical properties of the LCD panel when | ||
1903 | using the PXA LCD driver. | ||
1904 | |||
1905 | This option allows you to override the panel parameters | ||
1906 | supplied by the platform in order to support multiple | ||
1907 | different models of flatpanel. If you will only be using a | ||
1908 | single model of flatpanel then you can safely leave this | ||
1909 | option disabled. | ||
1910 | |||
1911 | <file:Documentation/fb/pxafb.txt> describes the available parameters. | ||
1912 | |||
1913 | config PXA3XX_GCU | ||
1914 | tristate "PXA3xx 2D graphics accelerator driver" | ||
1915 | depends on FB_PXA | ||
1916 | help | ||
1917 | Kernelspace driver for the 2D graphics controller unit (GCU) | ||
1918 | found on PXA3xx processors. There is a counterpart driver in the | ||
1919 | DirectFB suite, see http://www.directfb.org/ | ||
1920 | |||
1921 | If you compile this as a module, it will be called pxa3xx_gcu. | ||
1922 | |||
1923 | config FB_MBX | ||
1924 | tristate "2700G LCD framebuffer support" | ||
1925 | depends on FB && ARCH_PXA | ||
1926 | select FB_CFB_FILLRECT | ||
1927 | select FB_CFB_COPYAREA | ||
1928 | select FB_CFB_IMAGEBLIT | ||
1929 | ---help--- | ||
1930 | Framebuffer driver for the Intel 2700G (Marathon) Graphics | ||
1931 | Accelerator | ||
1932 | |||
1933 | config FB_MBX_DEBUG | ||
1934 | bool "Enable debugging info via debugfs" | ||
1935 | depends on FB_MBX && DEBUG_FS | ||
1936 | default n | ||
1937 | ---help--- | ||
1938 | Enable this if you want debugging information using the debug | ||
1939 | filesystem (debugfs) | ||
1940 | |||
1941 | If unsure, say N. | ||
1942 | |||
1943 | config FB_FSL_DIU | ||
1944 | tristate "Freescale DIU framebuffer support" | ||
1945 | depends on FB && FSL_SOC | ||
1946 | select FB_MODE_HELPERS | ||
1947 | select FB_CFB_FILLRECT | ||
1948 | select FB_CFB_COPYAREA | ||
1949 | select FB_CFB_IMAGEBLIT | ||
1950 | select PPC_LIB_RHEAP | ||
1951 | ---help--- | ||
1952 | Framebuffer driver for the Freescale SoC DIU | ||
1953 | |||
1954 | config FB_W100 | ||
1955 | tristate "W100 frame buffer support" | ||
1956 | depends on FB && ARCH_PXA | ||
1957 | select FB_CFB_FILLRECT | ||
1958 | select FB_CFB_COPYAREA | ||
1959 | select FB_CFB_IMAGEBLIT | ||
1960 | ---help--- | ||
1961 | Frame buffer driver for the w100 as found on the Sharp SL-Cxx series. | ||
1962 | It can also drive the w3220 chip found on iPAQ hx4700. | ||
1963 | |||
1964 | This driver is also available as a module ( = code which can be | ||
1965 | inserted and removed from the running kernel whenever you want). The | ||
1966 | module will be called w100fb. If you want to compile it as a module, | ||
1967 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
1968 | |||
1969 | If unsure, say N. | ||
1970 | |||
1971 | config FB_SH_MOBILE_LCDC | ||
1972 | tristate "SuperH Mobile LCDC framebuffer support" | ||
1973 | depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK | ||
1974 | select FB_SYS_FILLRECT | ||
1975 | select FB_SYS_COPYAREA | ||
1976 | select FB_SYS_IMAGEBLIT | ||
1977 | select FB_SYS_FOPS | ||
1978 | select FB_DEFERRED_IO | ||
1979 | select FB_BACKLIGHT | ||
1980 | select SH_MIPI_DSI if SH_LCD_MIPI_DSI | ||
1981 | ---help--- | ||
1982 | Frame buffer driver for the on-chip SH-Mobile LCD controller. | ||
1983 | |||
1984 | config FB_SH_MOBILE_HDMI | ||
1985 | tristate "SuperH Mobile HDMI controller support" | ||
1986 | depends on FB_SH_MOBILE_LCDC | ||
1987 | select FB_MODE_HELPERS | ||
1988 | select SOUND | ||
1989 | select SND | ||
1990 | select SND_SOC | ||
1991 | ---help--- | ||
1992 | Driver for the on-chip SH-Mobile HDMI controller. | ||
1993 | |||
1994 | config FB_TMIO | ||
1995 | tristate "Toshiba Mobile IO FrameBuffer support" | ||
1996 | depends on FB && MFD_CORE | ||
1997 | select FB_CFB_FILLRECT | ||
1998 | select FB_CFB_COPYAREA | ||
1999 | select FB_CFB_IMAGEBLIT | ||
2000 | ---help--- | ||
2001 | Frame buffer driver for the Toshiba Mobile IO integrated as found | ||
2002 | on the Sharp SL-6000 series | ||
2003 | |||
2004 | This driver is also available as a module ( = code which can be | ||
2005 | inserted and removed from the running kernel whenever you want). The | ||
2006 | module will be called tmiofb. If you want to compile it as a module, | ||
2007 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2008 | |||
2009 | If unsure, say N. | ||
2010 | |||
2011 | config FB_TMIO_ACCELL | ||
2012 | bool "tmiofb acceleration" | ||
2013 | depends on FB_TMIO | ||
2014 | default y | ||
2015 | |||
2016 | config FB_S3C | ||
2017 | tristate "Samsung S3C framebuffer support" | ||
2018 | depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || ARCH_S5P64X0 || \ | ||
2019 | ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) | ||
2020 | select FB_CFB_FILLRECT | ||
2021 | select FB_CFB_COPYAREA | ||
2022 | select FB_CFB_IMAGEBLIT | ||
2023 | ---help--- | ||
2024 | Frame buffer driver for the built-in FB controller in the Samsung | ||
2025 | SoC line from the S3C2443 onwards, including the S3C2416, S3C2450, | ||
2026 | and the S3C64XX series such as the S3C6400 and S3C6410. | ||
2027 | |||
2028 | These chips all have the same basic framebuffer design with the | ||
2029 | actual capabilities depending on the chip. For instance the S3C6400 | ||
2030 | and S3C6410 support 4 hardware windows whereas the S3C24XX series | ||
2031 | currently only have two. | ||
2032 | |||
2033 | Currently the support is only for the S3C6400 and S3C6410 SoCs. | ||
2034 | |||
2035 | config FB_S3C_DEBUG_REGWRITE | ||
2036 | bool "Debug register writes" | ||
2037 | depends on FB_S3C | ||
2038 | ---help--- | ||
2039 | Show all register writes via pr_debug() | ||
2040 | |||
2041 | config FB_S3C2410 | ||
2042 | tristate "S3C2410 LCD framebuffer support" | ||
2043 | depends on FB && ARCH_S3C24XX | ||
2044 | select FB_CFB_FILLRECT | ||
2045 | select FB_CFB_COPYAREA | ||
2046 | select FB_CFB_IMAGEBLIT | ||
2047 | ---help--- | ||
2048 | Frame buffer driver for the built-in LCD controller in the Samsung | ||
2049 | S3C2410 processor. | ||
2050 | |||
2051 | This driver is also available as a module ( = code which can be | ||
2052 | inserted and removed from the running kernel whenever you want). The | ||
2053 | module will be called s3c2410fb. If you want to compile it as a module, | ||
2054 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2055 | |||
2056 | If unsure, say N. | ||
2057 | config FB_S3C2410_DEBUG | ||
2058 | bool "S3C2410 lcd debug messages" | ||
2059 | depends on FB_S3C2410 | ||
2060 | help | ||
2061 | Turn on debugging messages. Note that you can set/unset at run time | ||
2062 | through sysfs | ||
2063 | |||
2064 | config FB_NUC900 | ||
2065 | bool "NUC900 LCD framebuffer support" | ||
2066 | depends on FB && ARCH_W90X900 | ||
2067 | select FB_CFB_FILLRECT | ||
2068 | select FB_CFB_COPYAREA | ||
2069 | select FB_CFB_IMAGEBLIT | ||
2070 | ---help--- | ||
2071 | Frame buffer driver for the built-in LCD controller in the Nuvoton | ||
2072 | NUC900 processor | ||
2073 | |||
2074 | config GPM1040A0_320X240 | ||
2075 | bool "Giantplus Technology GPM1040A0 320x240 Color TFT LCD" | ||
2076 | depends on FB_NUC900 | ||
2077 | |||
2078 | config FB_SM501 | ||
2079 | tristate "Silicon Motion SM501 framebuffer support" | ||
2080 | depends on FB && MFD_SM501 | ||
2081 | select FB_CFB_FILLRECT | ||
2082 | select FB_CFB_COPYAREA | ||
2083 | select FB_CFB_IMAGEBLIT | ||
2084 | ---help--- | ||
2085 | Frame buffer driver for the CRT and LCD controllers in the Silicon | ||
2086 | Motion SM501. | ||
2087 | |||
2088 | This driver is also available as a module ( = code which can be | ||
2089 | inserted and removed from the running kernel whenever you want). The | ||
2090 | module will be called sm501fb. If you want to compile it as a module, | ||
2091 | say M here and read <file:Documentation/kbuild/modules.txt>. | ||
2092 | |||
2093 | If unsure, say N. | ||
2094 | |||
2095 | config FB_SMSCUFX | ||
2096 | tristate "SMSC UFX6000/7000 USB Framebuffer support" | ||
2097 | depends on FB && USB | ||
2098 | select FB_MODE_HELPERS | ||
2099 | select FB_SYS_FILLRECT | ||
2100 | select FB_SYS_COPYAREA | ||
2101 | select FB_SYS_IMAGEBLIT | ||
2102 | select FB_SYS_FOPS | ||
2103 | select FB_DEFERRED_IO | ||
2104 | ---help--- | ||
2105 | This is a kernel framebuffer driver for SMSC UFX USB devices. | ||
2106 | Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and | ||
2107 | mplayer -vo fbdev. Supports both UFX6000 (USB 2.0) and UFX7000 | ||
2108 | (USB 3.0) devices. | ||
2109 | To compile as a module, choose M here: the module name is smscufx. | ||
2110 | |||
2111 | config FB_UDL | ||
2112 | tristate "Displaylink USB Framebuffer support" | ||
2113 | depends on FB && USB | ||
2114 | select FB_MODE_HELPERS | ||
2115 | select FB_SYS_FILLRECT | ||
2116 | select FB_SYS_COPYAREA | ||
2117 | select FB_SYS_IMAGEBLIT | ||
2118 | select FB_SYS_FOPS | ||
2119 | select FB_DEFERRED_IO | ||
2120 | ---help--- | ||
2121 | This is a kernel framebuffer driver for DisplayLink USB devices. | ||
2122 | Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and | ||
2123 | mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices. | ||
2124 | To compile as a module, choose M here: the module name is udlfb. | ||
2125 | |||
2126 | config FB_IBM_GXT4500 | ||
2127 | tristate "Framebuffer support for IBM GXT4000P/4500P/6000P/6500P adaptors" | ||
2128 | depends on FB && PPC | ||
2129 | select FB_CFB_FILLRECT | ||
2130 | select FB_CFB_COPYAREA | ||
2131 | select FB_CFB_IMAGEBLIT | ||
2132 | ---help--- | ||
2133 | Say Y here to enable support for the IBM GXT4000P/6000P and | ||
2134 | GXT4500P/6500P display adaptor based on Raster Engine RC1000, | ||
2135 | found on some IBM System P (pSeries) machines. This driver | ||
2136 | doesn't use Geometry Engine GT1000. | ||
2137 | |||
2138 | config FB_PS3 | ||
2139 | tristate "PS3 GPU framebuffer driver" | ||
2140 | depends on FB && PS3_PS3AV | ||
2141 | select FB_SYS_FILLRECT | ||
2142 | select FB_SYS_COPYAREA | ||
2143 | select FB_SYS_IMAGEBLIT | ||
2144 | select FB_SYS_FOPS | ||
2145 | select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE | ||
2146 | ---help--- | ||
2147 | Include support for the virtual frame buffer in the PS3 platform. | ||
2148 | |||
2149 | config FB_PS3_DEFAULT_SIZE_M | ||
2150 | int "PS3 default frame buffer size (in MiB)" | ||
2151 | depends on FB_PS3 | ||
2152 | default 9 | ||
2153 | ---help--- | ||
2154 | This is the default size (in MiB) of the virtual frame buffer in | ||
2155 | the PS3. | ||
2156 | The default value can be overridden on the kernel command line | ||
2157 | using the "ps3fb" option (e.g. "ps3fb=9M"); | ||
2158 | |||
2159 | config FB_XILINX | ||
2160 | tristate "Xilinx frame buffer support" | ||
2161 | depends on FB && (XILINX_VIRTEX || MICROBLAZE || ARCH_ZYNQ) | ||
2162 | select FB_CFB_FILLRECT | ||
2163 | select FB_CFB_COPYAREA | ||
2164 | select FB_CFB_IMAGEBLIT | ||
2165 | ---help--- | ||
2166 | Include support for the Xilinx ML300/ML403 reference design | ||
2167 | framebuffer. ML300 carries a 640*480 LCD display on the board, | ||
2168 | ML403 uses a standard DB15 VGA connector. | ||
2169 | |||
2170 | config FB_GOLDFISH | ||
2171 | tristate "Goldfish Framebuffer" | ||
2172 | depends on FB && HAS_DMA | ||
2173 | select FB_CFB_FILLRECT | ||
2174 | select FB_CFB_COPYAREA | ||
2175 | select FB_CFB_IMAGEBLIT | ||
2176 | ---help--- | ||
2177 | Framebuffer driver for Goldfish Virtual Platform | ||
2178 | |||
2179 | config FB_COBALT | ||
2180 | tristate "Cobalt server LCD frame buffer support" | ||
2181 | depends on FB && (MIPS_COBALT || MIPS_SEAD3) | ||
2182 | |||
2183 | config FB_SH7760 | ||
2184 | bool "SH7760/SH7763/SH7720/SH7721 LCDC support" | ||
2185 | depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ | ||
2186 | || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721) | ||
2187 | select FB_CFB_FILLRECT | ||
2188 | select FB_CFB_COPYAREA | ||
2189 | select FB_CFB_IMAGEBLIT | ||
2190 | ---help--- | ||
2191 | Support for the SH7760/SH7763/SH7720/SH7721 integrated | ||
2192 | (D)STN/TFT LCD Controller. | ||
2193 | Supports display resolutions up to 1024x1024 pixel, grayscale and | ||
2194 | color operation, with depths ranging from 1 bpp to 8 bpp monochrome | ||
2195 | and 8, 15 or 16 bpp color; 90 degrees clockwise display rotation for | ||
2196 | panels <= 320 pixel horizontal resolution. | ||
2197 | |||
2198 | config FB_DA8XX | ||
2199 | tristate "DA8xx/OMAP-L1xx/AM335x Framebuffer support" | ||
2200 | depends on FB && (ARCH_DAVINCI_DA8XX || SOC_AM33XX) | ||
2201 | select FB_CFB_FILLRECT | ||
2202 | select FB_CFB_COPYAREA | ||
2203 | select FB_CFB_IMAGEBLIT | ||
2204 | select FB_CFB_REV_PIXELS_IN_BYTE | ||
2205 | select FB_MODE_HELPERS | ||
2206 | select VIDEOMODE_HELPERS | ||
2207 | ---help--- | ||
2208 | This is the frame buffer device driver for the TI LCD controller | ||
2209 | found on DA8xx/OMAP-L1xx/AM335x SoCs. | ||
2210 | If unsure, say N. | ||
2211 | |||
2212 | config FB_VIRTUAL | ||
2213 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" | ||
2214 | depends on FB | ||
2215 | select FB_SYS_FILLRECT | ||
2216 | select FB_SYS_COPYAREA | ||
2217 | select FB_SYS_IMAGEBLIT | ||
2218 | select FB_SYS_FOPS | ||
2219 | ---help--- | ||
2220 | This is a `virtual' frame buffer device. It operates on a chunk of | ||
2221 | unswappable kernel memory instead of on the memory of a graphics | ||
2222 | board. This means you cannot see any output sent to this frame | ||
2223 | buffer device, while it does consume precious memory. The main use | ||
2224 | of this frame buffer device is testing and debugging the frame | ||
2225 | buffer subsystem. Do NOT enable it for normal systems! To protect | ||
2226 | the innocent, it has to be enabled explicitly at boot time using the | ||
2227 | kernel option `video=vfb:'. | ||
2228 | |||
2229 | To compile this driver as a module, choose M here: the | ||
2230 | module will be called vfb. In order to load it, you must use | ||
2231 | the vfb_enable=1 option. | ||
2232 | |||
2233 | If unsure, say N. | ||
2234 | |||
2235 | config XEN_FBDEV_FRONTEND | ||
2236 | tristate "Xen virtual frame buffer support" | ||
2237 | depends on FB && XEN | ||
2238 | select FB_SYS_FILLRECT | ||
2239 | select FB_SYS_COPYAREA | ||
2240 | select FB_SYS_IMAGEBLIT | ||
2241 | select FB_SYS_FOPS | ||
2242 | select FB_DEFERRED_IO | ||
2243 | select INPUT_XEN_KBDDEV_FRONTEND if INPUT_MISC | ||
2244 | select XEN_XENBUS_FRONTEND | ||
2245 | default y | ||
2246 | help | ||
2247 | This driver implements the front-end of the Xen virtual | ||
2248 | frame buffer driver. It communicates with a back-end | ||
2249 | in another domain. | ||
2250 | |||
2251 | config FB_METRONOME | ||
2252 | tristate "E-Ink Metronome/8track controller support" | ||
2253 | depends on FB | ||
2254 | select FB_SYS_FILLRECT | ||
2255 | select FB_SYS_COPYAREA | ||
2256 | select FB_SYS_IMAGEBLIT | ||
2257 | select FB_SYS_FOPS | ||
2258 | select FB_DEFERRED_IO | ||
2259 | help | ||
2260 | This driver implements support for the E-Ink Metronome | ||
2261 | controller. The pre-release name for this device was 8track | ||
2262 | and could also have been called by some vendors as PVI-nnnn. | ||
2263 | |||
2264 | config FB_MB862XX | ||
2265 | tristate "Fujitsu MB862xx GDC support" | ||
2266 | depends on FB | ||
2267 | depends on PCI || (OF && PPC) | ||
2268 | select FB_CFB_FILLRECT | ||
2269 | select FB_CFB_COPYAREA | ||
2270 | select FB_CFB_IMAGEBLIT | ||
2271 | ---help--- | ||
2272 | Frame buffer driver for Fujitsu Carmine/Coral-P(A)/Lime controllers. | ||
2273 | |||
2274 | choice | ||
2275 | prompt "GDC variant" | ||
2276 | depends on FB_MB862XX | ||
2277 | |||
2278 | config FB_MB862XX_PCI_GDC | ||
2279 | bool "Carmine/Coral-P(A) GDC" | ||
2280 | depends on PCI | ||
2281 | ---help--- | ||
2282 | This enables framebuffer support for Fujitsu Carmine/Coral-P(A) | ||
2283 | PCI graphics controller devices. | ||
2284 | |||
2285 | config FB_MB862XX_LIME | ||
2286 | bool "Lime GDC" | ||
2287 | depends on OF && PPC | ||
2288 | select FB_FOREIGN_ENDIAN | ||
2289 | select FB_LITTLE_ENDIAN | ||
2290 | ---help--- | ||
2291 | Framebuffer support for Fujitsu Lime GDC on host CPU bus. | ||
2292 | |||
2293 | endchoice | ||
2294 | |||
2295 | config FB_MB862XX_I2C | ||
2296 | bool "Support I2C bus on MB862XX GDC" | ||
2297 | depends on FB_MB862XX && I2C | ||
2298 | default y | ||
2299 | help | ||
2300 | Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter | ||
2301 | driver to support accessing I2C devices on controller's I2C bus. | ||
2302 | These are usually some video decoder chips. | ||
2303 | |||
2304 | config FB_EP93XX | ||
2305 | tristate "EP93XX frame buffer support" | ||
2306 | depends on FB && ARCH_EP93XX | ||
2307 | select FB_CFB_FILLRECT | ||
2308 | select FB_CFB_COPYAREA | ||
2309 | select FB_CFB_IMAGEBLIT | ||
2310 | ---help--- | ||
2311 | Framebuffer driver for the Cirrus Logic EP93XX series of processors. | ||
2312 | This driver is also available as a module. The module will be called | ||
2313 | ep93xx-fb. | ||
2314 | |||
2315 | config FB_PRE_INIT_FB | ||
2316 | bool "Don't reinitialize, use bootloader's GDC/Display configuration" | ||
2317 | depends on FB && FB_MB862XX_LIME | ||
2318 | ---help--- | ||
2319 | Select this option if display contents should be inherited as set by | ||
2320 | the bootloader. | ||
2321 | |||
2322 | config FB_MSM | ||
2323 | tristate "MSM Framebuffer support" | ||
2324 | depends on FB && ARCH_MSM | ||
2325 | select FB_CFB_FILLRECT | ||
2326 | select FB_CFB_COPYAREA | ||
2327 | select FB_CFB_IMAGEBLIT | ||
2328 | |||
2329 | config FB_MX3 | ||
2330 | tristate "MX3 Framebuffer support" | ||
2331 | depends on FB && MX3_IPU | ||
2332 | select FB_CFB_FILLRECT | ||
2333 | select FB_CFB_COPYAREA | ||
2334 | select FB_CFB_IMAGEBLIT | ||
2335 | default y | ||
2336 | help | ||
2337 | This is a framebuffer device for the i.MX31 LCD Controller. So | ||
2338 | far only synchronous displays are supported. If you plan to use | ||
2339 | an LCD display with your i.MX31 system, say Y here. | ||
2340 | |||
2341 | config FB_BROADSHEET | ||
2342 | tristate "E-Ink Broadsheet/Epson S1D13521 controller support" | ||
2343 | depends on FB | ||
2344 | select FB_SYS_FILLRECT | ||
2345 | select FB_SYS_COPYAREA | ||
2346 | select FB_SYS_IMAGEBLIT | ||
2347 | select FB_SYS_FOPS | ||
2348 | select FB_DEFERRED_IO | ||
2349 | help | ||
2350 | This driver implements support for the E-Ink Broadsheet | ||
2351 | controller. The release name for this device was Epson S1D13521 | ||
2352 | and could also have been called by other names when coupled with | ||
2353 | a bridge adapter. | ||
2354 | |||
2355 | config FB_AUO_K190X | ||
2356 | tristate "AUO-K190X EPD controller support" | ||
2357 | depends on FB | ||
2358 | select FB_SYS_FILLRECT | ||
2359 | select FB_SYS_COPYAREA | ||
2360 | select FB_SYS_IMAGEBLIT | ||
2361 | select FB_SYS_FOPS | ||
2362 | select FB_DEFERRED_IO | ||
2363 | help | ||
2364 | Provides support for epaper controllers from the K190X series | ||
2365 | of AUO. These controllers can be used to drive epaper displays | ||
2366 | from Sipix. | ||
2367 | |||
2368 | This option enables the common support, shared by the individual | ||
2369 | controller drivers. You will also have to enable the driver | ||
2370 | for the controller type used in your device. | ||
2371 | |||
2372 | config FB_AUO_K1900 | ||
2373 | tristate "AUO-K1900 EPD controller support" | ||
2374 | depends on FB && FB_AUO_K190X | ||
2375 | help | ||
2376 | This driver implements support for the AUO K1900 epd-controller. | ||
2377 | This controller can drive Sipix epaper displays but can only do | ||
2378 | serial updates, reducing the number of possible frames per second. | ||
2379 | |||
2380 | config FB_AUO_K1901 | ||
2381 | tristate "AUO-K1901 EPD controller support" | ||
2382 | depends on FB && FB_AUO_K190X | ||
2383 | help | ||
2384 | This driver implements support for the AUO K1901 epd-controller. | ||
2385 | This controller can drive Sipix epaper displays and supports | ||
2386 | concurrent updates, making higher frames per second possible. | ||
2387 | |||
2388 | config FB_JZ4740 | ||
2389 | tristate "JZ4740 LCD framebuffer support" | ||
2390 | depends on FB && MACH_JZ4740 | ||
2391 | select FB_SYS_FILLRECT | ||
2392 | select FB_SYS_COPYAREA | ||
2393 | select FB_SYS_IMAGEBLIT | ||
2394 | help | ||
2395 | Framebuffer support for the JZ4740 SoC. | ||
2396 | |||
2397 | config FB_MXS | ||
2398 | tristate "MXS LCD framebuffer support" | ||
2399 | depends on FB && ARCH_MXS | ||
2400 | select FB_CFB_FILLRECT | ||
2401 | select FB_CFB_COPYAREA | ||
2402 | select FB_CFB_IMAGEBLIT | ||
2403 | select FB_MODE_HELPERS | ||
2404 | select VIDEOMODE_HELPERS | ||
2405 | help | ||
2406 | Framebuffer support for the MXS SoC. | ||
2407 | |||
2408 | config FB_PUV3_UNIGFX | ||
2409 | tristate "PKUnity v3 Unigfx framebuffer support" | ||
2410 | depends on FB && UNICORE32 && ARCH_PUV3 | ||
2411 | select FB_SYS_FILLRECT | ||
2412 | select FB_SYS_COPYAREA | ||
2413 | select FB_SYS_IMAGEBLIT | ||
2414 | select FB_SYS_FOPS | ||
2415 | help | ||
2416 | Choose this option if you want to use the Unigfx device as a | ||
2417 | framebuffer device. Without the support of PCI & AGP. | ||
2418 | |||
2419 | config FB_HYPERV | ||
2420 | tristate "Microsoft Hyper-V Synthetic Video support" | ||
2421 | depends on FB && HYPERV | ||
2422 | select FB_CFB_FILLRECT | ||
2423 | select FB_CFB_COPYAREA | ||
2424 | select FB_CFB_IMAGEBLIT | ||
2425 | help | ||
2426 | This framebuffer driver supports Microsoft Hyper-V Synthetic Video. | ||
2427 | |||
2428 | config FB_SIMPLE | ||
2429 | bool "Simple framebuffer support" | ||
2430 | depends on (FB = y) | ||
2431 | select FB_CFB_FILLRECT | ||
2432 | select FB_CFB_COPYAREA | ||
2433 | select FB_CFB_IMAGEBLIT | ||
2434 | help | ||
2435 | Say Y if you want support for a simple frame-buffer. | ||
2436 | |||
2437 | This driver assumes that the display hardware has been initialized | ||
2438 | before the kernel boots, and the kernel will simply render to the | ||
2439 | pre-allocated frame buffer surface. | ||
2440 | |||
2441 | Configuration re: surface address, size, and format must be provided | ||
2442 | through device tree, or plain old platform data. | ||
2443 | |||
2444 | source "drivers/video/fbdev/omap/Kconfig" | ||
2445 | source "drivers/video/fbdev/omap2/Kconfig" | ||
2446 | source "drivers/video/fbdev/exynos/Kconfig" | ||
2447 | source "drivers/video/fbdev/mmp/Kconfig" | ||
2448 | |||
2449 | config FB_SH_MOBILE_MERAM | ||
2450 | tristate "SuperH Mobile MERAM read ahead support" | ||
2451 | depends on (SUPERH || ARCH_SHMOBILE) | ||
2452 | select GENERIC_ALLOCATOR | ||
2453 | ---help--- | ||
2454 | Enable MERAM support for the SuperH controller. | ||
2455 | |||
2456 | This will allow for caching of the framebuffer to provide more | ||
2457 | reliable access under heavy main memory bus traffic situations. | ||
2458 | Up to 4 memory channels can be configured, allowing 4 RGB or | ||
2459 | 2 YCbCr framebuffers to be configured. | ||
2460 | |||
2461 | config FB_SSD1307 | ||
2462 | tristate "Solomon SSD1307 framebuffer support" | ||
2463 | depends on FB && I2C | ||
2464 | depends on OF | ||
2465 | depends on GPIOLIB | ||
2466 | select FB_SYS_FOPS | ||
2467 | select FB_SYS_FILLRECT | ||
2468 | select FB_SYS_COPYAREA | ||
2469 | select FB_SYS_IMAGEBLIT | ||
2470 | select FB_DEFERRED_IO | ||
2471 | select PWM | ||
2472 | help | ||
2473 | This driver implements support for the Solomon SSD1307 | ||
2474 | OLED controller over I2C. | ||
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile new file mode 100644 index 000000000000..0284f2a12538 --- /dev/null +++ b/drivers/video/fbdev/Makefile | |||
@@ -0,0 +1,152 @@ | |||
1 | # Makefile for the Linux video drivers. | ||
2 | # 5 Aug 1999, James Simmons, <mailto:jsimmons@users.sf.net> | ||
3 | # Rewritten to use lists instead of if-statements. | ||
4 | |||
5 | # Each configuration option enables a list of files. | ||
6 | |||
7 | obj-y += core/ | ||
8 | |||
9 | obj-$(CONFIG_EXYNOS_VIDEO) += exynos/ | ||
10 | |||
11 | obj-$(CONFIG_FB_MACMODES) += macmodes.o | ||
12 | obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o | ||
13 | |||
14 | # Hardware specific drivers go first | ||
15 | obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o | ||
16 | obj-$(CONFIG_FB_ARC) += arcfb.o | ||
17 | obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o | ||
18 | obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o | ||
19 | obj-$(CONFIG_FB_GRVGA) += grvga.o | ||
20 | obj-$(CONFIG_FB_PM2) += pm2fb.o | ||
21 | obj-$(CONFIG_FB_PM3) += pm3fb.o | ||
22 | |||
23 | obj-$(CONFIG_FB_I740) += i740fb.o | ||
24 | obj-$(CONFIG_FB_MATROX) += matrox/ | ||
25 | obj-$(CONFIG_FB_RIVA) += riva/ | ||
26 | obj-$(CONFIG_FB_NVIDIA) += nvidia/ | ||
27 | obj-$(CONFIG_FB_ATY) += aty/ macmodes.o | ||
28 | obj-$(CONFIG_FB_ATY128) += aty/ macmodes.o | ||
29 | obj-$(CONFIG_FB_RADEON) += aty/ | ||
30 | obj-$(CONFIG_FB_SIS) += sis/ | ||
31 | obj-$(CONFIG_FB_VIA) += via/ | ||
32 | obj-$(CONFIG_FB_KYRO) += kyro/ | ||
33 | obj-$(CONFIG_FB_SAVAGE) += savage/ | ||
34 | obj-$(CONFIG_FB_GEODE) += geode/ | ||
35 | obj-$(CONFIG_FB_MBX) += mbx/ | ||
36 | obj-$(CONFIG_FB_NEOMAGIC) += neofb.o | ||
37 | obj-$(CONFIG_FB_3DFX) += tdfxfb.o | ||
38 | obj-$(CONFIG_FB_CONTROL) += controlfb.o | ||
39 | obj-$(CONFIG_FB_PLATINUM) += platinumfb.o | ||
40 | obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o | ||
41 | obj-$(CONFIG_FB_CT65550) += chipsfb.o | ||
42 | obj-$(CONFIG_FB_IMSTT) += imsttfb.o | ||
43 | obj-$(CONFIG_FB_FM2) += fm2fb.o | ||
44 | obj-$(CONFIG_FB_VT8623) += vt8623fb.o | ||
45 | obj-$(CONFIG_FB_TRIDENT) += tridentfb.o | ||
46 | obj-$(CONFIG_FB_LE80578) += vermilion/ | ||
47 | obj-$(CONFIG_FB_S3) += s3fb.o | ||
48 | obj-$(CONFIG_FB_ARK) += arkfb.o | ||
49 | obj-$(CONFIG_FB_STI) += stifb.o | ||
50 | obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o | ||
51 | obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o | ||
52 | obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o | ||
53 | obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o | ||
54 | obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o | ||
55 | obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o | ||
56 | obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o | ||
57 | obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o | ||
58 | obj-$(CONFIG_FB_ACORN) += acornfb.o | ||
59 | obj-$(CONFIG_FB_ATARI) += atafb.o c2p_iplan2.o atafb_mfb.o \ | ||
60 | atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o | ||
61 | obj-$(CONFIG_FB_MAC) += macfb.o | ||
62 | obj-$(CONFIG_FB_HECUBA) += hecubafb.o | ||
63 | obj-$(CONFIG_FB_N411) += n411.o | ||
64 | obj-$(CONFIG_FB_HGA) += hgafb.o | ||
65 | obj-$(CONFIG_FB_XVR500) += sunxvr500.o | ||
66 | obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o | ||
67 | obj-$(CONFIG_FB_XVR1000) += sunxvr1000.o | ||
68 | obj-$(CONFIG_FB_IGA) += igafb.o | ||
69 | obj-$(CONFIG_FB_APOLLO) += dnfb.o | ||
70 | obj-$(CONFIG_FB_Q40) += q40fb.o | ||
71 | obj-$(CONFIG_FB_TGA) += tgafb.o | ||
72 | obj-$(CONFIG_FB_HP300) += hpfb.o | ||
73 | obj-$(CONFIG_FB_G364) += g364fb.o | ||
74 | obj-$(CONFIG_FB_EP93XX) += ep93xx-fb.o | ||
75 | obj-$(CONFIG_FB_SA1100) += sa1100fb.o | ||
76 | obj-$(CONFIG_FB_HIT) += hitfb.o | ||
77 | obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o | ||
78 | obj-$(CONFIG_FB_PVR2) += pvr2fb.o | ||
79 | obj-$(CONFIG_FB_VOODOO1) += sstfb.o | ||
80 | obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o | ||
81 | obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o | ||
82 | obj-$(CONFIG_FB_68328) += 68328fb.o | ||
83 | obj-$(CONFIG_FB_GBE) += gbefb.o | ||
84 | obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o | ||
85 | obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o | ||
86 | obj-$(CONFIG_FB_PXA) += pxafb.o | ||
87 | obj-$(CONFIG_FB_PXA168) += pxa168fb.o | ||
88 | obj-$(CONFIG_PXA3XX_GCU) += pxa3xx-gcu.o | ||
89 | obj-$(CONFIG_MMP_DISP) += mmp/ | ||
90 | obj-$(CONFIG_FB_W100) += w100fb.o | ||
91 | obj-$(CONFIG_FB_TMIO) += tmiofb.o | ||
92 | obj-$(CONFIG_FB_AU1100) += au1100fb.o | ||
93 | obj-$(CONFIG_FB_AU1200) += au1200fb.o | ||
94 | obj-$(CONFIG_FB_VT8500) += vt8500lcdfb.o | ||
95 | obj-$(CONFIG_FB_WM8505) += wm8505fb.o | ||
96 | obj-$(CONFIG_FB_PMAG_AA) += pmag-aa-fb.o | ||
97 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o | ||
98 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o | ||
99 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o | ||
100 | obj-$(CONFIG_FB_METRONOME) += metronomefb.o | ||
101 | obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o | ||
102 | obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o | ||
103 | obj-$(CONFIG_FB_AUO_K1900) += auo_k1900fb.o | ||
104 | obj-$(CONFIG_FB_AUO_K1901) += auo_k1901fb.o | ||
105 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o | ||
106 | obj-$(CONFIG_FB_SH7760) += sh7760fb.o | ||
107 | obj-$(CONFIG_FB_IMX) += imxfb.o | ||
108 | obj-$(CONFIG_FB_S3C) += s3c-fb.o | ||
109 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o | ||
110 | obj-$(CONFIG_FB_FSL_DIU) += fsl-diu-fb.o | ||
111 | obj-$(CONFIG_FB_COBALT) += cobalt_lcdfb.o | ||
112 | obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o | ||
113 | obj-$(CONFIG_FB_PS3) += ps3fb.o | ||
114 | obj-$(CONFIG_FB_SM501) += sm501fb.o | ||
115 | obj-$(CONFIG_FB_UDL) += udlfb.o | ||
116 | obj-$(CONFIG_FB_SMSCUFX) += smscufx.o | ||
117 | obj-$(CONFIG_FB_XILINX) += xilinxfb.o | ||
118 | obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o | ||
119 | obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o | ||
120 | obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o | ||
121 | obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o | ||
122 | obj-$(CONFIG_FB_OMAP) += omap/ | ||
123 | obj-y += omap2/ | ||
124 | obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o | ||
125 | obj-$(CONFIG_FB_CARMINE) += carminefb.o | ||
126 | obj-$(CONFIG_FB_MB862XX) += mb862xx/ | ||
127 | obj-$(CONFIG_FB_MSM) += msm/ | ||
128 | obj-$(CONFIG_FB_NUC900) += nuc900fb.o | ||
129 | obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o | ||
130 | obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o | ||
131 | obj-$(CONFIG_FB_HYPERV) += hyperv_fb.o | ||
132 | obj-$(CONFIG_FB_OPENCORES) += ocfb.o | ||
133 | |||
134 | # Platform or fallback drivers go here | ||
135 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | ||
136 | obj-$(CONFIG_FB_VESA) += vesafb.o | ||
137 | obj-$(CONFIG_FB_EFI) += efifb.o | ||
138 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | ||
139 | obj-$(CONFIG_FB_OF) += offb.o | ||
140 | obj-$(CONFIG_FB_BF537_LQ035) += bf537-lq035.o | ||
141 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o | ||
142 | obj-$(CONFIG_FB_BFIN_LQ035Q1) += bfin-lq035q1-fb.o | ||
143 | obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o | ||
144 | obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o | ||
145 | obj-$(CONFIG_FB_MX3) += mx3fb.o | ||
146 | obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o | ||
147 | obj-$(CONFIG_FB_MXS) += mxsfb.o | ||
148 | obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o | ||
149 | obj-$(CONFIG_FB_SIMPLE) += simplefb.o | ||
150 | |||
151 | # the test framebuffer is last | ||
152 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o | ||
diff --git a/drivers/video/acornfb.c b/drivers/video/fbdev/acornfb.c index a305caea58ee..a305caea58ee 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/fbdev/acornfb.c | |||
diff --git a/drivers/video/acornfb.h b/drivers/video/fbdev/acornfb.h index 175c8ff3367c..175c8ff3367c 100644 --- a/drivers/video/acornfb.h +++ b/drivers/video/fbdev/acornfb.h | |||
diff --git a/drivers/video/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index 14d6b3793e0a..14d6b3793e0a 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c | |||
diff --git a/drivers/video/amifb.c b/drivers/video/fbdev/amifb.c index 518f790ef88a..518f790ef88a 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/fbdev/amifb.c | |||
diff --git a/drivers/video/arcfb.c b/drivers/video/fbdev/arcfb.c index 1b0b233b8b39..1b0b233b8b39 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/fbdev/arcfb.c | |||
diff --git a/drivers/video/arkfb.c b/drivers/video/fbdev/arkfb.c index adc4ea2cc5a0..adc4ea2cc5a0 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/fbdev/arkfb.c | |||
diff --git a/drivers/video/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c index 7e8ddf00ccc2..7e8ddf00ccc2 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/fbdev/asiliantfb.c | |||
diff --git a/drivers/video/atafb.c b/drivers/video/fbdev/atafb.c index e21d1f58554c..e21d1f58554c 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/fbdev/atafb.c | |||
diff --git a/drivers/video/atafb.h b/drivers/video/fbdev/atafb.h index 014e05906cb1..014e05906cb1 100644 --- a/drivers/video/atafb.h +++ b/drivers/video/fbdev/atafb.h | |||
diff --git a/drivers/video/atafb_iplan2p2.c b/drivers/video/fbdev/atafb_iplan2p2.c index 8cc9c50379d0..8cc9c50379d0 100644 --- a/drivers/video/atafb_iplan2p2.c +++ b/drivers/video/fbdev/atafb_iplan2p2.c | |||
diff --git a/drivers/video/atafb_iplan2p4.c b/drivers/video/fbdev/atafb_iplan2p4.c index bee0d89463f7..bee0d89463f7 100644 --- a/drivers/video/atafb_iplan2p4.c +++ b/drivers/video/fbdev/atafb_iplan2p4.c | |||
diff --git a/drivers/video/atafb_iplan2p8.c b/drivers/video/fbdev/atafb_iplan2p8.c index 356fb52ce443..356fb52ce443 100644 --- a/drivers/video/atafb_iplan2p8.c +++ b/drivers/video/fbdev/atafb_iplan2p8.c | |||
diff --git a/drivers/video/atafb_mfb.c b/drivers/video/fbdev/atafb_mfb.c index 6a352d62eecf..6a352d62eecf 100644 --- a/drivers/video/atafb_mfb.c +++ b/drivers/video/fbdev/atafb_mfb.c | |||
diff --git a/drivers/video/atafb_utils.h b/drivers/video/fbdev/atafb_utils.h index ac9e19dc5057..ac9e19dc5057 100644 --- a/drivers/video/atafb_utils.h +++ b/drivers/video/fbdev/atafb_utils.h | |||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e683b6ef9594..e683b6ef9594 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
diff --git a/drivers/video/aty/Makefile b/drivers/video/fbdev/aty/Makefile index a6cc0e9ec790..a6cc0e9ec790 100644 --- a/drivers/video/aty/Makefile +++ b/drivers/video/fbdev/aty/Makefile | |||
diff --git a/drivers/video/aty/ati_ids.h b/drivers/video/fbdev/aty/ati_ids.h index 3e9d28bcd9f8..3e9d28bcd9f8 100644 --- a/drivers/video/aty/ati_ids.h +++ b/drivers/video/fbdev/aty/ati_ids.h | |||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 52108be69e77..52108be69e77 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c | |||
diff --git a/drivers/video/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h index 1f39a62f899b..1f39a62f899b 100644 --- a/drivers/video/aty/atyfb.h +++ b/drivers/video/fbdev/aty/atyfb.h | |||
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index c3d0074a32db..c3d0074a32db 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c | |||
diff --git a/drivers/video/aty/mach64_accel.c b/drivers/video/fbdev/aty/mach64_accel.c index 182bd680141f..182bd680141f 100644 --- a/drivers/video/aty/mach64_accel.c +++ b/drivers/video/fbdev/aty/mach64_accel.c | |||
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c index 51f29d627ceb..51f29d627ceb 100644 --- a/drivers/video/aty/mach64_ct.c +++ b/drivers/video/fbdev/aty/mach64_ct.c | |||
diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/fbdev/aty/mach64_cursor.c index 0fe02e22d9a4..2fa0317ab3c7 100644 --- a/drivers/video/aty/mach64_cursor.c +++ b/drivers/video/fbdev/aty/mach64_cursor.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/fb.h> | 5 | #include <linux/fb.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include "../fb_draw.h" | 8 | #include "../core/fb_draw.h" |
9 | 9 | ||
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | 11 | ||
diff --git a/drivers/video/aty/mach64_gx.c b/drivers/video/fbdev/aty/mach64_gx.c index 10c988aef58e..10c988aef58e 100644 --- a/drivers/video/aty/mach64_gx.c +++ b/drivers/video/fbdev/aty/mach64_gx.c | |||
diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/fbdev/aty/radeon_accel.c index a469a3d6edcb..a469a3d6edcb 100644 --- a/drivers/video/aty/radeon_accel.c +++ b/drivers/video/fbdev/aty/radeon_accel.c | |||
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/fbdev/aty/radeon_backlight.c index db572df7e1ef..db572df7e1ef 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/fbdev/aty/radeon_backlight.c | |||
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c index 26d80a4486fb..26d80a4486fb 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/fbdev/aty/radeon_base.c | |||
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/fbdev/aty/radeon_i2c.c index ab1d0fd76316..ab1d0fd76316 100644 --- a/drivers/video/aty/radeon_i2c.c +++ b/drivers/video/fbdev/aty/radeon_i2c.c | |||
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/fbdev/aty/radeon_monitor.c index bc078d50d8f1..bc078d50d8f1 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/fbdev/aty/radeon_monitor.c | |||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/fbdev/aty/radeon_pm.c index 46a12f1a93c3..46a12f1a93c3 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/fbdev/aty/radeon_pm.c | |||
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/fbdev/aty/radeonfb.h index cb846044f57c..cb846044f57c 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/fbdev/aty/radeonfb.h | |||
diff --git a/drivers/video/au1100fb.c b/drivers/video/fbdev/au1100fb.c index 372d4aea9d1c..372d4aea9d1c 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/fbdev/au1100fb.c | |||
diff --git a/drivers/video/au1100fb.h b/drivers/video/fbdev/au1100fb.h index 12d9642d5465..12d9642d5465 100644 --- a/drivers/video/au1100fb.h +++ b/drivers/video/fbdev/au1100fb.h | |||
diff --git a/drivers/video/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 4cfba78a1458..4cfba78a1458 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c | |||
diff --git a/drivers/video/au1200fb.h b/drivers/video/fbdev/au1200fb.h index e2672714d8d4..e2672714d8d4 100644 --- a/drivers/video/au1200fb.h +++ b/drivers/video/fbdev/au1200fb.h | |||
diff --git a/drivers/video/auo_k1900fb.c b/drivers/video/fbdev/auo_k1900fb.c index f5b668e77af3..f5b668e77af3 100644 --- a/drivers/video/auo_k1900fb.c +++ b/drivers/video/fbdev/auo_k1900fb.c | |||
diff --git a/drivers/video/auo_k1901fb.c b/drivers/video/fbdev/auo_k1901fb.c index 12b9adcb75c5..12b9adcb75c5 100644 --- a/drivers/video/auo_k1901fb.c +++ b/drivers/video/fbdev/auo_k1901fb.c | |||
diff --git a/drivers/video/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c index 8d2499d1cafb..8d2499d1cafb 100644 --- a/drivers/video/auo_k190x.c +++ b/drivers/video/fbdev/auo_k190x.c | |||
diff --git a/drivers/video/auo_k190x.h b/drivers/video/fbdev/auo_k190x.h index e35af1f51b28..e35af1f51b28 100644 --- a/drivers/video/auo_k190x.h +++ b/drivers/video/fbdev/auo_k190x.h | |||
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/fbdev/bf537-lq035.c index a82d2578d976..a82d2578d976 100644 --- a/drivers/video/bf537-lq035.c +++ b/drivers/video/fbdev/bf537-lq035.c | |||
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/fbdev/bf54x-lq043fb.c index 42b8f9d11018..e2c42ad8515a 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/fbdev/bf54x-lq043fb.c | |||
@@ -49,13 +49,13 @@ | |||
49 | #include <linux/spinlock.h> | 49 | #include <linux/spinlock.h> |
50 | #include <linux/dma-mapping.h> | 50 | #include <linux/dma-mapping.h> |
51 | #include <linux/platform_device.h> | 51 | #include <linux/platform_device.h> |
52 | #include <linux/gpio.h> | ||
52 | 53 | ||
53 | #include <asm/blackfin.h> | 54 | #include <asm/blackfin.h> |
54 | #include <asm/irq.h> | 55 | #include <asm/irq.h> |
55 | #include <asm/dpmc.h> | 56 | #include <asm/dpmc.h> |
56 | #include <asm/dma-mapping.h> | 57 | #include <asm/dma-mapping.h> |
57 | #include <asm/dma.h> | 58 | #include <asm/dma.h> |
58 | #include <asm/gpio.h> | ||
59 | #include <asm/portmux.h> | 59 | #include <asm/portmux.h> |
60 | 60 | ||
61 | #include <mach/bf54x-lq043.h> | 61 | #include <mach/bf54x-lq043.h> |
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/fbdev/bfin-lq035q1-fb.c index b594a58ff21d..b594a58ff21d 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/fbdev/bfin-lq035q1-fb.c | |||
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/fbdev/bfin-t350mcqb-fb.c index b5cf1307a3d9..b5cf1307a3d9 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/fbdev/bfin-t350mcqb-fb.c | |||
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index a54f7f7d763b..a54f7f7d763b 100644 --- a/drivers/video/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c | |||
diff --git a/drivers/video/bfin_adv7393fb.h b/drivers/video/fbdev/bfin_adv7393fb.h index cd591b5152a5..cd591b5152a5 100644 --- a/drivers/video/bfin_adv7393fb.h +++ b/drivers/video/fbdev/bfin_adv7393fb.h | |||
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 8556264b16b7..8556264b16b7 100644 --- a/drivers/video/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c | |||
diff --git a/drivers/video/bt431.h b/drivers/video/fbdev/bt431.h index 04e0cfbba538..04e0cfbba538 100644 --- a/drivers/video/bt431.h +++ b/drivers/video/fbdev/bt431.h | |||
diff --git a/drivers/video/bt455.h b/drivers/video/fbdev/bt455.h index 80f61b03e9ae..80f61b03e9ae 100644 --- a/drivers/video/bt455.h +++ b/drivers/video/fbdev/bt455.h | |||
diff --git a/drivers/video/bw2.c b/drivers/video/fbdev/bw2.c index bc123d6947a4..bc123d6947a4 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/fbdev/bw2.c | |||
diff --git a/drivers/video/c2p.h b/drivers/video/fbdev/c2p.h index 6c38d40427d8..6c38d40427d8 100644 --- a/drivers/video/c2p.h +++ b/drivers/video/fbdev/c2p.h | |||
diff --git a/drivers/video/c2p_core.h b/drivers/video/fbdev/c2p_core.h index e1035a865fb9..e1035a865fb9 100644 --- a/drivers/video/c2p_core.h +++ b/drivers/video/fbdev/c2p_core.h | |||
diff --git a/drivers/video/c2p_iplan2.c b/drivers/video/fbdev/c2p_iplan2.c index 19156dc6158c..19156dc6158c 100644 --- a/drivers/video/c2p_iplan2.c +++ b/drivers/video/fbdev/c2p_iplan2.c | |||
diff --git a/drivers/video/c2p_planar.c b/drivers/video/fbdev/c2p_planar.c index ec7ac8526f06..ec7ac8526f06 100644 --- a/drivers/video/c2p_planar.c +++ b/drivers/video/fbdev/c2p_planar.c | |||
diff --git a/drivers/video/carminefb.c b/drivers/video/fbdev/carminefb.c index 65f7c15f5fdb..65f7c15f5fdb 100644 --- a/drivers/video/carminefb.c +++ b/drivers/video/fbdev/carminefb.c | |||
diff --git a/drivers/video/carminefb.h b/drivers/video/fbdev/carminefb.h index 05306de0c6b6..05306de0c6b6 100644 --- a/drivers/video/carminefb.h +++ b/drivers/video/fbdev/carminefb.h | |||
diff --git a/drivers/video/carminefb_regs.h b/drivers/video/fbdev/carminefb_regs.h index 045215600b73..045215600b73 100644 --- a/drivers/video/carminefb_regs.h +++ b/drivers/video/fbdev/carminefb_regs.h | |||
diff --git a/drivers/video/cg14.c b/drivers/video/fbdev/cg14.c index c79745b136bb..c79745b136bb 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/fbdev/cg14.c | |||
diff --git a/drivers/video/cg3.c b/drivers/video/fbdev/cg3.c index 64a89d5747ed..64a89d5747ed 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/fbdev/cg3.c | |||
diff --git a/drivers/video/cg6.c b/drivers/video/fbdev/cg6.c index 70781fea092a..70781fea092a 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/fbdev/cg6.c | |||
diff --git a/drivers/video/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 206a66b61072..206a66b61072 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c | |||
diff --git a/drivers/video/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c index d992aa5eb3f0..d992aa5eb3f0 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/fbdev/cirrusfb.c | |||
diff --git a/drivers/video/clps711xfb.c b/drivers/video/fbdev/clps711xfb.c index f00980607b8f..f00980607b8f 100644 --- a/drivers/video/clps711xfb.c +++ b/drivers/video/fbdev/clps711xfb.c | |||
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c index d5533f4db1cf..d5533f4db1cf 100644 --- a/drivers/video/cobalt_lcdfb.c +++ b/drivers/video/fbdev/cobalt_lcdfb.c | |||
diff --git a/drivers/video/controlfb.c b/drivers/video/fbdev/controlfb.c index fdadef979238..fdadef979238 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/fbdev/controlfb.c | |||
diff --git a/drivers/video/controlfb.h b/drivers/video/fbdev/controlfb.h index 6026c60fc100..6026c60fc100 100644 --- a/drivers/video/controlfb.h +++ b/drivers/video/fbdev/controlfb.h | |||
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile new file mode 100644 index 000000000000..fa306538dac2 --- /dev/null +++ b/drivers/video/fbdev/core/Makefile | |||
@@ -0,0 +1,16 @@ | |||
1 | obj-y += fb_notify.o | ||
2 | obj-$(CONFIG_FB) += fb.o | ||
3 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ | ||
4 | modedb.o fbcvt.o | ||
5 | fb-objs := $(fb-y) | ||
6 | |||
7 | obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o | ||
8 | obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o | ||
9 | obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o | ||
10 | obj-$(CONFIG_FB_SYS_FILLRECT) += sysfillrect.o | ||
11 | obj-$(CONFIG_FB_SYS_COPYAREA) += syscopyarea.o | ||
12 | obj-$(CONFIG_FB_SYS_IMAGEBLIT) += sysimgblt.o | ||
13 | obj-$(CONFIG_FB_SYS_FOPS) += fb_sys_fops.o | ||
14 | obj-$(CONFIG_FB_SVGALIB) += svgalib.o | ||
15 | obj-$(CONFIG_FB_DDC) += fb_ddc.o | ||
16 | obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o | ||
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/fbdev/core/cfbcopyarea.c index bcb57235fcc7..bcb57235fcc7 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/fbdev/core/cfbcopyarea.c | |||
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/fbdev/core/cfbfillrect.c index ba9f58b2a5e8..ba9f58b2a5e8 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/fbdev/core/cfbfillrect.c | |||
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c index a2bb276a8b24..a2bb276a8b24 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/fbdev/core/cfbimgblt.c | |||
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fbdev/core/fb_ddc.c index 2b106f046fde..94322ccfedde 100644 --- a/drivers/video/fb_ddc.c +++ b/drivers/video/fbdev/core/fb_ddc.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/i2c-algo-bit.h> | 15 | #include <linux/i2c-algo-bit.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | 17 | ||
18 | #include "edid.h" | 18 | #include "../edid.h" |
19 | 19 | ||
20 | #define DDC_ADDR 0x50 | 20 | #define DDC_ADDR 0x50 |
21 | 21 | ||
diff --git a/drivers/video/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c index 900aa4ecd617..900aa4ecd617 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fbdev/core/fb_defio.c | |||
diff --git a/drivers/video/fb_draw.h b/drivers/video/fbdev/core/fb_draw.h index 624ee115f129..624ee115f129 100644 --- a/drivers/video/fb_draw.h +++ b/drivers/video/fbdev/core/fb_draw.h | |||
diff --git a/drivers/video/fb_notify.c b/drivers/video/fbdev/core/fb_notify.c index 74c2da528884..74c2da528884 100644 --- a/drivers/video/fb_notify.c +++ b/drivers/video/fbdev/core/fb_notify.c | |||
diff --git a/drivers/video/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c index ff275d7f3eaf..ff275d7f3eaf 100644 --- a/drivers/video/fb_sys_fops.c +++ b/drivers/video/fbdev/core/fb_sys_fops.c | |||
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c index f89245b8ba8e..f89245b8ba8e 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c | |||
diff --git a/drivers/video/fbcvt.c b/drivers/video/fbdev/core/fbcvt.c index 7cb715dfc0e1..7cb715dfc0e1 100644 --- a/drivers/video/fbcvt.c +++ b/drivers/video/fbdev/core/fbcvt.c | |||
diff --git a/drivers/video/fbmem.c b/drivers/video/fbdev/core/fbmem.c index b6d5008f361f..b6d5008f361f 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c | |||
diff --git a/drivers/video/fbmon.c b/drivers/video/fbdev/core/fbmon.c index 6103fa6fb54f..c204ebe6187e 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <asm/prom.h> | 37 | #include <asm/prom.h> |
38 | #include <asm/pci-bridge.h> | 38 | #include <asm/pci-bridge.h> |
39 | #endif | 39 | #endif |
40 | #include "edid.h" | 40 | #include "../edid.h" |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * EDID parser | 43 | * EDID parser |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 53444ac19fe0..53444ac19fe0 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c | |||
diff --git a/drivers/video/modedb.c b/drivers/video/fbdev/core/modedb.c index a9a907c440d7..a9a907c440d7 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/fbdev/core/modedb.c | |||
diff --git a/drivers/video/svgalib.c b/drivers/video/fbdev/core/svgalib.c index 9e01322fabe3..9e01322fabe3 100644 --- a/drivers/video/svgalib.c +++ b/drivers/video/fbdev/core/svgalib.c | |||
diff --git a/drivers/video/syscopyarea.c b/drivers/video/fbdev/core/syscopyarea.c index 844a32fd38ed..844a32fd38ed 100644 --- a/drivers/video/syscopyarea.c +++ b/drivers/video/fbdev/core/syscopyarea.c | |||
diff --git a/drivers/video/sysfillrect.c b/drivers/video/fbdev/core/sysfillrect.c index 33ee3d34f9d2..33ee3d34f9d2 100644 --- a/drivers/video/sysfillrect.c +++ b/drivers/video/fbdev/core/sysfillrect.c | |||
diff --git a/drivers/video/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c index a4d05b1b17d7..a4d05b1b17d7 100644 --- a/drivers/video/sysimgblt.c +++ b/drivers/video/fbdev/core/sysimgblt.c | |||
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index b0a950f36970..b0a950f36970 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c | |||
diff --git a/drivers/video/cyber2000fb.h b/drivers/video/fbdev/cyber2000fb.h index bad69102e774..bad69102e774 100644 --- a/drivers/video/cyber2000fb.h +++ b/drivers/video/fbdev/cyber2000fb.h | |||
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 0c0ba920ea48..6b23508ff0a5 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c | |||
@@ -663,15 +663,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
663 | (green << info->var.green.offset) | | 663 | (green << info->var.green.offset) | |
664 | (blue << info->var.blue.offset); | 664 | (blue << info->var.blue.offset); |
665 | 665 | ||
666 | switch (info->var.bits_per_pixel) { | 666 | ((u32 *) (info->pseudo_palette))[regno] = v; |
667 | case 16: | ||
668 | ((u16 *) (info->pseudo_palette))[regno] = v; | ||
669 | break; | ||
670 | case 24: | ||
671 | case 32: | ||
672 | ((u32 *) (info->pseudo_palette))[regno] = v; | ||
673 | break; | ||
674 | } | ||
675 | if (palette[0] != 0x4000) { | 667 | if (palette[0] != 0x4000) { |
676 | update_hw = 1; | 668 | update_hw = 1; |
677 | palette[0] = 0x4000; | 669 | palette[0] = 0x4000; |
diff --git a/drivers/video/dnfb.c b/drivers/video/fbdev/dnfb.c index 3526899da61b..3526899da61b 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/fbdev/dnfb.c | |||
diff --git a/drivers/video/edid.h b/drivers/video/fbdev/edid.h index d03a232d90b2..d03a232d90b2 100644 --- a/drivers/video/edid.h +++ b/drivers/video/fbdev/edid.h | |||
diff --git a/drivers/video/efifb.c b/drivers/video/fbdev/efifb.c index ae9618ff6735..ae9618ff6735 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/fbdev/efifb.c | |||
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c index 35a0f533f1a2..35a0f533f1a2 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/fbdev/ep93xx-fb.c | |||
diff --git a/drivers/video/exynos/Kconfig b/drivers/video/fbdev/exynos/Kconfig index fcf2d48ac6d1..fcf2d48ac6d1 100644 --- a/drivers/video/exynos/Kconfig +++ b/drivers/video/fbdev/exynos/Kconfig | |||
diff --git a/drivers/video/exynos/Makefile b/drivers/video/fbdev/exynos/Makefile index b5b1bd228abb..b5b1bd228abb 100644 --- a/drivers/video/exynos/Makefile +++ b/drivers/video/fbdev/exynos/Makefile | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/fbdev/exynos/exynos_mipi_dsi.c index cee9602f9a7b..cee9602f9a7b 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi.c | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c index 85edabfdef5a..85edabfdef5a 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_common.c +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.h b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.h index 412552274df3..412552274df3 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_common.h +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.h | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c b/drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.c index c148d06540c1..c148d06540c1 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.c | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.h b/drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.h index 85460701c7ea..85460701c7ea 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.h +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_lowlevel.h | |||
diff --git a/drivers/video/exynos/exynos_mipi_dsi_regs.h b/drivers/video/fbdev/exynos/exynos_mipi_dsi_regs.h index 4227106d3fd0..4227106d3fd0 100644 --- a/drivers/video/exynos/exynos_mipi_dsi_regs.h +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_regs.h | |||
diff --git a/drivers/video/exynos/s6e8ax0.c b/drivers/video/fbdev/exynos/s6e8ax0.c index 29e70ed3f154..29e70ed3f154 100644 --- a/drivers/video/exynos/s6e8ax0.c +++ b/drivers/video/fbdev/exynos/s6e8ax0.c | |||
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fbdev/fb-puv3.c index 6db9ebd042a3..6db9ebd042a3 100644 --- a/drivers/video/fb-puv3.c +++ b/drivers/video/fbdev/fb-puv3.c | |||
diff --git a/drivers/video/ffb.c b/drivers/video/fbdev/ffb.c index 4c4ffa61ae26..4c4ffa61ae26 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/fbdev/ffb.c | |||
diff --git a/drivers/video/fm2fb.c b/drivers/video/fbdev/fm2fb.c index e69d47af9932..e69d47af9932 100644 --- a/drivers/video/fm2fb.c +++ b/drivers/video/fbdev/fm2fb.c | |||
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index e8758b9c3bcc..e8758b9c3bcc 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c | |||
diff --git a/drivers/video/g364fb.c b/drivers/video/fbdev/g364fb.c index 223896cc5f7d..223896cc5f7d 100644 --- a/drivers/video/g364fb.c +++ b/drivers/video/fbdev/g364fb.c | |||
diff --git a/drivers/video/gbefb.c b/drivers/video/fbdev/gbefb.c index 3ec65a878ac8..3ec65a878ac8 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/fbdev/gbefb.c | |||
diff --git a/drivers/video/geode/Kconfig b/drivers/video/fbdev/geode/Kconfig index 1e8555284786..1e8555284786 100644 --- a/drivers/video/geode/Kconfig +++ b/drivers/video/fbdev/geode/Kconfig | |||
diff --git a/drivers/video/geode/Makefile b/drivers/video/fbdev/geode/Makefile index 5c98da126883..5c98da126883 100644 --- a/drivers/video/geode/Makefile +++ b/drivers/video/fbdev/geode/Makefile | |||
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/fbdev/geode/display_gx.c index f0af911a096d..f0af911a096d 100644 --- a/drivers/video/geode/display_gx.c +++ b/drivers/video/fbdev/geode/display_gx.c | |||
diff --git a/drivers/video/geode/display_gx1.c b/drivers/video/fbdev/geode/display_gx1.c index 926d53eeb549..926d53eeb549 100644 --- a/drivers/video/geode/display_gx1.c +++ b/drivers/video/fbdev/geode/display_gx1.c | |||
diff --git a/drivers/video/geode/display_gx1.h b/drivers/video/fbdev/geode/display_gx1.h index 671c05558c79..671c05558c79 100644 --- a/drivers/video/geode/display_gx1.h +++ b/drivers/video/fbdev/geode/display_gx1.h | |||
diff --git a/drivers/video/geode/geodefb.h b/drivers/video/fbdev/geode/geodefb.h index ae04820e0c57..ae04820e0c57 100644 --- a/drivers/video/geode/geodefb.h +++ b/drivers/video/fbdev/geode/geodefb.h | |||
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/fbdev/geode/gx1fb_core.c index 2794ba11f332..2794ba11f332 100644 --- a/drivers/video/geode/gx1fb_core.c +++ b/drivers/video/fbdev/geode/gx1fb_core.c | |||
diff --git a/drivers/video/geode/gxfb.h b/drivers/video/fbdev/geode/gxfb.h index d19e9378b0c0..d19e9378b0c0 100644 --- a/drivers/video/geode/gxfb.h +++ b/drivers/video/fbdev/geode/gxfb.h | |||
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/fbdev/geode/gxfb_core.c index 1790f14bab15..1790f14bab15 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/fbdev/geode/gxfb_core.c | |||
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/fbdev/geode/lxfb.h index cfcd8090f313..cfcd8090f313 100644 --- a/drivers/video/geode/lxfb.h +++ b/drivers/video/fbdev/geode/lxfb.h | |||
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/fbdev/geode/lxfb_core.c index 9e1d19d673a1..9e1d19d673a1 100644 --- a/drivers/video/geode/lxfb_core.c +++ b/drivers/video/fbdev/geode/lxfb_core.c | |||
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/fbdev/geode/lxfb_ops.c index 79e9abc72b83..79e9abc72b83 100644 --- a/drivers/video/geode/lxfb_ops.c +++ b/drivers/video/fbdev/geode/lxfb_ops.c | |||
diff --git a/drivers/video/geode/suspend_gx.c b/drivers/video/fbdev/geode/suspend_gx.c index 1bb043d70c64..1bb043d70c64 100644 --- a/drivers/video/geode/suspend_gx.c +++ b/drivers/video/fbdev/geode/suspend_gx.c | |||
diff --git a/drivers/video/geode/video_cs5530.c b/drivers/video/fbdev/geode/video_cs5530.c index 649c3943d431..649c3943d431 100644 --- a/drivers/video/geode/video_cs5530.c +++ b/drivers/video/fbdev/geode/video_cs5530.c | |||
diff --git a/drivers/video/geode/video_cs5530.h b/drivers/video/fbdev/geode/video_cs5530.h index 56cecca7f1ce..56cecca7f1ce 100644 --- a/drivers/video/geode/video_cs5530.h +++ b/drivers/video/fbdev/geode/video_cs5530.h | |||
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/fbdev/geode/video_gx.c index 6082f653c68a..6082f653c68a 100644 --- a/drivers/video/geode/video_gx.c +++ b/drivers/video/fbdev/geode/video_gx.c | |||
diff --git a/drivers/video/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c index 7f6c9e6cfc6c..7f6c9e6cfc6c 100644 --- a/drivers/video/goldfishfb.c +++ b/drivers/video/fbdev/goldfishfb.c | |||
diff --git a/drivers/video/grvga.c b/drivers/video/fbdev/grvga.c index c078701f15f6..c078701f15f6 100644 --- a/drivers/video/grvga.c +++ b/drivers/video/fbdev/grvga.c | |||
diff --git a/drivers/video/gxt4500.c b/drivers/video/fbdev/gxt4500.c index 135d78a02588..135d78a02588 100644 --- a/drivers/video/gxt4500.c +++ b/drivers/video/fbdev/gxt4500.c | |||
diff --git a/drivers/video/hecubafb.c b/drivers/video/fbdev/hecubafb.c index f64120ec9192..f64120ec9192 100644 --- a/drivers/video/hecubafb.c +++ b/drivers/video/fbdev/hecubafb.c | |||
diff --git a/drivers/video/hgafb.c b/drivers/video/fbdev/hgafb.c index 5ff9fe2116a4..5ff9fe2116a4 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/fbdev/hgafb.c | |||
diff --git a/drivers/video/hitfb.c b/drivers/video/fbdev/hitfb.c index a648d5186c6e..a648d5186c6e 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/fbdev/hitfb.c | |||
diff --git a/drivers/video/hpfb.c b/drivers/video/fbdev/hpfb.c index a1b7e5fa9b09..a1b7e5fa9b09 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/fbdev/hpfb.c | |||
diff --git a/drivers/video/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index e23392ec5af3..e23392ec5af3 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c | |||
diff --git a/drivers/video/i740_reg.h b/drivers/video/fbdev/i740_reg.h index 91bac76549d7..91bac76549d7 100644 --- a/drivers/video/i740_reg.h +++ b/drivers/video/fbdev/i740_reg.h | |||
diff --git a/drivers/video/i740fb.c b/drivers/video/fbdev/i740fb.c index ca7c9df193b0..ca7c9df193b0 100644 --- a/drivers/video/i740fb.c +++ b/drivers/video/fbdev/i740fb.c | |||
diff --git a/drivers/video/i810/Makefile b/drivers/video/fbdev/i810/Makefile index 96e08c8ded97..96e08c8ded97 100644 --- a/drivers/video/i810/Makefile +++ b/drivers/video/fbdev/i810/Makefile | |||
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/fbdev/i810/i810-i2c.c index 7db17d0d8a8c..7db17d0d8a8c 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/fbdev/i810/i810-i2c.c | |||
diff --git a/drivers/video/i810/i810.h b/drivers/video/fbdev/i810/i810.h index 1414b73ac55b..1414b73ac55b 100644 --- a/drivers/video/i810/i810.h +++ b/drivers/video/fbdev/i810/i810.h | |||
diff --git a/drivers/video/i810/i810_accel.c b/drivers/video/fbdev/i810/i810_accel.c index 7672d2ea9b35..7672d2ea9b35 100644 --- a/drivers/video/i810/i810_accel.c +++ b/drivers/video/fbdev/i810/i810_accel.c | |||
diff --git a/drivers/video/i810/i810_dvt.c b/drivers/video/fbdev/i810/i810_dvt.c index b4b3670667ab..b4b3670667ab 100644 --- a/drivers/video/i810/i810_dvt.c +++ b/drivers/video/fbdev/i810/i810_dvt.c | |||
diff --git a/drivers/video/i810/i810_gtf.c b/drivers/video/fbdev/i810/i810_gtf.c index 9743d51e7f8c..9743d51e7f8c 100644 --- a/drivers/video/i810/i810_gtf.c +++ b/drivers/video/fbdev/i810/i810_gtf.c | |||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/fbdev/i810/i810_main.c index bb674e431741..bb674e431741 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/fbdev/i810/i810_main.c | |||
diff --git a/drivers/video/i810/i810_main.h b/drivers/video/fbdev/i810/i810_main.h index a25afaa534ba..a25afaa534ba 100644 --- a/drivers/video/i810/i810_main.h +++ b/drivers/video/fbdev/i810/i810_main.h | |||
diff --git a/drivers/video/i810/i810_regs.h b/drivers/video/fbdev/i810/i810_regs.h index 91c6bd9d0d0d..91c6bd9d0d0d 100644 --- a/drivers/video/i810/i810_regs.h +++ b/drivers/video/fbdev/i810/i810_regs.h | |||
diff --git a/drivers/video/igafb.c b/drivers/video/fbdev/igafb.c index 486f18897414..486f18897414 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/fbdev/igafb.c | |||
diff --git a/drivers/video/imsttfb.c b/drivers/video/fbdev/imsttfb.c index aae10ce74f14..aae10ce74f14 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c | |||
diff --git a/drivers/video/imxfb.c b/drivers/video/fbdev/imxfb.c index f6e621684953..f6e621684953 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/fbdev/imxfb.c | |||
diff --git a/drivers/video/intelfb/Makefile b/drivers/video/fbdev/intelfb/Makefile index f7d631ebee8e..f7d631ebee8e 100644 --- a/drivers/video/intelfb/Makefile +++ b/drivers/video/fbdev/intelfb/Makefile | |||
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/fbdev/intelfb/intelfb.h index 6b51175629c7..6b51175629c7 100644 --- a/drivers/video/intelfb/intelfb.h +++ b/drivers/video/fbdev/intelfb/intelfb.h | |||
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/fbdev/intelfb/intelfb_i2c.c index 3300bd31d9d7..3300bd31d9d7 100644 --- a/drivers/video/intelfb/intelfb_i2c.c +++ b/drivers/video/fbdev/intelfb/intelfb_i2c.c | |||
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c index b847d530471a..b847d530471a 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/fbdev/intelfb/intelfbdrv.c | |||
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c index fbad61da359f..fbad61da359f 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/fbdev/intelfb/intelfbhw.c | |||
diff --git a/drivers/video/intelfb/intelfbhw.h b/drivers/video/fbdev/intelfb/intelfbhw.h index 216ca20f259f..216ca20f259f 100644 --- a/drivers/video/intelfb/intelfbhw.h +++ b/drivers/video/fbdev/intelfb/intelfbhw.h | |||
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/fbdev/jz4740_fb.c index 87790e9644d0..87790e9644d0 100644 --- a/drivers/video/jz4740_fb.c +++ b/drivers/video/fbdev/jz4740_fb.c | |||
diff --git a/drivers/video/kyro/Makefile b/drivers/video/fbdev/kyro/Makefile index 2fd66f551bae..2fd66f551bae 100644 --- a/drivers/video/kyro/Makefile +++ b/drivers/video/fbdev/kyro/Makefile | |||
diff --git a/drivers/video/kyro/STG4000InitDevice.c b/drivers/video/fbdev/kyro/STG4000InitDevice.c index 1d3f2080aa6f..1d3f2080aa6f 100644 --- a/drivers/video/kyro/STG4000InitDevice.c +++ b/drivers/video/fbdev/kyro/STG4000InitDevice.c | |||
diff --git a/drivers/video/kyro/STG4000Interface.h b/drivers/video/fbdev/kyro/STG4000Interface.h index b7c83d5dfb13..b7c83d5dfb13 100644 --- a/drivers/video/kyro/STG4000Interface.h +++ b/drivers/video/fbdev/kyro/STG4000Interface.h | |||
diff --git a/drivers/video/kyro/STG4000OverlayDevice.c b/drivers/video/fbdev/kyro/STG4000OverlayDevice.c index 0aeeaa10708b..0aeeaa10708b 100644 --- a/drivers/video/kyro/STG4000OverlayDevice.c +++ b/drivers/video/fbdev/kyro/STG4000OverlayDevice.c | |||
diff --git a/drivers/video/kyro/STG4000Ramdac.c b/drivers/video/fbdev/kyro/STG4000Ramdac.c index e6ad037e4396..e6ad037e4396 100644 --- a/drivers/video/kyro/STG4000Ramdac.c +++ b/drivers/video/fbdev/kyro/STG4000Ramdac.c | |||
diff --git a/drivers/video/kyro/STG4000Reg.h b/drivers/video/fbdev/kyro/STG4000Reg.h index 50f4670e9252..50f4670e9252 100644 --- a/drivers/video/kyro/STG4000Reg.h +++ b/drivers/video/fbdev/kyro/STG4000Reg.h | |||
diff --git a/drivers/video/kyro/STG4000VTG.c b/drivers/video/fbdev/kyro/STG4000VTG.c index bd389709d234..bd389709d234 100644 --- a/drivers/video/kyro/STG4000VTG.c +++ b/drivers/video/fbdev/kyro/STG4000VTG.c | |||
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c index 65041e15fd59..65041e15fd59 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/fbdev/kyro/fbdev.c | |||
diff --git a/drivers/video/leo.c b/drivers/video/fbdev/leo.c index 2c7f7d479fe2..2c7f7d479fe2 100644 --- a/drivers/video/leo.c +++ b/drivers/video/fbdev/leo.c | |||
diff --git a/drivers/video/macfb.c b/drivers/video/fbdev/macfb.c index cda7587cbc86..cda7587cbc86 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/fbdev/macfb.c | |||
diff --git a/drivers/video/macmodes.c b/drivers/video/fbdev/macmodes.c index af86c081d2be..af86c081d2be 100644 --- a/drivers/video/macmodes.c +++ b/drivers/video/fbdev/macmodes.c | |||
diff --git a/drivers/video/macmodes.h b/drivers/video/fbdev/macmodes.h index b86ba08aac9e..b86ba08aac9e 100644 --- a/drivers/video/macmodes.h +++ b/drivers/video/fbdev/macmodes.h | |||
diff --git a/drivers/video/matrox/Makefile b/drivers/video/fbdev/matrox/Makefile index f9c00ebe2530..f9c00ebe2530 100644 --- a/drivers/video/matrox/Makefile +++ b/drivers/video/fbdev/matrox/Makefile | |||
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/fbdev/matrox/g450_pll.c index c15f8a57498e..c15f8a57498e 100644 --- a/drivers/video/matrox/g450_pll.c +++ b/drivers/video/fbdev/matrox/g450_pll.c | |||
diff --git a/drivers/video/matrox/g450_pll.h b/drivers/video/fbdev/matrox/g450_pll.h index aac615d18440..aac615d18440 100644 --- a/drivers/video/matrox/g450_pll.h +++ b/drivers/video/fbdev/matrox/g450_pll.h | |||
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/fbdev/matrox/i2c-matroxfb.c index 0fb280ead3dc..0fb280ead3dc 100644 --- a/drivers/video/matrox/i2c-matroxfb.c +++ b/drivers/video/fbdev/matrox/i2c-matroxfb.c | |||
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/fbdev/matrox/matroxfb_DAC1064.c index a01147fdf270..a01147fdf270 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/fbdev/matrox/matroxfb_DAC1064.c | |||
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/fbdev/matrox/matroxfb_DAC1064.h index 1e6e45b57b78..1e6e45b57b78 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.h +++ b/drivers/video/fbdev/matrox/matroxfb_DAC1064.h | |||
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c index 195ad7cac1ba..195ad7cac1ba 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/fbdev/matrox/matroxfb_Ti3026.c | |||
diff --git a/drivers/video/matrox/matroxfb_Ti3026.h b/drivers/video/fbdev/matrox/matroxfb_Ti3026.h index 27872aaa0a17..27872aaa0a17 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.h +++ b/drivers/video/fbdev/matrox/matroxfb_Ti3026.h | |||
diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/fbdev/matrox/matroxfb_accel.c index 0d5cb85d071a..0d5cb85d071a 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/fbdev/matrox/matroxfb_accel.c | |||
diff --git a/drivers/video/matrox/matroxfb_accel.h b/drivers/video/fbdev/matrox/matroxfb_accel.h index 1e418e62c22d..1e418e62c22d 100644 --- a/drivers/video/matrox/matroxfb_accel.h +++ b/drivers/video/fbdev/matrox/matroxfb_accel.h | |||
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c index 7116c5309c7d..7116c5309c7d 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/fbdev/matrox/matroxfb_base.c | |||
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/fbdev/matrox/matroxfb_base.h index 556d96ce40bf..556d96ce40bf 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/fbdev/matrox/matroxfb_base.h | |||
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/fbdev/matrox/matroxfb_crtc2.c index 02796a4317a9..02796a4317a9 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.c | |||
diff --git a/drivers/video/matrox/matroxfb_crtc2.h b/drivers/video/fbdev/matrox/matroxfb_crtc2.h index 1005582e843e..1005582e843e 100644 --- a/drivers/video/matrox/matroxfb_crtc2.h +++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.h | |||
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/fbdev/matrox/matroxfb_g450.c index cff0546ea6fd..cff0546ea6fd 100644 --- a/drivers/video/matrox/matroxfb_g450.c +++ b/drivers/video/fbdev/matrox/matroxfb_g450.c | |||
diff --git a/drivers/video/matrox/matroxfb_g450.h b/drivers/video/fbdev/matrox/matroxfb_g450.h index 3a3e654444b8..3a3e654444b8 100644 --- a/drivers/video/matrox/matroxfb_g450.h +++ b/drivers/video/fbdev/matrox/matroxfb_g450.h | |||
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c index ee41a0f276b2..ee41a0f276b2 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/fbdev/matrox/matroxfb_maven.c | |||
diff --git a/drivers/video/matrox/matroxfb_maven.h b/drivers/video/fbdev/matrox/matroxfb_maven.h index 99eddec9f30c..99eddec9f30c 100644 --- a/drivers/video/matrox/matroxfb_maven.h +++ b/drivers/video/fbdev/matrox/matroxfb_maven.h | |||
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/fbdev/matrox/matroxfb_misc.c index 9948ca2a3046..9948ca2a3046 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/fbdev/matrox/matroxfb_misc.c | |||
diff --git a/drivers/video/matrox/matroxfb_misc.h b/drivers/video/fbdev/matrox/matroxfb_misc.h index 351c823f1f74..351c823f1f74 100644 --- a/drivers/video/matrox/matroxfb_misc.h +++ b/drivers/video/fbdev/matrox/matroxfb_misc.h | |||
diff --git a/drivers/video/maxinefb.c b/drivers/video/fbdev/maxinefb.c index 5cf52d3c8e75..5cf52d3c8e75 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/fbdev/maxinefb.c | |||
diff --git a/drivers/video/mb862xx/Makefile b/drivers/video/fbdev/mb862xx/Makefile index 5707ed0e31a7..5707ed0e31a7 100644 --- a/drivers/video/mb862xx/Makefile +++ b/drivers/video/fbdev/mb862xx/Makefile | |||
diff --git a/drivers/video/mb862xx/mb862xx-i2c.c b/drivers/video/fbdev/mb862xx/mb862xx-i2c.c index c87e17afb3e2..c87e17afb3e2 100644 --- a/drivers/video/mb862xx/mb862xx-i2c.c +++ b/drivers/video/fbdev/mb862xx/mb862xx-i2c.c | |||
diff --git a/drivers/video/mb862xx/mb862xx_reg.h b/drivers/video/fbdev/mb862xx/mb862xx_reg.h index 9df48b8edc94..9df48b8edc94 100644 --- a/drivers/video/mb862xx/mb862xx_reg.h +++ b/drivers/video/fbdev/mb862xx/mb862xx_reg.h | |||
diff --git a/drivers/video/mb862xx/mb862xxfb.h b/drivers/video/fbdev/mb862xx/mb862xxfb.h index 8550630c1e01..8550630c1e01 100644 --- a/drivers/video/mb862xx/mb862xxfb.h +++ b/drivers/video/fbdev/mb862xx/mb862xxfb.h | |||
diff --git a/drivers/video/mb862xx/mb862xxfb_accel.c b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c index fe92eed6da70..fe92eed6da70 100644 --- a/drivers/video/mb862xx/mb862xxfb_accel.c +++ b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c | |||
diff --git a/drivers/video/mb862xx/mb862xxfb_accel.h b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.h index 96a2dfef0f60..96a2dfef0f60 100644 --- a/drivers/video/mb862xx/mb862xxfb_accel.h +++ b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.h | |||
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c index 0cd4c3318511..0cd4c3318511 100644 --- a/drivers/video/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | |||
diff --git a/drivers/video/mbx/Makefile b/drivers/video/fbdev/mbx/Makefile index 16c1165cf9c7..16c1165cf9c7 100644 --- a/drivers/video/mbx/Makefile +++ b/drivers/video/fbdev/mbx/Makefile | |||
diff --git a/drivers/video/mbx/mbxdebugfs.c b/drivers/video/fbdev/mbx/mbxdebugfs.c index 4449f249b0e7..4449f249b0e7 100644 --- a/drivers/video/mbx/mbxdebugfs.c +++ b/drivers/video/fbdev/mbx/mbxdebugfs.c | |||
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c index f0a5392f5fd3..f0a5392f5fd3 100644 --- a/drivers/video/mbx/mbxfb.c +++ b/drivers/video/fbdev/mbx/mbxfb.c | |||
diff --git a/drivers/video/mbx/reg_bits.h b/drivers/video/fbdev/mbx/reg_bits.h index 5f14b4befd71..5f14b4befd71 100644 --- a/drivers/video/mbx/reg_bits.h +++ b/drivers/video/fbdev/mbx/reg_bits.h | |||
diff --git a/drivers/video/mbx/regs.h b/drivers/video/fbdev/mbx/regs.h index 063099d48839..063099d48839 100644 --- a/drivers/video/mbx/regs.h +++ b/drivers/video/fbdev/mbx/regs.h | |||
diff --git a/drivers/video/metronomefb.c b/drivers/video/fbdev/metronomefb.c index 195cc2db4c2c..195cc2db4c2c 100644 --- a/drivers/video/metronomefb.c +++ b/drivers/video/fbdev/metronomefb.c | |||
diff --git a/drivers/video/mmp/Kconfig b/drivers/video/fbdev/mmp/Kconfig index e9ea39e13722..d4a4ffc24749 100644 --- a/drivers/video/mmp/Kconfig +++ b/drivers/video/fbdev/mmp/Kconfig | |||
@@ -5,7 +5,7 @@ menuconfig MMP_DISP | |||
5 | Marvell Display Subsystem support. | 5 | Marvell Display Subsystem support. |
6 | 6 | ||
7 | if MMP_DISP | 7 | if MMP_DISP |
8 | source "drivers/video/mmp/hw/Kconfig" | 8 | source "drivers/video/fbdev/mmp/hw/Kconfig" |
9 | source "drivers/video/mmp/panel/Kconfig" | 9 | source "drivers/video/fbdev/mmp/panel/Kconfig" |
10 | source "drivers/video/mmp/fb/Kconfig" | 10 | source "drivers/video/fbdev/mmp/fb/Kconfig" |
11 | endif | 11 | endif |
diff --git a/drivers/video/mmp/Makefile b/drivers/video/fbdev/mmp/Makefile index a014cb358bf8..a014cb358bf8 100644 --- a/drivers/video/mmp/Makefile +++ b/drivers/video/fbdev/mmp/Makefile | |||
diff --git a/drivers/video/mmp/core.c b/drivers/video/fbdev/mmp/core.c index b563b920f159..b563b920f159 100644 --- a/drivers/video/mmp/core.c +++ b/drivers/video/fbdev/mmp/core.c | |||
diff --git a/drivers/video/mmp/fb/Kconfig b/drivers/video/fbdev/mmp/fb/Kconfig index 9b0141f105f5..9b0141f105f5 100644 --- a/drivers/video/mmp/fb/Kconfig +++ b/drivers/video/fbdev/mmp/fb/Kconfig | |||
diff --git a/drivers/video/mmp/fb/Makefile b/drivers/video/fbdev/mmp/fb/Makefile index 709fd1f76abe..709fd1f76abe 100644 --- a/drivers/video/mmp/fb/Makefile +++ b/drivers/video/fbdev/mmp/fb/Makefile | |||
diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c index 7ab31eb76a8c..7ab31eb76a8c 100644 --- a/drivers/video/mmp/fb/mmpfb.c +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c | |||
diff --git a/drivers/video/mmp/fb/mmpfb.h b/drivers/video/fbdev/mmp/fb/mmpfb.h index 88c23c10a9ec..88c23c10a9ec 100644 --- a/drivers/video/mmp/fb/mmpfb.h +++ b/drivers/video/fbdev/mmp/fb/mmpfb.h | |||
diff --git a/drivers/video/mmp/hw/Kconfig b/drivers/video/fbdev/mmp/hw/Kconfig index 02f109a20cd0..02f109a20cd0 100644 --- a/drivers/video/mmp/hw/Kconfig +++ b/drivers/video/fbdev/mmp/hw/Kconfig | |||
diff --git a/drivers/video/mmp/hw/Makefile b/drivers/video/fbdev/mmp/hw/Makefile index 0000a714fedf..0000a714fedf 100644 --- a/drivers/video/mmp/hw/Makefile +++ b/drivers/video/fbdev/mmp/hw/Makefile | |||
diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index 8621a9f2bdcc..8621a9f2bdcc 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c | |||
diff --git a/drivers/video/mmp/hw/mmp_ctrl.h b/drivers/video/fbdev/mmp/hw/mmp_ctrl.h index 53301cfdb1ae..53301cfdb1ae 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.h +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.h | |||
diff --git a/drivers/video/mmp/hw/mmp_spi.c b/drivers/video/fbdev/mmp/hw/mmp_spi.c index e62ca7bf0d5e..e62ca7bf0d5e 100644 --- a/drivers/video/mmp/hw/mmp_spi.c +++ b/drivers/video/fbdev/mmp/hw/mmp_spi.c | |||
diff --git a/drivers/video/mmp/panel/Kconfig b/drivers/video/fbdev/mmp/panel/Kconfig index 4b2c4f457b11..4b2c4f457b11 100644 --- a/drivers/video/mmp/panel/Kconfig +++ b/drivers/video/fbdev/mmp/panel/Kconfig | |||
diff --git a/drivers/video/mmp/panel/Makefile b/drivers/video/fbdev/mmp/panel/Makefile index 2f91611c7e5e..2f91611c7e5e 100644 --- a/drivers/video/mmp/panel/Makefile +++ b/drivers/video/fbdev/mmp/panel/Makefile | |||
diff --git a/drivers/video/mmp/panel/tpo_tj032md01bw.c b/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c index 998978b08f5e..998978b08f5e 100644 --- a/drivers/video/mmp/panel/tpo_tj032md01bw.c +++ b/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c | |||
diff --git a/drivers/video/msm/Makefile b/drivers/video/fbdev/msm/Makefile index 802d6ae523fb..802d6ae523fb 100644 --- a/drivers/video/msm/Makefile +++ b/drivers/video/fbdev/msm/Makefile | |||
diff --git a/drivers/video/msm/mddi.c b/drivers/video/fbdev/msm/mddi.c index e0f8011a3c4b..e0f8011a3c4b 100644 --- a/drivers/video/msm/mddi.c +++ b/drivers/video/fbdev/msm/mddi.c | |||
diff --git a/drivers/video/msm/mddi_client_dummy.c b/drivers/video/fbdev/msm/mddi_client_dummy.c index f1b0dfcc9717..f1b0dfcc9717 100644 --- a/drivers/video/msm/mddi_client_dummy.c +++ b/drivers/video/fbdev/msm/mddi_client_dummy.c | |||
diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/fbdev/msm/mddi_client_nt35399.c index f96df32e5509..f96df32e5509 100644 --- a/drivers/video/msm/mddi_client_nt35399.c +++ b/drivers/video/fbdev/msm/mddi_client_nt35399.c | |||
diff --git a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/fbdev/msm/mddi_client_toshiba.c index 061d7dfebbf3..061d7dfebbf3 100644 --- a/drivers/video/msm/mddi_client_toshiba.c +++ b/drivers/video/fbdev/msm/mddi_client_toshiba.c | |||
diff --git a/drivers/video/msm/mddi_hw.h b/drivers/video/fbdev/msm/mddi_hw.h index 45cc01fc1e7f..45cc01fc1e7f 100644 --- a/drivers/video/msm/mddi_hw.h +++ b/drivers/video/fbdev/msm/mddi_hw.h | |||
diff --git a/drivers/video/msm/mdp.c b/drivers/video/fbdev/msm/mdp.c index 113c7876c855..113c7876c855 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/fbdev/msm/mdp.c | |||
diff --git a/drivers/video/msm/mdp_csc_table.h b/drivers/video/fbdev/msm/mdp_csc_table.h index d1cde30ead52..d1cde30ead52 100644 --- a/drivers/video/msm/mdp_csc_table.h +++ b/drivers/video/fbdev/msm/mdp_csc_table.h | |||
diff --git a/drivers/video/msm/mdp_hw.h b/drivers/video/fbdev/msm/mdp_hw.h index 35848d741001..35848d741001 100644 --- a/drivers/video/msm/mdp_hw.h +++ b/drivers/video/fbdev/msm/mdp_hw.h | |||
diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/fbdev/msm/mdp_ppp.c index be6079cdfbb6..be6079cdfbb6 100644 --- a/drivers/video/msm/mdp_ppp.c +++ b/drivers/video/fbdev/msm/mdp_ppp.c | |||
diff --git a/drivers/video/msm/mdp_scale_tables.c b/drivers/video/fbdev/msm/mdp_scale_tables.c index 604783b2e17c..604783b2e17c 100644 --- a/drivers/video/msm/mdp_scale_tables.c +++ b/drivers/video/fbdev/msm/mdp_scale_tables.c | |||
diff --git a/drivers/video/msm/mdp_scale_tables.h b/drivers/video/fbdev/msm/mdp_scale_tables.h index 34077b1af603..34077b1af603 100644 --- a/drivers/video/msm/mdp_scale_tables.h +++ b/drivers/video/fbdev/msm/mdp_scale_tables.h | |||
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/fbdev/msm/msm_fb.c index 1374803fbcd9..1374803fbcd9 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/fbdev/msm/msm_fb.c | |||
diff --git a/drivers/video/mx3fb.c b/drivers/video/fbdev/mx3fb.c index 142e860fb527..142e860fb527 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/fbdev/mx3fb.c | |||
diff --git a/drivers/video/mxsfb.c b/drivers/video/fbdev/mxsfb.c index accf48a2cce4..accf48a2cce4 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/fbdev/mxsfb.c | |||
diff --git a/drivers/video/n411.c b/drivers/video/fbdev/n411.c index 935830fea7b6..935830fea7b6 100644 --- a/drivers/video/n411.c +++ b/drivers/video/fbdev/n411.c | |||
diff --git a/drivers/video/neofb.c b/drivers/video/fbdev/neofb.c index 44f99a60bb9b..44f99a60bb9b 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/fbdev/neofb.c | |||
diff --git a/drivers/video/nuc900fb.c b/drivers/video/fbdev/nuc900fb.c index 478f9808dee4..478f9808dee4 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/fbdev/nuc900fb.c | |||
diff --git a/drivers/video/nuc900fb.h b/drivers/video/fbdev/nuc900fb.h index 9a1ca6dbb6b2..9a1ca6dbb6b2 100644 --- a/drivers/video/nuc900fb.h +++ b/drivers/video/fbdev/nuc900fb.h | |||
diff --git a/drivers/video/nvidia/Makefile b/drivers/video/fbdev/nvidia/Makefile index ca47432113e0..ca47432113e0 100644 --- a/drivers/video/nvidia/Makefile +++ b/drivers/video/fbdev/nvidia/Makefile | |||
diff --git a/drivers/video/nvidia/nv_accel.c b/drivers/video/fbdev/nvidia/nv_accel.c index ad6472a894ea..ad6472a894ea 100644 --- a/drivers/video/nvidia/nv_accel.c +++ b/drivers/video/fbdev/nvidia/nv_accel.c | |||
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c index 8471008aa6ff..8471008aa6ff 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/fbdev/nvidia/nv_backlight.c | |||
diff --git a/drivers/video/nvidia/nv_dma.h b/drivers/video/fbdev/nvidia/nv_dma.h index a7ed1c0acbbb..a7ed1c0acbbb 100644 --- a/drivers/video/nvidia/nv_dma.h +++ b/drivers/video/fbdev/nvidia/nv_dma.h | |||
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/fbdev/nvidia/nv_hw.c index 81c80ac3c76f..81c80ac3c76f 100644 --- a/drivers/video/nvidia/nv_hw.c +++ b/drivers/video/fbdev/nvidia/nv_hw.c | |||
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/fbdev/nvidia/nv_i2c.c index d7994a173245..d7994a173245 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/fbdev/nvidia/nv_i2c.c | |||
diff --git a/drivers/video/nvidia/nv_local.h b/drivers/video/fbdev/nvidia/nv_local.h index 68e508daa417..68e508daa417 100644 --- a/drivers/video/nvidia/nv_local.h +++ b/drivers/video/fbdev/nvidia/nv_local.h | |||
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/fbdev/nvidia/nv_of.c index 3bc13df4b120..3bc13df4b120 100644 --- a/drivers/video/nvidia/nv_of.c +++ b/drivers/video/fbdev/nvidia/nv_of.c | |||
diff --git a/drivers/video/nvidia/nv_proto.h b/drivers/video/fbdev/nvidia/nv_proto.h index ff5c410355ea..ff5c410355ea 100644 --- a/drivers/video/nvidia/nv_proto.h +++ b/drivers/video/fbdev/nvidia/nv_proto.h | |||
diff --git a/drivers/video/nvidia/nv_setup.c b/drivers/video/fbdev/nvidia/nv_setup.c index 2f2e162134fa..2f2e162134fa 100644 --- a/drivers/video/nvidia/nv_setup.c +++ b/drivers/video/fbdev/nvidia/nv_setup.c | |||
diff --git a/drivers/video/nvidia/nv_type.h b/drivers/video/fbdev/nvidia/nv_type.h index c03f7f55c76d..c03f7f55c76d 100644 --- a/drivers/video/nvidia/nv_type.h +++ b/drivers/video/fbdev/nvidia/nv_type.h | |||
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c index def041204676..def041204676 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/fbdev/nvidia/nvidia.c | |||
diff --git a/drivers/video/ocfb.c b/drivers/video/fbdev/ocfb.c index 7f9dc9bec309..7f9dc9bec309 100644 --- a/drivers/video/ocfb.c +++ b/drivers/video/fbdev/ocfb.c | |||
diff --git a/drivers/video/offb.c b/drivers/video/fbdev/offb.c index 7d44d669d5b6..7d44d669d5b6 100644 --- a/drivers/video/offb.c +++ b/drivers/video/fbdev/offb.c | |||
diff --git a/drivers/video/omap/Kconfig b/drivers/video/fbdev/omap/Kconfig index 0bc3a936ce2b..0bc3a936ce2b 100644 --- a/drivers/video/omap/Kconfig +++ b/drivers/video/fbdev/omap/Kconfig | |||
diff --git a/drivers/video/omap/Makefile b/drivers/video/fbdev/omap/Makefile index 1927faffb5bc..1927faffb5bc 100644 --- a/drivers/video/omap/Makefile +++ b/drivers/video/fbdev/omap/Makefile | |||
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/fbdev/omap/hwa742.c index a4ee65b8f918..a4ee65b8f918 100644 --- a/drivers/video/omap/hwa742.c +++ b/drivers/video/fbdev/omap/hwa742.c | |||
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/fbdev/omap/lcd_ams_delta.c index 4a5f2cd3d3bf..4a5f2cd3d3bf 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/fbdev/omap/lcd_ams_delta.c | |||
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/fbdev/omap/lcd_h3.c index 49bdeca81e50..49bdeca81e50 100644 --- a/drivers/video/omap/lcd_h3.c +++ b/drivers/video/fbdev/omap/lcd_h3.c | |||
diff --git a/drivers/video/omap/lcd_htcherald.c b/drivers/video/fbdev/omap/lcd_htcherald.c index 20f477851d54..20f477851d54 100644 --- a/drivers/video/omap/lcd_htcherald.c +++ b/drivers/video/fbdev/omap/lcd_htcherald.c | |||
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/fbdev/omap/lcd_inn1510.c index 2ee423279e35..2ee423279e35 100644 --- a/drivers/video/omap/lcd_inn1510.c +++ b/drivers/video/fbdev/omap/lcd_inn1510.c | |||
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/fbdev/omap/lcd_inn1610.c index e3d3d135aa48..e3d3d135aa48 100644 --- a/drivers/video/omap/lcd_inn1610.c +++ b/drivers/video/fbdev/omap/lcd_inn1610.c | |||
diff --git a/drivers/video/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c index 803fee618d57..803fee618d57 100644 --- a/drivers/video/omap/lcd_mipid.c +++ b/drivers/video/fbdev/omap/lcd_mipid.c | |||
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/fbdev/omap/lcd_osk.c index 7fbe04bce0ed..7fbe04bce0ed 100644 --- a/drivers/video/omap/lcd_osk.c +++ b/drivers/video/fbdev/omap/lcd_osk.c | |||
diff --git a/drivers/video/omap/lcd_palmte.c b/drivers/video/fbdev/omap/lcd_palmte.c index ff4fb624b904..ff4fb624b904 100644 --- a/drivers/video/omap/lcd_palmte.c +++ b/drivers/video/fbdev/omap/lcd_palmte.c | |||
diff --git a/drivers/video/omap/lcd_palmtt.c b/drivers/video/fbdev/omap/lcd_palmtt.c index aaf3c8ba1243..aaf3c8ba1243 100644 --- a/drivers/video/omap/lcd_palmtt.c +++ b/drivers/video/fbdev/omap/lcd_palmtt.c | |||
diff --git a/drivers/video/omap/lcd_palmz71.c b/drivers/video/fbdev/omap/lcd_palmz71.c index 3b7d8aa1cf34..3b7d8aa1cf34 100644 --- a/drivers/video/omap/lcd_palmz71.c +++ b/drivers/video/fbdev/omap/lcd_palmz71.c | |||
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/fbdev/omap/lcdc.c index b52f62595f65..b52f62595f65 100644 --- a/drivers/video/omap/lcdc.c +++ b/drivers/video/fbdev/omap/lcdc.c | |||
diff --git a/drivers/video/omap/lcdc.h b/drivers/video/fbdev/omap/lcdc.h index 845222270db3..845222270db3 100644 --- a/drivers/video/omap/lcdc.h +++ b/drivers/video/fbdev/omap/lcdc.h | |||
diff --git a/drivers/video/omap/omapfb.h b/drivers/video/fbdev/omap/omapfb.h index 2921d20e4fba..2921d20e4fba 100644 --- a/drivers/video/omap/omapfb.h +++ b/drivers/video/fbdev/omap/omapfb.h | |||
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index e4fc6d9b5371..e4fc6d9b5371 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c | |||
diff --git a/drivers/video/omap/sossi.c b/drivers/video/fbdev/omap/sossi.c index d4e7684e7045..d4e7684e7045 100644 --- a/drivers/video/omap/sossi.c +++ b/drivers/video/fbdev/omap/sossi.c | |||
diff --git a/drivers/video/fbdev/omap2/Kconfig b/drivers/video/fbdev/omap2/Kconfig new file mode 100644 index 000000000000..c22955d2de9a --- /dev/null +++ b/drivers/video/fbdev/omap2/Kconfig | |||
@@ -0,0 +1,10 @@ | |||
1 | config OMAP2_VRFB | ||
2 | bool | ||
3 | |||
4 | if ARCH_OMAP2PLUS | ||
5 | |||
6 | source "drivers/video/fbdev/omap2/dss/Kconfig" | ||
7 | source "drivers/video/fbdev/omap2/omapfb/Kconfig" | ||
8 | source "drivers/video/fbdev/omap2/displays-new/Kconfig" | ||
9 | |||
10 | endif | ||
diff --git a/drivers/video/omap2/Makefile b/drivers/video/fbdev/omap2/Makefile index bf8127df8c71..bf8127df8c71 100644 --- a/drivers/video/omap2/Makefile +++ b/drivers/video/fbdev/omap2/Makefile | |||
diff --git a/drivers/video/omap2/displays-new/Kconfig b/drivers/video/fbdev/omap2/displays-new/Kconfig index e6cfc38160d3..e6cfc38160d3 100644 --- a/drivers/video/omap2/displays-new/Kconfig +++ b/drivers/video/fbdev/omap2/displays-new/Kconfig | |||
diff --git a/drivers/video/omap2/displays-new/Makefile b/drivers/video/fbdev/omap2/displays-new/Makefile index 0323a8a1c682..0323a8a1c682 100644 --- a/drivers/video/omap2/displays-new/Makefile +++ b/drivers/video/fbdev/omap2/displays-new/Makefile | |||
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c index 5ee3b5505f7f..5ee3b5505f7f 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c | |||
diff --git a/drivers/video/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c index 74de2bc50c4f..74de2bc50c4f 100644 --- a/drivers/video/omap2/displays-new/connector-dvi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c | |||
diff --git a/drivers/video/omap2/displays-new/connector-hdmi.c b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c index 29ed21b9dce5..29ed21b9dce5 100644 --- a/drivers/video/omap2/displays-new/connector-hdmi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c | |||
diff --git a/drivers/video/omap2/displays-new/encoder-tfp410.c b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c index b4e9a42a79e6..b4e9a42a79e6 100644 --- a/drivers/video/omap2/displays-new/encoder-tfp410.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c | |||
diff --git a/drivers/video/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c index 7e33686171e3..7e33686171e3 100644 --- a/drivers/video/omap2/displays-new/encoder-tpd12s015.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c index 5f8f7e7c81ef..5f8f7e7c81ef 100644 --- a/drivers/video/omap2/displays-new/panel-dpi.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c index d6f14e8717e8..d6f14e8717e8 100644 --- a/drivers/video/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c index 2e6b513222d9..2e6b513222d9 100644 --- a/drivers/video/omap2/displays-new/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c index 996fa004b48c..996fa004b48c 100644 --- a/drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c index b2f710be565d..b2f710be565d 100644 --- a/drivers/video/omap2/displays-new/panel-sharp-ls037v7dw01.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c index c7ba4d8b928a..c7ba4d8b928a 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c index fae6adc005a7..fae6adc005a7 100644 --- a/drivers/video/omap2/displays-new/panel-tpo-td028ttec1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c | |||
diff --git a/drivers/video/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c index 875b40263b33..875b40263b33 100644 --- a/drivers/video/omap2/displays-new/panel-tpo-td043mtea1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c | |||
diff --git a/drivers/video/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig index dde4281663b1..dde4281663b1 100644 --- a/drivers/video/omap2/dss/Kconfig +++ b/drivers/video/fbdev/omap2/dss/Kconfig | |||
diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/fbdev/omap2/dss/Makefile index 8aec8bda27cc..8aec8bda27cc 100644 --- a/drivers/video/omap2/dss/Makefile +++ b/drivers/video/fbdev/omap2/dss/Makefile | |||
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/fbdev/omap2/dss/apply.c index 0a0b084ce65d..0a0b084ce65d 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/fbdev/omap2/dss/apply.c | |||
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/fbdev/omap2/dss/core.c index ffa45c894cd4..ffa45c894cd4 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/fbdev/omap2/dss/core.c | |||
diff --git a/drivers/video/omap2/dss/dispc-compat.c b/drivers/video/fbdev/omap2/dss/dispc-compat.c index 83779c2b292a..83779c2b292a 100644 --- a/drivers/video/omap2/dss/dispc-compat.c +++ b/drivers/video/fbdev/omap2/dss/dispc-compat.c | |||
diff --git a/drivers/video/omap2/dss/dispc-compat.h b/drivers/video/fbdev/omap2/dss/dispc-compat.h index 14a69b3d4fb0..14a69b3d4fb0 100644 --- a/drivers/video/omap2/dss/dispc-compat.h +++ b/drivers/video/fbdev/omap2/dss/dispc-compat.h | |||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 2bbdb7ff7daf..f18397c33e8f 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c | |||
@@ -101,6 +101,8 @@ static struct { | |||
101 | void __iomem *base; | 101 | void __iomem *base; |
102 | 102 | ||
103 | int irq; | 103 | int irq; |
104 | irq_handler_t user_handler; | ||
105 | void *user_data; | ||
104 | 106 | ||
105 | unsigned long core_clk_rate; | 107 | unsigned long core_clk_rate; |
106 | unsigned long tv_pclk_rate; | 108 | unsigned long tv_pclk_rate; |
@@ -113,6 +115,8 @@ static struct { | |||
113 | u32 ctx[DISPC_SZ_REGS / sizeof(u32)]; | 115 | u32 ctx[DISPC_SZ_REGS / sizeof(u32)]; |
114 | 116 | ||
115 | const struct dispc_features *feat; | 117 | const struct dispc_features *feat; |
118 | |||
119 | bool is_enabled; | ||
116 | } dispc; | 120 | } dispc; |
117 | 121 | ||
118 | enum omap_color_component { | 122 | enum omap_color_component { |
@@ -141,12 +145,18 @@ enum mgr_reg_fields { | |||
141 | DISPC_MGR_FLD_NUM, | 145 | DISPC_MGR_FLD_NUM, |
142 | }; | 146 | }; |
143 | 147 | ||
148 | struct dispc_reg_field { | ||
149 | u16 reg; | ||
150 | u8 high; | ||
151 | u8 low; | ||
152 | }; | ||
153 | |||
144 | static const struct { | 154 | static const struct { |
145 | const char *name; | 155 | const char *name; |
146 | u32 vsync_irq; | 156 | u32 vsync_irq; |
147 | u32 framedone_irq; | 157 | u32 framedone_irq; |
148 | u32 sync_lost_irq; | 158 | u32 sync_lost_irq; |
149 | struct reg_field reg_desc[DISPC_MGR_FLD_NUM]; | 159 | struct dispc_reg_field reg_desc[DISPC_MGR_FLD_NUM]; |
150 | } mgr_desc[] = { | 160 | } mgr_desc[] = { |
151 | [OMAP_DSS_CHANNEL_LCD] = { | 161 | [OMAP_DSS_CHANNEL_LCD] = { |
152 | .name = "LCD", | 162 | .name = "LCD", |
@@ -238,13 +248,13 @@ static inline u32 dispc_read_reg(const u16 idx) | |||
238 | 248 | ||
239 | static u32 mgr_fld_read(enum omap_channel channel, enum mgr_reg_fields regfld) | 249 | static u32 mgr_fld_read(enum omap_channel channel, enum mgr_reg_fields regfld) |
240 | { | 250 | { |
241 | const struct reg_field rfld = mgr_desc[channel].reg_desc[regfld]; | 251 | const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld]; |
242 | return REG_GET(rfld.reg, rfld.high, rfld.low); | 252 | return REG_GET(rfld.reg, rfld.high, rfld.low); |
243 | } | 253 | } |
244 | 254 | ||
245 | static void mgr_fld_write(enum omap_channel channel, | 255 | static void mgr_fld_write(enum omap_channel channel, |
246 | enum mgr_reg_fields regfld, int val) { | 256 | enum mgr_reg_fields regfld, int val) { |
247 | const struct reg_field rfld = mgr_desc[channel].reg_desc[regfld]; | 257 | const struct dispc_reg_field rfld = mgr_desc[channel].reg_desc[regfld]; |
248 | REG_FLD_MOD(rfld.reg, val, rfld.high, rfld.low); | 258 | REG_FLD_MOD(rfld.reg, val, rfld.high, rfld.low); |
249 | } | 259 | } |
250 | 260 | ||
@@ -3669,16 +3679,44 @@ static int __init dispc_init_features(struct platform_device *pdev) | |||
3669 | return 0; | 3679 | return 0; |
3670 | } | 3680 | } |
3671 | 3681 | ||
3682 | static irqreturn_t dispc_irq_handler(int irq, void *arg) | ||
3683 | { | ||
3684 | if (!dispc.is_enabled) | ||
3685 | return IRQ_NONE; | ||
3686 | |||
3687 | return dispc.user_handler(irq, dispc.user_data); | ||
3688 | } | ||
3689 | |||
3672 | int dispc_request_irq(irq_handler_t handler, void *dev_id) | 3690 | int dispc_request_irq(irq_handler_t handler, void *dev_id) |
3673 | { | 3691 | { |
3674 | return devm_request_irq(&dispc.pdev->dev, dispc.irq, handler, | 3692 | int r; |
3675 | IRQF_SHARED, "OMAP DISPC", dev_id); | 3693 | |
3694 | if (dispc.user_handler != NULL) | ||
3695 | return -EBUSY; | ||
3696 | |||
3697 | dispc.user_handler = handler; | ||
3698 | dispc.user_data = dev_id; | ||
3699 | |||
3700 | /* ensure the dispc_irq_handler sees the values above */ | ||
3701 | smp_wmb(); | ||
3702 | |||
3703 | r = devm_request_irq(&dispc.pdev->dev, dispc.irq, dispc_irq_handler, | ||
3704 | IRQF_SHARED, "OMAP DISPC", &dispc); | ||
3705 | if (r) { | ||
3706 | dispc.user_handler = NULL; | ||
3707 | dispc.user_data = NULL; | ||
3708 | } | ||
3709 | |||
3710 | return r; | ||
3676 | } | 3711 | } |
3677 | EXPORT_SYMBOL(dispc_request_irq); | 3712 | EXPORT_SYMBOL(dispc_request_irq); |
3678 | 3713 | ||
3679 | void dispc_free_irq(void *dev_id) | 3714 | void dispc_free_irq(void *dev_id) |
3680 | { | 3715 | { |
3681 | devm_free_irq(&dispc.pdev->dev, dispc.irq, dev_id); | 3716 | devm_free_irq(&dispc.pdev->dev, dispc.irq, &dispc); |
3717 | |||
3718 | dispc.user_handler = NULL; | ||
3719 | dispc.user_data = NULL; | ||
3682 | } | 3720 | } |
3683 | EXPORT_SYMBOL(dispc_free_irq); | 3721 | EXPORT_SYMBOL(dispc_free_irq); |
3684 | 3722 | ||
@@ -3750,6 +3788,12 @@ static int __exit omap_dispchw_remove(struct platform_device *pdev) | |||
3750 | 3788 | ||
3751 | static int dispc_runtime_suspend(struct device *dev) | 3789 | static int dispc_runtime_suspend(struct device *dev) |
3752 | { | 3790 | { |
3791 | dispc.is_enabled = false; | ||
3792 | /* ensure the dispc_irq_handler sees the is_enabled value */ | ||
3793 | smp_wmb(); | ||
3794 | /* wait for current handler to finish before turning the DISPC off */ | ||
3795 | synchronize_irq(dispc.irq); | ||
3796 | |||
3753 | dispc_save_context(); | 3797 | dispc_save_context(); |
3754 | 3798 | ||
3755 | return 0; | 3799 | return 0; |
@@ -3763,12 +3807,15 @@ static int dispc_runtime_resume(struct device *dev) | |||
3763 | * _omap_dispc_initial_config(). We can thus use it to detect if | 3807 | * _omap_dispc_initial_config(). We can thus use it to detect if |
3764 | * we have lost register context. | 3808 | * we have lost register context. |
3765 | */ | 3809 | */ |
3766 | if (REG_GET(DISPC_CONFIG, 2, 1) == OMAP_DSS_LOAD_FRAME_ONLY) | 3810 | if (REG_GET(DISPC_CONFIG, 2, 1) != OMAP_DSS_LOAD_FRAME_ONLY) { |
3767 | return 0; | 3811 | _omap_dispc_initial_config(); |
3768 | 3812 | ||
3769 | _omap_dispc_initial_config(); | 3813 | dispc_restore_context(); |
3814 | } | ||
3770 | 3815 | ||
3771 | dispc_restore_context(); | 3816 | dispc.is_enabled = true; |
3817 | /* ensure the dispc_irq_handler sees the is_enabled value */ | ||
3818 | smp_wmb(); | ||
3772 | 3819 | ||
3773 | return 0; | 3820 | return 0; |
3774 | } | 3821 | } |
diff --git a/drivers/video/omap2/dss/dispc.h b/drivers/video/fbdev/omap2/dss/dispc.h index 78edb449c763..78edb449c763 100644 --- a/drivers/video/omap2/dss/dispc.h +++ b/drivers/video/fbdev/omap2/dss/dispc.h | |||
diff --git a/drivers/video/omap2/dss/dispc_coefs.c b/drivers/video/fbdev/omap2/dss/dispc_coefs.c index 038c15b04215..038c15b04215 100644 --- a/drivers/video/omap2/dss/dispc_coefs.c +++ b/drivers/video/fbdev/omap2/dss/dispc_coefs.c | |||
diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/fbdev/omap2/dss/display-sysfs.c index 5a2095a98ed8..5a2095a98ed8 100644 --- a/drivers/video/omap2/dss/display-sysfs.c +++ b/drivers/video/fbdev/omap2/dss/display-sysfs.c | |||
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/fbdev/omap2/dss/display.c index 2412a0dd0c13..2412a0dd0c13 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/fbdev/omap2/dss/display.c | |||
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c index 157921db447a..157921db447a 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/fbdev/omap2/dss/dpi.c | |||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c index 121d1049d0bc..8be9b04d8849 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/fbdev/omap2/dss/dsi.c | |||
@@ -297,6 +297,8 @@ struct dsi_data { | |||
297 | 297 | ||
298 | int irq; | 298 | int irq; |
299 | 299 | ||
300 | bool is_enabled; | ||
301 | |||
300 | struct clk *dss_clk; | 302 | struct clk *dss_clk; |
301 | struct clk *sys_clk; | 303 | struct clk *sys_clk; |
302 | 304 | ||
@@ -795,6 +797,9 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg) | |||
795 | dsidev = (struct platform_device *) arg; | 797 | dsidev = (struct platform_device *) arg; |
796 | dsi = dsi_get_dsidrv_data(dsidev); | 798 | dsi = dsi_get_dsidrv_data(dsidev); |
797 | 799 | ||
800 | if (!dsi->is_enabled) | ||
801 | return IRQ_NONE; | ||
802 | |||
798 | spin_lock(&dsi->irq_lock); | 803 | spin_lock(&dsi->irq_lock); |
799 | 804 | ||
800 | irqstatus = dsi_read_reg(dsidev, DSI_IRQSTATUS); | 805 | irqstatus = dsi_read_reg(dsidev, DSI_IRQSTATUS); |
@@ -5671,6 +5676,15 @@ static int __exit omap_dsihw_remove(struct platform_device *dsidev) | |||
5671 | 5676 | ||
5672 | static int dsi_runtime_suspend(struct device *dev) | 5677 | static int dsi_runtime_suspend(struct device *dev) |
5673 | { | 5678 | { |
5679 | struct platform_device *pdev = to_platform_device(dev); | ||
5680 | struct dsi_data *dsi = dsi_get_dsidrv_data(pdev); | ||
5681 | |||
5682 | dsi->is_enabled = false; | ||
5683 | /* ensure the irq handler sees the is_enabled value */ | ||
5684 | smp_wmb(); | ||
5685 | /* wait for current handler to finish before turning the DSI off */ | ||
5686 | synchronize_irq(dsi->irq); | ||
5687 | |||
5674 | dispc_runtime_put(); | 5688 | dispc_runtime_put(); |
5675 | 5689 | ||
5676 | return 0; | 5690 | return 0; |
@@ -5678,12 +5692,18 @@ static int dsi_runtime_suspend(struct device *dev) | |||
5678 | 5692 | ||
5679 | static int dsi_runtime_resume(struct device *dev) | 5693 | static int dsi_runtime_resume(struct device *dev) |
5680 | { | 5694 | { |
5695 | struct platform_device *pdev = to_platform_device(dev); | ||
5696 | struct dsi_data *dsi = dsi_get_dsidrv_data(pdev); | ||
5681 | int r; | 5697 | int r; |
5682 | 5698 | ||
5683 | r = dispc_runtime_get(); | 5699 | r = dispc_runtime_get(); |
5684 | if (r) | 5700 | if (r) |
5685 | return r; | 5701 | return r; |
5686 | 5702 | ||
5703 | dsi->is_enabled = true; | ||
5704 | /* ensure the irq handler sees the is_enabled value */ | ||
5705 | smp_wmb(); | ||
5706 | |||
5687 | return 0; | 5707 | return 0; |
5688 | } | 5708 | } |
5689 | 5709 | ||
diff --git a/drivers/video/omap2/dss/dss-of.c b/drivers/video/fbdev/omap2/dss/dss-of.c index a4b20aaf6142..a4b20aaf6142 100644 --- a/drivers/video/omap2/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/dss/dss-of.c | |||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c index 825c019ddee7..d55266c0e029 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/fbdev/omap2/dss/dss.c | |||
@@ -457,7 +457,7 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min, | |||
457 | fckd_stop = max(DIV_ROUND_UP(prate * m, fck_hw_max), 1ul); | 457 | fckd_stop = max(DIV_ROUND_UP(prate * m, fck_hw_max), 1ul); |
458 | 458 | ||
459 | for (fckd = fckd_start; fckd >= fckd_stop; --fckd) { | 459 | for (fckd = fckd_start; fckd >= fckd_stop; --fckd) { |
460 | fck = prate / fckd * m; | 460 | fck = DIV_ROUND_UP(prate, fckd) * m; |
461 | 461 | ||
462 | if (func(fck, data)) | 462 | if (func(fck, data)) |
463 | return true; | 463 | return true; |
@@ -506,7 +506,7 @@ static int dss_setup_default_clock(void) | |||
506 | 506 | ||
507 | fck_div = DIV_ROUND_UP(prate * dss.feat->dss_fck_multiplier, | 507 | fck_div = DIV_ROUND_UP(prate * dss.feat->dss_fck_multiplier, |
508 | max_dss_fck); | 508 | max_dss_fck); |
509 | fck = prate / fck_div * dss.feat->dss_fck_multiplier; | 509 | fck = DIV_ROUND_UP(prate, fck_div) * dss.feat->dss_fck_multiplier; |
510 | } | 510 | } |
511 | 511 | ||
512 | r = dss_set_fck_rate(fck); | 512 | r = dss_set_fck_rate(fck); |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/fbdev/omap2/dss/dss.h index 918fec182424..560078fcb198 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/fbdev/omap2/dss/dss.h | |||
@@ -131,12 +131,6 @@ struct dsi_clock_info { | |||
131 | u16 lp_clk_div; | 131 | u16 lp_clk_div; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | struct reg_field { | ||
135 | u16 reg; | ||
136 | u8 high; | ||
137 | u8 low; | ||
138 | }; | ||
139 | |||
140 | struct dss_lcd_mgr_config { | 134 | struct dss_lcd_mgr_config { |
141 | enum dss_io_pad_mode io_pad_mode; | 135 | enum dss_io_pad_mode io_pad_mode; |
142 | 136 | ||
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/fbdev/omap2/dss/dss_features.c index 7f8969191dc6..7f8969191dc6 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/fbdev/omap2/dss/dss_features.c | |||
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/fbdev/omap2/dss/dss_features.h index e3ef3b714896..e3ef3b714896 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/fbdev/omap2/dss/dss_features.h | |||
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index e25681ff5a70..e25681ff5a70 100644 --- a/drivers/video/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h | |||
diff --git a/drivers/video/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index f5f7944a1fd1..f5f7944a1fd1 100644 --- a/drivers/video/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c | |||
diff --git a/drivers/video/omap2/dss/hdmi4_core.c b/drivers/video/fbdev/omap2/dss/hdmi4_core.c index 2eb04dcf807c..2eb04dcf807c 100644 --- a/drivers/video/omap2/dss/hdmi4_core.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c | |||
diff --git a/drivers/video/omap2/dss/hdmi4_core.h b/drivers/video/fbdev/omap2/dss/hdmi4_core.h index bb646896fa82..bb646896fa82 100644 --- a/drivers/video/omap2/dss/hdmi4_core.h +++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h | |||
diff --git a/drivers/video/omap2/dss/hdmi_common.c b/drivers/video/fbdev/omap2/dss/hdmi_common.c index b11afac8e068..0b12a3f62fe1 100644 --- a/drivers/video/omap2/dss/hdmi_common.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_common.c | |||
@@ -347,17 +347,17 @@ int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts) | |||
347 | case 96000: | 347 | case 96000: |
348 | case 192000: | 348 | case 192000: |
349 | if (deep_color == 125) | 349 | if (deep_color == 125) |
350 | if (pclk == 27027 || pclk == 74250) | 350 | if (pclk == 27027000 || pclk == 74250000) |
351 | deep_color_correct = true; | 351 | deep_color_correct = true; |
352 | if (deep_color == 150) | 352 | if (deep_color == 150) |
353 | if (pclk == 27027) | 353 | if (pclk == 27027000) |
354 | deep_color_correct = true; | 354 | deep_color_correct = true; |
355 | break; | 355 | break; |
356 | case 44100: | 356 | case 44100: |
357 | case 88200: | 357 | case 88200: |
358 | case 176400: | 358 | case 176400: |
359 | if (deep_color == 125) | 359 | if (deep_color == 125) |
360 | if (pclk == 27027) | 360 | if (pclk == 27027000) |
361 | deep_color_correct = true; | 361 | deep_color_correct = true; |
362 | break; | 362 | break; |
363 | default: | 363 | default: |
@@ -418,7 +418,7 @@ int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts) | |||
418 | } | 418 | } |
419 | } | 419 | } |
420 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ | 420 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ |
421 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); | 421 | *cts = (pclk/1000) * (*n / 128) * deep_color / (sample_freq / 10); |
422 | 422 | ||
423 | return 0; | 423 | return 0; |
424 | } | 424 | } |
diff --git a/drivers/video/omap2/dss/hdmi_phy.c b/drivers/video/fbdev/omap2/dss/hdmi_phy.c index dd376ce8da01..dd376ce8da01 100644 --- a/drivers/video/omap2/dss/hdmi_phy.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_phy.c | |||
diff --git a/drivers/video/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c index 5fc71215c303..5fc71215c303 100644 --- a/drivers/video/omap2/dss/hdmi_pll.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c | |||
diff --git a/drivers/video/omap2/dss/hdmi_wp.c b/drivers/video/fbdev/omap2/dss/hdmi_wp.c index f5f4ccf50d90..f5f4ccf50d90 100644 --- a/drivers/video/omap2/dss/hdmi_wp.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c | |||
diff --git a/drivers/video/omap2/dss/manager-sysfs.c b/drivers/video/fbdev/omap2/dss/manager-sysfs.c index 37b59fe28dc8..37b59fe28dc8 100644 --- a/drivers/video/omap2/dss/manager-sysfs.c +++ b/drivers/video/fbdev/omap2/dss/manager-sysfs.c | |||
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/fbdev/omap2/dss/manager.c index 1aac9b4191a9..1aac9b4191a9 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/fbdev/omap2/dss/manager.c | |||
diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/fbdev/omap2/dss/output.c index 2ab3afa615e8..2ab3afa615e8 100644 --- a/drivers/video/omap2/dss/output.c +++ b/drivers/video/fbdev/omap2/dss/output.c | |||
diff --git a/drivers/video/omap2/dss/overlay-sysfs.c b/drivers/video/fbdev/omap2/dss/overlay-sysfs.c index 4cc5ddebfb34..4cc5ddebfb34 100644 --- a/drivers/video/omap2/dss/overlay-sysfs.c +++ b/drivers/video/fbdev/omap2/dss/overlay-sysfs.c | |||
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/fbdev/omap2/dss/overlay.c index 2f7cee985cdd..2f7cee985cdd 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/fbdev/omap2/dss/overlay.c | |||
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/fbdev/omap2/dss/rfbi.c index c8a81a2b879c..c8a81a2b879c 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/fbdev/omap2/dss/rfbi.c | |||
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c index 911dcc9173a6..911dcc9173a6 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/fbdev/omap2/dss/sdi.c | |||
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c index 21d81113962b..21d81113962b 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/fbdev/omap2/dss/venc.c | |||
diff --git a/drivers/video/omap2/dss/venc_panel.c b/drivers/video/fbdev/omap2/dss/venc_panel.c index af68cd444d7e..af68cd444d7e 100644 --- a/drivers/video/omap2/dss/venc_panel.c +++ b/drivers/video/fbdev/omap2/dss/venc_panel.c | |||
diff --git a/drivers/video/omap2/omapfb/Kconfig b/drivers/video/fbdev/omap2/omapfb/Kconfig index 4cb12ce68855..4cb12ce68855 100644 --- a/drivers/video/omap2/omapfb/Kconfig +++ b/drivers/video/fbdev/omap2/omapfb/Kconfig | |||
diff --git a/drivers/video/omap2/omapfb/Makefile b/drivers/video/fbdev/omap2/omapfb/Makefile index 51c2e00d9bf8..51c2e00d9bf8 100644 --- a/drivers/video/omap2/omapfb/Makefile +++ b/drivers/video/fbdev/omap2/omapfb/Makefile | |||
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c index 146b6f5428db..146b6f5428db 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c | |||
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c index ec2d132c782d..ec2d132c782d 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c | |||
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c index 18fa9e1d0033..18fa9e1d0033 100644 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c | |||
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/fbdev/omap2/omapfb/omapfb.h index 623cd872a367..623cd872a367 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/fbdev/omap2/omapfb/omapfb.h | |||
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/fbdev/omap2/vrfb.c index f346b02eee1d..f346b02eee1d 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/fbdev/omap2/vrfb.c | |||
diff --git a/drivers/video/p9100.c b/drivers/video/fbdev/p9100.c index 367cea8f43f3..367cea8f43f3 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/fbdev/p9100.c | |||
diff --git a/drivers/video/platinumfb.c b/drivers/video/fbdev/platinumfb.c index 4c9299576827..4c9299576827 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/fbdev/platinumfb.c | |||
diff --git a/drivers/video/platinumfb.h b/drivers/video/fbdev/platinumfb.h index f6bd77cafd17..f6bd77cafd17 100644 --- a/drivers/video/platinumfb.h +++ b/drivers/video/fbdev/platinumfb.h | |||
diff --git a/drivers/video/pm2fb.c b/drivers/video/fbdev/pm2fb.c index 3b85b647bc10..3b85b647bc10 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/fbdev/pm2fb.c | |||
diff --git a/drivers/video/pm3fb.c b/drivers/video/fbdev/pm3fb.c index 4bf3273d0433..4bf3273d0433 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/fbdev/pm3fb.c | |||
diff --git a/drivers/video/pmag-aa-fb.c b/drivers/video/fbdev/pmag-aa-fb.c index 838424817de2..838424817de2 100644 --- a/drivers/video/pmag-aa-fb.c +++ b/drivers/video/fbdev/pmag-aa-fb.c | |||
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/fbdev/pmag-ba-fb.c index 914a52ba8477..914a52ba8477 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/fbdev/pmag-ba-fb.c | |||
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/fbdev/pmagb-b-fb.c index 0822b6f8dddc..0822b6f8dddc 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/fbdev/pmagb-b-fb.c | |||
diff --git a/drivers/video/ps3fb.c b/drivers/video/fbdev/ps3fb.c index b269abd932aa..b269abd932aa 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/fbdev/ps3fb.c | |||
diff --git a/drivers/video/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index 167cffff3d4e..167cffff3d4e 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c | |||
diff --git a/drivers/video/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c index c95b9e46d48f..c95b9e46d48f 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/fbdev/pxa168fb.c | |||
diff --git a/drivers/video/pxa168fb.h b/drivers/video/fbdev/pxa168fb.h index eee09279c524..eee09279c524 100644 --- a/drivers/video/pxa168fb.h +++ b/drivers/video/fbdev/pxa168fb.h | |||
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 417f9a27eb7d..417f9a27eb7d 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c | |||
diff --git a/drivers/video/pxa3xx-gcu.h b/drivers/video/fbdev/pxa3xx-gcu.h index 0428ed03dc49..0428ed03dc49 100644 --- a/drivers/video/pxa3xx-gcu.h +++ b/drivers/video/fbdev/pxa3xx-gcu.h | |||
diff --git a/drivers/video/pxafb.c b/drivers/video/fbdev/pxafb.c index 1ecd9cec2921..1ecd9cec2921 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/fbdev/pxafb.c | |||
diff --git a/drivers/video/pxafb.h b/drivers/video/fbdev/pxafb.h index 26ba9fa3f737..26ba9fa3f737 100644 --- a/drivers/video/pxafb.h +++ b/drivers/video/fbdev/pxafb.h | |||
diff --git a/drivers/video/q40fb.c b/drivers/video/fbdev/q40fb.c index 7487f76f6275..7487f76f6275 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/fbdev/q40fb.c | |||
diff --git a/drivers/video/riva/Makefile b/drivers/video/fbdev/riva/Makefile index 8898c9915b02..8898c9915b02 100644 --- a/drivers/video/riva/Makefile +++ b/drivers/video/fbdev/riva/Makefile | |||
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c index 8a8d7f060784..8a8d7f060784 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/fbdev/riva/fbdev.c | |||
diff --git a/drivers/video/riva/nv_driver.c b/drivers/video/fbdev/riva/nv_driver.c index f3694cf17e58..f3694cf17e58 100644 --- a/drivers/video/riva/nv_driver.c +++ b/drivers/video/fbdev/riva/nv_driver.c | |||
diff --git a/drivers/video/riva/nv_type.h b/drivers/video/fbdev/riva/nv_type.h index a69480c9a67c..a69480c9a67c 100644 --- a/drivers/video/riva/nv_type.h +++ b/drivers/video/fbdev/riva/nv_type.h | |||
diff --git a/drivers/video/riva/nvreg.h b/drivers/video/fbdev/riva/nvreg.h index abfc167ae8d8..abfc167ae8d8 100644 --- a/drivers/video/riva/nvreg.h +++ b/drivers/video/fbdev/riva/nvreg.h | |||
diff --git a/drivers/video/riva/riva_hw.c b/drivers/video/fbdev/riva/riva_hw.c index 78fdbf5178d7..78fdbf5178d7 100644 --- a/drivers/video/riva/riva_hw.c +++ b/drivers/video/fbdev/riva/riva_hw.c | |||
diff --git a/drivers/video/riva/riva_hw.h b/drivers/video/fbdev/riva/riva_hw.h index c2769f73e0b2..c2769f73e0b2 100644 --- a/drivers/video/riva/riva_hw.h +++ b/drivers/video/fbdev/riva/riva_hw.h | |||
diff --git a/drivers/video/riva/riva_tbl.h b/drivers/video/fbdev/riva/riva_tbl.h index 7ee7d72932d4..7ee7d72932d4 100644 --- a/drivers/video/riva/riva_tbl.h +++ b/drivers/video/fbdev/riva/riva_tbl.h | |||
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/fbdev/riva/rivafb-i2c.c index 6a183375ced1..6a183375ced1 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/fbdev/riva/rivafb-i2c.c | |||
diff --git a/drivers/video/riva/rivafb.h b/drivers/video/fbdev/riva/rivafb.h index d9f107b704c6..d9f107b704c6 100644 --- a/drivers/video/riva/rivafb.h +++ b/drivers/video/fbdev/riva/rivafb.h | |||
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/fbdev/s1d13xxxfb.c index 83433cb0dfba..83433cb0dfba 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/fbdev/s1d13xxxfb.c | |||
diff --git a/drivers/video/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c index 62acae2694a9..62acae2694a9 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/fbdev/s3c-fb.c | |||
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c index 81af5a63e9e1..81af5a63e9e1 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/fbdev/s3c2410fb.c | |||
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/fbdev/s3c2410fb.h index 47a17bd23011..47a17bd23011 100644 --- a/drivers/video/s3c2410fb.h +++ b/drivers/video/fbdev/s3c2410fb.h | |||
diff --git a/drivers/video/s3fb.c b/drivers/video/fbdev/s3fb.c index 9a3f8f1c6aab..9a3f8f1c6aab 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/fbdev/s3fb.c | |||
diff --git a/drivers/video/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 580c444ec301..580c444ec301 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c | |||
diff --git a/drivers/video/sa1100fb.h b/drivers/video/fbdev/sa1100fb.h index fc5d4292fad6..fc5d4292fad6 100644 --- a/drivers/video/sa1100fb.h +++ b/drivers/video/fbdev/sa1100fb.h | |||
diff --git a/drivers/video/savage/Makefile b/drivers/video/fbdev/savage/Makefile index e09770fff8ea..e09770fff8ea 100644 --- a/drivers/video/savage/Makefile +++ b/drivers/video/fbdev/savage/Makefile | |||
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/fbdev/savage/savagefb-i2c.c index 80fa87e2ae2f..80fa87e2ae2f 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/fbdev/savage/savagefb-i2c.c | |||
diff --git a/drivers/video/savage/savagefb.h b/drivers/video/fbdev/savage/savagefb.h index dcaab9012ca2..dcaab9012ca2 100644 --- a/drivers/video/savage/savagefb.h +++ b/drivers/video/fbdev/savage/savagefb.h | |||
diff --git a/drivers/video/savage/savagefb_accel.c b/drivers/video/fbdev/savage/savagefb_accel.c index bfefa6234cf0..bfefa6234cf0 100644 --- a/drivers/video/savage/savagefb_accel.c +++ b/drivers/video/fbdev/savage/savagefb_accel.c | |||
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c index 4dbf45f3b21a..4dbf45f3b21a 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/fbdev/savage/savagefb_driver.c | |||
diff --git a/drivers/video/sbuslib.c b/drivers/video/fbdev/sbuslib.c index a350209ffbd3..a350209ffbd3 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/fbdev/sbuslib.c | |||
diff --git a/drivers/video/sbuslib.h b/drivers/video/fbdev/sbuslib.h index 7ba3250236bd..7ba3250236bd 100644 --- a/drivers/video/sbuslib.h +++ b/drivers/video/fbdev/sbuslib.h | |||
diff --git a/drivers/video/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index 1265b25f9f99..1265b25f9f99 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c | |||
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/fbdev/sh_mipi_dsi.c index 8f6e8ff620d4..8f6e8ff620d4 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/fbdev/sh_mipi_dsi.c | |||
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c index 9a33ee0413fb..9a33ee0413fb 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/fbdev/sh_mobile_hdmi.c | |||
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 2bcc84ac18c7..2bcc84ac18c7 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c | |||
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/fbdev/sh_mobile_lcdcfb.h index f839adef1d90..f839adef1d90 100644 --- a/drivers/video/sh_mobile_lcdcfb.h +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.h | |||
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c index a297de5cc859..a297de5cc859 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/fbdev/sh_mobile_meram.c | |||
diff --git a/drivers/video/simplefb.c b/drivers/video/fbdev/simplefb.c index 210f3a02121a..210f3a02121a 100644 --- a/drivers/video/simplefb.c +++ b/drivers/video/fbdev/simplefb.c | |||
diff --git a/drivers/video/sis/300vtbl.h b/drivers/video/fbdev/sis/300vtbl.h index e4b4a2626da4..e4b4a2626da4 100644 --- a/drivers/video/sis/300vtbl.h +++ b/drivers/video/fbdev/sis/300vtbl.h | |||
diff --git a/drivers/video/sis/310vtbl.h b/drivers/video/fbdev/sis/310vtbl.h index 54fcbbf4ef63..54fcbbf4ef63 100644 --- a/drivers/video/sis/310vtbl.h +++ b/drivers/video/fbdev/sis/310vtbl.h | |||
diff --git a/drivers/video/sis/Makefile b/drivers/video/fbdev/sis/Makefile index f7c0046e5b1d..f7c0046e5b1d 100644 --- a/drivers/video/sis/Makefile +++ b/drivers/video/fbdev/sis/Makefile | |||
diff --git a/drivers/video/sis/init.c b/drivers/video/fbdev/sis/init.c index bd40f5ecd901..bd40f5ecd901 100644 --- a/drivers/video/sis/init.c +++ b/drivers/video/fbdev/sis/init.c | |||
diff --git a/drivers/video/sis/init.h b/drivers/video/fbdev/sis/init.h index 85d6738b6c64..85d6738b6c64 100644 --- a/drivers/video/sis/init.h +++ b/drivers/video/fbdev/sis/init.h | |||
diff --git a/drivers/video/sis/init301.c b/drivers/video/fbdev/sis/init301.c index a89e3cafd5ad..a89e3cafd5ad 100644 --- a/drivers/video/sis/init301.c +++ b/drivers/video/fbdev/sis/init301.c | |||
diff --git a/drivers/video/sis/init301.h b/drivers/video/fbdev/sis/init301.h index 2112d6d7feda..2112d6d7feda 100644 --- a/drivers/video/sis/init301.h +++ b/drivers/video/fbdev/sis/init301.h | |||
diff --git a/drivers/video/sis/initdef.h b/drivers/video/fbdev/sis/initdef.h index 264b55a5947b..264b55a5947b 100644 --- a/drivers/video/sis/initdef.h +++ b/drivers/video/fbdev/sis/initdef.h | |||
diff --git a/drivers/video/sis/initextlfb.c b/drivers/video/fbdev/sis/initextlfb.c index 3ab18f5a3759..3ab18f5a3759 100644 --- a/drivers/video/sis/initextlfb.c +++ b/drivers/video/fbdev/sis/initextlfb.c | |||
diff --git a/drivers/video/sis/oem300.h b/drivers/video/fbdev/sis/oem300.h index b73f26840143..b73f26840143 100644 --- a/drivers/video/sis/oem300.h +++ b/drivers/video/fbdev/sis/oem300.h | |||
diff --git a/drivers/video/sis/oem310.h b/drivers/video/fbdev/sis/oem310.h index 8fce56e4482c..8fce56e4482c 100644 --- a/drivers/video/sis/oem310.h +++ b/drivers/video/fbdev/sis/oem310.h | |||
diff --git a/drivers/video/sis/sis.h b/drivers/video/fbdev/sis/sis.h index 1987f1b7212f..1987f1b7212f 100644 --- a/drivers/video/sis/sis.h +++ b/drivers/video/fbdev/sis/sis.h | |||
diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/fbdev/sis/sis_accel.c index ceb434c95c0d..ceb434c95c0d 100644 --- a/drivers/video/sis/sis_accel.c +++ b/drivers/video/fbdev/sis/sis_accel.c | |||
diff --git a/drivers/video/sis/sis_accel.h b/drivers/video/fbdev/sis/sis_accel.h index 30e03cdf6b85..30e03cdf6b85 100644 --- a/drivers/video/sis/sis_accel.h +++ b/drivers/video/fbdev/sis/sis_accel.h | |||
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 22ad028bf123..22ad028bf123 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c | |||
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/fbdev/sis/sis_main.h index 32e23c209430..32e23c209430 100644 --- a/drivers/video/sis/sis_main.h +++ b/drivers/video/fbdev/sis/sis_main.h | |||
diff --git a/drivers/video/sis/vgatypes.h b/drivers/video/fbdev/sis/vgatypes.h index e3f9976cfef0..e3f9976cfef0 100644 --- a/drivers/video/sis/vgatypes.h +++ b/drivers/video/fbdev/sis/vgatypes.h | |||
diff --git a/drivers/video/sis/vstruct.h b/drivers/video/fbdev/sis/vstruct.h index ea94d214dcff..ea94d214dcff 100644 --- a/drivers/video/sis/vstruct.h +++ b/drivers/video/fbdev/sis/vstruct.h | |||
diff --git a/drivers/video/skeletonfb.c b/drivers/video/fbdev/skeletonfb.c index fefde7c6add7..fefde7c6add7 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/fbdev/skeletonfb.c | |||
diff --git a/drivers/video/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 1501979099dc..1501979099dc 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c | |||
diff --git a/drivers/video/smscufx.c b/drivers/video/fbdev/smscufx.c index d513ed6a49f2..d513ed6a49f2 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/fbdev/smscufx.c | |||
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index f4daa59f0a80..f4daa59f0a80 100644 --- a/drivers/video/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c | |||
diff --git a/drivers/video/sstfb.c b/drivers/video/fbdev/sstfb.c index f0cb279ef333..f0cb279ef333 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/fbdev/sstfb.c | |||
diff --git a/drivers/video/sticore.h b/drivers/video/fbdev/sticore.h index af1619536ac8..af1619536ac8 100644 --- a/drivers/video/sticore.h +++ b/drivers/video/fbdev/sticore.h | |||
diff --git a/drivers/video/stifb.c b/drivers/video/fbdev/stifb.c index cfe8a2f905c5..cfe8a2f905c5 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/fbdev/stifb.c | |||
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/fbdev/sunxvr1000.c index 58241b47a96d..58241b47a96d 100644 --- a/drivers/video/sunxvr1000.c +++ b/drivers/video/fbdev/sunxvr1000.c | |||
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/fbdev/sunxvr2500.c index 843b6bab0483..843b6bab0483 100644 --- a/drivers/video/sunxvr2500.c +++ b/drivers/video/fbdev/sunxvr2500.c | |||
diff --git a/drivers/video/sunxvr500.c b/drivers/video/fbdev/sunxvr500.c index 387350d004df..387350d004df 100644 --- a/drivers/video/sunxvr500.c +++ b/drivers/video/fbdev/sunxvr500.c | |||
diff --git a/drivers/video/tcx.c b/drivers/video/fbdev/tcx.c index 7fb2d696fac7..7fb2d696fac7 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/fbdev/tcx.c | |||
diff --git a/drivers/video/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index f761fe375f5b..f761fe375f5b 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c | |||
diff --git a/drivers/video/tgafb.c b/drivers/video/fbdev/tgafb.c index 65ba9921506e..65ba9921506e 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/fbdev/tgafb.c | |||
diff --git a/drivers/video/tmiofb.c b/drivers/video/fbdev/tmiofb.c index 7fb4e321a431..7fb4e321a431 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/fbdev/tmiofb.c | |||
diff --git a/drivers/video/tridentfb.c b/drivers/video/fbdev/tridentfb.c index 7ed9a227f5ea..7ed9a227f5ea 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/fbdev/tridentfb.c | |||
diff --git a/drivers/video/udlfb.c b/drivers/video/fbdev/udlfb.c index 77b890e4d296..77b890e4d296 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/fbdev/udlfb.c | |||
diff --git a/drivers/video/uvesafb.c b/drivers/video/fbdev/uvesafb.c index 509d452e8f91..509d452e8f91 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c | |||
diff --git a/drivers/video/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c index 97cb9bd1d1dd..97cb9bd1d1dd 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/fbdev/valkyriefb.c | |||
diff --git a/drivers/video/valkyriefb.h b/drivers/video/fbdev/valkyriefb.h index d787441e5a42..d787441e5a42 100644 --- a/drivers/video/valkyriefb.h +++ b/drivers/video/fbdev/valkyriefb.h | |||
diff --git a/drivers/video/vermilion/Makefile b/drivers/video/fbdev/vermilion/Makefile index cc21a656153d..cc21a656153d 100644 --- a/drivers/video/vermilion/Makefile +++ b/drivers/video/fbdev/vermilion/Makefile | |||
diff --git a/drivers/video/vermilion/cr_pll.c b/drivers/video/fbdev/vermilion/cr_pll.c index ebc6e6e0dd0f..ebc6e6e0dd0f 100644 --- a/drivers/video/vermilion/cr_pll.c +++ b/drivers/video/fbdev/vermilion/cr_pll.c | |||
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index 048a66640b03..048a66640b03 100644 --- a/drivers/video/vermilion/vermilion.c +++ b/drivers/video/fbdev/vermilion/vermilion.c | |||
diff --git a/drivers/video/vermilion/vermilion.h b/drivers/video/fbdev/vermilion/vermilion.h index 43d11ec197fc..43d11ec197fc 100644 --- a/drivers/video/vermilion/vermilion.h +++ b/drivers/video/fbdev/vermilion/vermilion.h | |||
diff --git a/drivers/video/vesafb.c b/drivers/video/fbdev/vesafb.c index 6170e7f58640..6170e7f58640 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/fbdev/vesafb.c | |||
diff --git a/drivers/video/vfb.c b/drivers/video/fbdev/vfb.c index 70a897b1e458..70a897b1e458 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/fbdev/vfb.c | |||
diff --git a/drivers/video/vga16fb.c b/drivers/video/fbdev/vga16fb.c index 283d335a759f..283d335a759f 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c | |||
diff --git a/drivers/video/via/Makefile b/drivers/video/fbdev/via/Makefile index 159f26e6adb5..159f26e6adb5 100644 --- a/drivers/video/via/Makefile +++ b/drivers/video/fbdev/via/Makefile | |||
diff --git a/drivers/video/via/accel.c b/drivers/video/fbdev/via/accel.c index 4b67b8e6030a..4b67b8e6030a 100644 --- a/drivers/video/via/accel.c +++ b/drivers/video/fbdev/via/accel.c | |||
diff --git a/drivers/video/via/accel.h b/drivers/video/fbdev/via/accel.h index 79d5e10cc835..79d5e10cc835 100644 --- a/drivers/video/via/accel.h +++ b/drivers/video/fbdev/via/accel.h | |||
diff --git a/drivers/video/via/chip.h b/drivers/video/fbdev/via/chip.h index d32a5076c20f..d32a5076c20f 100644 --- a/drivers/video/via/chip.h +++ b/drivers/video/fbdev/via/chip.h | |||
diff --git a/drivers/video/via/debug.h b/drivers/video/fbdev/via/debug.h index 86eacc2017f3..86eacc2017f3 100644 --- a/drivers/video/via/debug.h +++ b/drivers/video/fbdev/via/debug.h | |||
diff --git a/drivers/video/via/dvi.c b/drivers/video/fbdev/via/dvi.c index 7789553952d3..7789553952d3 100644 --- a/drivers/video/via/dvi.c +++ b/drivers/video/fbdev/via/dvi.c | |||
diff --git a/drivers/video/via/dvi.h b/drivers/video/fbdev/via/dvi.h index 4c6bfba57d11..4c6bfba57d11 100644 --- a/drivers/video/via/dvi.h +++ b/drivers/video/fbdev/via/dvi.h | |||
diff --git a/drivers/video/via/global.c b/drivers/video/fbdev/via/global.c index 3102171c1674..3102171c1674 100644 --- a/drivers/video/via/global.c +++ b/drivers/video/fbdev/via/global.c | |||
diff --git a/drivers/video/via/global.h b/drivers/video/fbdev/via/global.h index 275dbbbd6b81..275dbbbd6b81 100644 --- a/drivers/video/via/global.h +++ b/drivers/video/fbdev/via/global.h | |||
diff --git a/drivers/video/via/hw.c b/drivers/video/fbdev/via/hw.c index 22450908306c..22450908306c 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/fbdev/via/hw.c | |||
diff --git a/drivers/video/via/hw.h b/drivers/video/fbdev/via/hw.h index 3be073c58b03..3be073c58b03 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/fbdev/via/hw.h | |||
diff --git a/drivers/video/via/ioctl.c b/drivers/video/fbdev/via/ioctl.c index ea1c51428823..ea1c51428823 100644 --- a/drivers/video/via/ioctl.c +++ b/drivers/video/fbdev/via/ioctl.c | |||
diff --git a/drivers/video/via/ioctl.h b/drivers/video/fbdev/via/ioctl.h index 6010d10b59e8..6010d10b59e8 100644 --- a/drivers/video/via/ioctl.h +++ b/drivers/video/fbdev/via/ioctl.h | |||
diff --git a/drivers/video/via/lcd.c b/drivers/video/fbdev/via/lcd.c index 5d21ff436ec8..5d21ff436ec8 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/fbdev/via/lcd.c | |||
diff --git a/drivers/video/via/lcd.h b/drivers/video/fbdev/via/lcd.h index 5c988a063ad5..5c988a063ad5 100644 --- a/drivers/video/via/lcd.h +++ b/drivers/video/fbdev/via/lcd.h | |||
diff --git a/drivers/video/via/share.h b/drivers/video/fbdev/via/share.h index 65c65c611e0a..65c65c611e0a 100644 --- a/drivers/video/via/share.h +++ b/drivers/video/fbdev/via/share.h | |||
diff --git a/drivers/video/via/tblDPASetting.c b/drivers/video/fbdev/via/tblDPASetting.c index 73bb554e7c1e..73bb554e7c1e 100644 --- a/drivers/video/via/tblDPASetting.c +++ b/drivers/video/fbdev/via/tblDPASetting.c | |||
diff --git a/drivers/video/via/tblDPASetting.h b/drivers/video/fbdev/via/tblDPASetting.h index 6db61519cb5d..6db61519cb5d 100644 --- a/drivers/video/via/tblDPASetting.h +++ b/drivers/video/fbdev/via/tblDPASetting.h | |||
diff --git a/drivers/video/via/via-core.c b/drivers/video/fbdev/via/via-core.c index 6e274825fb31..6e274825fb31 100644 --- a/drivers/video/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c | |||
diff --git a/drivers/video/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c index e408679081ab..e408679081ab 100644 --- a/drivers/video/via/via-gpio.c +++ b/drivers/video/fbdev/via/via-gpio.c | |||
diff --git a/drivers/video/via/via_aux.c b/drivers/video/fbdev/via/via_aux.c index 4a0a55cdac3d..4a0a55cdac3d 100644 --- a/drivers/video/via/via_aux.c +++ b/drivers/video/fbdev/via/via_aux.c | |||
diff --git a/drivers/video/via/via_aux.h b/drivers/video/fbdev/via/via_aux.h index a8de3f038cea..a8de3f038cea 100644 --- a/drivers/video/via/via_aux.h +++ b/drivers/video/fbdev/via/via_aux.h | |||
diff --git a/drivers/video/via/via_aux_ch7301.c b/drivers/video/fbdev/via/via_aux_ch7301.c index 1cbe5037a6b0..1cbe5037a6b0 100644 --- a/drivers/video/via/via_aux_ch7301.c +++ b/drivers/video/fbdev/via/via_aux_ch7301.c | |||
diff --git a/drivers/video/via/via_aux_edid.c b/drivers/video/fbdev/via/via_aux_edid.c index 754d4509033f..754d4509033f 100644 --- a/drivers/video/via/via_aux_edid.c +++ b/drivers/video/fbdev/via/via_aux_edid.c | |||
diff --git a/drivers/video/via/via_aux_sii164.c b/drivers/video/fbdev/via/via_aux_sii164.c index ca1b35f033b1..ca1b35f033b1 100644 --- a/drivers/video/via/via_aux_sii164.c +++ b/drivers/video/fbdev/via/via_aux_sii164.c | |||
diff --git a/drivers/video/via/via_aux_vt1621.c b/drivers/video/fbdev/via/via_aux_vt1621.c index 38eca8479898..38eca8479898 100644 --- a/drivers/video/via/via_aux_vt1621.c +++ b/drivers/video/fbdev/via/via_aux_vt1621.c | |||
diff --git a/drivers/video/via/via_aux_vt1622.c b/drivers/video/fbdev/via/via_aux_vt1622.c index 8c79c68ba683..8c79c68ba683 100644 --- a/drivers/video/via/via_aux_vt1622.c +++ b/drivers/video/fbdev/via/via_aux_vt1622.c | |||
diff --git a/drivers/video/via/via_aux_vt1625.c b/drivers/video/fbdev/via/via_aux_vt1625.c index 03eb30165d36..03eb30165d36 100644 --- a/drivers/video/via/via_aux_vt1625.c +++ b/drivers/video/fbdev/via/via_aux_vt1625.c | |||
diff --git a/drivers/video/via/via_aux_vt1631.c b/drivers/video/fbdev/via/via_aux_vt1631.c index 06e742f1f723..06e742f1f723 100644 --- a/drivers/video/via/via_aux_vt1631.c +++ b/drivers/video/fbdev/via/via_aux_vt1631.c | |||
diff --git a/drivers/video/via/via_aux_vt1632.c b/drivers/video/fbdev/via/via_aux_vt1632.c index d24f4cd97401..d24f4cd97401 100644 --- a/drivers/video/via/via_aux_vt1632.c +++ b/drivers/video/fbdev/via/via_aux_vt1632.c | |||
diff --git a/drivers/video/via/via_aux_vt1636.c b/drivers/video/fbdev/via/via_aux_vt1636.c index 9e015c101d4d..9e015c101d4d 100644 --- a/drivers/video/via/via_aux_vt1636.c +++ b/drivers/video/fbdev/via/via_aux_vt1636.c | |||
diff --git a/drivers/video/via/via_clock.c b/drivers/video/fbdev/via/via_clock.c index db1e39277e32..db1e39277e32 100644 --- a/drivers/video/via/via_clock.c +++ b/drivers/video/fbdev/via/via_clock.c | |||
diff --git a/drivers/video/via/via_clock.h b/drivers/video/fbdev/via/via_clock.h index 88714ae0d157..88714ae0d157 100644 --- a/drivers/video/via/via_clock.h +++ b/drivers/video/fbdev/via/via_clock.h | |||
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/fbdev/via/via_i2c.c index dd53058bbbb7..dd53058bbbb7 100644 --- a/drivers/video/via/via_i2c.c +++ b/drivers/video/fbdev/via/via_i2c.c | |||
diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/fbdev/via/via_modesetting.c index 0b414b09b9b4..0b414b09b9b4 100644 --- a/drivers/video/via/via_modesetting.c +++ b/drivers/video/fbdev/via/via_modesetting.c | |||
diff --git a/drivers/video/via/via_modesetting.h b/drivers/video/fbdev/via/via_modesetting.h index f6a6503da3b3..f6a6503da3b3 100644 --- a/drivers/video/via/via_modesetting.h +++ b/drivers/video/fbdev/via/via_modesetting.h | |||
diff --git a/drivers/video/via/via_utility.c b/drivers/video/fbdev/via/via_utility.c index 35458a5eadc8..35458a5eadc8 100644 --- a/drivers/video/via/via_utility.c +++ b/drivers/video/fbdev/via/via_utility.c | |||
diff --git a/drivers/video/via/via_utility.h b/drivers/video/fbdev/via/via_utility.h index f23be1708c14..f23be1708c14 100644 --- a/drivers/video/via/via_utility.h +++ b/drivers/video/fbdev/via/via_utility.h | |||
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c index 325c43c6ff97..325c43c6ff97 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/fbdev/via/viafbdev.c | |||
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/fbdev/via/viafbdev.h index f6b2ddf56e94..f6b2ddf56e94 100644 --- a/drivers/video/via/viafbdev.h +++ b/drivers/video/fbdev/via/viafbdev.h | |||
diff --git a/drivers/video/via/viamode.c b/drivers/video/fbdev/via/viamode.c index 0666ab01cf4a..0666ab01cf4a 100644 --- a/drivers/video/via/viamode.c +++ b/drivers/video/fbdev/via/viamode.c | |||
diff --git a/drivers/video/via/viamode.h b/drivers/video/fbdev/via/viamode.h index dd19106698e7..dd19106698e7 100644 --- a/drivers/video/via/viamode.h +++ b/drivers/video/fbdev/via/viamode.h | |||
diff --git a/drivers/video/via/vt1636.c b/drivers/video/fbdev/via/vt1636.c index ee2903b472cf..ee2903b472cf 100644 --- a/drivers/video/via/vt1636.c +++ b/drivers/video/fbdev/via/vt1636.c | |||
diff --git a/drivers/video/via/vt1636.h b/drivers/video/fbdev/via/vt1636.h index 4c1314e57468..4c1314e57468 100644 --- a/drivers/video/via/vt1636.h +++ b/drivers/video/fbdev/via/vt1636.h | |||
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index a8f2b280f796..a8f2b280f796 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c | |||
diff --git a/drivers/video/vt8500lcdfb.h b/drivers/video/fbdev/vt8500lcdfb.h index 36ca3ca09d83..36ca3ca09d83 100644 --- a/drivers/video/vt8500lcdfb.h +++ b/drivers/video/fbdev/vt8500lcdfb.h | |||
diff --git a/drivers/video/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index 5c7cbc6c6236..5c7cbc6c6236 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c | |||
diff --git a/drivers/video/w100fb.c b/drivers/video/fbdev/w100fb.c index 10951c82f6ed..10951c82f6ed 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/fbdev/w100fb.c | |||
diff --git a/drivers/video/w100fb.h b/drivers/video/fbdev/w100fb.h index fffae7b4f6e9..fffae7b4f6e9 100644 --- a/drivers/video/w100fb.h +++ b/drivers/video/fbdev/w100fb.h | |||
diff --git a/drivers/video/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c index 537d199612af..537d199612af 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/fbdev/wm8505fb.c | |||
diff --git a/drivers/video/wm8505fb_regs.h b/drivers/video/fbdev/wm8505fb_regs.h index 4dd41668c6d1..4dd41668c6d1 100644 --- a/drivers/video/wm8505fb_regs.h +++ b/drivers/video/fbdev/wm8505fb_regs.h | |||
diff --git a/drivers/video/wmt_ge_rops.c b/drivers/video/fbdev/wmt_ge_rops.c index b0a9f34b2e01..9df6fe78a44b 100644 --- a/drivers/video/wmt_ge_rops.c +++ b/drivers/video/fbdev/wmt_ge_rops.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include "fb_draw.h" | 21 | #include "core/fb_draw.h" |
22 | 22 | ||
23 | #define GE_COMMAND_OFF 0x00 | 23 | #define GE_COMMAND_OFF 0x00 |
24 | #define GE_DEPTH_OFF 0x04 | 24 | #define GE_DEPTH_OFF 0x04 |
diff --git a/drivers/video/wmt_ge_rops.h b/drivers/video/fbdev/wmt_ge_rops.h index f73ec6377a46..f73ec6377a46 100644 --- a/drivers/video/wmt_ge_rops.h +++ b/drivers/video/fbdev/wmt_ge_rops.h | |||
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c index 901014bbc821..901014bbc821 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/fbdev/xen-fbfront.c | |||
diff --git a/drivers/video/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c index 553cff2f3f4c..553cff2f3f4c 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/fbdev/xilinxfb.c | |||
diff --git a/drivers/video/omap2/Kconfig b/drivers/video/omap2/Kconfig deleted file mode 100644 index 63b23f87081d..000000000000 --- a/drivers/video/omap2/Kconfig +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | config OMAP2_VRFB | ||
2 | bool | ||
3 | |||
4 | if ARCH_OMAP2PLUS | ||
5 | |||
6 | source "drivers/video/omap2/dss/Kconfig" | ||
7 | source "drivers/video/omap2/omapfb/Kconfig" | ||
8 | source "drivers/video/omap2/displays-new/Kconfig" | ||
9 | |||
10 | endif | ||
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c index 06990c6a1a69..61e706c0e00c 100644 --- a/drivers/vme/bridges/vme_tsi148.c +++ b/drivers/vme/bridges/vme_tsi148.c | |||
@@ -320,7 +320,7 @@ static int tsi148_irq_init(struct vme_bridge *tsi148_bridge) | |||
320 | struct pci_dev *pdev; | 320 | struct pci_dev *pdev; |
321 | struct tsi148_driver *bridge; | 321 | struct tsi148_driver *bridge; |
322 | 322 | ||
323 | pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev); | 323 | pdev = to_pci_dev(tsi148_bridge->parent); |
324 | 324 | ||
325 | bridge = tsi148_bridge->driver_priv; | 325 | bridge = tsi148_bridge->driver_priv; |
326 | 326 | ||
@@ -433,9 +433,7 @@ static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level, | |||
433 | iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO); | 433 | iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO); |
434 | 434 | ||
435 | if (sync != 0) { | 435 | if (sync != 0) { |
436 | pdev = container_of(tsi148_bridge->parent, | 436 | pdev = to_pci_dev(tsi148_bridge->parent); |
437 | struct pci_dev, dev); | ||
438 | |||
439 | synchronize_irq(pdev->irq); | 437 | synchronize_irq(pdev->irq); |
440 | } | 438 | } |
441 | } else { | 439 | } else { |
@@ -741,7 +739,7 @@ static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled, | |||
741 | reg_join(vme_bound_high, vme_bound_low, &vme_bound); | 739 | reg_join(vme_bound_high, vme_bound_low, &vme_bound); |
742 | reg_join(pci_offset_high, pci_offset_low, &pci_offset); | 740 | reg_join(pci_offset_high, pci_offset_low, &pci_offset); |
743 | 741 | ||
744 | *pci_base = (dma_addr_t)vme_base + pci_offset; | 742 | *pci_base = (dma_addr_t)(*vme_base + pci_offset); |
745 | 743 | ||
746 | *enabled = 0; | 744 | *enabled = 0; |
747 | *aspace = 0; | 745 | *aspace = 0; |
@@ -814,7 +812,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, | |||
814 | 812 | ||
815 | tsi148_bridge = image->parent; | 813 | tsi148_bridge = image->parent; |
816 | 814 | ||
817 | pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev); | 815 | pdev = to_pci_dev(tsi148_bridge->parent); |
818 | 816 | ||
819 | existing_size = (unsigned long long)(image->bus_resource.end - | 817 | existing_size = (unsigned long long)(image->bus_resource.end - |
820 | image->bus_resource.start); | 818 | image->bus_resource.start); |
@@ -910,11 +908,15 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled, | |||
910 | unsigned long long pci_bound, vme_offset, pci_base; | 908 | unsigned long long pci_bound, vme_offset, pci_base; |
911 | struct vme_bridge *tsi148_bridge; | 909 | struct vme_bridge *tsi148_bridge; |
912 | struct tsi148_driver *bridge; | 910 | struct tsi148_driver *bridge; |
911 | struct pci_bus_region region; | ||
912 | struct pci_dev *pdev; | ||
913 | 913 | ||
914 | tsi148_bridge = image->parent; | 914 | tsi148_bridge = image->parent; |
915 | 915 | ||
916 | bridge = tsi148_bridge->driver_priv; | 916 | bridge = tsi148_bridge->driver_priv; |
917 | 917 | ||
918 | pdev = to_pci_dev(tsi148_bridge->parent); | ||
919 | |||
918 | /* Verify input data */ | 920 | /* Verify input data */ |
919 | if (vme_base & 0xFFFF) { | 921 | if (vme_base & 0xFFFF) { |
920 | dev_err(tsi148_bridge->parent, "Invalid VME Window " | 922 | dev_err(tsi148_bridge->parent, "Invalid VME Window " |
@@ -949,7 +951,9 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled, | |||
949 | pci_bound = 0; | 951 | pci_bound = 0; |
950 | vme_offset = 0; | 952 | vme_offset = 0; |
951 | } else { | 953 | } else { |
952 | pci_base = (unsigned long long)image->bus_resource.start; | 954 | pcibios_resource_to_bus(pdev->bus, ®ion, |
955 | &image->bus_resource); | ||
956 | pci_base = region.start; | ||
953 | 957 | ||
954 | /* | 958 | /* |
955 | * Bound address is a valid address for the window, adjust | 959 | * Bound address is a valid address for the window, adjust |
@@ -2232,7 +2236,7 @@ static void *tsi148_alloc_consistent(struct device *parent, size_t size, | |||
2232 | struct pci_dev *pdev; | 2236 | struct pci_dev *pdev; |
2233 | 2237 | ||
2234 | /* Find pci_dev container of dev */ | 2238 | /* Find pci_dev container of dev */ |
2235 | pdev = container_of(parent, struct pci_dev, dev); | 2239 | pdev = to_pci_dev(parent); |
2236 | 2240 | ||
2237 | return pci_alloc_consistent(pdev, size, dma); | 2241 | return pci_alloc_consistent(pdev, size, dma); |
2238 | } | 2242 | } |
@@ -2243,7 +2247,7 @@ static void tsi148_free_consistent(struct device *parent, size_t size, | |||
2243 | struct pci_dev *pdev; | 2247 | struct pci_dev *pdev; |
2244 | 2248 | ||
2245 | /* Find pci_dev container of dev */ | 2249 | /* Find pci_dev container of dev */ |
2246 | pdev = container_of(parent, struct pci_dev, dev); | 2250 | pdev = to_pci_dev(parent); |
2247 | 2251 | ||
2248 | pci_free_consistent(pdev, size, vaddr, dma); | 2252 | pci_free_consistent(pdev, size, vaddr, dma); |
2249 | } | 2253 | } |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index b96f61b15dc6..ff52618cafbe 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -614,27 +614,11 @@ end: | |||
614 | return err; | 614 | return err; |
615 | } | 615 | } |
616 | 616 | ||
617 | /* | 617 | static int w1_family_notify(unsigned long action, struct w1_slave *sl) |
618 | * Handle sysfs file creation and removal here, before userspace is told that | ||
619 | * the device is added / removed from the system | ||
620 | */ | ||
621 | static int w1_bus_notify(struct notifier_block *nb, unsigned long action, | ||
622 | void *data) | ||
623 | { | 618 | { |
624 | struct device *dev = data; | ||
625 | struct w1_slave *sl; | ||
626 | struct w1_family_ops *fops; | 619 | struct w1_family_ops *fops; |
627 | int err; | 620 | int err; |
628 | 621 | ||
629 | /* | ||
630 | * Only care about slave devices at the moment. Yes, we should use a | ||
631 | * separate "type" for this, but for now, look at the release function | ||
632 | * to know which type it is... | ||
633 | */ | ||
634 | if (dev->release != w1_slave_release) | ||
635 | return 0; | ||
636 | |||
637 | sl = dev_to_w1_slave(dev); | ||
638 | fops = sl->family->fops; | 622 | fops = sl->family->fops; |
639 | 623 | ||
640 | if (!fops) | 624 | if (!fops) |
@@ -673,10 +657,6 @@ static int w1_bus_notify(struct notifier_block *nb, unsigned long action, | |||
673 | return 0; | 657 | return 0; |
674 | } | 658 | } |
675 | 659 | ||
676 | static struct notifier_block w1_bus_nb = { | ||
677 | .notifier_call = w1_bus_notify, | ||
678 | }; | ||
679 | |||
680 | static int __w1_attach_slave_device(struct w1_slave *sl) | 660 | static int __w1_attach_slave_device(struct w1_slave *sl) |
681 | { | 661 | { |
682 | int err; | 662 | int err; |
@@ -698,6 +678,9 @@ static int __w1_attach_slave_device(struct w1_slave *sl) | |||
698 | dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, | 678 | dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, |
699 | dev_name(&sl->dev), sl); | 679 | dev_name(&sl->dev), sl); |
700 | 680 | ||
681 | /* suppress for w1_family_notify before sending KOBJ_ADD */ | ||
682 | dev_set_uevent_suppress(&sl->dev, true); | ||
683 | |||
701 | err = device_register(&sl->dev); | 684 | err = device_register(&sl->dev); |
702 | if (err < 0) { | 685 | if (err < 0) { |
703 | dev_err(&sl->dev, | 686 | dev_err(&sl->dev, |
@@ -705,7 +688,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl) | |||
705 | dev_name(&sl->dev), err); | 688 | dev_name(&sl->dev), err); |
706 | return err; | 689 | return err; |
707 | } | 690 | } |
708 | 691 | w1_family_notify(BUS_NOTIFY_ADD_DEVICE, sl); | |
709 | 692 | ||
710 | dev_set_uevent_suppress(&sl->dev, false); | 693 | dev_set_uevent_suppress(&sl->dev, false); |
711 | kobject_uevent(&sl->dev.kobj, KOBJ_ADD); | 694 | kobject_uevent(&sl->dev.kobj, KOBJ_ADD); |
@@ -799,6 +782,7 @@ int w1_unref_slave(struct w1_slave *sl) | |||
799 | msg.type = W1_SLAVE_REMOVE; | 782 | msg.type = W1_SLAVE_REMOVE; |
800 | w1_netlink_send(sl->master, &msg); | 783 | w1_netlink_send(sl->master, &msg); |
801 | 784 | ||
785 | w1_family_notify(BUS_NOTIFY_DEL_DEVICE, sl); | ||
802 | device_unregister(&sl->dev); | 786 | device_unregister(&sl->dev); |
803 | #ifdef DEBUG | 787 | #ifdef DEBUG |
804 | memset(sl, 0, sizeof(*sl)); | 788 | memset(sl, 0, sizeof(*sl)); |
@@ -1186,10 +1170,6 @@ static int __init w1_init(void) | |||
1186 | goto err_out_exit_init; | 1170 | goto err_out_exit_init; |
1187 | } | 1171 | } |
1188 | 1172 | ||
1189 | retval = bus_register_notifier(&w1_bus_type, &w1_bus_nb); | ||
1190 | if (retval) | ||
1191 | goto err_out_bus_unregister; | ||
1192 | |||
1193 | retval = driver_register(&w1_master_driver); | 1173 | retval = driver_register(&w1_master_driver); |
1194 | if (retval) { | 1174 | if (retval) { |
1195 | printk(KERN_ERR | 1175 | printk(KERN_ERR |
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index 5234964fe001..a02704a59321 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c | |||
@@ -300,12 +300,6 @@ static int w1_process_command_root(struct cn_msg *msg, | |||
300 | struct w1_netlink_msg *w; | 300 | struct w1_netlink_msg *w; |
301 | u32 *id; | 301 | u32 *id; |
302 | 302 | ||
303 | if (mcmd->type != W1_LIST_MASTERS) { | ||
304 | printk(KERN_NOTICE "%s: msg: %x.%x, wrong type: %u, len: %u.\n", | ||
305 | __func__, msg->id.idx, msg->id.val, mcmd->type, mcmd->len); | ||
306 | return -EPROTO; | ||
307 | } | ||
308 | |||
309 | cn = kmalloc(PAGE_SIZE, GFP_KERNEL); | 303 | cn = kmalloc(PAGE_SIZE, GFP_KERNEL); |
310 | if (!cn) | 304 | if (!cn) |
311 | return -ENOMEM; | 305 | return -ENOMEM; |
@@ -441,6 +435,9 @@ static void w1_process_cb(struct w1_master *dev, struct w1_async_cmd *async_cmd) | |||
441 | w1_netlink_send_error(&node->block->msg, node->m, cmd, | 435 | w1_netlink_send_error(&node->block->msg, node->m, cmd, |
442 | node->block->portid, err); | 436 | node->block->portid, err); |
443 | 437 | ||
438 | /* ref taken in w1_search_slave or w1_search_master_id when building | ||
439 | * the block | ||
440 | */ | ||
444 | if (sl) | 441 | if (sl) |
445 | w1_unref_slave(sl); | 442 | w1_unref_slave(sl); |
446 | else | 443 | else |
@@ -503,30 +500,42 @@ static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | |||
503 | 500 | ||
504 | msg_len = msg->len; | 501 | msg_len = msg->len; |
505 | while (msg_len && !err) { | 502 | while (msg_len && !err) { |
506 | struct w1_reg_num id; | ||
507 | u16 mlen = m->len; | ||
508 | 503 | ||
509 | dev = NULL; | 504 | dev = NULL; |
510 | sl = NULL; | 505 | sl = NULL; |
511 | 506 | ||
512 | memcpy(&id, m->id.id, sizeof(id)); | ||
513 | #if 0 | ||
514 | printk("%s: %02x.%012llx.%02x: type=%02x, len=%u.\n", | ||
515 | __func__, id.family, (unsigned long long)id.id, id.crc, m->type, m->len); | ||
516 | #endif | ||
517 | if (m->len + sizeof(struct w1_netlink_msg) > msg_len) { | 507 | if (m->len + sizeof(struct w1_netlink_msg) > msg_len) { |
518 | err = -E2BIG; | 508 | err = -E2BIG; |
519 | break; | 509 | break; |
520 | } | 510 | } |
521 | 511 | ||
512 | /* execute on this thread, no need to process later */ | ||
513 | if (m->type == W1_LIST_MASTERS) { | ||
514 | err = w1_process_command_root(msg, m, nsp->portid); | ||
515 | goto out_cont; | ||
516 | } | ||
517 | |||
518 | /* All following message types require additional data, | ||
519 | * check here before references are taken. | ||
520 | */ | ||
521 | if (!m->len) { | ||
522 | err = -EPROTO; | ||
523 | goto out_cont; | ||
524 | } | ||
525 | |||
526 | /* both search calls take reference counts */ | ||
522 | if (m->type == W1_MASTER_CMD) { | 527 | if (m->type == W1_MASTER_CMD) { |
523 | dev = w1_search_master_id(m->id.mst.id); | 528 | dev = w1_search_master_id(m->id.mst.id); |
524 | } else if (m->type == W1_SLAVE_CMD) { | 529 | } else if (m->type == W1_SLAVE_CMD) { |
525 | sl = w1_search_slave(&id); | 530 | sl = w1_search_slave((struct w1_reg_num *)m->id.id); |
526 | if (sl) | 531 | if (sl) |
527 | dev = sl->master; | 532 | dev = sl->master; |
528 | } else { | 533 | } else { |
529 | err = w1_process_command_root(msg, m, nsp->portid); | 534 | printk(KERN_NOTICE |
535 | "%s: msg: %x.%x, wrong type: %u, len: %u.\n", | ||
536 | __func__, msg->id.idx, msg->id.val, | ||
537 | m->type, m->len); | ||
538 | err = -EPROTO; | ||
530 | goto out_cont; | 539 | goto out_cont; |
531 | } | 540 | } |
532 | 541 | ||
@@ -536,8 +545,6 @@ static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | |||
536 | } | 545 | } |
537 | 546 | ||
538 | err = 0; | 547 | err = 0; |
539 | if (!mlen) | ||
540 | goto out_cont; | ||
541 | 548 | ||
542 | atomic_inc(&block->refcnt); | 549 | atomic_inc(&block->refcnt); |
543 | node->async.cb = w1_process_cb; | 550 | node->async.cb = w1_process_cb; |
@@ -557,7 +564,8 @@ out_cont: | |||
557 | if (err) | 564 | if (err) |
558 | w1_netlink_send_error(msg, m, NULL, nsp->portid, err); | 565 | w1_netlink_send_error(msg, m, NULL, nsp->portid, err); |
559 | msg_len -= sizeof(struct w1_netlink_msg) + m->len; | 566 | msg_len -= sizeof(struct w1_netlink_msg) + m->len; |
560 | m = (struct w1_netlink_msg *)(((u8 *)m) + sizeof(struct w1_netlink_msg) + m->len); | 567 | m = (struct w1_netlink_msg *)(((u8 *)m) + |
568 | sizeof(struct w1_netlink_msg) + m->len); | ||
561 | 569 | ||
562 | /* | 570 | /* |
563 | * Let's allow requests for nonexisting devices. | 571 | * Let's allow requests for nonexisting devices. |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index fc6c94c0b436..32f9236c959f 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -198,10 +198,32 @@ struct shutdown_handler { | |||
198 | void (*cb)(void); | 198 | void (*cb)(void); |
199 | }; | 199 | }; |
200 | 200 | ||
201 | static int poweroff_nb(struct notifier_block *cb, unsigned long code, void *unused) | ||
202 | { | ||
203 | switch (code) { | ||
204 | case SYS_DOWN: | ||
205 | case SYS_HALT: | ||
206 | case SYS_POWER_OFF: | ||
207 | shutting_down = SHUTDOWN_POWEROFF; | ||
208 | default: | ||
209 | break; | ||
210 | } | ||
211 | return NOTIFY_DONE; | ||
212 | } | ||
201 | static void do_poweroff(void) | 213 | static void do_poweroff(void) |
202 | { | 214 | { |
203 | shutting_down = SHUTDOWN_POWEROFF; | 215 | switch (system_state) { |
204 | orderly_poweroff(false); | 216 | case SYSTEM_BOOTING: |
217 | orderly_poweroff(true); | ||
218 | break; | ||
219 | case SYSTEM_RUNNING: | ||
220 | orderly_poweroff(false); | ||
221 | break; | ||
222 | default: | ||
223 | /* Don't do it when we are halting/rebooting. */ | ||
224 | pr_info("Ignoring Xen toolstack shutdown.\n"); | ||
225 | break; | ||
226 | } | ||
205 | } | 227 | } |
206 | 228 | ||
207 | static void do_reboot(void) | 229 | static void do_reboot(void) |
@@ -307,6 +329,10 @@ static struct xenbus_watch shutdown_watch = { | |||
307 | .callback = shutdown_handler | 329 | .callback = shutdown_handler |
308 | }; | 330 | }; |
309 | 331 | ||
332 | static struct notifier_block xen_reboot_nb = { | ||
333 | .notifier_call = poweroff_nb, | ||
334 | }; | ||
335 | |||
310 | static int setup_shutdown_watcher(void) | 336 | static int setup_shutdown_watcher(void) |
311 | { | 337 | { |
312 | int err; | 338 | int err; |
@@ -317,6 +343,7 @@ static int setup_shutdown_watcher(void) | |||
317 | return err; | 343 | return err; |
318 | } | 344 | } |
319 | 345 | ||
346 | |||
320 | #ifdef CONFIG_MAGIC_SYSRQ | 347 | #ifdef CONFIG_MAGIC_SYSRQ |
321 | err = register_xenbus_watch(&sysrq_watch); | 348 | err = register_xenbus_watch(&sysrq_watch); |
322 | if (err) { | 349 | if (err) { |
@@ -345,6 +372,7 @@ int xen_setup_shutdown_event(void) | |||
345 | if (!xen_domain()) | 372 | if (!xen_domain()) |
346 | return -ENODEV; | 373 | return -ENODEV; |
347 | register_xenstore_notifier(&xenstore_notifier); | 374 | register_xenstore_notifier(&xenstore_notifier); |
375 | register_reboot_notifier(&xen_reboot_nb); | ||
348 | 376 | ||
349 | return 0; | 377 | return 0; |
350 | } | 378 | } |
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 929dd46bb40c..607e41460c0d 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
@@ -217,7 +217,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, | |||
217 | if (result == 0) { | 217 | if (result == 0) { |
218 | for (i = 0; i < op->value; i++) { | 218 | for (i = 0; i < op->value; i++) { |
219 | op->msix_entries[i].entry = entries[i].entry; | 219 | op->msix_entries[i].entry = entries[i].entry; |
220 | if (entries[i].vector) | 220 | if (entries[i].vector) { |
221 | op->msix_entries[i].vector = | 221 | op->msix_entries[i].vector = |
222 | xen_pirq_from_irq(entries[i].vector); | 222 | xen_pirq_from_irq(entries[i].vector); |
223 | if (unlikely(verbose_request)) | 223 | if (unlikely(verbose_request)) |
@@ -225,6 +225,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, | |||
225 | "MSI-X[%d]: %d\n", | 225 | "MSI-X[%d]: %d\n", |
226 | pci_name(dev), i, | 226 | pci_name(dev), i, |
227 | op->msix_entries[i].vector); | 227 | op->msix_entries[i].vector); |
228 | } | ||
228 | } | 229 | } |
229 | } else | 230 | } else |
230 | pr_warn_ratelimited("%s: error enabling MSI-X for guest %u: err %d!\n", | 231 | pr_warn_ratelimited("%s: error enabling MSI-X for guest %u: err %d!\n", |
diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c index 3165ce361b00..51afff96c515 100644 --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c | |||
@@ -137,6 +137,8 @@ unlock: | |||
137 | /* Publish this device. */ | 137 | /* Publish this device. */ |
138 | if (!err) | 138 | if (!err) |
139 | err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid); | 139 | err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid); |
140 | else | ||
141 | kfree(dev_entry); | ||
140 | 142 | ||
141 | out: | 143 | out: |
142 | return err; | 144 | return err; |
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index b6d5fff43d16..ba804f3d8278 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <xen/xenbus.h> | 50 | #include <xen/xenbus.h> |
51 | #include <xen/xen.h> | 51 | #include <xen/xen.h> |
52 | #include "xenbus_comms.h" | 52 | #include "xenbus_comms.h" |
53 | #include "xenbus_probe.h" | ||
53 | 54 | ||
54 | struct xs_stored_msg { | 55 | struct xs_stored_msg { |
55 | struct list_head list; | 56 | struct list_head list; |
@@ -139,6 +140,29 @@ static int get_error(const char *errorstring) | |||
139 | return xsd_errors[i].errnum; | 140 | return xsd_errors[i].errnum; |
140 | } | 141 | } |
141 | 142 | ||
143 | static bool xenbus_ok(void) | ||
144 | { | ||
145 | switch (xen_store_domain_type) { | ||
146 | case XS_LOCAL: | ||
147 | switch (system_state) { | ||
148 | case SYSTEM_POWER_OFF: | ||
149 | case SYSTEM_RESTART: | ||
150 | case SYSTEM_HALT: | ||
151 | return false; | ||
152 | default: | ||
153 | break; | ||
154 | } | ||
155 | return true; | ||
156 | case XS_PV: | ||
157 | case XS_HVM: | ||
158 | /* FIXME: Could check that the remote domain is alive, | ||
159 | * but it is normally initial domain. */ | ||
160 | return true; | ||
161 | default: | ||
162 | break; | ||
163 | } | ||
164 | return false; | ||
165 | } | ||
142 | static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) | 166 | static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) |
143 | { | 167 | { |
144 | struct xs_stored_msg *msg; | 168 | struct xs_stored_msg *msg; |
@@ -148,9 +172,20 @@ static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) | |||
148 | 172 | ||
149 | while (list_empty(&xs_state.reply_list)) { | 173 | while (list_empty(&xs_state.reply_list)) { |
150 | spin_unlock(&xs_state.reply_lock); | 174 | spin_unlock(&xs_state.reply_lock); |
151 | /* XXX FIXME: Avoid synchronous wait for response here. */ | 175 | if (xenbus_ok()) |
152 | wait_event(xs_state.reply_waitq, | 176 | /* XXX FIXME: Avoid synchronous wait for response here. */ |
153 | !list_empty(&xs_state.reply_list)); | 177 | wait_event_timeout(xs_state.reply_waitq, |
178 | !list_empty(&xs_state.reply_list), | ||
179 | msecs_to_jiffies(500)); | ||
180 | else { | ||
181 | /* | ||
182 | * If we are in the process of being shut-down there is | ||
183 | * no point of trying to contact XenBus - it is either | ||
184 | * killed (xenstored application) or the other domain | ||
185 | * has been killed or is unreachable. | ||
186 | */ | ||
187 | return ERR_PTR(-EIO); | ||
188 | } | ||
154 | spin_lock(&xs_state.reply_lock); | 189 | spin_lock(&xs_state.reply_lock); |
155 | } | 190 | } |
156 | 191 | ||
@@ -215,6 +250,9 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | |||
215 | 250 | ||
216 | mutex_unlock(&xs_state.request_mutex); | 251 | mutex_unlock(&xs_state.request_mutex); |
217 | 252 | ||
253 | if (IS_ERR(ret)) | ||
254 | return ret; | ||
255 | |||
218 | if ((msg->type == XS_TRANSACTION_END) || | 256 | if ((msg->type == XS_TRANSACTION_END) || |
219 | ((req_msg.type == XS_TRANSACTION_START) && | 257 | ((req_msg.type == XS_TRANSACTION_START) && |
220 | (msg->type == XS_ERROR))) | 258 | (msg->type == XS_ERROR))) |
diff --git a/firmware/WHENCE b/firmware/WHENCE index 8388f02de2bd..0c4d96dee9b6 100644 --- a/firmware/WHENCE +++ b/firmware/WHENCE | |||
@@ -273,16 +273,6 @@ Converted from Intel HEX files, used in our binary representation of ihex. | |||
273 | 273 | ||
274 | -------------------------------------------------------------------------- | 274 | -------------------------------------------------------------------------- |
275 | 275 | ||
276 | Driver: ip2 -- Computone IntelliPort Plus serial device | ||
277 | |||
278 | File: intelliport2.bin | ||
279 | |||
280 | Licence: Unknown | ||
281 | |||
282 | Found in hex form in kernel source. | ||
283 | |||
284 | -------------------------------------------------------------------------- | ||
285 | |||
286 | Driver: CPiA2 -- cameras based on Vision's CPiA2 | 276 | Driver: CPiA2 -- cameras based on Vision's CPiA2 |
287 | 277 | ||
288 | File: cpia2/stv0672_vp4.bin | 278 | File: cpia2/stv0672_vp4.bin |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index df9c9141c099..5be1f997ecde 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -253,6 +253,11 @@ cifs_alloc_inode(struct super_block *sb) | |||
253 | cifs_set_oplock_level(cifs_inode, 0); | 253 | cifs_set_oplock_level(cifs_inode, 0); |
254 | cifs_inode->delete_pending = false; | 254 | cifs_inode->delete_pending = false; |
255 | cifs_inode->invalid_mapping = false; | 255 | cifs_inode->invalid_mapping = false; |
256 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cifs_inode->flags); | ||
257 | clear_bit(CIFS_INODE_PENDING_WRITERS, &cifs_inode->flags); | ||
258 | clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, &cifs_inode->flags); | ||
259 | spin_lock_init(&cifs_inode->writers_lock); | ||
260 | cifs_inode->writers = 0; | ||
256 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ | 261 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ |
257 | cifs_inode->server_eof = 0; | 262 | cifs_inode->server_eof = 0; |
258 | cifs_inode->uniqueid = 0; | 263 | cifs_inode->uniqueid = 0; |
@@ -732,19 +737,26 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
732 | unsigned long nr_segs, loff_t pos) | 737 | unsigned long nr_segs, loff_t pos) |
733 | { | 738 | { |
734 | struct inode *inode = file_inode(iocb->ki_filp); | 739 | struct inode *inode = file_inode(iocb->ki_filp); |
740 | struct cifsInodeInfo *cinode = CIFS_I(inode); | ||
735 | ssize_t written; | 741 | ssize_t written; |
736 | int rc; | 742 | int rc; |
737 | 743 | ||
744 | written = cifs_get_writer(cinode); | ||
745 | if (written) | ||
746 | return written; | ||
747 | |||
738 | written = generic_file_aio_write(iocb, iov, nr_segs, pos); | 748 | written = generic_file_aio_write(iocb, iov, nr_segs, pos); |
739 | 749 | ||
740 | if (CIFS_CACHE_WRITE(CIFS_I(inode))) | 750 | if (CIFS_CACHE_WRITE(CIFS_I(inode))) |
741 | return written; | 751 | goto out; |
742 | 752 | ||
743 | rc = filemap_fdatawrite(inode->i_mapping); | 753 | rc = filemap_fdatawrite(inode->i_mapping); |
744 | if (rc) | 754 | if (rc) |
745 | cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n", | 755 | cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n", |
746 | rc, inode); | 756 | rc, inode); |
747 | 757 | ||
758 | out: | ||
759 | cifs_put_writer(cinode); | ||
748 | return written; | 760 | return written; |
749 | } | 761 | } |
750 | 762 | ||
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index c0f3718b77a8..30f6e9251a4a 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -228,6 +228,8 @@ struct smb_version_operations { | |||
228 | /* verify the message */ | 228 | /* verify the message */ |
229 | int (*check_message)(char *, unsigned int); | 229 | int (*check_message)(char *, unsigned int); |
230 | bool (*is_oplock_break)(char *, struct TCP_Server_Info *); | 230 | bool (*is_oplock_break)(char *, struct TCP_Server_Info *); |
231 | void (*downgrade_oplock)(struct TCP_Server_Info *, | ||
232 | struct cifsInodeInfo *, bool); | ||
231 | /* process transaction2 response */ | 233 | /* process transaction2 response */ |
232 | bool (*check_trans2)(struct mid_q_entry *, struct TCP_Server_Info *, | 234 | bool (*check_trans2)(struct mid_q_entry *, struct TCP_Server_Info *, |
233 | char *, int); | 235 | char *, int); |
@@ -1113,6 +1115,12 @@ struct cifsInodeInfo { | |||
1113 | unsigned int epoch; /* used to track lease state changes */ | 1115 | unsigned int epoch; /* used to track lease state changes */ |
1114 | bool delete_pending; /* DELETE_ON_CLOSE is set */ | 1116 | bool delete_pending; /* DELETE_ON_CLOSE is set */ |
1115 | bool invalid_mapping; /* pagecache is invalid */ | 1117 | bool invalid_mapping; /* pagecache is invalid */ |
1118 | unsigned long flags; | ||
1119 | #define CIFS_INODE_PENDING_OPLOCK_BREAK (0) /* oplock break in progress */ | ||
1120 | #define CIFS_INODE_PENDING_WRITERS (1) /* Writes in progress */ | ||
1121 | #define CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2 (2) /* Downgrade oplock to L2 */ | ||
1122 | spinlock_t writers_lock; | ||
1123 | unsigned int writers; /* Number of writers on this inode */ | ||
1116 | unsigned long time; /* jiffies of last update of inode */ | 1124 | unsigned long time; /* jiffies of last update of inode */ |
1117 | u64 server_eof; /* current file size on server -- protected by i_lock */ | 1125 | u64 server_eof; /* current file size on server -- protected by i_lock */ |
1118 | u64 uniqueid; /* server inode number */ | 1126 | u64 uniqueid; /* server inode number */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index acc4ee8ed075..ca7980a1e303 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -127,6 +127,9 @@ extern u64 cifs_UnixTimeToNT(struct timespec); | |||
127 | extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, | 127 | extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, |
128 | int offset); | 128 | int offset); |
129 | extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock); | 129 | extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock); |
130 | extern int cifs_get_writer(struct cifsInodeInfo *cinode); | ||
131 | extern void cifs_put_writer(struct cifsInodeInfo *cinode); | ||
132 | extern void cifs_done_oplock_break(struct cifsInodeInfo *cinode); | ||
130 | extern int cifs_unlock_range(struct cifsFileInfo *cfile, | 133 | extern int cifs_unlock_range(struct cifsFileInfo *cfile, |
131 | struct file_lock *flock, const unsigned int xid); | 134 | struct file_lock *flock, const unsigned int xid); |
132 | extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile); | 135 | extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index f3264bd7a83d..6ce4e0954b98 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -6197,6 +6197,9 @@ QAllEAsRetry: | |||
6197 | cifs_dbg(FYI, "ea length %d\n", list_len); | 6197 | cifs_dbg(FYI, "ea length %d\n", list_len); |
6198 | if (list_len <= 8) { | 6198 | if (list_len <= 8) { |
6199 | cifs_dbg(FYI, "empty EA list returned from server\n"); | 6199 | cifs_dbg(FYI, "empty EA list returned from server\n"); |
6200 | /* didn't find the named attribute */ | ||
6201 | if (ea_name) | ||
6202 | rc = -ENODATA; | ||
6200 | goto QAllEAsOut; | 6203 | goto QAllEAsOut; |
6201 | } | 6204 | } |
6202 | 6205 | ||
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8add25538a3b..5ed03e0b8b40 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2599,7 +2599,7 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2599 | ssize_t err; | 2599 | ssize_t err; |
2600 | 2600 | ||
2601 | err = generic_write_sync(file, iocb->ki_pos - rc, rc); | 2601 | err = generic_write_sync(file, iocb->ki_pos - rc, rc); |
2602 | if (rc < 0) | 2602 | if (err < 0) |
2603 | rc = err; | 2603 | rc = err; |
2604 | } | 2604 | } |
2605 | } else { | 2605 | } else { |
@@ -2621,12 +2621,20 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2621 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 2621 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
2622 | ssize_t written; | 2622 | ssize_t written; |
2623 | 2623 | ||
2624 | written = cifs_get_writer(cinode); | ||
2625 | if (written) | ||
2626 | return written; | ||
2627 | |||
2624 | if (CIFS_CACHE_WRITE(cinode)) { | 2628 | if (CIFS_CACHE_WRITE(cinode)) { |
2625 | if (cap_unix(tcon->ses) && | 2629 | if (cap_unix(tcon->ses) && |
2626 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) | 2630 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) |
2627 | && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) | 2631 | && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) { |
2628 | return generic_file_aio_write(iocb, iov, nr_segs, pos); | 2632 | written = generic_file_aio_write( |
2629 | return cifs_writev(iocb, iov, nr_segs, pos); | 2633 | iocb, iov, nr_segs, pos); |
2634 | goto out; | ||
2635 | } | ||
2636 | written = cifs_writev(iocb, iov, nr_segs, pos); | ||
2637 | goto out; | ||
2630 | } | 2638 | } |
2631 | /* | 2639 | /* |
2632 | * For non-oplocked files in strict cache mode we need to write the data | 2640 | * For non-oplocked files in strict cache mode we need to write the data |
@@ -2646,6 +2654,8 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2646 | inode); | 2654 | inode); |
2647 | cinode->oplock = 0; | 2655 | cinode->oplock = 0; |
2648 | } | 2656 | } |
2657 | out: | ||
2658 | cifs_put_writer(cinode); | ||
2649 | return written; | 2659 | return written; |
2650 | } | 2660 | } |
2651 | 2661 | ||
@@ -2872,7 +2882,7 @@ ssize_t cifs_user_readv(struct kiocb *iocb, const struct iovec *iov, | |||
2872 | cifs_uncached_readv_complete); | 2882 | cifs_uncached_readv_complete); |
2873 | if (!rdata) { | 2883 | if (!rdata) { |
2874 | rc = -ENOMEM; | 2884 | rc = -ENOMEM; |
2875 | goto error; | 2885 | break; |
2876 | } | 2886 | } |
2877 | 2887 | ||
2878 | rc = cifs_read_allocate_pages(rdata, npages); | 2888 | rc = cifs_read_allocate_pages(rdata, npages); |
@@ -3621,6 +3631,13 @@ static int cifs_launder_page(struct page *page) | |||
3621 | return rc; | 3631 | return rc; |
3622 | } | 3632 | } |
3623 | 3633 | ||
3634 | static int | ||
3635 | cifs_pending_writers_wait(void *unused) | ||
3636 | { | ||
3637 | schedule(); | ||
3638 | return 0; | ||
3639 | } | ||
3640 | |||
3624 | void cifs_oplock_break(struct work_struct *work) | 3641 | void cifs_oplock_break(struct work_struct *work) |
3625 | { | 3642 | { |
3626 | struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, | 3643 | struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, |
@@ -3628,8 +3645,15 @@ void cifs_oplock_break(struct work_struct *work) | |||
3628 | struct inode *inode = cfile->dentry->d_inode; | 3645 | struct inode *inode = cfile->dentry->d_inode; |
3629 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 3646 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
3630 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 3647 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
3648 | struct TCP_Server_Info *server = tcon->ses->server; | ||
3631 | int rc = 0; | 3649 | int rc = 0; |
3632 | 3650 | ||
3651 | wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, | ||
3652 | cifs_pending_writers_wait, TASK_UNINTERRUPTIBLE); | ||
3653 | |||
3654 | server->ops->downgrade_oplock(server, cinode, | ||
3655 | test_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, &cinode->flags)); | ||
3656 | |||
3633 | if (!CIFS_CACHE_WRITE(cinode) && CIFS_CACHE_READ(cinode) && | 3657 | if (!CIFS_CACHE_WRITE(cinode) && CIFS_CACHE_READ(cinode) && |
3634 | cifs_has_mand_locks(cinode)) { | 3658 | cifs_has_mand_locks(cinode)) { |
3635 | cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n", | 3659 | cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n", |
@@ -3666,6 +3690,7 @@ void cifs_oplock_break(struct work_struct *work) | |||
3666 | cinode); | 3690 | cinode); |
3667 | cifs_dbg(FYI, "Oplock release rc = %d\n", rc); | 3691 | cifs_dbg(FYI, "Oplock release rc = %d\n", rc); |
3668 | } | 3692 | } |
3693 | cifs_done_oplock_break(cinode); | ||
3669 | } | 3694 | } |
3670 | 3695 | ||
3671 | /* | 3696 | /* |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2f9f3790679d..3b0c62e622da 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -466,8 +466,22 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
466 | cifs_dbg(FYI, "file id match, oplock break\n"); | 466 | cifs_dbg(FYI, "file id match, oplock break\n"); |
467 | pCifsInode = CIFS_I(netfile->dentry->d_inode); | 467 | pCifsInode = CIFS_I(netfile->dentry->d_inode); |
468 | 468 | ||
469 | cifs_set_oplock_level(pCifsInode, | 469 | set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, |
470 | pSMB->OplockLevel ? OPLOCK_READ : 0); | 470 | &pCifsInode->flags); |
471 | |||
472 | /* | ||
473 | * Set flag if the server downgrades the oplock | ||
474 | * to L2 else clear. | ||
475 | */ | ||
476 | if (pSMB->OplockLevel) | ||
477 | set_bit( | ||
478 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | ||
479 | &pCifsInode->flags); | ||
480 | else | ||
481 | clear_bit( | ||
482 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | ||
483 | &pCifsInode->flags); | ||
484 | |||
471 | queue_work(cifsiod_wq, | 485 | queue_work(cifsiod_wq, |
472 | &netfile->oplock_break); | 486 | &netfile->oplock_break); |
473 | netfile->oplock_break_cancelled = false; | 487 | netfile->oplock_break_cancelled = false; |
@@ -551,6 +565,62 @@ void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | |||
551 | cinode->oplock = 0; | 565 | cinode->oplock = 0; |
552 | } | 566 | } |
553 | 567 | ||
568 | static int | ||
569 | cifs_oplock_break_wait(void *unused) | ||
570 | { | ||
571 | schedule(); | ||
572 | return signal_pending(current) ? -ERESTARTSYS : 0; | ||
573 | } | ||
574 | |||
575 | /* | ||
576 | * We wait for oplock breaks to be processed before we attempt to perform | ||
577 | * writes. | ||
578 | */ | ||
579 | int cifs_get_writer(struct cifsInodeInfo *cinode) | ||
580 | { | ||
581 | int rc; | ||
582 | |||
583 | start: | ||
584 | rc = wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK, | ||
585 | cifs_oplock_break_wait, TASK_KILLABLE); | ||
586 | if (rc) | ||
587 | return rc; | ||
588 | |||
589 | spin_lock(&cinode->writers_lock); | ||
590 | if (!cinode->writers) | ||
591 | set_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); | ||
592 | cinode->writers++; | ||
593 | /* Check to see if we have started servicing an oplock break */ | ||
594 | if (test_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags)) { | ||
595 | cinode->writers--; | ||
596 | if (cinode->writers == 0) { | ||
597 | clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); | ||
598 | wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); | ||
599 | } | ||
600 | spin_unlock(&cinode->writers_lock); | ||
601 | goto start; | ||
602 | } | ||
603 | spin_unlock(&cinode->writers_lock); | ||
604 | return 0; | ||
605 | } | ||
606 | |||
607 | void cifs_put_writer(struct cifsInodeInfo *cinode) | ||
608 | { | ||
609 | spin_lock(&cinode->writers_lock); | ||
610 | cinode->writers--; | ||
611 | if (cinode->writers == 0) { | ||
612 | clear_bit(CIFS_INODE_PENDING_WRITERS, &cinode->flags); | ||
613 | wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS); | ||
614 | } | ||
615 | spin_unlock(&cinode->writers_lock); | ||
616 | } | ||
617 | |||
618 | void cifs_done_oplock_break(struct cifsInodeInfo *cinode) | ||
619 | { | ||
620 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); | ||
621 | wake_up_bit(&cinode->flags, CIFS_INODE_PENDING_OPLOCK_BREAK); | ||
622 | } | ||
623 | |||
554 | bool | 624 | bool |
555 | backup_cred(struct cifs_sb_info *cifs_sb) | 625 | backup_cred(struct cifs_sb_info *cifs_sb) |
556 | { | 626 | { |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 526fb89f9230..d1fdfa848703 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -372,6 +372,16 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr) | |||
372 | return 0; | 372 | return 0; |
373 | } | 373 | } |
374 | 374 | ||
375 | static void | ||
376 | cifs_downgrade_oplock(struct TCP_Server_Info *server, | ||
377 | struct cifsInodeInfo *cinode, bool set_level2) | ||
378 | { | ||
379 | if (set_level2) | ||
380 | cifs_set_oplock_level(cinode, OPLOCK_READ); | ||
381 | else | ||
382 | cifs_set_oplock_level(cinode, 0); | ||
383 | } | ||
384 | |||
375 | static bool | 385 | static bool |
376 | cifs_check_trans2(struct mid_q_entry *mid, struct TCP_Server_Info *server, | 386 | cifs_check_trans2(struct mid_q_entry *mid, struct TCP_Server_Info *server, |
377 | char *buf, int malformed) | 387 | char *buf, int malformed) |
@@ -1019,6 +1029,7 @@ struct smb_version_operations smb1_operations = { | |||
1019 | .clear_stats = cifs_clear_stats, | 1029 | .clear_stats = cifs_clear_stats, |
1020 | .print_stats = cifs_print_stats, | 1030 | .print_stats = cifs_print_stats, |
1021 | .is_oplock_break = is_valid_oplock_break, | 1031 | .is_oplock_break = is_valid_oplock_break, |
1032 | .downgrade_oplock = cifs_downgrade_oplock, | ||
1022 | .check_trans2 = cifs_check_trans2, | 1033 | .check_trans2 = cifs_check_trans2, |
1023 | .need_neg = cifs_need_neg, | 1034 | .need_neg = cifs_need_neg, |
1024 | .negotiate = cifs_negotiate, | 1035 | .negotiate = cifs_negotiate, |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index fb3966265b6e..b8021fde987d 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
@@ -575,9 +575,21 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) | |||
575 | else | 575 | else |
576 | cfile->oplock_break_cancelled = false; | 576 | cfile->oplock_break_cancelled = false; |
577 | 577 | ||
578 | server->ops->set_oplock_level(cinode, | 578 | set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, |
579 | rsp->OplockLevel ? SMB2_OPLOCK_LEVEL_II : 0, | 579 | &cinode->flags); |
580 | 0, NULL); | 580 | |
581 | /* | ||
582 | * Set flag if the server downgrades the oplock | ||
583 | * to L2 else clear. | ||
584 | */ | ||
585 | if (rsp->OplockLevel) | ||
586 | set_bit( | ||
587 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | ||
588 | &cinode->flags); | ||
589 | else | ||
590 | clear_bit( | ||
591 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | ||
592 | &cinode->flags); | ||
581 | 593 | ||
582 | queue_work(cifsiod_wq, &cfile->oplock_break); | 594 | queue_work(cifsiod_wq, &cfile->oplock_break); |
583 | 595 | ||
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 192f51a12cf1..35ddc3ed119d 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -905,6 +905,17 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
905 | } | 905 | } |
906 | 906 | ||
907 | static void | 907 | static void |
908 | smb2_downgrade_oplock(struct TCP_Server_Info *server, | ||
909 | struct cifsInodeInfo *cinode, bool set_level2) | ||
910 | { | ||
911 | if (set_level2) | ||
912 | server->ops->set_oplock_level(cinode, SMB2_OPLOCK_LEVEL_II, | ||
913 | 0, NULL); | ||
914 | else | ||
915 | server->ops->set_oplock_level(cinode, 0, 0, NULL); | ||
916 | } | ||
917 | |||
918 | static void | ||
908 | smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, | 919 | smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, |
909 | unsigned int epoch, bool *purge_cache) | 920 | unsigned int epoch, bool *purge_cache) |
910 | { | 921 | { |
@@ -1110,6 +1121,7 @@ struct smb_version_operations smb20_operations = { | |||
1110 | .clear_stats = smb2_clear_stats, | 1121 | .clear_stats = smb2_clear_stats, |
1111 | .print_stats = smb2_print_stats, | 1122 | .print_stats = smb2_print_stats, |
1112 | .is_oplock_break = smb2_is_valid_oplock_break, | 1123 | .is_oplock_break = smb2_is_valid_oplock_break, |
1124 | .downgrade_oplock = smb2_downgrade_oplock, | ||
1113 | .need_neg = smb2_need_neg, | 1125 | .need_neg = smb2_need_neg, |
1114 | .negotiate = smb2_negotiate, | 1126 | .negotiate = smb2_negotiate, |
1115 | .negotiate_wsize = smb2_negotiate_wsize, | 1127 | .negotiate_wsize = smb2_negotiate_wsize, |
@@ -1184,6 +1196,7 @@ struct smb_version_operations smb21_operations = { | |||
1184 | .clear_stats = smb2_clear_stats, | 1196 | .clear_stats = smb2_clear_stats, |
1185 | .print_stats = smb2_print_stats, | 1197 | .print_stats = smb2_print_stats, |
1186 | .is_oplock_break = smb2_is_valid_oplock_break, | 1198 | .is_oplock_break = smb2_is_valid_oplock_break, |
1199 | .downgrade_oplock = smb2_downgrade_oplock, | ||
1187 | .need_neg = smb2_need_neg, | 1200 | .need_neg = smb2_need_neg, |
1188 | .negotiate = smb2_negotiate, | 1201 | .negotiate = smb2_negotiate, |
1189 | .negotiate_wsize = smb2_negotiate_wsize, | 1202 | .negotiate_wsize = smb2_negotiate_wsize, |
@@ -1259,6 +1272,7 @@ struct smb_version_operations smb30_operations = { | |||
1259 | .print_stats = smb2_print_stats, | 1272 | .print_stats = smb2_print_stats, |
1260 | .dump_share_caps = smb2_dump_share_caps, | 1273 | .dump_share_caps = smb2_dump_share_caps, |
1261 | .is_oplock_break = smb2_is_valid_oplock_break, | 1274 | .is_oplock_break = smb2_is_valid_oplock_break, |
1275 | .downgrade_oplock = smb2_downgrade_oplock, | ||
1262 | .need_neg = smb2_need_neg, | 1276 | .need_neg = smb2_need_neg, |
1263 | .negotiate = smb2_negotiate, | 1277 | .negotiate = smb2_negotiate, |
1264 | .negotiate_wsize = smb2_negotiate_wsize, | 1278 | .negotiate_wsize = smb2_negotiate_wsize, |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 860344701067..3802f8c94acc 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -1352,7 +1352,6 @@ SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon, | |||
1352 | u64 persistent_fid, u64 volatile_fid) | 1352 | u64 persistent_fid, u64 volatile_fid) |
1353 | { | 1353 | { |
1354 | int rc; | 1354 | int rc; |
1355 | char *res_key = NULL; | ||
1356 | struct compress_ioctl fsctl_input; | 1355 | struct compress_ioctl fsctl_input; |
1357 | char *ret_data = NULL; | 1356 | char *ret_data = NULL; |
1358 | 1357 | ||
@@ -1365,7 +1364,6 @@ SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon, | |||
1365 | 2 /* in data len */, &ret_data /* out data */, NULL); | 1364 | 2 /* in data len */, &ret_data /* out data */, NULL); |
1366 | 1365 | ||
1367 | cifs_dbg(FYI, "set compression rc %d\n", rc); | 1366 | cifs_dbg(FYI, "set compression rc %d\n", rc); |
1368 | kfree(res_key); | ||
1369 | 1367 | ||
1370 | return rc; | 1368 | return rc; |
1371 | } | 1369 | } |
diff --git a/fs/coredump.c b/fs/coredump.c index e3ad709a4232..0b2528fb640e 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -73,10 +73,15 @@ static int expand_corename(struct core_name *cn, int size) | |||
73 | static int cn_vprintf(struct core_name *cn, const char *fmt, va_list arg) | 73 | static int cn_vprintf(struct core_name *cn, const char *fmt, va_list arg) |
74 | { | 74 | { |
75 | int free, need; | 75 | int free, need; |
76 | va_list arg_copy; | ||
76 | 77 | ||
77 | again: | 78 | again: |
78 | free = cn->size - cn->used; | 79 | free = cn->size - cn->used; |
79 | need = vsnprintf(cn->corename + cn->used, free, fmt, arg); | 80 | |
81 | va_copy(arg_copy, arg); | ||
82 | need = vsnprintf(cn->corename + cn->used, free, fmt, arg_copy); | ||
83 | va_end(arg_copy); | ||
84 | |||
80 | if (need < free) { | 85 | if (need < free) { |
81 | cn->used += need; | 86 | cn->used += need; |
82 | return 0; | 87 | return 0; |
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index abb0f1f53d93..985217626e66 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c | |||
@@ -48,14 +48,18 @@ void __init kernfs_inode_init(void) | |||
48 | 48 | ||
49 | static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) | 49 | static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) |
50 | { | 50 | { |
51 | static DEFINE_MUTEX(iattr_mutex); | ||
52 | struct kernfs_iattrs *ret; | ||
51 | struct iattr *iattrs; | 53 | struct iattr *iattrs; |
52 | 54 | ||
55 | mutex_lock(&iattr_mutex); | ||
56 | |||
53 | if (kn->iattr) | 57 | if (kn->iattr) |
54 | return kn->iattr; | 58 | goto out_unlock; |
55 | 59 | ||
56 | kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); | 60 | kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); |
57 | if (!kn->iattr) | 61 | if (!kn->iattr) |
58 | return NULL; | 62 | goto out_unlock; |
59 | iattrs = &kn->iattr->ia_iattr; | 63 | iattrs = &kn->iattr->ia_iattr; |
60 | 64 | ||
61 | /* assign default attributes */ | 65 | /* assign default attributes */ |
@@ -65,8 +69,10 @@ static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) | |||
65 | iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME; | 69 | iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME; |
66 | 70 | ||
67 | simple_xattrs_init(&kn->iattr->xattrs); | 71 | simple_xattrs_init(&kn->iattr->xattrs); |
68 | 72 | out_unlock: | |
69 | return kn->iattr; | 73 | ret = kn->iattr; |
74 | mutex_unlock(&iattr_mutex); | ||
75 | return ret; | ||
70 | } | 76 | } |
71 | 77 | ||
72 | static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) | 78 | static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) |
diff --git a/fs/super.c b/fs/super.c index e9dc3c3fe159..48377f7463c0 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -800,7 +800,10 @@ void emergency_remount(void) | |||
800 | 800 | ||
801 | static DEFINE_IDA(unnamed_dev_ida); | 801 | static DEFINE_IDA(unnamed_dev_ida); |
802 | static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ | 802 | static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */ |
803 | static int unnamed_dev_start = 0; /* don't bother trying below it */ | 803 | /* Many userspace utilities consider an FSID of 0 invalid. |
804 | * Always return at least 1 from get_anon_bdev. | ||
805 | */ | ||
806 | static int unnamed_dev_start = 1; | ||
804 | 807 | ||
805 | int get_anon_bdev(dev_t *p) | 808 | int get_anon_bdev(dev_t *p) |
806 | { | 809 | { |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 1b8b91b67fdb..28cc1acd5439 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -453,95 +453,3 @@ void sysfs_remove_bin_file(struct kobject *kobj, | |||
453 | kernfs_remove_by_name(kobj->sd, attr->attr.name); | 453 | kernfs_remove_by_name(kobj->sd, attr->attr.name); |
454 | } | 454 | } |
455 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); | 455 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); |
456 | |||
457 | struct sysfs_schedule_callback_struct { | ||
458 | struct list_head workq_list; | ||
459 | struct kobject *kobj; | ||
460 | void (*func)(void *); | ||
461 | void *data; | ||
462 | struct module *owner; | ||
463 | struct work_struct work; | ||
464 | }; | ||
465 | |||
466 | static struct workqueue_struct *sysfs_workqueue; | ||
467 | static DEFINE_MUTEX(sysfs_workq_mutex); | ||
468 | static LIST_HEAD(sysfs_workq); | ||
469 | static void sysfs_schedule_callback_work(struct work_struct *work) | ||
470 | { | ||
471 | struct sysfs_schedule_callback_struct *ss = container_of(work, | ||
472 | struct sysfs_schedule_callback_struct, work); | ||
473 | |||
474 | (ss->func)(ss->data); | ||
475 | kobject_put(ss->kobj); | ||
476 | module_put(ss->owner); | ||
477 | mutex_lock(&sysfs_workq_mutex); | ||
478 | list_del(&ss->workq_list); | ||
479 | mutex_unlock(&sysfs_workq_mutex); | ||
480 | kfree(ss); | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * sysfs_schedule_callback - helper to schedule a callback for a kobject | ||
485 | * @kobj: object we're acting for. | ||
486 | * @func: callback function to invoke later. | ||
487 | * @data: argument to pass to @func. | ||
488 | * @owner: module owning the callback code | ||
489 | * | ||
490 | * sysfs attribute methods must not unregister themselves or their parent | ||
491 | * kobject (which would amount to the same thing). Attempts to do so will | ||
492 | * deadlock, since unregistration is mutually exclusive with driver | ||
493 | * callbacks. | ||
494 | * | ||
495 | * Instead methods can call this routine, which will attempt to allocate | ||
496 | * and schedule a workqueue request to call back @func with @data as its | ||
497 | * argument in the workqueue's process context. @kobj will be pinned | ||
498 | * until @func returns. | ||
499 | * | ||
500 | * Returns 0 if the request was submitted, -ENOMEM if storage could not | ||
501 | * be allocated, -ENODEV if a reference to @owner isn't available, | ||
502 | * -EAGAIN if a callback has already been scheduled for @kobj. | ||
503 | */ | ||
504 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | ||
505 | void *data, struct module *owner) | ||
506 | { | ||
507 | struct sysfs_schedule_callback_struct *ss, *tmp; | ||
508 | |||
509 | if (!try_module_get(owner)) | ||
510 | return -ENODEV; | ||
511 | |||
512 | mutex_lock(&sysfs_workq_mutex); | ||
513 | list_for_each_entry_safe(ss, tmp, &sysfs_workq, workq_list) | ||
514 | if (ss->kobj == kobj) { | ||
515 | module_put(owner); | ||
516 | mutex_unlock(&sysfs_workq_mutex); | ||
517 | return -EAGAIN; | ||
518 | } | ||
519 | mutex_unlock(&sysfs_workq_mutex); | ||
520 | |||
521 | if (sysfs_workqueue == NULL) { | ||
522 | sysfs_workqueue = create_singlethread_workqueue("sysfsd"); | ||
523 | if (sysfs_workqueue == NULL) { | ||
524 | module_put(owner); | ||
525 | return -ENOMEM; | ||
526 | } | ||
527 | } | ||
528 | |||
529 | ss = kmalloc(sizeof(*ss), GFP_KERNEL); | ||
530 | if (!ss) { | ||
531 | module_put(owner); | ||
532 | return -ENOMEM; | ||
533 | } | ||
534 | kobject_get(kobj); | ||
535 | ss->kobj = kobj; | ||
536 | ss->func = func; | ||
537 | ss->data = data; | ||
538 | ss->owner = owner; | ||
539 | INIT_WORK(&ss->work, sysfs_schedule_callback_work); | ||
540 | INIT_LIST_HEAD(&ss->workq_list); | ||
541 | mutex_lock(&sysfs_workq_mutex); | ||
542 | list_add_tail(&ss->workq_list, &sysfs_workq); | ||
543 | mutex_unlock(&sysfs_workq_mutex); | ||
544 | queue_work(sysfs_workqueue, &ss->work); | ||
545 | return 0; | ||
546 | } | ||
547 | EXPORT_SYMBOL_GPL(sysfs_schedule_callback); | ||
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 75df77d09f75..0479c32c5eb1 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1344,6 +1344,14 @@ __xfs_get_blocks( | |||
1344 | /* | 1344 | /* |
1345 | * If this is O_DIRECT or the mpage code calling tell them how large | 1345 | * If this is O_DIRECT or the mpage code calling tell them how large |
1346 | * the mapping is, so that we can avoid repeated get_blocks calls. | 1346 | * the mapping is, so that we can avoid repeated get_blocks calls. |
1347 | * | ||
1348 | * If the mapping spans EOF, then we have to break the mapping up as the | ||
1349 | * mapping for blocks beyond EOF must be marked new so that sub block | ||
1350 | * regions can be correctly zeroed. We can't do this for mappings within | ||
1351 | * EOF unless the mapping was just allocated or is unwritten, otherwise | ||
1352 | * the callers would overwrite existing data with zeros. Hence we have | ||
1353 | * to split the mapping into a range up to and including EOF, and a | ||
1354 | * second mapping for beyond EOF. | ||
1347 | */ | 1355 | */ |
1348 | if (direct || size > (1 << inode->i_blkbits)) { | 1356 | if (direct || size > (1 << inode->i_blkbits)) { |
1349 | xfs_off_t mapping_size; | 1357 | xfs_off_t mapping_size; |
@@ -1354,6 +1362,12 @@ __xfs_get_blocks( | |||
1354 | ASSERT(mapping_size > 0); | 1362 | ASSERT(mapping_size > 0); |
1355 | if (mapping_size > size) | 1363 | if (mapping_size > size) |
1356 | mapping_size = size; | 1364 | mapping_size = size; |
1365 | if (offset < i_size_read(inode) && | ||
1366 | offset + mapping_size >= i_size_read(inode)) { | ||
1367 | /* limit mapping to block that spans EOF */ | ||
1368 | mapping_size = roundup_64(i_size_read(inode) - offset, | ||
1369 | 1 << inode->i_blkbits); | ||
1370 | } | ||
1357 | if (mapping_size > LONG_MAX) | 1371 | if (mapping_size > LONG_MAX) |
1358 | mapping_size = LONG_MAX; | 1372 | mapping_size = LONG_MAX; |
1359 | 1373 | ||
@@ -1566,6 +1580,16 @@ xfs_vm_write_failed( | |||
1566 | 1580 | ||
1567 | xfs_vm_kill_delalloc_range(inode, block_offset, | 1581 | xfs_vm_kill_delalloc_range(inode, block_offset, |
1568 | block_offset + bh->b_size); | 1582 | block_offset + bh->b_size); |
1583 | |||
1584 | /* | ||
1585 | * This buffer does not contain data anymore. make sure anyone | ||
1586 | * who finds it knows that for certain. | ||
1587 | */ | ||
1588 | clear_buffer_delay(bh); | ||
1589 | clear_buffer_uptodate(bh); | ||
1590 | clear_buffer_mapped(bh); | ||
1591 | clear_buffer_new(bh); | ||
1592 | clear_buffer_dirty(bh); | ||
1569 | } | 1593 | } |
1570 | 1594 | ||
1571 | } | 1595 | } |
@@ -1599,12 +1623,21 @@ xfs_vm_write_begin( | |||
1599 | status = __block_write_begin(page, pos, len, xfs_get_blocks); | 1623 | status = __block_write_begin(page, pos, len, xfs_get_blocks); |
1600 | if (unlikely(status)) { | 1624 | if (unlikely(status)) { |
1601 | struct inode *inode = mapping->host; | 1625 | struct inode *inode = mapping->host; |
1626 | size_t isize = i_size_read(inode); | ||
1602 | 1627 | ||
1603 | xfs_vm_write_failed(inode, page, pos, len); | 1628 | xfs_vm_write_failed(inode, page, pos, len); |
1604 | unlock_page(page); | 1629 | unlock_page(page); |
1605 | 1630 | ||
1606 | if (pos + len > i_size_read(inode)) | 1631 | /* |
1607 | truncate_pagecache(inode, i_size_read(inode)); | 1632 | * If the write is beyond EOF, we only want to kill blocks |
1633 | * allocated in this write, not blocks that were previously | ||
1634 | * written successfully. | ||
1635 | */ | ||
1636 | if (pos + len > isize) { | ||
1637 | ssize_t start = max_t(ssize_t, pos, isize); | ||
1638 | |||
1639 | truncate_pagecache_range(inode, start, pos + len); | ||
1640 | } | ||
1608 | 1641 | ||
1609 | page_cache_release(page); | 1642 | page_cache_release(page); |
1610 | page = NULL; | 1643 | page = NULL; |
@@ -1615,9 +1648,12 @@ xfs_vm_write_begin( | |||
1615 | } | 1648 | } |
1616 | 1649 | ||
1617 | /* | 1650 | /* |
1618 | * On failure, we only need to kill delalloc blocks beyond EOF because they | 1651 | * On failure, we only need to kill delalloc blocks beyond EOF in the range of |
1619 | * will never be written. For blocks within EOF, generic_write_end() zeros them | 1652 | * this specific write because they will never be written. Previous writes |
1620 | * so they are safe to leave alone and be written with all the other valid data. | 1653 | * beyond EOF where block allocation succeeded do not need to be trashed, so |
1654 | * only new blocks from this write should be trashed. For blocks within | ||
1655 | * EOF, generic_write_end() zeros them so they are safe to leave alone and be | ||
1656 | * written with all the other valid data. | ||
1621 | */ | 1657 | */ |
1622 | STATIC int | 1658 | STATIC int |
1623 | xfs_vm_write_end( | 1659 | xfs_vm_write_end( |
@@ -1640,8 +1676,11 @@ xfs_vm_write_end( | |||
1640 | loff_t to = pos + len; | 1676 | loff_t to = pos + len; |
1641 | 1677 | ||
1642 | if (to > isize) { | 1678 | if (to > isize) { |
1643 | truncate_pagecache(inode, isize); | 1679 | /* only kill blocks in this write beyond EOF */ |
1680 | if (pos > isize) | ||
1681 | isize = pos; | ||
1644 | xfs_vm_kill_delalloc_range(inode, isize, to); | 1682 | xfs_vm_kill_delalloc_range(inode, isize, to); |
1683 | truncate_pagecache_range(inode, isize, to); | ||
1645 | } | 1684 | } |
1646 | } | 1685 | } |
1647 | return ret; | 1686 | return ret; |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 5b6092ef51ef..f0efc7e970ef 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -5413,6 +5413,7 @@ xfs_bmap_shift_extents( | |||
5413 | int whichfork = XFS_DATA_FORK; | 5413 | int whichfork = XFS_DATA_FORK; |
5414 | int logflags; | 5414 | int logflags; |
5415 | xfs_filblks_t blockcount = 0; | 5415 | xfs_filblks_t blockcount = 0; |
5416 | int total_extents; | ||
5416 | 5417 | ||
5417 | if (unlikely(XFS_TEST_ERROR( | 5418 | if (unlikely(XFS_TEST_ERROR( |
5418 | (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && | 5419 | (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS && |
@@ -5429,7 +5430,6 @@ xfs_bmap_shift_extents( | |||
5429 | ASSERT(current_ext != NULL); | 5430 | ASSERT(current_ext != NULL); |
5430 | 5431 | ||
5431 | ifp = XFS_IFORK_PTR(ip, whichfork); | 5432 | ifp = XFS_IFORK_PTR(ip, whichfork); |
5432 | |||
5433 | if (!(ifp->if_flags & XFS_IFEXTENTS)) { | 5433 | if (!(ifp->if_flags & XFS_IFEXTENTS)) { |
5434 | /* Read in all the extents */ | 5434 | /* Read in all the extents */ |
5435 | error = xfs_iread_extents(tp, ip, whichfork); | 5435 | error = xfs_iread_extents(tp, ip, whichfork); |
@@ -5456,7 +5456,6 @@ xfs_bmap_shift_extents( | |||
5456 | 5456 | ||
5457 | /* We are going to change core inode */ | 5457 | /* We are going to change core inode */ |
5458 | logflags = XFS_ILOG_CORE; | 5458 | logflags = XFS_ILOG_CORE; |
5459 | |||
5460 | if (ifp->if_flags & XFS_IFBROOT) { | 5459 | if (ifp->if_flags & XFS_IFBROOT) { |
5461 | cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); | 5460 | cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); |
5462 | cur->bc_private.b.firstblock = *firstblock; | 5461 | cur->bc_private.b.firstblock = *firstblock; |
@@ -5467,8 +5466,14 @@ xfs_bmap_shift_extents( | |||
5467 | logflags |= XFS_ILOG_DEXT; | 5466 | logflags |= XFS_ILOG_DEXT; |
5468 | } | 5467 | } |
5469 | 5468 | ||
5470 | while (nexts++ < num_exts && | 5469 | /* |
5471 | *current_ext < XFS_IFORK_NEXTENTS(ip, whichfork)) { | 5470 | * There may be delalloc extents in the data fork before the range we |
5471 | * are collapsing out, so we cannot | ||
5472 | * use the count of real extents here. Instead we have to calculate it | ||
5473 | * from the incore fork. | ||
5474 | */ | ||
5475 | total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t); | ||
5476 | while (nexts++ < num_exts && *current_ext < total_extents) { | ||
5472 | 5477 | ||
5473 | gotp = xfs_iext_get_ext(ifp, *current_ext); | 5478 | gotp = xfs_iext_get_ext(ifp, *current_ext); |
5474 | xfs_bmbt_get_all(gotp, &got); | 5479 | xfs_bmbt_get_all(gotp, &got); |
@@ -5556,10 +5561,11 @@ xfs_bmap_shift_extents( | |||
5556 | } | 5561 | } |
5557 | 5562 | ||
5558 | (*current_ext)++; | 5563 | (*current_ext)++; |
5564 | total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t); | ||
5559 | } | 5565 | } |
5560 | 5566 | ||
5561 | /* Check if we are done */ | 5567 | /* Check if we are done */ |
5562 | if (*current_ext == XFS_IFORK_NEXTENTS(ip, whichfork)) | 5568 | if (*current_ext == total_extents) |
5563 | *done = 1; | 5569 | *done = 1; |
5564 | 5570 | ||
5565 | del_cursor: | 5571 | del_cursor: |
@@ -5568,6 +5574,5 @@ del_cursor: | |||
5568 | error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); | 5574 | error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); |
5569 | 5575 | ||
5570 | xfs_trans_log_inode(tp, ip, logflags); | 5576 | xfs_trans_log_inode(tp, ip, logflags); |
5571 | |||
5572 | return error; | 5577 | return error; |
5573 | } | 5578 | } |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 01f6a646caa1..296160b8e78c 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -1418,6 +1418,8 @@ xfs_zero_file_space( | |||
1418 | xfs_off_t end_boundary; | 1418 | xfs_off_t end_boundary; |
1419 | int error; | 1419 | int error; |
1420 | 1420 | ||
1421 | trace_xfs_zero_file_space(ip); | ||
1422 | |||
1421 | granularity = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); | 1423 | granularity = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); |
1422 | 1424 | ||
1423 | /* | 1425 | /* |
@@ -1432,9 +1434,18 @@ xfs_zero_file_space( | |||
1432 | ASSERT(end_boundary <= offset + len); | 1434 | ASSERT(end_boundary <= offset + len); |
1433 | 1435 | ||
1434 | if (start_boundary < end_boundary - 1) { | 1436 | if (start_boundary < end_boundary - 1) { |
1435 | /* punch out the page cache over the conversion range */ | 1437 | /* |
1438 | * punch out delayed allocation blocks and the page cache over | ||
1439 | * the conversion range | ||
1440 | */ | ||
1441 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
1442 | error = xfs_bmap_punch_delalloc_range(ip, | ||
1443 | XFS_B_TO_FSBT(mp, start_boundary), | ||
1444 | XFS_B_TO_FSB(mp, end_boundary - start_boundary)); | ||
1445 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
1436 | truncate_pagecache_range(VFS_I(ip), start_boundary, | 1446 | truncate_pagecache_range(VFS_I(ip), start_boundary, |
1437 | end_boundary - 1); | 1447 | end_boundary - 1); |
1448 | |||
1438 | /* convert the blocks */ | 1449 | /* convert the blocks */ |
1439 | error = xfs_alloc_file_space(ip, start_boundary, | 1450 | error = xfs_alloc_file_space(ip, start_boundary, |
1440 | end_boundary - start_boundary - 1, | 1451 | end_boundary - start_boundary - 1, |
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 107f2fdfe41f..cb10a0aaab3a 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -1372,21 +1372,29 @@ xfs_buf_iorequest( | |||
1372 | xfs_buf_wait_unpin(bp); | 1372 | xfs_buf_wait_unpin(bp); |
1373 | xfs_buf_hold(bp); | 1373 | xfs_buf_hold(bp); |
1374 | 1374 | ||
1375 | /* Set the count to 1 initially, this will stop an I/O | 1375 | /* |
1376 | * Set the count to 1 initially, this will stop an I/O | ||
1376 | * completion callout which happens before we have started | 1377 | * completion callout which happens before we have started |
1377 | * all the I/O from calling xfs_buf_ioend too early. | 1378 | * all the I/O from calling xfs_buf_ioend too early. |
1378 | */ | 1379 | */ |
1379 | atomic_set(&bp->b_io_remaining, 1); | 1380 | atomic_set(&bp->b_io_remaining, 1); |
1380 | _xfs_buf_ioapply(bp); | 1381 | _xfs_buf_ioapply(bp); |
1381 | _xfs_buf_ioend(bp, 1); | 1382 | /* |
1383 | * If _xfs_buf_ioapply failed, we'll get back here with | ||
1384 | * only the reference we took above. _xfs_buf_ioend will | ||
1385 | * drop it to zero, so we'd better not queue it for later, | ||
1386 | * or we'll free it before it's done. | ||
1387 | */ | ||
1388 | _xfs_buf_ioend(bp, bp->b_error ? 0 : 1); | ||
1382 | 1389 | ||
1383 | xfs_buf_rele(bp); | 1390 | xfs_buf_rele(bp); |
1384 | } | 1391 | } |
1385 | 1392 | ||
1386 | /* | 1393 | /* |
1387 | * Waits for I/O to complete on the buffer supplied. It returns immediately if | 1394 | * Waits for I/O to complete on the buffer supplied. It returns immediately if |
1388 | * no I/O is pending or there is already a pending error on the buffer. It | 1395 | * no I/O is pending or there is already a pending error on the buffer, in which |
1389 | * returns the I/O error code, if any, or 0 if there was no error. | 1396 | * case nothing will ever complete. It returns the I/O error code, if any, or |
1397 | * 0 if there was no error. | ||
1390 | */ | 1398 | */ |
1391 | int | 1399 | int |
1392 | xfs_buf_iowait( | 1400 | xfs_buf_iowait( |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 79e96ce98733..82afdcb33183 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -679,7 +679,7 @@ xfs_file_dio_aio_write( | |||
679 | goto out; | 679 | goto out; |
680 | 680 | ||
681 | if (mapping->nrpages) { | 681 | if (mapping->nrpages) { |
682 | ret = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | 682 | ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, |
683 | pos, -1); | 683 | pos, -1); |
684 | if (ret) | 684 | if (ret) |
685 | goto out; | 685 | goto out; |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 5e7a38fa6ee6..768087bedbac 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1334,7 +1334,8 @@ int | |||
1334 | xfs_create_tmpfile( | 1334 | xfs_create_tmpfile( |
1335 | struct xfs_inode *dp, | 1335 | struct xfs_inode *dp, |
1336 | struct dentry *dentry, | 1336 | struct dentry *dentry, |
1337 | umode_t mode) | 1337 | umode_t mode, |
1338 | struct xfs_inode **ipp) | ||
1338 | { | 1339 | { |
1339 | struct xfs_mount *mp = dp->i_mount; | 1340 | struct xfs_mount *mp = dp->i_mount; |
1340 | struct xfs_inode *ip = NULL; | 1341 | struct xfs_inode *ip = NULL; |
@@ -1402,7 +1403,6 @@ xfs_create_tmpfile( | |||
1402 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); | 1403 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); |
1403 | 1404 | ||
1404 | ip->i_d.di_nlink--; | 1405 | ip->i_d.di_nlink--; |
1405 | d_tmpfile(dentry, VFS_I(ip)); | ||
1406 | error = xfs_iunlink(tp, ip); | 1406 | error = xfs_iunlink(tp, ip); |
1407 | if (error) | 1407 | if (error) |
1408 | goto out_trans_abort; | 1408 | goto out_trans_abort; |
@@ -1415,6 +1415,7 @@ xfs_create_tmpfile( | |||
1415 | xfs_qm_dqrele(gdqp); | 1415 | xfs_qm_dqrele(gdqp); |
1416 | xfs_qm_dqrele(pdqp); | 1416 | xfs_qm_dqrele(pdqp); |
1417 | 1417 | ||
1418 | *ipp = ip; | ||
1418 | return 0; | 1419 | return 0; |
1419 | 1420 | ||
1420 | out_trans_abort: | 1421 | out_trans_abort: |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 396cc1fafd0d..f2fcde52b66d 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -334,7 +334,7 @@ int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, | |||
334 | int xfs_create(struct xfs_inode *dp, struct xfs_name *name, | 334 | int xfs_create(struct xfs_inode *dp, struct xfs_name *name, |
335 | umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp); | 335 | umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp); |
336 | int xfs_create_tmpfile(struct xfs_inode *dp, struct dentry *dentry, | 336 | int xfs_create_tmpfile(struct xfs_inode *dp, struct dentry *dentry, |
337 | umode_t mode); | 337 | umode_t mode, struct xfs_inode **ipp); |
338 | int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, | 338 | int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, |
339 | struct xfs_inode *ip); | 339 | struct xfs_inode *ip); |
340 | int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, | 340 | int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 89b07e43ca28..ef1ca010f417 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -1053,11 +1053,25 @@ xfs_vn_tmpfile( | |||
1053 | struct dentry *dentry, | 1053 | struct dentry *dentry, |
1054 | umode_t mode) | 1054 | umode_t mode) |
1055 | { | 1055 | { |
1056 | int error; | 1056 | int error; |
1057 | struct xfs_inode *ip; | ||
1058 | struct inode *inode; | ||
1057 | 1059 | ||
1058 | error = xfs_create_tmpfile(XFS_I(dir), dentry, mode); | 1060 | error = xfs_create_tmpfile(XFS_I(dir), dentry, mode, &ip); |
1061 | if (unlikely(error)) | ||
1062 | return -error; | ||
1059 | 1063 | ||
1060 | return -error; | 1064 | inode = VFS_I(ip); |
1065 | |||
1066 | error = xfs_init_security(inode, dir, &dentry->d_name); | ||
1067 | if (unlikely(error)) { | ||
1068 | iput(inode); | ||
1069 | return -error; | ||
1070 | } | ||
1071 | |||
1072 | d_tmpfile(dentry, inode); | ||
1073 | |||
1074 | return 0; | ||
1061 | } | 1075 | } |
1062 | 1076 | ||
1063 | static const struct inode_operations xfs_inode_operations = { | 1077 | static const struct inode_operations xfs_inode_operations = { |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 8497a00e399d..08624dc67317 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -1181,11 +1181,14 @@ xlog_iodone(xfs_buf_t *bp) | |||
1181 | /* log I/O is always issued ASYNC */ | 1181 | /* log I/O is always issued ASYNC */ |
1182 | ASSERT(XFS_BUF_ISASYNC(bp)); | 1182 | ASSERT(XFS_BUF_ISASYNC(bp)); |
1183 | xlog_state_done_syncing(iclog, aborted); | 1183 | xlog_state_done_syncing(iclog, aborted); |
1184 | |||
1184 | /* | 1185 | /* |
1185 | * do not reference the buffer (bp) here as we could race | 1186 | * drop the buffer lock now that we are done. Nothing references |
1186 | * with it being freed after writing the unmount record to the | 1187 | * the buffer after this, so an unmount waiting on this lock can now |
1187 | * log. | 1188 | * tear it down safely. As such, it is unsafe to reference the buffer |
1189 | * (bp) after the unlock as we could race with it being freed. | ||
1188 | */ | 1190 | */ |
1191 | xfs_buf_unlock(bp); | ||
1189 | } | 1192 | } |
1190 | 1193 | ||
1191 | /* | 1194 | /* |
@@ -1368,8 +1371,16 @@ xlog_alloc_log( | |||
1368 | bp = xfs_buf_alloc(mp->m_logdev_targp, 0, BTOBB(log->l_iclog_size), 0); | 1371 | bp = xfs_buf_alloc(mp->m_logdev_targp, 0, BTOBB(log->l_iclog_size), 0); |
1369 | if (!bp) | 1372 | if (!bp) |
1370 | goto out_free_log; | 1373 | goto out_free_log; |
1371 | bp->b_iodone = xlog_iodone; | 1374 | |
1375 | /* | ||
1376 | * The iclogbuf buffer locks are held over IO but we are not going to do | ||
1377 | * IO yet. Hence unlock the buffer so that the log IO path can grab it | ||
1378 | * when appropriately. | ||
1379 | */ | ||
1372 | ASSERT(xfs_buf_islocked(bp)); | 1380 | ASSERT(xfs_buf_islocked(bp)); |
1381 | xfs_buf_unlock(bp); | ||
1382 | |||
1383 | bp->b_iodone = xlog_iodone; | ||
1373 | log->l_xbuf = bp; | 1384 | log->l_xbuf = bp; |
1374 | 1385 | ||
1375 | spin_lock_init(&log->l_icloglock); | 1386 | spin_lock_init(&log->l_icloglock); |
@@ -1398,6 +1409,9 @@ xlog_alloc_log( | |||
1398 | if (!bp) | 1409 | if (!bp) |
1399 | goto out_free_iclog; | 1410 | goto out_free_iclog; |
1400 | 1411 | ||
1412 | ASSERT(xfs_buf_islocked(bp)); | ||
1413 | xfs_buf_unlock(bp); | ||
1414 | |||
1401 | bp->b_iodone = xlog_iodone; | 1415 | bp->b_iodone = xlog_iodone; |
1402 | iclog->ic_bp = bp; | 1416 | iclog->ic_bp = bp; |
1403 | iclog->ic_data = bp->b_addr; | 1417 | iclog->ic_data = bp->b_addr; |
@@ -1422,7 +1436,6 @@ xlog_alloc_log( | |||
1422 | iclog->ic_callback_tail = &(iclog->ic_callback); | 1436 | iclog->ic_callback_tail = &(iclog->ic_callback); |
1423 | iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; | 1437 | iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; |
1424 | 1438 | ||
1425 | ASSERT(xfs_buf_islocked(iclog->ic_bp)); | ||
1426 | init_waitqueue_head(&iclog->ic_force_wait); | 1439 | init_waitqueue_head(&iclog->ic_force_wait); |
1427 | init_waitqueue_head(&iclog->ic_write_wait); | 1440 | init_waitqueue_head(&iclog->ic_write_wait); |
1428 | 1441 | ||
@@ -1631,6 +1644,12 @@ xlog_cksum( | |||
1631 | * we transition the iclogs to IOERROR state *after* flushing all existing | 1644 | * we transition the iclogs to IOERROR state *after* flushing all existing |
1632 | * iclogs to disk. This is because we don't want anymore new transactions to be | 1645 | * iclogs to disk. This is because we don't want anymore new transactions to be |
1633 | * started or completed afterwards. | 1646 | * started or completed afterwards. |
1647 | * | ||
1648 | * We lock the iclogbufs here so that we can serialise against IO completion | ||
1649 | * during unmount. We might be processing a shutdown triggered during unmount, | ||
1650 | * and that can occur asynchronously to the unmount thread, and hence we need to | ||
1651 | * ensure that completes before tearing down the iclogbufs. Hence we need to | ||
1652 | * hold the buffer lock across the log IO to acheive that. | ||
1634 | */ | 1653 | */ |
1635 | STATIC int | 1654 | STATIC int |
1636 | xlog_bdstrat( | 1655 | xlog_bdstrat( |
@@ -1638,6 +1657,7 @@ xlog_bdstrat( | |||
1638 | { | 1657 | { |
1639 | struct xlog_in_core *iclog = bp->b_fspriv; | 1658 | struct xlog_in_core *iclog = bp->b_fspriv; |
1640 | 1659 | ||
1660 | xfs_buf_lock(bp); | ||
1641 | if (iclog->ic_state & XLOG_STATE_IOERROR) { | 1661 | if (iclog->ic_state & XLOG_STATE_IOERROR) { |
1642 | xfs_buf_ioerror(bp, EIO); | 1662 | xfs_buf_ioerror(bp, EIO); |
1643 | xfs_buf_stale(bp); | 1663 | xfs_buf_stale(bp); |
@@ -1645,7 +1665,8 @@ xlog_bdstrat( | |||
1645 | /* | 1665 | /* |
1646 | * It would seem logical to return EIO here, but we rely on | 1666 | * It would seem logical to return EIO here, but we rely on |
1647 | * the log state machine to propagate I/O errors instead of | 1667 | * the log state machine to propagate I/O errors instead of |
1648 | * doing it here. | 1668 | * doing it here. Similarly, IO completion will unlock the |
1669 | * buffer, so we don't do it here. | ||
1649 | */ | 1670 | */ |
1650 | return 0; | 1671 | return 0; |
1651 | } | 1672 | } |
@@ -1847,14 +1868,28 @@ xlog_dealloc_log( | |||
1847 | xlog_cil_destroy(log); | 1868 | xlog_cil_destroy(log); |
1848 | 1869 | ||
1849 | /* | 1870 | /* |
1850 | * always need to ensure that the extra buffer does not point to memory | 1871 | * Cycle all the iclogbuf locks to make sure all log IO completion |
1851 | * owned by another log buffer before we free it. | 1872 | * is done before we tear down these buffers. |
1852 | */ | 1873 | */ |
1874 | iclog = log->l_iclog; | ||
1875 | for (i = 0; i < log->l_iclog_bufs; i++) { | ||
1876 | xfs_buf_lock(iclog->ic_bp); | ||
1877 | xfs_buf_unlock(iclog->ic_bp); | ||
1878 | iclog = iclog->ic_next; | ||
1879 | } | ||
1880 | |||
1881 | /* | ||
1882 | * Always need to ensure that the extra buffer does not point to memory | ||
1883 | * owned by another log buffer before we free it. Also, cycle the lock | ||
1884 | * first to ensure we've completed IO on it. | ||
1885 | */ | ||
1886 | xfs_buf_lock(log->l_xbuf); | ||
1887 | xfs_buf_unlock(log->l_xbuf); | ||
1853 | xfs_buf_set_empty(log->l_xbuf, BTOBB(log->l_iclog_size)); | 1888 | xfs_buf_set_empty(log->l_xbuf, BTOBB(log->l_iclog_size)); |
1854 | xfs_buf_free(log->l_xbuf); | 1889 | xfs_buf_free(log->l_xbuf); |
1855 | 1890 | ||
1856 | iclog = log->l_iclog; | 1891 | iclog = log->l_iclog; |
1857 | for (i=0; i<log->l_iclog_bufs; i++) { | 1892 | for (i = 0; i < log->l_iclog_bufs; i++) { |
1858 | xfs_buf_free(iclog->ic_bp); | 1893 | xfs_buf_free(iclog->ic_bp); |
1859 | next_iclog = iclog->ic_next; | 1894 | next_iclog = iclog->ic_next; |
1860 | kmem_free(iclog); | 1895 | kmem_free(iclog); |
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index a4ae41c179a8..65d8c793a25c 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h | |||
@@ -603,6 +603,7 @@ DEFINE_INODE_EVENT(xfs_readlink); | |||
603 | DEFINE_INODE_EVENT(xfs_inactive_symlink); | 603 | DEFINE_INODE_EVENT(xfs_inactive_symlink); |
604 | DEFINE_INODE_EVENT(xfs_alloc_file_space); | 604 | DEFINE_INODE_EVENT(xfs_alloc_file_space); |
605 | DEFINE_INODE_EVENT(xfs_free_file_space); | 605 | DEFINE_INODE_EVENT(xfs_free_file_space); |
606 | DEFINE_INODE_EVENT(xfs_zero_file_space); | ||
606 | DEFINE_INODE_EVENT(xfs_collapse_file_space); | 607 | DEFINE_INODE_EVENT(xfs_collapse_file_space); |
607 | DEFINE_INODE_EVENT(xfs_readdir); | 608 | DEFINE_INODE_EVENT(xfs_readdir); |
608 | #ifdef CONFIG_XFS_POSIX_ACL | 609 | #ifdef CONFIG_XFS_POSIX_ACL |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 1ec08c198b66..a8015a7a55bb 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -693,24 +693,35 @@ static inline int pmd_numa(pmd_t pmd) | |||
693 | #ifndef pte_mknonnuma | 693 | #ifndef pte_mknonnuma |
694 | static inline pte_t pte_mknonnuma(pte_t pte) | 694 | static inline pte_t pte_mknonnuma(pte_t pte) |
695 | { | 695 | { |
696 | pte = pte_clear_flags(pte, _PAGE_NUMA); | 696 | pteval_t val = pte_val(pte); |
697 | return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED); | 697 | |
698 | val &= ~_PAGE_NUMA; | ||
699 | val |= (_PAGE_PRESENT|_PAGE_ACCESSED); | ||
700 | return __pte(val); | ||
698 | } | 701 | } |
699 | #endif | 702 | #endif |
700 | 703 | ||
701 | #ifndef pmd_mknonnuma | 704 | #ifndef pmd_mknonnuma |
702 | static inline pmd_t pmd_mknonnuma(pmd_t pmd) | 705 | static inline pmd_t pmd_mknonnuma(pmd_t pmd) |
703 | { | 706 | { |
704 | pmd = pmd_clear_flags(pmd, _PAGE_NUMA); | 707 | pmdval_t val = pmd_val(pmd); |
705 | return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED); | 708 | |
709 | val &= ~_PAGE_NUMA; | ||
710 | val |= (_PAGE_PRESENT|_PAGE_ACCESSED); | ||
711 | |||
712 | return __pmd(val); | ||
706 | } | 713 | } |
707 | #endif | 714 | #endif |
708 | 715 | ||
709 | #ifndef pte_mknuma | 716 | #ifndef pte_mknuma |
710 | static inline pte_t pte_mknuma(pte_t pte) | 717 | static inline pte_t pte_mknuma(pte_t pte) |
711 | { | 718 | { |
712 | pte = pte_set_flags(pte, _PAGE_NUMA); | 719 | pteval_t val = pte_val(pte); |
713 | return pte_clear_flags(pte, _PAGE_PRESENT); | 720 | |
721 | val &= ~_PAGE_PRESENT; | ||
722 | val |= _PAGE_NUMA; | ||
723 | |||
724 | return __pte(val); | ||
714 | } | 725 | } |
715 | #endif | 726 | #endif |
716 | 727 | ||
@@ -729,8 +740,12 @@ static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, | |||
729 | #ifndef pmd_mknuma | 740 | #ifndef pmd_mknuma |
730 | static inline pmd_t pmd_mknuma(pmd_t pmd) | 741 | static inline pmd_t pmd_mknuma(pmd_t pmd) |
731 | { | 742 | { |
732 | pmd = pmd_set_flags(pmd, _PAGE_NUMA); | 743 | pmdval_t val = pmd_val(pmd); |
733 | return pmd_clear_flags(pmd, _PAGE_PRESENT); | 744 | |
745 | val &= ~_PAGE_PRESENT; | ||
746 | val |= _PAGE_NUMA; | ||
747 | |||
748 | return __pmd(val); | ||
734 | } | 749 | } |
735 | #endif | 750 | #endif |
736 | 751 | ||
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 0bb34ca2ad2b..36a5febac2a6 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -125,7 +125,6 @@ struct drm_connector_helper_funcs { | |||
125 | struct drm_encoder *(*best_encoder)(struct drm_connector *connector); | 125 | struct drm_encoder *(*best_encoder)(struct drm_connector *connector); |
126 | }; | 126 | }; |
127 | 127 | ||
128 | extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); | ||
129 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); | 128 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); |
130 | extern int drm_crtc_helper_set_config(struct drm_mode_set *set); | 129 | extern int drm_crtc_helper_set_config(struct drm_mode_set *set); |
131 | extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | 130 | extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, |
@@ -161,6 +160,11 @@ static inline void drm_connector_helper_add(struct drm_connector *connector, | |||
161 | } | 160 | } |
162 | 161 | ||
163 | extern void drm_helper_resume_force_mode(struct drm_device *dev); | 162 | extern void drm_helper_resume_force_mode(struct drm_device *dev); |
163 | |||
164 | /* drm_probe_helper.c */ | ||
165 | extern int drm_helper_probe_single_connector_modes(struct drm_connector | ||
166 | *connector, uint32_t maxX, | ||
167 | uint32_t maxY); | ||
164 | extern void drm_kms_helper_poll_init(struct drm_device *dev); | 168 | extern void drm_kms_helper_poll_init(struct drm_device *dev); |
165 | extern void drm_kms_helper_poll_fini(struct drm_device *dev); | 169 | extern void drm_kms_helper_poll_fini(struct drm_device *dev); |
166 | extern bool drm_helper_hpd_irq_event(struct drm_device *dev); | 170 | extern bool drm_helper_hpd_irq_event(struct drm_device *dev); |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index b4f58914bf7d..cfcacec5b89d 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
@@ -456,6 +456,10 @@ struct drm_dp_aux_msg { | |||
456 | * transactions. The drm_dp_aux_register_i2c_bus() function registers an | 456 | * transactions. The drm_dp_aux_register_i2c_bus() function registers an |
457 | * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers | 457 | * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers |
458 | * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. | 458 | * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. |
459 | * | ||
460 | * Note that the aux helper code assumes that the .transfer() function | ||
461 | * only modifies the reply field of the drm_dp_aux_msg structure. The | ||
462 | * retry logic and i2c helpers assume this is the case. | ||
459 | */ | 463 | */ |
460 | struct drm_dp_aux { | 464 | struct drm_dp_aux { |
461 | const char *name; | 465 | const char *name; |
diff --git a/include/linux/device.h b/include/linux/device.h index 233bbbeb768d..d1d1c055b48e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -566,12 +566,6 @@ extern int __must_check device_create_bin_file(struct device *dev, | |||
566 | const struct bin_attribute *attr); | 566 | const struct bin_attribute *attr); |
567 | extern void device_remove_bin_file(struct device *dev, | 567 | extern void device_remove_bin_file(struct device *dev, |
568 | const struct bin_attribute *attr); | 568 | const struct bin_attribute *attr); |
569 | extern int device_schedule_callback_owner(struct device *dev, | ||
570 | void (*func)(struct device *dev), struct module *owner); | ||
571 | |||
572 | /* This is a macro to avoid include problems with THIS_MODULE */ | ||
573 | #define device_schedule_callback(dev, func) \ | ||
574 | device_schedule_callback_owner(dev, func, THIS_MODULE) | ||
575 | 569 | ||
576 | /* device resource management */ | 570 | /* device resource management */ |
577 | typedef void (*dr_release_t)(struct device *dev, void *res); | 571 | typedef void (*dr_release_t)(struct device *dev, void *res); |
@@ -932,10 +926,7 @@ extern int device_online(struct device *dev); | |||
932 | extern struct device *__root_device_register(const char *name, | 926 | extern struct device *__root_device_register(const char *name, |
933 | struct module *owner); | 927 | struct module *owner); |
934 | 928 | ||
935 | /* | 929 | /* This is a macro to avoid include problems with THIS_MODULE */ |
936 | * This is a macro to avoid include problems with THIS_MODULE, | ||
937 | * just as per what is done for device_schedule_callback() above. | ||
938 | */ | ||
939 | #define root_device_register(name) \ | 930 | #define root_device_register(name) \ |
940 | __root_device_register(name, THIS_MODULE) | 931 | __root_device_register(name, THIS_MODULE) |
941 | 932 | ||
diff --git a/include/linux/filter.h b/include/linux/filter.h index 262dcbb75ffe..024fd03e5d18 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -220,7 +220,6 @@ enum { | |||
220 | BPF_S_ANC_RXHASH, | 220 | BPF_S_ANC_RXHASH, |
221 | BPF_S_ANC_CPU, | 221 | BPF_S_ANC_CPU, |
222 | BPF_S_ANC_ALU_XOR_X, | 222 | BPF_S_ANC_ALU_XOR_X, |
223 | BPF_S_ANC_SECCOMP_LD_W, | ||
224 | BPF_S_ANC_VLAN_TAG, | 223 | BPF_S_ANC_VLAN_TAG, |
225 | BPF_S_ANC_VLAN_TAG_PRESENT, | 224 | BPF_S_ANC_VLAN_TAG_PRESENT, |
226 | BPF_S_ANC_PAY_OFFSET, | 225 | BPF_S_ANC_PAY_OFFSET, |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ab7359fde987..2d7b4f139c32 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -147,15 +147,17 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, | |||
147 | * 0 . 13 (Windows Server 2008) | 147 | * 0 . 13 (Windows Server 2008) |
148 | * 1 . 1 (Windows 7) | 148 | * 1 . 1 (Windows 7) |
149 | * 2 . 4 (Windows 8) | 149 | * 2 . 4 (Windows 8) |
150 | * 3 . 0 (Windows 8 R2) | ||
150 | */ | 151 | */ |
151 | 152 | ||
152 | #define VERSION_WS2008 ((0 << 16) | (13)) | 153 | #define VERSION_WS2008 ((0 << 16) | (13)) |
153 | #define VERSION_WIN7 ((1 << 16) | (1)) | 154 | #define VERSION_WIN7 ((1 << 16) | (1)) |
154 | #define VERSION_WIN8 ((2 << 16) | (4)) | 155 | #define VERSION_WIN8 ((2 << 16) | (4)) |
156 | #define VERSION_WIN8_1 ((3 << 16) | (0)) | ||
155 | 157 | ||
156 | #define VERSION_INVAL -1 | 158 | #define VERSION_INVAL -1 |
157 | 159 | ||
158 | #define VERSION_CURRENT VERSION_WIN8 | 160 | #define VERSION_CURRENT VERSION_WIN8_1 |
159 | 161 | ||
160 | /* Make maximum size of pipe payload of 16K */ | 162 | /* Make maximum size of pipe payload of 16K */ |
161 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) | 163 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 1f9f56e28851..76d2acbfa7c6 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
@@ -237,7 +237,7 @@ int ipmi_set_maintenance_mode(ipmi_user_t user, int mode); | |||
237 | * The first user that sets this to TRUE will receive all events that | 237 | * The first user that sets this to TRUE will receive all events that |
238 | * have been queued while no one was waiting for events. | 238 | * have been queued while no one was waiting for events. |
239 | */ | 239 | */ |
240 | int ipmi_set_gets_events(ipmi_user_t user, int val); | 240 | int ipmi_set_gets_events(ipmi_user_t user, bool val); |
241 | 241 | ||
242 | /* | 242 | /* |
243 | * Called when a new SMI is registered. This will also be called on | 243 | * Called when a new SMI is registered. This will also be called on |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 8ea3fe0b9759..bd349240d50e 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
@@ -109,12 +109,19 @@ struct ipmi_smi_handlers { | |||
109 | events from the BMC we are attached to. */ | 109 | events from the BMC we are attached to. */ |
110 | void (*request_events)(void *send_info); | 110 | void (*request_events)(void *send_info); |
111 | 111 | ||
112 | /* Called by the upper layer when some user requires that the | ||
113 | interface watch for events, received messages, watchdog | ||
114 | pretimeouts, or not. Used by the SMI to know if it should | ||
115 | watch for these. This may be NULL if the SMI does not | ||
116 | implement it. */ | ||
117 | void (*set_need_watch)(void *send_info, bool enable); | ||
118 | |||
112 | /* Called when the interface should go into "run to | 119 | /* Called when the interface should go into "run to |
113 | completion" mode. If this call sets the value to true, the | 120 | completion" mode. If this call sets the value to true, the |
114 | interface should make sure that all messages are flushed | 121 | interface should make sure that all messages are flushed |
115 | out and that none are pending, and any new requests are run | 122 | out and that none are pending, and any new requests are run |
116 | to completion immediately. */ | 123 | to completion immediately. */ |
117 | void (*set_run_to_completion)(void *send_info, int run_to_completion); | 124 | void (*set_run_to_completion)(void *send_info, bool run_to_completion); |
118 | 125 | ||
119 | /* Called to poll for work to do. This is so upper layers can | 126 | /* Called to poll for work to do. This is so upper layers can |
120 | poll for operations during things like crash dumps. */ | 127 | poll for operations during things like crash dumps. */ |
@@ -125,7 +132,7 @@ struct ipmi_smi_handlers { | |||
125 | setting. The message handler does the mode handling. Note | 132 | setting. The message handler does the mode handling. Note |
126 | that this is called from interrupt context, so it cannot | 133 | that this is called from interrupt context, so it cannot |
127 | block. */ | 134 | block. */ |
128 | void (*set_maintenance_mode)(void *send_info, int enable); | 135 | void (*set_maintenance_mode)(void *send_info, bool enable); |
129 | 136 | ||
130 | /* Tell the handler that we are using it/not using it. The | 137 | /* Tell the handler that we are using it/not using it. The |
131 | message handler get the modules that this handler belongs | 138 | message handler get the modules that this handler belongs |
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h index 7c9fe3c2be73..66c30a763b10 100644 --- a/include/linux/mdio-gpio.h +++ b/include/linux/mdio-gpio.h | |||
@@ -17,6 +17,11 @@ struct mdio_gpio_platform_data { | |||
17 | /* GPIO numbers for bus pins */ | 17 | /* GPIO numbers for bus pins */ |
18 | unsigned int mdc; | 18 | unsigned int mdc; |
19 | unsigned int mdio; | 19 | unsigned int mdio; |
20 | unsigned int mdo; | ||
21 | |||
22 | bool mdc_active_low; | ||
23 | bool mdio_active_low; | ||
24 | bool mdo_active_low; | ||
20 | 25 | ||
21 | unsigned int phy_mask; | 26 | unsigned int phy_mask; |
22 | int irqs[PHY_MAX_ADDR]; | 27 | int irqs[PHY_MAX_ADDR]; |
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index f25adfa97c73..0bf2708df150 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h | |||
@@ -64,6 +64,20 @@ enum { | |||
64 | TPS65090_REGULATOR_MAX, | 64 | TPS65090_REGULATOR_MAX, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* Register addresses */ | ||
68 | #define TPS65090_REG_INTR_STS 0x00 | ||
69 | #define TPS65090_REG_INTR_STS2 0x01 | ||
70 | #define TPS65090_REG_INTR_MASK 0x02 | ||
71 | #define TPS65090_REG_INTR_MASK2 0x03 | ||
72 | #define TPS65090_REG_CG_CTRL0 0x04 | ||
73 | #define TPS65090_REG_CG_CTRL1 0x05 | ||
74 | #define TPS65090_REG_CG_CTRL2 0x06 | ||
75 | #define TPS65090_REG_CG_CTRL3 0x07 | ||
76 | #define TPS65090_REG_CG_CTRL4 0x08 | ||
77 | #define TPS65090_REG_CG_CTRL5 0x09 | ||
78 | #define TPS65090_REG_CG_STATUS1 0x0a | ||
79 | #define TPS65090_REG_CG_STATUS2 0x0b | ||
80 | |||
67 | struct tps65090 { | 81 | struct tps65090 { |
68 | struct device *dev; | 82 | struct device *dev; |
69 | struct regmap *rmap; | 83 | struct regmap *rmap; |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 407bdb67fd4f..3406cfb1267a 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -179,6 +179,7 @@ enum { | |||
179 | MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9, | 179 | MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9, |
180 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, | 180 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, |
181 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, | 181 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, |
182 | MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23, | ||
182 | MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, | 183 | MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, |
183 | MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, | 184 | MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, |
184 | MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, | 185 | MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, |
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index f829ad80ff28..9709b30e2d69 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h | |||
@@ -146,6 +146,7 @@ enum { | |||
146 | 146 | ||
147 | enum { | 147 | enum { |
148 | MLX5_QP_LAT_SENSITIVE = 1 << 28, | 148 | MLX5_QP_LAT_SENSITIVE = 1 << 28, |
149 | MLX5_QP_BLOCK_MCAST = 1 << 30, | ||
149 | MLX5_QP_ENABLE_SIG = 1 << 31, | 150 | MLX5_QP_ENABLE_SIG = 1 << 31, |
150 | }; | 151 | }; |
151 | 152 | ||
diff --git a/include/linux/mtd/spear_smi.h b/include/linux/mtd/spear_smi.h index 8ae1726044c3..581603ac1277 100644 --- a/include/linux/mtd/spear_smi.h +++ b/include/linux/mtd/spear_smi.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright © 2010 ST Microelectronics | 2 | * Copyright © 2010 ST Microelectronics |
3 | * Shiraz Hashim <shiraz.hashim@st.com> | 3 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
4 | * | 4 | * |
5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h index ec2ffaf418c8..df78dc2b5524 100644 --- a/include/linux/netfilter/nf_conntrack_proto_gre.h +++ b/include/linux/netfilter/nf_conntrack_proto_gre.h | |||
@@ -87,7 +87,6 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, | |||
87 | /* delete keymap entries */ | 87 | /* delete keymap entries */ |
88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); | 88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); |
89 | 89 | ||
90 | void nf_ct_gre_keymap_flush(struct net *net); | ||
91 | void nf_nat_need_gre(void); | 90 | void nf_nat_need_gre(void); |
92 | 91 | ||
93 | #endif /* __KERNEL__ */ | 92 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 919bf211877d..3bad8d106e0e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -374,6 +374,11 @@ static inline struct device_node *of_find_matching_node_and_match( | |||
374 | return NULL; | 374 | return NULL; |
375 | } | 375 | } |
376 | 376 | ||
377 | static inline struct device_node *of_find_node_by_path(const char *path) | ||
378 | { | ||
379 | return NULL; | ||
380 | } | ||
381 | |||
377 | static inline struct device_node *of_get_parent(const struct device_node *node) | 382 | static inline struct device_node *of_get_parent(const struct device_node *node) |
378 | { | 383 | { |
379 | return NULL; | 384 | return NULL; |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 24126c4b27b5..4d0221fd0688 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -75,6 +75,7 @@ typedef enum { | |||
75 | PHY_INTERFACE_MODE_SMII, | 75 | PHY_INTERFACE_MODE_SMII, |
76 | PHY_INTERFACE_MODE_XGMII, | 76 | PHY_INTERFACE_MODE_XGMII, |
77 | PHY_INTERFACE_MODE_MOCA, | 77 | PHY_INTERFACE_MODE_MOCA, |
78 | PHY_INTERFACE_MODE_QSGMII, | ||
78 | PHY_INTERFACE_MODE_MAX, | 79 | PHY_INTERFACE_MODE_MAX, |
79 | } phy_interface_t; | 80 | } phy_interface_t; |
80 | 81 | ||
@@ -116,6 +117,8 @@ static inline const char *phy_modes(phy_interface_t interface) | |||
116 | return "xgmii"; | 117 | return "xgmii"; |
117 | case PHY_INTERFACE_MODE_MOCA: | 118 | case PHY_INTERFACE_MODE_MOCA: |
118 | return "moca"; | 119 | return "moca"; |
120 | case PHY_INTERFACE_MODE_QSGMII: | ||
121 | return "qsgmii"; | ||
119 | default: | 122 | default: |
120 | return "unknown"; | 123 | return "unknown"; |
121 | } | 124 | } |
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 9e7db9e73cc1..48bf152761c7 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h | |||
@@ -20,13 +20,13 @@ enum reboot_mode { | |||
20 | extern enum reboot_mode reboot_mode; | 20 | extern enum reboot_mode reboot_mode; |
21 | 21 | ||
22 | enum reboot_type { | 22 | enum reboot_type { |
23 | BOOT_TRIPLE = 't', | 23 | BOOT_TRIPLE = 't', |
24 | BOOT_KBD = 'k', | 24 | BOOT_KBD = 'k', |
25 | BOOT_BIOS = 'b', | 25 | BOOT_BIOS = 'b', |
26 | BOOT_ACPI = 'a', | 26 | BOOT_ACPI = 'a', |
27 | BOOT_EFI = 'e', | 27 | BOOT_EFI = 'e', |
28 | BOOT_CF9 = 'p', | 28 | BOOT_CF9_FORCE = 'p', |
29 | BOOT_CF9_COND = 'q', | 29 | BOOT_CF9_SAFE = 'q', |
30 | }; | 30 | }; |
31 | extern enum reboot_type reboot_type; | 31 | extern enum reboot_type reboot_type; |
32 | 32 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 084354b0e814..5ffaa3443712 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -179,9 +179,6 @@ struct sysfs_ops { | |||
179 | 179 | ||
180 | #ifdef CONFIG_SYSFS | 180 | #ifdef CONFIG_SYSFS |
181 | 181 | ||
182 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | ||
183 | void *data, struct module *owner); | ||
184 | |||
185 | int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns); | 182 | int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns); |
186 | void sysfs_remove_dir(struct kobject *kobj); | 183 | void sysfs_remove_dir(struct kobject *kobj); |
187 | int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, | 184 | int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, |
@@ -255,12 +252,6 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) | |||
255 | 252 | ||
256 | #else /* CONFIG_SYSFS */ | 253 | #else /* CONFIG_SYSFS */ |
257 | 254 | ||
258 | static inline int sysfs_schedule_callback(struct kobject *kobj, | ||
259 | void (*func)(void *), void *data, struct module *owner) | ||
260 | { | ||
261 | return -ENOSYS; | ||
262 | } | ||
263 | |||
264 | static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) | 255 | static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) |
265 | { | 256 | { |
266 | return 0; | 257 | return 0; |
diff --git a/include/linux/wait.h b/include/linux/wait.h index e7d9d9ed14f5..bd68819f0815 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -191,11 +191,23 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
191 | (!__builtin_constant_p(state) || \ | 191 | (!__builtin_constant_p(state) || \ |
192 | state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ | 192 | state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ |
193 | 193 | ||
194 | /* | ||
195 | * The below macro ___wait_event() has an explicit shadow of the __ret | ||
196 | * variable when used from the wait_event_*() macros. | ||
197 | * | ||
198 | * This is so that both can use the ___wait_cond_timeout() construct | ||
199 | * to wrap the condition. | ||
200 | * | ||
201 | * The type inconsistency of the wait_event_*() __ret variable is also | ||
202 | * on purpose; we use long where we can return timeout values and int | ||
203 | * otherwise. | ||
204 | */ | ||
205 | |||
194 | #define ___wait_event(wq, condition, state, exclusive, ret, cmd) \ | 206 | #define ___wait_event(wq, condition, state, exclusive, ret, cmd) \ |
195 | ({ \ | 207 | ({ \ |
196 | __label__ __out; \ | 208 | __label__ __out; \ |
197 | wait_queue_t __wait; \ | 209 | wait_queue_t __wait; \ |
198 | long __ret = ret; \ | 210 | long __ret = ret; /* explicit shadow */ \ |
199 | \ | 211 | \ |
200 | INIT_LIST_HEAD(&__wait.task_list); \ | 212 | INIT_LIST_HEAD(&__wait.task_list); \ |
201 | if (exclusive) \ | 213 | if (exclusive) \ |
diff --git a/include/net/dst.h b/include/net/dst.h index 46ed958e0c6e..71c60f42be48 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -45,7 +45,7 @@ struct dst_entry { | |||
45 | void *__pad1; | 45 | void *__pad1; |
46 | #endif | 46 | #endif |
47 | int (*input)(struct sk_buff *); | 47 | int (*input)(struct sk_buff *); |
48 | int (*output)(struct sk_buff *); | 48 | int (*output)(struct sock *sk, struct sk_buff *skb); |
49 | 49 | ||
50 | unsigned short flags; | 50 | unsigned short flags; |
51 | #define DST_HOST 0x0001 | 51 | #define DST_HOST 0x0001 |
@@ -367,7 +367,11 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) | |||
367 | return child; | 367 | return child; |
368 | } | 368 | } |
369 | 369 | ||
370 | int dst_discard(struct sk_buff *skb); | 370 | int dst_discard_sk(struct sock *sk, struct sk_buff *skb); |
371 | static inline int dst_discard(struct sk_buff *skb) | ||
372 | { | ||
373 | return dst_discard_sk(skb->sk, skb); | ||
374 | } | ||
371 | void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref, | 375 | void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref, |
372 | int initial_obsolete, unsigned short flags); | 376 | int initial_obsolete, unsigned short flags); |
373 | void __dst_free(struct dst_entry *dst); | 377 | void __dst_free(struct dst_entry *dst); |
@@ -449,9 +453,13 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout) | |||
449 | } | 453 | } |
450 | 454 | ||
451 | /* Output packet to network from transport. */ | 455 | /* Output packet to network from transport. */ |
456 | static inline int dst_output_sk(struct sock *sk, struct sk_buff *skb) | ||
457 | { | ||
458 | return skb_dst(skb)->output(sk, skb); | ||
459 | } | ||
452 | static inline int dst_output(struct sk_buff *skb) | 460 | static inline int dst_output(struct sk_buff *skb) |
453 | { | 461 | { |
454 | return skb_dst(skb)->output(skb); | 462 | return dst_output_sk(skb->sk, skb); |
455 | } | 463 | } |
456 | 464 | ||
457 | /* Input packet from network to transport. */ | 465 | /* Input packet from network to transport. */ |
diff --git a/include/net/flow.h b/include/net/flow.h index 64fd24836650..8109a159d1b3 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -11,6 +11,14 @@ | |||
11 | #include <linux/in6.h> | 11 | #include <linux/in6.h> |
12 | #include <linux/atomic.h> | 12 | #include <linux/atomic.h> |
13 | 13 | ||
14 | /* | ||
15 | * ifindex generation is per-net namespace, and loopback is | ||
16 | * always the 1st device in ns (see net_dev_init), thus any | ||
17 | * loopback device should get ifindex 1 | ||
18 | */ | ||
19 | |||
20 | #define LOOPBACK_IFINDEX 1 | ||
21 | |||
14 | struct flowi_common { | 22 | struct flowi_common { |
15 | int flowic_oif; | 23 | int flowic_oif; |
16 | int flowic_iif; | 24 | int flowic_iif; |
@@ -80,7 +88,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, | |||
80 | __be16 dport, __be16 sport) | 88 | __be16 dport, __be16 sport) |
81 | { | 89 | { |
82 | fl4->flowi4_oif = oif; | 90 | fl4->flowi4_oif = oif; |
83 | fl4->flowi4_iif = 0; | 91 | fl4->flowi4_iif = LOOPBACK_IFINDEX; |
84 | fl4->flowi4_mark = mark; | 92 | fl4->flowi4_mark = mark; |
85 | fl4->flowi4_tos = tos; | 93 | fl4->flowi4_tos = tos; |
86 | fl4->flowi4_scope = scope; | 94 | fl4->flowi4_scope = scope; |
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h index f981ba7adeed..74af137304be 100644 --- a/include/net/inet6_connection_sock.h +++ b/include/net/inet6_connection_sock.h | |||
@@ -40,7 +40,7 @@ void inet6_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, | |||
40 | 40 | ||
41 | void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | 41 | void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); |
42 | 42 | ||
43 | int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); | 43 | int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); |
44 | 44 | ||
45 | struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); | 45 | struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); |
46 | #endif /* _INET6_CONNECTION_SOCK_H */ | 46 | #endif /* _INET6_CONNECTION_SOCK_H */ |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index c55aeed41ace..7a4313887568 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -36,7 +36,7 @@ struct tcp_congestion_ops; | |||
36 | * (i.e. things that depend on the address family) | 36 | * (i.e. things that depend on the address family) |
37 | */ | 37 | */ |
38 | struct inet_connection_sock_af_ops { | 38 | struct inet_connection_sock_af_ops { |
39 | int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl); | 39 | int (*queue_xmit)(struct sock *sk, struct sk_buff *skb, struct flowi *fl); |
40 | void (*send_check)(struct sock *sk, struct sk_buff *skb); | 40 | void (*send_check)(struct sock *sk, struct sk_buff *skb); |
41 | int (*rebuild_header)(struct sock *sk); | 41 | int (*rebuild_header)(struct sock *sk); |
42 | void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb); | 42 | void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb); |
diff --git a/include/net/ip.h b/include/net/ip.h index 25064c28e059..3ec2b0fb9d83 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -104,14 +104,19 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
104 | struct net_device *orig_dev); | 104 | struct net_device *orig_dev); |
105 | int ip_local_deliver(struct sk_buff *skb); | 105 | int ip_local_deliver(struct sk_buff *skb); |
106 | int ip_mr_input(struct sk_buff *skb); | 106 | int ip_mr_input(struct sk_buff *skb); |
107 | int ip_output(struct sk_buff *skb); | 107 | int ip_output(struct sock *sk, struct sk_buff *skb); |
108 | int ip_mc_output(struct sk_buff *skb); | 108 | int ip_mc_output(struct sock *sk, struct sk_buff *skb); |
109 | int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 109 | int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); |
110 | int ip_do_nat(struct sk_buff *skb); | 110 | int ip_do_nat(struct sk_buff *skb); |
111 | void ip_send_check(struct iphdr *ip); | 111 | void ip_send_check(struct iphdr *ip); |
112 | int __ip_local_out(struct sk_buff *skb); | 112 | int __ip_local_out(struct sk_buff *skb); |
113 | int ip_local_out(struct sk_buff *skb); | 113 | int ip_local_out_sk(struct sock *sk, struct sk_buff *skb); |
114 | int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); | 114 | static inline int ip_local_out(struct sk_buff *skb) |
115 | { | ||
116 | return ip_local_out_sk(skb->sk, skb); | ||
117 | } | ||
118 | |||
119 | int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl); | ||
115 | void ip_init(void); | 120 | void ip_init(void); |
116 | int ip_append_data(struct sock *sk, struct flowi4 *fl4, | 121 | int ip_append_data(struct sock *sk, struct flowi4 *fl4, |
117 | int getfrag(void *from, char *to, int offset, int len, | 122 | int getfrag(void *from, char *to, int offset, int len, |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 3c3bb184eb8f..6c4f5eac98e7 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -32,6 +32,11 @@ struct route_info { | |||
32 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 | 32 | #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 |
33 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 | 33 | #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 |
34 | 34 | ||
35 | /* We do not (yet ?) support IPv6 jumbograms (RFC 2675) | ||
36 | * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header | ||
37 | */ | ||
38 | #define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr)) | ||
39 | |||
35 | /* | 40 | /* |
36 | * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate | 41 | * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate |
37 | * between IPV6_ADDR_PREFERENCES socket option values | 42 | * between IPV6_ADDR_PREFERENCES socket option values |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index e77c10405d51..a4daf9eb8562 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -153,7 +153,7 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, | |||
153 | } | 153 | } |
154 | 154 | ||
155 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); | 155 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); |
156 | int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, | 156 | int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, |
157 | __be32 src, __be32 dst, __u8 proto, | 157 | __be32 src, __be32 dst, __u8 proto, |
158 | __u8 tos, __u8 ttl, __be16 df, bool xnet); | 158 | __u8 tos, __u8 ttl, __be16 df, bool xnet); |
159 | 159 | ||
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4f541f11ce63..d640925bc454 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -731,7 +731,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, | |||
731 | * skb processing functions | 731 | * skb processing functions |
732 | */ | 732 | */ |
733 | 733 | ||
734 | int ip6_output(struct sk_buff *skb); | 734 | int ip6_output(struct sock *sk, struct sk_buff *skb); |
735 | int ip6_forward(struct sk_buff *skb); | 735 | int ip6_forward(struct sk_buff *skb); |
736 | int ip6_input(struct sk_buff *skb); | 736 | int ip6_input(struct sk_buff *skb); |
737 | int ip6_mc_input(struct sk_buff *skb); | 737 | int ip6_mc_input(struct sk_buff *skb); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 79387f73f875..5f9eb260990f 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | #include <linux/sysctl.h> | 10 | #include <linux/sysctl.h> |
11 | 11 | ||
12 | #include <net/flow.h> | ||
12 | #include <net/netns/core.h> | 13 | #include <net/netns/core.h> |
13 | #include <net/netns/mib.h> | 14 | #include <net/netns/mib.h> |
14 | #include <net/netns/unix.h> | 15 | #include <net/netns/unix.h> |
@@ -131,14 +132,6 @@ struct net { | |||
131 | atomic_t fnhe_genid; | 132 | atomic_t fnhe_genid; |
132 | }; | 133 | }; |
133 | 134 | ||
134 | /* | ||
135 | * ifindex generation is per-net namespace, and loopback is | ||
136 | * always the 1st device in ns (see net_dev_init), thus any | ||
137 | * loopback device should get ifindex 1 | ||
138 | */ | ||
139 | |||
140 | #define LOOPBACK_IFINDEX 1 | ||
141 | |||
142 | #include <linux/seq_file_net.h> | 135 | #include <linux/seq_file_net.h> |
143 | 136 | ||
144 | /* Init's network namespace */ | 137 | /* Init's network namespace */ |
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h index cf2b7ae2b9d8..a75fc8e27cd6 100644 --- a/include/net/netfilter/nf_tables_core.h +++ b/include/net/netfilter/nf_tables_core.h | |||
@@ -13,6 +13,16 @@ struct nft_cmp_fast_expr { | |||
13 | u8 len; | 13 | u8 len; |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /* Calculate the mask for the nft_cmp_fast expression. On big endian the | ||
17 | * mask needs to include the *upper* bytes when interpreting that data as | ||
18 | * something smaller than the full u32, therefore a cpu_to_le32 is done. | ||
19 | */ | ||
20 | static inline u32 nft_cmp_fast_mask(unsigned int len) | ||
21 | { | ||
22 | return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr, | ||
23 | data) * BITS_PER_BYTE - len)); | ||
24 | } | ||
25 | |||
16 | extern const struct nft_expr_ops nft_cmp_fast_ops; | 26 | extern const struct nft_expr_ops nft_cmp_fast_ops; |
17 | 27 | ||
18 | int nft_cmp_module_init(void); | 28 | int nft_cmp_module_init(void); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 6ee76c804893..0dfcc92600e8 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -1241,6 +1241,7 @@ struct sctp_endpoint { | |||
1241 | /* SCTP-AUTH: endpoint shared keys */ | 1241 | /* SCTP-AUTH: endpoint shared keys */ |
1242 | struct list_head endpoint_shared_keys; | 1242 | struct list_head endpoint_shared_keys; |
1243 | __u16 active_key_id; | 1243 | __u16 active_key_id; |
1244 | __u8 auth_enable; | ||
1244 | }; | 1245 | }; |
1245 | 1246 | ||
1246 | /* Recover the outter endpoint structure. */ | 1247 | /* Recover the outter endpoint structure. */ |
@@ -1269,7 +1270,8 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, | |||
1269 | int sctp_has_association(struct net *net, const union sctp_addr *laddr, | 1270 | int sctp_has_association(struct net *net, const union sctp_addr *laddr, |
1270 | const union sctp_addr *paddr); | 1271 | const union sctp_addr *paddr); |
1271 | 1272 | ||
1272 | int sctp_verify_init(struct net *net, const struct sctp_association *asoc, | 1273 | int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, |
1274 | const struct sctp_association *asoc, | ||
1273 | sctp_cid_t, sctp_init_chunk_t *peer_init, | 1275 | sctp_cid_t, sctp_init_chunk_t *peer_init, |
1274 | struct sctp_chunk *chunk, struct sctp_chunk **err_chunk); | 1276 | struct sctp_chunk *chunk, struct sctp_chunk **err_chunk); |
1275 | int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, | 1277 | int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, |
@@ -1653,6 +1655,17 @@ struct sctp_association { | |||
1653 | /* This is the last advertised value of rwnd over a SACK chunk. */ | 1655 | /* This is the last advertised value of rwnd over a SACK chunk. */ |
1654 | __u32 a_rwnd; | 1656 | __u32 a_rwnd; |
1655 | 1657 | ||
1658 | /* Number of bytes by which the rwnd has slopped. The rwnd is allowed | ||
1659 | * to slop over a maximum of the association's frag_point. | ||
1660 | */ | ||
1661 | __u32 rwnd_over; | ||
1662 | |||
1663 | /* Keeps treack of rwnd pressure. This happens when we have | ||
1664 | * a window, but not recevie buffer (i.e small packets). This one | ||
1665 | * is releases slowly (1 PMTU at a time ). | ||
1666 | */ | ||
1667 | __u32 rwnd_press; | ||
1668 | |||
1656 | /* This is the sndbuf size in use for the association. | 1669 | /* This is the sndbuf size in use for the association. |
1657 | * This corresponds to the sndbuf size for the association, | 1670 | * This corresponds to the sndbuf size for the association, |
1658 | * as specified in the sk->sndbuf. | 1671 | * as specified in the sk->sndbuf. |
@@ -1881,7 +1894,8 @@ void sctp_assoc_update(struct sctp_association *old, | |||
1881 | __u32 sctp_association_get_next_tsn(struct sctp_association *); | 1894 | __u32 sctp_association_get_next_tsn(struct sctp_association *); |
1882 | 1895 | ||
1883 | void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *); | 1896 | void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *); |
1884 | void sctp_assoc_rwnd_update(struct sctp_association *, bool); | 1897 | void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); |
1898 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); | ||
1885 | void sctp_assoc_set_primary(struct sctp_association *, | 1899 | void sctp_assoc_set_primary(struct sctp_association *, |
1886 | struct sctp_transport *); | 1900 | struct sctp_transport *); |
1887 | void sctp_assoc_del_nonprimary_peers(struct sctp_association *, | 1901 | void sctp_assoc_del_nonprimary_peers(struct sctp_association *, |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 32682ae47b3f..116e9c7e19cb 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -333,7 +333,7 @@ struct xfrm_state_afinfo { | |||
333 | const xfrm_address_t *saddr); | 333 | const xfrm_address_t *saddr); |
334 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 334 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
335 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 335 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
336 | int (*output)(struct sk_buff *skb); | 336 | int (*output)(struct sock *sk, struct sk_buff *skb); |
337 | int (*output_finish)(struct sk_buff *skb); | 337 | int (*output_finish)(struct sk_buff *skb); |
338 | int (*extract_input)(struct xfrm_state *x, | 338 | int (*extract_input)(struct xfrm_state *x, |
339 | struct sk_buff *skb); | 339 | struct sk_buff *skb); |
@@ -1540,7 +1540,7 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | |||
1540 | 1540 | ||
1541 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1541 | int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1542 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1542 | int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1543 | int xfrm4_output(struct sk_buff *skb); | 1543 | int xfrm4_output(struct sock *sk, struct sk_buff *skb); |
1544 | int xfrm4_output_finish(struct sk_buff *skb); | 1544 | int xfrm4_output_finish(struct sk_buff *skb); |
1545 | int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); | 1545 | int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); |
1546 | int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); | 1546 | int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); |
@@ -1565,7 +1565,7 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); | |||
1565 | __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); | 1565 | __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); |
1566 | int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1566 | int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1567 | int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1567 | int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1568 | int xfrm6_output(struct sk_buff *skb); | 1568 | int xfrm6_output(struct sock *sk, struct sk_buff *skb); |
1569 | int xfrm6_output_finish(struct sk_buff *skb); | 1569 | int xfrm6_output_finish(struct sk_buff *skb); |
1570 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | 1570 | int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, |
1571 | u8 **prevhdr); | 1571 | u8 **prevhdr); |
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h index b042b48495d9..b75482112428 100644 --- a/include/uapi/drm/tegra_drm.h +++ b/include/uapi/drm/tegra_drm.h | |||
@@ -120,7 +120,6 @@ struct drm_tegra_submit { | |||
120 | __u32 num_waitchks; | 120 | __u32 num_waitchks; |
121 | __u32 waitchk_mask; | 121 | __u32 waitchk_mask; |
122 | __u32 timeout; | 122 | __u32 timeout; |
123 | __u32 pad; | ||
124 | __u64 syncpts; | 123 | __u64 syncpts; |
125 | __u64 cmdbufs; | 124 | __u64 cmdbufs; |
126 | __u64 relocs; | 125 | __u64 relocs; |
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h index 9beb7c991638..78e4a86030dd 100644 --- a/include/uapi/linux/hyperv.h +++ b/include/uapi/linux/hyperv.h | |||
@@ -305,6 +305,7 @@ enum hv_kvp_exchg_pool { | |||
305 | #define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F | 305 | #define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F |
306 | #define HV_INVALIDARG 0x80070057 | 306 | #define HV_INVALIDARG 0x80070057 |
307 | #define HV_GUID_NOTFOUND 0x80041002 | 307 | #define HV_GUID_NOTFOUND 0x80041002 |
308 | #define HV_ERROR_ALREADY_EXISTS 0x80070050 | ||
308 | 309 | ||
309 | #define ADDR_FAMILY_NONE 0x00 | 310 | #define ADDR_FAMILY_NONE 0x00 |
310 | #define ADDR_FAMILY_IPV4 0x01 | 311 | #define ADDR_FAMILY_IPV4 0x01 |
diff --git a/init/Kconfig b/init/Kconfig index 765018c24cf9..9d3585bb2a7a 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1646,6 +1646,18 @@ config MMAP_ALLOW_UNINITIALIZED | |||
1646 | 1646 | ||
1647 | See Documentation/nommu-mmap.txt for more information. | 1647 | See Documentation/nommu-mmap.txt for more information. |
1648 | 1648 | ||
1649 | config SYSTEM_TRUSTED_KEYRING | ||
1650 | bool "Provide system-wide ring of trusted keys" | ||
1651 | depends on KEYS | ||
1652 | help | ||
1653 | Provide a system keyring to which trusted keys can be added. Keys in | ||
1654 | the keyring are considered to be trusted. Keys may be added at will | ||
1655 | by the kernel from compiled-in data and from hardware key stores, but | ||
1656 | userspace may only add extra keys if those keys can be verified by | ||
1657 | keys already in the keyring. | ||
1658 | |||
1659 | Keys in this keyring are used by module signature checking. | ||
1660 | |||
1649 | config PROFILING | 1661 | config PROFILING |
1650 | bool "Profiling support" | 1662 | bool "Profiling support" |
1651 | help | 1663 | help |
@@ -1681,18 +1693,6 @@ config BASE_SMALL | |||
1681 | default 0 if BASE_FULL | 1693 | default 0 if BASE_FULL |
1682 | default 1 if !BASE_FULL | 1694 | default 1 if !BASE_FULL |
1683 | 1695 | ||
1684 | config SYSTEM_TRUSTED_KEYRING | ||
1685 | bool "Provide system-wide ring of trusted keys" | ||
1686 | depends on KEYS | ||
1687 | help | ||
1688 | Provide a system keyring to which trusted keys can be added. Keys in | ||
1689 | the keyring are considered to be trusted. Keys may be added at will | ||
1690 | by the kernel from compiled-in data and from hardware key stores, but | ||
1691 | userspace may only add extra keys if those keys can be verified by | ||
1692 | keys already in the keyring. | ||
1693 | |||
1694 | Keys in this keyring are used by module signature checking. | ||
1695 | |||
1696 | menuconfig MODULES | 1696 | menuconfig MODULES |
1697 | bool "Enable loadable module support" | 1697 | bool "Enable loadable module support" |
1698 | option modules | 1698 | option modules |
diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c index e1191c996c59..5cf6731b98e9 100644 --- a/kernel/locking/mutex-debug.c +++ b/kernel/locking/mutex-debug.c | |||
@@ -71,18 +71,17 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter, | |||
71 | 71 | ||
72 | void debug_mutex_unlock(struct mutex *lock) | 72 | void debug_mutex_unlock(struct mutex *lock) |
73 | { | 73 | { |
74 | if (unlikely(!debug_locks)) | 74 | if (likely(debug_locks)) { |
75 | return; | 75 | DEBUG_LOCKS_WARN_ON(lock->magic != lock); |
76 | 76 | ||
77 | DEBUG_LOCKS_WARN_ON(lock->magic != lock); | 77 | if (!lock->owner) |
78 | DEBUG_LOCKS_WARN_ON(!lock->owner); | ||
79 | else | ||
80 | DEBUG_LOCKS_WARN_ON(lock->owner != current); | ||
78 | 81 | ||
79 | if (!lock->owner) | 82 | DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next); |
80 | DEBUG_LOCKS_WARN_ON(!lock->owner); | 83 | mutex_clear_owner(lock); |
81 | else | 84 | } |
82 | DEBUG_LOCKS_WARN_ON(lock->owner != current); | ||
83 | |||
84 | DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next); | ||
85 | mutex_clear_owner(lock); | ||
86 | 85 | ||
87 | /* | 86 | /* |
88 | * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug | 87 | * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 27ef40925525..b08095786cb8 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -1021,8 +1021,17 @@ struct task_struct *pick_next_task_dl(struct rq *rq, struct task_struct *prev) | |||
1021 | 1021 | ||
1022 | dl_rq = &rq->dl; | 1022 | dl_rq = &rq->dl; |
1023 | 1023 | ||
1024 | if (need_pull_dl_task(rq, prev)) | 1024 | if (need_pull_dl_task(rq, prev)) { |
1025 | pull_dl_task(rq); | 1025 | pull_dl_task(rq); |
1026 | /* | ||
1027 | * pull_rt_task() can drop (and re-acquire) rq->lock; this | ||
1028 | * means a stop task can slip in, in which case we need to | ||
1029 | * re-start task selection. | ||
1030 | */ | ||
1031 | if (rq->stop && rq->stop->on_rq) | ||
1032 | return RETRY_TASK; | ||
1033 | } | ||
1034 | |||
1026 | /* | 1035 | /* |
1027 | * When prev is DL, we may throttle it in put_prev_task(). | 1036 | * When prev is DL, we may throttle it in put_prev_task(). |
1028 | * So, we update time before we check for dl_nr_running. | 1037 | * So, we update time before we check for dl_nr_running. |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7e9bd0b1fa9e..7570dd969c28 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -1497,7 +1497,7 @@ static void task_numa_placement(struct task_struct *p) | |||
1497 | /* If the task is part of a group prevent parallel updates to group stats */ | 1497 | /* If the task is part of a group prevent parallel updates to group stats */ |
1498 | if (p->numa_group) { | 1498 | if (p->numa_group) { |
1499 | group_lock = &p->numa_group->lock; | 1499 | group_lock = &p->numa_group->lock; |
1500 | spin_lock(group_lock); | 1500 | spin_lock_irq(group_lock); |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | /* Find the node with the highest number of faults */ | 1503 | /* Find the node with the highest number of faults */ |
@@ -1572,7 +1572,7 @@ static void task_numa_placement(struct task_struct *p) | |||
1572 | } | 1572 | } |
1573 | } | 1573 | } |
1574 | 1574 | ||
1575 | spin_unlock(group_lock); | 1575 | spin_unlock_irq(group_lock); |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | /* Preferred node as the node with the most faults */ | 1578 | /* Preferred node as the node with the most faults */ |
@@ -1677,7 +1677,8 @@ static void task_numa_group(struct task_struct *p, int cpupid, int flags, | |||
1677 | if (!join) | 1677 | if (!join) |
1678 | return; | 1678 | return; |
1679 | 1679 | ||
1680 | double_lock(&my_grp->lock, &grp->lock); | 1680 | BUG_ON(irqs_disabled()); |
1681 | double_lock_irq(&my_grp->lock, &grp->lock); | ||
1681 | 1682 | ||
1682 | for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++) { | 1683 | for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++) { |
1683 | my_grp->faults[i] -= p->numa_faults_memory[i]; | 1684 | my_grp->faults[i] -= p->numa_faults_memory[i]; |
@@ -1691,7 +1692,7 @@ static void task_numa_group(struct task_struct *p, int cpupid, int flags, | |||
1691 | grp->nr_tasks++; | 1692 | grp->nr_tasks++; |
1692 | 1693 | ||
1693 | spin_unlock(&my_grp->lock); | 1694 | spin_unlock(&my_grp->lock); |
1694 | spin_unlock(&grp->lock); | 1695 | spin_unlock_irq(&grp->lock); |
1695 | 1696 | ||
1696 | rcu_assign_pointer(p->numa_group, grp); | 1697 | rcu_assign_pointer(p->numa_group, grp); |
1697 | 1698 | ||
@@ -1710,14 +1711,14 @@ void task_numa_free(struct task_struct *p) | |||
1710 | void *numa_faults = p->numa_faults_memory; | 1711 | void *numa_faults = p->numa_faults_memory; |
1711 | 1712 | ||
1712 | if (grp) { | 1713 | if (grp) { |
1713 | spin_lock(&grp->lock); | 1714 | spin_lock_irq(&grp->lock); |
1714 | for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++) | 1715 | for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++) |
1715 | grp->faults[i] -= p->numa_faults_memory[i]; | 1716 | grp->faults[i] -= p->numa_faults_memory[i]; |
1716 | grp->total_faults -= p->total_numa_faults; | 1717 | grp->total_faults -= p->total_numa_faults; |
1717 | 1718 | ||
1718 | list_del(&p->numa_entry); | 1719 | list_del(&p->numa_entry); |
1719 | grp->nr_tasks--; | 1720 | grp->nr_tasks--; |
1720 | spin_unlock(&grp->lock); | 1721 | spin_unlock_irq(&grp->lock); |
1721 | rcu_assign_pointer(p->numa_group, NULL); | 1722 | rcu_assign_pointer(p->numa_group, NULL); |
1722 | put_numa_group(grp); | 1723 | put_numa_group(grp); |
1723 | } | 1724 | } |
@@ -6727,7 +6728,8 @@ static int idle_balance(struct rq *this_rq) | |||
6727 | out: | 6728 | out: |
6728 | /* Is there a task of a high priority class? */ | 6729 | /* Is there a task of a high priority class? */ |
6729 | if (this_rq->nr_running != this_rq->cfs.h_nr_running && | 6730 | if (this_rq->nr_running != this_rq->cfs.h_nr_running && |
6730 | (this_rq->dl.dl_nr_running || | 6731 | ((this_rq->stop && this_rq->stop->on_rq) || |
6732 | this_rq->dl.dl_nr_running || | ||
6731 | (this_rq->rt.rt_nr_running && !rt_rq_throttled(&this_rq->rt)))) | 6733 | (this_rq->rt.rt_nr_running && !rt_rq_throttled(&this_rq->rt)))) |
6732 | pulled_task = -1; | 6734 | pulled_task = -1; |
6733 | 6735 | ||
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index d8cdf1618551..bd2267ad404f 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -1362,10 +1362,11 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev) | |||
1362 | pull_rt_task(rq); | 1362 | pull_rt_task(rq); |
1363 | /* | 1363 | /* |
1364 | * pull_rt_task() can drop (and re-acquire) rq->lock; this | 1364 | * pull_rt_task() can drop (and re-acquire) rq->lock; this |
1365 | * means a dl task can slip in, in which case we need to | 1365 | * means a dl or stop task can slip in, in which case we need |
1366 | * re-start task selection. | 1366 | * to re-start task selection. |
1367 | */ | 1367 | */ |
1368 | if (unlikely(rq->dl.dl_nr_running)) | 1368 | if (unlikely((rq->stop && rq->stop->on_rq) || |
1369 | rq->dl.dl_nr_running)) | ||
1369 | return RETRY_TASK; | 1370 | return RETRY_TASK; |
1370 | } | 1371 | } |
1371 | 1372 | ||
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index c9007f28d3a2..456e492a3dca 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1385,6 +1385,15 @@ static inline void double_lock(spinlock_t *l1, spinlock_t *l2) | |||
1385 | spin_lock_nested(l2, SINGLE_DEPTH_NESTING); | 1385 | spin_lock_nested(l2, SINGLE_DEPTH_NESTING); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | static inline void double_lock_irq(spinlock_t *l1, spinlock_t *l2) | ||
1389 | { | ||
1390 | if (l1 > l2) | ||
1391 | swap(l1, l2); | ||
1392 | |||
1393 | spin_lock_irq(l1); | ||
1394 | spin_lock_nested(l2, SINGLE_DEPTH_NESTING); | ||
1395 | } | ||
1396 | |||
1388 | static inline void double_raw_lock(raw_spinlock_t *l1, raw_spinlock_t *l2) | 1397 | static inline void double_raw_lock(raw_spinlock_t *l1, raw_spinlock_t *l2) |
1389 | { | 1398 | { |
1390 | if (l1 > l2) | 1399 | if (l1 > l2) |
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index d8d046c0726a..b35c21503a36 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c | |||
@@ -69,18 +69,17 @@ static void populate_seccomp_data(struct seccomp_data *sd) | |||
69 | { | 69 | { |
70 | struct task_struct *task = current; | 70 | struct task_struct *task = current; |
71 | struct pt_regs *regs = task_pt_regs(task); | 71 | struct pt_regs *regs = task_pt_regs(task); |
72 | unsigned long args[6]; | ||
72 | 73 | ||
73 | sd->nr = syscall_get_nr(task, regs); | 74 | sd->nr = syscall_get_nr(task, regs); |
74 | sd->arch = syscall_get_arch(); | 75 | sd->arch = syscall_get_arch(); |
75 | 76 | syscall_get_arguments(task, regs, 0, 6, args); | |
76 | /* Unroll syscall_get_args to help gcc on arm. */ | 77 | sd->args[0] = args[0]; |
77 | syscall_get_arguments(task, regs, 0, 1, (unsigned long *) &sd->args[0]); | 78 | sd->args[1] = args[1]; |
78 | syscall_get_arguments(task, regs, 1, 1, (unsigned long *) &sd->args[1]); | 79 | sd->args[2] = args[2]; |
79 | syscall_get_arguments(task, regs, 2, 1, (unsigned long *) &sd->args[2]); | 80 | sd->args[3] = args[3]; |
80 | syscall_get_arguments(task, regs, 3, 1, (unsigned long *) &sd->args[3]); | 81 | sd->args[4] = args[4]; |
81 | syscall_get_arguments(task, regs, 4, 1, (unsigned long *) &sd->args[4]); | 82 | sd->args[5] = args[5]; |
82 | syscall_get_arguments(task, regs, 5, 1, (unsigned long *) &sd->args[5]); | ||
83 | |||
84 | sd->instruction_pointer = KSTK_EIP(task); | 83 | sd->instruction_pointer = KSTK_EIP(task); |
85 | } | 84 | } |
86 | 85 | ||
@@ -256,6 +255,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) | |||
256 | goto free_prog; | 255 | goto free_prog; |
257 | 256 | ||
258 | /* Allocate a new seccomp_filter */ | 257 | /* Allocate a new seccomp_filter */ |
258 | ret = -ENOMEM; | ||
259 | filter = kzalloc(sizeof(struct seccomp_filter) + | 259 | filter = kzalloc(sizeof(struct seccomp_filter) + |
260 | sizeof(struct sock_filter_int) * new_len, | 260 | sizeof(struct sock_filter_int) * new_len, |
261 | GFP_KERNEL|__GFP_NOWARN); | 261 | GFP_KERNEL|__GFP_NOWARN); |
@@ -265,6 +265,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) | |||
265 | ret = sk_convert_filter(fp, fprog->len, filter->insnsi, &new_len); | 265 | ret = sk_convert_filter(fp, fprog->len, filter->insnsi, &new_len); |
266 | if (ret) | 266 | if (ret) |
267 | goto free_filter; | 267 | goto free_filter; |
268 | kfree(fp); | ||
268 | 269 | ||
269 | atomic_set(&filter->usage, 1); | 270 | atomic_set(&filter->usage, 1); |
270 | filter->len = new_len; | 271 | filter->len = new_len; |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 015661279b68..0a0608edeb26 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -276,7 +276,7 @@ static bool tick_check_preferred(struct clock_event_device *curdev, | |||
276 | bool tick_check_replacement(struct clock_event_device *curdev, | 276 | bool tick_check_replacement(struct clock_event_device *curdev, |
277 | struct clock_event_device *newdev) | 277 | struct clock_event_device *newdev) |
278 | { | 278 | { |
279 | if (tick_check_percpu(curdev, newdev, smp_processor_id())) | 279 | if (!tick_check_percpu(curdev, newdev, smp_processor_id())) |
280 | return false; | 280 | return false; |
281 | 281 | ||
282 | return tick_check_preferred(curdev, newdev); | 282 | return tick_check_preferred(curdev, newdev); |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 9f8af69c67ec..6558b7ac112d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -84,6 +84,9 @@ static void tick_do_update_jiffies64(ktime_t now) | |||
84 | 84 | ||
85 | /* Keep the tick_next_period variable up to date */ | 85 | /* Keep the tick_next_period variable up to date */ |
86 | tick_next_period = ktime_add(last_jiffies_update, tick_period); | 86 | tick_next_period = ktime_add(last_jiffies_update, tick_period); |
87 | } else { | ||
88 | write_sequnlock(&jiffies_lock); | ||
89 | return; | ||
87 | } | 90 | } |
88 | write_sequnlock(&jiffies_lock); | 91 | write_sequnlock(&jiffies_lock); |
89 | update_wall_time(); | 92 | update_wall_time(); |
@@ -967,7 +970,7 @@ static void tick_nohz_switch_to_nohz(void) | |||
967 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 970 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); |
968 | ktime_t next; | 971 | ktime_t next; |
969 | 972 | ||
970 | if (!tick_nohz_active) | 973 | if (!tick_nohz_enabled) |
971 | return; | 974 | return; |
972 | 975 | ||
973 | local_irq_disable(); | 976 | local_irq_disable(); |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 5b781d2be383..ffd56351b521 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -58,12 +58,16 @@ int ftrace_create_function_files(struct trace_array *tr, | |||
58 | { | 58 | { |
59 | int ret; | 59 | int ret; |
60 | 60 | ||
61 | /* The top level array uses the "global_ops". */ | 61 | /* |
62 | if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL)) { | 62 | * The top level array uses the "global_ops", and the files are |
63 | ret = allocate_ftrace_ops(tr); | 63 | * created on boot up. |
64 | if (ret) | 64 | */ |
65 | return ret; | 65 | if (tr->flags & TRACE_ARRAY_FL_GLOBAL) |
66 | } | 66 | return 0; |
67 | |||
68 | ret = allocate_ftrace_ops(tr); | ||
69 | if (ret) | ||
70 | return ret; | ||
67 | 71 | ||
68 | ftrace_create_filter_files(tr->ops, parent); | 72 | ftrace_create_filter_files(tr->ops, parent); |
69 | 73 | ||
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 930e51462dc8..c082a7441345 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -732,9 +732,15 @@ static int uprobe_buffer_enable(void) | |||
732 | 732 | ||
733 | static void uprobe_buffer_disable(void) | 733 | static void uprobe_buffer_disable(void) |
734 | { | 734 | { |
735 | int cpu; | ||
736 | |||
735 | BUG_ON(!mutex_is_locked(&event_mutex)); | 737 | BUG_ON(!mutex_is_locked(&event_mutex)); |
736 | 738 | ||
737 | if (--uprobe_buffer_refcnt == 0) { | 739 | if (--uprobe_buffer_refcnt == 0) { |
740 | for_each_possible_cpu(cpu) | ||
741 | free_page((unsigned long)per_cpu_ptr(uprobe_cpu_buffer, | ||
742 | cpu)->buf); | ||
743 | |||
738 | free_percpu(uprobe_cpu_buffer); | 744 | free_percpu(uprobe_cpu_buffer); |
739 | uprobe_cpu_buffer = NULL; | 745 | uprobe_cpu_buffer = NULL; |
740 | } | 746 | } |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 0d8f6023fd8d..bf71b4b2d632 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -152,7 +152,7 @@ static u32 map_id_range_down(struct uid_gid_map *map, u32 id, u32 count) | |||
152 | 152 | ||
153 | /* Find the matching extent */ | 153 | /* Find the matching extent */ |
154 | extents = map->nr_extents; | 154 | extents = map->nr_extents; |
155 | smp_read_barrier_depends(); | 155 | smp_rmb(); |
156 | for (idx = 0; idx < extents; idx++) { | 156 | for (idx = 0; idx < extents; idx++) { |
157 | first = map->extent[idx].first; | 157 | first = map->extent[idx].first; |
158 | last = first + map->extent[idx].count - 1; | 158 | last = first + map->extent[idx].count - 1; |
@@ -176,7 +176,7 @@ static u32 map_id_down(struct uid_gid_map *map, u32 id) | |||
176 | 176 | ||
177 | /* Find the matching extent */ | 177 | /* Find the matching extent */ |
178 | extents = map->nr_extents; | 178 | extents = map->nr_extents; |
179 | smp_read_barrier_depends(); | 179 | smp_rmb(); |
180 | for (idx = 0; idx < extents; idx++) { | 180 | for (idx = 0; idx < extents; idx++) { |
181 | first = map->extent[idx].first; | 181 | first = map->extent[idx].first; |
182 | last = first + map->extent[idx].count - 1; | 182 | last = first + map->extent[idx].count - 1; |
@@ -199,7 +199,7 @@ static u32 map_id_up(struct uid_gid_map *map, u32 id) | |||
199 | 199 | ||
200 | /* Find the matching extent */ | 200 | /* Find the matching extent */ |
201 | extents = map->nr_extents; | 201 | extents = map->nr_extents; |
202 | smp_read_barrier_depends(); | 202 | smp_rmb(); |
203 | for (idx = 0; idx < extents; idx++) { | 203 | for (idx = 0; idx < extents; idx++) { |
204 | first = map->extent[idx].lower_first; | 204 | first = map->extent[idx].lower_first; |
205 | last = first + map->extent[idx].count - 1; | 205 | last = first + map->extent[idx].count - 1; |
@@ -615,9 +615,8 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
615 | * were written before the count of the extents. | 615 | * were written before the count of the extents. |
616 | * | 616 | * |
617 | * To achieve this smp_wmb() is used on guarantee the write | 617 | * To achieve this smp_wmb() is used on guarantee the write |
618 | * order and smp_read_barrier_depends() is guaranteed that we | 618 | * order and smp_rmb() is guaranteed that we don't have crazy |
619 | * don't have crazy architectures returning stale data. | 619 | * architectures returning stale data. |
620 | * | ||
621 | */ | 620 | */ |
622 | mutex_lock(&id_map_mutex); | 621 | mutex_lock(&id_map_mutex); |
623 | 622 | ||
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index e90089fd78e0..516203e665fc 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -138,7 +138,11 @@ static void __touch_watchdog(void) | |||
138 | 138 | ||
139 | void touch_softlockup_watchdog(void) | 139 | void touch_softlockup_watchdog(void) |
140 | { | 140 | { |
141 | __this_cpu_write(watchdog_touch_ts, 0); | 141 | /* |
142 | * Preemption can be enabled. It doesn't matter which CPU's timestamp | ||
143 | * gets zeroed here, so use the raw_ operation. | ||
144 | */ | ||
145 | raw_cpu_write(watchdog_touch_ts, 0); | ||
142 | } | 146 | } |
143 | EXPORT_SYMBOL(touch_softlockup_watchdog); | 147 | EXPORT_SYMBOL(touch_softlockup_watchdog); |
144 | 148 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 140b66a874c1..819ac51202c0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -505,8 +505,7 @@ config DEBUG_VM_RB | |||
505 | bool "Debug VM red-black trees" | 505 | bool "Debug VM red-black trees" |
506 | depends on DEBUG_VM | 506 | depends on DEBUG_VM |
507 | help | 507 | help |
508 | Enable this to turn on more extended checks in the virtual-memory | 508 | Enable VM red-black tree debugging information and extra validations. |
509 | system that may impact performance. | ||
510 | 509 | ||
511 | If unsure, say N. | 510 | If unsure, say N. |
512 | 511 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index a82fbe4c9e8e..5020b280a771 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2581,7 +2581,6 @@ EXPORT_SYMBOL(generic_perform_write); | |||
2581 | * @iocb: IO state structure (file, offset, etc.) | 2581 | * @iocb: IO state structure (file, offset, etc.) |
2582 | * @iov: vector with data to write | 2582 | * @iov: vector with data to write |
2583 | * @nr_segs: number of segments in the vector | 2583 | * @nr_segs: number of segments in the vector |
2584 | * @ppos: position where to write | ||
2585 | * | 2584 | * |
2586 | * This function does all the work needed for actually writing data to a | 2585 | * This function does all the work needed for actually writing data to a |
2587 | * file. It does all basic checks, removes SUID from the file, updates | 2586 | * file. It does all basic checks, removes SUID from the file, updates |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 64635f5278ff..b4b1feba6472 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1536,16 +1536,23 @@ pmd_t *page_check_address_pmd(struct page *page, | |||
1536 | enum page_check_address_pmd_flag flag, | 1536 | enum page_check_address_pmd_flag flag, |
1537 | spinlock_t **ptl) | 1537 | spinlock_t **ptl) |
1538 | { | 1538 | { |
1539 | pgd_t *pgd; | ||
1540 | pud_t *pud; | ||
1539 | pmd_t *pmd; | 1541 | pmd_t *pmd; |
1540 | 1542 | ||
1541 | if (address & ~HPAGE_PMD_MASK) | 1543 | if (address & ~HPAGE_PMD_MASK) |
1542 | return NULL; | 1544 | return NULL; |
1543 | 1545 | ||
1544 | pmd = mm_find_pmd(mm, address); | 1546 | pgd = pgd_offset(mm, address); |
1545 | if (!pmd) | 1547 | if (!pgd_present(*pgd)) |
1546 | return NULL; | 1548 | return NULL; |
1549 | pud = pud_offset(pgd, address); | ||
1550 | if (!pud_present(*pud)) | ||
1551 | return NULL; | ||
1552 | pmd = pmd_offset(pud, address); | ||
1553 | |||
1547 | *ptl = pmd_lock(mm, pmd); | 1554 | *ptl = pmd_lock(mm, pmd); |
1548 | if (pmd_none(*pmd)) | 1555 | if (!pmd_present(*pmd)) |
1549 | goto unlock; | 1556 | goto unlock; |
1550 | if (pmd_page(*pmd) != page) | 1557 | if (pmd_page(*pmd) != page) |
1551 | goto unlock; | 1558 | goto unlock; |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dd30f22b35e0..246192929a2d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -1172,6 +1172,7 @@ static void return_unused_surplus_pages(struct hstate *h, | |||
1172 | while (nr_pages--) { | 1172 | while (nr_pages--) { |
1173 | if (!free_pool_huge_page(h, &node_states[N_MEMORY], 1)) | 1173 | if (!free_pool_huge_page(h, &node_states[N_MEMORY], 1)) |
1174 | break; | 1174 | break; |
1175 | cond_resched_lock(&hugetlb_lock); | ||
1175 | } | 1176 | } |
1176 | } | 1177 | } |
1177 | 1178 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 9b6497eda806..3f56c8deb3c0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1158,7 +1158,7 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, | |||
1158 | TTU_UNMAP|TTU_IGNORE_ACCESS, | 1158 | TTU_UNMAP|TTU_IGNORE_ACCESS, |
1159 | &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, true); | 1159 | &dummy1, &dummy2, &dummy3, &dummy4, &dummy5, true); |
1160 | list_splice(&clean_pages, page_list); | 1160 | list_splice(&clean_pages, page_list); |
1161 | __mod_zone_page_state(zone, NR_ISOLATED_FILE, -ret); | 1161 | mod_zone_page_state(zone, NR_ISOLATED_FILE, -ret); |
1162 | return ret; | 1162 | return ret; |
1163 | } | 1163 | } |
1164 | 1164 | ||
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 6f142f03716d..733ec283ed1b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -493,10 +493,48 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) | |||
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | static int vlan_calculate_locking_subclass(struct net_device *real_dev) | ||
497 | { | ||
498 | int subclass = 0; | ||
499 | |||
500 | while (is_vlan_dev(real_dev)) { | ||
501 | subclass++; | ||
502 | real_dev = vlan_dev_priv(real_dev)->real_dev; | ||
503 | } | ||
504 | |||
505 | return subclass; | ||
506 | } | ||
507 | |||
508 | static void vlan_dev_mc_sync(struct net_device *to, struct net_device *from) | ||
509 | { | ||
510 | int err = 0, subclass; | ||
511 | |||
512 | subclass = vlan_calculate_locking_subclass(to); | ||
513 | |||
514 | spin_lock_nested(&to->addr_list_lock, subclass); | ||
515 | err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); | ||
516 | if (!err) | ||
517 | __dev_set_rx_mode(to); | ||
518 | spin_unlock(&to->addr_list_lock); | ||
519 | } | ||
520 | |||
521 | static void vlan_dev_uc_sync(struct net_device *to, struct net_device *from) | ||
522 | { | ||
523 | int err = 0, subclass; | ||
524 | |||
525 | subclass = vlan_calculate_locking_subclass(to); | ||
526 | |||
527 | spin_lock_nested(&to->addr_list_lock, subclass); | ||
528 | err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); | ||
529 | if (!err) | ||
530 | __dev_set_rx_mode(to); | ||
531 | spin_unlock(&to->addr_list_lock); | ||
532 | } | ||
533 | |||
496 | static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) | 534 | static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) |
497 | { | 535 | { |
498 | dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); | 536 | vlan_dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); |
499 | dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); | 537 | vlan_dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); |
500 | } | 538 | } |
501 | 539 | ||
502 | /* | 540 | /* |
@@ -608,9 +646,7 @@ static int vlan_dev_init(struct net_device *dev) | |||
608 | 646 | ||
609 | SET_NETDEV_DEVTYPE(dev, &vlan_type); | 647 | SET_NETDEV_DEVTYPE(dev, &vlan_type); |
610 | 648 | ||
611 | if (is_vlan_dev(real_dev)) | 649 | subclass = vlan_calculate_locking_subclass(dev); |
612 | subclass = 1; | ||
613 | |||
614 | vlan_dev_set_lockdep_class(dev, subclass); | 650 | vlan_dev_set_lockdep_class(dev, subclass); |
615 | 651 | ||
616 | vlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats); | 652 | vlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats); |
diff --git a/net/core/dev.c b/net/core/dev.c index 14dac0654f28..d2c8a06b3a98 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2284,7 +2284,7 @@ EXPORT_SYMBOL(skb_checksum_help); | |||
2284 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) | 2284 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) |
2285 | { | 2285 | { |
2286 | __be16 type = skb->protocol; | 2286 | __be16 type = skb->protocol; |
2287 | int vlan_depth = ETH_HLEN; | 2287 | int vlan_depth = skb->mac_len; |
2288 | 2288 | ||
2289 | /* Tunnel gso handlers can set protocol to ethernet. */ | 2289 | /* Tunnel gso handlers can set protocol to ethernet. */ |
2290 | if (type == htons(ETH_P_TEB)) { | 2290 | if (type == htons(ETH_P_TEB)) { |
@@ -5238,6 +5238,7 @@ void __dev_set_rx_mode(struct net_device *dev) | |||
5238 | if (ops->ndo_set_rx_mode) | 5238 | if (ops->ndo_set_rx_mode) |
5239 | ops->ndo_set_rx_mode(dev); | 5239 | ops->ndo_set_rx_mode(dev); |
5240 | } | 5240 | } |
5241 | EXPORT_SYMBOL(__dev_set_rx_mode); | ||
5241 | 5242 | ||
5242 | void dev_set_rx_mode(struct net_device *dev) | 5243 | void dev_set_rx_mode(struct net_device *dev) |
5243 | { | 5244 | { |
diff --git a/net/core/dst.c b/net/core/dst.c index ca4231ec7347..80d6286c8b62 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -142,12 +142,12 @@ loop: | |||
142 | mutex_unlock(&dst_gc_mutex); | 142 | mutex_unlock(&dst_gc_mutex); |
143 | } | 143 | } |
144 | 144 | ||
145 | int dst_discard(struct sk_buff *skb) | 145 | int dst_discard_sk(struct sock *sk, struct sk_buff *skb) |
146 | { | 146 | { |
147 | kfree_skb(skb); | 147 | kfree_skb(skb); |
148 | return 0; | 148 | return 0; |
149 | } | 149 | } |
150 | EXPORT_SYMBOL(dst_discard); | 150 | EXPORT_SYMBOL(dst_discard_sk); |
151 | 151 | ||
152 | const u32 dst_default_metrics[RTAX_MAX + 1] = { | 152 | const u32 dst_default_metrics[RTAX_MAX + 1] = { |
153 | /* This initializer is needed to force linker to place this variable | 153 | /* This initializer is needed to force linker to place this variable |
@@ -184,7 +184,7 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev, | |||
184 | dst->xfrm = NULL; | 184 | dst->xfrm = NULL; |
185 | #endif | 185 | #endif |
186 | dst->input = dst_discard; | 186 | dst->input = dst_discard; |
187 | dst->output = dst_discard; | 187 | dst->output = dst_discard_sk; |
188 | dst->error = 0; | 188 | dst->error = 0; |
189 | dst->obsolete = initial_obsolete; | 189 | dst->obsolete = initial_obsolete; |
190 | dst->header_len = 0; | 190 | dst->header_len = 0; |
@@ -209,8 +209,10 @@ static void ___dst_free(struct dst_entry *dst) | |||
209 | /* The first case (dev==NULL) is required, when | 209 | /* The first case (dev==NULL) is required, when |
210 | protocol module is unloaded. | 210 | protocol module is unloaded. |
211 | */ | 211 | */ |
212 | if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) | 212 | if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { |
213 | dst->input = dst->output = dst_discard; | 213 | dst->input = dst_discard; |
214 | dst->output = dst_discard_sk; | ||
215 | } | ||
214 | dst->obsolete = DST_OBSOLETE_DEAD; | 216 | dst->obsolete = DST_OBSOLETE_DEAD; |
215 | } | 217 | } |
216 | 218 | ||
@@ -361,7 +363,8 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
361 | return; | 363 | return; |
362 | 364 | ||
363 | if (!unregister) { | 365 | if (!unregister) { |
364 | dst->input = dst->output = dst_discard; | 366 | dst->input = dst_discard; |
367 | dst->output = dst_discard_sk; | ||
365 | } else { | 368 | } else { |
366 | dst->dev = dev_net(dst->dev)->loopback_dev; | 369 | dst->dev = dev_net(dst->dev)->loopback_dev; |
367 | dev_hold(dst->dev); | 370 | dev_hold(dst->dev); |
diff --git a/net/core/filter.c b/net/core/filter.c index e08b3822c72a..cd58614660cf 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -600,6 +600,9 @@ static u64 __skb_get_nlattr(u64 ctx, u64 A, u64 X, u64 r4, u64 r5) | |||
600 | if (skb_is_nonlinear(skb)) | 600 | if (skb_is_nonlinear(skb)) |
601 | return 0; | 601 | return 0; |
602 | 602 | ||
603 | if (skb->len < sizeof(struct nlattr)) | ||
604 | return 0; | ||
605 | |||
603 | if (A > skb->len - sizeof(struct nlattr)) | 606 | if (A > skb->len - sizeof(struct nlattr)) |
604 | return 0; | 607 | return 0; |
605 | 608 | ||
@@ -618,11 +621,14 @@ static u64 __skb_get_nlattr_nest(u64 ctx, u64 A, u64 X, u64 r4, u64 r5) | |||
618 | if (skb_is_nonlinear(skb)) | 621 | if (skb_is_nonlinear(skb)) |
619 | return 0; | 622 | return 0; |
620 | 623 | ||
624 | if (skb->len < sizeof(struct nlattr)) | ||
625 | return 0; | ||
626 | |||
621 | if (A > skb->len - sizeof(struct nlattr)) | 627 | if (A > skb->len - sizeof(struct nlattr)) |
622 | return 0; | 628 | return 0; |
623 | 629 | ||
624 | nla = (struct nlattr *) &skb->data[A]; | 630 | nla = (struct nlattr *) &skb->data[A]; |
625 | if (nla->nla_len > A - skb->len) | 631 | if (nla->nla_len > skb->len - A) |
626 | return 0; | 632 | return 0; |
627 | 633 | ||
628 | nla = nla_find_nested(nla, X); | 634 | nla = nla_find_nested(nla, X); |
@@ -1737,7 +1743,6 @@ void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to) | |||
1737 | [BPF_S_ANC_RXHASH] = BPF_LD|BPF_B|BPF_ABS, | 1743 | [BPF_S_ANC_RXHASH] = BPF_LD|BPF_B|BPF_ABS, |
1738 | [BPF_S_ANC_CPU] = BPF_LD|BPF_B|BPF_ABS, | 1744 | [BPF_S_ANC_CPU] = BPF_LD|BPF_B|BPF_ABS, |
1739 | [BPF_S_ANC_ALU_XOR_X] = BPF_LD|BPF_B|BPF_ABS, | 1745 | [BPF_S_ANC_ALU_XOR_X] = BPF_LD|BPF_B|BPF_ABS, |
1740 | [BPF_S_ANC_SECCOMP_LD_W] = BPF_LD|BPF_B|BPF_ABS, | ||
1741 | [BPF_S_ANC_VLAN_TAG] = BPF_LD|BPF_B|BPF_ABS, | 1746 | [BPF_S_ANC_VLAN_TAG] = BPF_LD|BPF_B|BPF_ABS, |
1742 | [BPF_S_ANC_VLAN_TAG_PRESENT] = BPF_LD|BPF_B|BPF_ABS, | 1747 | [BPF_S_ANC_VLAN_TAG_PRESENT] = BPF_LD|BPF_B|BPF_ABS, |
1743 | [BPF_S_ANC_PAY_OFFSET] = BPF_LD|BPF_B|BPF_ABS, | 1748 | [BPF_S_ANC_PAY_OFFSET] = BPF_LD|BPF_B|BPF_ABS, |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 8876078859da..0248e8a3460c 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -138,7 +138,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
138 | 138 | ||
139 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); | 139 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); |
140 | 140 | ||
141 | err = icsk->icsk_af_ops->queue_xmit(skb, &inet->cork.fl); | 141 | err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); |
142 | return net_xmit_eval(err); | 142 | return net_xmit_eval(err); |
143 | } | 143 | } |
144 | return -ENOBUFS; | 144 | return -ENOBUFS; |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index ce0cbbfe0f43..daccc4a36d80 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -752,7 +752,7 @@ static int dn_to_neigh_output(struct sk_buff *skb) | |||
752 | return n->output(n, skb); | 752 | return n->output(n, skb); |
753 | } | 753 | } |
754 | 754 | ||
755 | static int dn_output(struct sk_buff *skb) | 755 | static int dn_output(struct sock *sk, struct sk_buff *skb) |
756 | { | 756 | { |
757 | struct dst_entry *dst = skb_dst(skb); | 757 | struct dst_entry *dst = skb_dst(skb); |
758 | struct dn_route *rt = (struct dn_route *)dst; | 758 | struct dn_route *rt = (struct dn_route *)dst; |
@@ -838,6 +838,18 @@ drop: | |||
838 | * Used to catch bugs. This should never normally get | 838 | * Used to catch bugs. This should never normally get |
839 | * called. | 839 | * called. |
840 | */ | 840 | */ |
841 | static int dn_rt_bug_sk(struct sock *sk, struct sk_buff *skb) | ||
842 | { | ||
843 | struct dn_skb_cb *cb = DN_SKB_CB(skb); | ||
844 | |||
845 | net_dbg_ratelimited("dn_rt_bug: skb from:%04x to:%04x\n", | ||
846 | le16_to_cpu(cb->src), le16_to_cpu(cb->dst)); | ||
847 | |||
848 | kfree_skb(skb); | ||
849 | |||
850 | return NET_RX_DROP; | ||
851 | } | ||
852 | |||
841 | static int dn_rt_bug(struct sk_buff *skb) | 853 | static int dn_rt_bug(struct sk_buff *skb) |
842 | { | 854 | { |
843 | struct dn_skb_cb *cb = DN_SKB_CB(skb); | 855 | struct dn_skb_cb *cb = DN_SKB_CB(skb); |
@@ -1463,7 +1475,7 @@ make_route: | |||
1463 | 1475 | ||
1464 | rt->n = neigh; | 1476 | rt->n = neigh; |
1465 | rt->dst.lastuse = jiffies; | 1477 | rt->dst.lastuse = jiffies; |
1466 | rt->dst.output = dn_rt_bug; | 1478 | rt->dst.output = dn_rt_bug_sk; |
1467 | switch (res.type) { | 1479 | switch (res.type) { |
1468 | case RTN_UNICAST: | 1480 | case RTN_UNICAST: |
1469 | rt->dst.input = dn_forward; | 1481 | rt->dst.input = dn_forward; |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 1a629f870274..255aa9946fe7 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -250,7 +250,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, | |||
250 | bool dev_match; | 250 | bool dev_match; |
251 | 251 | ||
252 | fl4.flowi4_oif = 0; | 252 | fl4.flowi4_oif = 0; |
253 | fl4.flowi4_iif = oif; | 253 | fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX; |
254 | fl4.daddr = src; | 254 | fl4.daddr = src; |
255 | fl4.saddr = dst; | 255 | fl4.saddr = dst; |
256 | fl4.flowi4_tos = tos; | 256 | fl4.flowi4_tos = tos; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index b53f0bf84dca..8a043f03c88e 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -631,6 +631,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | |||
631 | .daddr = nh->nh_gw, | 631 | .daddr = nh->nh_gw, |
632 | .flowi4_scope = cfg->fc_scope + 1, | 632 | .flowi4_scope = cfg->fc_scope + 1, |
633 | .flowi4_oif = nh->nh_oif, | 633 | .flowi4_oif = nh->nh_oif, |
634 | .flowi4_iif = LOOPBACK_IFINDEX, | ||
634 | }; | 635 | }; |
635 | 636 | ||
636 | /* It is not necessary, but requires a bit of thinking */ | 637 | /* It is not necessary, but requires a bit of thinking */ |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 1a0755fea491..1cbeba5edff9 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -101,17 +101,17 @@ int __ip_local_out(struct sk_buff *skb) | |||
101 | skb_dst(skb)->dev, dst_output); | 101 | skb_dst(skb)->dev, dst_output); |
102 | } | 102 | } |
103 | 103 | ||
104 | int ip_local_out(struct sk_buff *skb) | 104 | int ip_local_out_sk(struct sock *sk, struct sk_buff *skb) |
105 | { | 105 | { |
106 | int err; | 106 | int err; |
107 | 107 | ||
108 | err = __ip_local_out(skb); | 108 | err = __ip_local_out(skb); |
109 | if (likely(err == 1)) | 109 | if (likely(err == 1)) |
110 | err = dst_output(skb); | 110 | err = dst_output_sk(sk, skb); |
111 | 111 | ||
112 | return err; | 112 | return err; |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(ip_local_out); | 114 | EXPORT_SYMBOL_GPL(ip_local_out_sk); |
115 | 115 | ||
116 | static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) | 116 | static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) |
117 | { | 117 | { |
@@ -226,9 +226,8 @@ static int ip_finish_output(struct sk_buff *skb) | |||
226 | return ip_finish_output2(skb); | 226 | return ip_finish_output2(skb); |
227 | } | 227 | } |
228 | 228 | ||
229 | int ip_mc_output(struct sk_buff *skb) | 229 | int ip_mc_output(struct sock *sk, struct sk_buff *skb) |
230 | { | 230 | { |
231 | struct sock *sk = skb->sk; | ||
232 | struct rtable *rt = skb_rtable(skb); | 231 | struct rtable *rt = skb_rtable(skb); |
233 | struct net_device *dev = rt->dst.dev; | 232 | struct net_device *dev = rt->dst.dev; |
234 | 233 | ||
@@ -287,7 +286,7 @@ int ip_mc_output(struct sk_buff *skb) | |||
287 | !(IPCB(skb)->flags & IPSKB_REROUTED)); | 286 | !(IPCB(skb)->flags & IPSKB_REROUTED)); |
288 | } | 287 | } |
289 | 288 | ||
290 | int ip_output(struct sk_buff *skb) | 289 | int ip_output(struct sock *sk, struct sk_buff *skb) |
291 | { | 290 | { |
292 | struct net_device *dev = skb_dst(skb)->dev; | 291 | struct net_device *dev = skb_dst(skb)->dev; |
293 | 292 | ||
@@ -315,9 +314,9 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) | |||
315 | sizeof(fl4->saddr) + sizeof(fl4->daddr)); | 314 | sizeof(fl4->saddr) + sizeof(fl4->daddr)); |
316 | } | 315 | } |
317 | 316 | ||
318 | int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl) | 317 | /* Note: skb->sk can be different from sk, in case of tunnels */ |
318 | int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl) | ||
319 | { | 319 | { |
320 | struct sock *sk = skb->sk; | ||
321 | struct inet_sock *inet = inet_sk(sk); | 320 | struct inet_sock *inet = inet_sk(sk); |
322 | struct ip_options_rcu *inet_opt; | 321 | struct ip_options_rcu *inet_opt; |
323 | struct flowi4 *fl4; | 322 | struct flowi4 *fl4; |
@@ -389,6 +388,7 @@ packet_routed: | |||
389 | ip_select_ident_more(skb, &rt->dst, sk, | 388 | ip_select_ident_more(skb, &rt->dst, sk, |
390 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | 389 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
391 | 390 | ||
391 | /* TODO : should we use skb->sk here instead of sk ? */ | ||
392 | skb->priority = sk->sk_priority; | 392 | skb->priority = sk->sk_priority; |
393 | skb->mark = sk->sk_mark; | 393 | skb->mark = sk->sk_mark; |
394 | 394 | ||
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index e77381d1df9a..fa5b7519765f 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -670,7 +670,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |||
670 | return; | 670 | return; |
671 | } | 671 | } |
672 | 672 | ||
673 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol, | 673 | err = iptunnel_xmit(skb->sk, rt, skb, fl4.saddr, fl4.daddr, protocol, |
674 | tos, ttl, df, !net_eq(tunnel->net, dev_net(dev))); | 674 | tos, ttl, df, !net_eq(tunnel->net, dev_net(dev))); |
675 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); | 675 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); |
676 | 676 | ||
@@ -722,19 +722,18 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn, | |||
722 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd) | 722 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd) |
723 | { | 723 | { |
724 | int err = 0; | 724 | int err = 0; |
725 | struct ip_tunnel *t; | 725 | struct ip_tunnel *t = netdev_priv(dev); |
726 | struct net *net = dev_net(dev); | 726 | struct net *net = t->net; |
727 | struct ip_tunnel *tunnel = netdev_priv(dev); | 727 | struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id); |
728 | struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id); | ||
729 | 728 | ||
730 | BUG_ON(!itn->fb_tunnel_dev); | 729 | BUG_ON(!itn->fb_tunnel_dev); |
731 | switch (cmd) { | 730 | switch (cmd) { |
732 | case SIOCGETTUNNEL: | 731 | case SIOCGETTUNNEL: |
733 | t = NULL; | 732 | if (dev == itn->fb_tunnel_dev) { |
734 | if (dev == itn->fb_tunnel_dev) | ||
735 | t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); | 733 | t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); |
736 | if (t == NULL) | 734 | if (t == NULL) |
737 | t = netdev_priv(dev); | 735 | t = netdev_priv(dev); |
736 | } | ||
738 | memcpy(p, &t->parms, sizeof(*p)); | 737 | memcpy(p, &t->parms, sizeof(*p)); |
739 | break; | 738 | break; |
740 | 739 | ||
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index e0c2b1d2ea4e..bcf206c79005 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <net/netns/generic.h> | 46 | #include <net/netns/generic.h> |
47 | #include <net/rtnetlink.h> | 47 | #include <net/rtnetlink.h> |
48 | 48 | ||
49 | int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, | 49 | int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, |
50 | __be32 src, __be32 dst, __u8 proto, | 50 | __be32 src, __be32 dst, __u8 proto, |
51 | __u8 tos, __u8 ttl, __be16 df, bool xnet) | 51 | __u8 tos, __u8 ttl, __be16 df, bool xnet) |
52 | { | 52 | { |
@@ -76,7 +76,7 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, | |||
76 | iph->ttl = ttl; | 76 | iph->ttl = ttl; |
77 | __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); | 77 | __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
78 | 78 | ||
79 | err = ip_local_out(skb); | 79 | err = ip_local_out_sk(sk, skb); |
80 | if (unlikely(net_xmit_eval(err))) | 80 | if (unlikely(net_xmit_eval(err))) |
81 | pkt_len = 0; | 81 | pkt_len = 0; |
82 | return pkt_len; | 82 | return pkt_len; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 28863570dd60..d84dc8d4c916 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -455,7 +455,7 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) | |||
455 | struct mr_table *mrt; | 455 | struct mr_table *mrt; |
456 | struct flowi4 fl4 = { | 456 | struct flowi4 fl4 = { |
457 | .flowi4_oif = dev->ifindex, | 457 | .flowi4_oif = dev->ifindex, |
458 | .flowi4_iif = skb->skb_iif, | 458 | .flowi4_iif = skb->skb_iif ? : LOOPBACK_IFINDEX, |
459 | .flowi4_mark = skb->mark, | 459 | .flowi4_mark = skb->mark, |
460 | }; | 460 | }; |
461 | int err; | 461 | int err; |
diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c index c49dcd0284a0..4bfaedf9b34e 100644 --- a/net/ipv4/netfilter/ipt_rpfilter.c +++ b/net/ipv4/netfilter/ipt_rpfilter.c | |||
@@ -89,11 +89,8 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
89 | if (ipv4_is_multicast(iph->daddr)) { | 89 | if (ipv4_is_multicast(iph->daddr)) { |
90 | if (ipv4_is_zeronet(iph->saddr)) | 90 | if (ipv4_is_zeronet(iph->saddr)) |
91 | return ipv4_is_local_multicast(iph->daddr) ^ invert; | 91 | return ipv4_is_local_multicast(iph->daddr) ^ invert; |
92 | flow.flowi4_iif = 0; | ||
93 | } else { | ||
94 | flow.flowi4_iif = LOOPBACK_IFINDEX; | ||
95 | } | 92 | } |
96 | 93 | flow.flowi4_iif = LOOPBACK_IFINDEX; | |
97 | flow.daddr = iph->saddr; | 94 | flow.daddr = iph->saddr; |
98 | flow.saddr = rpfilter_get_saddr(iph->daddr); | 95 | flow.saddr = rpfilter_get_saddr(iph->daddr); |
99 | flow.flowi4_oif = 0; | 96 | flow.flowi4_oif = 0; |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index f4b19e5dde54..8210964a9f19 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -252,26 +252,33 @@ int ping_init_sock(struct sock *sk) | |||
252 | { | 252 | { |
253 | struct net *net = sock_net(sk); | 253 | struct net *net = sock_net(sk); |
254 | kgid_t group = current_egid(); | 254 | kgid_t group = current_egid(); |
255 | struct group_info *group_info = get_current_groups(); | 255 | struct group_info *group_info; |
256 | int i, j, count = group_info->ngroups; | 256 | int i, j, count; |
257 | kgid_t low, high; | 257 | kgid_t low, high; |
258 | int ret = 0; | ||
258 | 259 | ||
259 | inet_get_ping_group_range_net(net, &low, &high); | 260 | inet_get_ping_group_range_net(net, &low, &high); |
260 | if (gid_lte(low, group) && gid_lte(group, high)) | 261 | if (gid_lte(low, group) && gid_lte(group, high)) |
261 | return 0; | 262 | return 0; |
262 | 263 | ||
264 | group_info = get_current_groups(); | ||
265 | count = group_info->ngroups; | ||
263 | for (i = 0; i < group_info->nblocks; i++) { | 266 | for (i = 0; i < group_info->nblocks; i++) { |
264 | int cp_count = min_t(int, NGROUPS_PER_BLOCK, count); | 267 | int cp_count = min_t(int, NGROUPS_PER_BLOCK, count); |
265 | for (j = 0; j < cp_count; j++) { | 268 | for (j = 0; j < cp_count; j++) { |
266 | kgid_t gid = group_info->blocks[i][j]; | 269 | kgid_t gid = group_info->blocks[i][j]; |
267 | if (gid_lte(low, gid) && gid_lte(gid, high)) | 270 | if (gid_lte(low, gid) && gid_lte(gid, high)) |
268 | return 0; | 271 | goto out_release_group; |
269 | } | 272 | } |
270 | 273 | ||
271 | count -= cp_count; | 274 | count -= cp_count; |
272 | } | 275 | } |
273 | 276 | ||
274 | return -EACCES; | 277 | ret = -EACCES; |
278 | |||
279 | out_release_group: | ||
280 | put_group_info(group_info); | ||
281 | return ret; | ||
275 | } | 282 | } |
276 | EXPORT_SYMBOL_GPL(ping_init_sock); | 283 | EXPORT_SYMBOL_GPL(ping_init_sock); |
277 | 284 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 34d094cadb11..db1e0da871f4 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1129,7 +1129,7 @@ static void ipv4_link_failure(struct sk_buff *skb) | |||
1129 | dst_set_expires(&rt->dst, 0); | 1129 | dst_set_expires(&rt->dst, 0); |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | static int ip_rt_bug(struct sk_buff *skb) | 1132 | static int ip_rt_bug(struct sock *sk, struct sk_buff *skb) |
1133 | { | 1133 | { |
1134 | pr_debug("%s: %pI4 -> %pI4, %s\n", | 1134 | pr_debug("%s: %pI4 -> %pI4, %s\n", |
1135 | __func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, | 1135 | __func__, &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, |
@@ -1700,8 +1700,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1700 | 1700 | ||
1701 | if (res.type == RTN_LOCAL) { | 1701 | if (res.type == RTN_LOCAL) { |
1702 | err = fib_validate_source(skb, saddr, daddr, tos, | 1702 | err = fib_validate_source(skb, saddr, daddr, tos, |
1703 | LOOPBACK_IFINDEX, | 1703 | 0, dev, in_dev, &itag); |
1704 | dev, in_dev, &itag); | ||
1705 | if (err < 0) | 1704 | if (err < 0) |
1706 | goto martian_source_keep_err; | 1705 | goto martian_source_keep_err; |
1707 | goto local_input; | 1706 | goto local_input; |
@@ -2218,7 +2217,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or | |||
2218 | 2217 | ||
2219 | new->__use = 1; | 2218 | new->__use = 1; |
2220 | new->input = dst_discard; | 2219 | new->input = dst_discard; |
2221 | new->output = dst_discard; | 2220 | new->output = dst_discard_sk; |
2222 | 2221 | ||
2223 | new->dev = ort->dst.dev; | 2222 | new->dev = ort->dst.dev; |
2224 | if (new->dev) | 2223 | if (new->dev) |
@@ -2357,7 +2356,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, | |||
2357 | } | 2356 | } |
2358 | } else | 2357 | } else |
2359 | #endif | 2358 | #endif |
2360 | if (nla_put_u32(skb, RTA_IIF, rt->rt_iif)) | 2359 | if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex)) |
2361 | goto nla_put_failure; | 2360 | goto nla_put_failure; |
2362 | } | 2361 | } |
2363 | 2362 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 699fb102e971..025e25093984 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -981,7 +981,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
981 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, | 981 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, |
982 | tcp_skb_pcount(skb)); | 982 | tcp_skb_pcount(skb)); |
983 | 983 | ||
984 | err = icsk->icsk_af_ops->queue_xmit(skb, &inet->cork.fl); | 984 | err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); |
985 | if (likely(err <= 0)) | 985 | if (likely(err <= 0)) |
986 | return err; | 986 | return err; |
987 | 987 | ||
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index baa0f63731fd..40e701f2e1e0 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -86,7 +86,7 @@ int xfrm4_output_finish(struct sk_buff *skb) | |||
86 | return xfrm_output(skb); | 86 | return xfrm_output(skb); |
87 | } | 87 | } |
88 | 88 | ||
89 | int xfrm4_output(struct sk_buff *skb) | 89 | int xfrm4_output(struct sock *sk, struct sk_buff *skb) |
90 | { | 90 | { |
91 | struct dst_entry *dst = skb_dst(skb); | 91 | struct dst_entry *dst = skb_dst(skb); |
92 | struct xfrm_state *x = dst->xfrm; | 92 | struct xfrm_state *x = dst->xfrm; |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index c9138189415a..d4ade34ab375 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -224,9 +224,8 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk, | |||
224 | return dst; | 224 | return dst; |
225 | } | 225 | } |
226 | 226 | ||
227 | int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused) | 227 | int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused) |
228 | { | 228 | { |
229 | struct sock *sk = skb->sk; | ||
230 | struct ipv6_pinfo *np = inet6_sk(sk); | 229 | struct ipv6_pinfo *np = inet6_sk(sk); |
231 | struct flowi6 fl6; | 230 | struct flowi6 fl6; |
232 | struct dst_entry *dst; | 231 | struct dst_entry *dst; |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index c98338b81d30..9d921462b57f 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1559,6 +1559,15 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], | |||
1559 | return 0; | 1559 | return 0; |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | static void ip6gre_dellink(struct net_device *dev, struct list_head *head) | ||
1563 | { | ||
1564 | struct net *net = dev_net(dev); | ||
1565 | struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); | ||
1566 | |||
1567 | if (dev != ign->fb_tunnel_dev) | ||
1568 | unregister_netdevice_queue(dev, head); | ||
1569 | } | ||
1570 | |||
1562 | static size_t ip6gre_get_size(const struct net_device *dev) | 1571 | static size_t ip6gre_get_size(const struct net_device *dev) |
1563 | { | 1572 | { |
1564 | return | 1573 | return |
@@ -1636,6 +1645,7 @@ static struct rtnl_link_ops ip6gre_link_ops __read_mostly = { | |||
1636 | .validate = ip6gre_tunnel_validate, | 1645 | .validate = ip6gre_tunnel_validate, |
1637 | .newlink = ip6gre_newlink, | 1646 | .newlink = ip6gre_newlink, |
1638 | .changelink = ip6gre_changelink, | 1647 | .changelink = ip6gre_changelink, |
1648 | .dellink = ip6gre_dellink, | ||
1639 | .get_size = ip6gre_get_size, | 1649 | .get_size = ip6gre_get_size, |
1640 | .fill_info = ip6gre_fill_info, | 1650 | .fill_info = ip6gre_fill_info, |
1641 | }; | 1651 | }; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 3284d61577c0..40e7581374f7 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -132,7 +132,7 @@ static int ip6_finish_output(struct sk_buff *skb) | |||
132 | return ip6_finish_output2(skb); | 132 | return ip6_finish_output2(skb); |
133 | } | 133 | } |
134 | 134 | ||
135 | int ip6_output(struct sk_buff *skb) | 135 | int ip6_output(struct sock *sk, struct sk_buff *skb) |
136 | { | 136 | { |
137 | struct net_device *dev = skb_dst(skb)->dev; | 137 | struct net_device *dev = skb_dst(skb)->dev; |
138 | struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); | 138 | struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index e1df691d78be..b05b609f69d1 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1340,8 +1340,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1340 | int err = 0; | 1340 | int err = 0; |
1341 | struct ip6_tnl_parm p; | 1341 | struct ip6_tnl_parm p; |
1342 | struct __ip6_tnl_parm p1; | 1342 | struct __ip6_tnl_parm p1; |
1343 | struct ip6_tnl *t = NULL; | 1343 | struct ip6_tnl *t = netdev_priv(dev); |
1344 | struct net *net = dev_net(dev); | 1344 | struct net *net = t->net; |
1345 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1345 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
1346 | 1346 | ||
1347 | switch (cmd) { | 1347 | switch (cmd) { |
@@ -1353,11 +1353,11 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1353 | } | 1353 | } |
1354 | ip6_tnl_parm_from_user(&p1, &p); | 1354 | ip6_tnl_parm_from_user(&p1, &p); |
1355 | t = ip6_tnl_locate(net, &p1, 0); | 1355 | t = ip6_tnl_locate(net, &p1, 0); |
1356 | if (t == NULL) | ||
1357 | t = netdev_priv(dev); | ||
1356 | } else { | 1358 | } else { |
1357 | memset(&p, 0, sizeof(p)); | 1359 | memset(&p, 0, sizeof(p)); |
1358 | } | 1360 | } |
1359 | if (t == NULL) | ||
1360 | t = netdev_priv(dev); | ||
1361 | ip6_tnl_parm_to_user(&p, &t->parms); | 1361 | ip6_tnl_parm_to_user(&p, &t->parms); |
1362 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { | 1362 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { |
1363 | err = -EFAULT; | 1363 | err = -EFAULT; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 8737400af0a0..8659067da28e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -700,7 +700,7 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, | |||
700 | struct mr6_table *mrt; | 700 | struct mr6_table *mrt; |
701 | struct flowi6 fl6 = { | 701 | struct flowi6 fl6 = { |
702 | .flowi6_oif = dev->ifindex, | 702 | .flowi6_oif = dev->ifindex, |
703 | .flowi6_iif = skb->skb_iif, | 703 | .flowi6_iif = skb->skb_iif ? : LOOPBACK_IFINDEX, |
704 | .flowi6_mark = skb->mark, | 704 | .flowi6_mark = skb->mark, |
705 | }; | 705 | }; |
706 | int err; | 706 | int err; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5015c50a5ba7..4011617cca68 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -84,9 +84,9 @@ static void ip6_dst_ifdown(struct dst_entry *, | |||
84 | static int ip6_dst_gc(struct dst_ops *ops); | 84 | static int ip6_dst_gc(struct dst_ops *ops); |
85 | 85 | ||
86 | static int ip6_pkt_discard(struct sk_buff *skb); | 86 | static int ip6_pkt_discard(struct sk_buff *skb); |
87 | static int ip6_pkt_discard_out(struct sk_buff *skb); | 87 | static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb); |
88 | static int ip6_pkt_prohibit(struct sk_buff *skb); | 88 | static int ip6_pkt_prohibit(struct sk_buff *skb); |
89 | static int ip6_pkt_prohibit_out(struct sk_buff *skb); | 89 | static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb); |
90 | static void ip6_link_failure(struct sk_buff *skb); | 90 | static void ip6_link_failure(struct sk_buff *skb); |
91 | static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, | 91 | static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
92 | struct sk_buff *skb, u32 mtu); | 92 | struct sk_buff *skb, u32 mtu); |
@@ -290,7 +290,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = { | |||
290 | .obsolete = DST_OBSOLETE_FORCE_CHK, | 290 | .obsolete = DST_OBSOLETE_FORCE_CHK, |
291 | .error = -EINVAL, | 291 | .error = -EINVAL, |
292 | .input = dst_discard, | 292 | .input = dst_discard, |
293 | .output = dst_discard, | 293 | .output = dst_discard_sk, |
294 | }, | 294 | }, |
295 | .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), | 295 | .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), |
296 | .rt6i_protocol = RTPROT_KERNEL, | 296 | .rt6i_protocol = RTPROT_KERNEL, |
@@ -1058,7 +1058,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori | |||
1058 | 1058 | ||
1059 | new->__use = 1; | 1059 | new->__use = 1; |
1060 | new->input = dst_discard; | 1060 | new->input = dst_discard; |
1061 | new->output = dst_discard; | 1061 | new->output = dst_discard_sk; |
1062 | 1062 | ||
1063 | if (dst_metrics_read_only(&ort->dst)) | 1063 | if (dst_metrics_read_only(&ort->dst)) |
1064 | new->_metrics = ort->dst._metrics; | 1064 | new->_metrics = ort->dst._metrics; |
@@ -1338,7 +1338,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst) | |||
1338 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | 1338 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
1339 | 1339 | ||
1340 | if (mtu) | 1340 | if (mtu) |
1341 | return mtu; | 1341 | goto out; |
1342 | 1342 | ||
1343 | mtu = IPV6_MIN_MTU; | 1343 | mtu = IPV6_MIN_MTU; |
1344 | 1344 | ||
@@ -1348,7 +1348,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst) | |||
1348 | mtu = idev->cnf.mtu6; | 1348 | mtu = idev->cnf.mtu6; |
1349 | rcu_read_unlock(); | 1349 | rcu_read_unlock(); |
1350 | 1350 | ||
1351 | return mtu; | 1351 | out: |
1352 | return min_t(unsigned int, mtu, IP6_MAX_MTU); | ||
1352 | } | 1353 | } |
1353 | 1354 | ||
1354 | static struct dst_entry *icmp6_dst_gc_list; | 1355 | static struct dst_entry *icmp6_dst_gc_list; |
@@ -1576,7 +1577,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1576 | switch (cfg->fc_type) { | 1577 | switch (cfg->fc_type) { |
1577 | case RTN_BLACKHOLE: | 1578 | case RTN_BLACKHOLE: |
1578 | rt->dst.error = -EINVAL; | 1579 | rt->dst.error = -EINVAL; |
1579 | rt->dst.output = dst_discard; | 1580 | rt->dst.output = dst_discard_sk; |
1580 | rt->dst.input = dst_discard; | 1581 | rt->dst.input = dst_discard; |
1581 | break; | 1582 | break; |
1582 | case RTN_PROHIBIT: | 1583 | case RTN_PROHIBIT: |
@@ -2128,7 +2129,7 @@ static int ip6_pkt_discard(struct sk_buff *skb) | |||
2128 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES); | 2129 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES); |
2129 | } | 2130 | } |
2130 | 2131 | ||
2131 | static int ip6_pkt_discard_out(struct sk_buff *skb) | 2132 | static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb) |
2132 | { | 2133 | { |
2133 | skb->dev = skb_dst(skb)->dev; | 2134 | skb->dev = skb_dst(skb)->dev; |
2134 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); | 2135 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); |
@@ -2139,7 +2140,7 @@ static int ip6_pkt_prohibit(struct sk_buff *skb) | |||
2139 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); | 2140 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); |
2140 | } | 2141 | } |
2141 | 2142 | ||
2142 | static int ip6_pkt_prohibit_out(struct sk_buff *skb) | 2143 | static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb) |
2143 | { | 2144 | { |
2144 | skb->dev = skb_dst(skb)->dev; | 2145 | skb->dev = skb_dst(skb)->dev; |
2145 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); | 2146 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 1693c8d885f0..e5a453ca302e 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -974,8 +974,9 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
974 | goto out; | 974 | goto out; |
975 | } | 975 | } |
976 | 976 | ||
977 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos, | 977 | err = iptunnel_xmit(skb->sk, rt, skb, fl4.saddr, fl4.daddr, |
978 | ttl, df, !net_eq(tunnel->net, dev_net(dev))); | 978 | IPPROTO_IPV6, tos, ttl, df, |
979 | !net_eq(tunnel->net, dev_net(dev))); | ||
979 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); | 980 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); |
980 | return NETDEV_TX_OK; | 981 | return NETDEV_TX_OK; |
981 | 982 | ||
@@ -1126,8 +1127,8 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1126 | int err = 0; | 1127 | int err = 0; |
1127 | struct ip_tunnel_parm p; | 1128 | struct ip_tunnel_parm p; |
1128 | struct ip_tunnel_prl prl; | 1129 | struct ip_tunnel_prl prl; |
1129 | struct ip_tunnel *t; | 1130 | struct ip_tunnel *t = netdev_priv(dev); |
1130 | struct net *net = dev_net(dev); | 1131 | struct net *net = t->net; |
1131 | struct sit_net *sitn = net_generic(net, sit_net_id); | 1132 | struct sit_net *sitn = net_generic(net, sit_net_id); |
1132 | #ifdef CONFIG_IPV6_SIT_6RD | 1133 | #ifdef CONFIG_IPV6_SIT_6RD |
1133 | struct ip_tunnel_6rd ip6rd; | 1134 | struct ip_tunnel_6rd ip6rd; |
@@ -1138,16 +1139,15 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1138 | #ifdef CONFIG_IPV6_SIT_6RD | 1139 | #ifdef CONFIG_IPV6_SIT_6RD |
1139 | case SIOCGET6RD: | 1140 | case SIOCGET6RD: |
1140 | #endif | 1141 | #endif |
1141 | t = NULL; | ||
1142 | if (dev == sitn->fb_tunnel_dev) { | 1142 | if (dev == sitn->fb_tunnel_dev) { |
1143 | if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) { | 1143 | if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) { |
1144 | err = -EFAULT; | 1144 | err = -EFAULT; |
1145 | break; | 1145 | break; |
1146 | } | 1146 | } |
1147 | t = ipip6_tunnel_locate(net, &p, 0); | 1147 | t = ipip6_tunnel_locate(net, &p, 0); |
1148 | if (t == NULL) | ||
1149 | t = netdev_priv(dev); | ||
1148 | } | 1150 | } |
1149 | if (t == NULL) | ||
1150 | t = netdev_priv(dev); | ||
1151 | 1151 | ||
1152 | err = -EFAULT; | 1152 | err = -EFAULT; |
1153 | if (cmd == SIOCGETTUNNEL) { | 1153 | if (cmd == SIOCGETTUNNEL) { |
@@ -1243,9 +1243,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1243 | err = -EINVAL; | 1243 | err = -EINVAL; |
1244 | if (dev == sitn->fb_tunnel_dev) | 1244 | if (dev == sitn->fb_tunnel_dev) |
1245 | goto done; | 1245 | goto done; |
1246 | err = -ENOENT; | ||
1247 | if (!(t = netdev_priv(dev))) | ||
1248 | goto done; | ||
1249 | err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data); | 1246 | err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data); |
1250 | break; | 1247 | break; |
1251 | 1248 | ||
@@ -1261,9 +1258,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1261 | err = -EFAULT; | 1258 | err = -EFAULT; |
1262 | if (copy_from_user(&prl, ifr->ifr_ifru.ifru_data, sizeof(prl))) | 1259 | if (copy_from_user(&prl, ifr->ifr_ifru.ifru_data, sizeof(prl))) |
1263 | goto done; | 1260 | goto done; |
1264 | err = -ENOENT; | ||
1265 | if (!(t = netdev_priv(dev))) | ||
1266 | goto done; | ||
1267 | 1261 | ||
1268 | switch (cmd) { | 1262 | switch (cmd) { |
1269 | case SIOCDELPRL: | 1263 | case SIOCDELPRL: |
@@ -1291,8 +1285,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1291 | sizeof(ip6rd))) | 1285 | sizeof(ip6rd))) |
1292 | goto done; | 1286 | goto done; |
1293 | 1287 | ||
1294 | t = netdev_priv(dev); | ||
1295 | |||
1296 | if (cmd != SIOCDEL6RD) { | 1288 | if (cmd != SIOCDEL6RD) { |
1297 | err = ipip6_tunnel_update_6rd(t, &ip6rd); | 1289 | err = ipip6_tunnel_update_6rd(t, &ip6rd); |
1298 | if (err < 0) | 1290 | if (err < 0) |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 6cd625e37706..19ef329bdbf8 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -163,7 +163,7 @@ static int __xfrm6_output(struct sk_buff *skb) | |||
163 | return x->outer_mode->afinfo->output_finish(skb); | 163 | return x->outer_mode->afinfo->output_finish(skb); |
164 | } | 164 | } |
165 | 165 | ||
166 | int xfrm6_output(struct sk_buff *skb) | 166 | int xfrm6_output(struct sock *sk, struct sk_buff *skb) |
167 | { | 167 | { |
168 | return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, | 168 | return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, |
169 | skb_dst(skb)->dev, __xfrm6_output); | 169 | skb_dst(skb)->dev, __xfrm6_output); |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 47f7a5490555..a4e37d7158dc 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1131,10 +1131,10 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, | |||
1131 | skb->local_df = 1; | 1131 | skb->local_df = 1; |
1132 | #if IS_ENABLED(CONFIG_IPV6) | 1132 | #if IS_ENABLED(CONFIG_IPV6) |
1133 | if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped) | 1133 | if (tunnel->sock->sk_family == PF_INET6 && !tunnel->v4mapped) |
1134 | error = inet6_csk_xmit(skb, NULL); | 1134 | error = inet6_csk_xmit(tunnel->sock, skb, NULL); |
1135 | else | 1135 | else |
1136 | #endif | 1136 | #endif |
1137 | error = ip_queue_xmit(skb, fl); | 1137 | error = ip_queue_xmit(tunnel->sock, skb, fl); |
1138 | 1138 | ||
1139 | /* Update stats */ | 1139 | /* Update stats */ |
1140 | if (error >= 0) { | 1140 | if (error >= 0) { |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 0b44d855269c..3397fe6897c0 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -487,7 +487,7 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m | |||
487 | 487 | ||
488 | xmit: | 488 | xmit: |
489 | /* Queue the packet to IP for output */ | 489 | /* Queue the packet to IP for output */ |
490 | rc = ip_queue_xmit(skb, &inet->cork.fl); | 490 | rc = ip_queue_xmit(sk, skb, &inet->cork.fl); |
491 | rcu_read_unlock(); | 491 | rcu_read_unlock(); |
492 | 492 | ||
493 | error: | 493 | error: |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index bd1fd8ea5105..75b5dd2c9267 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -249,7 +249,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local, | |||
249 | 249 | ||
250 | if (!local->use_chanctx) { | 250 | if (!local->use_chanctx) { |
251 | local->_oper_chandef = *chandef; | 251 | local->_oper_chandef = *chandef; |
252 | ieee80211_hw_config(local, 0); | 252 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
253 | } else { | 253 | } else { |
254 | err = drv_add_chanctx(local, ctx); | 254 | err = drv_add_chanctx(local, ctx); |
255 | if (err) { | 255 | if (err) { |
@@ -286,7 +286,7 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, | |||
286 | check_single_channel = true; | 286 | check_single_channel = true; |
287 | local->hw.conf.radar_enabled = false; | 287 | local->hw.conf.radar_enabled = false; |
288 | 288 | ||
289 | ieee80211_hw_config(local, 0); | 289 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
290 | } else { | 290 | } else { |
291 | drv_remove_chanctx(local, ctx); | 291 | drv_remove_chanctx(local, ctx); |
292 | } | 292 | } |
@@ -492,6 +492,13 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, | |||
492 | rx_chains_static = max(rx_chains_static, needed_static); | 492 | rx_chains_static = max(rx_chains_static, needed_static); |
493 | rx_chains_dynamic = max(rx_chains_dynamic, needed_dynamic); | 493 | rx_chains_dynamic = max(rx_chains_dynamic, needed_dynamic); |
494 | } | 494 | } |
495 | |||
496 | /* Disable SMPS for the monitor interface */ | ||
497 | sdata = rcu_dereference(local->monitor_sdata); | ||
498 | if (sdata && | ||
499 | rcu_access_pointer(sdata->vif.chanctx_conf) == &chanctx->conf) | ||
500 | rx_chains_dynamic = rx_chains_static = local->rx_chains; | ||
501 | |||
495 | rcu_read_unlock(); | 502 | rcu_read_unlock(); |
496 | 503 | ||
497 | if (!local->use_chanctx) { | 504 | if (!local->use_chanctx) { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b055f6a55c68..4c1bf61bc778 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -148,6 +148,8 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local) | |||
148 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 148 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
149 | if (!rcu_access_pointer(sdata->vif.chanctx_conf)) | 149 | if (!rcu_access_pointer(sdata->vif.chanctx_conf)) |
150 | continue; | 150 | continue; |
151 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
152 | continue; | ||
151 | power = min(power, sdata->vif.bss_conf.txpower); | 153 | power = min(power, sdata->vif.bss_conf.txpower); |
152 | } | 154 | } |
153 | rcu_read_unlock(); | 155 | rcu_read_unlock(); |
@@ -199,7 +201,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
199 | { | 201 | { |
200 | struct ieee80211_local *local = sdata->local; | 202 | struct ieee80211_local *local = sdata->local; |
201 | 203 | ||
202 | if (!changed) | 204 | if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
203 | return; | 205 | return; |
204 | 206 | ||
205 | drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed); | 207 | drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed); |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index 0c2a29484c07..6fb38558a5e6 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -355,6 +355,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) | |||
355 | struct ieee80211_roc_work *dep; | 355 | struct ieee80211_roc_work *dep; |
356 | 356 | ||
357 | /* start this ROC */ | 357 | /* start this ROC */ |
358 | ieee80211_offchannel_stop_vifs(local); | ||
358 | 359 | ||
359 | /* switch channel etc */ | 360 | /* switch channel etc */ |
360 | ieee80211_recalc_idle(local); | 361 | ieee80211_recalc_idle(local); |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index e6e574a307c8..00ba90b02ab2 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -618,6 +618,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
618 | sta, true, acked); | 618 | sta, true, acked); |
619 | 619 | ||
620 | if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) && | 620 | if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) && |
621 | (ieee80211_is_data(hdr->frame_control)) && | ||
621 | (rates_idx != -1)) | 622 | (rates_idx != -1)) |
622 | sta->last_tx_rate = info->status.rates[rates_idx]; | 623 | sta->last_tx_rate = info->status.rates[rates_idx]; |
623 | 624 | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 6dba48efe01e..75421f2ba8be 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1795,6 +1795,7 @@ int nf_conntrack_init_net(struct net *net) | |||
1795 | int cpu; | 1795 | int cpu; |
1796 | 1796 | ||
1797 | atomic_set(&net->ct.count, 0); | 1797 | atomic_set(&net->ct.count, 0); |
1798 | seqcount_init(&net->ct.generation); | ||
1798 | 1799 | ||
1799 | net->ct.pcpu_lists = alloc_percpu(struct ct_pcpu); | 1800 | net->ct.pcpu_lists = alloc_percpu(struct ct_pcpu); |
1800 | if (!net->ct.pcpu_lists) | 1801 | if (!net->ct.pcpu_lists) |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 7bd03decd36c..825c3e3f8305 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
@@ -605,32 +605,14 @@ static struct nf_conntrack_helper pptp __read_mostly = { | |||
605 | .expect_policy = &pptp_exp_policy, | 605 | .expect_policy = &pptp_exp_policy, |
606 | }; | 606 | }; |
607 | 607 | ||
608 | static void nf_conntrack_pptp_net_exit(struct net *net) | ||
609 | { | ||
610 | nf_ct_gre_keymap_flush(net); | ||
611 | } | ||
612 | |||
613 | static struct pernet_operations nf_conntrack_pptp_net_ops = { | ||
614 | .exit = nf_conntrack_pptp_net_exit, | ||
615 | }; | ||
616 | |||
617 | static int __init nf_conntrack_pptp_init(void) | 608 | static int __init nf_conntrack_pptp_init(void) |
618 | { | 609 | { |
619 | int rv; | 610 | return nf_conntrack_helper_register(&pptp); |
620 | |||
621 | rv = nf_conntrack_helper_register(&pptp); | ||
622 | if (rv < 0) | ||
623 | return rv; | ||
624 | rv = register_pernet_subsys(&nf_conntrack_pptp_net_ops); | ||
625 | if (rv < 0) | ||
626 | nf_conntrack_helper_unregister(&pptp); | ||
627 | return rv; | ||
628 | } | 611 | } |
629 | 612 | ||
630 | static void __exit nf_conntrack_pptp_fini(void) | 613 | static void __exit nf_conntrack_pptp_fini(void) |
631 | { | 614 | { |
632 | nf_conntrack_helper_unregister(&pptp); | 615 | nf_conntrack_helper_unregister(&pptp); |
633 | unregister_pernet_subsys(&nf_conntrack_pptp_net_ops); | ||
634 | } | 616 | } |
635 | 617 | ||
636 | module_init(nf_conntrack_pptp_init); | 618 | module_init(nf_conntrack_pptp_init); |
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index 9d9c0dade602..d5665739e3b1 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
@@ -66,7 +66,7 @@ static inline struct netns_proto_gre *gre_pernet(struct net *net) | |||
66 | return net_generic(net, proto_gre_net_id); | 66 | return net_generic(net, proto_gre_net_id); |
67 | } | 67 | } |
68 | 68 | ||
69 | void nf_ct_gre_keymap_flush(struct net *net) | 69 | static void nf_ct_gre_keymap_flush(struct net *net) |
70 | { | 70 | { |
71 | struct netns_proto_gre *net_gre = gre_pernet(net); | 71 | struct netns_proto_gre *net_gre = gre_pernet(net); |
72 | struct nf_ct_gre_keymap *km, *tmp; | 72 | struct nf_ct_gre_keymap *km, *tmp; |
@@ -78,7 +78,6 @@ void nf_ct_gre_keymap_flush(struct net *net) | |||
78 | } | 78 | } |
79 | write_unlock_bh(&net_gre->keymap_lock); | 79 | write_unlock_bh(&net_gre->keymap_lock); |
80 | } | 80 | } |
81 | EXPORT_SYMBOL(nf_ct_gre_keymap_flush); | ||
82 | 81 | ||
83 | static inline int gre_key_cmpfn(const struct nf_ct_gre_keymap *km, | 82 | static inline int gre_key_cmpfn(const struct nf_ct_gre_keymap *km, |
84 | const struct nf_conntrack_tuple *t) | 83 | const struct nf_conntrack_tuple *t) |
diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index 90998a6ff8b9..804105391b9a 100644 --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c | |||
@@ -25,9 +25,8 @@ static void nft_cmp_fast_eval(const struct nft_expr *expr, | |||
25 | struct nft_data data[NFT_REG_MAX + 1]) | 25 | struct nft_data data[NFT_REG_MAX + 1]) |
26 | { | 26 | { |
27 | const struct nft_cmp_fast_expr *priv = nft_expr_priv(expr); | 27 | const struct nft_cmp_fast_expr *priv = nft_expr_priv(expr); |
28 | u32 mask; | 28 | u32 mask = nft_cmp_fast_mask(priv->len); |
29 | 29 | ||
30 | mask = ~0U >> (sizeof(priv->data) * BITS_PER_BYTE - priv->len); | ||
31 | if ((data[priv->sreg].data[0] & mask) == priv->data) | 30 | if ((data[priv->sreg].data[0] & mask) == priv->data) |
32 | return; | 31 | return; |
33 | data[NFT_REG_VERDICT].verdict = NFT_BREAK; | 32 | data[NFT_REG_VERDICT].verdict = NFT_BREAK; |
diff --git a/net/netfilter/nft_cmp.c b/net/netfilter/nft_cmp.c index 954925db414d..e2b3f51c81f1 100644 --- a/net/netfilter/nft_cmp.c +++ b/net/netfilter/nft_cmp.c | |||
@@ -128,7 +128,7 @@ static int nft_cmp_fast_init(const struct nft_ctx *ctx, | |||
128 | BUG_ON(err < 0); | 128 | BUG_ON(err < 0); |
129 | desc.len *= BITS_PER_BYTE; | 129 | desc.len *= BITS_PER_BYTE; |
130 | 130 | ||
131 | mask = ~0U >> (sizeof(priv->data) * BITS_PER_BYTE - desc.len); | 131 | mask = nft_cmp_fast_mask(desc.len); |
132 | priv->data = data.data[0] & mask; | 132 | priv->data = data.data[0] & mask; |
133 | priv->len = desc.len; | 133 | priv->len = desc.len; |
134 | return 0; | 134 | return 0; |
diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c index a3d6951602db..ebb6e2442554 100644 --- a/net/openvswitch/vport-gre.c +++ b/net/openvswitch/vport-gre.c | |||
@@ -174,7 +174,7 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb) | |||
174 | 174 | ||
175 | skb->local_df = 1; | 175 | skb->local_df = 1; |
176 | 176 | ||
177 | return iptunnel_xmit(rt, skb, fl.saddr, | 177 | return iptunnel_xmit(skb->sk, rt, skb, fl.saddr, |
178 | OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE, | 178 | OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE, |
179 | OVS_CB(skb)->tun_key->ipv4_tos, | 179 | OVS_CB(skb)->tun_key->ipv4_tos, |
180 | OVS_CB(skb)->tun_key->ipv4_ttl, df, false); | 180 | OVS_CB(skb)->tun_key->ipv4_ttl, df, false); |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 4f6d6f9d1274..39579c3e0d14 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -1395,35 +1395,44 @@ static inline bool sctp_peer_needs_update(struct sctp_association *asoc) | |||
1395 | return false; | 1395 | return false; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | /* Update asoc's rwnd for the approximated state in the buffer, | 1398 | /* Increase asoc's rwnd by len and send any window update SACK if needed. */ |
1399 | * and check whether SACK needs to be sent. | 1399 | void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len) |
1400 | */ | ||
1401 | void sctp_assoc_rwnd_update(struct sctp_association *asoc, bool update_peer) | ||
1402 | { | 1400 | { |
1403 | int rx_count; | ||
1404 | struct sctp_chunk *sack; | 1401 | struct sctp_chunk *sack; |
1405 | struct timer_list *timer; | 1402 | struct timer_list *timer; |
1406 | 1403 | ||
1407 | if (asoc->ep->rcvbuf_policy) | 1404 | if (asoc->rwnd_over) { |
1408 | rx_count = atomic_read(&asoc->rmem_alloc); | 1405 | if (asoc->rwnd_over >= len) { |
1409 | else | 1406 | asoc->rwnd_over -= len; |
1410 | rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc); | 1407 | } else { |
1408 | asoc->rwnd += (len - asoc->rwnd_over); | ||
1409 | asoc->rwnd_over = 0; | ||
1410 | } | ||
1411 | } else { | ||
1412 | asoc->rwnd += len; | ||
1413 | } | ||
1411 | 1414 | ||
1412 | if ((asoc->base.sk->sk_rcvbuf - rx_count) > 0) | 1415 | /* If we had window pressure, start recovering it |
1413 | asoc->rwnd = (asoc->base.sk->sk_rcvbuf - rx_count) >> 1; | 1416 | * once our rwnd had reached the accumulated pressure |
1414 | else | 1417 | * threshold. The idea is to recover slowly, but up |
1415 | asoc->rwnd = 0; | 1418 | * to the initial advertised window. |
1419 | */ | ||
1420 | if (asoc->rwnd_press && asoc->rwnd >= asoc->rwnd_press) { | ||
1421 | int change = min(asoc->pathmtu, asoc->rwnd_press); | ||
1422 | asoc->rwnd += change; | ||
1423 | asoc->rwnd_press -= change; | ||
1424 | } | ||
1416 | 1425 | ||
1417 | pr_debug("%s: asoc:%p rwnd=%u, rx_count=%d, sk_rcvbuf=%d\n", | 1426 | pr_debug("%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n", |
1418 | __func__, asoc, asoc->rwnd, rx_count, | 1427 | __func__, asoc, len, asoc->rwnd, asoc->rwnd_over, |
1419 | asoc->base.sk->sk_rcvbuf); | 1428 | asoc->a_rwnd); |
1420 | 1429 | ||
1421 | /* Send a window update SACK if the rwnd has increased by at least the | 1430 | /* Send a window update SACK if the rwnd has increased by at least the |
1422 | * minimum of the association's PMTU and half of the receive buffer. | 1431 | * minimum of the association's PMTU and half of the receive buffer. |
1423 | * The algorithm used is similar to the one described in | 1432 | * The algorithm used is similar to the one described in |
1424 | * Section 4.2.3.3 of RFC 1122. | 1433 | * Section 4.2.3.3 of RFC 1122. |
1425 | */ | 1434 | */ |
1426 | if (update_peer && sctp_peer_needs_update(asoc)) { | 1435 | if (sctp_peer_needs_update(asoc)) { |
1427 | asoc->a_rwnd = asoc->rwnd; | 1436 | asoc->a_rwnd = asoc->rwnd; |
1428 | 1437 | ||
1429 | pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u " | 1438 | pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u " |
@@ -1445,6 +1454,45 @@ void sctp_assoc_rwnd_update(struct sctp_association *asoc, bool update_peer) | |||
1445 | } | 1454 | } |
1446 | } | 1455 | } |
1447 | 1456 | ||
1457 | /* Decrease asoc's rwnd by len. */ | ||
1458 | void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len) | ||
1459 | { | ||
1460 | int rx_count; | ||
1461 | int over = 0; | ||
1462 | |||
1463 | if (unlikely(!asoc->rwnd || asoc->rwnd_over)) | ||
1464 | pr_debug("%s: association:%p has asoc->rwnd:%u, " | ||
1465 | "asoc->rwnd_over:%u!\n", __func__, asoc, | ||
1466 | asoc->rwnd, asoc->rwnd_over); | ||
1467 | |||
1468 | if (asoc->ep->rcvbuf_policy) | ||
1469 | rx_count = atomic_read(&asoc->rmem_alloc); | ||
1470 | else | ||
1471 | rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc); | ||
1472 | |||
1473 | /* If we've reached or overflowed our receive buffer, announce | ||
1474 | * a 0 rwnd if rwnd would still be positive. Store the | ||
1475 | * the potential pressure overflow so that the window can be restored | ||
1476 | * back to original value. | ||
1477 | */ | ||
1478 | if (rx_count >= asoc->base.sk->sk_rcvbuf) | ||
1479 | over = 1; | ||
1480 | |||
1481 | if (asoc->rwnd >= len) { | ||
1482 | asoc->rwnd -= len; | ||
1483 | if (over) { | ||
1484 | asoc->rwnd_press += asoc->rwnd; | ||
1485 | asoc->rwnd = 0; | ||
1486 | } | ||
1487 | } else { | ||
1488 | asoc->rwnd_over = len - asoc->rwnd; | ||
1489 | asoc->rwnd = 0; | ||
1490 | } | ||
1491 | |||
1492 | pr_debug("%s: asoc:%p rwnd decreased by %d to (%u, %u, %u)\n", | ||
1493 | __func__, asoc, len, asoc->rwnd, asoc->rwnd_over, | ||
1494 | asoc->rwnd_press); | ||
1495 | } | ||
1448 | 1496 | ||
1449 | /* Build the bind address list for the association based on info from the | 1497 | /* Build the bind address list for the association based on info from the |
1450 | * local endpoint and the remote peer. | 1498 | * local endpoint and the remote peer. |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 683c7d1b1306..0e8529113dc5 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -386,14 +386,13 @@ nomem: | |||
386 | */ | 386 | */ |
387 | int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) | 387 | int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) |
388 | { | 388 | { |
389 | struct net *net = sock_net(asoc->base.sk); | ||
390 | struct sctp_auth_bytes *secret; | 389 | struct sctp_auth_bytes *secret; |
391 | struct sctp_shared_key *ep_key; | 390 | struct sctp_shared_key *ep_key; |
392 | 391 | ||
393 | /* If we don't support AUTH, or peer is not capable | 392 | /* If we don't support AUTH, or peer is not capable |
394 | * we don't need to do anything. | 393 | * we don't need to do anything. |
395 | */ | 394 | */ |
396 | if (!net->sctp.auth_enable || !asoc->peer.auth_capable) | 395 | if (!asoc->ep->auth_enable || !asoc->peer.auth_capable) |
397 | return 0; | 396 | return 0; |
398 | 397 | ||
399 | /* If the key_id is non-zero and we couldn't find an | 398 | /* If the key_id is non-zero and we couldn't find an |
@@ -440,16 +439,16 @@ struct sctp_shared_key *sctp_auth_get_shkey( | |||
440 | */ | 439 | */ |
441 | int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) | 440 | int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) |
442 | { | 441 | { |
443 | struct net *net = sock_net(ep->base.sk); | ||
444 | struct crypto_hash *tfm = NULL; | 442 | struct crypto_hash *tfm = NULL; |
445 | __u16 id; | 443 | __u16 id; |
446 | 444 | ||
447 | /* if the transforms are already allocted, we are done */ | 445 | /* If AUTH extension is disabled, we are done */ |
448 | if (!net->sctp.auth_enable) { | 446 | if (!ep->auth_enable) { |
449 | ep->auth_hmacs = NULL; | 447 | ep->auth_hmacs = NULL; |
450 | return 0; | 448 | return 0; |
451 | } | 449 | } |
452 | 450 | ||
451 | /* If the transforms are already allocated, we are done */ | ||
453 | if (ep->auth_hmacs) | 452 | if (ep->auth_hmacs) |
454 | return 0; | 453 | return 0; |
455 | 454 | ||
@@ -665,12 +664,10 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param) | |||
665 | /* Check if peer requested that this chunk is authenticated */ | 664 | /* Check if peer requested that this chunk is authenticated */ |
666 | int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) | 665 | int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) |
667 | { | 666 | { |
668 | struct net *net; | ||
669 | if (!asoc) | 667 | if (!asoc) |
670 | return 0; | 668 | return 0; |
671 | 669 | ||
672 | net = sock_net(asoc->base.sk); | 670 | if (!asoc->ep->auth_enable || !asoc->peer.auth_capable) |
673 | if (!net->sctp.auth_enable || !asoc->peer.auth_capable) | ||
674 | return 0; | 671 | return 0; |
675 | 672 | ||
676 | return __sctp_auth_cid(chunk, asoc->peer.peer_chunks); | 673 | return __sctp_auth_cid(chunk, asoc->peer.peer_chunks); |
@@ -679,12 +676,10 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) | |||
679 | /* Check if we requested that peer authenticate this chunk. */ | 676 | /* Check if we requested that peer authenticate this chunk. */ |
680 | int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc) | 677 | int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc) |
681 | { | 678 | { |
682 | struct net *net; | ||
683 | if (!asoc) | 679 | if (!asoc) |
684 | return 0; | 680 | return 0; |
685 | 681 | ||
686 | net = sock_net(asoc->base.sk); | 682 | if (!asoc->ep->auth_enable) |
687 | if (!net->sctp.auth_enable) | ||
688 | return 0; | 683 | return 0; |
689 | 684 | ||
690 | return __sctp_auth_cid(chunk, | 685 | return __sctp_auth_cid(chunk, |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 8e5fdea05216..3d9f429858dc 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -68,7 +68,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
68 | if (!ep->digest) | 68 | if (!ep->digest) |
69 | return NULL; | 69 | return NULL; |
70 | 70 | ||
71 | if (net->sctp.auth_enable) { | 71 | ep->auth_enable = net->sctp.auth_enable; |
72 | if (ep->auth_enable) { | ||
72 | /* Allocate space for HMACS and CHUNKS authentication | 73 | /* Allocate space for HMACS and CHUNKS authentication |
73 | * variables. There are arrays that we encode directly | 74 | * variables. There are arrays that we encode directly |
74 | * into parameters to make the rest of the operations easier. | 75 | * into parameters to make the rest of the operations easier. |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 4e1d0fcb028e..c09757fbf803 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -957,7 +957,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
957 | 957 | ||
958 | SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS); | 958 | SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS); |
959 | 959 | ||
960 | return ip_queue_xmit(skb, &transport->fl); | 960 | return ip_queue_xmit(&inet->sk, skb, &transport->fl); |
961 | } | 961 | } |
962 | 962 | ||
963 | static struct sctp_af sctp_af_inet; | 963 | static struct sctp_af sctp_af_inet; |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 3a1767ef3201..fee5552ddf92 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -219,6 +219,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
219 | gfp_t gfp, int vparam_len) | 219 | gfp_t gfp, int vparam_len) |
220 | { | 220 | { |
221 | struct net *net = sock_net(asoc->base.sk); | 221 | struct net *net = sock_net(asoc->base.sk); |
222 | struct sctp_endpoint *ep = asoc->ep; | ||
222 | sctp_inithdr_t init; | 223 | sctp_inithdr_t init; |
223 | union sctp_params addrs; | 224 | union sctp_params addrs; |
224 | size_t chunksize; | 225 | size_t chunksize; |
@@ -278,7 +279,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
278 | chunksize += vparam_len; | 279 | chunksize += vparam_len; |
279 | 280 | ||
280 | /* Account for AUTH related parameters */ | 281 | /* Account for AUTH related parameters */ |
281 | if (net->sctp.auth_enable) { | 282 | if (ep->auth_enable) { |
282 | /* Add random parameter length*/ | 283 | /* Add random parameter length*/ |
283 | chunksize += sizeof(asoc->c.auth_random); | 284 | chunksize += sizeof(asoc->c.auth_random); |
284 | 285 | ||
@@ -363,7 +364,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
363 | } | 364 | } |
364 | 365 | ||
365 | /* Add SCTP-AUTH chunks to the parameter list */ | 366 | /* Add SCTP-AUTH chunks to the parameter list */ |
366 | if (net->sctp.auth_enable) { | 367 | if (ep->auth_enable) { |
367 | sctp_addto_chunk(retval, sizeof(asoc->c.auth_random), | 368 | sctp_addto_chunk(retval, sizeof(asoc->c.auth_random), |
368 | asoc->c.auth_random); | 369 | asoc->c.auth_random); |
369 | if (auth_hmacs) | 370 | if (auth_hmacs) |
@@ -2010,7 +2011,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc, | |||
2010 | /* if the peer reports AUTH, assume that he | 2011 | /* if the peer reports AUTH, assume that he |
2011 | * supports AUTH. | 2012 | * supports AUTH. |
2012 | */ | 2013 | */ |
2013 | if (net->sctp.auth_enable) | 2014 | if (asoc->ep->auth_enable) |
2014 | asoc->peer.auth_capable = 1; | 2015 | asoc->peer.auth_capable = 1; |
2015 | break; | 2016 | break; |
2016 | case SCTP_CID_ASCONF: | 2017 | case SCTP_CID_ASCONF: |
@@ -2102,6 +2103,7 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, | |||
2102 | * SCTP_IERROR_NO_ERROR - continue with the chunk | 2103 | * SCTP_IERROR_NO_ERROR - continue with the chunk |
2103 | */ | 2104 | */ |
2104 | static sctp_ierror_t sctp_verify_param(struct net *net, | 2105 | static sctp_ierror_t sctp_verify_param(struct net *net, |
2106 | const struct sctp_endpoint *ep, | ||
2105 | const struct sctp_association *asoc, | 2107 | const struct sctp_association *asoc, |
2106 | union sctp_params param, | 2108 | union sctp_params param, |
2107 | sctp_cid_t cid, | 2109 | sctp_cid_t cid, |
@@ -2152,7 +2154,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, | |||
2152 | goto fallthrough; | 2154 | goto fallthrough; |
2153 | 2155 | ||
2154 | case SCTP_PARAM_RANDOM: | 2156 | case SCTP_PARAM_RANDOM: |
2155 | if (!net->sctp.auth_enable) | 2157 | if (!ep->auth_enable) |
2156 | goto fallthrough; | 2158 | goto fallthrough; |
2157 | 2159 | ||
2158 | /* SCTP-AUTH: Secion 6.1 | 2160 | /* SCTP-AUTH: Secion 6.1 |
@@ -2169,7 +2171,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, | |||
2169 | break; | 2171 | break; |
2170 | 2172 | ||
2171 | case SCTP_PARAM_CHUNKS: | 2173 | case SCTP_PARAM_CHUNKS: |
2172 | if (!net->sctp.auth_enable) | 2174 | if (!ep->auth_enable) |
2173 | goto fallthrough; | 2175 | goto fallthrough; |
2174 | 2176 | ||
2175 | /* SCTP-AUTH: Section 3.2 | 2177 | /* SCTP-AUTH: Section 3.2 |
@@ -2185,7 +2187,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, | |||
2185 | break; | 2187 | break; |
2186 | 2188 | ||
2187 | case SCTP_PARAM_HMAC_ALGO: | 2189 | case SCTP_PARAM_HMAC_ALGO: |
2188 | if (!net->sctp.auth_enable) | 2190 | if (!ep->auth_enable) |
2189 | goto fallthrough; | 2191 | goto fallthrough; |
2190 | 2192 | ||
2191 | hmacs = (struct sctp_hmac_algo_param *)param.p; | 2193 | hmacs = (struct sctp_hmac_algo_param *)param.p; |
@@ -2220,10 +2222,9 @@ fallthrough: | |||
2220 | } | 2222 | } |
2221 | 2223 | ||
2222 | /* Verify the INIT packet before we process it. */ | 2224 | /* Verify the INIT packet before we process it. */ |
2223 | int sctp_verify_init(struct net *net, const struct sctp_association *asoc, | 2225 | int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, |
2224 | sctp_cid_t cid, | 2226 | const struct sctp_association *asoc, sctp_cid_t cid, |
2225 | sctp_init_chunk_t *peer_init, | 2227 | sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, |
2226 | struct sctp_chunk *chunk, | ||
2227 | struct sctp_chunk **errp) | 2228 | struct sctp_chunk **errp) |
2228 | { | 2229 | { |
2229 | union sctp_params param; | 2230 | union sctp_params param; |
@@ -2264,8 +2265,8 @@ int sctp_verify_init(struct net *net, const struct sctp_association *asoc, | |||
2264 | 2265 | ||
2265 | /* Verify all the variable length parameters */ | 2266 | /* Verify all the variable length parameters */ |
2266 | sctp_walk_params(param, peer_init, init_hdr.params) { | 2267 | sctp_walk_params(param, peer_init, init_hdr.params) { |
2267 | 2268 | result = sctp_verify_param(net, ep, asoc, param, cid, | |
2268 | result = sctp_verify_param(net, asoc, param, cid, chunk, errp); | 2269 | chunk, errp); |
2269 | switch (result) { | 2270 | switch (result) { |
2270 | case SCTP_IERROR_ABORT: | 2271 | case SCTP_IERROR_ABORT: |
2271 | case SCTP_IERROR_NOMEM: | 2272 | case SCTP_IERROR_NOMEM: |
@@ -2497,6 +2498,7 @@ static int sctp_process_param(struct sctp_association *asoc, | |||
2497 | struct sctp_af *af; | 2498 | struct sctp_af *af; |
2498 | union sctp_addr_param *addr_param; | 2499 | union sctp_addr_param *addr_param; |
2499 | struct sctp_transport *t; | 2500 | struct sctp_transport *t; |
2501 | struct sctp_endpoint *ep = asoc->ep; | ||
2500 | 2502 | ||
2501 | /* We maintain all INIT parameters in network byte order all the | 2503 | /* We maintain all INIT parameters in network byte order all the |
2502 | * time. This allows us to not worry about whether the parameters | 2504 | * time. This allows us to not worry about whether the parameters |
@@ -2636,7 +2638,7 @@ do_addr_param: | |||
2636 | goto fall_through; | 2638 | goto fall_through; |
2637 | 2639 | ||
2638 | case SCTP_PARAM_RANDOM: | 2640 | case SCTP_PARAM_RANDOM: |
2639 | if (!net->sctp.auth_enable) | 2641 | if (!ep->auth_enable) |
2640 | goto fall_through; | 2642 | goto fall_through; |
2641 | 2643 | ||
2642 | /* Save peer's random parameter */ | 2644 | /* Save peer's random parameter */ |
@@ -2649,7 +2651,7 @@ do_addr_param: | |||
2649 | break; | 2651 | break; |
2650 | 2652 | ||
2651 | case SCTP_PARAM_HMAC_ALGO: | 2653 | case SCTP_PARAM_HMAC_ALGO: |
2652 | if (!net->sctp.auth_enable) | 2654 | if (!ep->auth_enable) |
2653 | goto fall_through; | 2655 | goto fall_through; |
2654 | 2656 | ||
2655 | /* Save peer's HMAC list */ | 2657 | /* Save peer's HMAC list */ |
@@ -2665,7 +2667,7 @@ do_addr_param: | |||
2665 | break; | 2667 | break; |
2666 | 2668 | ||
2667 | case SCTP_PARAM_CHUNKS: | 2669 | case SCTP_PARAM_CHUNKS: |
2668 | if (!net->sctp.auth_enable) | 2670 | if (!ep->auth_enable) |
2669 | goto fall_through; | 2671 | goto fall_through; |
2670 | 2672 | ||
2671 | asoc->peer.peer_chunks = kmemdup(param.p, | 2673 | asoc->peer.peer_chunks = kmemdup(param.p, |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 01e002430c85..5170a1ff95a1 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -357,7 +357,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, | |||
357 | 357 | ||
358 | /* Verify the INIT chunk before processing it. */ | 358 | /* Verify the INIT chunk before processing it. */ |
359 | err_chunk = NULL; | 359 | err_chunk = NULL; |
360 | if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, | 360 | if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, |
361 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, | 361 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, |
362 | &err_chunk)) { | 362 | &err_chunk)) { |
363 | /* This chunk contains fatal error. It is to be discarded. | 363 | /* This chunk contains fatal error. It is to be discarded. |
@@ -524,7 +524,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, | |||
524 | 524 | ||
525 | /* Verify the INIT chunk before processing it. */ | 525 | /* Verify the INIT chunk before processing it. */ |
526 | err_chunk = NULL; | 526 | err_chunk = NULL; |
527 | if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, | 527 | if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, |
528 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, | 528 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, |
529 | &err_chunk)) { | 529 | &err_chunk)) { |
530 | 530 | ||
@@ -1430,7 +1430,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( | |||
1430 | 1430 | ||
1431 | /* Verify the INIT chunk before processing it. */ | 1431 | /* Verify the INIT chunk before processing it. */ |
1432 | err_chunk = NULL; | 1432 | err_chunk = NULL; |
1433 | if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, | 1433 | if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, |
1434 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, | 1434 | (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, |
1435 | &err_chunk)) { | 1435 | &err_chunk)) { |
1436 | /* This chunk contains fatal error. It is to be discarded. | 1436 | /* This chunk contains fatal error. It is to be discarded. |
@@ -6178,7 +6178,7 @@ static int sctp_eat_data(const struct sctp_association *asoc, | |||
6178 | * PMTU. In cases, such as loopback, this might be a rather | 6178 | * PMTU. In cases, such as loopback, this might be a rather |
6179 | * large spill over. | 6179 | * large spill over. |
6180 | */ | 6180 | */ |
6181 | if ((!chunk->data_accepted) && (!asoc->rwnd || | 6181 | if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over || |
6182 | (datalen > asoc->rwnd + asoc->frag_point))) { | 6182 | (datalen > asoc->rwnd + asoc->frag_point))) { |
6183 | 6183 | ||
6184 | /* If this is the next TSN, consider reneging to make | 6184 | /* If this is the next TSN, consider reneging to make |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e13519e9df80..fee06b99a4da 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2115,6 +2115,12 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
2115 | sctp_skb_pull(skb, copied); | 2115 | sctp_skb_pull(skb, copied); |
2116 | skb_queue_head(&sk->sk_receive_queue, skb); | 2116 | skb_queue_head(&sk->sk_receive_queue, skb); |
2117 | 2117 | ||
2118 | /* When only partial message is copied to the user, increase | ||
2119 | * rwnd by that amount. If all the data in the skb is read, | ||
2120 | * rwnd is updated when the event is freed. | ||
2121 | */ | ||
2122 | if (!sctp_ulpevent_is_notification(event)) | ||
2123 | sctp_assoc_rwnd_increase(event->asoc, copied); | ||
2118 | goto out; | 2124 | goto out; |
2119 | } else if ((event->msg_flags & MSG_NOTIFICATION) || | 2125 | } else if ((event->msg_flags & MSG_NOTIFICATION) || |
2120 | (event->msg_flags & MSG_EOR)) | 2126 | (event->msg_flags & MSG_EOR)) |
@@ -3315,10 +3321,10 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk, | |||
3315 | char __user *optval, | 3321 | char __user *optval, |
3316 | unsigned int optlen) | 3322 | unsigned int optlen) |
3317 | { | 3323 | { |
3318 | struct net *net = sock_net(sk); | 3324 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
3319 | struct sctp_authchunk val; | 3325 | struct sctp_authchunk val; |
3320 | 3326 | ||
3321 | if (!net->sctp.auth_enable) | 3327 | if (!ep->auth_enable) |
3322 | return -EACCES; | 3328 | return -EACCES; |
3323 | 3329 | ||
3324 | if (optlen != sizeof(struct sctp_authchunk)) | 3330 | if (optlen != sizeof(struct sctp_authchunk)) |
@@ -3335,7 +3341,7 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk, | |||
3335 | } | 3341 | } |
3336 | 3342 | ||
3337 | /* add this chunk id to the endpoint */ | 3343 | /* add this chunk id to the endpoint */ |
3338 | return sctp_auth_ep_add_chunkid(sctp_sk(sk)->ep, val.sauth_chunk); | 3344 | return sctp_auth_ep_add_chunkid(ep, val.sauth_chunk); |
3339 | } | 3345 | } |
3340 | 3346 | ||
3341 | /* | 3347 | /* |
@@ -3348,12 +3354,12 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, | |||
3348 | char __user *optval, | 3354 | char __user *optval, |
3349 | unsigned int optlen) | 3355 | unsigned int optlen) |
3350 | { | 3356 | { |
3351 | struct net *net = sock_net(sk); | 3357 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
3352 | struct sctp_hmacalgo *hmacs; | 3358 | struct sctp_hmacalgo *hmacs; |
3353 | u32 idents; | 3359 | u32 idents; |
3354 | int err; | 3360 | int err; |
3355 | 3361 | ||
3356 | if (!net->sctp.auth_enable) | 3362 | if (!ep->auth_enable) |
3357 | return -EACCES; | 3363 | return -EACCES; |
3358 | 3364 | ||
3359 | if (optlen < sizeof(struct sctp_hmacalgo)) | 3365 | if (optlen < sizeof(struct sctp_hmacalgo)) |
@@ -3370,7 +3376,7 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, | |||
3370 | goto out; | 3376 | goto out; |
3371 | } | 3377 | } |
3372 | 3378 | ||
3373 | err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs); | 3379 | err = sctp_auth_ep_set_hmacs(ep, hmacs); |
3374 | out: | 3380 | out: |
3375 | kfree(hmacs); | 3381 | kfree(hmacs); |
3376 | return err; | 3382 | return err; |
@@ -3386,12 +3392,12 @@ static int sctp_setsockopt_auth_key(struct sock *sk, | |||
3386 | char __user *optval, | 3392 | char __user *optval, |
3387 | unsigned int optlen) | 3393 | unsigned int optlen) |
3388 | { | 3394 | { |
3389 | struct net *net = sock_net(sk); | 3395 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
3390 | struct sctp_authkey *authkey; | 3396 | struct sctp_authkey *authkey; |
3391 | struct sctp_association *asoc; | 3397 | struct sctp_association *asoc; |
3392 | int ret; | 3398 | int ret; |
3393 | 3399 | ||
3394 | if (!net->sctp.auth_enable) | 3400 | if (!ep->auth_enable) |
3395 | return -EACCES; | 3401 | return -EACCES; |
3396 | 3402 | ||
3397 | if (optlen <= sizeof(struct sctp_authkey)) | 3403 | if (optlen <= sizeof(struct sctp_authkey)) |
@@ -3412,7 +3418,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk, | |||
3412 | goto out; | 3418 | goto out; |
3413 | } | 3419 | } |
3414 | 3420 | ||
3415 | ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey); | 3421 | ret = sctp_auth_set_key(ep, asoc, authkey); |
3416 | out: | 3422 | out: |
3417 | kzfree(authkey); | 3423 | kzfree(authkey); |
3418 | return ret; | 3424 | return ret; |
@@ -3428,11 +3434,11 @@ static int sctp_setsockopt_active_key(struct sock *sk, | |||
3428 | char __user *optval, | 3434 | char __user *optval, |
3429 | unsigned int optlen) | 3435 | unsigned int optlen) |
3430 | { | 3436 | { |
3431 | struct net *net = sock_net(sk); | 3437 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
3432 | struct sctp_authkeyid val; | 3438 | struct sctp_authkeyid val; |
3433 | struct sctp_association *asoc; | 3439 | struct sctp_association *asoc; |
3434 | 3440 | ||
3435 | if (!net->sctp.auth_enable) | 3441 | if (!ep->auth_enable) |
3436 | return -EACCES; | 3442 | return -EACCES; |
3437 | 3443 | ||
3438 | if (optlen != sizeof(struct sctp_authkeyid)) | 3444 | if (optlen != sizeof(struct sctp_authkeyid)) |
@@ -3444,8 +3450,7 @@ static int sctp_setsockopt_active_key(struct sock *sk, | |||
3444 | if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) | 3450 | if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) |
3445 | return -EINVAL; | 3451 | return -EINVAL; |
3446 | 3452 | ||
3447 | return sctp_auth_set_active_key(sctp_sk(sk)->ep, asoc, | 3453 | return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); |
3448 | val.scact_keynumber); | ||
3449 | } | 3454 | } |
3450 | 3455 | ||
3451 | /* | 3456 | /* |
@@ -3457,11 +3462,11 @@ static int sctp_setsockopt_del_key(struct sock *sk, | |||
3457 | char __user *optval, | 3462 | char __user *optval, |
3458 | unsigned int optlen) | 3463 | unsigned int optlen) |
3459 | { | 3464 | { |
3460 | struct net *net = sock_net(sk); | 3465 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
3461 | struct sctp_authkeyid val; | 3466 | struct sctp_authkeyid val; |
3462 | struct sctp_association *asoc; | 3467 | struct sctp_association *asoc; |
3463 | 3468 | ||
3464 | if (!net->sctp.auth_enable) | 3469 | if (!ep->auth_enable) |
3465 | return -EACCES; | 3470 | return -EACCES; |
3466 | 3471 | ||
3467 | if (optlen != sizeof(struct sctp_authkeyid)) | 3472 | if (optlen != sizeof(struct sctp_authkeyid)) |
@@ -3473,8 +3478,7 @@ static int sctp_setsockopt_del_key(struct sock *sk, | |||
3473 | if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) | 3478 | if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) |
3474 | return -EINVAL; | 3479 | return -EINVAL; |
3475 | 3480 | ||
3476 | return sctp_auth_del_key_id(sctp_sk(sk)->ep, asoc, | 3481 | return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); |
3477 | val.scact_keynumber); | ||
3478 | 3482 | ||
3479 | } | 3483 | } |
3480 | 3484 | ||
@@ -5381,16 +5385,16 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, | |||
5381 | static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | 5385 | static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, |
5382 | char __user *optval, int __user *optlen) | 5386 | char __user *optval, int __user *optlen) |
5383 | { | 5387 | { |
5384 | struct net *net = sock_net(sk); | 5388 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
5385 | struct sctp_hmacalgo __user *p = (void __user *)optval; | 5389 | struct sctp_hmacalgo __user *p = (void __user *)optval; |
5386 | struct sctp_hmac_algo_param *hmacs; | 5390 | struct sctp_hmac_algo_param *hmacs; |
5387 | __u16 data_len = 0; | 5391 | __u16 data_len = 0; |
5388 | u32 num_idents; | 5392 | u32 num_idents; |
5389 | 5393 | ||
5390 | if (!net->sctp.auth_enable) | 5394 | if (!ep->auth_enable) |
5391 | return -EACCES; | 5395 | return -EACCES; |
5392 | 5396 | ||
5393 | hmacs = sctp_sk(sk)->ep->auth_hmacs_list; | 5397 | hmacs = ep->auth_hmacs_list; |
5394 | data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t); | 5398 | data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t); |
5395 | 5399 | ||
5396 | if (len < sizeof(struct sctp_hmacalgo) + data_len) | 5400 | if (len < sizeof(struct sctp_hmacalgo) + data_len) |
@@ -5411,11 +5415,11 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | |||
5411 | static int sctp_getsockopt_active_key(struct sock *sk, int len, | 5415 | static int sctp_getsockopt_active_key(struct sock *sk, int len, |
5412 | char __user *optval, int __user *optlen) | 5416 | char __user *optval, int __user *optlen) |
5413 | { | 5417 | { |
5414 | struct net *net = sock_net(sk); | 5418 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
5415 | struct sctp_authkeyid val; | 5419 | struct sctp_authkeyid val; |
5416 | struct sctp_association *asoc; | 5420 | struct sctp_association *asoc; |
5417 | 5421 | ||
5418 | if (!net->sctp.auth_enable) | 5422 | if (!ep->auth_enable) |
5419 | return -EACCES; | 5423 | return -EACCES; |
5420 | 5424 | ||
5421 | if (len < sizeof(struct sctp_authkeyid)) | 5425 | if (len < sizeof(struct sctp_authkeyid)) |
@@ -5430,7 +5434,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len, | |||
5430 | if (asoc) | 5434 | if (asoc) |
5431 | val.scact_keynumber = asoc->active_key_id; | 5435 | val.scact_keynumber = asoc->active_key_id; |
5432 | else | 5436 | else |
5433 | val.scact_keynumber = sctp_sk(sk)->ep->active_key_id; | 5437 | val.scact_keynumber = ep->active_key_id; |
5434 | 5438 | ||
5435 | len = sizeof(struct sctp_authkeyid); | 5439 | len = sizeof(struct sctp_authkeyid); |
5436 | if (put_user(len, optlen)) | 5440 | if (put_user(len, optlen)) |
@@ -5444,7 +5448,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len, | |||
5444 | static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, | 5448 | static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, |
5445 | char __user *optval, int __user *optlen) | 5449 | char __user *optval, int __user *optlen) |
5446 | { | 5450 | { |
5447 | struct net *net = sock_net(sk); | 5451 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
5448 | struct sctp_authchunks __user *p = (void __user *)optval; | 5452 | struct sctp_authchunks __user *p = (void __user *)optval; |
5449 | struct sctp_authchunks val; | 5453 | struct sctp_authchunks val; |
5450 | struct sctp_association *asoc; | 5454 | struct sctp_association *asoc; |
@@ -5452,7 +5456,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, | |||
5452 | u32 num_chunks = 0; | 5456 | u32 num_chunks = 0; |
5453 | char __user *to; | 5457 | char __user *to; |
5454 | 5458 | ||
5455 | if (!net->sctp.auth_enable) | 5459 | if (!ep->auth_enable) |
5456 | return -EACCES; | 5460 | return -EACCES; |
5457 | 5461 | ||
5458 | if (len < sizeof(struct sctp_authchunks)) | 5462 | if (len < sizeof(struct sctp_authchunks)) |
@@ -5489,7 +5493,7 @@ num: | |||
5489 | static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, | 5493 | static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, |
5490 | char __user *optval, int __user *optlen) | 5494 | char __user *optval, int __user *optlen) |
5491 | { | 5495 | { |
5492 | struct net *net = sock_net(sk); | 5496 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; |
5493 | struct sctp_authchunks __user *p = (void __user *)optval; | 5497 | struct sctp_authchunks __user *p = (void __user *)optval; |
5494 | struct sctp_authchunks val; | 5498 | struct sctp_authchunks val; |
5495 | struct sctp_association *asoc; | 5499 | struct sctp_association *asoc; |
@@ -5497,7 +5501,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, | |||
5497 | u32 num_chunks = 0; | 5501 | u32 num_chunks = 0; |
5498 | char __user *to; | 5502 | char __user *to; |
5499 | 5503 | ||
5500 | if (!net->sctp.auth_enable) | 5504 | if (!ep->auth_enable) |
5501 | return -EACCES; | 5505 | return -EACCES; |
5502 | 5506 | ||
5503 | if (len < sizeof(struct sctp_authchunks)) | 5507 | if (len < sizeof(struct sctp_authchunks)) |
@@ -5514,7 +5518,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, | |||
5514 | if (asoc) | 5518 | if (asoc) |
5515 | ch = (struct sctp_chunks_param *)asoc->c.auth_chunks; | 5519 | ch = (struct sctp_chunks_param *)asoc->c.auth_chunks; |
5516 | else | 5520 | else |
5517 | ch = sctp_sk(sk)->ep->auth_chunk_list; | 5521 | ch = ep->auth_chunk_list; |
5518 | 5522 | ||
5519 | if (!ch) | 5523 | if (!ch) |
5520 | goto num; | 5524 | goto num; |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 35c8923b5554..c82fdc1eab7c 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -64,6 +64,9 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | |||
64 | static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | 64 | static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, |
65 | void __user *buffer, size_t *lenp, | 65 | void __user *buffer, size_t *lenp, |
66 | loff_t *ppos); | 66 | loff_t *ppos); |
67 | static int proc_sctp_do_auth(struct ctl_table *ctl, int write, | ||
68 | void __user *buffer, size_t *lenp, | ||
69 | loff_t *ppos); | ||
67 | 70 | ||
68 | static struct ctl_table sctp_table[] = { | 71 | static struct ctl_table sctp_table[] = { |
69 | { | 72 | { |
@@ -266,7 +269,7 @@ static struct ctl_table sctp_net_table[] = { | |||
266 | .data = &init_net.sctp.auth_enable, | 269 | .data = &init_net.sctp.auth_enable, |
267 | .maxlen = sizeof(int), | 270 | .maxlen = sizeof(int), |
268 | .mode = 0644, | 271 | .mode = 0644, |
269 | .proc_handler = proc_dointvec, | 272 | .proc_handler = proc_sctp_do_auth, |
270 | }, | 273 | }, |
271 | { | 274 | { |
272 | .procname = "addr_scope_policy", | 275 | .procname = "addr_scope_policy", |
@@ -400,6 +403,37 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | |||
400 | return ret; | 403 | return ret; |
401 | } | 404 | } |
402 | 405 | ||
406 | static int proc_sctp_do_auth(struct ctl_table *ctl, int write, | ||
407 | void __user *buffer, size_t *lenp, | ||
408 | loff_t *ppos) | ||
409 | { | ||
410 | struct net *net = current->nsproxy->net_ns; | ||
411 | struct ctl_table tbl; | ||
412 | int new_value, ret; | ||
413 | |||
414 | memset(&tbl, 0, sizeof(struct ctl_table)); | ||
415 | tbl.maxlen = sizeof(unsigned int); | ||
416 | |||
417 | if (write) | ||
418 | tbl.data = &new_value; | ||
419 | else | ||
420 | tbl.data = &net->sctp.auth_enable; | ||
421 | |||
422 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | ||
423 | |||
424 | if (write) { | ||
425 | struct sock *sk = net->sctp.ctl_sock; | ||
426 | |||
427 | net->sctp.auth_enable = new_value; | ||
428 | /* Update the value in the control socket */ | ||
429 | lock_sock(sk); | ||
430 | sctp_sk(sk)->ep->auth_enable = new_value; | ||
431 | release_sock(sk); | ||
432 | } | ||
433 | |||
434 | return ret; | ||
435 | } | ||
436 | |||
403 | int sctp_sysctl_net_register(struct net *net) | 437 | int sctp_sysctl_net_register(struct net *net) |
404 | { | 438 | { |
405 | struct ctl_table *table = sctp_net_table; | 439 | struct ctl_table *table = sctp_net_table; |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 8d198ae03606..85c64658bd0b 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -989,7 +989,7 @@ static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event, | |||
989 | skb = sctp_event2skb(event); | 989 | skb = sctp_event2skb(event); |
990 | /* Set the owner and charge rwnd for bytes received. */ | 990 | /* Set the owner and charge rwnd for bytes received. */ |
991 | sctp_ulpevent_set_owner(event, asoc); | 991 | sctp_ulpevent_set_owner(event, asoc); |
992 | sctp_assoc_rwnd_update(asoc, false); | 992 | sctp_assoc_rwnd_decrease(asoc, skb_headlen(skb)); |
993 | 993 | ||
994 | if (!skb->data_len) | 994 | if (!skb->data_len) |
995 | return; | 995 | return; |
@@ -1011,7 +1011,6 @@ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event) | |||
1011 | { | 1011 | { |
1012 | struct sk_buff *skb, *frag; | 1012 | struct sk_buff *skb, *frag; |
1013 | unsigned int len; | 1013 | unsigned int len; |
1014 | struct sctp_association *asoc; | ||
1015 | 1014 | ||
1016 | /* Current stack structures assume that the rcv buffer is | 1015 | /* Current stack structures assume that the rcv buffer is |
1017 | * per socket. For UDP style sockets this is not true as | 1016 | * per socket. For UDP style sockets this is not true as |
@@ -1036,11 +1035,8 @@ static void sctp_ulpevent_release_data(struct sctp_ulpevent *event) | |||
1036 | } | 1035 | } |
1037 | 1036 | ||
1038 | done: | 1037 | done: |
1039 | asoc = event->asoc; | 1038 | sctp_assoc_rwnd_increase(event->asoc, len); |
1040 | sctp_association_hold(asoc); | ||
1041 | sctp_ulpevent_release_owner(event); | 1039 | sctp_ulpevent_release_owner(event); |
1042 | sctp_assoc_rwnd_update(asoc, true); | ||
1043 | sctp_association_put(asoc); | ||
1044 | } | 1040 | } |
1045 | 1041 | ||
1046 | static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event) | 1042 | static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event) |
diff --git a/net/socket.c b/net/socket.c index 1b1e7e6a960f..abf56b2a14f9 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1880,8 +1880,8 @@ out: | |||
1880 | * Receive a datagram from a socket. | 1880 | * Receive a datagram from a socket. |
1881 | */ | 1881 | */ |
1882 | 1882 | ||
1883 | asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size, | 1883 | SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size, |
1884 | unsigned int flags) | 1884 | unsigned int, flags) |
1885 | { | 1885 | { |
1886 | return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL); | 1886 | return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL); |
1887 | } | 1887 | } |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index f02f511b7107..c08fbd11ceff 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1842,7 +1842,7 @@ purge_queue: | |||
1842 | xfrm_pol_put(pol); | 1842 | xfrm_pol_put(pol); |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | static int xdst_queue_output(struct sk_buff *skb) | 1845 | static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) |
1846 | { | 1846 | { |
1847 | unsigned long sched_next; | 1847 | unsigned long sched_next; |
1848 | struct dst_entry *dst = skb_dst(skb); | 1848 | struct dst_entry *dst = skb_dst(skb); |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 1c16830af3d8..6faaac60161a 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -520,7 +520,7 @@ static int snd_es18xx_playback1_trigger(struct snd_es18xx *chip, | |||
520 | snd_es18xx_mixer_write(chip, 0x78, 0x93); | 520 | snd_es18xx_mixer_write(chip, 0x78, 0x93); |
521 | #ifdef AVOID_POPS | 521 | #ifdef AVOID_POPS |
522 | /* Avoid pops */ | 522 | /* Avoid pops */ |
523 | udelay(100000); | 523 | mdelay(100); |
524 | if (chip->caps & ES18XX_PCM2) | 524 | if (chip->caps & ES18XX_PCM2) |
525 | /* Restore Audio 2 volume */ | 525 | /* Restore Audio 2 volume */ |
526 | snd_es18xx_mixer_write(chip, 0x7C, chip->audio2_vol); | 526 | snd_es18xx_mixer_write(chip, 0x7C, chip->audio2_vol); |
@@ -537,7 +537,7 @@ static int snd_es18xx_playback1_trigger(struct snd_es18xx *chip, | |||
537 | /* Stop DMA */ | 537 | /* Stop DMA */ |
538 | snd_es18xx_mixer_write(chip, 0x78, 0x00); | 538 | snd_es18xx_mixer_write(chip, 0x78, 0x00); |
539 | #ifdef AVOID_POPS | 539 | #ifdef AVOID_POPS |
540 | udelay(25000); | 540 | mdelay(25); |
541 | if (chip->caps & ES18XX_PCM2) | 541 | if (chip->caps & ES18XX_PCM2) |
542 | /* Set Audio 2 volume to 0 */ | 542 | /* Set Audio 2 volume to 0 */ |
543 | snd_es18xx_mixer_write(chip, 0x7C, 0); | 543 | snd_es18xx_mixer_write(chip, 0x7C, 0); |
@@ -596,7 +596,7 @@ static int snd_es18xx_capture_prepare(struct snd_pcm_substream *substream) | |||
596 | snd_es18xx_write(chip, 0xA5, count >> 8); | 596 | snd_es18xx_write(chip, 0xA5, count >> 8); |
597 | 597 | ||
598 | #ifdef AVOID_POPS | 598 | #ifdef AVOID_POPS |
599 | udelay(100000); | 599 | mdelay(100); |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | /* Set format */ | 602 | /* Set format */ |
@@ -691,7 +691,7 @@ static int snd_es18xx_playback2_trigger(struct snd_es18xx *chip, | |||
691 | snd_es18xx_write(chip, 0xB8, 0x05); | 691 | snd_es18xx_write(chip, 0xB8, 0x05); |
692 | #ifdef AVOID_POPS | 692 | #ifdef AVOID_POPS |
693 | /* Avoid pops */ | 693 | /* Avoid pops */ |
694 | udelay(100000); | 694 | mdelay(100); |
695 | /* Enable Audio 1 */ | 695 | /* Enable Audio 1 */ |
696 | snd_es18xx_dsp_command(chip, 0xD1); | 696 | snd_es18xx_dsp_command(chip, 0xD1); |
697 | #endif | 697 | #endif |
@@ -705,7 +705,7 @@ static int snd_es18xx_playback2_trigger(struct snd_es18xx *chip, | |||
705 | snd_es18xx_write(chip, 0xB8, 0x00); | 705 | snd_es18xx_write(chip, 0xB8, 0x00); |
706 | #ifdef AVOID_POPS | 706 | #ifdef AVOID_POPS |
707 | /* Avoid pops */ | 707 | /* Avoid pops */ |
708 | udelay(25000); | 708 | mdelay(25); |
709 | /* Disable Audio 1 */ | 709 | /* Disable Audio 1 */ |
710 | snd_es18xx_dsp_command(chip, 0xD3); | 710 | snd_es18xx_dsp_command(chip, 0xD3); |
711 | #endif | 711 | #endif |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 14ae979a92ea..c643dfc0a826 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4621,6 +4621,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4621 | SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4621 | SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4622 | SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), | 4622 | SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), |
4623 | SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), | 4623 | SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), |
4624 | SND_PCI_QUIRK(0x1028, 0x067f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
4624 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4625 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
4625 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4626 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
4626 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), | 4627 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
@@ -4912,6 +4913,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
4912 | spec->codec_variant = ALC269_TYPE_ALC285; | 4913 | spec->codec_variant = ALC269_TYPE_ALC285; |
4913 | break; | 4914 | break; |
4914 | case 0x10ec0286: | 4915 | case 0x10ec0286: |
4916 | case 0x10ec0288: | ||
4915 | spec->codec_variant = ALC269_TYPE_ALC286; | 4917 | spec->codec_variant = ALC269_TYPE_ALC286; |
4916 | break; | 4918 | break; |
4917 | case 0x10ec0255: | 4919 | case 0x10ec0255: |
@@ -5539,6 +5541,8 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
5539 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5541 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5540 | SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE), | 5542 | SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5541 | SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_AUTO_MUTE), | 5543 | SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_AUTO_MUTE), |
5544 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
5545 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
5542 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 5546 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
5543 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), | 5547 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
5544 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | 5548 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
@@ -5781,6 +5785,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
5781 | { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, | 5785 | { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, |
5782 | { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 }, | 5786 | { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 }, |
5783 | { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 }, | 5787 | { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 }, |
5788 | { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 }, | ||
5784 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, | 5789 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, |
5785 | { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, | 5790 | { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, |
5786 | { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 }, | 5791 | { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 }, |
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index 4ecc4fd0bc1b..fba1c75aa484 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c | |||
@@ -82,8 +82,10 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg) | |||
82 | 82 | ||
83 | if (!access(target_fname, F_OK)) { | 83 | if (!access(target_fname, F_OK)) { |
84 | syslog(LOG_INFO, "File: %s exists", target_fname); | 84 | syslog(LOG_INFO, "File: %s exists", target_fname); |
85 | if (!smsg->copy_flags & OVER_WRITE) | 85 | if (!(smsg->copy_flags & OVER_WRITE)) { |
86 | error = HV_ERROR_ALREADY_EXISTS; | ||
86 | goto done; | 87 | goto done; |
88 | } | ||
87 | } | 89 | } |
88 | 90 | ||
89 | target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744); | 91 | target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744); |
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index 07b0b7542511..cb09d3ff8f58 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile | |||
@@ -1,13 +1,8 @@ | |||
1 | # liblockdep version | ||
2 | LL_VERSION = 0 | ||
3 | LL_PATCHLEVEL = 0 | ||
4 | LL_EXTRAVERSION = 1 | ||
5 | |||
6 | # file format version | 1 | # file format version |
7 | FILE_VERSION = 1 | 2 | FILE_VERSION = 1 |
8 | 3 | ||
9 | MAKEFLAGS += --no-print-directory | 4 | MAKEFLAGS += --no-print-directory |
10 | 5 | LIBLOCKDEP_VERSION=$(shell make -sC ../../.. kernelversion) | |
11 | 6 | ||
12 | # Makefiles suck: This macro sets a default value of $(2) for the | 7 | # Makefiles suck: This macro sets a default value of $(2) for the |
13 | # variable named by $(1), unless the variable has been set by | 8 | # variable named by $(1), unless the variable has been set by |
@@ -98,7 +93,7 @@ export prefix libdir bindir src obj | |||
98 | libdir_SQ = $(subst ','\'',$(libdir)) | 93 | libdir_SQ = $(subst ','\'',$(libdir)) |
99 | bindir_SQ = $(subst ','\'',$(bindir)) | 94 | bindir_SQ = $(subst ','\'',$(bindir)) |
100 | 95 | ||
101 | LIB_FILE = liblockdep.a liblockdep.so | 96 | LIB_FILE = liblockdep.a liblockdep.so.$(LIBLOCKDEP_VERSION) |
102 | BIN_FILE = lockdep | 97 | BIN_FILE = lockdep |
103 | 98 | ||
104 | CONFIG_INCLUDES = | 99 | CONFIG_INCLUDES = |
@@ -110,8 +105,6 @@ N = | |||
110 | 105 | ||
111 | export Q VERBOSE | 106 | export Q VERBOSE |
112 | 107 | ||
113 | LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION) | ||
114 | |||
115 | INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) | 108 | INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) |
116 | 109 | ||
117 | # Set compile option CFLAGS if not set elsewhere | 110 | # Set compile option CFLAGS if not set elsewhere |
@@ -146,7 +139,7 @@ do_app_build = \ | |||
146 | 139 | ||
147 | do_compile_shared_library = \ | 140 | do_compile_shared_library = \ |
148 | ($(print_shared_lib_compile) \ | 141 | ($(print_shared_lib_compile) \ |
149 | $(CC) --shared $^ -o $@ -lpthread -ldl) | 142 | $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so)) |
150 | 143 | ||
151 | do_build_static_lib = \ | 144 | do_build_static_lib = \ |
152 | ($(print_static_lib_build) \ | 145 | ($(print_static_lib_build) \ |
@@ -177,7 +170,7 @@ all: all_cmd | |||
177 | 170 | ||
178 | all_cmd: $(CMD_TARGETS) | 171 | all_cmd: $(CMD_TARGETS) |
179 | 172 | ||
180 | liblockdep.so: $(PEVENT_LIB_OBJS) | 173 | liblockdep.so.$(LIBLOCKDEP_VERSION): $(PEVENT_LIB_OBJS) |
181 | $(Q)$(do_compile_shared_library) | 174 | $(Q)$(do_compile_shared_library) |
182 | 175 | ||
183 | liblockdep.a: $(PEVENT_LIB_OBJS) | 176 | liblockdep.a: $(PEVENT_LIB_OBJS) |
diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h index d0f5d6e50214..c1552c28507e 100644 --- a/tools/lib/lockdep/uinclude/linux/lockdep.h +++ b/tools/lib/lockdep/uinclude/linux/lockdep.h | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | #define MAX_LOCK_DEPTH 2000UL | 11 | #define MAX_LOCK_DEPTH 2000UL |
12 | 12 | ||
13 | #define asmlinkage | ||
14 | #define __visible | ||
15 | |||
13 | #include "../../../include/linux/lockdep.h" | 16 | #include "../../../include/linux/lockdep.h" |
14 | 17 | ||
15 | struct task_struct { | 18 | struct task_struct { |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 1587ea392ad6..baec7d887da4 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -50,6 +50,18 @@ static int show_warning = 1; | |||
50 | warning(fmt, ##__VA_ARGS__); \ | 50 | warning(fmt, ##__VA_ARGS__); \ |
51 | } while (0) | 51 | } while (0) |
52 | 52 | ||
53 | #define do_warning_event(event, fmt, ...) \ | ||
54 | do { \ | ||
55 | if (!show_warning) \ | ||
56 | continue; \ | ||
57 | \ | ||
58 | if (event) \ | ||
59 | warning("[%s:%s] " fmt, event->system, \ | ||
60 | event->name, ##__VA_ARGS__); \ | ||
61 | else \ | ||
62 | warning(fmt, ##__VA_ARGS__); \ | ||
63 | } while (0) | ||
64 | |||
53 | static void init_input_buf(const char *buf, unsigned long long size) | 65 | static void init_input_buf(const char *buf, unsigned long long size) |
54 | { | 66 | { |
55 | input_buf = buf; | 67 | input_buf = buf; |
@@ -1355,7 +1367,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f | |||
1355 | } | 1367 | } |
1356 | 1368 | ||
1357 | if (!field->type) { | 1369 | if (!field->type) { |
1358 | do_warning("%s: no type found", __func__); | 1370 | do_warning_event(event, "%s: no type found", __func__); |
1359 | goto fail; | 1371 | goto fail; |
1360 | } | 1372 | } |
1361 | field->name = last_token; | 1373 | field->name = last_token; |
@@ -1402,7 +1414,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f | |||
1402 | free_token(token); | 1414 | free_token(token); |
1403 | type = read_token(&token); | 1415 | type = read_token(&token); |
1404 | if (type == EVENT_NONE) { | 1416 | if (type == EVENT_NONE) { |
1405 | do_warning("failed to find token"); | 1417 | do_warning_event(event, "failed to find token"); |
1406 | goto fail; | 1418 | goto fail; |
1407 | } | 1419 | } |
1408 | } | 1420 | } |
@@ -1636,7 +1648,7 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok) | |||
1636 | right = alloc_arg(); | 1648 | right = alloc_arg(); |
1637 | 1649 | ||
1638 | if (!arg || !left || !right) { | 1650 | if (!arg || !left || !right) { |
1639 | do_warning("%s: not enough memory!", __func__); | 1651 | do_warning_event(event, "%s: not enough memory!", __func__); |
1640 | /* arg will be freed at out_free */ | 1652 | /* arg will be freed at out_free */ |
1641 | free_arg(left); | 1653 | free_arg(left); |
1642 | free_arg(right); | 1654 | free_arg(right); |
@@ -1686,7 +1698,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok) | |||
1686 | 1698 | ||
1687 | arg = alloc_arg(); | 1699 | arg = alloc_arg(); |
1688 | if (!arg) { | 1700 | if (!arg) { |
1689 | do_warning("%s: not enough memory!", __func__); | 1701 | do_warning_event(event, "%s: not enough memory!", __func__); |
1690 | /* '*tok' is set to top->op.op. No need to free. */ | 1702 | /* '*tok' is set to top->op.op. No need to free. */ |
1691 | *tok = NULL; | 1703 | *tok = NULL; |
1692 | return EVENT_ERROR; | 1704 | return EVENT_ERROR; |
@@ -1792,7 +1804,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) | |||
1792 | if (arg->type == PRINT_OP && !arg->op.left) { | 1804 | if (arg->type == PRINT_OP && !arg->op.left) { |
1793 | /* handle single op */ | 1805 | /* handle single op */ |
1794 | if (token[1]) { | 1806 | if (token[1]) { |
1795 | do_warning("bad op token %s", token); | 1807 | do_warning_event(event, "bad op token %s", token); |
1796 | goto out_free; | 1808 | goto out_free; |
1797 | } | 1809 | } |
1798 | switch (token[0]) { | 1810 | switch (token[0]) { |
@@ -1802,7 +1814,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) | |||
1802 | case '-': | 1814 | case '-': |
1803 | break; | 1815 | break; |
1804 | default: | 1816 | default: |
1805 | do_warning("bad op token %s", token); | 1817 | do_warning_event(event, "bad op token %s", token); |
1806 | goto out_free; | 1818 | goto out_free; |
1807 | 1819 | ||
1808 | } | 1820 | } |
@@ -1888,7 +1900,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) | |||
1888 | char *new_atom; | 1900 | char *new_atom; |
1889 | 1901 | ||
1890 | if (left->type != PRINT_ATOM) { | 1902 | if (left->type != PRINT_ATOM) { |
1891 | do_warning("bad pointer type"); | 1903 | do_warning_event(event, "bad pointer type"); |
1892 | goto out_free; | 1904 | goto out_free; |
1893 | } | 1905 | } |
1894 | new_atom = realloc(left->atom.atom, | 1906 | new_atom = realloc(left->atom.atom, |
@@ -1930,7 +1942,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) | |||
1930 | type = process_array(event, arg, tok); | 1942 | type = process_array(event, arg, tok); |
1931 | 1943 | ||
1932 | } else { | 1944 | } else { |
1933 | do_warning("unknown op '%s'", token); | 1945 | do_warning_event(event, "unknown op '%s'", token); |
1934 | event->flags |= EVENT_FL_FAILED; | 1946 | event->flags |= EVENT_FL_FAILED; |
1935 | /* the arg is now the left side */ | 1947 | /* the arg is now the left side */ |
1936 | goto out_free; | 1948 | goto out_free; |
@@ -1951,7 +1963,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok) | |||
1951 | return type; | 1963 | return type; |
1952 | 1964 | ||
1953 | out_warn_free: | 1965 | out_warn_free: |
1954 | do_warning("%s: not enough memory!", __func__); | 1966 | do_warning_event(event, "%s: not enough memory!", __func__); |
1955 | out_free: | 1967 | out_free: |
1956 | free_token(token); | 1968 | free_token(token); |
1957 | *tok = NULL; | 1969 | *tok = NULL; |
@@ -2385,7 +2397,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok) | |||
2385 | 2397 | ||
2386 | field = alloc_arg(); | 2398 | field = alloc_arg(); |
2387 | if (!field) { | 2399 | if (!field) { |
2388 | do_warning("%s: not enough memory!", __func__); | 2400 | do_warning_event(event, "%s: not enough memory!", __func__); |
2389 | goto out_free; | 2401 | goto out_free; |
2390 | } | 2402 | } |
2391 | 2403 | ||
@@ -2438,7 +2450,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok) | |||
2438 | 2450 | ||
2439 | field = alloc_arg(); | 2451 | field = alloc_arg(); |
2440 | if (!field) { | 2452 | if (!field) { |
2441 | do_warning("%s: not enough memory!", __func__); | 2453 | do_warning_event(event, "%s: not enough memory!", __func__); |
2442 | goto out_free; | 2454 | goto out_free; |
2443 | } | 2455 | } |
2444 | 2456 | ||
@@ -2477,7 +2489,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) | |||
2477 | 2489 | ||
2478 | field = alloc_arg(); | 2490 | field = alloc_arg(); |
2479 | if (!field) { | 2491 | if (!field) { |
2480 | do_warning("%s: not enough memory!", __func__); | 2492 | do_warning_event(event, "%s: not enough memory!", __func__); |
2481 | goto out_free; | 2493 | goto out_free; |
2482 | } | 2494 | } |
2483 | 2495 | ||
@@ -2492,7 +2504,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok) | |||
2492 | 2504 | ||
2493 | field = alloc_arg(); | 2505 | field = alloc_arg(); |
2494 | if (!field) { | 2506 | if (!field) { |
2495 | do_warning("%s: not enough memory!", __func__); | 2507 | do_warning_event(event, "%s: not enough memory!", __func__); |
2496 | *tok = NULL; | 2508 | *tok = NULL; |
2497 | return EVENT_ERROR; | 2509 | return EVENT_ERROR; |
2498 | } | 2510 | } |
@@ -2555,7 +2567,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char ** | |||
2555 | free_token(token); | 2567 | free_token(token); |
2556 | arg = alloc_arg(); | 2568 | arg = alloc_arg(); |
2557 | if (!arg) { | 2569 | if (!arg) { |
2558 | do_warning("%s: not enough memory!", __func__); | 2570 | do_warning_event(event, "%s: not enough memory!", __func__); |
2559 | *tok = NULL; | 2571 | *tok = NULL; |
2560 | return EVENT_ERROR; | 2572 | return EVENT_ERROR; |
2561 | } | 2573 | } |
@@ -2614,13 +2626,14 @@ process_paren(struct event_format *event, struct print_arg *arg, char **tok) | |||
2614 | 2626 | ||
2615 | /* prevous must be an atom */ | 2627 | /* prevous must be an atom */ |
2616 | if (arg->type != PRINT_ATOM) { | 2628 | if (arg->type != PRINT_ATOM) { |
2617 | do_warning("previous needed to be PRINT_ATOM"); | 2629 | do_warning_event(event, "previous needed to be PRINT_ATOM"); |
2618 | goto out_free; | 2630 | goto out_free; |
2619 | } | 2631 | } |
2620 | 2632 | ||
2621 | item_arg = alloc_arg(); | 2633 | item_arg = alloc_arg(); |
2622 | if (!item_arg) { | 2634 | if (!item_arg) { |
2623 | do_warning("%s: not enough memory!", __func__); | 2635 | do_warning_event(event, "%s: not enough memory!", |
2636 | __func__); | ||
2624 | goto out_free; | 2637 | goto out_free; |
2625 | } | 2638 | } |
2626 | 2639 | ||
@@ -2721,21 +2734,24 @@ process_func_handler(struct event_format *event, struct pevent_function_handler | |||
2721 | for (i = 0; i < func->nr_args; i++) { | 2734 | for (i = 0; i < func->nr_args; i++) { |
2722 | farg = alloc_arg(); | 2735 | farg = alloc_arg(); |
2723 | if (!farg) { | 2736 | if (!farg) { |
2724 | do_warning("%s: not enough memory!", __func__); | 2737 | do_warning_event(event, "%s: not enough memory!", |
2738 | __func__); | ||
2725 | return EVENT_ERROR; | 2739 | return EVENT_ERROR; |
2726 | } | 2740 | } |
2727 | 2741 | ||
2728 | type = process_arg(event, farg, &token); | 2742 | type = process_arg(event, farg, &token); |
2729 | if (i < (func->nr_args - 1)) { | 2743 | if (i < (func->nr_args - 1)) { |
2730 | if (type != EVENT_DELIM || strcmp(token, ",") != 0) { | 2744 | if (type != EVENT_DELIM || strcmp(token, ",") != 0) { |
2731 | warning("Error: function '%s()' expects %d arguments but event %s only uses %d", | 2745 | do_warning_event(event, |
2746 | "Error: function '%s()' expects %d arguments but event %s only uses %d", | ||
2732 | func->name, func->nr_args, | 2747 | func->name, func->nr_args, |
2733 | event->name, i + 1); | 2748 | event->name, i + 1); |
2734 | goto err; | 2749 | goto err; |
2735 | } | 2750 | } |
2736 | } else { | 2751 | } else { |
2737 | if (type != EVENT_DELIM || strcmp(token, ")") != 0) { | 2752 | if (type != EVENT_DELIM || strcmp(token, ")") != 0) { |
2738 | warning("Error: function '%s()' only expects %d arguments but event %s has more", | 2753 | do_warning_event(event, |
2754 | "Error: function '%s()' only expects %d arguments but event %s has more", | ||
2739 | func->name, func->nr_args, event->name); | 2755 | func->name, func->nr_args, event->name); |
2740 | goto err; | 2756 | goto err; |
2741 | } | 2757 | } |
@@ -2792,7 +2808,7 @@ process_function(struct event_format *event, struct print_arg *arg, | |||
2792 | return process_func_handler(event, func, arg, tok); | 2808 | return process_func_handler(event, func, arg, tok); |
2793 | } | 2809 | } |
2794 | 2810 | ||
2795 | do_warning("function %s not defined", token); | 2811 | do_warning_event(event, "function %s not defined", token); |
2796 | free_token(token); | 2812 | free_token(token); |
2797 | return EVENT_ERROR; | 2813 | return EVENT_ERROR; |
2798 | } | 2814 | } |
@@ -2878,7 +2894,7 @@ process_arg_token(struct event_format *event, struct print_arg *arg, | |||
2878 | 2894 | ||
2879 | case EVENT_ERROR ... EVENT_NEWLINE: | 2895 | case EVENT_ERROR ... EVENT_NEWLINE: |
2880 | default: | 2896 | default: |
2881 | do_warning("unexpected type %d", type); | 2897 | do_warning_event(event, "unexpected type %d", type); |
2882 | return EVENT_ERROR; | 2898 | return EVENT_ERROR; |
2883 | } | 2899 | } |
2884 | *tok = token; | 2900 | *tok = token; |
@@ -2901,7 +2917,8 @@ static int event_read_print_args(struct event_format *event, struct print_arg ** | |||
2901 | 2917 | ||
2902 | arg = alloc_arg(); | 2918 | arg = alloc_arg(); |
2903 | if (!arg) { | 2919 | if (!arg) { |
2904 | do_warning("%s: not enough memory!", __func__); | 2920 | do_warning_event(event, "%s: not enough memory!", |
2921 | __func__); | ||
2905 | return -1; | 2922 | return -1; |
2906 | } | 2923 | } |
2907 | 2924 | ||
@@ -3481,11 +3498,12 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
3481 | return val; | 3498 | return val; |
3482 | 3499 | ||
3483 | out_warning_op: | 3500 | out_warning_op: |
3484 | do_warning("%s: unknown op '%s'", __func__, arg->op.op); | 3501 | do_warning_event(event, "%s: unknown op '%s'", __func__, arg->op.op); |
3485 | return 0; | 3502 | return 0; |
3486 | 3503 | ||
3487 | out_warning_field: | 3504 | out_warning_field: |
3488 | do_warning("%s: field %s not found", __func__, arg->field.name); | 3505 | do_warning_event(event, "%s: field %s not found", |
3506 | __func__, arg->field.name); | ||
3489 | return 0; | 3507 | return 0; |
3490 | } | 3508 | } |
3491 | 3509 | ||
@@ -3591,7 +3609,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3591 | } | 3609 | } |
3592 | str = malloc(len + 1); | 3610 | str = malloc(len + 1); |
3593 | if (!str) { | 3611 | if (!str) { |
3594 | do_warning("%s: not enough memory!", __func__); | 3612 | do_warning_event(event, "%s: not enough memory!", |
3613 | __func__); | ||
3595 | return; | 3614 | return; |
3596 | } | 3615 | } |
3597 | memcpy(str, data + field->offset, len); | 3616 | memcpy(str, data + field->offset, len); |
@@ -3697,7 +3716,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3697 | return; | 3716 | return; |
3698 | 3717 | ||
3699 | out_warning_field: | 3718 | out_warning_field: |
3700 | do_warning("%s: field %s not found", __func__, arg->field.name); | 3719 | do_warning_event(event, "%s: field %s not found", |
3720 | __func__, arg->field.name); | ||
3701 | } | 3721 | } |
3702 | 3722 | ||
3703 | static unsigned long long | 3723 | static unsigned long long |
@@ -3742,14 +3762,16 @@ process_defined_func(struct trace_seq *s, void *data, int size, | |||
3742 | trace_seq_terminate(&str); | 3762 | trace_seq_terminate(&str); |
3743 | string = malloc(sizeof(*string)); | 3763 | string = malloc(sizeof(*string)); |
3744 | if (!string) { | 3764 | if (!string) { |
3745 | do_warning("%s(%d): malloc str", __func__, __LINE__); | 3765 | do_warning_event(event, "%s(%d): malloc str", |
3766 | __func__, __LINE__); | ||
3746 | goto out_free; | 3767 | goto out_free; |
3747 | } | 3768 | } |
3748 | string->next = strings; | 3769 | string->next = strings; |
3749 | string->str = strdup(str.buffer); | 3770 | string->str = strdup(str.buffer); |
3750 | if (!string->str) { | 3771 | if (!string->str) { |
3751 | free(string); | 3772 | free(string); |
3752 | do_warning("%s(%d): malloc str", __func__, __LINE__); | 3773 | do_warning_event(event, "%s(%d): malloc str", |
3774 | __func__, __LINE__); | ||
3753 | goto out_free; | 3775 | goto out_free; |
3754 | } | 3776 | } |
3755 | args[i] = (uintptr_t)string->str; | 3777 | args[i] = (uintptr_t)string->str; |
@@ -3761,7 +3783,7 @@ process_defined_func(struct trace_seq *s, void *data, int size, | |||
3761 | * Something went totally wrong, this is not | 3783 | * Something went totally wrong, this is not |
3762 | * an input error, something in this code broke. | 3784 | * an input error, something in this code broke. |
3763 | */ | 3785 | */ |
3764 | do_warning("Unexpected end of arguments\n"); | 3786 | do_warning_event(event, "Unexpected end of arguments\n"); |
3765 | goto out_free; | 3787 | goto out_free; |
3766 | } | 3788 | } |
3767 | farg = farg->next; | 3789 | farg = farg->next; |
@@ -3811,12 +3833,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
3811 | if (!field) { | 3833 | if (!field) { |
3812 | field = pevent_find_field(event, "buf"); | 3834 | field = pevent_find_field(event, "buf"); |
3813 | if (!field) { | 3835 | if (!field) { |
3814 | do_warning("can't find buffer field for binary printk"); | 3836 | do_warning_event(event, "can't find buffer field for binary printk"); |
3815 | return NULL; | 3837 | return NULL; |
3816 | } | 3838 | } |
3817 | ip_field = pevent_find_field(event, "ip"); | 3839 | ip_field = pevent_find_field(event, "ip"); |
3818 | if (!ip_field) { | 3840 | if (!ip_field) { |
3819 | do_warning("can't find ip field for binary printk"); | 3841 | do_warning_event(event, "can't find ip field for binary printk"); |
3820 | return NULL; | 3842 | return NULL; |
3821 | } | 3843 | } |
3822 | pevent->bprint_buf_field = field; | 3844 | pevent->bprint_buf_field = field; |
@@ -3830,7 +3852,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
3830 | */ | 3852 | */ |
3831 | args = alloc_arg(); | 3853 | args = alloc_arg(); |
3832 | if (!args) { | 3854 | if (!args) { |
3833 | do_warning("%s(%d): not enough memory!", __func__, __LINE__); | 3855 | do_warning_event(event, "%s(%d): not enough memory!", |
3856 | __func__, __LINE__); | ||
3834 | return NULL; | 3857 | return NULL; |
3835 | } | 3858 | } |
3836 | arg = args; | 3859 | arg = args; |
@@ -3896,7 +3919,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
3896 | bptr += vsize; | 3919 | bptr += vsize; |
3897 | arg = alloc_arg(); | 3920 | arg = alloc_arg(); |
3898 | if (!arg) { | 3921 | if (!arg) { |
3899 | do_warning("%s(%d): not enough memory!", | 3922 | do_warning_event(event, "%s(%d): not enough memory!", |
3900 | __func__, __LINE__); | 3923 | __func__, __LINE__); |
3901 | goto out_free; | 3924 | goto out_free; |
3902 | } | 3925 | } |
@@ -3919,7 +3942,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
3919 | case 's': | 3942 | case 's': |
3920 | arg = alloc_arg(); | 3943 | arg = alloc_arg(); |
3921 | if (!arg) { | 3944 | if (!arg) { |
3922 | do_warning("%s(%d): not enough memory!", | 3945 | do_warning_event(event, "%s(%d): not enough memory!", |
3923 | __func__, __LINE__); | 3946 | __func__, __LINE__); |
3924 | goto out_free; | 3947 | goto out_free; |
3925 | } | 3948 | } |
@@ -3959,7 +3982,7 @@ get_bprint_format(void *data, int size __maybe_unused, | |||
3959 | if (!field) { | 3982 | if (!field) { |
3960 | field = pevent_find_field(event, "fmt"); | 3983 | field = pevent_find_field(event, "fmt"); |
3961 | if (!field) { | 3984 | if (!field) { |
3962 | do_warning("can't find format field for binary printk"); | 3985 | do_warning_event(event, "can't find format field for binary printk"); |
3963 | return NULL; | 3986 | return NULL; |
3964 | } | 3987 | } |
3965 | pevent->bprint_fmt_field = field; | 3988 | pevent->bprint_fmt_field = field; |
@@ -4003,8 +4026,8 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size, | |||
4003 | arg->field.field = | 4026 | arg->field.field = |
4004 | pevent_find_any_field(event, arg->field.name); | 4027 | pevent_find_any_field(event, arg->field.name); |
4005 | if (!arg->field.field) { | 4028 | if (!arg->field.field) { |
4006 | do_warning("%s: field %s not found", | 4029 | do_warning_event(event, "%s: field %s not found", |
4007 | __func__, arg->field.name); | 4030 | __func__, arg->field.name); |
4008 | return; | 4031 | return; |
4009 | } | 4032 | } |
4010 | } | 4033 | } |
@@ -4176,7 +4199,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
4176 | case '*': | 4199 | case '*': |
4177 | /* The argument is the length. */ | 4200 | /* The argument is the length. */ |
4178 | if (!arg) { | 4201 | if (!arg) { |
4179 | do_warning("no argument match"); | 4202 | do_warning_event(event, "no argument match"); |
4180 | event->flags |= EVENT_FL_FAILED; | 4203 | event->flags |= EVENT_FL_FAILED; |
4181 | goto out_failed; | 4204 | goto out_failed; |
4182 | } | 4205 | } |
@@ -4213,7 +4236,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
4213 | case 'X': | 4236 | case 'X': |
4214 | case 'u': | 4237 | case 'u': |
4215 | if (!arg) { | 4238 | if (!arg) { |
4216 | do_warning("no argument match"); | 4239 | do_warning_event(event, "no argument match"); |
4217 | event->flags |= EVENT_FL_FAILED; | 4240 | event->flags |= EVENT_FL_FAILED; |
4218 | goto out_failed; | 4241 | goto out_failed; |
4219 | } | 4242 | } |
@@ -4223,7 +4246,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
4223 | 4246 | ||
4224 | /* should never happen */ | 4247 | /* should never happen */ |
4225 | if (len > 31) { | 4248 | if (len > 31) { |
4226 | do_warning("bad format!"); | 4249 | do_warning_event(event, "bad format!"); |
4227 | event->flags |= EVENT_FL_FAILED; | 4250 | event->flags |= EVENT_FL_FAILED; |
4228 | len = 31; | 4251 | len = 31; |
4229 | } | 4252 | } |
@@ -4290,13 +4313,13 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
4290 | trace_seq_printf(s, format, (long long)val); | 4313 | trace_seq_printf(s, format, (long long)val); |
4291 | break; | 4314 | break; |
4292 | default: | 4315 | default: |
4293 | do_warning("bad count (%d)", ls); | 4316 | do_warning_event(event, "bad count (%d)", ls); |
4294 | event->flags |= EVENT_FL_FAILED; | 4317 | event->flags |= EVENT_FL_FAILED; |
4295 | } | 4318 | } |
4296 | break; | 4319 | break; |
4297 | case 's': | 4320 | case 's': |
4298 | if (!arg) { | 4321 | if (!arg) { |
4299 | do_warning("no matching argument"); | 4322 | do_warning_event(event, "no matching argument"); |
4300 | event->flags |= EVENT_FL_FAILED; | 4323 | event->flags |= EVENT_FL_FAILED; |
4301 | goto out_failed; | 4324 | goto out_failed; |
4302 | } | 4325 | } |
@@ -4306,7 +4329,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
4306 | 4329 | ||
4307 | /* should never happen */ | 4330 | /* should never happen */ |
4308 | if (len > 31) { | 4331 | if (len > 31) { |
4309 | do_warning("bad format!"); | 4332 | do_warning_event(event, "bad format!"); |
4310 | event->flags |= EVENT_FL_FAILED; | 4333 | event->flags |= EVENT_FL_FAILED; |
4311 | len = 31; | 4334 | len = 31; |
4312 | } | 4335 | } |
diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt index 7065cd6fbdfc..4464ad770d51 100644 --- a/tools/perf/Documentation/perf-bench.txt +++ b/tools/perf/Documentation/perf-bench.txt | |||
@@ -48,6 +48,12 @@ SUBSYSTEM | |||
48 | 'mem':: | 48 | 'mem':: |
49 | Memory access performance. | 49 | Memory access performance. |
50 | 50 | ||
51 | 'numa':: | ||
52 | NUMA scheduling and MM benchmarks. | ||
53 | |||
54 | 'futex':: | ||
55 | Futex stressing benchmarks. | ||
56 | |||
51 | 'all':: | 57 | 'all':: |
52 | All benchmark subsystems. | 58 | All benchmark subsystems. |
53 | 59 | ||
@@ -187,6 +193,22 @@ Show only the result with page faults before memset. | |||
187 | --no-prefault:: | 193 | --no-prefault:: |
188 | Show only the result without page faults before memset. | 194 | Show only the result without page faults before memset. |
189 | 195 | ||
196 | SUITES FOR 'numa' | ||
197 | ~~~~~~~~~~~~~~~~~ | ||
198 | *mem*:: | ||
199 | Suite for evaluating NUMA workloads. | ||
200 | |||
201 | SUITES FOR 'futex' | ||
202 | ~~~~~~~~~~~~~~~~~~ | ||
203 | *hash*:: | ||
204 | Suite for evaluating hash tables. | ||
205 | |||
206 | *wake*:: | ||
207 | Suite for evaluating wake calls. | ||
208 | |||
209 | *requeue*:: | ||
210 | Suite for evaluating requeue calls. | ||
211 | |||
190 | SEE ALSO | 212 | SEE ALSO |
191 | -------- | 213 | -------- |
192 | linkperf:perf[1] | 214 | linkperf:perf[1] |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index cdd8d4946dba..976b00c6cdb1 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -87,7 +87,6 @@ Default is to monitor all CPUS. | |||
87 | --realtime=<priority>:: | 87 | --realtime=<priority>:: |
88 | Collect data with this RT SCHED_FIFO priority. | 88 | Collect data with this RT SCHED_FIFO priority. |
89 | 89 | ||
90 | -s <symbol>:: | ||
91 | --sym-annotate=<symbol>:: | 90 | --sym-annotate=<symbol>:: |
92 | Annotate this symbol. | 91 | Annotate this symbol. |
93 | 92 | ||
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 50d875d970c4..e96923310d57 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -192,13 +192,13 @@ endif | |||
192 | export PERL_PATH | 192 | export PERL_PATH |
193 | 193 | ||
194 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c | 194 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c |
195 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 195 | $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l |
196 | 196 | ||
197 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y | 197 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
198 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ | 198 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ |
199 | 199 | ||
200 | $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c | 200 | $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c |
201 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 201 | $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l |
202 | 202 | ||
203 | $(OUTPUT)util/pmu-bison.c: util/pmu.y | 203 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
204 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ | 204 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ |
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 97d86d828190..ebfa163b80b5 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char | |||
1593 | p->data_rand_walk = true; | 1593 | p->data_rand_walk = true; |
1594 | p->nr_loops = -1; | 1594 | p->nr_loops = -1; |
1595 | p->init_random = true; | 1595 | p->init_random = true; |
1596 | p->mb_global_str = "1"; | ||
1597 | p->nr_proc = 1; | ||
1598 | p->nr_threads = 1; | ||
1599 | p->nr_secs = 5; | ||
1596 | p->run_all = argc == 1; | 1600 | p->run_all = argc == 1; |
1597 | } | 1601 | } |
1598 | 1602 | ||
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 21c164b8f9db..0f1e5a2f6ad7 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -404,6 +404,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key) | |||
404 | } | 404 | } |
405 | 405 | ||
406 | event->key = *key; | 406 | event->key = *key; |
407 | init_stats(&event->total.stats); | ||
407 | return event; | 408 | return event; |
408 | } | 409 | } |
409 | 410 | ||
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index eb524f91bffe..8ce62ef7f6c3 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
374 | 374 | ||
375 | session = perf_session__new(file, false, NULL); | 375 | session = perf_session__new(file, false, NULL); |
376 | if (session == NULL) { | 376 | if (session == NULL) { |
377 | pr_err("Not enough memory for reading perf file header\n"); | 377 | pr_err("Perf session creation failed.\n"); |
378 | return -1; | 378 | return -1; |
379 | } | 379 | } |
380 | 380 | ||
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8b0e1c9234d9..65a151e36067 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel) | |||
174 | 174 | ||
175 | static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) | 175 | static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) |
176 | { | 176 | { |
177 | memset(evsel->priv, 0, sizeof(struct perf_stat)); | 177 | int i; |
178 | struct perf_stat *ps = evsel->priv; | ||
179 | |||
180 | for (i = 0; i < 3; i++) | ||
181 | init_stats(&ps->res_stats[i]); | ||
178 | } | 182 | } |
179 | 183 | ||
180 | static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) | 184 | static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) |
181 | { | 185 | { |
182 | evsel->priv = zalloc(sizeof(struct perf_stat)); | 186 | evsel->priv = zalloc(sizeof(struct perf_stat)); |
183 | return evsel->priv == NULL ? -ENOMEM : 0; | 187 | if (evsel == NULL) |
188 | return -ENOMEM; | ||
189 | perf_evsel__reset_stat_priv(evsel); | ||
190 | return 0; | ||
184 | } | 191 | } |
185 | 192 | ||
186 | static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) | 193 | static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index c23418225c2c..ee21fa95ebcf 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -65,10 +65,9 @@ ifndef NO_LIBELF | |||
65 | ifdef LIBDW_DIR | 65 | ifdef LIBDW_DIR |
66 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include | 66 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include |
67 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib | 67 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib |
68 | |||
69 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) | ||
70 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw | ||
71 | endif | 68 | endif |
69 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) | ||
70 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw | ||
72 | endif | 71 | endif |
73 | 72 | ||
74 | # include ARCH specific config | 73 | # include ARCH specific config |
@@ -278,6 +277,8 @@ else | |||
278 | NO_LIBELF := 1 | 277 | NO_LIBELF := 1 |
279 | NO_DWARF := 1 | 278 | NO_DWARF := 1 |
280 | NO_DEMANGLE := 1 | 279 | NO_DEMANGLE := 1 |
280 | NO_LIBUNWIND := 1 | ||
281 | NO_LIBDW_DWARF_UNWIND := 1 | ||
281 | else | 282 | else |
282 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 283 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
283 | endif | 284 | endif |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 653a8fe2db95..bfb186900ac0 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore) | |||
504 | if (ret < 0) { | 504 | if (ret < 0) { |
505 | if (!excl_kernel) { | 505 | if (!excl_kernel) { |
506 | excl_kernel = true; | 506 | excl_kernel = true; |
507 | perf_evlist__set_maps(evlist, NULL, NULL); | ||
507 | perf_evlist__delete(evlist); | 508 | perf_evlist__delete(evlist); |
508 | evlist = NULL; | 509 | evlist = NULL; |
509 | continue; | 510 | continue; |
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 1fbcd8bdc11b..55de44ecebef 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c | |||
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file) | |||
86 | 86 | ||
87 | static int open_file_write(struct perf_data_file *file) | 87 | static int open_file_write(struct perf_data_file *file) |
88 | { | 88 | { |
89 | int fd; | ||
90 | |||
89 | if (check_backup(file)) | 91 | if (check_backup(file)) |
90 | return -1; | 92 | return -1; |
91 | 93 | ||
92 | return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); | 94 | fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); |
95 | |||
96 | if (fd < 0) | ||
97 | pr_err("failed to open %s : %s\n", file->path, strerror(errno)); | ||
98 | |||
99 | return fd; | ||
93 | } | 100 | } |
94 | 101 | ||
95 | static int open_file(struct perf_data_file *file) | 102 | static int open_file(struct perf_data_file *file) |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index df0238654698..562762117639 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg, | |||
985 | 985 | ||
986 | #if _ELFUTILS_PREREQ(0, 142) | 986 | #if _ELFUTILS_PREREQ(0, 142) |
987 | /* Get the call frame information from this dwarf */ | 987 | /* Get the call frame information from this dwarf */ |
988 | pf->cfi = dwarf_getcfi(dbg->dbg); | 988 | pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg)); |
989 | #endif | 989 | #endif |
990 | 990 | ||
991 | off = 0; | 991 | off = 0; |
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno, | |||
1441 | void *data) | 1441 | void *data) |
1442 | { | 1442 | { |
1443 | struct line_finder *lf = data; | 1443 | struct line_finder *lf = data; |
1444 | int err; | ||
1444 | 1445 | ||
1445 | if ((strtailcmp(fname, lf->fname) != 0) || | 1446 | if ((strtailcmp(fname, lf->fname) != 0) || |
1446 | (lf->lno_s > lineno || lf->lno_e < lineno)) | 1447 | (lf->lno_s > lineno || lf->lno_e < lineno)) |
1447 | return 0; | 1448 | return 0; |
1448 | 1449 | ||
1449 | if (line_range_add_line(fname, lineno, lf->lr) < 0) | 1450 | err = line_range_add_line(fname, lineno, lf->lr); |
1450 | return -EINVAL; | 1451 | if (err < 0 && err != -EEXIST) |
1452 | return err; | ||
1451 | 1453 | ||
1452 | return 0; | 1454 | return 0; |
1453 | } | 1455 | } |
@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) | |||
1473 | 1475 | ||
1474 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) | 1476 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) |
1475 | { | 1477 | { |
1476 | find_line_range_by_line(in_die, data); | 1478 | int ret = find_line_range_by_line(in_die, data); |
1477 | 1479 | ||
1478 | /* | 1480 | /* |
1479 | * We have to check all instances of inlined function, because | 1481 | * We have to check all instances of inlined function, because |
1480 | * some execution paths can be optimized out depends on the | 1482 | * some execution paths can be optimized out depends on the |
1481 | * function argument of instances | 1483 | * function argument of instances. However, if an error occurs, |
1484 | * it should be handled by the caller. | ||
1482 | */ | 1485 | */ |
1483 | return 0; | 1486 | return ret < 0 ? ret : 0; |
1484 | } | 1487 | } |
1485 | 1488 | ||
1486 | /* Search function definition from function name */ | 1489 | /* Search function definition from function name */ |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 3b7dbf51d4a9..6864661a79dd 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <inttypes.h> | 6 | #include <inttypes.h> |
7 | 7 | ||
8 | #include "symbol.h" | 8 | #include "symbol.h" |
9 | #include "vdso.h" | ||
9 | #include <symbol/kallsyms.h> | 10 | #include <symbol/kallsyms.h> |
10 | #include "debug.h" | 11 | #include "debug.h" |
11 | 12 | ||
@@ -618,6 +619,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
618 | GElf_Shdr shdr; | 619 | GElf_Shdr shdr; |
619 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || | 620 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || |
620 | ehdr.e_type == ET_REL || | 621 | ehdr.e_type == ET_REL || |
622 | is_vdso_map(dso->short_name) || | ||
621 | elf_section_by_name(elf, &ehdr, &shdr, | 623 | elf_section_by_name(elf, &ehdr, &shdr, |
622 | ".gnu.prelink_undo", | 624 | ".gnu.prelink_undo", |
623 | NULL) != NULL); | 625 | NULL) != NULL); |
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index d4b601547f1f..2458a1dc2ba9 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -97,6 +97,14 @@ static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) | |||
97 | bitmap_zero(ioapic->rtc_status.dest_map, KVM_MAX_VCPUS); | 97 | bitmap_zero(ioapic->rtc_status.dest_map, KVM_MAX_VCPUS); |
98 | } | 98 | } |
99 | 99 | ||
100 | static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic); | ||
101 | |||
102 | static void rtc_status_pending_eoi_check_valid(struct kvm_ioapic *ioapic) | ||
103 | { | ||
104 | if (WARN_ON(ioapic->rtc_status.pending_eoi < 0)) | ||
105 | kvm_rtc_eoi_tracking_restore_all(ioapic); | ||
106 | } | ||
107 | |||
100 | static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | 108 | static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) |
101 | { | 109 | { |
102 | bool new_val, old_val; | 110 | bool new_val, old_val; |
@@ -120,9 +128,8 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | |||
120 | } else { | 128 | } else { |
121 | __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map); | 129 | __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map); |
122 | ioapic->rtc_status.pending_eoi--; | 130 | ioapic->rtc_status.pending_eoi--; |
131 | rtc_status_pending_eoi_check_valid(ioapic); | ||
123 | } | 132 | } |
124 | |||
125 | WARN_ON(ioapic->rtc_status.pending_eoi < 0); | ||
126 | } | 133 | } |
127 | 134 | ||
128 | void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | 135 | void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) |
@@ -149,10 +156,10 @@ static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic) | |||
149 | 156 | ||
150 | static void rtc_irq_eoi(struct kvm_ioapic *ioapic, struct kvm_vcpu *vcpu) | 157 | static void rtc_irq_eoi(struct kvm_ioapic *ioapic, struct kvm_vcpu *vcpu) |
151 | { | 158 | { |
152 | if (test_and_clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map)) | 159 | if (test_and_clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map)) { |
153 | --ioapic->rtc_status.pending_eoi; | 160 | --ioapic->rtc_status.pending_eoi; |
154 | 161 | rtc_status_pending_eoi_check_valid(ioapic); | |
155 | WARN_ON(ioapic->rtc_status.pending_eoi < 0); | 162 | } |
156 | } | 163 | } |
157 | 164 | ||
158 | static bool rtc_irq_check_coalesced(struct kvm_ioapic *ioapic) | 165 | static bool rtc_irq_check_coalesced(struct kvm_ioapic *ioapic) |
@@ -353,10 +360,16 @@ static int ioapic_service(struct kvm_ioapic *ioapic, int irq, bool line_status) | |||
353 | ioapic->irr &= ~(1 << irq); | 360 | ioapic->irr &= ~(1 << irq); |
354 | 361 | ||
355 | if (irq == RTC_GSI && line_status) { | 362 | if (irq == RTC_GSI && line_status) { |
363 | /* | ||
364 | * pending_eoi cannot ever become negative (see | ||
365 | * rtc_status_pending_eoi_check_valid) and the caller | ||
366 | * ensures that it is only called if it is >= zero, namely | ||
367 | * if rtc_irq_check_coalesced returns false). | ||
368 | */ | ||
356 | BUG_ON(ioapic->rtc_status.pending_eoi != 0); | 369 | BUG_ON(ioapic->rtc_status.pending_eoi != 0); |
357 | ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, | 370 | ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, |
358 | ioapic->rtc_status.dest_map); | 371 | ioapic->rtc_status.dest_map); |
359 | ioapic->rtc_status.pending_eoi = ret; | 372 | ioapic->rtc_status.pending_eoi = (ret < 0 ? 0 : ret); |
360 | } else | 373 | } else |
361 | ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, NULL); | 374 | ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, NULL); |
362 | 375 | ||