From 836b7aab793962aeac45cedd049970ca058258d5 Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Wed, 15 Sep 2004 17:11:52 +0000 Subject: [PATCH] kernel-2_6_6-1_441 --- .config | 137 +- .config.old | 42 +- CREDITS | 21 +- Documentation/arm/memory.txt | 24 +- Documentation/binfmt_misc.txt | 30 +- Documentation/fb/framebuffer.txt | 2 +- Documentation/filesystems/Exporting | 24 +- Documentation/filesystems/Locking | 30 +- Documentation/filesystems/ntfs.txt | 15 + Documentation/filesystems/proc.txt | 5 +- Documentation/ide.txt | 7 + Documentation/ioctl-number.txt | 2 + Documentation/kernel-parameters.txt | 4 +- Documentation/networking/00-INDEX | 2 - Documentation/networking/ip-sysctl.txt | 64 +- Documentation/networking/packet_mmap.txt | 13 - MAINTAINERS | 29 +- Makefile | 3 +- arch/alpha/kernel/init_task.c | 1 + arch/alpha/mm/numa.c | 4 +- arch/arm/Kconfig | 17 +- arch/arm/Makefile | 1 + arch/arm/boot/compressed/head.S | 14 + arch/arm/configs/ebsa110_defconfig | 587 +- arch/arm/configs/lpd7a400_defconfig | 100 +- arch/arm/configs/lpd7a404_defconfig | 83 +- arch/arm/kernel/debug.S | 3 +- arch/arm/kernel/entry-armv.S | 23 +- arch/arm/kernel/init_task.c | 1 + arch/arm/kernel/process.c | 6 + arch/arm/kernel/signal.c | 14 +- arch/arm/lib/Makefile | 1 - arch/arm/lib/io-acorn.S | 25 - arch/arm/mach-clps711x/Kconfig | 9 +- arch/arm/mach-ebsa110/io.c | 38 +- arch/arm/mach-epxa10db/Kconfig | 6 +- arch/arm/mach-footbridge/Kconfig | 7 +- arch/arm/mach-integrator/Kconfig | 5 +- arch/arm/mach-integrator/Makefile | 2 +- arch/arm/mach-integrator/impd1.c | 41 +- arch/arm/mach-integrator/integrator_cp.c | 62 + arch/arm/mach-iop3xx/Kconfig | 11 +- arch/arm/mach-ixp4xx/Kconfig | 9 +- arch/arm/mach-lh7a40x/Kconfig | 41 +- arch/arm/mach-lh7a40x/arch-lpd7a40x.c | 11 +- arch/arm/mach-omap/Kconfig | 10 +- arch/arm/mach-omap/board-generic.c | 3 +- arch/arm/mach-omap/board-innovator.c | 15 +- arch/arm/mach-omap/board-osk.c | 1 + arch/arm/mach-omap/board-perseus2.c | 6 +- arch/arm/mach-omap/bus.c | 3 +- arch/arm/mach-omap/clocks.c | 22 +- arch/arm/mach-omap/common.c | 65 +- arch/arm/mach-omap/dma.c | 230 +- arch/arm/mach-omap/fpga.c | 28 +- arch/arm/mach-omap/gpio.c | 87 +- arch/arm/mach-omap/irq.c | 22 +- arch/arm/mach-omap/ocpi.c | 8 - arch/arm/mach-pxa/Kconfig | 3 +- arch/arm/mach-pxa/idp.c | 2 + arch/arm/mach-pxa/leds-idp.c | 2 + arch/arm/mach-pxa/leds-lubbock.c | 1 + arch/arm/mach-pxa/leds-mainstone.c | 2 + arch/arm/mach-pxa/lubbock.c | 1 + arch/arm/mach-pxa/mainstone.c | 2 + arch/arm/mach-pxa/pm.c | 1 + arch/arm/mach-s3c2410/Kconfig | 8 +- arch/arm/mach-sa1100/Kconfig | 36 +- arch/arm/mach-sa1100/cpu-sa1100.c | 5 +- arch/arm/mach-sa1100/cpu-sa1110.c | 5 +- arch/arm/mach-versatile/Makefile | 2 +- arch/arm/mm/fault-armv.c | 14 +- arch/arm/mm/fault.c | 2 +- arch/arm/mm/mmap.c | 2 +- arch/arm/mm/proc-syms.c | 3 - arch/arm/tools/mach-types | 17 +- arch/arm26/kernel/init_task.c | 1 + arch/cris/arch-v10/drivers/ethernet.c | 4 +- arch/cris/kernel/process.c | 1 + arch/h8300/Kconfig | 2 +- arch/h8300/kernel/init_task.c | 1 + arch/h8300/kernel/ptrace.c | 28 +- arch/h8300/platform/h8s/entry.S | 2 +- arch/h8300/platform/h8s/ptrace_h8s.c | 2 +- arch/i386/Kconfig | 14 +- arch/i386/defconfig | 93 +- arch/i386/kernel/Makefile | 1 - arch/i386/kernel/acpi/boot.c | 36 +- arch/i386/kernel/apic.c | 12 +- arch/i386/kernel/cpu/cpufreq/elanfreq.c | 3 +- arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 4 +- arch/i386/kernel/cpu/cpufreq/longhaul.c | 124 +- arch/i386/kernel/cpu/cpufreq/p4-clockmod.c | 29 +- arch/i386/kernel/cpu/cpufreq/powernow-k7.c | 8 +- arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 33 +- arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 70 +- arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | 17 +- arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | 2 +- arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 34 +- arch/i386/kernel/dmi_scan.c | 18 +- arch/i386/kernel/efi.c | 1 - arch/i386/kernel/i386_ksyms.c | 1 - arch/i386/kernel/i8259.c | 5 - arch/i386/kernel/init_task.c | 1 + arch/i386/kernel/io_apic.c | 103 +- arch/i386/kernel/irq.c | 2 +- arch/i386/kernel/mpparse.c | 140 +- arch/i386/kernel/process.c | 2 +- arch/i386/kernel/setup.c | 207 +- arch/i386/kernel/signal.c | 18 +- arch/i386/kernel/smp.c | 1 - arch/i386/kernel/smpboot.c | 1 - arch/i386/kernel/time_hpet.c | 46 + arch/i386/kernel/timers/timer_cyclone.c | 12 + arch/i386/kernel/timers/timer_pm.c | 38 + arch/i386/kernel/traps.c | 6 +- arch/i386/kernel/vm86.c | 33 +- arch/i386/lib/Makefile | 5 +- arch/i386/lib/delay.c | 7 +- arch/i386/mach-es7000/es7000plat.c | 2 - arch/i386/mach-visws/mpparse.c | 4 +- arch/i386/mach-visws/traps.c | 1 - arch/i386/mach-voyager/voyager_basic.c | 1 - arch/i386/mach-voyager/voyager_smp.c | 1 - arch/i386/mach-voyager/voyager_thread.c | 1 - arch/i386/math-emu/errors.c | 10 +- arch/i386/math-emu/fpu_arith.c | 36 +- arch/i386/math-emu/fpu_aux.c | 20 +- arch/i386/math-emu/fpu_entry.c | 33 +- arch/i386/math-emu/fpu_etc.c | 2 +- arch/i386/math-emu/fpu_proto.h | 42 +- arch/i386/math-emu/fpu_system.h | 2 +- arch/i386/math-emu/get_address.c | 30 +- arch/i386/math-emu/load_store.c | 52 +- arch/i386/math-emu/reg_compare.c | 12 +- arch/i386/math-emu/reg_ld_str.c | 150 +- arch/i386/mm/fault.c | 3 +- arch/i386/mm/hugetlbpage.c | 12 +- arch/i386/mm/init.c | 1 - arch/i386/mm/ioremap.c | 1 - arch/i386/pci/acpi.c | 31 +- arch/i386/pci/fixup.c | 7 +- arch/ia64/Kconfig | 18 +- arch/ia64/ia32/binfmt_elf32.c | 13 + arch/ia64/ia32/ia32_entry.S | 4 +- arch/ia64/kernel/acpi.c | 23 +- arch/ia64/kernel/entry.S | 2 +- arch/ia64/kernel/fsys.S | 3 +- arch/ia64/kernel/gate.S | 6 +- arch/ia64/kernel/head.S | 36 + arch/ia64/kernel/init_task.c | 1 + arch/ia64/kernel/iosapic.c | 209 +- arch/ia64/kernel/irq.c | 6 +- arch/ia64/kernel/setup.c | 17 +- arch/ia64/kernel/smpboot.c | 3 +- arch/ia64/kernel/time.c | 8 - arch/ia64/kernel/vmlinux.lds.S | 5 +- arch/ia64/lib/Makefile | 2 +- arch/ia64/pci/pci.c | 20 +- arch/ia64/sn/io/machvec/iomv.c | 2 +- arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c | 50 +- arch/m68k/kernel/process.c | 1 + arch/m68knommu/kernel/init_task.c | 1 + arch/mips/kernel/init_task.c | 1 + arch/parisc/kernel/init_task.c | 1 + arch/ppc/8260_io/fcc_enet.c | 57 +- arch/ppc/8260_io/uart.c | 4 +- arch/ppc/Kconfig | 48 +- arch/ppc/Makefile | 14 +- arch/ppc/boot/simple/embed_config.c | 86 +- arch/ppc/kernel/Makefile | 4 + arch/ppc/kernel/align.c | 10 +- arch/ppc/kernel/asm-offsets.c | 8 +- arch/ppc/kernel/cputable.c | 21 +- arch/ppc/kernel/entry.S | 36 +- arch/ppc/kernel/irq.c | 8 +- arch/ppc/kernel/misc.S | 40 +- arch/ppc/kernel/pci.c | 19 +- arch/ppc/kernel/ppc_htab.c | 16 +- arch/ppc/kernel/ppc_ksyms.c | 15 +- arch/ppc/kernel/process.c | 106 +- arch/ppc/kernel/ptrace.c | 87 +- arch/ppc/kernel/signal.c | 45 +- arch/ppc/kernel/traps.c | 91 +- arch/ppc/lib/locks.c | 25 +- arch/ppc/mm/Makefile | 1 + arch/ppc/mm/fault.c | 14 +- arch/ppc/mm/init.c | 6 + arch/ppc/mm/mmu_decl.h | 9 + arch/ppc/mm/pgtable.c | 32 + arch/ppc/mm/tlb.c | 11 + arch/ppc/platforms/Makefile | 1 + arch/ppc/syslib/Makefile | 14 +- arch/ppc/syslib/open_pic.c | 2 +- arch/ppc64/Kconfig | 1 - arch/ppc64/Makefile | 2 +- arch/ppc64/kernel/align.c | 13 +- arch/ppc64/kernel/asm-offsets.c | 13 +- arch/ppc64/kernel/entry.S | 487 +- arch/ppc64/kernel/head.S | 1465 ++-- arch/ppc64/kernel/iSeries_setup.c | 13 +- arch/ppc64/kernel/init_task.c | 1 + arch/ppc64/kernel/mf_proc.c | 37 +- arch/ppc64/kernel/misc.S | 25 +- arch/ppc64/kernel/pacaData.c | 2 - arch/ppc64/kernel/pmac_feature.c | 4 + arch/ppc64/kernel/process.c | 93 +- arch/ppc64/kernel/ptrace.c | 12 +- arch/ppc64/kernel/ptrace32.c | 18 +- arch/ppc64/kernel/rtas.c | 6 +- arch/ppc64/kernel/signal.c | 12 +- arch/ppc64/kernel/signal32.c | 14 +- arch/ppc64/kernel/smp.c | 23 +- arch/ppc64/kernel/sys_ppc32.c | 8 +- arch/ppc64/kernel/syscalls.c | 14 + arch/ppc64/kernel/sysfs.c | 10 + arch/ppc64/kernel/traps.c | 38 +- arch/ppc64/kernel/vio.c | 28 +- arch/ppc64/kernel/viopath.c | 10 +- arch/ppc64/mm/fault.c | 57 +- arch/ppc64/mm/hash_utils.c | 10 +- arch/ppc64/mm/hugetlbpage.c | 5 +- arch/ppc64/mm/init.c | 5 +- arch/ppc64/mm/tlb.c | 33 +- arch/ppc64/xmon/xmon.c | 3 - arch/s390/appldata/appldata_base.c | 16 +- arch/s390/defconfig | 9 +- arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kernel/compat_signal.c | 54 +- arch/s390/kernel/compat_wrapper.S | 2 + arch/s390/kernel/debug.c | 24 +- arch/s390/kernel/entry.S | 93 +- arch/s390/kernel/entry64.S | 97 +- arch/s390/kernel/head.S | 126 +- arch/s390/kernel/head64.S | 134 +- arch/s390/kernel/init_task.c | 1 + arch/s390/kernel/process.c | 13 +- arch/s390/kernel/profile.c | 3 +- arch/s390/kernel/ptrace.c | 28 +- arch/s390/kernel/s390_ksyms.c | 19 - arch/s390/kernel/setup.c | 4 +- arch/s390/kernel/signal.c | 48 +- arch/s390/kernel/sys_s390.c | 46 +- arch/s390/kernel/traps.c | 4 +- arch/s390/lib/Makefile | 6 +- arch/s390/lib/uaccess.S | 67 +- arch/s390/lib/uaccess64.S | 65 +- arch/s390/mm/extmem.c | 24 +- arch/s390/mm/ioremap.c | 2 +- arch/sh/kernel/init_task.c | 1 + arch/sparc/kernel/init_task.c | 3 +- arch/sparc/kernel/unaligned.c | 8 +- arch/sparc/mm/fault.c | 27 +- arch/sparc/mm/srmmu.c | 64 +- arch/sparc/mm/sun4c.c | 4 - arch/sparc64/defconfig | 10 +- arch/sparc64/kernel/chmc.c | 5 +- arch/sparc64/kernel/init_task.c | 1 + arch/sparc64/kernel/irq.c | 4 + arch/sparc64/kernel/smp.c | 27 +- arch/sparc64/kernel/sparc64_ksyms.c | 5 + arch/sparc64/kernel/sys32.S | 2 +- arch/sparc64/kernel/sys_sunos32.c | 4 +- arch/sparc64/kernel/unaligned.c | 4 +- arch/sparc64/lib/Makefile | 3 +- arch/sparc64/lib/debuglocks.c | 31 +- arch/sparc64/math-emu/sfp-util.h | 180 +- arch/sparc64/mm/fault.c | 15 +- arch/sparc64/mm/init.c | 19 +- arch/um/kernel/init_task.c | 1 + arch/v850/kernel/init_task.c | 1 + arch/x86_64/Makefile | 2 + arch/x86_64/defconfig | 4 +- arch/x86_64/ia32/fpu32.c | 16 +- arch/x86_64/ia32/ia32_ioctl.c | 10 +- arch/x86_64/ia32/ia32_signal.c | 36 +- arch/x86_64/ia32/ia32entry.S | 61 +- arch/x86_64/ia32/ptrace32.c | 30 +- arch/x86_64/ia32/sys_ia32.c | 111 +- arch/x86_64/ia32/syscall32.c | 6 +- arch/x86_64/ia32/tls32.c | 13 +- arch/x86_64/kernel/acpi/sleep.c | 1 - arch/x86_64/kernel/e820.c | 2 +- arch/x86_64/kernel/head64.c | 9 + arch/x86_64/kernel/i387.c | 10 +- arch/x86_64/kernel/init_task.c | 1 + arch/x86_64/kernel/io_apic.c | 3 +- arch/x86_64/kernel/irq.c | 6 +- arch/x86_64/kernel/ldt.c | 8 +- arch/x86_64/kernel/mce.c | 62 +- arch/x86_64/kernel/mpparse.c | 118 +- arch/x86_64/kernel/msr.c | 18 +- arch/x86_64/kernel/process.c | 9 +- arch/x86_64/kernel/ptrace.c | 41 +- arch/x86_64/kernel/setup.c | 29 +- arch/x86_64/kernel/setup64.c | 5 +- arch/x86_64/kernel/signal.c | 37 +- arch/x86_64/kernel/smpboot.c | 10 +- arch/x86_64/kernel/sys_x86_64.c | 8 +- arch/x86_64/kernel/traps.c | 4 +- arch/x86_64/kernel/vmlinux.lds.S | 5 +- arch/x86_64/kernel/x8664_ksyms.c | 3 - arch/x86_64/lib/Makefile | 4 +- arch/x86_64/lib/csum-wrappers.c | 12 +- arch/x86_64/lib/io.c | 10 +- arch/x86_64/lib/usercopy.c | 16 +- arch/x86_64/mm/fault.c | 8 +- arch/x86_64/mm/init.c | 4 +- arch/x86_64/mm/ioremap.c | 1 + arch/x86_64/mm/numa.c | 4 +- arch/x86_64/mm/pageattr.c | 39 +- crypto/digest.c | 27 +- drivers/acpi/Kconfig | 2 +- drivers/acpi/pci_irq.c | 119 +- drivers/acpi/pci_link.c | 26 +- drivers/acpi/pci_root.c | 49 +- drivers/acpi/tables.c | 6 +- drivers/acpi/thermal.c | 7 + drivers/atm/ambassador.c | 524 +- drivers/atm/atmtcp.c | 4 +- drivers/atm/eni.c | 10 +- drivers/atm/firestream.c | 6 +- drivers/atm/fore200e.c | 39 +- drivers/atm/fore200e.h | 26 +- drivers/atm/he.c | 10 +- drivers/atm/horizon.c | 252 +- drivers/atm/idt77105.c | 11 +- drivers/atm/iphase.c | 12 +- drivers/atm/iphase.h | 2 +- drivers/atm/lanai.c | 2 +- drivers/atm/nicstar.c | 10 +- drivers/atm/suni.c | 23 +- drivers/atm/uPD98402.c | 15 +- drivers/atm/zatm.c | 14 +- drivers/base/cpu.c | 4 +- drivers/base/node.c | 7 +- drivers/block/DAC960.c | 22 +- drivers/block/DAC960.h | 10 +- drivers/block/Kconfig | 9 +- drivers/block/carmel.c | 2 +- drivers/block/cciss.c | 245 +- drivers/block/cciss_scsi.c | 2 +- drivers/block/cfq-iosched.c | 156 +- drivers/block/cpqarray.c | 16 +- drivers/block/elevator.c | 8 + drivers/block/floppy.c | 2 +- drivers/block/ida_ioctl.h | 2 +- drivers/block/ll_rw_blk.c | 11 +- drivers/block/loop.c | 4 +- drivers/block/paride/epat.c | 39 +- drivers/block/paride/pf.c | 2 +- drivers/block/paride/pg.c | 12 +- drivers/block/paride/pt.c | 12 +- drivers/block/ps2esdi.c | 16 +- drivers/block/rd.c | 15 +- drivers/block/umem.c | 2 +- drivers/block/xd.c | 8 +- drivers/bluetooth/hci_ldisc.c | 4 +- drivers/bluetooth/hci_vhci.c | 11 +- drivers/cdrom/aztcd.c | 45 +- drivers/cdrom/cdrom.c | 62 +- drivers/cdrom/cdu31a.c | 13 +- drivers/cdrom/optcd.c | 67 +- drivers/cdrom/sjcd.c | 31 +- drivers/cdrom/sonycd535.c | 24 +- drivers/char/Kconfig | 49 +- drivers/char/Makefile | 2 +- drivers/char/applicom.c | 19 +- drivers/char/cyclades.c | 59 +- drivers/char/drm/drm_agpsupport.h | 2 - drivers/char/drm/drm_ioctl.h | 7 + drivers/char/drm/gamma_dma.c | 45 +- drivers/char/drm/r128_state.c | 8 +- drivers/char/drm/radeon.h | 4 +- drivers/char/drm/radeon_drm.h | 3 +- drivers/char/drm/radeon_drv.h | 1 + drivers/char/drm/radeon_mem.c | 4 +- drivers/char/drm/radeon_state.c | 2 + drivers/char/drm/sis_mm.c | 4 +- drivers/char/i8k.c | 22 +- drivers/char/ipmi/ipmi_bt_sm.c | 2 +- drivers/char/ipmi/ipmi_devintf.c | 31 +- drivers/char/ipmi/ipmi_kcs_sm.c | 2 +- drivers/char/ipmi/ipmi_msghandler.c | 89 +- drivers/char/ipmi/ipmi_si_intf.c | 65 +- drivers/char/ipmi/ipmi_smic_sm.c | 2 +- drivers/char/ipmi/ipmi_watchdog.c | 31 +- drivers/char/istallion.c | 2 +- drivers/char/keyboard.c | 5 +- drivers/char/lp.c | 16 +- drivers/char/mem.c | 1 - drivers/char/mwave/3780i.c | 20 +- drivers/char/mwave/3780i.h | 10 +- drivers/char/mwave/mwavedd.c | 37 +- drivers/char/mwave/tp3780i.c | 4 +- drivers/char/mwave/tp3780i.h | 4 +- drivers/char/nvram.c | 4 +- drivers/char/pcmcia/synclink_cs.c | 123 +- drivers/char/ppdev.c | 51 +- drivers/char/rtc.c | 5 + drivers/char/scx200_gpio.c | 4 +- drivers/char/sonypi.c | 24 +- drivers/char/synclink.c | 155 +- drivers/char/synclinkmp.c | 171 +- drivers/char/toshiba.c | 7 +- drivers/char/tpqic02.c | 19 +- drivers/char/tty_io.c | 83 +- drivers/char/watchdog/acquirewdt.c | 12 +- drivers/char/watchdog/advantechwdt.c | 14 +- drivers/char/watchdog/alim1535_wdt.c | 14 +- drivers/char/watchdog/alim7101_wdt.c | 14 +- drivers/char/watchdog/cpu5wdt.c | 9 +- drivers/char/watchdog/eurotechwdt.c | 17 +- drivers/char/watchdog/i8xx_tco.c | 14 +- drivers/char/watchdog/ib700wdt.c | 12 +- drivers/char/watchdog/machzwd.c | 9 +- drivers/char/watchdog/mixcomwd.c | 9 +- drivers/char/watchdog/pcwd.c | 26 +- drivers/char/watchdog/pcwd_pci.c | 56 +- drivers/char/watchdog/pcwd_usb.c | 48 +- drivers/char/watchdog/sbc60xxwdt.c | 14 +- drivers/char/watchdog/sc1200wdt.c | 16 +- drivers/char/watchdog/sc520_wdt.c | 14 +- drivers/char/watchdog/scx200_wdt.c | 13 +- drivers/char/watchdog/softdog.c | 12 +- drivers/char/watchdog/w83627hf_wdt.c | 14 +- drivers/char/watchdog/w83877f_wdt.c | 14 +- drivers/char/watchdog/wafer5823wdt.c | 15 +- drivers/char/watchdog/wdt.c | 16 +- drivers/char/watchdog/wdt_pci.c | 16 +- drivers/cpufreq/cpufreq.c | 7 +- drivers/cpufreq/cpufreq_userspace.c | 4 +- drivers/cpufreq/proc_intf.c | 2 +- drivers/fc4/fc.c | 2 +- drivers/firmware/edd.c | 52 +- drivers/i2c/i2c-core.c | 10 +- drivers/ide/Kconfig | 76 +- drivers/ide/Makefile | 1 - drivers/ide/ide-cd.c | 101 +- drivers/ide/ide-cd.h | 2 - drivers/ide/ide-disk.c | 206 +- drivers/ide/ide-dma.c | 4 +- drivers/ide/ide-floppy.c | 15 +- drivers/ide/ide-io.c | 23 +- drivers/ide/ide-pnp.c | 37 +- drivers/ide/ide-probe.c | 28 +- drivers/ide/ide-proc.c | 87 +- drivers/ide/ide-tape.c | 20 +- drivers/ide/ide-taskfile.c | 216 +- drivers/ide/ide.c | 52 +- drivers/ide/legacy/pdc4030.c | 6 - drivers/ide/pci/aec62xx.c | 10 +- drivers/ide/pci/alim15x3.c | 16 +- drivers/ide/pci/cmd64x.c | 6 +- drivers/ide/pci/cs5520.c | 21 +- drivers/ide/pci/cs5530.c | 14 +- drivers/ide/pci/hpt34x.c | 4 +- drivers/ide/pci/hpt366.c | 16 +- drivers/ide/pci/ns87415.c | 12 +- drivers/ide/pci/pdc202xx_new.c | 10 +- drivers/ide/pci/pdc202xx_old.c | 12 +- drivers/ide/pci/piix.c | 47 +- drivers/ide/pci/rz1000.c | 14 +- drivers/ide/pci/sc1200.c | 13 +- drivers/ide/pci/siimage.c | 38 +- drivers/ide/pci/sis5513.c | 15 +- drivers/ide/pci/sl82c105.c | 15 +- drivers/ide/pci/slc90e66.c | 14 +- drivers/ide/pci/triflex.c | 21 +- drivers/ide/pci/trm290.c | 14 +- drivers/ide/pci/via82cxxx.c | 15 +- drivers/ieee1394/csr1212.c | 6 +- drivers/ieee1394/csr1212.h | 6 +- drivers/ieee1394/eth1394.c | 17 +- drivers/ieee1394/highlevel.c | 2 +- drivers/ieee1394/hosts.c | 22 +- drivers/ieee1394/hosts.h | 2 +- drivers/ieee1394/ieee1394_core.c | 6 + drivers/ieee1394/nodemgr.c | 14 +- drivers/ieee1394/ohci1394.c | 8 +- drivers/ieee1394/sbp2.c | 4 +- drivers/ieee1394/video1394.c | 4 + drivers/input/Kconfig | 7 + drivers/input/evbug.c | 14 +- drivers/input/evdev.c | 8 +- drivers/input/gameport/cs461x.c | 30 +- drivers/input/gameport/emu10k1-gp.c | 12 +- drivers/input/gameport/fm801-gp.c | 2 +- drivers/input/gameport/gameport.c | 2 +- drivers/input/gameport/lightning.c | 16 +- drivers/input/gameport/ns558.c | 14 +- drivers/input/gameport/vortex.c | 6 +- drivers/input/input.c | 40 +- drivers/input/joydev.c | 57 +- drivers/input/joystick/Kconfig | 16 +- drivers/input/joystick/a3d.c | 14 +- drivers/input/joystick/adi.c | 30 +- drivers/input/joystick/amijoy.c | 2 +- drivers/input/joystick/analog.c | 42 +- drivers/input/joystick/cobra.c | 10 +- drivers/input/joystick/db9.c | 24 +- drivers/input/joystick/gamecon.c | 32 +- drivers/input/joystick/gf2k.c | 12 +- drivers/input/joystick/grip.c | 6 +- drivers/input/joystick/grip_mp.c | 44 +- drivers/input/joystick/guillemot.c | 8 +- drivers/input/joystick/iforce/Kconfig | 2 +- drivers/input/joystick/iforce/Makefile | 6 +- drivers/input/joystick/iforce/iforce-ff.c | 4 +- drivers/input/joystick/iforce/iforce-main.c | 4 +- .../input/joystick/iforce/iforce-packets.c | 4 +- drivers/input/joystick/iforce/iforce-serio.c | 2 +- drivers/input/joystick/iforce/iforce.h | 2 +- drivers/input/joystick/interact.c | 8 +- drivers/input/joystick/joydump.c | 10 +- drivers/input/joystick/magellan.c | 12 +- drivers/input/joystick/sidewinder.c | 20 +- drivers/input/joystick/spaceball.c | 20 +- drivers/input/joystick/spaceorb.c | 18 +- drivers/input/joystick/stinger.c | 6 +- drivers/input/joystick/tmdc.c | 24 +- drivers/input/joystick/turbografx.c | 20 +- drivers/input/joystick/twidjoy.c | 15 +- drivers/input/joystick/warrior.c | 32 +- drivers/input/keyboard/Kconfig | 16 +- drivers/input/keyboard/atkbd.c | 57 +- drivers/input/keyboard/maple_keyb.c | 2 +- drivers/input/keyboard/sunkbd.c | 16 +- drivers/input/keyboard/xtkbd.c | 12 +- drivers/input/misc/Kconfig | 4 - drivers/input/misc/pcspkr.c | 4 +- drivers/input/misc/sparcspkr.c | 8 +- drivers/input/misc/uinput.c | 56 +- drivers/input/mouse/Kconfig | 11 - drivers/input/mouse/Makefile | 1 - drivers/input/mouse/logips2pp.c | 266 +- drivers/input/mouse/logips2pp.h | 9 +- drivers/input/mouse/psmouse-base.c | 175 +- drivers/input/mouse/psmouse.h | 11 +- drivers/input/mouse/synaptics.c | 453 +- drivers/input/mouse/synaptics.h | 23 +- drivers/input/mousedev.c | 290 +- drivers/input/power.c | 27 +- drivers/input/serio/Kconfig | 10 - drivers/input/serio/ambakmi.c | 38 +- drivers/input/serio/ct82c710.c | 8 +- drivers/input/serio/gscps2.c | 22 +- drivers/input/serio/i8042.c | 44 +- drivers/input/serio/parkbd.c | 23 +- drivers/input/serio/q40kbd.c | 13 +- drivers/input/serio/rpckbd.c | 2 +- drivers/input/serio/serio.c | 17 +- drivers/input/serio/serport.c | 10 +- drivers/input/touchscreen/gunze.c | 8 +- drivers/input/touchscreen/h3600_ts_input.c | 112 +- drivers/input/tsdev.c | 2 +- drivers/isdn/hisax/nj_s.c | 20 +- drivers/isdn/i4l/isdn_common.c | 2 +- drivers/md/Kconfig | 20 + drivers/md/Makefile | 9 +- drivers/md/dm-ioctl.c | 10 +- drivers/md/dm-table.c | 4 +- drivers/md/dm.c | 2 +- drivers/md/md.c | 177 +- drivers/md/multipath.c | 47 +- drivers/md/raid1.c | 208 +- drivers/md/raid5.c | 31 +- drivers/md/raid6main.c | 31 +- drivers/media/common/saa7146_fops.c | 2 +- drivers/media/dvb/frontends/tda1004x.c | 1 + drivers/message/fusion/isense.c | 8 - drivers/message/fusion/linux_compat.h | 189 - drivers/message/fusion/lsi/mpi_type.h | 17 +- drivers/message/fusion/mptbase.c | 18 +- drivers/message/fusion/mptbase.h | 10 +- drivers/message/fusion/mptctl.c | 226 +- drivers/message/fusion/mptctl.h | 10 +- drivers/message/fusion/mptlan.c | 19 +- drivers/message/fusion/mptscsih.c | 73 +- drivers/message/fusion/mptscsih.h | 71 - drivers/message/i2o/i2o_block.c | 8 +- drivers/message/i2o/i2o_config.c | 2 +- drivers/message/i2o/i2o_core.c | 159 +- drivers/message/i2o/i2o_scsi.c | 97 +- drivers/misc/ibmasm/ibmasmfs.c | 28 +- drivers/mtd/chips/jedec_probe.c | 42 + drivers/mtd/maps/Kconfig | 8 + drivers/mtd/maps/Makefile | 1 + drivers/mtd/maps/lubbock-flash.c | 3 +- drivers/mtd/mtdblock.c | 2 +- drivers/net/3c501.c | 2 +- drivers/net/3c503.c | 6 +- drivers/net/3c505.c | 3 +- drivers/net/3c507.c | 4 +- drivers/net/3c509.c | 51 +- drivers/net/3c523.c | 4 +- drivers/net/3c527.c | 5 +- drivers/net/3c59x.c | 26 +- drivers/net/8139cp.c | 3 +- drivers/net/8139too.c | 5 +- drivers/net/82596.c | 5 +- drivers/net/Kconfig | 137 +- drivers/net/Makefile | 2 +- drivers/net/Space.c | 4 +- drivers/net/ac3200.c | 8 +- drivers/net/acenic.c | 248 +- drivers/net/acenic.h | 1 - drivers/net/amd8111e.c | 6 +- drivers/net/apne.c | 6 +- drivers/net/appletalk/cops.c | 2 +- drivers/net/appletalk/ipddp.c | 2 +- drivers/net/arm/Kconfig | 17 + drivers/net/arm/Makefile | 1 + drivers/net/arm/am79c961a.c | 89 +- drivers/net/at1700.c | 107 +- drivers/net/au1000_eth.c | 2 +- drivers/net/b44.c | 2 +- drivers/net/bonding/bond_main.c | 20 +- drivers/net/cs89x0.c | 8 +- drivers/net/defxx.c | 6 +- drivers/net/depca.c | 2 +- drivers/net/depca.h | 2 +- drivers/net/dl2k.c | 8 +- drivers/net/e100.c | 14 +- drivers/net/e1000/e1000_ethtool.c | 5 +- drivers/net/e1000/e1000_main.c | 10 +- drivers/net/e2100.c | 6 +- drivers/net/eepro.c | 6 +- drivers/net/eepro100.c | 6 +- drivers/net/eexpress.c | 2 + drivers/net/epic100.c | 37 +- drivers/net/eql.c | 48 +- drivers/net/es3210.c | 2 + drivers/net/eth16i.c | 10 +- drivers/net/ewrk3.c | 14 +- drivers/net/ewrk3.h | 2 +- drivers/net/fc/iph5526.c | 2 +- drivers/net/fealnx.c | 8 +- drivers/net/fmv18x.c | 6 +- drivers/net/forcedeth.c | 7 +- drivers/net/hamachi.c | 8 +- drivers/net/hamradio/baycom_epp.c | 2 - drivers/net/hamradio/baycom_par.c | 3 - drivers/net/hamradio/baycom_ser_fdx.c | 3 - drivers/net/hamradio/baycom_ser_hdx.c | 3 - drivers/net/hamradio/bpqether.c | 2 +- drivers/net/hamradio/scc.c | 6 +- drivers/net/hp-plus.c | 6 +- drivers/net/hp.c | 10 +- drivers/net/hp100.c | 2 + drivers/net/ibm_emac/ibm_emac_core.c | 2 +- drivers/net/ibmlana.c | 6 +- drivers/net/ibmveth.c | 4 +- drivers/net/ioc3-eth.c | 3 +- drivers/net/irda/ali-ircc.c | 30 +- drivers/net/irda/ali-ircc.h | 3 + drivers/net/irda/irtty-sir.c | 10 +- drivers/net/irda/nsc-ircc.c | 30 +- drivers/net/irda/nsc-ircc.h | 3 + drivers/net/irda/smsc-ircc2.c | 31 +- drivers/net/irda/via-ircc.c | 28 +- drivers/net/irda/via-ircc.h | 3 + drivers/net/irda/w83977af_ir.c | 31 +- drivers/net/irda/w83977af_ir.h | 3 + drivers/net/isa-skeleton.c | 2 + drivers/net/ixgb/ixgb_ethtool.c | 6 +- drivers/net/ixgb/ixgb_main.c | 5 +- drivers/net/jazzsonic.c | 4 +- drivers/net/lance.c | 2 + drivers/net/lasi_82596.c | 1 - drivers/net/lne390.c | 10 +- drivers/net/lp486e.c | 4 +- drivers/net/macsonic.c | 1 - drivers/net/natsemi.c | 15 +- drivers/net/ne-h8300.c | 6 +- drivers/net/ne.c | 6 +- drivers/net/ne2.c | 8 +- drivers/net/ne3210.c | 10 +- drivers/net/ni52.c | 4 +- drivers/net/ns83820.c | 8 +- drivers/net/oaknet.c | 2 +- drivers/net/pci-skeleton.c | 2 +- drivers/net/pcmcia/3c574_cs.c | 2 +- drivers/net/pcmcia/axnet_cs.c | 2 +- drivers/net/pcmcia/pcnet_cs.c | 2 +- drivers/net/pcmcia/smc91c92_cs.c | 8 +- drivers/net/pcmcia/xirc2ps_cs.c | 2 +- drivers/net/pcnet32.c | 3 +- drivers/net/plip.c | 2 +- drivers/net/r8169.c | 2 +- drivers/net/rrunner.c | 2 +- drivers/net/s2io.c | 82 +- drivers/net/s2io.h | 1 - drivers/net/sb1000.c | 4 +- drivers/net/sb1250-mac.c | 2 +- drivers/net/shaper.c | 2 +- drivers/net/sis900.c | 2 +- drivers/net/slip.c | 32 +- drivers/net/smc-mca.c | 4 +- drivers/net/smc-ultra.c | 6 +- drivers/net/smc-ultra32.c | 4 +- drivers/net/smc9194.c | 8 +- drivers/net/starfire.c | 8 +- drivers/net/stnic.c | 4 +- drivers/net/sun3_82586.c | 4 +- drivers/net/sun3lance.c | 1 - drivers/net/sundance.c | 7 +- drivers/net/sungem.c | 4 +- drivers/net/sunhme.c | 4 +- drivers/net/tg3.c | 27 +- drivers/net/tlan.c | 2 +- drivers/net/tulip/Kconfig | 15 +- drivers/net/tulip/de4x5.c | 2 +- drivers/net/tulip/de4x5.h | 2 +- drivers/net/tulip/interrupt.c | 4 + drivers/net/tulip/tulip_core.c | 6 +- drivers/net/tulip/winbond-840.c | 10 +- drivers/net/tulip/xircom_tulip_cb.c | 6 +- drivers/net/tun.c | 14 +- drivers/net/typhoon.c | 4 +- drivers/net/via-rhine.c | 311 +- drivers/net/wan/dlci.c | 6 +- drivers/net/wan/pc300_drv.c | 2 +- drivers/net/wan/sbni.c | 2 +- drivers/net/wan/sdla.c | 8 +- drivers/net/wd.c | 6 +- drivers/net/wireless/airo.c | 187 +- drivers/net/wireless/prism54/isl_38xx.c | 134 +- drivers/net/wireless/prism54/isl_38xx.h | 10 - drivers/net/wireless/prism54/isl_ioctl.c | 196 +- drivers/net/wireless/prism54/isl_ioctl.h | 1 - drivers/net/wireless/prism54/islpci_dev.c | 161 +- drivers/net/wireless/prism54/islpci_dev.h | 22 +- drivers/net/wireless/prism54/islpci_eth.c | 73 +- drivers/net/wireless/prism54/islpci_hotplug.c | 3 +- drivers/net/wireless/prism54/islpci_mgt.c | 163 +- drivers/net/wireless/prism54/islpci_mgt.h | 11 +- drivers/net/wireless/prism54/oid_mgt.c | 88 +- drivers/net/wireless/prism54/oid_mgt.h | 2 +- drivers/net/wireless/wavelan_cs.c | 4 +- drivers/net/wireless/wl3501_cs.c | 4 +- drivers/net/yellowfin.c | 13 +- drivers/net/zorro8390.c | 6 +- drivers/parisc/ccio-dma.c | 1 - drivers/parisc/ccio-rm-dma.c | 1 - drivers/pci/pci.ids | 3 + drivers/pcmcia/ds.c | 17 +- drivers/pcmcia/i82365.c | 14 +- drivers/pcmcia/pxa2xx_base.c | 127 +- drivers/pcmcia/pxa2xx_lubbock.c | 1 + drivers/pcmcia/pxa2xx_mainstone.c | 2 + drivers/pcmcia/sa11xx_base.c | 104 +- drivers/pcmcia/soc_common.c | 51 + drivers/pcmcia/soc_common.h | 8 + drivers/pcmcia/yenta_socket.c | 1 + drivers/pnp/isapnp/core.c | 5 - drivers/pnp/isapnp/proc.c | 2 +- drivers/pnp/pnpbios/proc.c | 2 +- drivers/s390/block/dasd.c | 6 +- drivers/s390/block/dasd_cmb.c | 4 +- drivers/s390/block/dasd_diag.c | 8 +- drivers/s390/block/dasd_eckd.c | 10 +- drivers/s390/block/dasd_int.h | 9 +- drivers/s390/block/dasd_ioctl.c | 14 +- drivers/s390/block/dasd_proc.c | 4 +- drivers/s390/block/dcssblk.c | 114 +- drivers/s390/block/xpram.c | 29 +- drivers/s390/char/con3215.c | 3 +- drivers/s390/char/keyboard.c | 19 +- drivers/s390/char/sclp_tty.c | 33 +- drivers/s390/char/sclp_vt220.c | 3 +- drivers/s390/char/tape.h | 8 +- drivers/s390/char/tape_34xx.c | 22 +- drivers/s390/char/tape_block.c | 2 + drivers/s390/char/tape_char.c | 16 +- drivers/s390/char/tape_core.c | 18 +- drivers/s390/char/tape_proc.c | 2 + drivers/s390/char/tape_std.c | 2 + drivers/s390/cio/airq.c | 38 +- drivers/s390/cio/blacklist.c | 2 +- drivers/s390/cio/ccwgroup.c | 24 +- drivers/s390/cio/chsc.c | 40 +- drivers/s390/cio/chsc.h | 1 - drivers/s390/cio/cio.c | 8 +- drivers/s390/cio/css.c | 75 +- drivers/s390/cio/css.h | 4 +- drivers/s390/cio/device.c | 18 +- drivers/s390/cio/device_fsm.c | 174 +- drivers/s390/cio/requestirq.c | 17 +- drivers/s390/crypto/z90crypt.h | 22 +- drivers/s390/crypto/z90main.c | 65 +- drivers/s390/net/ctctty.c | 15 +- drivers/s390/net/iucv.c | 9 +- drivers/s390/net/netiucv.c | 25 +- drivers/s390/net/qeth.h | 21 +- drivers/s390/net/qeth_main.c | 239 +- drivers/s390/net/qeth_sys.c | 16 +- drivers/s390/s390mach.c | 25 +- drivers/scsi/53c700.c | 129 +- drivers/scsi/53c700.h | 23 +- drivers/scsi/Kconfig | 39 +- drivers/scsi/Makefile | 3 +- drivers/scsi/NCR53C9x.c | 11 + drivers/scsi/NCR_D700.c | 4 +- drivers/scsi/advansys.c | 772 +- drivers/scsi/aha152x.c | 6 +- drivers/scsi/arm/acornscsi.c | 2 +- drivers/scsi/arm/arxescsi.c | 2 +- drivers/scsi/arm/cumana_1.c | 2 +- drivers/scsi/arm/cumana_2.c | 2 +- drivers/scsi/arm/ecoscsi.c | 2 +- drivers/scsi/arm/eesox.c | 2 +- drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/arm/oak.c | 2 +- drivers/scsi/arm/powertec.c | 2 +- drivers/scsi/ata_piix.c | 27 +- drivers/scsi/constants.c | 22 +- drivers/scsi/cpqfcTScontrol.c | 2 + drivers/scsi/dc390.h | 15 +- drivers/scsi/dpt_i2o.c | 55 +- drivers/scsi/dpti.h | 24 +- drivers/scsi/eata_generic.h | 2 +- drivers/scsi/eata_pio.c | 227 +- drivers/scsi/esp.c | 9 +- drivers/scsi/esp.h | 15 +- drivers/scsi/fd_mcs.c | 21 +- drivers/scsi/fdomain.c | 23 +- drivers/scsi/gdth.c | 71 +- drivers/scsi/ide-scsi.c | 14 + drivers/scsi/ipr.c | 13 +- drivers/scsi/ipr.h | 4 +- drivers/scsi/lasi700.c | 3 +- drivers/scsi/megaraid.c | 50 +- drivers/scsi/osst.c | 14 +- drivers/scsi/pcmcia/nsp_cs.c | 10 +- drivers/scsi/qla1280.c | 4 +- drivers/scsi/qlogicfc.c | 3 +- drivers/scsi/qlogicpti.c | 11 +- drivers/scsi/qlogicpti.h | 15 +- drivers/scsi/scsi.h | 63 +- drivers/scsi/scsi_debug.c | 385 +- drivers/scsi/scsi_debug.h | 5 +- drivers/scsi/scsi_devinfo.c | 6 +- drivers/scsi/scsi_error.c | 19 +- drivers/scsi/scsi_ioctl.c | 16 - drivers/scsi/scsi_lib.c | 1 - drivers/scsi/scsi_scan.c | 5 + drivers/scsi/scsi_syms.c | 13 +- drivers/scsi/scsi_transport_spi.c | 8 +- drivers/scsi/scsiiom.c | 104 +- drivers/scsi/sd.c | 8 +- drivers/scsi/sg.c | 38 +- drivers/scsi/sim710.c | 5 +- drivers/scsi/sr.c | 16 +- drivers/scsi/sr_ioctl.c | 3 + drivers/scsi/st.c | 16 +- drivers/scsi/sym53c416.c | 83 +- drivers/scsi/tmscsim.c | 351 +- drivers/scsi/tmscsim.h | 13 +- drivers/scsi/wd7000.c | 3 +- drivers/serial/8250_acpi.c | 22 +- drivers/serial/8250_hcdp.c | 12 +- drivers/serial/8250_pnp.c | 5 +- drivers/serial/Kconfig | 14 +- drivers/serial/Makefile | 1 - drivers/serial/amba-pl011.c | 81 +- drivers/serial/s3c2410.c | 2 +- drivers/telephony/ixj.c | 106 +- drivers/telephony/ixj.h | 10 +- drivers/usb/Kconfig | 2 +- drivers/usb/class/audio.c | 66 +- drivers/usb/class/cdc-acm.c | 323 +- drivers/usb/class/usblp.c | 11 + drivers/usb/core/devices.c | 2 + drivers/usb/core/devio.c | 45 +- drivers/usb/core/hcd-pci.c | 4 +- drivers/usb/core/hcd.c | 23 +- drivers/usb/core/hcd.h | 13 +- drivers/usb/core/hub.c | 649 +- drivers/usb/core/hub.h | 17 +- drivers/usb/core/message.c | 30 +- drivers/usb/core/sysfs.c | 89 +- drivers/usb/core/usb.c | 231 +- drivers/usb/core/usb.h | 5 + drivers/usb/gadget/dummy_hcd.c | 28 +- drivers/usb/gadget/ether.c | 75 +- drivers/usb/gadget/file_storage.c | 5 +- drivers/usb/gadget/ndis.h | 30 + drivers/usb/gadget/net2280.c | 25 +- drivers/usb/gadget/rndis.c | 687 +- drivers/usb/gadget/rndis.h | 41 +- drivers/usb/host/ehci-hcd.c | 13 +- drivers/usb/host/ehci-sched.c | 2 +- drivers/usb/host/hc_sl811_rh.c | 10 +- drivers/usb/host/ohci-dbg.c | 30 +- drivers/usb/host/ohci-hcd.c | 47 +- drivers/usb/host/ohci-hub.c | 42 +- drivers/usb/host/ohci-omap.c | 4 +- drivers/usb/host/ohci-q.c | 6 +- drivers/usb/host/ohci-sa1111.c | 4 +- drivers/usb/host/ohci.h | 19 + drivers/usb/host/uhci-hcd.c | 50 +- drivers/usb/image/hpusbscsi.c | 2 +- drivers/usb/image/mdc800.c | 6 +- drivers/usb/image/microtek.c | 2 +- drivers/usb/input/Kconfig | 14 +- drivers/usb/input/ati_remote.c | 54 +- drivers/usb/input/hid-core.c | 4 +- drivers/usb/input/hiddev.c | 49 +- drivers/usb/media/Kconfig | 2 +- drivers/usb/media/dabusb.c | 10 +- drivers/usb/media/ov511.c | 2 +- drivers/usb/media/ov511.h | 2 +- drivers/usb/media/pwc-if.c | 13 +- drivers/usb/media/se401.c | 2 +- drivers/usb/media/stv680.c | 2 +- drivers/usb/media/usbvideo.c | 4 +- drivers/usb/media/vicam.c | 32 +- drivers/usb/media/w9968cf.c | 56 +- drivers/usb/media/w9968cf.h | 2 +- drivers/usb/misc/auerswald.c | 14 +- drivers/usb/misc/legousbtower.c | 8 +- drivers/usb/misc/phidgetservo.c | 115 +- drivers/usb/misc/speedtch.c | 6 +- drivers/usb/misc/usbtest.c | 16 +- drivers/usb/net/catc.c | 4 +- drivers/usb/net/kaweth.c | 2 +- drivers/usb/net/pegasus.c | 6 +- drivers/usb/net/pegasus.h | 3 + drivers/usb/net/rtl8150.c | 36 +- drivers/usb/net/usbnet.c | 11 +- drivers/usb/serial/bus.c | 4 +- drivers/usb/serial/cyberjack.c | 21 +- drivers/usb/serial/ftdi_sio.c | 13 +- drivers/usb/serial/io_edgeport.c | 15 +- drivers/usb/serial/io_ti.c | 6 +- drivers/usb/serial/kl5kusb105.c | 15 +- drivers/usb/serial/kobil_sct.c | 9 +- drivers/usb/serial/visor.c | 19 +- drivers/usb/serial/visor.h | 3 + drivers/usb/serial/whiteheat.c | 5 +- drivers/usb/storage/Kconfig | 22 + drivers/usb/storage/jumpshot.c | 2 +- drivers/usb/storage/scsiglue.c | 55 +- drivers/usb/storage/transport.c | 32 +- drivers/usb/storage/unusual_devs.h | 26 +- drivers/usb/storage/usb.c | 221 +- drivers/usb/storage/usb.h | 5 +- drivers/video/Kconfig | 5 + drivers/video/aty/radeon_accel.c | 8 +- drivers/video/aty/radeon_base.c | 21 +- drivers/video/console/fbcon.c | 114 +- drivers/video/console/fbcon.h | 51 +- drivers/video/console/sticore.c | 1 - drivers/video/console/vgacon.c | 2 + drivers/video/fbmem.c | 30 +- drivers/video/imsttfb.c | 19 +- drivers/video/kyro/fbdev.c | 12 +- drivers/video/matrox/matroxfb_base.c | 31 +- drivers/video/matrox/matroxfb_crtc2.c | 10 +- drivers/video/modedb.c | 21 +- drivers/video/pxafb.c | 94 +- drivers/video/radeonfb.c | 4 +- drivers/video/riva/Makefile | 8 +- drivers/video/riva/fbdev.c | 368 +- drivers/video/riva/rivafb.h | 33 +- drivers/video/sbuslib.c | 1 + drivers/video/sis/300vtbl.h | 808 +- drivers/video/sis/310vtbl.h | 1641 ++-- drivers/video/sis/init.c | 2021 +++-- drivers/video/sis/init.h | 789 +- drivers/video/sis/init301.c | 7624 ++++++++--------- drivers/video/sis/init301.h | 190 +- drivers/video/sis/initdef.h | 122 +- drivers/video/sis/oem300.h | 8 +- drivers/video/sis/oem310.h | 228 +- drivers/video/sis/osdef.h | 110 +- drivers/video/sis/sis.h | 499 +- drivers/video/sis/sis_accel.c | 375 +- drivers/video/sis/sis_accel.h | 408 +- drivers/video/sis/sis_main.c | 6799 ++++++++------- drivers/video/sis/sis_main.h | 1067 +-- drivers/video/sis/vgatypes.h | 163 +- drivers/video/sis/vstruct.h | 158 +- drivers/video/skeletonfb.c | 8 +- drivers/video/sstfb.c | 4 +- drivers/video/vga16fb.c | 2 - fs/afs/file.c | 8 +- fs/afs/proc.c | 14 +- fs/aio.c | 44 +- fs/autofs/root.c | 13 +- fs/binfmt_aout.c | 26 +- fs/binfmt_elf.c | 1 - fs/binfmt_flat.c | 1 - fs/binfmt_misc.c | 185 +- fs/cifs/AUTHORS | 5 +- fs/cifs/CHANGES | 17 + fs/cifs/README | 11 +- fs/cifs/TODO | 16 +- fs/cifs/cifs_debug.c | 116 +- fs/cifs/cifsfs.c | 4 +- fs/cifs/cifsfs.h | 4 +- fs/cifs/cifspdu.h | 66 +- fs/cifs/cifsproto.h | 7 + fs/cifs/cifssmb.c | 157 +- fs/cifs/connect.c | 71 +- fs/cifs/dir.c | 21 +- fs/cifs/fcntl.c | 18 +- fs/cifs/file.c | 267 +- fs/cifs/inode.c | 76 +- fs/cifs/link.c | 2 +- fs/cifs/transport.c | 22 +- fs/cifs/xattr.c | 49 +- fs/coda/file.c | 4 +- fs/coda/pioctl.c | 2 +- fs/coda/psdev.c | 6 +- fs/coda/sysctl.c | 8 +- fs/compat.c | 255 + fs/compat_ioctl.c | 21 +- fs/devfs/base.c | 12 +- fs/direct-io.c | 15 +- fs/dquot.c | 30 +- fs/eventpoll.c | 283 +- fs/exec.c | 9 +- fs/ext3/Makefile | 2 +- fs/ext3/balloc.c | 640 +- fs/ext3/file.c | 6 +- fs/ext3/ialloc.c | 9 +- fs/ext3/inode.c | 109 +- fs/ext3/ioctl.c | 77 +- fs/ext3/namei.c | 4 +- fs/ext3/super.c | 66 +- fs/ext3/xattr.c | 2 +- fs/fs-writeback.c | 23 +- fs/hfsplus/ioctl.c | 4 +- fs/hugetlbfs/inode.c | 2 +- fs/isofs/Makefile | 2 +- fs/isofs/dir.c | 20 +- fs/isofs/inode.c | 167 +- fs/isofs/namei.c | 30 +- fs/isofs/rock.c | 15 +- fs/jbd/commit.c | 6 +- fs/jbd/journal.c | 12 +- fs/jbd/revoke.c | 4 +- fs/jffs/inode-v23.c | 4 +- fs/jfs/jfs_btree.h | 24 +- fs/jfs/jfs_dmap.c | 4 +- fs/jfs/jfs_dtree.c | 19 +- fs/jfs/jfs_metapage.c | 1 + fs/jfs/jfs_txnmgr.c | 42 +- fs/jfs/jfs_types.h | 3 +- fs/jfs/namei.c | 107 +- fs/jfs/xattr.c | 25 +- fs/ncpfs/dir.c | 10 +- fs/ncpfs/file.c | 4 +- fs/ncpfs/ioctl.c | 317 +- fs/ncpfs/ncplib_kernel.c | 44 +- fs/ncpfs/ncplib_kernel.h | 10 +- fs/nfs/direct.c | 4 +- fs/nfs/idmap.c | 11 +- fs/nfs/write.c | 5 +- fs/nfsd/nfs3proc.c | 1 - fs/nfsd/nfs3xdr.c | 39 +- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c | 45 +- fs/nfsd/nfs4xdr.c | 83 +- fs/nfsd/nfsfh.c | 2 +- fs/ntfs/ChangeLog | 73 +- fs/ntfs/Makefile | 2 +- fs/ntfs/aops.c | 52 +- fs/ntfs/attrib.c | 4 +- fs/ntfs/compress.c | 4 +- fs/ntfs/dir.c | 47 +- fs/ntfs/inode.c | 117 +- fs/ntfs/mft.c | 662 ++ fs/ntfs/mft.h | 54 + fs/ntfs/super.c | 333 +- fs/partitions/Kconfig | 7 - fs/partitions/check.c | 1 - fs/partitions/msdos.c | 17 +- fs/proc/base.c | 4 +- fs/proc/generic.c | 10 +- fs/proc/proc_misc.c | 1 - fs/quota_v1.c | 2 + fs/reiserfs/bitmap.c | 289 +- fs/reiserfs/dir.c | 1 + fs/reiserfs/file.c | 34 +- fs/reiserfs/inode.c | 62 +- fs/reiserfs/journal.c | 17 +- fs/reiserfs/stree.c | 136 +- fs/reiserfs/super.c | 13 +- fs/reiserfs/tail_conversion.c | 41 - fs/smbfs/file.c | 4 +- fs/smbfs/ioctl.c | 6 +- fs/smbfs/smbiod.c | 2 +- fs/stat.c | 4 + fs/super.c | 15 +- fs/sysfs/file.c | 1 + fs/udf/crc.c | 2 +- fs/udf/file.c | 12 +- fs/udf/misc.c | 12 +- include/acpi/acpi_drivers.h | 2 +- include/asm-alpha/resource.h | 12 +- include/asm-arm/arch-ebsa110/io.h | 2 +- include/asm-arm/arch-ebsa110/system.h | 4 +- include/asm-arm/arch-ebsa110/timex.h | 2 +- include/asm-arm/arch-ebsa110/uncompress.h | 40 +- include/asm-arm/arch-integrator/impd1.h | 1 - include/asm-arm/arch-lh7a40x/hardware.h | 4 +- include/asm-arm/arch-lh7a40x/memory.h | 69 +- include/asm-arm/arch-omap/board-innovator.h | 106 +- include/asm-arm/arch-omap/bus.h | 4 + include/asm-arm/arch-omap/dma.h | 149 +- include/asm-arm/arch-omap/gpio.h | 12 +- include/asm-arm/arch-omap/hardware.h | 222 +- include/asm-arm/arch-omap/io.h | 66 + include/asm-arm/arch-omap/mux.h | 12 +- include/asm-arm/arch-omap/omap1610.h | 66 +- include/asm-arm/arch-omap/omap5912.h | 44 +- include/asm-arm/arch-omap/omap730.h | 4 +- include/asm-arm/arch-omap/time.h | 2 +- include/asm-arm/arch-omap/uncompress.h | 2 +- include/asm-arm/arch-pxa/hardware.h | 9 - include/asm-arm/arch-s3c2410/regs-gpio.h | 7 +- include/asm-arm/arch-s3c2410/regs-irq.h | 5 + include/asm-arm/cacheflush.h | 12 +- include/asm-arm/fpstate.h | 32 + include/asm-arm/pgtable.h | 7 + include/asm-arm/resource.h | 8 +- include/asm-arm/thread_info.h | 7 +- include/asm-arm/uaccess.h | 2 +- include/asm-arm/unistd.h | 1 + include/asm-arm26/resource.h | 8 +- include/asm-arm26/tlb.h | 1 + include/asm-arm26/unistd.h | 1 + include/asm-cris/resource.h | 12 +- include/asm-cris/unistd.h | 1 + include/asm-generic/tlb.h | 1 + include/asm-h8300/io.h | 86 +- include/asm-h8300/resource.h | 10 +- include/asm-h8300/unistd.h | 1 + include/asm-i386/acpi.h | 2 + include/asm-i386/apic.h | 2 + include/asm-i386/bitops.h | 104 +- include/asm-i386/checksum.h | 8 +- include/asm-i386/delay.h | 2 +- include/asm-i386/dma-mapping.h | 3 + include/asm-i386/floppy.h | 2 +- include/asm-i386/genapic.h | 2 - include/asm-i386/hpet.h | 3 + include/asm-i386/i387.h | 2 +- include/asm-i386/ide.h | 34 - include/asm-i386/io_apic.h | 9 - include/asm-i386/mach-bigsmp/mach_apic.h | 1 - include/asm-i386/mach-bigsmp/mach_mpspec.h | 5 - include/asm-i386/mach-default/mach_apic.h | 12 +- include/asm-i386/mach-default/mach_mpspec.h | 5 - include/asm-i386/mach-es7000/mach_apic.h | 1 - include/asm-i386/mach-es7000/mach_mpspec.h | 5 - include/asm-i386/mach-generic/mach_apic.h | 1 - include/asm-i386/mach-generic/mach_mpspec.h | 5 - include/asm-i386/mach-numaq/mach_apic.h | 1 - include/asm-i386/mach-numaq/mach_mpspec.h | 5 - include/asm-i386/mach-summit/mach_apic.h | 1 - include/asm-i386/mach-summit/mach_mpspec.h | 5 - include/asm-i386/mach-visws/mach_apic.h | 6 +- include/asm-i386/mpspec.h | 2 +- include/asm-i386/mpspec_def.h | 1 + include/asm-i386/msi.h | 2 +- include/asm-i386/pgtable.h | 16 +- include/asm-i386/processor.h | 6 - include/asm-i386/resource.h | 11 +- include/asm-i386/serial.h | 7 - include/asm-i386/timex.h | 4 - include/asm-i386/unistd.h | 1 + include/asm-ia64/bitops.h | 92 +- include/asm-ia64/iosapic.h | 1 - include/asm-ia64/pgtable.h | 4 + include/asm-ia64/resource.h | 8 +- include/asm-ia64/system.h | 2 +- include/asm-ia64/unistd.h | 2 + include/asm-m68k/resource.h | 10 +- include/asm-m68k/unistd.h | 1 + include/asm-m68knommu/unistd.h | 1 + include/asm-mips/checksum.h | 3 +- include/asm-mips/resource.h | 6 +- include/asm-mips/unistd.h | 1 + include/asm-parisc/checksum.h | 6 +- include/asm-parisc/pgtable.h | 4 + include/asm-parisc/resource.h | 8 +- include/asm-parisc/unistd.h | 1 + include/asm-ppc/bug.h | 38 +- include/asm-ppc/elf.h | 1 + include/asm-ppc/hardirq.h | 4 + include/asm-ppc/io.h | 2 + include/asm-ppc/mmu.h | 68 + include/asm-ppc/mmu_context.h | 5 + include/asm-ppc/mpc8260.h | 4 + include/asm-ppc/ocp.h | 4 + include/asm-ppc/ocp_ids.h | 3 +- include/asm-ppc/pgtable.h | 43 +- include/asm-ppc/ppc_asm.h | 66 +- include/asm-ppc/ppcboot.h | 4 +- include/asm-ppc/processor.h | 25 +- include/asm-ppc/ptrace.h | 5 + include/asm-ppc/reg.h | 12 + include/asm-ppc/reg_booke.h | 157 +- include/asm-ppc/resource.h | 8 +- include/asm-ppc/serial.h | 2 + include/asm-ppc/spinlock.h | 22 +- include/asm-ppc/system.h | 2 + include/asm-ppc/tlbflush.h | 29 + include/asm-ppc/unistd.h | 1 + include/asm-ppc64/current.h | 4 +- include/asm-ppc64/hardirq.h | 2 + include/asm-ppc64/io.h | 6 +- include/asm-ppc64/paca.h | 24 +- include/asm-ppc64/pgalloc.h | 28 +- include/asm-ppc64/pgtable.h | 5 +- include/asm-ppc64/ppc_asm.h | 8 +- include/asm-ppc64/processor.h | 3 +- include/asm-ppc64/ptrace.h | 12 + include/asm-ppc64/resource.h | 8 +- include/asm-ppc64/system.h | 11 + include/asm-ppc64/thread_info.h | 7 +- include/asm-ppc64/tlbflush.h | 2 + include/asm-ppc64/unistd.h | 1 + include/asm-ppc64/vio.h | 5 - include/asm-s390/atomic.h | 2 +- include/asm-s390/checksum.h | 4 +- include/asm-s390/compat.h | 8 +- include/asm-s390/debug.h | 23 +- include/asm-s390/idals.h | 8 +- include/asm-s390/ipc.h | 2 +- include/asm-s390/pgtable.h | 10 +- include/asm-s390/ptrace.h | 1 + include/asm-s390/resource.h | 10 +- include/asm-s390/setup.h | 1 + include/asm-s390/spinlock.h | 8 +- include/asm-s390/string.h | 212 +- include/asm-s390/thread_info.h | 2 + include/asm-s390/types.h | 5 +- include/asm-s390/uaccess.h | 52 +- include/asm-s390/unistd.h | 1 + include/asm-sh/checksum.h | 6 +- include/asm-sh/resource.h | 8 +- include/asm-sh/unistd.h | 1 + include/asm-sparc/checksum.h | 2 +- include/asm-sparc/dma-mapping.h | 1 + include/asm-sparc/highmem.h | 4 +- include/asm-sparc/pgtable.h | 31 +- include/asm-sparc/pgtsrmmu.h | 35 +- include/asm-sparc/pgtsun4.h | 3 - include/asm-sparc/pgtsun4c.h | 3 - include/asm-sparc/resource.h | 14 +- include/asm-sparc/viking.h | 2 +- include/asm-sparc64/bitops.h | 113 +- include/asm-sparc64/checksum.h | 3 +- include/asm-sparc64/resource.h | 14 +- include/asm-um/unistd.h | 1 + include/asm-v850/resource.h | 10 +- include/asm-v850/unistd.h | 1 + include/asm-x86_64/bitops.h | 7 +- include/asm-x86_64/checksum.h | 4 +- include/asm-x86_64/compat.h | 8 +- include/asm-x86_64/desc.h | 3 +- include/asm-x86_64/floppy.h | 2 +- include/asm-x86_64/fpu32.h | 4 +- include/asm-x86_64/i387.h | 12 +- include/asm-x86_64/ia32.h | 4 +- include/asm-x86_64/ia32_unistd.h | 3 +- include/asm-x86_64/ide.h | 68 +- include/asm-x86_64/io.h | 9 +- include/asm-x86_64/mpspec.h | 2 +- include/asm-x86_64/page.h | 11 +- include/asm-x86_64/pgtable.h | 41 +- include/asm-x86_64/processor.h | 2 +- include/asm-x86_64/ptrace.h | 2 +- include/asm-x86_64/resource.h | 10 +- include/asm-x86_64/semaphore.h | 14 +- include/asm-x86_64/sigcontext.h | 3 +- include/asm-x86_64/uaccess.h | 94 +- include/asm-x86_64/unistd.h | 1 + include/linux/acct.h | 145 +- include/linux/acpi.h | 4 +- include/linux/aio.h | 11 +- include/linux/atm.h | 3 +- include/linux/atmdev.h | 8 +- include/linux/autoconf.h | 137 +- include/linux/binfmts.h | 4 + include/linux/blkdev.h | 1 + include/linux/cciss_ioctl.h | 32 +- include/linux/cdrom.h | 4 +- include/linux/coda.h | 5 +- include/linux/coda_proc.h | 4 +- include/linux/compat_ioctl.h | 1 + include/linux/cpu.h | 4 +- include/linux/cpumask.h | 1 + include/linux/edd.h | 6 +- include/linux/efi.h | 7 - include/linux/ethtool.h | 2 + include/linux/ext3_fs.h | 87 +- include/linux/ext3_fs_i.h | 17 +- include/linux/ext3_fs_sb.h | 4 - include/linux/fb.h | 58 +- include/linux/fd.h | 2 +- include/linux/filter.h | 4 +- include/linux/hugetlb.h | 2 +- include/linux/i2o.h | 14 +- include/linux/ide.h | 40 +- include/linux/idr.h | 29 +- include/linux/if.h | 6 +- include/linux/if_arp.h | 1 + include/linux/if_bridge.h | 2 +- include/linux/if_frad.h | 2 +- include/linux/if_vlan.h | 2 +- include/linux/input.h | 63 +- include/linux/ipmi.h | 14 +- include/linux/ipmi_msgdefs.h | 1 + include/linux/ipmi_smi.h | 4 + include/linux/ipv6.h | 2 + include/linux/iso_fs.h | 60 + include/linux/iso_fs_i.h | 5 +- include/linux/ixjuser.h | 2 +- include/linux/kmod.h | 2 + include/linux/mca.h | 2 + include/linux/mempolicy.h | 11 + include/linux/mii.h | 7 + include/linux/miscdevice.h | 1 + include/linux/mm.h | 12 +- include/linux/mqueue.h | 2 + include/linux/mroute.h | 2 +- include/linux/netdevice.h | 2 +- include/linux/netfilter.h | 6 + include/linux/netfilter_arp/arp_tables.h | 2 +- include/linux/netfilter_ipv4/ip_tables.h | 10 +- include/linux/netfilter_ipv6/ip6_tables.h | 4 +- include/linux/nfs4_mount.h | 6 +- include/linux/nfs_fs.h | 2 +- include/linux/nfsd/export.h | 3 +- include/linux/nfsd/nfsd.h | 2 +- include/linux/nfsd/xdr3.h | 1 + include/linux/page-flags.h | 18 +- include/linux/pci_ids.h | 6 + include/linux/pkt_sched.h | 3 +- include/linux/prctl.h | 6 + include/linux/raid/md_k.h | 10 + include/linux/raid/raid1.h | 16 + include/linux/reiserfs_fs.h | 23 +- include/linux/reiserfs_fs_i.h | 1 + include/linux/sched.h | 34 +- include/linux/sdla.h | 2 +- include/linux/security.h | 21 +- include/linux/serial_core.h | 8 - include/linux/serio.h | 1 - include/linux/signal.h | 4 + include/linux/skbuff.h | 24 + include/linux/stat.h | 2 +- include/linux/sunrpc/svcauth.h | 1 + include/linux/syscalls.h | 3 +- include/linux/tcp.h | 9 +- include/linux/time.h | 12 +- include/linux/udf_fs.h | 2 +- include/linux/usb.h | 1 + include/linux/watchdog.h | 1 + include/linux/wavefront.h | 4 +- include/net/ax25.h | 2 +- include/net/bluetooth/hci_core.h | 12 +- include/net/bluetooth/rfcomm.h | 2 +- include/net/dn_dev.h | 2 +- include/net/dst.h | 5 +- include/net/ip.h | 4 +- include/net/ip6_route.h | 2 +- include/net/ipv6.h | 3 +- include/net/irda/irda_device.h | 4 +- include/net/netrom.h | 2 +- include/net/rose.h | 2 +- include/net/sctp/command.h | 1 + include/net/sctp/sm.h | 17 + include/net/sctp/structs.h | 6 +- include/net/sctp/user.h | 2 +- include/net/sock.h | 68 + include/net/tcp.h | 56 +- include/net/tux.h | 2 +- include/net/x25.h | 4 +- include/net/xfrm.h | 2 +- include/scsi/scsi_eh.h | 4 + include/scsi/scsi_host.h | 9 +- include/scsi/scsi_ioctl.h | 1 - include/sound/ainstr_gf1.h | 4 +- include/sound/ainstr_iw.h | 4 +- include/sound/ainstr_simple.h | 4 +- include/sound/asound.h | 8 +- include/sound/core.h | 4 +- include/sound/emu10k1.h | 6 +- include/sound/emux_synth.h | 2 +- include/sound/gus.h | 16 +- include/sound/hdsp.h | 2 +- include/sound/hwdep.h | 4 +- include/sound/info.h | 4 +- include/sound/pcm.h | 13 +- include/sound/seq_instr.h | 4 +- include/sound/seq_kernel.h | 2 +- include/sound/sscape_ioctl.h | 2 +- include/sound/trident.h | 2 +- include/sound/vx_core.h | 4 +- include/sound/wavefront.h | 4 +- include/video/sisfb.h | 251 +- init/Kconfig | 12 + init/main.c | 12 +- ipc/mqueue.c | 83 +- ipc/shm.c | 15 +- ipc/util.c | 7 +- kernel/acct.c | 105 +- kernel/compat.c | 63 +- kernel/exit.c | 8 +- kernel/fork.c | 11 +- kernel/futex.c | 3 +- kernel/kmod.c | 20 +- kernel/module.c | 3 +- kernel/posix-timers.c | 86 +- kernel/power/pmdisk.c | 39 +- kernel/power/swsusp.c | 43 +- kernel/resource.c | 4 +- kernel/sched.c | 25 +- kernel/signal.c | 52 +- kernel/sysctl.c | 54 +- kernel/timer.c | 2 +- kernel/uid16.c | 12 +- kernel/user.c | 7 +- kernel/workqueue.c | 69 +- lib/idr.c | 89 +- lib/rwsem.c | 35 +- lib/string.c | 2 +- lib/vsprintf.c | 10 +- mm/filemap.c | 78 +- mm/fremap.c | 17 +- mm/highmem.c | 1 - mm/hugetlb.c | 4 +- mm/memory.c | 21 +- mm/mempolicy.c | 19 +- mm/mempool.c | 6 - mm/mincore.c | 1 - mm/mlock.c | 8 +- mm/mmap.c | 66 +- mm/mprotect.c | 1 - mm/mremap.c | 7 +- mm/msync.c | 11 +- mm/nommu.c | 1 - mm/oom_kill.c | 1 - mm/page-writeback.c | 68 +- mm/page_alloc.c | 58 +- mm/rmap.c | 52 +- mm/shmem.c | 21 +- mm/swap_state.c | 7 +- mm/truncate.c | 10 +- mm/vmalloc.c | 1 - mm/vmscan.c | 361 +- net/8021q/vlan.c | 9 +- net/appletalk/ddp.c | 19 +- net/atm/addr.c | 4 +- net/atm/addr.h | 2 +- net/atm/br2684.c | 21 +- net/atm/common.c | 10 +- net/atm/common.h | 8 +- net/atm/ioctl.c | 10 +- net/atm/lec.c | 4 +- net/atm/lec.h | 2 +- net/atm/mpc.c | 8 +- net/atm/mpc.h | 2 +- net/atm/mpoa_proc.c | 10 +- net/atm/pppoatm.c | 17 +- net/atm/proc.c | 6 +- net/atm/resources.c | 25 +- net/atm/resources.h | 2 +- net/ax25/af_ax25.c | 28 +- net/ax25/ax25_route.c | 2 +- net/bluetooth/bnep/sock.c | 15 +- net/bluetooth/cmtp/cmtp.h | 2 +- net/bluetooth/cmtp/sock.c | 15 +- net/bluetooth/hci_conn.c | 12 +- net/bluetooth/hci_core.c | 22 +- net/bluetooth/hci_sock.c | 13 +- net/bluetooth/l2cap.c | 8 +- net/bluetooth/rfcomm/sock.c | 2 +- net/bluetooth/rfcomm/tty.c | 24 +- net/bluetooth/sco.c | 8 +- net/bridge/br.c | 3 - net/bridge/br_if.c | 2 +- net/bridge/br_ioctl.c | 18 +- net/bridge/br_netfilter.c | 4 +- net/bridge/br_private.h | 7 +- net/bridge/br_sysfs_br.c | 21 +- net/bridge/br_sysfs_if.c | 2 +- net/core/Makefile | 2 +- net/core/dev.c | 51 +- net/core/dst.c | 74 +- net/core/ethtool.c | 104 +- net/core/iovec.c | 2 +- net/core/net-sysfs.c | 2 +- net/core/netfilter.c | 8 - net/core/pktgen.c | 8 +- net/core/sock.c | 42 + net/decnet/af_decnet.c | 10 +- net/decnet/dn_dev.c | 20 +- net/decnet/dn_route.c | 10 +- net/decnet/sysctl_net_decnet.c | 20 +- net/econet/af_econet.c | 37 +- net/ipv4/ah4.c | 37 +- net/ipv4/esp4.c | 58 +- net/ipv4/ip_output.c | 11 +- net/ipv4/ip_sockglue.c | 1 + net/ipv4/ipcomp.c | 45 +- net/ipv4/ipmr.c | 10 +- net/ipv4/ipvs/ip_vs_core.c | 14 + net/ipv4/ipvs/ip_vs_ctl.c | 4 +- net/ipv4/netfilter/arp_tables.c | 24 +- net/ipv4/netfilter/ip_conntrack_core.c | 11 +- net/ipv4/netfilter/ip_conntrack_proto_tcp.c | 2 + net/ipv4/netfilter/ip_fw_compat.c | 3 +- net/ipv4/netfilter/ip_nat_standalone.c | 3 +- net/ipv4/netfilter/ip_tables.c | 22 +- net/ipv4/netfilter/ipt_ECN.c | 14 +- net/ipv4/netfilter/ipt_TCPMSS.c | 5 +- net/ipv4/netfilter/ipt_recent.c | 2 +- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 16 +- net/ipv4/tcp.c | 130 +- net/ipv4/tcp_diag.c | 106 +- net/ipv4/tcp_input.c | 14 +- net/ipv4/tcp_ipv4.c | 6 +- net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/tcp_output.c | 11 +- net/ipv4/tcp_timer.c | 29 +- net/ipv4/udp.c | 2 +- net/ipv4/xfrm4_tunnel.c | 3 +- net/ipv6/ah6.c | 87 +- net/ipv6/datagram.c | 14 +- net/ipv6/esp6.c | 60 +- net/ipv6/exthdrs.c | 10 +- net/ipv6/ip6_input.c | 2 +- net/ipv6/ip6_output.c | 27 +- net/ipv6/ipcomp6.c | 55 +- net/ipv6/mcast.c | 2 +- net/ipv6/ndisc.c | 6 +- net/ipv6/netfilter/ip6_tables.c | 21 +- net/ipv6/raw.c | 6 +- net/ipv6/route.c | 32 +- net/ipv6/tcp_ipv6.c | 15 +- net/ipv6/udp.c | 34 +- net/ipx/af_ipx.c | 29 +- net/ipx/ipx_route.c | 2 +- net/irda/af_irda.c | 10 +- net/irda/ircomm/ircomm_tty_ioctl.c | 10 +- net/irda/irda_device.c | 4 +- net/irda/irlmp.c | 4 +- net/irda/irnet/irnet_ppp.c | 44 +- net/irda/irnet/irnet_ppp.h | 4 +- net/irda/irsysctl.c | 2 +- net/key/af_key.c | 2 +- net/netlink/af_netlink.c | 8 +- net/netlink/netlink_dev.c | 6 +- net/netrom/af_netrom.c | 13 +- net/netrom/nr_route.c | 2 +- net/packet/af_packet.c | 2 +- net/rose/af_rose.c | 21 +- net/rose/rose_route.c | 2 +- net/sched/sch_cbq.c | 2 +- net/sched/sch_delay.c | 31 +- net/sched/sch_hfsc.c | 3 +- net/sched/sch_htb.c | 1 - net/sched/sch_tbf.c | 12 +- net/sctp/sm_make_chunk.c | 25 +- net/sctp/sm_sideeffect.c | 10 + net/sctp/sm_statefuns.c | 136 +- net/sctp/socket.c | 17 +- net/sctp/sysctl.c | 4 +- net/socket.c | 29 +- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/auth_gss/svcauth_gss.c | 18 +- net/sunrpc/svcauth.c | 30 +- net/sunrpc/svcauth_unix.c | 3 + net/sunrpc/svcsock.c | 2 +- net/sunrpc/xprt.c | 4 +- net/wanrouter/af_wanpipe.c | 2 +- net/wanrouter/wanmain.c | 26 +- net/x25/af_x25.c | 27 +- net/x25/x25_link.c | 2 +- net/x25/x25_route.c | 2 +- scripts/basic/.docproc.cmd | 11 +- scripts/basic/.fixdep.cmd | 8 +- scripts/basic/.split-include.cmd | 6 +- scripts/basic/docproc | Bin 19832 -> 13331 bytes scripts/basic/fixdep | Bin 15691 -> 8820 bytes scripts/basic/split-include | Bin 14592 -> 7905 bytes scripts/checkstack.pl | 29 +- scripts/kconfig/.conf.o.cmd | 6 +- scripts/kconfig/.mconf.o.cmd | 15 +- scripts/kconfig/.zconf.tab.o.cmd | 12 +- scripts/kconfig/conf | Bin 20591 -> 13640 bytes scripts/kconfig/conf.o | Bin 10348 -> 9872 bytes scripts/kconfig/libkconfig.so | Bin 92510 -> 87324 bytes scripts/kconfig/mconf.o | Bin 20532 -> 19968 bytes scripts/kconfig/zconf.tab.o | Bin 95696 -> 92684 bytes scripts/reference_init.pl | 1 + security/dummy.c | 4 +- security/selinux/Makefile | 2 +- security/selinux/hooks.c | 108 +- security/selinux/include/av_inherit.h | 9 + security/selinux/include/av_perm_to_string.h | 104 +- security/selinux/include/av_permissions.h | 825 +- security/selinux/include/class_to_string.h | 21 + security/selinux/include/flask.h | 21 + security/selinux/include/security.h | 9 +- security/selinux/selinuxfs.c | 25 +- security/selinux/ss/mls.c | 2 +- security/selinux/ss/policydb.c | 10 +- security/selinux/ss/services.c | 17 + sound/core/control.c | 56 +- sound/core/hwdep.c | 25 +- sound/core/info.c | 4 +- sound/core/memory.c | 4 +- sound/core/oss/mixer_oss.c | 34 +- sound/core/oss/pcm_oss.c | 71 +- sound/core/pcm.c | 9 +- sound/core/pcm_lib.c | 60 +- sound/core/pcm_native.c | 102 +- sound/core/rawmidi.c | 32 +- sound/core/seq/Makefile | 1 - sound/core/seq/instr/Makefile | 1 - sound/core/seq/instr/ainstr_fm.c | 5 +- sound/core/seq/instr/ainstr_gf1.c | 10 +- sound/core/seq/instr/ainstr_iw.c | 15 +- sound/core/seq/instr/ainstr_simple.c | 6 +- sound/core/seq/oss/seq_oss.c | 8 +- sound/core/seq/oss/seq_oss_ioctl.c | 27 +- sound/core/seq/seq_clientmgr.c | 8 +- sound/core/seq/seq_memory.c | 2 +- sound/core/timer.c | 42 +- sound/drivers/mpu401/mpu401.c | 11 - sound/drivers/opl3/opl3_lib.c | 20 - sound/drivers/opl3/opl3_synth.c | 9 +- sound/drivers/opl4/opl4_proc.c | 4 +- sound/isa/Kconfig | 10 - sound/isa/cs423x/Makefile | 2 - sound/isa/gus/gus_dram.c | 8 +- sound/isa/gus/gus_instr.c | 12 +- sound/isa/gus/gus_mem_proc.c | 2 +- sound/isa/gus/gus_pcm.c | 2 +- sound/isa/sb/emu8000_patch.c | 6 +- sound/isa/sb/emu8000_pcm.c | 4 +- sound/isa/sb/sb16_csp.c | 61 +- sound/isa/sscape.c | 12 +- sound/isa/wavefront/wavefront_fx.c | 4 +- sound/isa/wavefront/wavefront_synth.c | 31 +- sound/oss/ad1889.c | 27 +- sound/oss/ali5455.c | 71 +- sound/oss/awe_wave.c | 4 +- sound/oss/btaudio.c | 59 +- sound/oss/cmpci.c | 144 +- sound/oss/cs4281/cs4281m.c | 138 +- sound/oss/cs46xx.c | 99 +- sound/oss/dmasound/dmasound_atari.c | 1 - sound/oss/emu10k1/audio.c | 65 +- sound/oss/emu10k1/cardwi.c | 4 +- sound/oss/emu10k1/cardwi.h | 2 +- sound/oss/emu10k1/cardwo.c | 6 +- sound/oss/emu10k1/cardwo.h | 2 +- sound/oss/emu10k1/midi.c | 4 +- sound/oss/emu10k1/mixer.c | 29 +- sound/oss/emu10k1/passthrough.c | 7 +- sound/oss/emu10k1/passthrough.h | 2 +- sound/oss/es1370.c | 144 +- sound/oss/es1371.c | 107 +- sound/oss/esssolo1.c | 109 +- sound/oss/forte.c | 56 +- sound/oss/i810_audio.c | 74 +- sound/oss/kahlua.c | 2 +- sound/oss/maestro.c | 68 +- sound/oss/maestro3.c | 54 +- sound/oss/msnd.c | 22 +- sound/oss/msnd.h | 4 +- sound/oss/msnd_pinnacle.c | 133 +- sound/oss/opl3.c | 8 +- sound/oss/rme96xx.c | 77 +- sound/oss/sb_audio.c | 2 +- sound/oss/sb_card.c | 8 +- sound/oss/sb_common.c | 5 +- sound/oss/sonicvibes.c | 99 +- sound/oss/trident.c | 72 +- sound/oss/wavfront.c | 23 +- sound/oss/ymfpci.c | 48 +- sound/pci/cs4281.c | 4 +- sound/pci/cs46xx/cs46xx_lib.c | 2 +- sound/pci/cs46xx/dsp_spos_scb_lib.c | 8 +- sound/pci/emu10k1/emufx.c | 36 +- sound/pci/emu10k1/emuproc.c | 2 +- sound/pci/es1938.c | 4 +- sound/pci/korg1212/korg1212.c | 10 +- sound/pci/mixart/mixart.c | 4 +- sound/pci/nm256/nm256.c | 2 +- sound/pci/rme32.c | 4 +- sound/pci/rme96.c | 4 +- sound/pci/rme9652/hdsp.c | 83 +- sound/pci/rme9652/rme9652.c | 4 +- sound/pci/trident/trident_memory.c | 2 +- sound/pci/trident/trident_synth.c | 4 +- sound/pci/vx222/vx222_ops.c | 3 +- sound/pcmcia/vx/vxp_ops.c | 3 +- sound/synth/emux/soundfont.c | 2 +- 1710 files changed, 38525 insertions(+), 33537 deletions(-) diff --git a/.config b/.config index de7e3e791..7445bef55 100644 --- a/.config +++ b/.config @@ -12,6 +12,7 @@ CONFIG_GENERIC_ISA_DMA=y CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_STANDALONE=y +CONFIG_BROKEN_ON_SMP=y # # General setup @@ -20,8 +21,10 @@ CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set CONFIG_SYSCTL=y -# CONFIG_AUDIT is not set +CONFIG_AUDIT=y +CONFIG_AUDITSYSCALL=y CONFIG_LOG_BUF_SHIFT=17 CONFIG_HOTPLUG=y # CONFIG_IKCONFIG is not set @@ -45,21 +48,19 @@ CONFIG_MODULE_UNLOAD=y CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set CONFIG_KMOD=y -CONFIG_STOP_MACHINE=y # # Processor type and features # -# CONFIG_X86_PC is not set +CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_NUMAQ is not set # CONFIG_X86_SUMMIT is not set # CONFIG_X86_BIGSMP is not set # CONFIG_X86_VISWS is not set -CONFIG_X86_GENERICARCH=y +# CONFIG_X86_GENERICARCH is not set # CONFIG_X86_ES7000 is not set -CONFIG_X86_CYCLONE_TIMER=y # CONFIG_M386 is not set # CONFIG_M486 is not set # CONFIG_M586 is not set @@ -99,16 +100,12 @@ CONFIG_X86_UACCESS_INDIRECT=y CONFIG_X86_HIGH_ENTRY=y CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y -CONFIG_SMP=y -CONFIG_NR_CPUS=32 -CONFIG_SCHED_SMT=y +# CONFIG_SMP is not set # CONFIG_PREEMPT is not set -CONFIG_X86_LOCAL_APIC=y -CONFIG_X86_IO_APIC=y +# CONFIG_X86_UP_APIC is not set CONFIG_X86_TSC=y CONFIG_X86_MCE=y # CONFIG_X86_MCE_NONFATAL is not set -CONFIG_X86_MCE_P4THERMAL=y CONFIG_TOSHIBA=m CONFIG_I8K=m CONFIG_MICROCODE=m @@ -120,17 +117,13 @@ CONFIG_X86_CPUID=m # CONFIG_EDD=m # CONFIG_NOHIGHMEM is not set -# CONFIG_HIGHMEM4G is not set -CONFIG_HIGHMEM64G=y +CONFIG_HIGHMEM4G=y +# CONFIG_HIGHMEM64G is not set CONFIG_HIGHMEM=y -CONFIG_X86_PAE=y -# CONFIG_NUMA is not set CONFIG_HIGHPTE=y # CONFIG_MATH_EMULATION is not set CONFIG_MTRR=y # CONFIG_EFI is not set -# CONFIG_IRQBALANCE is not set -CONFIG_HAVE_DEC_LOCK=y CONFIG_REGPARM=y # @@ -220,7 +213,6 @@ CONFIG_PCI_GOANY=y CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y CONFIG_PCI_MMCONFIG=y -CONFIG_PCI_USE_VECTOR=y CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_NAMES is not set CONFIG_ISA=y @@ -247,7 +239,6 @@ CONFIG_HOTPLUG_PCI=y # CONFIG_HOTPLUG_PCI_FAKE is not set CONFIG_HOTPLUG_PCI_COMPAQ=m # CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set -CONFIG_HOTPLUG_PCI_IBM=m # CONFIG_HOTPLUG_PCI_ACPI is not set # CONFIG_HOTPLUG_PCI_CPCI is not set CONFIG_HOTPLUG_PCI_PCIE=m @@ -260,7 +251,7 @@ CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=m +CONFIG_BINFMT_MISC=y # # Device Drivers @@ -413,7 +404,6 @@ CONFIG_BLK_DEV_IDE=y # CONFIG_BLK_DEV_HD_IDE is not set CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDEDISK_MULTI_MODE=y -# CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECS=m CONFIG_BLK_DEV_IDECD=y CONFIG_BLK_DEV_IDETAPE=m @@ -505,6 +495,7 @@ CONFIG_SCSI_FC_ATTRS=m # SCSI low-level drivers # CONFIG_BLK_DEV_3W_XXXX_RAID=m +CONFIG_SCSI_3W_9XXX=m # CONFIG_SCSI_7000FASST is not set CONFIG_SCSI_ACARD=m CONFIG_SCSI_AHA152X=m @@ -541,7 +532,6 @@ CONFIG_SCSI_SATA_VIA=m CONFIG_SCSI_SATA_VITESSE=m CONFIG_SCSI_BUSLOGIC=m # CONFIG_SCSI_OMIT_FLASHPOINT is not set -# CONFIG_SCSI_CPQFCTS is not set # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_DTC3280 is not set # CONFIG_SCSI_EATA is not set @@ -612,6 +602,9 @@ CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_BLK_DEV_DM=m CONFIG_DM_CRYPT=m +CONFIG_DM_SNAPSHOT=m +CONFIG_DM_MIRROR=m +CONFIG_DM_ZERO=m # # Fusion MPT device support @@ -963,10 +956,12 @@ CONFIG_ACT200L_DONGLE=m # # Old SIR device drivers # +CONFIG_IRPORT_SIR=m # # Old Serial dongle support # +# CONFIG_DONGLE_OLD is not set # # FIR device drivers @@ -1049,6 +1044,7 @@ CONFIG_WD80x3=m CONFIG_ULTRA=m CONFIG_SMC9194=m CONFIG_NET_VENDOR_RACAL=y +# CONFIG_NI5010 is not set CONFIG_NI52=m CONFIG_NI65=m @@ -1065,6 +1061,7 @@ CONFIG_DE4X5=m CONFIG_WINBOND_840=m CONFIG_DM9102=m CONFIG_PCMCIA_XIRCOM=m +# CONFIG_PCMCIA_XIRTULIP is not set # CONFIG_AT1700 is not set CONFIG_DEPCA=m CONFIG_HP100=m @@ -1102,15 +1099,15 @@ CONFIG_SUNDANCE=m CONFIG_TLAN=m CONFIG_VIA_RHINE=m CONFIG_VIA_RHINE_MMIO=y +CONFIG_VIA_VELOCITY=m CONFIG_NET_POCKET=y CONFIG_ATP=m CONFIG_DE600=m CONFIG_DE620=m # -# Gigabit Ethernet (1000/10000 Mbit) +# Ethernet (1000 Mbit) # -CONFIG_NET_GIGE=y CONFIG_ACENIC=m # CONFIG_ACENIC_OMIT_TIGON_I is not set CONFIG_DL2K=m @@ -1122,6 +1119,10 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m + +# +# Ethernet (10000 Mbit) +# CONFIG_IXGB=m CONFIG_IXGB_NAPI=y CONFIG_S2IO=m @@ -1231,6 +1232,7 @@ CONFIG_ISDN_TTY_FAX=y # # ISDN feature submodules # +CONFIG_ISDN_DRV_LOOP=m # # ISDN4Linux hardware drivers @@ -1310,6 +1312,8 @@ CONFIG_ISDN_DRV_PCBIT=m CONFIG_ISDN_DRV_SC=m CONFIG_ISDN_DRV_ACT2000=m CONFIG_ISDN_DRV_TPAM=m +CONFIG_HYSDN=m +CONFIG_HYSDN_CAPI=y # # CAPI subsystem @@ -1330,6 +1334,14 @@ CONFIG_ISDN_CAPI_CAPIDRV=m # Active AVM cards # CONFIG_CAPI_AVM=y +CONFIG_ISDN_DRV_AVMB1_B1ISA=m +CONFIG_ISDN_DRV_AVMB1_B1PCI=m +CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y +CONFIG_ISDN_DRV_AVMB1_T1ISA=m +CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m +CONFIG_ISDN_DRV_AVMB1_AVM_CS=m +CONFIG_ISDN_DRV_AVMB1_T1PCI=m +CONFIG_ISDN_DRV_AVMB1_C4=m # # Active Eicon DIVA Server cards @@ -1437,12 +1449,25 @@ CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_HW_CONSOLE=y CONFIG_SERIAL_NONSTANDARD=y +# CONFIG_COMPUTONE is not set CONFIG_ROCKETPORT=m # CONFIG_CYCLADES is not set +# CONFIG_DIGIEPCA is not set +# CONFIG_DIGI is not set +# CONFIG_ESPSERIAL is not set +# CONFIG_MOXA_INTELLIO is not set +# CONFIG_MOXA_SMARTIO is not set +# CONFIG_ISI is not set CONFIG_SYNCLINK=m CONFIG_SYNCLINKMP=m CONFIG_N_HDLC=m +# CONFIG_RISCOM8 is not set +# CONFIG_SPECIALIX is not set +# CONFIG_SX is not set +# CONFIG_RIO is not set CONFIG_STALDRV=y +# CONFIG_STALLION is not set +# CONFIG_ISTALLION is not set # # Serial drivers @@ -1539,6 +1564,7 @@ CONFIG_SONYPI=m # # Ftape, the floppy tape device driver # +# CONFIG_FTAPE is not set CONFIG_AGP=y CONFIG_AGP_ALI=y CONFIG_AGP_ATI=y @@ -1567,6 +1593,7 @@ CONFIG_DRM_SIS=m CONFIG_SYNCLINK_CS=m CONFIG_MWAVE=m # CONFIG_RAW_DRIVER is not set +# CONFIG_HPET is not set CONFIG_HANGCHECK_TIMER=m # @@ -1589,6 +1616,7 @@ CONFIG_I2C_ALI1563=m CONFIG_I2C_ALI15X3=m CONFIG_I2C_AMD756=m CONFIG_I2C_AMD8111=m +# CONFIG_I2C_ELEKTOR is not set CONFIG_I2C_I801=m CONFIG_I2C_I810=m CONFIG_I2C_ISA=m @@ -1675,6 +1703,7 @@ CONFIG_VIDEO_ZORAN_DC10=m CONFIG_VIDEO_ZORAN_DC30=m CONFIG_VIDEO_ZORAN_LML33=m CONFIG_VIDEO_ZORAN_LML33R10=m +CONFIG_VIDEO_MEYE=m CONFIG_VIDEO_SAA7134=m CONFIG_VIDEO_MXB=m CONFIG_VIDEO_DPC=m @@ -1704,7 +1733,52 @@ CONFIG_RADIO_ZOLTRIX=m # # Digital Video Broadcasting Devices # -# CONFIG_DVB is not set +CONFIG_DVB=y +CONFIG_DVB_CORE=m + +# +# Supported Frontend Modules +# +CONFIG_DVB_TWINHAN_DST=m +CONFIG_DVB_STV0299=m +# CONFIG_DVB_SP887X is not set +# CONFIG_DVB_ALPS_TDLB7 is not set +CONFIG_DVB_ALPS_TDMB7=m +CONFIG_DVB_ATMEL_AT76C651=m +CONFIG_DVB_CX24110=m +CONFIG_DVB_GRUNDIG_29504_491=m +CONFIG_DVB_GRUNDIG_29504_401=m +CONFIG_DVB_MT312=m +CONFIG_DVB_VES1820=m +CONFIG_DVB_VES1X93=m +# CONFIG_DVB_TDA1004X is not set +CONFIG_DVB_NXT6000=m + +# +# Supported SAA7146 based PCI Adapters +# +CONFIG_DVB_AV7110=m +CONFIG_DVB_AV7110_OSD=y +CONFIG_DVB_BUDGET=m +CONFIG_DVB_BUDGET_CI=m +CONFIG_DVB_BUDGET_AV=m +CONFIG_DVB_BUDGET_PATCH=m + +# +# Supported USB Adapters +# +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m + +# +# Supported FlexCopII (B2C2) Adapters +# +CONFIG_DVB_B2C2_SKYSTAR=m + +# +# Supported BT878 Adapters +# +CONFIG_DVB_BT8XX=m CONFIG_VIDEO_SAA7146=m CONFIG_VIDEO_SAA7146_VV=m CONFIG_VIDEO_VIDEOBUF=m @@ -1727,6 +1801,7 @@ CONFIG_VIDEO_SELECT=y CONFIG_FB_HGA=m CONFIG_FB_HGA_ACCEL=y CONFIG_FB_RIVA=m +# CONFIG_FB_RIVA_I2C is not set CONFIG_FB_I810=m CONFIG_FB_I810_GTF=y CONFIG_FB_MATROX=m @@ -1937,6 +2012,7 @@ CONFIG_USB_ACM=m CONFIG_USB_PRINTER=m CONFIG_USB_STORAGE=m # CONFIG_USB_STORAGE_DEBUG is not set +CONFIG_USB_STORAGE_RW_DETECT=y CONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_ISD200=y @@ -2028,6 +2104,7 @@ CONFIG_USB_USS720=m CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_GENERIC=y CONFIG_USB_SERIAL_BELKIN=m +CONFIG_USB_SERIAL_WHITEHEAT=m CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m CONFIG_USB_SERIAL_EMPEG=m CONFIG_USB_SERIAL_FTDI_SIO=m @@ -2223,7 +2300,6 @@ CONFIG_MINIX_SUBPARTITION=y CONFIG_SOLARIS_X86_PARTITION=y CONFIG_UNIXWARE_DISKLABEL=y # CONFIG_LDM_PARTITION is not set -# CONFIG_NEC98_PARTITION is not set CONFIG_SGI_PARTITION=y # CONFIG_ULTRIX_PARTITION is not set CONFIG_SUN_PARTITION=y @@ -2275,8 +2351,7 @@ CONFIG_NLS_UTF8=m # # Profiling support # -CONFIG_PROFILING=y -CONFIG_OPROFILE=m +# CONFIG_PROFILING is not set # # Kernel hacking @@ -2293,8 +2368,6 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SPINLOCK_SLEEP=y # CONFIG_FRAME_POINTER is not set -CONFIG_X86_FIND_SMP_CONFIG=y -CONFIG_X86_MPPARSE=y # # Security options @@ -2340,9 +2413,5 @@ CONFIG_CRC32=y CONFIG_LIBCRC32C=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m -CONFIG_X86_SMP=y -CONFIG_X86_HT=y CONFIG_X86_BIOS_REBOOT=y -CONFIG_X86_TRAMPOLINE=y -CONFIG_X86_STD_RESOURCES=y CONFIG_PC=y diff --git a/.config.old b/.config.old index a1d48d7b8..ef6ee1688 100644 --- a/.config.old +++ b/.config.old @@ -4,9 +4,10 @@ CONFIG_MMU=y CONFIG_UID16=y CONFIG_GENERIC_ISA_DMA=y -CONFIG_SMP=y +# CONFIG_SMP is not set # CONFIG_HOTPLUG_CPU is not set CONFIG_SCHED_SMT=y +# CONFIG_HPET is not set # # Code maturity level options @@ -21,6 +22,7 @@ CONFIG_STANDALONE=y CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_BSD_PROCESS_ACCT=y +# CONFIG_BSD_PROCESS_ACCT_V3 is not set CONFIG_SYSCTL=y CONFIG_LOG_BUF_SHIFT=17 # CONFIG_IKCONFIG is not set @@ -147,7 +149,7 @@ CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=m +CONFIG_BINFMT_MISC=y # # Device Drivers @@ -392,6 +394,7 @@ CONFIG_SCSI_FC_ATTRS=y # SCSI low-level drivers # CONFIG_BLK_DEV_3W_XXXX_RAID=m +CONFIG_SCSI_3W_9XXX=m # CONFIG_SCSI_7000FASST is not set CONFIG_SCSI_ACARD=m CONFIG_SCSI_AHA152X=m @@ -503,6 +506,9 @@ CONFIG_MD_RAID5=m CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_BLK_DEV_DM=m +CONFIG_DM_SNAPSHOT=m +CONFIG_DM_MIRROR=m +CONFIG_DM_ZERO=m CONFIG_DM_CRYPT=m # @@ -860,7 +866,7 @@ CONFIG_PCMCIA_XIRCOM=m CONFIG_DEPCA=m CONFIG_HP100=m # CONFIG_NET_ISA is not set -# CONFIG_EWRK3 is not set +CONFIG_EWRK3=m CONFIG_E2100=m CONFIG_EEXPRESS=m CONFIG_EEXPRESS_PRO=m @@ -907,6 +913,7 @@ CONFIG_SUNDANCE=m CONFIG_TLAN=m CONFIG_VIA_RHINE=m CONFIG_VIA_RHINE_MMIO=y +CONFIG_VIA_VELOCITY=m CONFIG_NET_POCKET=y CONFIG_ATP=m CONFIG_DE600=m @@ -1585,7 +1592,7 @@ CONFIG_RADIO_ZOLTRIX=m # # Digital Video Broadcasting Devices # -# CONFIG_DVB is not set +CONFIG_DVB=y CONFIG_DVB_CORE=m # @@ -1646,6 +1653,7 @@ CONFIG_FB_VESA=y CONFIG_VIDEO_SELECT=y CONFIG_FB_HGA=m CONFIG_FB_RIVA=m +# CONFIG_FB_RIVA_I2C is not set CONFIG_FB_I810=m CONFIG_FB_I810_GTF=y CONFIG_FB_MATROX=m @@ -1863,6 +1871,7 @@ CONFIG_USB_STORAGE_HP8200e=y CONFIG_USB_STORAGE_SDDR09=y CONFIG_USB_STORAGE_SDDR55=y CONFIG_USB_STORAGE_JUMPSHOT=y +CONFIG_USB_STORAGE_RW_DETECT=y # # USB Human Interface Devices (HID) @@ -2209,8 +2218,8 @@ CONFIG_NLS_UTF8=m # # Profiling support # -CONFIG_PROFILING=y -CONFIG_OPROFILE=m +# CONFIG_PROFILING is not set +# CONFIG_OPROFILE is not set # # Tux @@ -2251,7 +2260,7 @@ CONFIG_SECURITY_SELINUX_BOOTPARAM=y CONFIG_SECURITY_SELINUX_DISABLE=y CONFIG_SECURITY_SELINUX_DEVELOP=y # CONFIG_SECURITY_SELINUX_MLS is not set -# CONFIG_AUDIT is not set +CONFIG_AUDIT=y CONFIG_AUDITSYSCALL=y # @@ -2286,14 +2295,14 @@ CONFIG_CRC32=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m CONFIG_PC=y -# CONFIG_X86_PC is not set +CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_NUMAQ is not set # CONFIG_X86_SUMMIT is not set # CONFIG_X86_BIGSMP is not set # CONFIG_X86_VISWS is not set -CONFIG_X86_GENERICARCH=y +# CONFIG_X86_GENERICARCH is not set # CONFIG_X86_ES7000 is not set # CONFIG_M386 is not set # CONFIG_M486 is not set @@ -2329,7 +2338,7 @@ CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y -CONFIG_NR_CPUS=32 +CONFIG_NR_CPUS=8 CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y CONFIG_X86_TSC=y @@ -2345,7 +2354,6 @@ CONFIG_X86_CPUID=m CONFIG_EDD=m # CONFIG_NOHIGHMEM is not set CONFIG_HIGHMEM4G=y -CONFIG_HIGHMEM64G=y # CONFIG_HIGHMEM64G is not set CONFIG_HIGHMEM=y CONFIG_HIGHPTE=y @@ -2404,12 +2412,8 @@ CONFIG_NVRAM=m CONFIG_IBM_ASM=m CONFIG_M686=y # CONFIG_NOHIGHMEM is not set -CONFIG_HIGHMEM64G=y -CONFIG_HOTPLUG_PCI=y -CONFIG_HOTPLUG_PCI_COMPAQ=m -CONFIG_HOTPLUG_PCI_IBM=m +# CONFIG_SMP is not set +CONFIG_HIGHMEM4G=y # CONFIG_HIGHMEM64G is not set -# CONFIG_EWRK3 is not set -CONFIG_NR_CPUS=32 -# CONFIG_X86_PC is not set -CONFIG_X86_GENERICARCH=y +# CONFIG_PROFILING is not set +# CONFIG_OPROFILE is not set diff --git a/CREDITS b/CREDITS index 9eb5b8545..ebaff3968 100644 --- a/CREDITS +++ b/CREDITS @@ -2571,6 +2571,14 @@ P: 1024D/EDBB6147 7B36 0E07 04BC 11DC A7A0 D3F7 7185 9E7A EDBB 6147 D: sonypi, meye drivers, mct_u232 usb serial hacks S: Paris, France +N: Matt Porter +E: mporter@kernel.crashing.org +D: Motorola PowerPC PReP support +D: cPCI PowerPC support +D: Embedded PowerPC 4xx/6xx/7xx/74xx support +S: Chandler, Arizona 85249 +S: USA + N: Frederic Potter E: fpotter@cirpack.com D: Some PCI kernel support @@ -3109,12 +3117,13 @@ S: Beaverton, Oregon 97005 S: USA N: Marcelo W. Tosatti -E: marcelo@conectiva.com.br -W: http://bazar.conectiva.com.br/~marcelo/ -D: Miscellaneous kernel hacker (mostly VM/MM work) -S: Conectiva S.A. -S: R. Tocantins, 89 - Cristo Rei -S: 80050-430 - Curitiba - Paraná +E: marcelo.tosatti@cyclades.com +D: Miscellaneous kernel hacker +D: v2.4 kernel maintainer +D: Current pc300/cyclades maintainer +S: Cyclades Corporation +S: Av Cristovao Colombo, 462. Floresta. +S: Porto Alegre S: Brazil N: Stefan Traby diff --git a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt index 967ce6c56..4b1c93a81 100644 --- a/Documentation/arm/memory.txt +++ b/Documentation/arm/memory.txt @@ -1,7 +1,7 @@ Kernel Memory Layout on ARM Linux Russell King - April 27, 2003 (2.5.68) + May 21, 2004 (2.6.6) This document describes the virtual memory layout which the Linux kernel uses for ARM processors. It indicates which regions are @@ -29,32 +29,30 @@ ffff0000 ffff0fff CPU vector page. CPU supports vector relocation (control register V bit.) -ffe00000 fffeffff Free for platform use, not recommended. +ffc00000 fffeffff DMA memory mapping region. Memory returned + by the dma_alloc_xxx functions will be + dynamically mapped here. -ffc00000 ffdfffff 2MB consistent memory mapping. - Memory returned by the consistent_alloc - low level function will be dynamically - mapped here. +ff000000 ffbfffff Reserved for future expansion of DMA + mapping region. -ff000000 ffbfffff Free for platform use, not recommended. +VMALLOC_END feffffff Free for platform use, recommended. -VMALLOC_END ff000000 Free for platform use, recommended. - -VMALLOC_START VMALLOC_END vmalloc() / ioremap() space. +VMALLOC_START VMALLOC_END-1 vmalloc() / ioremap() space. Memory returned by vmalloc/ioremap will be dynamically placed in this region. VMALLOC_START may be based upon the value of the high_memory variable. -PAGE_OFFSET high_memory Kernel direct-mapped RAM region. +PAGE_OFFSET high_memory-1 Kernel direct-mapped RAM region. This maps the platforms RAM, and typically maps all platform RAM in a 1:1 relationship. -TASK_SIZE PAGE_OFFSET Kernel module space +TASK_SIZE PAGE_OFFSET-1 Kernel module space Kernel modules inserted via insmod are placed here using dynamic mappings. -00001000 TASK_SIZE User space mappings +00001000 TASK_SIZE-1 User space mappings Per-thread mappings are placed here via the mmap() system call. diff --git a/Documentation/binfmt_misc.txt b/Documentation/binfmt_misc.txt index 3de8edbe6..d097f09ee 100644 --- a/Documentation/binfmt_misc.txt +++ b/Documentation/binfmt_misc.txt @@ -15,7 +15,7 @@ First you must mount binfmt_misc: mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc To actually register a new binary type, you have to set up a string looking like -:name:type:offset:magic:mask:interpreter: (where you can choose the ':' upon +:name:type:offset:magic:mask:interpreter:flags (where you can choose the ':' upon your needs) and echo it to /proc/sys/fs/binfmt_misc/register. Here is what the fields mean: - 'name' is an identifier string. A new /proc file will be created with this @@ -34,6 +34,28 @@ Here is what the fields mean: The mask is anded with the byte sequence of the file. - 'interpreter' is the program that should be invoked with the binary as first argument (specify the full path) + - 'flags' is an optional field that controls several aspects of the invocation + of the interpreter. It is a string of capital letters, each controls a certain + aspect. The following flags are supported - + 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite the + original argv[0] with the full path to the binary. When this flag is + included, binfmt_misc will add an argument to the argument vector for + this purpose, thus preserving the original argv[0]. + 'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path + of the binary to the interpreter as an argument. When this flag is + included, binfmt_misc will open the file for reading and pass its + descriptor as an argument, instead of the full path, thus allowing + the interpreter to execute non-readable binaries. This feature should + be used with care - the interpreter has to be trusted not to emit + the contents of the non-readable binary. + 'C' - credentials. Currently, the behavior of binfmt_misc is to calculate + the credentials and security token of the new process according to + the interpreter. When this flag is included, these attributes are + calculated according to the binary. It also implies the 'O' flag. + This feature should be used with care as the interpreter + will run with root permissions when a setuid binary owned by root + is run with binfmt_misc. + There are some restrictions: - the whole register string may not exceed 255 characters @@ -83,9 +105,9 @@ If you want to pass special arguments to your interpreter, you can write a wrapper script for it. See Documentation/java.txt for an example. -Your interpreter should NOT look in the PATH for the filename; the -kernel passes it the full filename to use. Using the PATH can cause -unexpected behaviour and be a security hazard. +Your interpreter should NOT look in the PATH for the filename; the kernel +passes it the full filename (or the file descriptor) to use. Using $PATH can +cause unexpected behaviour and can be a security hazard. There is a web page about binfmt_misc at diff --git a/Documentation/fb/framebuffer.txt b/Documentation/fb/framebuffer.txt index b8d0b78f4..610e78012 100644 --- a/Documentation/fb/framebuffer.txt +++ b/Documentation/fb/framebuffer.txt @@ -190,7 +190,7 @@ We'll say that the horizontal scanrate is about 31 kHz: 1/(32.141E-6 s) = 31.113E3 Hz A full screen counts 480 (yres) lines, but we have to consider the vertical -retrace too (e.g. 49 `pixels'). So a full screen will take +retrace too (e.g. 49 `lines'). So a full screen will take (480+49)*32.141E-6 s = 17.002E-3 s diff --git a/Documentation/filesystems/Exporting b/Documentation/filesystems/Exporting index 548dcf48e..31047e0fe 100644 --- a/Documentation/filesystems/Exporting +++ b/Documentation/filesystems/Exporting @@ -32,7 +32,7 @@ tree. This means that if any filesystem object is in the dcache, then all of the ancestors of that filesystem object are also in the dcache. As normal access is by filename this prefix is created naturally and maintained easily (by each object maintaining a reference count on -it's parent). +its parent). However when objects are included into the dcache by interpreting a filehandle fragment, there is no automatic creation of a path prefix @@ -44,15 +44,15 @@ the dcache that are not needed for normal filesystem access. 2/ The dcache must be prepared for a newly found (via ->lookup) directory to already have a (non-connected) dentry, and must be able to move that dentry into place (based on the parent and name in the - ->lookup). This is particuarly needed for directories as + ->lookup). This is particularly needed for directories as it is a dcache invariant that directories only have one dentry. To implement these features, the dcache has: -a/ A dentry flag DCACHE_DISCONNECTED which is set on - and dentry that might not be part of the proper prefix. +a/ A dentry flag DCACHE_DISCONNECTED which is set on + any dentry that might not be part of the proper prefix. This is set when anonymous dentries are created, and cleared when a - dentry is noticed to be a child on a dentry which is in the proper + dentry is noticed to be a child of a dentry which is in the proper prefix. b/ A per-superblock list "s_anon" of dentries which are the roots of @@ -123,9 +123,9 @@ filesystem: get_name. When given a parent dentry and a child dentry, this should find a name in the directory identified by the parent dentry, which leads to the object identified by the child dentry. - If no get_name function is supplied, a default implementation - which used vfs_readdir to find potential names, and matches inode - numbers to find the correct match. + If no get_name function is supplied, a default implementation is + provided which uses vfs_readdir to find potential names, and + matches inode numbers to find the correct match. get_parent. When given a dentry for a directory, this should return a dentry for the parent. Quite possibly the parent dentry will @@ -135,7 +135,7 @@ filesystem: ->lookup("..") is *not* used as a default as it can leave ".." entries in the dcache which are too messy to work with. - get_dentry. When given a opaque datum, this should find the + get_dentry. When given an opaque datum, this should find the implied object and create a dentry for it (possibly with d_alloc_anon). The opaque datum is whatever is passed down by the decode_fh @@ -143,7 +143,7 @@ filesystem: fragment. decode_fh passes two datums through find_exported_dentry. One that should be used to identify the target object, and one that can be - used to identify the objects parent, should that be necessary. + used to identify the object's parent, should that be necessary. The default get_dentry function assumes that the datum contains an inode number and a generation number, and it attempts to get the inode using "iget" and check it's validity by matching the @@ -164,8 +164,8 @@ filehandle assuming the format used by the default encode_fh and passed them to find_exported_dentry. -A filehandle fragment consists of an array of 1 or more 4byte words. -Together with a one byte "type". +A filehandle fragment consists of an array of 1 or more 4byte words, +together with a one byte "type". The decode_fh routine should not depend on the stated size that is passed to it. This size may be larger than the original filehandle generated by encode_fh, in which case it will have been padded with diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 83e6a8f83..e0ef1f80f 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -203,20 +203,34 @@ currently-in-progress I/O. If the filesystem is not called for "sync" and it determines that it would need to block against in-progress I/O to be able to start new I/O -against the page the filesystem shoud redirty the page (usually with -__set_page_dirty_nobuffers()), then unlock the page and return zero. +against the page the filesystem should redirty the page with +redirty_page_for_writepage(), then unlock the page and return zero. This may also be done to avoid internal deadlocks, but rarely. If the filesytem is called for sync then it must wait on any in-progress I/O and then start new I/O. The filesystem should unlock the page synchronously, before returning -to the caller. If the page has write I/O underway against it, -writepage() should run SetPageWriteback() against the page prior to -unlocking it. The write I/O completion handler should run -end_page_writeback() against the page. - -That is: after 2.5.12, pages which are under writeout are *not* locked. +to the caller. + +Unless the filesystem is going to redirty_page_for_writepage(), unlock the page +and return zero, writepage *must* run set_page_writeback() against the page, +followed by unlocking it. Once set_page_writeback() has been run against the +page, write I/O can be submitted and the write I/O completion handler must run +end_page_writeback() once the I/O is complete. If no I/O is submitted, the +filesystem must run end_page_writeback() against the page before returning from +writepage. + +That is: after 2.5.12, pages which are under writeout are *not* locked. Note, +if the filesystem needs the page to be locked during writeout, that is ok, too, +the page is allowed to be unlocked at any point in time between the calls to +set_page_writeback() and end_page_writeback(). + +Note, failure to run either redirty_page_for_writepage() or the combination of +set_page_writeback()/end_page_writeback() on a page submitted to writepage +will leave the page itself marked clean but it will be tagged as dirty in the +radix tree. This incoherency can lead to all sorts of hard-to-debug problems +in the filesystem like having dirty inodes at umount and losing written data. ->sync_page() locking rules are not well-defined - usually it is called with lock on page, but that is not guaranteed. Considering the currently diff --git a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt index 1cdc5d274..018ec9693 100644 --- a/Documentation/filesystems/ntfs.txt +++ b/Documentation/filesystems/ntfs.txt @@ -273,6 +273,21 @@ ChangeLog Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. +2.1.14: + - Fix an NFSd caused deadlock reported by several users. +2.1.13: + - Implement writing of inodes (access time updates are not implemented + yet so mounting with -o noatime,nodiratime is enforced). + - Enable writing out of resident files so you can now overwrite any + uncompressed, unencrypted, nonsparse file as long as you do not + change the file size. + - Add housekeeping of ntfs system files so that ntfsfix no longer needs + to be run after writing to an NTFS volume. + NOTE: This still leaves quota tracking and user space journalling on + the side but they should not cause data corruption. In the worst + case the charged quotas will be out of date ($Quota) and some + userspace applications might get confused due to the out of date + userspace journal ($UsnJrnl). 2.1.12: - Fix the second fix to the decompression engine from the 2.1.9 release and some further internals cleanups. diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 7dd9fc9ed..39934498c 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt @@ -201,7 +201,7 @@ Table 1-3: Kernel info in /proc devices Available devices (block and character) dma Used DMS channels filesystems Supported filesystems - driver Various drivers grouped here, currently rtc (2.4) + driver Various drivers grouped here, currently rtc (2.4) and hpet (2.6) execdomains Execdomains, related to security (2.4) fb Frame Buffer devices (2.4) fs File system parameters, currently nfs/exports (2.4) @@ -1632,7 +1632,8 @@ flush Writing to this file results in a flush of the routing cache. -gc_elastic, gc_interval, gc_min_interval, gc_tresh, gc_timeout +gc_elasticity, gc_interval, gc_min_interval, gc_tresh, gc_timeout, +gc_thresh, gc_thresh1, gc_thresh2, gc_thresh3 -------------------------------------------------------------- Values to control the frequency and behavior of the garbage collection diff --git a/Documentation/ide.txt b/Documentation/ide.txt index 07811d2df..58853a4ef 100644 --- a/Documentation/ide.txt +++ b/Documentation/ide.txt @@ -248,6 +248,13 @@ Summary of ide driver parameters for kernel command line allowing ide-floppy, ide-tape, and ide-cdrom|writers to use ide-scsi emulation on a device specific option. + "hdx=stroke" : Should you have a system w/ an AWARD Bios and your + drives are larger than 32GB and it will not boot, + one is required to perform a few OEM operations first. + The option is called "stroke" because it allows one + to "soft clip" the drive to work around a barrier + limit. + "idebus=xx" : inform IDE driver of VESA/PCI bus speed in MHz, where "xx" is between 20 and 66 inclusive, used when tuning chipset PIO modes. diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 1af5712b8..2be1218a6 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt @@ -189,3 +189,5 @@ Code Seq# Include File Comments 0xDD 00-3F ZFCP device driver see drivers/s390/scsi/ +0xF3 00-3F video/sisfb.h sisfb (in development) + diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 591e458ee..c26a38ac5 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -896,8 +896,8 @@ running once the system is up. psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports per second. psmouse.resetafter= - [HW,MOUSE] Try to reset Synaptics Touchpad after so many - bad packets (0 = never). + [HW,MOUSE] Try to reset the device after so many bad packets + (0 = never). psmouse.resolution= [HW,MOUSE] Set desired mouse resolution, in dpi. psmouse.smartscroll= diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index 029e9c71e..834993d26 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX @@ -4,8 +4,6 @@ - information on the 3Com EtherLink Plus (3c505) driver. 6pack.txt - info on the 6pack protocol, an alternative to KISS for AX.25 -8139too.txt - - info on the 8139too driver for RTL-8139 based network cards. Configurable - info on some of the configurable network parameters DLINK.txt diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 708e12a20..10304b436 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -17,6 +17,16 @@ ip_no_pmtu_disc - BOOLEAN Disable Path MTU Discovery. default FALSE +min_pmtu - INTEGER + default 562 - minimum discovered Path MTU + +mtu_expires - INTEGER + Time, in seconds, that cached PMTU information is kept. + +min_adv_mss - INTEGER + The advertised MSS depends on the first hop route MTU, but will + never be lower than this setting. + IP Fragmentation: ipfrag_high_thresh - INTEGER @@ -345,6 +355,20 @@ tcp_default_win_scale - INTEGER conections. Default: 7 + +tcp_frto - BOOLEAN + Enables F-RTO, an enhanced recovery algorithm for TCP retransmission + timeouts. It is particularly beneficial in wireless environments + where packet loss is typically due to random radio interference + rather than intermediate router congestion. + +somaxconn - INTEGER + Limit of socket listen() backlog, known in userspace as SOMAXCONN. + Defaults to 128. See also tcp_max_syn_backlog for additional tuning + for TCP sockets. + +IP Variables: + ip_local_port_range - 2 INTEGERS Defines the local port range that is used by TCP and UDP to choose the local port. The first number is the first, the @@ -586,6 +610,19 @@ arp_ignore - INTEGER The max value from conf/{all,interface}/arp_ignore is used when ARP request is received on the {interface} +app_solicit - INTEGER + The maximum number of probes to send to the user space ARP daemon + via netlink before dropping back to multicast probes (see + mcast_solicit). Defaults to 0. + +disable_policy - BOOLEAN + Disable IPSEC policy (SPD) for this interface + +disable_xfrm - BOOLEAN + Disable IPSEC encryption on this interface, whatever the policy + + + tag - INTEGER Allows you to write a number, which can be used as required. Default value is 0. @@ -678,9 +715,11 @@ accept_redirects - BOOLEAN disabled if local forwarding is enabled. autoconf - BOOLEAN - Configure link-local addresses using L2 hardware addresses. + Autoconfigure addresses using Prefix Information in Router + Advertisements. - Default: TRUE + Functional default: enabled if accept_ra is enabled. + disabled if accept_ra is disabled. dad_transmits - INTEGER The amount of Duplicate Address Detection probes to send. @@ -804,4 +843,25 @@ bridge-nf-filter-vlan-tagged - BOOLEAN Default: 1 +UNDOCUMENTED: + +dev_weight FIXME +discovery_slots FIXME +discovery_timeout FIXME +fast_poll_increase FIXME +ip6_queue_maxlen FIXME +lap_keepalive_time FIXME +lo_cong FIXME +max_baud_rate FIXME +max_dgram_qlen FIXME +max_noreply_time FIXME +max_tx_data_size FIXME +max_tx_window FIXME +min_tx_turn_time FIXME +mod_cong FIXME +no_cong FIXME +no_cong_thresh FIXME +slot_timeout FIXME +warn_noreply_time FIXME + $Id: ip-sysctl.txt,v 1.20 2001/12/13 09:00:18 davem Exp $ diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt index 091b2d202..8d4cf7825 100644 --- a/Documentation/networking/packet_mmap.txt +++ b/Documentation/networking/packet_mmap.txt @@ -1,11 +1,3 @@ - -DaveM: - -If you agree with it I will send two small patches to modify -kernel's configure help. - - Ulisses - -------------------------------------------------------------------------------- + ABSTRACT -------------------------------------------------------------------------------- @@ -405,8 +397,3 @@ then poll for frames. Jesse Brandeburg, for fixing my grammathical/spelling errors ->>> EOF -- -To unsubscribe from this list: send the line "unsubscribe linux-net" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html \ No newline at end of file diff --git a/MAINTAINERS b/MAINTAINERS index 5f2455edb..1b254cd76 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -90,6 +90,20 @@ M: dave@thedillows.org L: linux-net@vger.kernel.org S: Maintained +3W-XXXX ATA-RAID CONTROLLER DRIVER +P: Adam Radford +M: linuxraid@amcc.com +L: linux-scsi@vger.kernel.org +W: http://www.amcc.com +S: Supported + +3W-9XXX SATA-RAID CONTROLLER DRIVER +P: Adam Radford +M: linuxraid@amcc.com +L: linux-scsi@vger.kernel.org +W: http://www.amcc.com +S: Supported + 53C700 AND 53C700-66 SCSI DRIVER P: James E.J. Bottomley M: James.Bottomley@HansenPartnership.com @@ -944,15 +958,15 @@ S: Maintained IA64 (Itanium) PLATFORM P: David Mosberger-Tang M: davidm@hpl.hp.com -L: linux-ia64@linuxia64.org -W: http://www.linuxia64.org/ +L: linux-ia64@vger.kernel.org +W: http://www.ia64-linux.org/ S: Maintained SN-IA64 (Itanium) SUB-PLATFORM P: Jesse Barnes M: jbarnes@sgi.com L: linux-altix@sgi.com -L: linux-ia64@linuxia64.org +L: linux-ia64@vger.kernel.org W: http://www.sgi.com/altix S: Maintained @@ -1251,6 +1265,13 @@ W: http://www.linuxppc.org/ L: linuxppc-dev@lists.linuxppc.org S: Maintained +LINUX FOR POWERPC EMBEDDED PPC4XX +P: Matt Porter +M: mporter@kernel.crashing.org +W: http://www.penguinppc.org/ +L: linuxppc-embedded@lists.linuxppc.org +S: Maintained + LLC (802.2) P: Arnaldo Carvalho de Melo M: acme@conectiva.com.br @@ -1390,8 +1411,6 @@ S: Maintained NCP FILESYSTEM P: Petr Vandrovec M: vandrove@vc.cvut.cz -P: Volker Lendecke -M: vl@kki.org L: linware@sh.cvut.cz S: Maintained diff --git a/Makefile b/Makefile index da97882b5..785fff509 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 6 -SUBLEVEL = 6 +SUBLEVEL = 7 EXTRAVERSION = -prep NAME=Zonked Quokka @@ -1062,6 +1062,7 @@ versioncheck: buildcheck: $(PERL) scripts/reference_discarded.pl + $(PERL) scripts/reference_init.pl endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) diff --git a/arch/alpha/kernel/init_task.c b/arch/alpha/kernel/init_task.c index 60722f035..835d09a7b 100644 --- a/arch/alpha/kernel/init_task.c +++ b/arch/alpha/kernel/init_task.c @@ -4,6 +4,7 @@ #include #include #include +#include #include diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c index 2cb8fa4eb..91f5f373f 100644 --- a/arch/alpha/mm/numa.c +++ b/arch/alpha/mm/numa.c @@ -279,8 +279,8 @@ setup_memory(void *kernel_end) initrd_end, phys_to_virt(PFN_PHYS(max_low_pfn))); } else { - nid = NODE_DATA(kvaddr_to_nid(initrd_start)); - reserve_bootmem_node(nid, + nid = kvaddr_to_nid(initrd_start); + reserve_bootmem_node(NODE_DATA(nid), virt_to_phys((void *)initrd_start), INITRD_SIZE); } diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 03b9d5bc6..ff2a826db 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -246,10 +246,10 @@ menu "General setup" # Select various configuration options depending on the machine type config DISCONTIGMEM bool - depends on ARCH_EDB7211 || ARCH_SA1100 || ARCH_LH7A40X + depends on ARCH_EDB7211 || ARCH_SA1100 || (ARCH_LH7A40X && !LH7A40X_SROMLL) default y help - Say Y to upport efficient handling of discontiguous physical memory, + Say Y to support efficient handling of discontiguous physical memory, for architectures which are either NUMA (Non-Uniform Memory Access) or have huge holes in the physical address space for other reasons. See for more. @@ -421,6 +421,17 @@ config FPE_FASTFPE If you do not feel you need a faster FP emulation you should better choose NWFPE. +config VFP + bool "VFP-format floating point maths" + help + Say Y to include VFP support code in the kernel. This is needed + if your hardware includes a VFP unit. + + Please see for + release notes and additional status information. + + Say N if your target does not have VFP hardware. + source "fs/Kconfig.binfmt" source "drivers/base/Kconfig" @@ -581,7 +592,7 @@ config LEDS_CPU config ALIGNMENT_TRAP bool depends on CPU_32 - default y + default y if !ARCH_EBSA110 help ARM processors can not fetch/store information which is not naturally aligned on the bus, i.e., a 4 byte fetch must start at an diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 85eeb2b1e..598a521ce 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -119,6 +119,7 @@ core-y += arch/arm/mach-$(machine-y)/ endif core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) +core-$(CONFIG_VFP) += arch/arm/vfp/ drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/ diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index c7e543972..480344606 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -86,6 +86,20 @@ .macro writeb, rb strb \rb, [r3, #0] .endm +#elif defined(CONFIG_ARCH_OMAP) + .macro loadsp, rb + mov \rb, #0xff000000 @ physical base address + add \rb, \rb, #0x00fb0000 +#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) + add \rb, \rb, #0x00000800 +#endif +#ifdef CONFIG_OMAP_LL_DEBUG_UART3 + add \rb, \rb, #0x00009000 +#endif + .endm + .macro writeb, rb + strb \rb, [r3] + .endm #else #error no serial architecture defined #endif diff --git a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig index 1def9c72b..6f1dac2e1 100644 --- a/arch/arm/configs/ebsa110_defconfig +++ b/arch/arm/configs/ebsa110_defconfig @@ -2,137 +2,120 @@ # Automatically generated make config: don't edit # CONFIG_ARM=y -# CONFIG_EISA is not set -# CONFIG_SBUS is not set -# CONFIG_MCA is not set +CONFIG_MMU=y CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y -# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set # # Code maturity level options # CONFIG_EXPERIMENTAL=y -# CONFIG_OBSOLETE is not set +CONFIG_CLEAN_COMPILE=y +CONFIG_STANDALONE=y +CONFIG_BROKEN_ON_SMP=y + +# +# General setup +# +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_HOTPLUG=y +# CONFIG_IKCONFIG is not set +CONFIG_EMBEDDED=y +CONFIG_KALLSYMS=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # # Loadable module support # CONFIG_MODULES=y +# CONFIG_MODULE_UNLOAD is not set +CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set CONFIG_KMOD=y # # System Type # -# CONFIG_ARCH_ARCA5K is not set +# CONFIG_ARCH_ADIFCC is not set # CONFIG_ARCH_CLPS7500 is not set +# CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_CO285 is not set CONFIG_ARCH_EBSA110=y -# CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_CAMELOT is not set # CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_IOP3XX is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_S3C2410 is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_LH7A40X is not set +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_VERSATILE_PB is not set # -# Archimedes/A5000 Implementations -# - -# -# Archimedes/A5000 Implementations (select only ONE) -# -# CONFIG_ARCH_ARC is not set -# CONFIG_ARCH_A5K is not set - -# -# Footbridge Implementations -# -# CONFIG_ARCH_CATS is not set -# CONFIG_ARCH_PERSONAL_SERVER is not set -# CONFIG_ARCH_EBSA285_ADDIN is not set -# CONFIG_ARCH_EBSA285_HOST is not set -# CONFIG_ARCH_NETWINDER is not set - -# -# SA11x0 Implementations -# -# CONFIG_SA1100_ASSABET is not set -# CONFIG_ASSABET_NEPONSET is not set -# CONFIG_SA1100_BRUTUS is not set -# CONFIG_SA1100_CERF is not set -# CONFIG_SA1100_BITSY is not set -# CONFIG_SA1100_EXTENEX1 is not set -# CONFIG_SA1100_FREEBIRD is not set -# CONFIG_SA1100_GRAPHICSCLIENT is not set -# CONFIG_SA1100_JORNADA720 is not set -# CONFIG_SA1100_HUW_WEBPANEL is not set -# CONFIG_SA1100_ITSY is not set -# CONFIG_SA1100_LART is not set -# CONFIG_SA1100_NANOENGINE is not set -# CONFIG_SA1100_OMNIMETER is not set -# CONFIG_SA1100_PANGOLIN is not set -# CONFIG_SA1100_PLEB is not set -# CONFIG_SA1100_SHERMAN is not set -# CONFIG_SA1100_PFS168 is not set -# CONFIG_SA1100_VICTOR is not set -# CONFIG_SA1100_XP860 is not set -# CONFIG_SA1100_YOPY is not set - -# -# CLPS711X/EP721X Implementations +# Processor Type # -# CONFIG_ARCH_P720T is not set -# CONFIG_ARCH_ACORN is not set -# CONFIG_FOOTBRIDGE is not set -# CONFIG_FOOTBRIDGE_HOST is not set -# CONFIG_FOOTBRIDGE_ADDIN is not set CONFIG_CPU_32=y -# CONFIG_CPU_26 is not set +CONFIG_CPU_SA110=y +CONFIG_CPU_32v4=y +CONFIG_CPU_ABRT_EV4=y +CONFIG_CPU_CACHE_V4WB=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_TLB_V4WB=y # -# Processor Type +# Processor Features # -# CONFIG_CPU_32v3 is not set -CONFIG_CPU_32v4=y -# CONFIG_CPU_ARM610 is not set -# CONFIG_CPU_ARM710 is not set -# CONFIG_CPU_ARM720T is not set -# CONFIG_CPU_ARM920T is not set -# CONFIG_CPU_ARM1020 is not set -CONFIG_CPU_SA110=y -# CONFIG_CPU_SA1100 is not set -# CONFIG_DISCONTIGMEM is not set # # General setup # -# CONFIG_PCI is not set CONFIG_ISA=y -# CONFIG_ISA_DMA is not set -CONFIG_HOTPLUG=y +# CONFIG_ZBOOT_ROM is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 # # PCMCIA/CardBus support # CONFIG_PCMCIA=m -CONFIG_I82365=y +# CONFIG_PCMCIA_DEBUG is not set +CONFIG_I82365=m # CONFIG_TCIC is not set -# CONFIG_PCMCIA_CLPS6700 is not set -# CONFIG_PCMCIA_SA1100 is not set -CONFIG_NET=y -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_SYSCTL=y +CONFIG_PCMCIA_PROBE=y + +# +# At least one math emulation must be selected +# CONFIG_FPE_NWFPE=y +# CONFIG_FPE_NWFPE_XP is not set CONFIG_FPE_FASTFPE=y -CONFIG_KCORE_ELF=y -# CONFIG_KCORE_AOUT is not set -CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y +CONFIG_BINFMT_AOUT=y # CONFIG_BINFMT_MISC is not set + +# +# Generic Driver Options +# +# CONFIG_FW_LOADER is not set # CONFIG_PM is not set +# CONFIG_PREEMPT is not set # CONFIG_ARTHUR is not set CONFIG_CMDLINE="root=/dev/nfs rw mem=16M console=ttyS1,38400n8" CONFIG_LEDS=y @@ -143,22 +126,18 @@ CONFIG_LEDS_TIMER=y # CONFIG_PARPORT=y CONFIG_PARPORT_PC=y +CONFIG_PARPORT_PC_CML1=y CONFIG_PARPORT_PC_FIFO=y # CONFIG_PARPORT_PC_SUPERIO is not set # CONFIG_PARPORT_PC_PCMCIA is not set # CONFIG_PARPORT_ARC is not set -# CONFIG_PARPORT_AMIGA is not set -# CONFIG_PARPORT_MFC3 is not set -# CONFIG_PARPORT_ATARI is not set -# CONFIG_PARPORT_SUNBPP is not set # CONFIG_PARPORT_OTHER is not set CONFIG_PARPORT_1284=y # -# Plug and Play configuration +# Plug and Play support # # CONFIG_PNP is not set -# CONFIG_ISAPNP is not set # # Block devices @@ -166,9 +145,6 @@ CONFIG_PARPORT_1284=y # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set -# CONFIG_BLK_CPQ_DA is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y @@ -179,37 +155,29 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 # Multi-device support (RAID and LVM) # # CONFIG_MD is not set -# CONFIG_BLK_DEV_MD is not set -# CONFIG_MD_LINEAR is not set -# CONFIG_MD_RAID0 is not set -# CONFIG_MD_RAID1 is not set -# CONFIG_MD_RAID5 is not set -# CONFIG_BLK_DEV_LVM is not set + +# +# Networking support +# +CONFIG_NET=y # # Networking options # CONFIG_PACKET=y CONFIG_PACKET_MMAP=y -CONFIG_NETLINK=y -CONFIG_RTNETLINK=y # CONFIG_NETLINK_DEV is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_FILTER is not set CONFIG_UNIX=y +# CONFIG_NET_KEY is not set CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_RTNETLINK=y -CONFIG_NETLINK=y CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_ROUTE_FWMARK=y CONFIG_IP_ROUTE_NAT=y # CONFIG_IP_ROUTE_MULTIPATH is not set # CONFIG_IP_ROUTE_TOS is not set CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_ROUTE_LARGE_TABLES is not set CONFIG_IP_PNP=y # CONFIG_IP_PNP_DHCP is not set CONFIG_IP_PNP_BOOTP=y @@ -218,64 +186,113 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set -CONFIG_INET_ECN=y CONFIG_SYN_COOKIES=y +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set + +# +# IP: Virtual Server Configuration +# +# CONFIG_IP_VS is not set +CONFIG_IPV6=y +# CONFIG_IPV6_PRIVACY is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_TUNNEL is not set +CONFIG_NETFILTER=y +# CONFIG_NETFILTER_DEBUG is not set # -# IP: Netfilter Configuration +# IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=y CONFIG_IP_NF_FTP=y CONFIG_IP_NF_IRC=y +# CONFIG_IP_NF_TFTP is not set +# CONFIG_IP_NF_AMANDA is not set # CONFIG_IP_NF_QUEUE is not set CONFIG_IP_NF_IPTABLES=y CONFIG_IP_NF_MATCH_LIMIT=y -# CONFIG_IP_NF_MATCH_MAC is not set +CONFIG_IP_NF_MATCH_IPRANGE=y +CONFIG_IP_NF_MATCH_MAC=y +CONFIG_IP_NF_MATCH_PKTTYPE=y CONFIG_IP_NF_MATCH_MARK=y CONFIG_IP_NF_MATCH_MULTIPORT=y CONFIG_IP_NF_MATCH_TOS=y -# CONFIG_IP_NF_MATCH_TCPMSS is not set +CONFIG_IP_NF_MATCH_RECENT=y +CONFIG_IP_NF_MATCH_ECN=y +CONFIG_IP_NF_MATCH_DSCP=y +CONFIG_IP_NF_MATCH_AH_ESP=y +CONFIG_IP_NF_MATCH_LENGTH=y +CONFIG_IP_NF_MATCH_TTL=y +CONFIG_IP_NF_MATCH_TCPMSS=y +CONFIG_IP_NF_MATCH_HELPER=y CONFIG_IP_NF_MATCH_STATE=y -CONFIG_IP_NF_MATCH_UNCLEAN=y +CONFIG_IP_NF_MATCH_CONNTRACK=y # CONFIG_IP_NF_MATCH_OWNER is not set CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_TARGET_REJECT=y -# CONFIG_IP_NF_TARGET_MIRROR is not set CONFIG_IP_NF_NAT=y CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=y CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_SAME=y +# CONFIG_IP_NF_NAT_LOCAL is not set +# CONFIG_IP_NF_NAT_SNMP_BASIC is not set CONFIG_IP_NF_NAT_IRC=y CONFIG_IP_NF_NAT_FTP=y CONFIG_IP_NF_MANGLE=y CONFIG_IP_NF_TARGET_TOS=y +CONFIG_IP_NF_TARGET_ECN=y +CONFIG_IP_NF_TARGET_DSCP=y CONFIG_IP_NF_TARGET_MARK=y +CONFIG_IP_NF_TARGET_CLASSIFY=y CONFIG_IP_NF_TARGET_LOG=y -# CONFIG_IP_NF_TARGET_TCPMSS is not set -CONFIG_IPV6=y +# CONFIG_IP_NF_TARGET_ULOG is not set +CONFIG_IP_NF_TARGET_TCPMSS=y +# CONFIG_IP_NF_ARPTABLES is not set +# CONFIG_IP_NF_RAW is not set # -# IPv6: Netfilter Configuration +# IPv6: Netfilter Configuration # +# CONFIG_IP6_NF_QUEUE is not set CONFIG_IP6_NF_IPTABLES=y CONFIG_IP6_NF_MATCH_LIMIT=y +CONFIG_IP6_NF_MATCH_MAC=y +CONFIG_IP6_NF_MATCH_RT=y +CONFIG_IP6_NF_MATCH_OPTS=y +CONFIG_IP6_NF_MATCH_FRAG=y +CONFIG_IP6_NF_MATCH_HL=y +CONFIG_IP6_NF_MATCH_MULTIPORT=y +# CONFIG_IP6_NF_MATCH_OWNER is not set CONFIG_IP6_NF_MATCH_MARK=y +# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set +CONFIG_IP6_NF_MATCH_AHESP=y +CONFIG_IP6_NF_MATCH_LENGTH=y +# CONFIG_IP6_NF_MATCH_EUI64 is not set CONFIG_IP6_NF_FILTER=y +# CONFIG_IP6_NF_TARGET_LOG is not set CONFIG_IP6_NF_MANGLE=y CONFIG_IP6_NF_TARGET_MARK=y -# CONFIG_KHTTPD is not set -# CONFIG_ATM is not set +# CONFIG_IP6_NF_RAW is not set # -# +# SCTP Configuration (EXPERIMENTAL) # +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -288,25 +305,30 @@ CONFIG_IP6_NF_TARGET_MARK=y # CONFIG_NET_SCHED is not set # -# Network device support +# Network testing # +# CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y +# CONFIG_DUMMY is not set +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # # ARCnet devices # # CONFIG_ARCNET is not set -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set -# CONFIG_ETHERTAP is not set -# CONFIG_NET_SB1000 is not set # # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y +# CONFIG_MII is not set CONFIG_ARM_AM79C961A=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_LANCE is not set @@ -322,40 +344,20 @@ CONFIG_ARM_AM79C961A=y # # Ethernet (1000 Mbit) # -# CONFIG_ACENIC is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_SK98LIN is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PLIP is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -# CONFIG_PPP_SYNC_TTY is not set -CONFIG_PPP_DEFLATE=m -CONFIG_PPP_BSDCOMP=m -# CONFIG_PPPOE is not set -# CONFIG_SLIP is not set # -# Wireless LAN (non-hamradio) +# Ethernet (10000 Mbit) # -# CONFIG_NET_RADIO is not set # # Token Ring devices # # CONFIG_TR is not set -# CONFIG_NET_FC is not set -# CONFIG_RCPCI is not set -# CONFIG_SHAPER is not set # -# Wan interfaces +# Wireless LAN (non-hamradio) # -# CONFIG_WAN is not set +# CONFIG_NET_RADIO is not set # # PCMCIA network device support @@ -368,39 +370,42 @@ CONFIG_PCMCIA_PCNET=m # CONFIG_PCMCIA_NMCLAN is not set # CONFIG_PCMCIA_SMC91C92 is not set # CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_ARCNET_COM20020_CS is not set -# CONFIG_PCMCIA_IBMTR is not set -# CONFIG_NET_PCMCIA_RADIO is not set +# CONFIG_PCMCIA_AXNET is not set # -# Amateur Radio support +# Wan interfaces # -# CONFIG_HAMRADIO is not set +# CONFIG_WAN is not set +# CONFIG_PLIP is not set +CONFIG_PPP=m +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_ASYNC=m +# CONFIG_PPP_SYNC_TTY is not set +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_BSDCOMP=m +# CONFIG_PPPOE is not set +# CONFIG_SLIP is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # -# IrDA (infrared) support +# SCSI device support # -# CONFIG_IRDA is not set +# CONFIG_SCSI is not set # -# ATA/IDE/MFM/RLL support +# Fusion MPT device support # -# CONFIG_IDE is not set -# CONFIG_BLK_DEV_HD is not set # -# SCSI support +# IEEE 1394 (FireWire) support # -# CONFIG_SCSI is not set +# CONFIG_IEEE1394 is not set # # I2O device support # -# CONFIG_I2O is not set -# CONFIG_I2O_BLOCK is not set -# CONFIG_I2O_LAN is not set -# CONFIG_I2O_SCSI is not set -# CONFIG_I2O_PROC is not set # # ISDN subsystem @@ -408,76 +413,80 @@ CONFIG_PCMCIA_PCNET=m # CONFIG_ISDN is not set # -# Input core support +# Input device support # # CONFIG_INPUT is not set # -# Character devices +# Userland interfaces # -# CONFIG_VT is not set -CONFIG_SERIAL=y -CONFIG_SERIAL_CONSOLE=y -CONFIG_SERIAL_EXTENDED=y -# CONFIG_SERIAL_MANY_PORTS is not set -# CONFIG_SERIAL_SHARE_IRQ is not set -# CONFIG_SERIAL_DETECT_IRQ is not set -# CONFIG_SERIAL_MULTIPORT is not set -# CONFIG_HUB6 is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_21285 is not set -# CONFIG_SERIAL_21285_OLD is not set -# CONFIG_SERIAL_21285_CONSOLE is not set -# CONFIG_SERIAL_SA1100 is not set -# CONFIG_SERIAL_SA1100_CONSOLE is not set -# CONFIG_SERIAL_AMBA is not set -# CONFIG_SERIAL_AMBA_CONSOLE is not set -# CONFIG_SERIAL_CLPS711X is not set -# CONFIG_SERIAL_CLPS711X_CONSOLE is not set -CONFIG_UNIX98_PTYS=y -CONFIG_UNIX98_PTY_COUNT=256 -CONFIG_PRINTER=m -# CONFIG_LP_CONSOLE is not set -# CONFIG_PPDEV is not set # -# I2C support +# Input I/O drivers # -# CONFIG_I2C is not set +# CONFIG_GAMEPORT is not set +CONFIG_SOUND_GAMEPORT=y +# CONFIG_SERIO is not set +# CONFIG_SERIO_I8042 is not set # -# Mice +# Input Device Drivers # -# CONFIG_BUSMOUSE is not set -# CONFIG_MOUSE is not set # -# Joysticks +# Character devices # -# CONFIG_JOYSTICK is not set +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set # -# Input core support is needed for joysticks +# Serial drivers +# +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_CS=m +CONFIG_SERIAL_8250_NR_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set + # +# Non-8250 serial port support +# +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_PRINTER=m +# CONFIG_LP_CONSOLE is not set +# CONFIG_PPDEV is not set +# CONFIG_TIPAR is not set # CONFIG_QIC02_TAPE is not set +# +# IPMI +# +# CONFIG_IPMI_HANDLER is not set + # # Watchdog Cards # CONFIG_WATCHDOG=y # CONFIG_WATCHDOG_NOWAYOUT is not set + +# +# Watchdog Device Drivers +# CONFIG_SOFT_WATCHDOG=y -# CONFIG_WDT is not set -# CONFIG_WDTPCI is not set + +# +# ISA-based Watchdog Cards +# # CONFIG_PCWATCHDOG is not set -# CONFIG_ACQUIRE_WDT is not set -# CONFIG_ADVANTECH_WDT is not set -# CONFIG_60XX_WDT is not set # CONFIG_MIXCOMWD is not set -# CONFIG_MACHZ_WDT is not set -# CONFIG_INTEL_RNG is not set +# CONFIG_WDT is not set # CONFIG_NVRAM is not set # CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -492,81 +501,97 @@ CONFIG_SOFT_WATCHDOG=y # # PCMCIA character devices # -# CONFIG_PCMCIA_SERIAL_CS is not set +# CONFIG_SYNCLINK_CS is not set +# CONFIG_RAW_DRIVER is not set + +# +# I2C support +# +# CONFIG_I2C is not set # # Multimedia devices # # CONFIG_VIDEO_DEV is not set +# +# Digital Video Broadcasting Devices +# +# CONFIG_DVB is not set + # # File systems # +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +CONFIG_MINIX_FS=y +# CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set CONFIG_AUTOFS4_FS=y -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_CHECK is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_FAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_SYSFS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVPTS_FS_XATTR is not set +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# # CONFIG_ADFS_FS is not set -# CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set -# CONFIG_FAT_FS is not set -# CONFIG_MSDOS_FS is not set -# CONFIG_UMSDOS_FS is not set -# CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set -# CONFIG_JFFS_FS is not set -# CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set -# CONFIG_TMPFS is not set -# CONFIG_RAMFS is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_JOLIET is not set -CONFIG_MINIX_FS=y # CONFIG_VXFS_FS is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set -CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set -# CONFIG_DEVFS_MOUNT is not set -# CONFIG_DEVFS_DEBUG is not set -CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set -# CONFIG_QNX4FS_RW is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_EXT2_FS is not set # CONFIG_SYSV_FS is not set -# CONFIG_SYSV_FS_WRITE is not set -# CONFIG_UDF_FS is not set -# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set -# CONFIG_UFS_FS_WRITE is not set # # Network File Systems # -# CONFIG_CODA_FS is not set CONFIG_NFS_FS=y -# CONFIG_NFS_V3 is not set -CONFIG_ROOT_NFS=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set # CONFIG_NFSD is not set -# CONFIG_NFSD_V3 is not set -CONFIG_SUNRPC=y +CONFIG_ROOT_NFS=y CONFIG_LOCKD=y +# CONFIG_EXPORTFS is not set +CONFIG_SUNRPC=y +# CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set # CONFIG_NCP_FS is not set -# CONFIG_NCPFS_PACKET_SIGNING is not set -# CONFIG_NCPFS_IOCTL_LOCKING is not set -# CONFIG_NCPFS_STRONG is not set -# CONFIG_NCPFS_NFS_NS is not set -# CONFIG_NCPFS_OS2_NS is not set -# CONFIG_NCPFS_SMALLDOS is not set -# CONFIG_NCPFS_NLS is not set -# CONFIG_NCPFS_EXTRAS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set # # Partition Types @@ -578,26 +603,68 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set # CONFIG_MSDOS_PARTITION is not set +# CONFIG_LDM_PARTITION is not set +# CONFIG_NEC98_PARTITION is not set # CONFIG_SGI_PARTITION is not set # CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set -# CONFIG_SMB_NLS is not set +# CONFIG_EFI_PARTITION is not set + +# +# Native Language Support +# # CONFIG_NLS is not set +# +# Profiling support +# +# CONFIG_PROFILING is not set + +# +# Graphics support +# +# CONFIG_FB is not set + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# Misc devices +# + # # USB support # -# CONFIG_USB is not set + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set # # Kernel hacking # CONFIG_FRAME_POINTER=y -CONFIG_DEBUG_ERRORS=y # CONFIG_DEBUG_USER is not set # CONFIG_DEBUG_INFO is not set -CONFIG_MAGIC_SYSRQ=y -# CONFIG_NO_PGT_CACHE is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_DC21285_PORT is not set -# CONFIG_DEBUG_CLPS711X_UART2 is not set +# CONFIG_DEBUG_KERNEL is not set + +# +# Security options +# +# CONFIG_SECURITY is not set + +# +# Cryptographic options +# +# CONFIG_CRYPTO is not set + +# +# Library routines +# +CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=m +CONFIG_ZLIB_DEFLATE=m diff --git a/arch/arm/configs/lpd7a400_defconfig b/arch/arm/configs/lpd7a400_defconfig index 2fd8da9f1..7bbb7181d 100644 --- a/arch/arm/configs/lpd7a400_defconfig +++ b/arch/arm/configs/lpd7a400_defconfig @@ -19,19 +19,23 @@ CONFIG_BROKEN_ON_SMP=y # # CONFIG_SWAP is not set CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set CONFIG_IKCONFIG=y # CONFIG_IKCONFIG_PROC is not set CONFIG_EMBEDDED=y CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y # CONFIG_EPOLL is not set CONFIG_IOSCHED_NOOP=y # CONFIG_IOSCHED_AS is not set # CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IOSCHED_CFQ=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # @@ -43,21 +47,24 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y # System Type # # CONFIG_ARCH_ADIFCC is not set -# CONFIG_ARCH_ANAKIN is not set # CONFIG_ARCH_CLPS7500 is not set # CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_PXA is not set # CONFIG_ARCH_EBSA110 is not set # CONFIG_ARCH_CAMELOT is not set # CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_INTEGRATOR is not set # CONFIG_ARCH_IOP3XX is not set +# CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C2410 is not set # CONFIG_ARCH_SHARK is not set CONFIG_ARCH_LH7A40X=y +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_VERSATILE_PB is not set # # CLPS711X/EP721X Implementations @@ -82,13 +89,45 @@ CONFIG_ARCH_LH7A40X=y # # -# Intel PXA250/210 Implementations +# Intel IXP4xx Implementation Options +# + +# +# IXP4xx Platforms +# + +# +# IXP4xx Options +# + +# +# Intel PXA2xx Implementations # # # SA11x0 Implementations # +# +# TI OMAP Implementations +# + +# +# OMAP Core Type +# + +# +# OMAP Board Type +# + +# +# OMAP Feature Selections +# + +# +# S3C2410 Implementations +# + # # LH7A40X Implementations # @@ -254,23 +293,21 @@ CONFIG_IP_PNP_RARP=y # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_ARPD is not set -# CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set # CONFIG_NETFILTER is not set # # SCTP Configuration (EXPERIMENTAL) # -CONFIG_IPV6_SCTP__=y # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set @@ -291,6 +328,11 @@ CONFIG_IPV6_SCTP__=y # Network testing # # CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_BONDING is not set @@ -311,38 +353,24 @@ CONFIG_SMC91X=y # # Ethernet (10000 Mbit) # -# CONFIG_PPP is not set -# CONFIG_SLIP is not set # -# Wireless LAN (non-hamradio) +# Token Ring devices # -# CONFIG_NET_RADIO is not set # -# Token Ring devices +# Wireless LAN (non-hamradio) # -# CONFIG_SHAPER is not set +# CONFIG_NET_RADIO is not set # # Wan interfaces # # CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # # ATA/ATAPI/MFM/RLL support @@ -367,9 +395,9 @@ CONFIG_IDE_POLL=y # IDE chipset support/bugfixes # CONFIG_IDE_GENERIC=y +CONFIG_IDE_ARM=y # CONFIG_BLK_DEV_IDEDMA is not set # CONFIG_IDEDMA_AUTO is not set -# CONFIG_DMA_NONPCI is not set # CONFIG_BLK_DEV_HD is not set # @@ -452,11 +480,6 @@ CONFIG_SERIAL_LH7A40X_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 - -# -# Mice -# -# CONFIG_BUSMOUSE is not set # CONFIG_QIC02_TAPE is not set # @@ -536,6 +559,7 @@ CONFIG_VFAT_FS=y # Pseudo filesystems # CONFIG_PROC_FS=y +CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y @@ -576,7 +600,7 @@ CONFIG_LOCKD=y CONFIG_LOCKD_V4=y # CONFIG_EXPORTFS is not set CONFIG_SUNRPC=y -# CONFIG_SUNRPC_GSS is not set +# CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set @@ -664,6 +688,11 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y +# +# Sound +# +# CONFIG_SOUND is not set + # # Misc devices # @@ -706,5 +735,6 @@ CONFIG_DEBUG_ERRORS=y # Library routines # CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig index a13b52210..517f486d9 100644 --- a/arch/arm/configs/lpd7a404_defconfig +++ b/arch/arm/configs/lpd7a404_defconfig @@ -19,19 +19,23 @@ CONFIG_BROKEN_ON_SMP=y # # CONFIG_SWAP is not set CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set CONFIG_IKCONFIG=y # CONFIG_IKCONFIG_PROC is not set CONFIG_EMBEDDED=y CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y # CONFIG_EPOLL is not set CONFIG_IOSCHED_NOOP=y # CONFIG_IOSCHED_AS is not set # CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IOSCHED_CFQ=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # @@ -46,19 +50,21 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_ARCH_CLPS7500 is not set # CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_CO285 is not set -# CONFIG_ARCH_PXA is not set # CONFIG_ARCH_EBSA110 is not set # CONFIG_ARCH_CAMELOT is not set # CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_INTEGRATOR is not set # CONFIG_ARCH_IOP3XX is not set +# CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_L7200 is not set +# CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SHARK is not set # CONFIG_ARCH_S3C2410 is not set -# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_SHARK is not set CONFIG_ARCH_LH7A40X=y +# CONFIG_ARCH_OMAP is not set +# CONFIG_ARCH_VERSATILE_PB is not set # # CLPS711X/EP721X Implementations @@ -83,7 +89,19 @@ CONFIG_ARCH_LH7A40X=y # # -# Intel PXA250/210 Implementations +# Intel IXP4xx Implementation Options +# + +# +# IXP4xx Platforms +# + +# +# IXP4xx Options +# + +# +# Intel PXA2xx Implementations # # @@ -94,6 +112,14 @@ CONFIG_ARCH_LH7A40X=y # TI OMAP Implementations # +# +# OMAP Core Type +# + +# +# OMAP Board Type +# + # # OMAP Feature Selections # @@ -271,8 +297,6 @@ CONFIG_IP_PNP_RARP=y # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set # CONFIG_NETFILTER is not set # @@ -280,7 +304,9 @@ CONFIG_IP_PNP_RARP=y # # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set @@ -301,6 +327,11 @@ CONFIG_IP_PNP_RARP=y # Network testing # # CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_BONDING is not set @@ -321,41 +352,24 @@ CONFIG_SMC91X=y # # Ethernet (10000 Mbit) # -# CONFIG_PPP is not set -# CONFIG_SLIP is not set # -# Wireless LAN (non-hamradio) +# Token Ring devices # -# CONFIG_NET_RADIO is not set # -# Token Ring devices +# Wireless LAN (non-hamradio) # -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set +# CONFIG_NET_RADIO is not set # # Wan interfaces # # CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# -# Bluetooth support -# -# CONFIG_BT is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # # ATA/ATAPI/MFM/RLL support @@ -381,6 +395,7 @@ CONFIG_IDE_POLL=y # IDE chipset support/bugfixes # CONFIG_IDE_GENERIC=y +CONFIG_IDE_ARM=y # CONFIG_BLK_DEV_IDEDMA is not set # CONFIG_IDEDMA_AUTO is not set # CONFIG_BLK_DEV_HD is not set @@ -404,7 +419,6 @@ CONFIG_SCSI=y # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # # CONFIG_SCSI_MULTI_LUN is not set -# CONFIG_SCSI_REPORT_LUNS is not set # CONFIG_SCSI_CONSTANTS is not set # CONFIG_SCSI_LOGGING is not set @@ -418,6 +432,7 @@ CONFIG_SCSI=y # SCSI low-level drivers # # CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_DPT_I2O is not set # CONFIG_SCSI_SATA is not set # CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_DEBUG is not set @@ -573,6 +588,7 @@ CONFIG_VFAT_FS=y # Pseudo filesystems # CONFIG_PROC_FS=y +CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y @@ -618,7 +634,6 @@ CONFIG_SUNRPC=y # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set # CONFIG_AFS_FS is not set # @@ -761,6 +776,7 @@ CONFIG_USB_HIDINPUT=y # CONFIG_USB_KBTAB is not set # CONFIG_USB_POWERMATE is not set # CONFIG_USB_MTOUCH is not set +# CONFIG_USB_EGALAX is not set # CONFIG_USB_XPAD is not set # CONFIG_USB_ATI_REMOTE is not set @@ -809,6 +825,8 @@ CONFIG_USB_HIDINPUT=y # CONFIG_USB_LEGOTOWER is not set # CONFIG_USB_LCD is not set # CONFIG_USB_LED is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_PHIDGETSERVO is not set # CONFIG_USB_TEST is not set # @@ -845,5 +863,6 @@ CONFIG_DEBUG_ERRORS=y # Library routines # CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index 2ae6eae42..22b78368d 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S @@ -591,7 +591,8 @@ .macro addruart,rx mrc p15, 0, \rx, c1, c0 tst \rx, #1 @ MMU enabled? - ldr \rx, =0x80000700 @ physical base address + mov \rx, #0x00000700 @ offset from base + orreq \rx, \rx, #0x80000000 @ physical base orrne \rx, \rx, #0xf8000000 @ virtual base .endm diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 40058170e..c8a5e0f87 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -19,6 +19,7 @@ #include #include #include +#include #include "entry-header.S" @@ -679,19 +680,19 @@ ENTRY(soft_irq_mask) .macro get_irqnr_and_base, irqnr, irqstat, base, tmp ldr \base, =IO_ADDRESS(OMAP_IH1_BASE) - ldr \irqnr, [\base, #IRQ_ITR] - ldr \tmp, [\base, #IRQ_MIR] + ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET] + ldr \tmp, [\base, #IRQ_MIR_REG_OFFSET] mov \irqstat, #0xffffffff bic \tmp, \irqstat, \tmp tst \irqnr, \tmp beq 1510f - ldr \irqnr, [\base, #IRQ_SIR_FIQ] + ldr \irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET] cmp \irqnr, #0 - ldreq \irqnr, [\base, #IRQ_SIR_IRQ] + ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] cmpeq \irqnr, #INT_IH2_IRQ ldreq \base, =IO_ADDRESS(OMAP_IH2_BASE) - ldreq \irqnr, [\base, #IRQ_SIR_IRQ] + ldreq \irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET] addeqs \irqnr, \irqnr, #32 1510: .endm @@ -1198,8 +1199,13 @@ call_fpe: enable_irq r10 @ Enable interrupts mov pc, lr @ CP#7 mov pc, lr @ CP#8 mov pc, lr @ CP#9 +#ifdef CONFIG_VFP + b do_vfp @ CP#10 (VFP) + b do_vfp @ CP#11 (VFP) +#else mov pc, lr @ CP#10 (VFP) mov pc, lr @ CP#11 (VFP) +#endif mov pc, lr @ CP#12 mov pc, lr @ CP#13 mov pc, lr @ CP#14 (Debug) @@ -1260,6 +1266,13 @@ ENTRY(__switch_to) ldr r3, [r2, #TI_CPU_DOMAIN]! stmia ip, {r4 - sl, fp, sp, lr} @ Store most regs on stack mcr p15, 0, r3, c3, c0, 0 @ Set domain register +#ifdef CONFIG_VFP + @ Always disable VFP so we can lazily save/restore the old + @ state. This occurs in the context of the previous thread. + VFPFMRX r4, FPEXC + bic r4, r4, #FPEXC_ENABLE + VFPFMXR FPEXC, r4 +#endif ldmib r2, {r4 - sl, fp, sp, pc} @ Load all regs saved previously __INIT diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c index d7c3f2667..a00cca000 100644 --- a/arch/arm/kernel/init_task.c +++ b/arch/arm/kernel/init_task.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 8d9db749e..56498dbf7 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -314,10 +314,16 @@ void flush_thread(void) memset(thread->used_cp, 0, sizeof(thread->used_cp)); memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); fp_init(&thread->fpstate); +#if defined(CONFIG_VFP) + vfp_flush_thread(&thread->vfpstate); +#endif } void release_thread(struct task_struct *dead_task) { +#if defined(CONFIG_VFP) + vfp_release_thread(&dead_task->thread_info->vfpstate); +#endif } asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 9cb5cb994..4aef80895 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -253,6 +253,9 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) goto badframe; + if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT) + goto badframe; + /* Send SIGTRAP if we're single-stepping */ if (current->ptrace & PT_SINGLESTEP) { ptrace_cancel_bpt(current); @@ -402,6 +405,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs *regs) { struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); + stack_t stack; int err = 0; if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) @@ -411,8 +415,14 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, __put_user_error(&frame->uc, &frame->puc, err); err |= copy_siginfo_to_user(&frame->info, info); - /* Clear all the bits of the ucontext we don't use. */ - err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); + __put_user_error(0, &frame->uc.uc_flags, err); + __put_user_error(NULL, &frame->uc.uc_link, err); + + memset(&stack, 0, sizeof(stack)); + stack.ss_sp = (void *)current->sas_ss_sp; + stack.ss_flags = sas_ss_flags(regs->ARM_sp); + stack.ss_size = current->sas_ss_size; + err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack)); err |= setup_sigcontext(&frame->uc.uc_mcontext, /*&frame->fpstate,*/ regs, set->sig[0]); diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index b419d0b5f..007a5a012 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -24,7 +24,6 @@ lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o lib-$(CONFIG_ARCH_CLPS7500) += io-acorn.o lib-$(CONFIG_ARCH_L7200) += io-acorn.o lib-$(CONFIG_ARCH_SHARK) += io-shark.o -lib-$(CONFIG_ARCH_CLPS711X) += io-acorn.o $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S diff --git a/arch/arm/lib/io-acorn.S b/arch/arm/lib/io-acorn.S index 99378ecd7..3aacd01d4 100644 --- a/arch/arm/lib/io-acorn.S +++ b/arch/arm/lib/io-acorn.S @@ -17,31 +17,6 @@ .text .align - .equ diff_pcio_base, PCIO_BASE - IO_BASE - - .macro outw2 rd - mov r8, \rd, lsl #16 - orr r8, r8, r8, lsr #16 - str r8, [r3, r0, lsl #2] - mov r8, \rd, lsr #16 - orr r8, r8, r8, lsl #16 - str r8, [r3, r0, lsl #2] - .endm - - .macro inw2 rd, mask, temp - ldr \rd, [r0] - and \rd, \rd, \mask - ldr \temp, [r0] - orr \rd, \rd, \temp, lsl #16 - .endm - - .macro addr rd - tst \rd, #0x80000000 - mov \rd, \rd, lsl #2 - add \rd, \rd, #IO_BASE - addeq \rd, \rd, #diff_pcio_base - .endm - .iosl_warning: .ascii "<4>insl/outsl not implemented, called from %08lX\0" .align diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index 4e2278f95..f6e676322 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig @@ -1,16 +1,15 @@ +if ARCH_CLPS711X menu "CLPS711X/EP721X Implementations" config ARCH_AUTCPU12 bool "AUTCPU12" - depends on ARCH_CLPS711X help Say Y if you intend to run the kernel on the autronix autcpu12 board. This board is based on a Cirrus Logic CS89712. config ARCH_CDB89712 bool "CDB89712" - depends on ARCH_CLPS711X help This is an evaluation board from Cirrus for the CS89712 processor. The board includes 2 serial ports, Ethernet, IRDA, and expansion @@ -18,32 +17,27 @@ config ARCH_CDB89712 config ARCH_CEIVA bool "CEIVA" - depends on ARCH_CLPS711X help Say Y here if you intend to run this kernel on the Ceiva/Polaroid PhotoMax Digital Picture Frame. config ARCH_CLEP7312 bool "CLEP7312" - depends on ARCH_CLPS711X config ARCH_EDB7211 bool "EDB7211" - depends on ARCH_CLPS711X help Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211 evaluation board. config ARCH_P720T bool "P720T" - depends on ARCH_CLPS711X help Say Y here if you intend to run this kernel on the ARM Prospector 720T. config ARCH_FORTUNET bool "FORTUNET" - depends on ARCH_CLPS711X # XXX Maybe these should indicate register compatibility # instead of being mutually exclusive. @@ -74,3 +68,4 @@ config EP72XX_ROM_BOOT endmenu +endif diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c index c948ddf30..6556818e4 100644 --- a/arch/arm/mach-ebsa110/io.c +++ b/arch/arm/mach-ebsa110/io.c @@ -67,9 +67,9 @@ u8 __readb(void *addr) u32 ret, a = __isamem_convert_addr(addr); if ((int)addr & 1) - ret = __raw_getl(a); + ret = __raw_readl(a); else - ret = __raw_getb(a); + ret = __raw_readb(a); return ret; } @@ -80,7 +80,7 @@ u16 __readw(void *addr) if ((int)addr & 1) BUG(); - return __raw_getw(a); + return __raw_readw(a); } u32 __readl(void *addr) @@ -90,8 +90,8 @@ u32 __readl(void *addr) if ((int)addr & 3) BUG(); - ret = __raw_getw(a); - ret |= __raw_getw(a + 4) << 16; + ret = __raw_readw(a); + ret |= __raw_readw(a + 4) << 16; return ret; } @@ -104,9 +104,9 @@ void __writeb(u8 val, void *addr) u32 a = __isamem_convert_addr(addr); if ((int)addr & 1) - __raw_putl(val, a); + __raw_writel(val, a); else - __raw_putb(val, a); + __raw_writeb(val, a); } void __writew(u16 val, void *addr) @@ -116,7 +116,7 @@ void __writew(u16 val, void *addr) if ((int)addr & 1) BUG(); - __raw_putw(val, a); + __raw_writew(val, a); } void __writel(u32 val, void *addr) @@ -126,8 +126,8 @@ void __writel(u32 val, void *addr) if ((int)addr & 3) BUG(); - __raw_putw(val, a); - __raw_putw(val >> 16, a + 4); + __raw_writew(val, a); + __raw_writew(val >> 16, a + 4); } EXPORT_SYMBOL(__writeb); @@ -147,7 +147,7 @@ u8 __inb(int port) * The SuperIO registers use sane addressing techniques... */ if (SUPERIO_PORT(port)) - ret = __raw_getb(ISAIO_BASE + (port << 2)); + ret = __raw_readb(ISAIO_BASE + (port << 2)); else { u32 a = ISAIO_BASE + ((port & ~1) << 1); @@ -155,9 +155,9 @@ u8 __inb(int port) * Shame nothing else does */ if (port & 1) - ret = __raw_getl(a); + ret = __raw_readl(a); else - ret = __raw_getb(a); + ret = __raw_readb(a); } return ret; } @@ -170,7 +170,7 @@ u16 __inw(int port) * The SuperIO registers use sane addressing techniques... */ if (SUPERIO_PORT(port)) - ret = __raw_getw(ISAIO_BASE + (port << 2)); + ret = __raw_readw(ISAIO_BASE + (port << 2)); else { u32 a = ISAIO_BASE + ((port & ~1) << 1); @@ -180,7 +180,7 @@ u16 __inw(int port) if (port & 1) BUG(); - ret = __raw_getw(a); + ret = __raw_readw(a); } return ret; } @@ -201,7 +201,7 @@ void __outb(u8 val, int port) * The SuperIO registers use sane addressing techniques... */ if (SUPERIO_PORT(port)) - __raw_putb(val, ISAIO_BASE + (port << 2)); + __raw_writeb(val, ISAIO_BASE + (port << 2)); else { u32 a = ISAIO_BASE + ((port & ~1) << 1); @@ -209,9 +209,9 @@ void __outb(u8 val, int port) * Shame nothing else does */ if (port & 1) - __raw_putl(val, a); + __raw_writel(val, a); else - __raw_putb(val, a); + __raw_writeb(val, a); } } @@ -230,7 +230,7 @@ void __outw(u16 val, int port) BUG(); } - __raw_putw(val, ISAIO_BASE + off); + __raw_writew(val, ISAIO_BASE + off); } void __outl(u32 val, int port) diff --git a/arch/arm/mach-epxa10db/Kconfig b/arch/arm/mach-epxa10db/Kconfig index e88d914ef..55d896dd4 100644 --- a/arch/arm/mach-epxa10db/Kconfig +++ b/arch/arm/mach-epxa10db/Kconfig @@ -1,17 +1,16 @@ +if ARCH_CAMELOT menu "Epxa10db" comment "PLD hotswap support" - depends on ARCH_CAMELOT config PLD bool - depends on ARCH_CAMELOT default y config PLD_HOTSWAP bool "Support for PLD device hotplugging (experimental)" - depends on ARCH_CAMELOT && EXPERIMENTAL + depends on EXPERIMENTAL help This enables support for the dynamic loading and configuration of compatible drivers when the contents of the PLD are changed. This @@ -21,3 +20,4 @@ config PLD_HOTSWAP endmenu +endif diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig index 510f896fd..1eaea0b87 100644 --- a/arch/arm/mach-footbridge/Kconfig +++ b/arch/arm/mach-footbridge/Kconfig @@ -1,9 +1,9 @@ +if ARCH_FOOTBRIDGE menu "Footbridge Implementations" config ARCH_CATS bool "CATS" - depends on ARCH_FOOTBRIDGE help Say Y here if you intend to run this kernel on the CATS. @@ -11,7 +11,6 @@ config ARCH_CATS config ARCH_PERSONAL_SERVER bool "Compaq Personal Server" - depends on ARCH_FOOTBRIDGE ---help--- Say Y here if you intend to run this kernel on the Compaq Personal Server. @@ -29,7 +28,6 @@ config ARCH_PERSONAL_SERVER config ARCH_EBSA285_ADDIN bool "EBSA285 (addin mode)" - depends on ARCH_FOOTBRIDGE help Say Y here if you intend to run this kernel on the EBSA285 card in addin mode. @@ -38,7 +36,6 @@ config ARCH_EBSA285_ADDIN config ARCH_EBSA285_HOST bool "EBSA285 (host mode)" - depends on ARCH_FOOTBRIDGE help Say Y here if you intend to run this kernel on the EBSA285 card in host ("central function") mode. @@ -47,7 +44,6 @@ config ARCH_EBSA285_HOST config ARCH_NETWINDER bool "NetWinder" - depends on ARCH_FOOTBRIDGE help Say Y here if you intend to run this kernel on the Rebel.COM NetWinder. Information about this machine can be found at: @@ -58,3 +54,4 @@ config ARCH_NETWINDER endmenu +endif diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index 47f67a206..df97d1639 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig @@ -1,5 +1,6 @@ +if ARCH_INTEGRATOR + menu "Integrator Options" - depends on ARCH_INTEGRATOR config ARCH_INTEGRATOR_AP bool "Support Integrator/AP and Integrator/PP2 platforms" @@ -28,3 +29,5 @@ config INTEGRATOR_IMPD1 module will be called impd1. endmenu + +endif diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile index 34726a4da..158daaf9e 100644 --- a/arch/arm/mach-integrator/Makefile +++ b/arch/arm/mach-integrator/Makefile @@ -4,7 +4,7 @@ # Object file lists. -obj-y := core.o lm.o time.o +obj-y := clock.o core.o lm.o time.o obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index dfdd5ecdf..e776e8a8d 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -25,13 +25,16 @@ #include #include +#include "clock.h" + static int module_id; module_param_named(lmid, module_id, int, 0444); MODULE_PARM_DESC(lmid, "logic module stack position"); struct impd1_module { - void *base; + void *base; + struct clk vcos[2]; }; static const struct icst525_params impd1_vco_params = { @@ -43,25 +46,20 @@ static const struct icst525_params impd1_vco_params = { .rd_max = 120, }; -void impd1_set_vco(struct device *dev, int vconr, unsigned long period) +static void impd1_setvco(struct clk *clk, struct icst525_vco vco) { - struct impd1_module *impd1 = dev_get_drvdata(dev); - struct icst525_vco vco; + struct impd1_module *impd1 = clk->data; + int vconr = clk - impd1->vcos; u32 val; - vco = icst525_ps_to_vco(&impd1_vco_params, period); - - pr_debug("Guessed VCO reg params: S=%d R=%d V=%d\n", - vco.s, vco.r, vco.v); - val = vco.v | (vco.r << 9) | (vco.s << 16); writel(0xa05f, impd1->base + IMPD1_LOCK); switch (vconr) { - case 1: + case 0: writel(val, impd1->base + IMPD1_OSC1); break; - case 2: + case 1: writel(val, impd1->base + IMPD1_OSC2); break; } @@ -77,8 +75,6 @@ void impd1_set_vco(struct device *dev, int vconr, unsigned long period) #endif } -EXPORT_SYMBOL(impd1_set_vco); - void impd1_tweak_control(struct device *dev, u32 mask, u32 val) { struct impd1_module *impd1 = dev_get_drvdata(dev); @@ -140,6 +136,11 @@ static struct impd1_device impd1_devs[] = { } }; +static const char *impd1_vconames[2] = { + "CLCDCLK", + "AUXVCO2", +}; + static int impd1_probe(struct lm_device *dev) { struct impd1_module *impd1; @@ -168,6 +169,16 @@ static int impd1_probe(struct lm_device *dev) printk("IM-PD1 found at 0x%08lx\n", dev->resource.start); + for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { + impd1->vcos[i].owner = THIS_MODULE, + impd1->vcos[i].name = impd1_vconames[i], + impd1->vcos[i].params = &impd1_vco_params, + impd1->vcos[i].data = impd1, + impd1->vcos[i].setvco = impd1_setvco; + + clk_register(&impd1->vcos[i]); + } + for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { struct impd1_device *idev = impd1_devs + i; struct amba_device *d; @@ -216,6 +227,7 @@ static void impd1_remove(struct lm_device *dev) { struct impd1_module *impd1 = lm_get_drvdata(dev); struct list_head *l, *n; + int i; list_for_each_safe(l, n, &dev->dev.children) { struct device *d = list_to_dev(l); @@ -223,6 +235,9 @@ static void impd1_remove(struct lm_device *dev) device_unregister(d); } + for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) + clk_unregister(&impd1->vcos[i]); + lm_set_drvdata(dev, NULL); iounmap(impd1->base); diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 751941059..f63e45cbe 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -32,12 +33,16 @@ #include #include +#include "clock.h" + #define INTCP_PA_MMC_BASE 0x1c000000 #define INTCP_PA_AACI_BASE 0x1d000000 #define INTCP_PA_FLASH_BASE 0x24000000 #define INTCP_FLASH_SIZE SZ_32M +#define INTCP_PA_CLCD_BASE 0xc0000000 + #define INTCP_VA_CIC_BASE 0xf1000040 #define INTCP_VA_PIC_BASE 0xf1400000 #define INTCP_VA_SIC_BASE 0xfca00000 @@ -209,6 +214,44 @@ static void __init intcp_init_irq(void) pic_unmask_irq(IRQ_CP_CPPLDINT); } +/* + * Clock handling + */ +#define CM_LOCK (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET) +#define CM_AUXOSC (IO_ADDRESS(INTEGRATOR_HDR_BASE)+0x1c) + +static const struct icst525_params cp_auxvco_params = { + .ref = 24000, + .vco_max = 320000, + .vd_min = 8, + .vd_max = 263, + .rd_min = 3, + .rd_max = 65, +}; + +static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco) +{ + u32 val; + + val = readl(CM_AUXOSC) & ~0x7ffff; + val |= vco.v | (vco.r << 9) | (vco.s << 16); + + writel(0xa05f, CM_LOCK); + writel(val, CM_AUXOSC); + writel(0, CM_LOCK); +} + +static struct clk cp_clcd_clk = { + .name = "CLCDCLK", + .params = &cp_auxvco_params, + .setvco = cp_auxvco_set, +}; + +static struct clk cp_mmci_clk = { + .name = "MCLK", + .rate = 33000000, +}; + /* * Flash handling. */ @@ -340,15 +383,34 @@ static struct amba_device aaci_device = { .periphid = 0, }; +static struct amba_device clcd_device = { + .dev = { + .bus_id = "mb:c0", + .coherent_dma_mask = ~0, + }, + .res = { + .start = INTCP_PA_CLCD_BASE, + .end = INTCP_PA_CLCD_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + .dma_mask = ~0, + .irq = { IRQ_CP_CLCDCINT, NO_IRQ }, + .periphid = 0, +}; + static struct amba_device *amba_devs[] __initdata = { &mmc_device, &aaci_device, + &clcd_device, }; static void __init intcp_init(void) { int i; + clk_register(&cp_clcd_clk); + clk_register(&cp_mmci_clk); + platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { diff --git a/arch/arm/mach-iop3xx/Kconfig b/arch/arm/mach-iop3xx/Kconfig index a253ad4dc..6a388e273 100644 --- a/arch/arm/mach-iop3xx/Kconfig +++ b/arch/arm/mach-iop3xx/Kconfig @@ -1,10 +1,10 @@ +if ARCH_IOP3XX menu "IOP3xx Implementation Options" choice prompt "IOP3xx System Type" default ARCH_IQ80310 - depends on ARCH_IOP3XX config ARCH_IQ80310 bool "IQ80310" @@ -36,19 +36,20 @@ comment "IOP3xx Chipset Features" config IOP3XX_AAU bool "Support Intel IOP3xx Application Accelerator Unit (EXPERIMENTAL)" - depends on ARCH_IOP3XX && EXPERIMENTAL + depends on EXPERIMENTAL config IOP3XX_DMA bool "Support Intel IOP3xx DMA (EXPERIMENTAL)" - depends on ARCH_IOP3XX && EXPERIMENTAL + depends on EXPERIMENTAL config IOP3XX_MU bool "Support Intel IOP3xx Messaging Unit (EXPERIMENTAL)" - depends on ARCH_IOP3XX && EXPERIMENTAL + depends on EXPERIMENTAL config IOP3XX_PMON bool "Support Intel IOP3xx Performance Monitor (EXPERIMENTAL)" - depends on ARCH_IOP3XX && EXPERIMENTAL + depends on EXPERIMENTAL endmenu +endif diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 3377f887b..46b72e106 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig @@ -1,7 +1,7 @@ +if ARCH_IXP4XX config ARCH_SUPPORTS_BIG_ENDIAN bool - depends on ARCH_IXP4XX default y menu "Intel IXP4xx Implementation Options" @@ -10,7 +10,6 @@ comment "IXP4xx Platforms" config ARCH_AVILA bool "Avila" - depends on ARCH_IXP4XX help Say 'Y' here if you want your kernel to support the Gateworks Avila Network Platform. For more information on this platform, @@ -18,7 +17,6 @@ config ARCH_AVILA config ARCH_ADI_COYOTE bool "Coyote" - depends on ARCH_IXP4XX help Say 'Y' here if you want your kernel to support the ADI Engineering Coyote Gateway Reference Platform. For more @@ -26,7 +24,6 @@ config ARCH_ADI_COYOTE config ARCH_IXDP425 bool "IXDP425" - depends on ARCH_IXP4XX help Say 'Y' here if you want your kernel to support Intel's IXDP425 Development Platform (Also known as Richfield). @@ -44,7 +41,6 @@ config ARCH_IXCDP1100 config ARCH_PRPMC1100 bool "PrPMC1100" - depends on ARCH_IXP4XX help Say 'Y' here if you want your kernel to support the Motorola PrPCM1100 Processor Mezanine Module. For more information on @@ -62,7 +58,6 @@ comment "IXP4xx Options" config IXP4XX_INDIRECT_PCI bool "Use indirect PCI memory access" - depends on ARCH_IXP4XX help IXP4xx provides two methods of accessing PCI memory space: @@ -87,3 +82,5 @@ config IXP4XX_INDIRECT_PCI what you need, leave this option unselected. endmenu + +endif diff --git a/arch/arm/mach-lh7a40x/Kconfig b/arch/arm/mach-lh7a40x/Kconfig index 4475dba72..8a17867a6 100644 --- a/arch/arm/mach-lh7a40x/Kconfig +++ b/arch/arm/mach-lh7a40x/Kconfig @@ -1,9 +1,9 @@ +if ARCH_LH7A40X menu "LH7A40X Implementations" config MACH_KEV7A400 bool "KEV7A400" - depends on ARCH_LH7A40X select ARCH_LH7A400 help Say Y here if you are using the Sharp KEV7A400 development @@ -12,9 +12,8 @@ config MACH_KEV7A400 config MACH_LPD7A400 bool "LPD7A400 Card Engine" - depends on ARCH_LH7A40X select ARCH_LH7A400 - select IDE_POLL +# select IDE_POLL help Say Y here if you are using Logic Product Development's LPD7A400 CardEngine. For the time being, the LPD7A400 and @@ -22,9 +21,8 @@ config MACH_LPD7A400 config MACH_LPD7A404 bool "LPD7A404 Card Engine" - depends on ARCH_LH7A40X select ARCH_LH7A404 - select IDE_POLL +# select IDE_POLL help Say Y here if you are using Logic Product Development's LPD7A404 CardEngine. For the time being, the LPD7A400 and @@ -36,4 +34,37 @@ config ARCH_LH7A400 config ARCH_LH7A404 bool +config LH7A40X_CONTIGMEM + bool "Disable NUMA Support" + depends on ARCH_LH7A40X + help + Say Y here if your bootloader sets the SROMLL bit(s) in + the SDRAM controller, organizing memory as a contiguous + array. This option will disable CONFIG_DISCONTIGMEM and + force the kernel to manage all memory in one node. + + Setting this option incorrectly may prevent the kernel from + booting. It is OK to leave it N. + + For more information, consult + . + +config LH7A40X_ONE_BANK_PER_NODE + bool "Optimize NUMA Node Tables for Size" + depends on ARCH_LH7A40X && !LH7A40X_CONTIGMEM + help + Say Y here to produce compact memory node tables. By + default pairs of adjacent physical RAM banks are managed + together in a single node, incurring some wasted overhead + in the node tables, however also maintaining compatibility + with systems where physical memory is truly contiguous. + + Setting this option incorrectly may prevent the kernel from + booting. It is OK to leave it N. + + For more information, consult + . + endmenu + +endif diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c index 734cc7581..75dba9836 100644 --- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c +++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c @@ -116,7 +116,12 @@ extern void lpd7a400_map_io (void); static void __init lpd7a40x_init (void) { - CPLD_CONTROL = 0x0; /* Enable LAN (Disable LCD) */ + CPLD_CONTROL |= (1<<6); /* Mask USB1 connection IRQ */ + CPLD_CONTROL &= ~(0 + | (1<<1) /* Disable LCD */ + | (1<<0) /* Enable WLAN */ + ); + platform_add_devices (lpd7a40x_devs, ARRAY_SIZE (lpd7a40x_devs)); } @@ -191,7 +196,7 @@ void __init lh7a40x_init_board_irq (void) int pinCPLD = (cpld_version == 0x28) ? 7 : 3; #if defined CONFIG_MACH_LPD7A404 - cpld_version = 0x34; /* Override, for now */ + cpld_version = 0x34; /* Coerce LPD7A404 to RevB */ #endif /* First, configure user controlled GPIOF interrupts */ @@ -204,7 +209,7 @@ void __init lh7a40x_init_board_irq (void) /* Then, configure CPLD interrupt */ - CPLD_INTERRUPTS = 0x0c; /* Disable all CPLD interrupts */ + CPLD_INTERRUPTS = 0x9c; /* Disable all CPLD interrupts */ GPIO_PFDD &= ~(1 << pinCPLD); /* Make input */ GPIO_INTTYPE1 |= (1 << pinCPLD); /* Edge triggered */ GPIO_INTTYPE2 &= ~(1 << pinCPLD); /* Active low */ diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig index 30bc6dff3..9fb70d5dc 100644 --- a/arch/arm/mach-omap/Kconfig +++ b/arch/arm/mach-omap/Kconfig @@ -1,27 +1,24 @@ +if ARCH_OMAP menu "TI OMAP Implementations" comment "OMAP Core Type" config ARCH_OMAP730 - depends on ARCH_OMAP bool "OMAP730 Based System" select CPU_ARM926T config ARCH_OMAP1510 - depends on ARCH_OMAP default y bool "OMAP1510 Based System" select CPU_ARM925T select CPU_DCACHE_WRITETHROUGH config ARCH_OMAP1610 - depends on ARCH_OMAP bool "OMAP1610 Based System" select CPU_ARM926T config ARCH_OMAP5912 - depends on ARCH_OMAP bool "OMAP5912 Based System" select CPU_ARM926T @@ -87,7 +84,6 @@ comment "OMAP Feature Selections" #config OMAP_BOOT_TAG # bool "OMAP bootloader information passing" -# depends on ARCH_OMAP # default n # help # Say Y, if you have a bootloader which passes information @@ -95,7 +91,6 @@ comment "OMAP Feature Selections" config OMAP_MUX bool "OMAP multiplexing support" - depends on ARCH_OMAP default y help Pin multiplexing support for OMAP boards. If your bootloader @@ -113,7 +108,6 @@ config OMAP_MUX_DEBUG choice prompt "Low-level debug console UART" - depends on ARCH_OMAP default OMAP_LL_DEBUG_UART1 config OMAP_LL_DEBUG_UART1 @@ -171,3 +165,5 @@ config OMAP_ARM_30MHZ Enable 30MHz clock for OMAP CPU. If unsure, say N. endmenu + +endif diff --git a/arch/arm/mach-omap/board-generic.c b/arch/arm/mach-omap/board-generic.c index bf739b5df..e0b09f86a 100644 --- a/arch/arm/mach-omap/board-generic.c +++ b/arch/arm/mach-omap/board-generic.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ static void __init omap_generic_map_io(void) omap_map_io(); } -MACHINE_START(OMAP_GENERIC, "Generic OMAP-1510/1610") +MACHINE_START(OMAP_GENERIC, "Generic OMAP-1510/1610/1710") MAINTAINER("Tony Lindgren ") BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) BOOT_PARAMS(0x10000100) diff --git a/arch/arm/mach-omap/board-innovator.c b/arch/arm/mach-omap/board-innovator.c index c11880123..c65f38f58 100644 --- a/arch/arm/mach-omap/board-innovator.c +++ b/arch/arm/mach-omap/board-innovator.c @@ -19,8 +19,10 @@ #include #include #include +#include #include +#include #include #include @@ -36,14 +38,14 @@ extern int omap_gpio_init(void); /* Only FPGA needs to be mapped here. All others are done with ioremap */ static struct map_desc innovator1510_io_desc[] __initdata = { -{ OMAP1510P1_FPGA_BASE, OMAP1510P1_FPGA_START, OMAP1510P1_FPGA_SIZE, +{ OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE, MT_DEVICE }, }; static struct resource innovator1510_smc91x_resources[] = { [0] = { - .start = OMAP1510P1_FPGA_ETHR_START, /* Physical */ - .end = OMAP1510P1_FPGA_ETHR_START + 16, + .start = OMAP1510_FPGA_ETHR_START, /* Physical */ + .end = OMAP1510_FPGA_ETHR_START + 16, .flags = IORESOURCE_MEM, }, [1] = { @@ -132,12 +134,13 @@ static void __init innovator_map_io(void) #ifdef CONFIG_ARCH_OMAP1510 if (cpu_is_omap1510()) { iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); + udelay(10); /* Delay needed for FPGA */ /* Dump the Innovator FPGA rev early - useful info for support. */ printk("Innovator FPGA Rev %d.%d Board Rev %d\n", - fpga_read(OMAP1510P1_FPGA_REV_HIGH), - fpga_read(OMAP1510P1_FPGA_REV_LOW), - fpga_read(OMAP1510P1_FPGA_BOARD_REV)); + fpga_read(OMAP1510_FPGA_REV_HIGH), + fpga_read(OMAP1510_FPGA_REV_LOW), + fpga_read(OMAP1510_FPGA_BOARD_REV)); } #endif #ifdef CONFIG_ARCH_OMAP1610 diff --git a/arch/arm/mach-omap/board-osk.c b/arch/arm/mach-omap/board-osk.c index 521683496..8044dd190 100644 --- a/arch/arm/mach-omap/board-osk.c +++ b/arch/arm/mach-omap/board-osk.c @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-omap/board-perseus2.c b/arch/arm/mach-omap/board-perseus2.c index 3843d6a6d..e938ea4b6 100644 --- a/arch/arm/mach-omap/board-perseus2.c +++ b/arch/arm/mach-omap/board-perseus2.c @@ -3,6 +3,9 @@ * * Modified from board-generic.c * + * Original OMAP730 support by Jean Pihet + * Updated for 2.6 by Kevin Hilman + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. @@ -13,6 +16,7 @@ #include #include +#include #include #include @@ -102,7 +106,7 @@ static void __init omap_perseus2_map_io(void) } MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") - MAINTAINER("Kevin Hilman ") + MAINTAINER("Kevin Hilman ") BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) BOOT_PARAMS(0x10000100) MAPIO(omap_perseus2_map_io) diff --git a/arch/arm/mach-omap/bus.c b/arch/arm/mach-omap/bus.c index ba5dd2a8c..07da30d52 100644 --- a/arch/arm/mach-omap/bus.c +++ b/arch/arm/mach-omap/bus.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -265,7 +266,7 @@ static void __exit omap_bus_exit(void) } } -module_init(omap_bus_init); +postcore_initcall(omap_bus_init); module_exit(omap_bus_exit); MODULE_DESCRIPTION("Virtual bus for OMAP"); diff --git a/arch/arm/mach-omap/clocks.c b/arch/arm/mach-omap/clocks.c index 382baee25..bda7c6f38 100644 --- a/arch/arm/mach-omap/clocks.c +++ b/arch/arm/mach-omap/clocks.c @@ -84,7 +84,7 @@ static ck_info_t ck_info_table[] = { }, { .name = "ck_gen1", .flags = CK_RATEF | CK_IDLEF, - .rate_reg = CK_DPLL1, + .rate_reg = DPLL_CTL, .idle_reg = ARM_IDLECT1, .idle_shift = IDLDPLL_ARM, .parent = OMAP_CLKIN, @@ -629,39 +629,39 @@ init_ck(void) omap_writew(0x1000, ARM_SYSST); #if defined(CONFIG_OMAP_ARM_30MHZ) omap_writew(0x1555, ARM_CKCTL); - omap_writew(0x2290, DPLL_CTL_REG); + omap_writew(0x2290, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_60MHZ) omap_writew(0x1005, ARM_CKCTL); - omap_writew(0x2290, DPLL_CTL_REG); + omap_writew(0x2290, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_96MHZ) omap_writew(0x1005, ARM_CKCTL); - omap_writew(0x2410, DPLL_CTL_REG); + omap_writew(0x2410, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_120MHZ) omap_writew(0x110a, ARM_CKCTL); - omap_writew(0x2510, DPLL_CTL_REG); + omap_writew(0x2510, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_168MHZ) omap_writew(0x110f, ARM_CKCTL); - omap_writew(0x2710, DPLL_CTL_REG); + omap_writew(0x2710, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_182MHZ) && defined(CONFIG_ARCH_OMAP730) omap_writew(0x250E, ARM_CKCTL); - omap_writew(0x2710, DPLL_CTL_REG); + omap_writew(0x2710, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_192MHZ) && (defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912)) omap_writew(0x150f, ARM_CKCTL); if (crystal_type == 2) { source_clock = 13; /* MHz */ - omap_writew(0x2510, DPLL_CTL_REG); + omap_writew(0x2510, DPLL_CTL); } else - omap_writew(0x2810, DPLL_CTL_REG); + omap_writew(0x2810, DPLL_CTL); #elif defined(CONFIG_OMAP_ARM_195MHZ) && defined(CONFIG_ARCH_OMAP730) omap_writew(0x250E, ARM_CKCTL); - omap_writew(0x2790, DPLL_CTL_REG); + omap_writew(0x2790, DPLL_CTL); #else #error "OMAP MHZ not set, please run make xconfig" #endif #ifdef CONFIG_MACH_OMAP_PERSEUS2 /* Select slicer output as OMAP input clock */ - omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL_REG) & ~0x1, OMAP730_PCC_UPLD_CTRL_REG); + omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL); #endif /* Turn off some other junk the bootloader might have turned on */ diff --git a/arch/arm/mach-omap/common.c b/arch/arm/mach-omap/common.c index 2ff74d1a4..43aaa1c6c 100644 --- a/arch/arm/mach-omap/common.c +++ b/arch/arm/mach-omap/common.c @@ -23,6 +23,58 @@ #include #include +/* + * ---------------------------------------------------------------------------- + * OMAP revision check + * + * Since we use the cpu_is_omapnnnn() macros, there's a chance that a board + * switches to an updated core. We want to print out the OMAP revision early. + * + * We use the system_serial registers for the revision information so we + * can see it in /proc/cpuinfo. + * + * If the OMAP detection gets more complicated, we may want to expand this + * to store the OMAP version and replace the current cpu_is_omapnnnn() macros. + * + * ---------------------------------------------------------------------------- + */ +static void __init omap_check_revision(void) +{ + system_serial_high = omap_readl(OMAP_ID_BASE); + system_serial_low = OMAP_ID_REG; + system_rev = (OMAP_ID_REG >> ID_SHIFT) & ID_MASK; + + printk("OMAP revision: %d.%d (0x%08x) id: 0x%08x detected as OMAP-", + (system_serial_high >> 20) & 0xf, + (system_serial_high >> 16) & 0xf, + system_serial_high, system_serial_low); + + switch (system_rev) { + case OMAP_ID_730: + printk("730\n"); + system_rev = 0x730; + break; + case OMAP_ID_1510: + printk("1510\n"); + system_rev = 0x1510; + break; + case OMAP_ID_1610: + printk("1610\n"); + system_rev = 0x1610; + break; + case OMAP_ID_1710: + printk("1710\n"); + system_rev = 0x1710; + break; + case OMAP_ID_5912: + printk("5912/1611B\n"); + system_rev = 0x5912; + break; + default: + printk("unknown, please add support!\n"); + } +} + /* * ---------------------------------------------------------------------------- * OMAP I/O mapping @@ -64,7 +116,13 @@ static struct map_desc omap1610_io_desc[] __initdata = { static struct map_desc omap5912_io_desc[] __initdata = { { OMAP5912_DSP_BASE, OMAP5912_DSP_START, OMAP5912_DSP_SIZE, MT_DEVICE }, { OMAP5912_DSPREG_BASE, OMAP5912_DSPREG_START, OMAP5912_DSPREG_SIZE, MT_DEVICE }, - { OMAP5912_SRAM_BASE, OMAP5912_SRAM_START, OMAP5912_SRAM_SIZE, MT_DEVICE } +/* + * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page + * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped. + * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte + * can be used. + */ + { OMAP5912_SRAM_BASE, OMAP5912_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE } }; #endif @@ -77,6 +135,7 @@ static void __init _omap_map_io(void) /* We have to initialize the IO space mapping before we can run * cpu_is_omapxxx() macros. */ iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); + omap_check_revision(); #ifdef CONFIG_ARCH_OMAP730 if (cpu_is_omap730()) { @@ -102,8 +161,8 @@ static void __init _omap_map_io(void) /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort * on a Posted Write in the TIPB Bridge". */ - omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL_REG); - omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL_REG); + omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL); + omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL); /* Must init clocks early to assure that timer interrupt works */ diff --git a/arch/arm/mach-omap/dma.c b/arch/arm/mach-omap/dma.c index 29c62e141..385b4d1cc 100644 --- a/arch/arm/mach-omap/dma.c +++ b/arch/arm/mach-omap/dma.c @@ -92,45 +92,124 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, { u16 w; - w = omap_readw(OMAP_DMA_CSDP_REG(lch)); + w = omap_readw(OMAP_DMA_CSDP(lch)); w &= ~0x03; w |= data_type; - omap_writew(w, OMAP_DMA_CSDP_REG(lch)); + omap_writew(w, OMAP_DMA_CSDP(lch)); - w = omap_readw(OMAP_DMA_CCR_REG(lch)); + w = omap_readw(OMAP_DMA_CCR(lch)); w &= ~(1 << 5); if (sync_mode == OMAP_DMA_SYNC_FRAME) w |= 1 << 5; - omap_writew(w, OMAP_DMA_CCR_REG(lch)); + omap_writew(w, OMAP_DMA_CCR(lch)); - w = omap_readw(OMAP_DMA_CCR2_REG(lch)); + w = omap_readw(OMAP_DMA_CCR2(lch)); w &= ~(1 << 2); if (sync_mode == OMAP_DMA_SYNC_BLOCK) w |= 1 << 2; - omap_writew(w, OMAP_DMA_CCR2_REG(lch)); + omap_writew(w, OMAP_DMA_CCR2(lch)); - omap_writew(elem_count, OMAP_DMA_CEN_REG(lch)); - omap_writew(frame_count, OMAP_DMA_CFN_REG(lch)); + omap_writew(elem_count, OMAP_DMA_CEN(lch)); + omap_writew(frame_count, OMAP_DMA_CFN(lch)); } +void omap_set_dma_constant_fill(int lch, u32 color) +{ + u16 w; + +#ifdef CONFIG_DEBUG_KERNEL + if (omap_dma_in_1510_mode) { + printk(KERN_ERR "OMAP DMA constant fill not available in 1510 mode."); + BUG(); + return; + } +#endif + w = omap_readw(OMAP_DMA_CCR2(lch)) & ~0x03; + w |= 0x01; + omap_writew(w, OMAP_DMA_CCR2(lch)); + + omap_writew((u16)color, OMAP_DMA_COLOR_L(lch)); + omap_writew((u16)(color >> 16), OMAP_DMA_COLOR_U(lch)); + + w = omap_readw(OMAP_DMA_LCH_CTRL(lch)) & ~0x0f; + w |= 1; /* Channel type G */ + omap_writew(w, OMAP_DMA_LCH_CTRL(lch)); +} + +void omap_set_dma_transparent_copy(int lch, u32 color) +{ + u16 w; + +#ifdef CONFIG_DEBUG_KERNEL + if (omap_dma_in_1510_mode) { + printk(KERN_ERR "OMAP DMA transparent copy not available in 1510 mode."); + BUG(); + } +#endif + w = omap_readw(OMAP_DMA_CCR2(lch)) & ~0x03; + w |= 0x02; + omap_writew(w, OMAP_DMA_CCR2(lch)); + + omap_writew((u16)color, OMAP_DMA_COLOR_L(lch)); + omap_writew((u16)(color >> 16), OMAP_DMA_COLOR_U(lch)); + + w = omap_readw(OMAP_DMA_LCH_CTRL(lch)) & ~0x0f; + w |= 1; /* Channel type G */ + omap_writew(w, OMAP_DMA_LCH_CTRL(lch)); +} void omap_set_dma_src_params(int lch, int src_port, int src_amode, unsigned long src_start) { u16 w; - w = omap_readw(OMAP_DMA_CSDP_REG(lch)); + w = omap_readw(OMAP_DMA_CSDP(lch)); w &= ~(0x1f << 2); w |= src_port << 2; - omap_writew(w, OMAP_DMA_CSDP_REG(lch)); + omap_writew(w, OMAP_DMA_CSDP(lch)); - w = omap_readw(OMAP_DMA_CCR_REG(lch)); + w = omap_readw(OMAP_DMA_CCR(lch)); w &= ~(0x03 << 12); w |= src_amode << 12; - omap_writew(w, OMAP_DMA_CCR_REG(lch)); + omap_writew(w, OMAP_DMA_CCR(lch)); + + omap_writew(src_start >> 16, OMAP_DMA_CSSA_U(lch)); + omap_writew(src_start, OMAP_DMA_CSSA_L(lch)); +} + +void omap_set_dma_src_index(int lch, int eidx, int fidx) +{ + omap_writew(eidx, OMAP_DMA_CSEI(lch)); + omap_writew(fidx, OMAP_DMA_CSFI(lch)); +} + +void omap_set_dma_src_data_pack(int lch, int enable) +{ + u16 w; + + w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(1 << 6); + w |= enable ? (1 << 6) : 0; + omap_writew(w, OMAP_DMA_CSDP(lch)); +} + +void omap_set_dma_src_burst_mode(int lch, int burst_mode) +{ + u16 w; - omap_writew(src_start >> 16, OMAP_DMA_CSSA_U_REG(lch)); - omap_writew(src_start, OMAP_DMA_CSSA_L_REG(lch)); + w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(0x03 << 7); + switch (burst_mode) { + case OMAP_DMA_DATA_BURST_4: + w |= (0x01 << 7); + break; + case OMAP_DMA_DATA_BURST_8: + w |= (0x03 << 7); + break; + default: + printk(KERN_ERR "Invalid DMA burst mode\n"); + BUG(); + return; + } + omap_writew(w, OMAP_DMA_CSDP(lch)); } void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, @@ -138,18 +217,53 @@ void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, { u16 w; - w = omap_readw(OMAP_DMA_CSDP_REG(lch)); + w = omap_readw(OMAP_DMA_CSDP(lch)); w &= ~(0x1f << 9); w |= dest_port << 9; - omap_writew(w, OMAP_DMA_CSDP_REG(lch)); + omap_writew(w, OMAP_DMA_CSDP(lch)); - w = omap_readw(OMAP_DMA_CCR_REG(lch)); + w = omap_readw(OMAP_DMA_CCR(lch)); w &= ~(0x03 << 14); w |= dest_amode << 14; - omap_writew(w, OMAP_DMA_CCR_REG(lch)); + omap_writew(w, OMAP_DMA_CCR(lch)); + + omap_writew(dest_start >> 16, OMAP_DMA_CDSA_U(lch)); + omap_writew(dest_start, OMAP_DMA_CDSA_L(lch)); +} + +void omap_set_dma_dest_index(int lch, int eidx, int fidx) +{ + omap_writew(eidx, OMAP_DMA_CDEI(lch)); + omap_writew(fidx, OMAP_DMA_CDFI(lch)); +} + +void omap_set_dma_dest_data_pack(int lch, int enable) +{ + u16 w; - omap_writew(dest_start >> 16, OMAP_DMA_CDSA_U_REG(lch)); - omap_writew(dest_start, OMAP_DMA_CDSA_L_REG(lch)); + w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(1 << 13); + w |= enable ? (1 << 13) : 0; + omap_writew(w, OMAP_DMA_CSDP(lch)); +} + +void omap_set_dma_dest_burst_mode(int lch, int burst_mode) +{ + u16 w; + + w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(0x03 << 14); + switch (burst_mode) { + case OMAP_DMA_DATA_BURST_4: + w |= (0x01 << 14); + break; + case OMAP_DMA_DATA_BURST_8: + w |= (0x03 << 14); + break; + default: + printk(KERN_ERR "Invalid DMA burst mode\n"); + BUG(); + return; + } + omap_writew(w, OMAP_DMA_CSDP(lch)); } void omap_start_dma(int lch) @@ -164,38 +278,38 @@ void omap_start_dma(int lch) /* Enable the queue, if needed so. */ if (next_lch != -1) { /* Clear the STOP_LNK bits */ - w = omap_readw(OMAP_DMA_CLNK_CTRL_REG(lch)); + w = omap_readw(OMAP_DMA_CLNK_CTRL(lch)); w &= ~(1 << 14); - omap_writew(w, OMAP_DMA_CLNK_CTRL_REG(lch)); - w = omap_readw(OMAP_DMA_CLNK_CTRL_REG(next_lch)); + omap_writew(w, OMAP_DMA_CLNK_CTRL(lch)); + w = omap_readw(OMAP_DMA_CLNK_CTRL(next_lch)); w &= ~(1 << 14); - omap_writew(w, OMAP_DMA_CLNK_CTRL_REG(next_lch)); + omap_writew(w, OMAP_DMA_CLNK_CTRL(next_lch)); /* And set the ENABLE_LNK bits */ omap_writew(next_lch | (1 << 15), - OMAP_DMA_CLNK_CTRL_REG(lch)); + OMAP_DMA_CLNK_CTRL(lch)); /* The loop case */ if (dma_chan[next_lch].next_lch == lch) omap_writew(lch | (1 << 15), - OMAP_DMA_CLNK_CTRL_REG(next_lch)); + OMAP_DMA_CLNK_CTRL(next_lch)); /* Read CSR to make sure it's cleared. */ - w = omap_readw(OMAP_DMA_CSR_REG(next_lch)); + w = omap_readw(OMAP_DMA_CSR(next_lch)); /* Enable some nice interrupts. */ omap_writew(dma_chan[next_lch].enabled_irqs, - OMAP_DMA_CICR_REG(next_lch)); + OMAP_DMA_CICR(next_lch)); dma_chan[next_lch].flags |= OMAP_DMA_ACTIVE; } } /* Read CSR to make sure it's cleared. */ - w = omap_readw(OMAP_DMA_CSR_REG(lch)); + w = omap_readw(OMAP_DMA_CSR(lch)); /* Enable some nice interrupts. */ - omap_writew(dma_chan[lch].enabled_irqs, OMAP_DMA_CICR_REG(lch)); + omap_writew(dma_chan[lch].enabled_irqs, OMAP_DMA_CICR(lch)); - w = omap_readw(OMAP_DMA_CCR_REG(lch)); + w = omap_readw(OMAP_DMA_CCR(lch)); w |= OMAP_DMA_CCR_EN; - omap_writew(w, OMAP_DMA_CCR_REG(lch)); + omap_writew(w, OMAP_DMA_CCR(lch)); dma_chan[lch].flags |= OMAP_DMA_ACTIVE; } @@ -205,12 +319,12 @@ void omap_stop_dma(int lch) int next_lch; /* Disable all interrupts on the channel */ - omap_writew(0, OMAP_DMA_CICR_REG(lch)); + omap_writew(0, OMAP_DMA_CICR(lch)); if (omap_dma_in_1510_mode()) { - w = omap_readw(OMAP_DMA_CCR_REG(lch)); + w = omap_readw(OMAP_DMA_CCR(lch)); w &= ~OMAP_DMA_CCR_EN; - omap_writew(w, OMAP_DMA_CCR_REG(lch)); + omap_writew(w, OMAP_DMA_CCR(lch)); dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; return; } @@ -221,16 +335,16 @@ void omap_stop_dma(int lch) * According to thw HW spec, enabling the STOP_LNK bit * resets the CCR_EN bit at the same time. */ - w = omap_readw(OMAP_DMA_CLNK_CTRL_REG(lch)); + w = omap_readw(OMAP_DMA_CLNK_CTRL(lch)); w |= (1 << 14); - w = omap_writew(w, OMAP_DMA_CLNK_CTRL_REG(lch)); + w = omap_writew(w, OMAP_DMA_CLNK_CTRL(lch)); dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; if (next_lch != -1) { - omap_writew(0, OMAP_DMA_CICR_REG(next_lch)); - w = omap_readw(OMAP_DMA_CLNK_CTRL_REG(next_lch)); + omap_writew(0, OMAP_DMA_CICR(next_lch)); + w = omap_readw(OMAP_DMA_CLNK_CTRL(next_lch)); w |= (1 << 14); - w = omap_writew(w, OMAP_DMA_CLNK_CTRL_REG(next_lch)); + w = omap_writew(w, OMAP_DMA_CLNK_CTRL(next_lch)); dma_chan[next_lch].flags &= ~OMAP_DMA_ACTIVE; } } @@ -253,7 +367,7 @@ static int dma_handle_ch(int ch) csr = dma_chan[ch].saved_csr; dma_chan[ch].saved_csr = 0; } else - csr = omap_readw(OMAP_DMA_CSR_REG(ch)); + csr = omap_readw(OMAP_DMA_CSR(ch)); if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) { dma_chan[ch + 6].saved_csr = csr >> 7; csr &= 0x7f; @@ -339,9 +453,9 @@ int omap_request_dma(int dev_id, const char *dev_name, } /* Disable the 1510 compatibility mode and set the sync device * id. */ - omap_writew(dev_id | (1 << 10), OMAP_DMA_CCR_REG(free_ch)); + omap_writew(dev_id | (1 << 10), OMAP_DMA_CCR(free_ch)); } else { - omap_writew(dev_id, OMAP_DMA_CCR_REG(free_ch)); + omap_writew(dev_id, OMAP_DMA_CCR(free_ch)); } *dma_ch_out = free_ch; @@ -362,9 +476,9 @@ void omap_free_dma(int ch) spin_unlock_irqrestore(&dma_chan_lock, flags); /* Disable all DMA interrupts for the channel. */ - omap_writew(0, OMAP_DMA_CICR_REG(ch)); + omap_writew(0, OMAP_DMA_CICR(ch)); /* Make sure the DMA transfer is stopped. */ - omap_writew(0, OMAP_DMA_CCR_REG(ch)); + omap_writew(0, OMAP_DMA_CCR(ch)); } int omap_dma_in_1510_mode(void) @@ -601,19 +715,19 @@ static int __init omap_init_dma(void) enable_1510_mode = 1; } else if (cpu_is_omap1610() || cpu_is_omap5912()) { printk(KERN_INFO "OMAP DMA hardware version %d\n", - omap_readw(OMAP_DMA_HW_ID_REG)); + omap_readw(OMAP_DMA_HW_ID)); printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n", - (omap_readw(OMAP_DMA_CAPS_0_U_REG) << 16) | omap_readw(OMAP_DMA_CAPS_0_L_REG), - (omap_readw(OMAP_DMA_CAPS_1_U_REG) << 16) | omap_readw(OMAP_DMA_CAPS_1_L_REG), - omap_readw(OMAP_DMA_CAPS_2_REG), omap_readw(OMAP_DMA_CAPS_3_REG), - omap_readw(OMAP_DMA_CAPS_4_REG)); + (omap_readw(OMAP_DMA_CAPS_0_U) << 16) | omap_readw(OMAP_DMA_CAPS_0_L), + (omap_readw(OMAP_DMA_CAPS_1_U) << 16) | omap_readw(OMAP_DMA_CAPS_1_L), + omap_readw(OMAP_DMA_CAPS_2), omap_readw(OMAP_DMA_CAPS_3), + omap_readw(OMAP_DMA_CAPS_4)); if (!enable_1510_mode) { u16 w; /* Disable OMAP 3.0/3.1 compatibility mode. */ - w = omap_readw(OMAP_DMA_GSCR_REG); + w = omap_readw(OMAP_DMA_GSCR); w |= 1 << 3; - omap_writew(w, OMAP_DMA_GSCR_REG); + omap_writew(w, OMAP_DMA_GSCR); dma_chan_count = OMAP_LOGICAL_DMA_CH_COUNT; } else dma_chan_count = 9; @@ -657,9 +771,21 @@ EXPORT_SYMBOL(omap_request_dma); EXPORT_SYMBOL(omap_free_dma); EXPORT_SYMBOL(omap_start_dma); EXPORT_SYMBOL(omap_stop_dma); + EXPORT_SYMBOL(omap_set_dma_transfer_params); +EXPORT_SYMBOL(omap_set_dma_constant_fill); +EXPORT_SYMBOL(omap_set_dma_transparent_copy); + EXPORT_SYMBOL(omap_set_dma_src_params); +EXPORT_SYMBOL(omap_set_dma_src_index); +EXPORT_SYMBOL(omap_set_dma_src_data_pack); +EXPORT_SYMBOL(omap_set_dma_src_burst_mode); + EXPORT_SYMBOL(omap_set_dma_dest_params); +EXPORT_SYMBOL(omap_set_dma_dest_index); +EXPORT_SYMBOL(omap_set_dma_dest_data_pack); +EXPORT_SYMBOL(omap_set_dma_dest_burst_mode); + EXPORT_SYMBOL(omap_dma_link_lch); EXPORT_SYMBOL(omap_dma_unlink_lch); diff --git a/arch/arm/mach-omap/fpga.c b/arch/arm/mach-omap/fpga.c index 95b21e2f4..d9246b1dc 100644 --- a/arch/arm/mach-omap/fpga.c +++ b/arch/arm/mach-omap/fpga.c @@ -46,11 +46,11 @@ static void fpga_mask_irq(unsigned int irq) irq -= IH_FPGA_BASE; if (irq < 8) - __raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_LO) - & ~(1 << irq)), OMAP1510P1_FPGA_IMR_LO); + __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) + & ~(1 << irq)), OMAP1510_FPGA_IMR_LO); else if (irq < 16) - __raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_HI) - & ~(1 << (irq - 8))), OMAP1510P1_FPGA_IMR_HI); + __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_HI) + & ~(1 << (irq - 8))), OMAP1510_FPGA_IMR_HI); else __raw_writeb((__raw_readb(INNOVATOR_FPGA_IMR2) & ~(1 << (irq - 16))), INNOVATOR_FPGA_IMR2); @@ -60,10 +60,10 @@ static void fpga_mask_irq(unsigned int irq) static inline u32 get_fpga_unmasked_irqs(void) { return - ((__raw_readb(OMAP1510P1_FPGA_ISR_LO) & - __raw_readb(OMAP1510P1_FPGA_IMR_LO))) | - ((__raw_readb(OMAP1510P1_FPGA_ISR_HI) & - __raw_readb(OMAP1510P1_FPGA_IMR_HI)) << 8) | + ((__raw_readb(OMAP1510_FPGA_ISR_LO) & + __raw_readb(OMAP1510_FPGA_IMR_LO))) | + ((__raw_readb(OMAP1510_FPGA_ISR_HI) & + __raw_readb(OMAP1510_FPGA_IMR_HI)) << 8) | ((__raw_readb(INNOVATOR_FPGA_ISR2) & __raw_readb(INNOVATOR_FPGA_IMR2)) << 16); } @@ -79,11 +79,11 @@ static void fpga_unmask_irq(unsigned int irq) irq -= IH_FPGA_BASE; if (irq < 8) - __raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_LO) | (1 << irq)), - OMAP1510P1_FPGA_IMR_LO); + __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)), + OMAP1510_FPGA_IMR_LO); else if (irq < 16) - __raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_HI) - | (1 << (irq - 8))), OMAP1510P1_FPGA_IMR_HI); + __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_HI) + | (1 << (irq - 8))), OMAP1510_FPGA_IMR_HI); else __raw_writeb((__raw_readb(INNOVATOR_FPGA_IMR2) | (1 << (irq - 16))), INNOVATOR_FPGA_IMR2); @@ -166,8 +166,8 @@ void fpga_init_irq(void) { int i; - __raw_writeb(0, OMAP1510P1_FPGA_IMR_LO); - __raw_writeb(0, OMAP1510P1_FPGA_IMR_HI); + __raw_writeb(0, OMAP1510_FPGA_IMR_LO); + __raw_writeb(0, OMAP1510_FPGA_IMR_HI); __raw_writeb(0, INNOVATOR_FPGA_IMR2); for (i = IH_FPGA_BASE; i < (IH_FPGA_BASE + NR_FPGA_IRQS); i++) { diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c index fce61a1b5..2f052a959 100644 --- a/arch/arm/mach-omap/gpio.c +++ b/arch/arm/mach-omap/gpio.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -79,7 +78,7 @@ #define OMAP730_GPIO_INT_MASK 0x10 #define OMAP730_GPIO_INT_STATUS 0x14 -#define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff) +#define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff) struct gpio_bank { u32 base; @@ -213,12 +212,12 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) reg += OMAP730_GPIO_DIR_CONTROL; break; } - l = omap_readl(reg); + l = __raw_readl(reg); if (is_input) l |= 1 << gpio; else l &= ~(1 << gpio); - omap_writel(l, reg); + __raw_writel(l, reg); } void omap_set_gpio_direction(int gpio, int is_input) @@ -240,8 +239,8 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) switch (bank->method) { case METHOD_MPUIO: - reg += OMAP_MPUIO_OUTPUT_REG; - l = omap_readl(reg); + reg += OMAP_MPUIO_OUTPUT; + l = __raw_readl(reg); if (enable) l |= 1 << gpio; else @@ -249,7 +248,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) break; case METHOD_GPIO_1510: reg += OMAP1510_GPIO_DATA_OUTPUT; - l = omap_readl(reg); + l = __raw_readl(reg); if (enable) l |= 1 << gpio; else @@ -264,7 +263,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) break; case METHOD_GPIO_730: reg += OMAP730_GPIO_DATA_OUTPUT; - l = omap_readl(reg); + l = __raw_readl(reg); if (enable) l |= 1 << gpio; else @@ -274,7 +273,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) BUG(); return; } - omap_writel(l, reg); + __raw_writel(l, reg); } void omap_set_gpio_dataout(int gpio, int enable) @@ -312,7 +311,7 @@ int omap_get_gpio_datain(int gpio) BUG(); return -1; } - return (omap_readl(reg) & (1 << get_gpio_index(gpio))) != 0; + return (__raw_readl(reg) & (1 << get_gpio_index(gpio))) != 0; } static void _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) @@ -322,22 +321,22 @@ static void _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) switch (bank->method) { case METHOD_MPUIO: - reg += OMAP_MPUIO_GPIO_INT_EDGE_REG; - l = omap_readl(reg); + reg += OMAP_MPUIO_GPIO_INT_EDGE; + l = __raw_readl(reg); if (edge == OMAP_GPIO_RISING_EDGE) l |= 1 << gpio; else l &= ~(1 << gpio); - omap_writel(l, reg); + __raw_writel(l, reg); break; case METHOD_GPIO_1510: reg += OMAP1510_GPIO_INT_CONTROL; - l = omap_readl(reg); + l = __raw_readl(reg); if (edge == OMAP_GPIO_RISING_EDGE) l |= 1 << gpio; else l &= ~(1 << gpio); - omap_writel(l, reg); + __raw_writel(l, reg); break; case METHOD_GPIO_1610: edge &= 0x03; @@ -346,19 +345,19 @@ static void _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) else reg += OMAP1610_GPIO_EDGE_CTRL1; gpio &= 0x07; - l = omap_readl(reg); + l = __raw_readl(reg); l &= ~(3 << (gpio << 1)); l |= edge << (gpio << 1); - omap_writel(l, reg); + __raw_writel(l, reg); break; case METHOD_GPIO_730: reg += OMAP730_GPIO_INT_CONTROL; - l = omap_readl(reg); + l = __raw_readl(reg); if (edge == OMAP_GPIO_RISING_EDGE) l |= 1 << gpio; else l &= ~(1 << gpio); - omap_writel(l, reg); + __raw_writel(l, reg); break; default: BUG(); @@ -385,11 +384,11 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio) switch (bank->method) { case METHOD_MPUIO: - l = omap_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE_REG); + l = __raw_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE); return (l & (1 << gpio)) ? OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; case METHOD_GPIO_1510: - l = omap_readl(reg + OMAP1510_GPIO_INT_CONTROL); + l = __raw_readl(reg + OMAP1510_GPIO_INT_CONTROL); return (l & (1 << gpio)) ? OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; case METHOD_GPIO_1610: @@ -397,9 +396,9 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio) reg += OMAP1610_GPIO_EDGE_CTRL2; else reg += OMAP1610_GPIO_EDGE_CTRL1; - return (omap_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03; + return (__raw_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03; case METHOD_GPIO_730: - l = omap_readl(reg + OMAP730_GPIO_INT_CONTROL); + l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL); return (l & (1 << gpio)) ? OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE; default: @@ -430,7 +429,7 @@ static void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio) BUG(); return; } - omap_writel(1 << get_gpio_index(gpio), reg); + __raw_writel(1 << get_gpio_index(gpio), reg); } static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) @@ -441,7 +440,7 @@ static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) switch (bank->method) { case METHOD_MPUIO: reg += OMAP_MPUIO_GPIO_MASKIT; - l = omap_readl(reg); + l = __raw_readl(reg); if (enable) l &= ~(1 << gpio); else @@ -449,7 +448,7 @@ static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) break; case METHOD_GPIO_1510: reg += OMAP1510_GPIO_INT_MASK; - l = omap_readl(reg); + l = __raw_readl(reg); if (enable) l &= ~(1 << gpio); else @@ -465,7 +464,7 @@ static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) break; case METHOD_GPIO_730: reg += OMAP730_GPIO_INT_MASK; - l = omap_readl(reg); + l = __raw_readl(reg); if (enable) l &= ~(1 << gpio); else @@ -475,7 +474,7 @@ static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) BUG(); return; } - omap_writel(l, reg); + __raw_writel(l, reg); } int omap_request_gpio(int gpio) @@ -500,7 +499,7 @@ int omap_request_gpio(int gpio) /* Claim the pin for the ARM */ reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; - omap_writel(omap_readl(reg) | (1 << get_gpio_index(gpio)), reg); + __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg); } #endif spin_unlock(&bank->lock); @@ -564,7 +563,7 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc, isr_reg = bank->base + OMAP730_GPIO_INT_STATUS; #endif for (;;) { - u32 isr = omap_readl(isr_reg); + u32 isr = __raw_readl(isr_reg); unsigned int gpio_irq; if (!isr) @@ -587,15 +586,15 @@ static void gpio_ack_irq(unsigned int irq) #ifdef CONFIG_ARCH_OMAP1510 if (bank->method == METHOD_GPIO_1510) - omap_writew(1 << (gpio & 0x0f), bank->base + OMAP1510_GPIO_INT_STATUS); + __raw_writew(1 << (gpio & 0x0f), bank->base + OMAP1510_GPIO_INT_STATUS); #endif #if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912) if (bank->method == METHOD_GPIO_1610) - omap_writew(1 << (gpio & 0x0f), bank->base + OMAP1610_GPIO_IRQSTATUS1); + __raw_writew(1 << (gpio & 0x0f), bank->base + OMAP1610_GPIO_IRQSTATUS1); #endif #ifdef CONFIG_ARCH_OMAP730 if (bank->method == METHOD_GPIO_730) - omap_writel(1 << (gpio & 0x1f), bank->base + OMAP730_GPIO_INT_STATUS); + __raw_writel(1 << (gpio & 0x1f), bank->base + OMAP730_GPIO_INT_STATUS); #endif } @@ -692,26 +691,27 @@ static int __init _omap_gpio_init(void) bank = &gpio_bank[i]; bank->reserved_map = 0; + bank->base = IO_ADDRESS(bank->base); spin_lock_init(&bank->lock); if (bank->method == METHOD_MPUIO) { omap_writew(0xFFFF, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_MASKIT); } #ifdef CONFIG_ARCH_OMAP1510 if (bank->method == METHOD_GPIO_1510) { - omap_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK); - omap_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS); + __raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK); + __raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS); } #endif #if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912) if (bank->method == METHOD_GPIO_1610) { - omap_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1); - omap_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); + __raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1); + __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); } #endif #ifdef CONFIG_ARCH_OMAP730 if (bank->method == METHOD_GPIO_730) { - omap_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK); - omap_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS); + __raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK); + __raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS); gpio_count = 32; /* 730 has 32-bit GPIOs */ } @@ -730,9 +730,9 @@ static int __init _omap_gpio_init(void) } /* Enable system clock for GPIO module. - * The CAM_CLK_CTRL_REG *is* really the right place. */ + * The CAM_CLK_CTRL *is* really the right place. */ if (cpu_is_omap1610()) - omap_writel(omap_readl(ULPD_CAM_CLK_CTRL_REG) | 0x04, ULPD_CAM_CLK_CTRL_REG); + omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL); return 0; } @@ -748,8 +748,11 @@ int omap_gpio_init(void) return 0; } -EXPORT_SYMBOL(omap_gpio_init); EXPORT_SYMBOL(omap_request_gpio); EXPORT_SYMBOL(omap_free_gpio); +EXPORT_SYMBOL(omap_set_gpio_direction); +EXPORT_SYMBOL(omap_set_gpio_dataout); +EXPORT_SYMBOL(omap_get_gpio_datain); +EXPORT_SYMBOL(omap_set_gpio_edge_ctrl); arch_initcall(omap_gpio_init); diff --git a/arch/arm/mach-omap/irq.c b/arch/arm/mach-omap/irq.c index 3c7cefcbd..18da117f6 100644 --- a/arch/arm/mach-omap/irq.c +++ b/arch/arm/mach-omap/irq.c @@ -74,9 +74,9 @@ static inline void irq_bank_writel(unsigned long value, int bank, int offset) static void omap_ack_irq(unsigned int irq) { if (irq > 31) - omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG); + omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET); - omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG); + omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET); } static void omap_mask_irq(unsigned int irq) @@ -84,9 +84,9 @@ static void omap_mask_irq(unsigned int irq) int bank = IRQ_BANK(irq); u32 l; - l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR); + l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); l |= 1 << IRQ_BIT(irq); - omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR); + omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); } static void omap_unmask_irq(unsigned int irq) @@ -94,9 +94,9 @@ static void omap_unmask_irq(unsigned int irq) int bank = IRQ_BANK(irq); u32 l; - l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR); + l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); l &= ~(1 << IRQ_BIT(irq)); - omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR); + omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); } static void omap_mask_ack_irq(unsigned int irq) @@ -121,7 +121,7 @@ static void omap_irq_set_cfg(int irq, int fiq, int priority, int trigger) /* FIQ is only available on bank 0 interrupts */ fiq = bank ? 0 : (fiq & 0x1); val = fiq | ((priority & 0x1f) << 2) | ((trigger & 0x1) << 1); - offset = IRQ_ILR0 + IRQ_BIT(irq) * 0x4; + offset = IRQ_ILR0_REG_OFFSET + IRQ_BIT(irq) * 0x4; irq_bank_writel(val, bank, offset); } @@ -182,13 +182,13 @@ void __init omap_init_irq(void) /* Mask and clear all interrupts */ for (i = 0; i < irq_bank_count; i++) { - irq_bank_writel(~0x0, i, IRQ_MIR); - irq_bank_writel(0x0, i, IRQ_ITR); + irq_bank_writel(~0x0, i, IRQ_MIR_REG_OFFSET); + irq_bank_writel(0x0, i, IRQ_ITR_REG_OFFSET); } /* Clear any pending interrupts */ - irq_bank_writel(0x03, 0, IRQ_CONTROL_REG); - irq_bank_writel(0x03, 1, IRQ_CONTROL_REG); + irq_bank_writel(0x03, 0, IRQ_CONTROL_REG_OFFSET); + irq_bank_writel(0x03, 1, IRQ_CONTROL_REG_OFFSET); /* Install the interrupt handlers for each bank */ for (i = 0; i < irq_bank_count; i++) { diff --git a/arch/arm/mach-omap/ocpi.c b/arch/arm/mach-omap/ocpi.c index e7087bc24..944c29418 100644 --- a/arch/arm/mach-omap/ocpi.c +++ b/arch/arm/mach-omap/ocpi.c @@ -85,14 +85,6 @@ int ocpi_enable(void) val &= ~0xff; omap_writel(val, OCPI_SEC); - val = omap_readl(OCPI_SEC); - val |= 0; - omap_writel(val, OCPI_SEC); - - val = omap_readl(OCPI_SINT0); - val |= 0; - omap_writel(val, OCPI_SINT1); - return 0; } EXPORT_SYMBOL(ocpi_enable); diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index a9648c82f..d394f6957 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig @@ -1,9 +1,9 @@ +if ARCH_PXA menu "Intel PXA2xx Implementations" choice prompt "Select target board" - depends on ARCH_PXA config ARCH_LUBBOCK bool "Intel DBPXA250 Development Platform" @@ -32,3 +32,4 @@ config PXA27x help Select code specific to PXA27x variants +endif diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 5e6468a5a..706858ea2 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c @@ -27,6 +27,8 @@ #include #include +#include + #include "generic.h" #ifndef PXA_IDP_REV02 diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c index 8f9d2c3c7..adb108c6c 100644 --- a/arch/arm/mach-pxa/leds-idp.c +++ b/arch/arm/mach-pxa/leds-idp.c @@ -19,6 +19,8 @@ #include #include +#include + #include "leds.h" #define LED_STATE_ENABLED 1 diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c index 6d1de79ab..0e083b34e 100644 --- a/arch/arm/mach-pxa/leds-lubbock.c +++ b/arch/arm/mach-pxa/leds-lubbock.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "leds.h" diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c index cb6f6ddb0..8403f6780 100644 --- a/arch/arm/mach-pxa/leds-mainstone.c +++ b/arch/arm/mach-pxa/leds-mainstone.c @@ -17,6 +17,8 @@ #include #include +#include + #include "leds.h" diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index da026d437..023c5e9f3 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index cd7da1ddf..663c1eef8 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -30,6 +30,8 @@ #include #include +#include + #include "generic.h" diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index de6b7e257..245e25b08 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c @@ -19,6 +19,7 @@ #include #include #include +#include /* diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index 2eff1396a..b71f89e11 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig @@ -1,8 +1,9 @@ +if ARCH_S3C2410 + menu "S3C2410 Implementations" config ARCH_BAST bool "Simtec Electronics BAST (EB2410ITX)" - depends on ARCH_S3C2410 help Say Y here if you are using the Simtec Electronics EB2410ITX development board (also known as BAST) @@ -11,22 +12,21 @@ config ARCH_BAST config ARCH_H1940 bool "IPAQ H1940" - depends on ARCH_S3C2410 help Say Y here if you are using the HP IPAQ H1940 . config ARCH_SMDK2410 bool "SMDK2410/A9M2410" - depends on ARCH_S3C2410 help Say Y here if you are using the SMDK2410 or the derived module A9M2410 config MACH_VR1000 bool "Simtec VR1000" - depends on ARCH_S3C2410 help Say Y here if you are using the Simtec VR1000 board. endmenu + +endif diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig index 6d9249bfc..ce21b9838 100644 --- a/arch/arm/mach-sa1100/Kconfig +++ b/arch/arm/mach-sa1100/Kconfig @@ -1,9 +1,9 @@ +if ARCH_SA1100 menu "SA11x0 Implementations" config SA1100_ASSABET bool "Assabet" - depends on ARCH_SA1100 help Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 Microprocessor Development Board (also known as the Assabet). @@ -18,7 +18,6 @@ config ASSABET_NEPONSET config SA1100_ADSBITSY bool "ADS Bitsy" - depends on ARCH_SA1100 help Say Y here if you are using Applied Data Systems Intel(R) StrongARM(R) 1110 based Bitsy, 3 x 5 inches in size, Compaq - IPAQ - @@ -28,14 +27,12 @@ config SA1100_ADSBITSY config SA1100_BRUTUS bool "Brutus" - depends on ARCH_SA1100 help Say Y here if you are using the Intel(R) StrongARM(R) SA-1100 Microprocessor Development Board (also known as the Brutus). config SA1100_CERF bool "CerfBoard" - depends on ARCH_SA1100 help The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued). More information is available at: @@ -62,7 +59,6 @@ endchoice config SA1100_H3100 bool "Compaq iPAQ H3100" - depends on ARCH_SA1100 help Say Y here if you intend to run this kernel on the Compaq iPAQ H3100 handheld computer. Information about this machine and the @@ -73,7 +69,6 @@ config SA1100_H3100 config SA1100_H3600 bool "Compaq iPAQ H3600/H3700" - depends on ARCH_SA1100 help Say Y here if you intend to run this kernel on the Compaq iPAQ H3600 handheld computer. Information about this machine and the @@ -84,7 +79,6 @@ config SA1100_H3600 config SA1100_H3800 bool "Compaq iPAQ H3800" - depends on ARCH_SA1100 help Say Y here if you intend to run this kernel on the Compaq iPAQ H3800 series handheld computer. Information about this machine and the @@ -102,7 +96,6 @@ config SA1100_H3XXX #dep_bool ' Empeg' CONFIG_SA1100_EMPEG $CONFIG_ARCH_SA1100 config SA1100_EXTENEX1 bool "Extenex HandHeld Theater (Squashtail)" - depends on ARCH_SA1100 config SA1100_EXTENEX1_16MB bool "Support 16 MB of DRAM (not just 8)" @@ -110,7 +103,6 @@ config SA1100_EXTENEX1_16MB config SA1100_FLEXANET bool "FlexaNet" - depends on ARCH_SA1100 help Say Y here if you intend to run this kernel on the FlexaNet handheld instruments. Information about this machine can be @@ -118,14 +110,12 @@ config SA1100_FLEXANET config SA1100_FREEBIRD bool "FreeBird-v1.1" - depends on ARCH_SA1100 help Support the FreeBird board used in Coventive embedded products. See Documentation/arm/SA1100/Freebird for more. config SA1100_GRAPHICSCLIENT bool "GraphicsClient Plus" - depends on ARCH_SA1100 help Say Y here if you are using an Applied Data Systems Intel(R) StrongARM(R) SA-1100 based Graphics Client SBC. See @@ -133,7 +123,6 @@ config SA1100_GRAPHICSCLIENT config SA1100_GRAPHICSMASTER bool "GraphicsMaster" - depends on ARCH_SA1100 help Say Y here if you are using an Applied Data Systems Intel(R) StrongARM(R) SA-1100 based Graphics Master SBC with SA-1111 @@ -143,14 +132,12 @@ config SA1100_GRAPHICSMASTER config SA1100_BADGE4 bool "HP Labs BadgePAD 4" - depends on ARCH_SA1100 help Say Y here if you want to build a kernel for the HP Laboratories BadgePAD 4. config SA1100_JORNADA720 bool "HP Jornada 720" - depends on ARCH_SA1100 help Say Y here if you want to build a kernel for the HP Jornada 720 handheld computer. See @@ -158,14 +145,12 @@ config SA1100_JORNADA720 config SA1100_HACKKIT bool "HackKit Core CPU Board" - depends on ARCH_SA1100 help Say Y here to support the HackKit Core CPU Board ; config SA1100_HUW_WEBPANEL bool "HuW WebPanel" - depends on ARCH_SA1100 help Say Y here to support the HuW Webpanel produced by Hoeft & Wessel AG. English-language website is at @@ -174,7 +159,6 @@ config SA1100_HUW_WEBPANEL config SA1100_ITSY bool "Itsy" - depends on ARCH_SA1100 help Say Y here if you are using the Compaq Itsy experimental pocket computer. See for @@ -182,7 +166,6 @@ config SA1100_ITSY config SA1100_LART bool "LART" - depends on ARCH_SA1100 help Say Y here if you are using the Linux Advanced Radio Terminal (also known as the LART). See for @@ -190,7 +173,6 @@ config SA1100_LART config SA1100_NANOENGINE bool "nanoEngine" - depends on ARCH_SA1100 help The nanoEngine is a StrongARM 1110-based single board computer from Bright Star Engineering. More information is available at: @@ -201,14 +183,12 @@ config SA1100_NANOENGINE config SA1100_OMNIMETER bool "OmniMeter" - depends on ARCH_SA1100 help Say Y here if you are using the inhand electronics OmniMeter. See for details. config SA1100_PANGOLIN bool "Pangolin" - depends on ARCH_SA1100 help Pangolin is a StrongARM 1110-based evaluation platform produced by Dialogue Technology. It has EISA slots for ease of configuration @@ -220,7 +200,6 @@ config SA1100_PANGOLIN config SA1100_PLEB bool "PLEB" - depends on ARCH_SA1100 help Say Y here if you are using a Portable Linux Embedded Board (also known as PLEB). See @@ -228,7 +207,6 @@ config SA1100_PLEB config SA1100_PT_SYSTEM3 bool "PT System 3" - depends on ARCH_SA1100 help Say Y here if you intend to build a kernel suitable to run on a Pruftechnik Digital Board. For more information see @@ -236,7 +214,6 @@ config SA1100_PT_SYSTEM3 config SA1100_SHANNON bool "Shannon" - depends on ARCH_SA1100 help The Shannon (also known as a Tuxscreen, and also as a IS2630) was a limited edition webphone produced by Philips. The Shannon is a SA1100 @@ -245,7 +222,6 @@ config SA1100_SHANNON config SA1100_SHERMAN bool "Sherman" - depends on ARCH_SA1100 help Say Y here to support the Blazie Engineering `Sherman' StrongARM 1110-based SBC, used primarily in assistance products for the @@ -255,7 +231,6 @@ config SA1100_SHERMAN config SA1100_SIMPAD bool "Simpad" - depends on ARCH_SA1100 help The SIEMENS webpad SIMpad is based on the StrongARM 1110. There are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB @@ -266,7 +241,6 @@ config SA1100_SIMPAD config SA1100_PFS168 bool "Tulsa" - depends on ARCH_SA1100 help The Radisys Corp. PFS-168 (aka Tulsa) is an Intel® StrongArm® SA-1110 based computer which includes the SA-1111 Microprocessor Companion Chip and other @@ -276,7 +250,6 @@ config SA1100_PFS168 config SA1100_VICTOR bool "Victor" - depends on ARCH_SA1100 help Say Y here if you are using a Visu Aide Intel(R) StrongARM(R) SA-1100 based Victor Digital Talking Book Reader. See @@ -285,14 +258,12 @@ config SA1100_VICTOR config SA1100_XP860 bool "XP860" - depends on ARCH_SA1100 help :: Config help missing :: :: 06 August 2002 :: config SA1100_YOPY bool "Yopy" - depends on ARCH_SA1100 help Say Y here to support the Yopy PDA. Product information at . See Documentation/arm/SA1100/Yopy @@ -300,14 +271,12 @@ config SA1100_YOPY config SA1100_STORK bool "Stork" - depends on ARCH_SA1100 help Say Y here if you intend to run this kernel on the Stork handheld computer. #config SA1100_TRIZEPS # bool "Trizeps" -# depends on ARCH_SA1100 # help # :: write me :: @@ -319,7 +288,6 @@ config SA1100_STORK config SA1100_SSP tristate "Generic PIO SSP" - depends on ARCH_SA1100 help Say Y here to enable support for the generic PIO SSP driver. This isn't for audio support, but for attached sensors and @@ -328,7 +296,6 @@ config SA1100_SSP config SA1100_USB tristate "SA1100 USB function support" - depends on ARCH_SA1100 config SA1100_USB_NETLINK tristate "Support for SA11x0 USB network link function" @@ -349,3 +316,4 @@ config H3600_SLEEVE endmenu +endif diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c index 6648d462e..be5dd86f4 100644 --- a/arch/arm/mach-sa1100/cpu-sa1100.c +++ b/arch/arm/mach-sa1100/cpu-sa1100.c @@ -230,8 +230,9 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver sa1100_driver = { - .flags = (CPUFREQ_PANIC_OUTOFSYNC | - CPUFREQ_PANIC_RESUME_OUTOFSYNC), + .flags = CPUFREQ_STICKY | + CPUFREQ_PANIC_OUTOFSYNC | + CPUFREQ_PANIC_RESUME_OUTOFSYNC, .verify = sa11x0_verify_speed, .target = sa1100_target, .get = sa11x0_getspeed, diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c index b17ca12a9..62a4dbcce 100644 --- a/arch/arm/mach-sa1100/cpu-sa1110.c +++ b/arch/arm/mach-sa1100/cpu-sa1110.c @@ -329,8 +329,9 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver sa1110_driver = { - .flags = (CPUFREQ_PANIC_OUTOFSYNC | - CPUFREQ_PANIC_RESUME_OUTOFSYNC), + .flags = CPUFREQ_STICKY | + CPUFREQ_PANIC_OUTOFSYNC | + CPUFREQ_PANIC_RESUME_OUTOFSYNC, .verify = sa11x0_verify_speed, .target = sa1110_target, .get = sa11x0_getspeed, diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile index fbf6db8a2..ff886e33e 100644 --- a/arch/arm/mach-versatile/Makefile +++ b/arch/arm/mach-versatile/Makefile @@ -2,4 +2,4 @@ # Makefile for the linux kernel. # -obj-y := core.o +obj-y := core.o clock.o diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 81485b5b4..d03940c1b 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -75,7 +76,7 @@ no_pmd: return 0; } -void __flush_dcache_page(struct page *page) +static void __flush_dcache_page(struct page *page) { struct address_space *mapping = page_mapping(page); struct mm_struct *mm = current->active_mm; @@ -111,6 +112,17 @@ void __flush_dcache_page(struct page *page) flush_dcache_mmap_unlock(mapping); } +void flush_dcache_page(struct page *page) +{ + struct address_space *mapping = page_mapping(page); + + if (mapping && !mapping_mapped(mapping)) + set_bit(PG_dcache_dirty, &page->flags); + else + __flush_dcache_page(page); +} +EXPORT_SYMBOL(flush_dcache_page); + static void make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, int dirty) { diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index c306fc469..c00061769 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -348,7 +348,7 @@ do_translation_fault(unsigned long addr, unsigned int fsr, if (pmd_none(*pmd_k)) goto bad_area; - set_pmd(pmd, *pmd_k); + copy_pmd(pmd, pmd_k); return 0; bad_area: diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index eec9d7b00..32c4b0e35 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -40,7 +40,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, */ cache_type = read_cpuid(CPUID_CACHETYPE); if (cache_type != read_cpuid(CPUID_ID)) { - aliasing = (cache_type | cache_type >> 12) & (1 << 9); + aliasing = (cache_type | cache_type >> 12) & (1 << 11); if (aliasing) do_align = filp || flags & MAP_SHARED; } diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c index e73c74803..8df666f8d 100644 --- a/arch/arm/mm/proc-syms.c +++ b/arch/arm/mm/proc-syms.c @@ -14,8 +14,6 @@ #include #include -EXPORT_SYMBOL(__flush_dcache_page); - #ifndef MULTI_CPU EXPORT_SYMBOL(cpu_dcache_clean_area); EXPORT_SYMBOL(cpu_set_pte); @@ -28,7 +26,6 @@ EXPORT_SYMBOL_NOVERS(__cpuc_flush_kern_all); EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_all); EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_range); EXPORT_SYMBOL_NOVERS(__cpuc_coherent_kern_range); -EXPORT_SYMBOL_NOVERS(__cpuc_flush_dcache_page); #else EXPORT_SYMBOL(cpu_cache); #endif diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 2a594d21d..2ecfdfd61 100644 --- a/arch/arm/tools/mach-types +++ b/arch/arm/tools/mach-types @@ -6,7 +6,7 @@ # To add an entry into this database, please see Documentation/arm/README, # or contact rmk@arm.linux.org.uk # -# Last update: Thu Apr 29 19:06:33 2004 +# Last update: Fri May 28 13:17:46 2004 # # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number # @@ -509,7 +509,7 @@ s3c5500 MACH_S3C5500 S3C5500 498 smdk5500 MACH_SMDK5500 SMDK5500 499 signalsync MACH_SIGNALSYNC SIGNALSYNC 500 nbc MACH_NBC NBC 501 -er4525 MACH_ER4525 ER4525 502 +kodiak MACH_KODIAK KODIAK 502 netbookpro MACH_NETBOOKPRO NETBOOKPRO 503 hw90200 MACH_HW90200 HW90200 504 condor MACH_CONDOR CONDOR 505 @@ -533,3 +533,16 @@ emc1000 MACH_EMC1000 EMC1000 522 tidsc25 MACH_TIDSC25 TIDSC25 523 akcpmxl MACH_AKCPMXL AKCPMXL 524 av3xx MACH_AV3XX AV3XX 525 +avila MACH_AVILA AVILA 526 +pxa_mpm10 MACH_PXA_MPM10 PXA_MPM10 527 +pxa_kyanite MACH_PXA_KYANITE PXA_KYANITE 528 +sgold MACH_SGOLD SGOLD 529 +oscar MACH_OSCAR OSCAR 530 +epxa4usb2 MACH_EPXA4USB2 EPXA4USB2 531 +xsengine MACH_XSENGINE XSENGINE 532 +ip600 MACH_IP600 IP600 533 +mcan2 MACH_MCAN2 MCAN2 534 +ddi_blueridge MACH_DDI_BLUERIDGE DDI_BLUERIDGE 535 +skyminder MACH_SKYMINDER SKYMINDER 536 +lpd79520 MACH_LPD79520 LPD79520 537 +edb9302 MACH_EDB9302 EDB9302 538 diff --git a/arch/arm26/kernel/init_task.c b/arch/arm26/kernel/init_task.c index d40e768bd..5b510232a 100644 --- a/arch/arm26/kernel/init_task.c +++ b/arch/arm26/kernel/init_task.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/arch/cris/arch-v10/drivers/ethernet.c b/arch/cris/arch-v10/drivers/ethernet.c index e13b754a2..f258c0008 100644 --- a/arch/cris/arch-v10/drivers/ethernet.c +++ b/arch/cris/arch-v10/drivers/ethernet.c @@ -1396,8 +1396,8 @@ e100_close(struct net_device *dev) static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; - struct net_local *np = (struct net_local *)dev->priv; + struct mii_ioctl_data *data = if_mii(ifr); + struct net_local *np = netdev_priv(dev); spin_lock(&np->lock); /* Preempt protection */ switch (cmd) { diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c index c4992bf89..9f7cad7c7 100644 --- a/arch/cris/kernel/process.c +++ b/arch/cris/kernel/process.c @@ -112,6 +112,7 @@ #include #include #include +#include //#define DEBUG diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 072192a4f..8497cfb80 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -223,7 +223,7 @@ config GDB_DEBUG config CONFIG_SH_STANDARD_BIOS bool "Use gdb protocol serial console" - depends on (!H8300H_SIM && H8S_SIM) + depends on (!H8300H_SIM && !H8S_SIM) help serial console output using GDB protocol. Require eCos/RedBoot diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c index 6a8e7475b..19272c2ac 100644 --- a/arch/h8300/kernel/init_task.c +++ b/arch/h8300/kernel/init_task.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c index 0843013d1..5905ceeaa 100644 --- a/arch/h8300/kernel/ptrace.c +++ b/arch/h8300/kernel/ptrace.c @@ -116,18 +116,36 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_PEEKUSR: { unsigned long tmp; - if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) + if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { ret = -EIO; + break ; + } - tmp = 0; /* Default return condition */ + ret = 0; /* Default return condition */ addr = addr >> 2; /* temporary hack. */ + if (addr < H8300_REGS_NO) tmp = h8300_get_reg(child, addr); else { - ret = -EIO; - break ; + switch(addr) { + case 49: + tmp = child->mm->start_code; + break ; + case 50: + tmp = child->mm->start_data; + break ; + case 51: + tmp = child->mm->end_code; + break ; + case 52: + tmp = child->mm->end_data; + break ; + default: + ret = -EIO; + } } - ret = put_user(tmp,(unsigned long *) data); + if (!ret) + ret = put_user(tmp,(unsigned long *) data); break ; } diff --git a/arch/h8300/platform/h8s/entry.S b/arch/h8300/platform/h8s/entry.S index 9df1201a1..68e5cae80 100644 --- a/arch/h8300/platform/h8s/entry.S +++ b/arch/h8300/platform/h8s/entry.S @@ -83,6 +83,7 @@ mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */ mov.l er1,@er0 mov.w @(LEXR-LER1:16,sp),r1 /* restore EXR */ + mov.b r1l,r1h mov.w r1,@(8:16,er0) mov.w @(LCCR-LER1:16,sp),r1 /* restore the RET addr */ mov.b r1l,r1h @@ -214,7 +215,6 @@ SYMBOL_NAME_LABEL(system_call) jsr @SYMBOL_NAME(syscall_trace) bra SYMBOL_NAME(ret_from_exception):8 - SYMBOL_NAME_LABEL(ret_from_fork) mov.l er2,er0 jsr @SYMBOL_NAME(schedule_tail) diff --git a/arch/h8300/platform/h8s/ptrace_h8s.c b/arch/h8300/platform/h8s/ptrace_h8s.c index dc0495404..e8cd46f92 100644 --- a/arch/h8300/platform/h8s/ptrace_h8s.c +++ b/arch/h8300/platform/h8s/ptrace_h8s.c @@ -23,7 +23,7 @@ static const int h8300_register_offset[] = { PT_REG(er1), PT_REG(er2), PT_REG(er3), PT_REG(er4), PT_REG(er5), PT_REG(er6), PT_REG(er0), PT_REG(orig_er0), - PT_REG(ccr), PT_REG(pc), PT_REG(exr) + PT_REG(ccr), PT_REG(pc), 0, PT_REG(exr) }; /* read register */ diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index c46596c97..afd6c26d6 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -65,6 +65,8 @@ config X86_VOYAGER config X86_NUMAQ bool "NUMAQ (IBM/Sequent)" + select DISCONTIGMEM + select NUMA help This option is used for getting Linux to run on a (IBM/Sequent) NUMA multiquad box. This changes the way that processors are bootstrapped, @@ -482,7 +484,8 @@ config HPET_TIMER Choose N to continue using the legacy 8254 timer. config HPET_EMULATE_RTC - def_bool HPET_TIMER && RTC=y + bool "Provide RTC interrupt" + depends on HPET_TIMER && RTC=y config SMP bool "Symmetric multi-processing support" @@ -596,6 +599,7 @@ config X86_TSC config X86_MCE bool "Machine Check Exception" + depends on !X86_VOYAGER ---help--- Machine Check Exception support allows the processor to notify the kernel if it detects a problem (e.g. overheating, component failure). @@ -871,7 +875,7 @@ config EFI This option is only useful on systems that have EFI firmware and will result in a kernel image that is ~8k larger. In addition, you must use the latest ELILO loader available at - in order to take advantage of + in order to take advantage of kernel initialization using EFI information (neither GRUB nor LILO know anything about EFI). However, even with this option, the resultant kernel should continue to boot on existing non-EFI platforms. @@ -1371,12 +1375,6 @@ config X86_TRAMPOLINE depends on X86_SMP || (X86_VOYAGER && SMP) default y -# std_resources is overridden for pc9800, but that's not -# a currently selectable arch choice -config X86_STD_RESOURCES - bool - default y - config PC bool depends on X86 && !EMBEDDED diff --git a/arch/i386/defconfig b/arch/i386/defconfig index c2a9ab0aa..7257696c7 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -18,8 +18,11 @@ CONFIG_STANDALONE=y # CONFIG_SWAP=y CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +CONFIG_AUDIT=y +CONFIG_AUDITSYSCALL=y CONFIG_LOG_BUF_SHIFT=15 CONFIG_HOTPLUG=y # CONFIG_IKCONFIG is not set @@ -30,6 +33,7 @@ CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # @@ -88,6 +92,7 @@ CONFIG_X86_USE_PPRO_CHECKSUM=y # CONFIG_HPET_EMULATE_RTC is not set CONFIG_SMP=y CONFIG_NR_CPUS=8 +CONFIG_SCHED_SMT=y CONFIG_PREEMPT=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y @@ -200,7 +205,7 @@ CONFIG_BINFMT_MISC=y # # Generic Driver Options # -# CONFIG_FW_LOADER is not set +CONFIG_FW_LOADER=m # # Memory Technology Devices (MTD) @@ -259,7 +264,6 @@ CONFIG_BLK_DEV_IDE=y # CONFIG_BLK_DEV_HD_IDE is not set CONFIG_BLK_DEV_IDEDISK=y CONFIG_IDEDISK_MULTI_MODE=y -# CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set @@ -307,6 +311,7 @@ CONFIG_BLK_DEV_PIIX=y # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_IDE_ARM is not set # CONFIG_IDE_CHIPSETS is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set @@ -332,7 +337,6 @@ CONFIG_CHR_DEV_SG=y # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # # CONFIG_SCSI_MULTI_LUN is not set -CONFIG_SCSI_REPORT_LUNS=y # CONFIG_SCSI_CONSTANTS is not set # CONFIG_SCSI_LOGGING is not set @@ -354,6 +358,7 @@ CONFIG_SCSI_REPORT_LUNS=y # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set +CONFIG_SCSI_DPT_I2O=m # CONFIG_SCSI_ADVANSYS is not set # CONFIG_SCSI_IN2000 is not set # CONFIG_SCSI_MEGARAID is not set @@ -361,7 +366,9 @@ CONFIG_SCSI_SATA=y # CONFIG_SCSI_SATA_SVW is not set CONFIG_SCSI_ATA_PIIX=y # CONFIG_SCSI_SATA_PROMISE is not set +CONFIG_SCSI_SATA_SX4=m # CONFIG_SCSI_SATA_SIL is not set +CONFIG_SCSI_SATA_SIS=m # CONFIG_SCSI_SATA_VIA is not set # CONFIG_SCSI_SATA_VITESSE is not set # CONFIG_SCSI_BUSLOGIC is not set @@ -380,6 +387,9 @@ CONFIG_SCSI_ATA_PIIX=y # CONFIG_SCSI_IMM is not set # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +CONFIG_SCSI_IPR=m +# CONFIG_SCSI_IPR_TRACE is not set +# CONFIG_SCSI_IPR_DUMP is not set # CONFIG_SCSI_PAS16 is not set # CONFIG_SCSI_PSI240I is not set # CONFIG_SCSI_QLOGIC_FAS is not set @@ -484,8 +494,6 @@ CONFIG_IP_MULTICAST=y # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -539,13 +547,17 @@ CONFIG_IP_NF_TARGET_TCPMSS=y CONFIG_IP_NF_ARPTABLES=y CONFIG_IP_NF_ARPFILTER=y CONFIG_IP_NF_ARP_MANGLE=y +CONFIG_IP_NF_TARGET_NOTRACK=m +CONFIG_IP_NF_RAW=m # # SCTP Configuration (EXPERIMENTAL) # # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set @@ -566,18 +578,23 @@ CONFIG_IP_NF_ARP_MANGLE=y # Network testing # # CONFIG_NET_PKTGEN is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set CONFIG_DUMMY=m # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_TUN is not set # CONFIG_NET_SB1000 is not set +# +# ARCnet devices +# +# CONFIG_ARCNET is not set + # # Ethernet (10 or 100Mbit) # @@ -619,7 +636,6 @@ CONFIG_8139TOO_PIO=y # CONFIG_8139TOO_TUNE_TWISTER is not set # CONFIG_8139TOO_8129 is not set # CONFIG_8139_OLD_RX_RESET is not set -CONFIG_8139_RXBUF_IDX=2 # CONFIG_SIS900 is not set # CONFIG_EPIC100 is not set # CONFIG_SUNDANCE is not set @@ -637,7 +653,6 @@ CONFIG_8139_RXBUF_IDX=2 # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set # CONFIG_R8169 is not set -# CONFIG_SIS190 is not set # CONFIG_SK98LIN is not set # CONFIG_TIGON3 is not set @@ -645,47 +660,31 @@ CONFIG_8139_RXBUF_IDX=2 # Ethernet (10000 Mbit) # # CONFIG_IXGB is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PLIP is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set +CONFIG_S2IO=m +# CONFIG_S2IO_NAPI is not set # # Token Ring devices # # CONFIG_TR is not set -# CONFIG_NET_FC is not set -# CONFIG_RCPCI is not set -# CONFIG_SHAPER is not set -# CONFIG_NETCONSOLE is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set # -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support +# Wireless LAN (non-hamradio) # -# CONFIG_IRDA is not set +# CONFIG_NET_RADIO is not set # -# Bluetooth support +# Wan interfaces # -# CONFIG_BT is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_WAN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PLIP is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_NET_FC is not set +# CONFIG_SHAPER is not set +# CONFIG_NETCONSOLE is not set # # ISDN subsystem @@ -803,6 +802,7 @@ CONFIG_AGP=y # CONFIG_AGP_AMD is not set # CONFIG_AGP_AMD64 is not set CONFIG_AGP_INTEL=y +CONFIG_AGP_INTEL_MCH=m # CONFIG_AGP_NVIDIA is not set # CONFIG_AGP_SIS is not set # CONFIG_AGP_SWORKS is not set @@ -978,6 +978,7 @@ CONFIG_USB_DEVICEFS=y # CONFIG_USB_EHCI_HCD=y # CONFIG_USB_EHCI_SPLIT_ISO is not set +# CONFIG_USB_EHCI_ROOT_HUB_TT is not set # CONFIG_USB_OHCI_HCD is not set CONFIG_USB_UHCI_HCD=y @@ -1012,6 +1013,7 @@ CONFIG_USB_HIDINPUT=y # CONFIG_USB_KBTAB is not set # CONFIG_USB_POWERMATE is not set # CONFIG_USB_MTOUCH is not set +CONFIG_USB_EGALAX=m # CONFIG_USB_XPAD is not set # CONFIG_USB_ATI_REMOTE is not set @@ -1061,6 +1063,8 @@ CONFIG_USB_HIDINPUT=y # CONFIG_USB_LEGOTOWER is not set # CONFIG_USB_LCD is not set # CONFIG_USB_LED is not set +CONFIG_USB_CYTHERM=m +CONFIG_USB_PHIDGETSERVO=m # CONFIG_USB_TEST is not set # @@ -1110,6 +1114,7 @@ CONFIG_VFAT_FS=y # CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y @@ -1152,7 +1157,6 @@ CONFIG_SUNRPC=y # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set # CONFIG_AFS_FS is not set # @@ -1217,6 +1221,7 @@ CONFIG_OPROFILE=y CONFIG_EARLY_PRINTK=y CONFIG_DEBUG_SPINLOCK_SLEEP=y # CONFIG_FRAME_POINTER is not set +CONFIG_4KSTACKS=y CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y @@ -1234,8 +1239,10 @@ CONFIG_X86_MPPARSE=y # Library routines # CONFIG_CRC32=y +CONFIG_LIBCRC32C=m CONFIG_X86_SMP=y CONFIG_X86_HT=y CONFIG_X86_BIOS_REBOOT=y CONFIG_X86_TRAMPOLINE=y +CONFIG_X86_STD_RESOURCES=y CONFIG_PC=y diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index 577be173b..a056d5068 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_ACPI_SRAT) += srat.o obj-$(CONFIG_HPET_TIMER) += time_hpet.o obj-$(CONFIG_EFI) += efi.o efi_stub.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -obj-$(CONFIG_X86_STD_RESOURCES) += std_resources.o EXTRA_AFLAGS := -traditional -m32 diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index fdb9b6c88..731132755 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c @@ -28,7 +28,9 @@ #include #include #include -#include +#include + +#include #include #include #include @@ -437,6 +439,38 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) return 0; } +unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) +{ + unsigned int irq; + +#ifdef CONFIG_PCI + /* + * Make sure all (legacy) PCI IRQs are set as level-triggered. + */ + if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { + static u16 irq_mask; + extern void eisa_set_level_irq(unsigned int irq); + + if (edge_level == ACPI_LEVEL_SENSITIVE) { + if ((gsi < 16) && !((1 << gsi) & irq_mask)) { + Dprintk(KERN_DEBUG PREFIX "Setting GSI %u as level-triggered\n", gsi); + irq_mask |= (1 << gsi); + eisa_set_level_irq(gsi); + } + } + } +#endif + +#ifdef CONFIG_X86_IO_APIC + if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { + mp_register_gsi(gsi, edge_level, active_high_low); + } +#endif + acpi_gsi_to_irq(gsi, &irq); + return irq; +} +EXPORT_SYMBOL(acpi_register_gsi); + static unsigned long __init acpi_scan_rsdp ( unsigned long start, diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 1df49f709..ecf2b632f 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -81,6 +80,17 @@ void enable_NMI_through_LVT0 (void * dummy) apic_write_around(APIC_LVT0, v); } +int get_physical_broadcast(void) +{ + unsigned int lvr, version; + lvr = apic_read(APIC_LVR); + version = GET_APIC_VERSION(lvr); + if (version >= 0x14) + return 0xff; + else + return 0xf; +} + int get_maxlvt(void) { unsigned int v, ver, maxlvt; diff --git a/arch/i386/kernel/cpu/cpufreq/elanfreq.c b/arch/i386/kernel/cpu/cpufreq/elanfreq.c index 0b0237e8a..3f7caa4ae 100644 --- a/arch/i386/kernel/cpu/cpufreq/elanfreq.c +++ b/arch/i386/kernel/cpu/cpufreq/elanfreq.c @@ -254,6 +254,7 @@ static int elanfreq_cpu_exit(struct cpufreq_policy *policy) static int __init elanfreq_setup(char *str) { max_freq = simple_strtoul(str, &str, 0); + printk(KERN_WARNING "You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n"); return 1; } __setup("elanfreq=", elanfreq_setup); @@ -300,7 +301,7 @@ static void __exit elanfreq_exit(void) } -MODULE_PARM (max_freq, "i"); +module_param (max_freq, int, 0444); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Robert Schwebel , Sven Geggus "); diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c index 000aac11e..fefaf45a0 100644 --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c @@ -124,7 +124,7 @@ static int stock_freq; /* PCI bus clock - defaults to 30.000 if cpu_khz is not available */ static int pci_busclk = 0; -MODULE_PARM(pci_busclk, "i"); +module_param (pci_busclk, int, 0444); /* maximum duration for which the cpu may be suspended * (32us * MAX_DURATION). If no parameter is given, this defaults @@ -133,7 +133,7 @@ MODULE_PARM(pci_busclk, "i"); * is suspended -- processing power is just 0.39% of what it used to be, * though. 781.25 kHz(!) for a 200 MHz processor -- wow. */ static int max_duration = 255; -MODULE_PARM(max_duration, "i"); +module_param (max_duration, int, 0444); /* For the default policy, we want at least some processing power * - let's say 5%. (min = maxfreq / POLICY_MIN_DIV) diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index 53145bbfe..57c0377b4 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c @@ -36,18 +36,26 @@ static unsigned int numscales=16, numvscales; static unsigned int fsb; static int minvid, maxvid; +static unsigned int minmult, maxmult; static int can_scale_voltage; static int vrmrev; /* Module parameters */ static int dont_scale_voltage; static int debug; -static int debug; -static void dprintk(const char *msg, ...) +static void dprintk(const char *fmt, ...) { - if (debug == 1) - printk(msg); + char s[256]; + va_list args; + + if (debug == 0) + return; + + va_start(args, fmt); + vsprintf(s, fmt, args); + printk(s); + va_end(args); } @@ -62,7 +70,7 @@ static int longhaul_version; static struct cpufreq_frequency_table *longhaul_table; -static unsigned int calc_speed (int mult, int fsb) +static unsigned int calc_speed(int mult, int fsb) { int khz; khz = (mult/10)*fsb; @@ -73,17 +81,13 @@ static unsigned int calc_speed (int mult, int fsb) } -static int longhaul_get_cpu_mult (void) +static int longhaul_get_cpu_mult(void) { unsigned long invalue=0,lo, hi; rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22; - if (longhaul_version==2) { - if (lo & (1<<27)) - invalue+=16; - } - if (longhaul_version==4) { + if (longhaul_version==2 || longhaul_version==3) { if (lo & (1<<27)) invalue+=16; } @@ -98,7 +102,7 @@ static int longhaul_get_cpu_mult (void) * Sets a new clock ratio, and -if applicable- a new Front Side Bus */ -static void longhaul_setstate (unsigned int clock_ratio_index) +static void longhaul_setstate(unsigned int clock_ratio_index) { int speed, mult; struct cpufreq_freqs freqs; @@ -162,7 +166,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index) longhaul.bits.RevisionKey = 3; wrmsrl (MSR_VIA_LONGHAUL, longhaul.val); break; - case 4: + case 3: rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf; longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; @@ -194,7 +198,7 @@ static void longhaul_setstate (unsigned int clock_ratio_index) #define ROUNDING 0xf -static int _guess (int guess, int maxmult) +static int _guess(int guess) { int target; @@ -207,7 +211,7 @@ static int _guess (int guess, int maxmult) } -static int guess_fsb(int maxmult) +static int guess_fsb(void) { int speed = (cpu_khz/1000); int i; @@ -217,25 +221,25 @@ static int guess_fsb(int maxmult) speed &= ~ROUNDING; for (i=0; i<3; i++) { - if (_guess(speeds[i],maxmult) == speed) + if (_guess(speeds[i]) == speed) return speeds[i]; } return 0; } -static int __init longhaul_get_ranges (void) +static int __init longhaul_get_ranges(void) { struct cpuinfo_x86 *c = cpu_data; - unsigned long invalue,invalue2; - unsigned int minmult=0, maxmult=0; + unsigned long invalue; unsigned int multipliers[32]= { 50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65, -1,110,120,-1,135,115,125,105,130,150,160,140,-1,155,-1,145 }; unsigned int j, k = 0; union msr_longhaul longhaul; unsigned long lo, hi; - unsigned int eblcr_fsb_table[] = { 66, 133, 100, -1 }; + unsigned int eblcr_fsb_table_v1[] = { 66, 133, 100, -1 }; + unsigned int eblcr_fsb_table_v2[] = { 133, 100, -1, 66 }; switch (longhaul_version) { case 1: @@ -246,9 +250,9 @@ static int __init longhaul_get_ranges (void) rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi); invalue = (lo & (1<<18|1<<19)) >>18; if (c->x86_model==6) - fsb = eblcr_fsb_table[invalue]; + fsb = eblcr_fsb_table_v1[invalue]; else - fsb = guess_fsb(maxmult); + fsb = guess_fsb(); break; case 2: @@ -265,53 +269,38 @@ static int __init longhaul_get_ranges (void) else minmult = multipliers[invalue]; - switch (longhaul.bits.MaxMHzFSB) { - case 0x0: fsb=133; - break; - case 0x1: fsb=100; - break; - case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); - return -EINVAL; - case 0x3: fsb=66; - break; - } + fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; break; - case 4: + case 3: rdmsrl (MSR_VIA_LONGHAUL, longhaul.val); - //TODO: Nehemiah may have borken MaxMHzBR. - // need to extrapolate from FSB. - - invalue2 = longhaul.bits.MinMHzBR; - invalue = longhaul.bits.MaxMHzBR; - if (longhaul.bits.MaxMHzBR4) - invalue += 16; - maxmult=multipliers[invalue]; - - maxmult=longhaul_get_cpu_mult(); - - printk(KERN_INFO PFX " invalue: %ld maxmult: %d \n", invalue, maxmult); - printk(KERN_INFO PFX " invalue2: %ld \n", invalue2); - + /* + * TODO: This code works, but raises a lot of questions. + * - Some Nehemiah's seem to have broken Min/MaxMHzBR's. + * We get around this by using a hardcoded multiplier of 5.0x + * for the minimimum speed, and the speed we booted up at for the max. + * This is done in longhaul_get_cpu_mult() by reading the EBLCR register. + * - According to some VIA documentation EBLCR is only + * in pre-Nehemiah C3s. How this still works is a mystery. + * We're possibly using something undocumented and unsupported, + * But it works, so we don't grumble. + */ minmult=50; + maxmult=longhaul_get_cpu_mult(); - switch (longhaul.bits.MaxMHzFSB) { - case 0x0: fsb=133; - break; - case 0x1: fsb=100; - break; - case 0x2: printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); - return -EINVAL; - case 0x3: fsb=66; - break; - } - + fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; break; } dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n", minmult/10, minmult%10, maxmult/10, maxmult%10); + + if (fsb == -1) { + printk (KERN_INFO PFX "Invalid (reserved) FSB!\n"); + return -EINVAL; + } + highest_speed = calc_speed (maxmult, fsb); lowest_speed = calc_speed (minmult,fsb); dprintk (KERN_INFO PFX "FSB: %dMHz Lowestspeed=%dMHz Highestspeed=%dMHz\n", @@ -413,7 +402,7 @@ static int longhaul_verify(struct cpufreq_policy *policy) } -static int longhaul_target (struct cpufreq_policy *policy, +static int longhaul_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { @@ -437,7 +426,7 @@ static unsigned int longhaul_get(unsigned int cpu) return (calc_speed (longhaul_get_cpu_mult(), fsb)); } -static int __init longhaul_cpu_init (struct cpufreq_policy *policy) +static int __init longhaul_cpu_init(struct cpufreq_policy *policy) { struct cpuinfo_x86 *c = cpu_data; char *cpuname=NULL; @@ -480,7 +469,7 @@ static int __init longhaul_cpu_init (struct cpufreq_policy *policy) break; case 9: - longhaul_version=4; + longhaul_version=3; numscales=32; switch (c->x86_mask) { case 0 ... 1: @@ -551,7 +540,7 @@ static struct cpufreq_driver longhaul_driver = { .attr = longhaul_attr, }; -static int __init longhaul_init (void) +static int __init longhaul_init(void) { struct cpuinfo_x86 *c = cpu_data; @@ -568,8 +557,17 @@ static int __init longhaul_init (void) return -ENODEV; } -static void __exit longhaul_exit (void) +static void __exit longhaul_exit(void) { + int i=0; + unsigned int new_clock_ratio; + + while (clock_ratio[i] != maxmult) + i++; + + new_clock_ratio = longhaul_table[i].index & 0xFF; + longhaul_setstate(new_clock_ratio); + cpufreq_unregister_driver(&longhaul_driver); kfree(longhaul_table); } diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c index b5daeccfa..fa01a95bb 100644 --- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -132,34 +133,28 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, #endif /* notifiers */ - for_each_cpu(i) { - if (cpu_isset(i, affected_cpu_map)) { - freqs.cpu = i; - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - } + for_each_cpu_mask(i, affected_cpu_map) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); } /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software * Developer's Manual, Volume 3 */ - for_each_cpu(i) { - if (cpu_isset(i, affected_cpu_map)) { - cpumask_t this_cpu = cpumask_of_cpu(i); + for_each_cpu_mask(i, affected_cpu_map) { + cpumask_t this_cpu = cpumask_of_cpu(i); - set_cpus_allowed(current, this_cpu); - BUG_ON(smp_processor_id() != i); + set_cpus_allowed(current, this_cpu); + BUG_ON(smp_processor_id() != i); - cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); - } + cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); } set_cpus_allowed(current, cpus_allowed); /* notifiers */ - for_each_cpu(i) { - if (cpu_isset(i, affected_cpu_map)) { - freqs.cpu = i; - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - } + for_each_cpu_mask(i, affected_cpu_map) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); } return 0; diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c index cf008b4af..7aefc6764 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c @@ -28,7 +28,7 @@ #include #include -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) #include #include #endif @@ -63,7 +63,7 @@ struct pst_s { u8 numpstates; }; -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) union powernow_acpi_control_t { struct { unsigned long fid:5, @@ -293,7 +293,7 @@ static void change_speed (unsigned int index) } -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) struct acpi_processor_performance *acpi_processor_perf; @@ -642,7 +642,7 @@ static int __init powernow_init (void) static void __exit powernow_exit (void) { -#ifdef CONFIG_ACPI_PROCESSOR +#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) if (acpi_processor_perf) { acpi_processor_unregister_performance(acpi_processor_perf, 0); kfree(acpi_processor_perf); diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 63737e8cb..20d875da8 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -733,10 +733,22 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) continue; } - /* verify only 1 entry from the lo frequency table */ - if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) { - printk(KERN_ERR PFX "Too many lo freq table entries\n"); - goto err_out_mem; + if (fid < HI_FID_TABLE_BOTTOM) { + if (cntlofreq) { + /* if both entries are the same, ignore this + * one... + */ + if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) || + (powernow_table[i].index != powernow_table[cntlofreq].index)) { + printk(KERN_ERR PFX "Too many lo freq table entries\n"); + goto err_out_mem; + } + + dprintk(KERN_INFO PFX "double low frequency table entry, ignoring it.\n"); + powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; + continue; + } else + cntlofreq = i; } if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { @@ -857,12 +869,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi if (smp_processor_id() != pol->cpu) { printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); - goto sched_out; + goto err_out; } - /* from this point, do not exit without restoring preempt and cpu */ - preempt_disable(); - if (pending_bit_stuck()) { printk(KERN_ERR PFX "failing targ, change pending bit set\n"); goto err_out; @@ -900,8 +909,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi ret = 0; err_out: - preempt_enable_no_resched(); -sched_out: set_cpus_allowed(current, oldmask); schedule(); @@ -1017,7 +1024,7 @@ err_out: return -ENODEV; } -static int __exit powernowk8_cpu_exit (struct cpufreq_policy *pol) +static int powernowk8_cpu_exit (struct cpufreq_policy *pol) { struct powernow_k8_data *data = powernow_data[pol->cpu]; @@ -1069,7 +1076,7 @@ static struct cpufreq_driver cpufreq_amd64_driver = { .verify = powernowk8_verify, .target = powernowk8_target, .init = powernowk8_cpu_init, - .exit = powernowk8_cpu_exit, + .exit = __devexit_p(powernowk8_cpu_exit), .get = powernowk8_get, .name = "powernow-k8", .owner = THIS_MODULE, @@ -1098,7 +1105,7 @@ static int __init powernowk8_init(void) } /* driver entry point for term */ -static void __exit powernowk8_exit(void) +static void powernowk8_exit(void) { dprintk(KERN_INFO PFX "exit\n"); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 466fc6578..93b70f0dc 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c @@ -67,28 +67,19 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { /** * speedstep_set_state - set the SpeedStep state * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) - * @notify: whether to call cpufreq_notify_transition for CPU speed changes * * Tries to change the SpeedStep state. */ -static void speedstep_set_state (unsigned int state, unsigned int notify) +static void speedstep_set_state (unsigned int state) { u32 pmbase; u8 pm2_blk; u8 value; unsigned long flags; - struct cpufreq_freqs freqs; if (!speedstep_chipset_dev || (state > 0x1)) return; - freqs.old = speedstep_get_processor_frequency(speedstep_processor); - freqs.new = speedstep_freqs[state].frequency; - freqs.cpu = 0; /* speedstep.c is UP only driver */ - - if (notify) - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - /* get PMBASE */ pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); if (!(pmbase & 0x01)) @@ -143,9 +134,6 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) printk (KERN_ERR "cpufreq: change failed - I/O error\n"); } - if (notify) - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - return; } @@ -252,11 +240,47 @@ static int speedstep_target (struct cpufreq_policy *policy, unsigned int relation) { unsigned int newstate = 0; + struct cpufreq_freqs freqs; + cpumask_t cpus_allowed, affected_cpu_map; + int i; if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) return -EINVAL; - speedstep_set_state(newstate, 1); + /* no transition necessary */ + if (freqs.old == freqs.new) + return 0; + + freqs.old = speedstep_get_processor_frequency(speedstep_processor); + freqs.new = speedstep_freqs[newstate].frequency; + freqs.cpu = policy->cpu; + + cpus_allowed = current->cpus_allowed; + + /* only run on CPU to be set, or on its sibling */ +#ifdef CONFIG_SMP + affected_cpu_map = cpu_sibling_map[policy->cpu]; +#else + affected_cpu_map = cpumask_of_cpu(policy->cpu); +#endif + + for_each_cpu_mask(i, affected_cpu_map) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + } + + /* switch to physical CPU where state is to be changed */ + set_cpus_allowed(current, affected_cpu_map); + + speedstep_set_state(newstate); + + /* allow to be run on all CPUs */ + set_cpus_allowed(current, cpus_allowed); + + for_each_cpu_mask(i, affected_cpu_map) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } return 0; } @@ -279,21 +303,35 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) { int result = 0; unsigned int speed; + cpumask_t cpus_allowed,affected_cpu_map; + /* capability check */ - if (policy->cpu != 0) + if (policy->cpu != 0) /* FIXME: better support for SMT in cpufreq core. Up until then, it's better to register only one CPU */ return -ENODEV; + /* only run on CPU to be set, or on its sibling */ + cpus_allowed = current->cpus_allowed; +#ifdef CONFIG_SMP + affected_cpu_map = cpu_sibling_map[policy->cpu]; +#else + affected_cpu_map = cpumask_of_cpu(policy->cpu); +#endif + set_cpus_allowed(current, affected_cpu_map); + /* detect low and high frequency */ result = speedstep_get_freqs(speedstep_processor, &speedstep_freqs[SPEEDSTEP_LOW].frequency, &speedstep_freqs[SPEEDSTEP_HIGH].frequency, &speedstep_set_state); - if (result) + if (result) { + set_cpus_allowed(current, cpus_allowed); return result; + } /* get current speed setting */ speed = speedstep_get_processor_frequency(speedstep_processor); + set_cpus_allowed(current, cpus_allowed); if (!speed) return -EIO; diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index 3305a84b6..82f7c0220 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c @@ -252,11 +252,10 @@ unsigned int speedstep_detect_processor (void) * specific. * M-P4-Ms may have either ebx=0xe or 0xf [see above] * M-P4/533 have either ebx=0xe or 0xf. [25317607.pdf] - * So, how to distinguish all those processors with - * ebx=0xf? I don't know. Sort them out, and wait - * for someone to complain. + * also, M-P4M HTs have ebx=0x8, too + * For now, they are distinguished by the model_id string */ - if (ebx == 0x0e) + if ((ebx == 0x0e) || (strstr(c->x86_model_id,"Mobile Intel(R) Pentium(R) 4") != NULL)) return SPEEDSTEP_PROCESSOR_P4M; break; default: @@ -321,9 +320,7 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor); unsigned int speedstep_get_freqs(unsigned int processor, unsigned int *low_speed, unsigned int *high_speed, - void (*set_state) (unsigned int state, - unsigned int notify) - ) + void (*set_state) (unsigned int state)) { unsigned int prev_speed; unsigned int ret = 0; @@ -340,7 +337,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, local_irq_save(flags); /* switch to low state */ - set_state(SPEEDSTEP_LOW, 0); + set_state(SPEEDSTEP_LOW); *low_speed = speedstep_get_processor_frequency(processor); if (!*low_speed) { ret = -EIO; @@ -348,7 +345,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, } /* switch to high state */ - set_state(SPEEDSTEP_HIGH, 0); + set_state(SPEEDSTEP_HIGH); *high_speed = speedstep_get_processor_frequency(processor); if (!*high_speed) { ret = -EIO; @@ -362,7 +359,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, /* switch to previous state, if necessary */ if (*high_speed != prev_speed) - set_state(SPEEDSTEP_LOW, 0); + set_state(SPEEDSTEP_LOW); out: local_irq_restore(flags); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index 851926d61..261a2c9b7 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h @@ -44,4 +44,4 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor); extern unsigned int speedstep_get_freqs(unsigned int processor, unsigned int *low_speed, unsigned int *high_speed, - void (*set_state) (unsigned int state, unsigned int notify)); + void (*set_state) (unsigned int state)); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 2b1f2fbee..6aa31cd5a 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c @@ -139,37 +139,24 @@ static int speedstep_get_state (void) : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0) ); - return state; + return (state & 1); } /** * speedstep_set_state - set the SpeedStep state * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) - * @notify: whether to call cpufreq_notify_transition * */ -static void speedstep_set_state (unsigned int state, unsigned int notify) +static void speedstep_set_state (unsigned int state) { - unsigned int old_state, result = 0, command, new_state; + unsigned int result = 0, command, new_state; unsigned long flags; - struct cpufreq_freqs freqs; unsigned int function=SET_SPEEDSTEP_STATE; unsigned int retry = 0; if (state > 0x1) return; - old_state = speedstep_get_state(); - freqs.old = speedstep_freqs[old_state].frequency; - freqs.new = speedstep_freqs[state].frequency; - freqs.cpu = 0; /* speedstep.c is UP only driver */ - - if (old_state == state) - return; - - if (notify) - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - /* Disable IRQs */ local_irq_save(flags); @@ -198,9 +185,6 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) printk(KERN_ERR "cpufreq: change failed with new_state %u and result %u\n", new_state, result); } - if (notify) - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - return; } @@ -217,11 +201,21 @@ static int speedstep_target (struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { unsigned int newstate = 0; + struct cpufreq_freqs freqs; if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) return -EINVAL; - speedstep_set_state(newstate, 1); + freqs.old = speedstep_freqs[speedstep_get_state()].frequency; + freqs.new = speedstep_freqs[newstate].frequency; + freqs.cpu = 0; /* speedstep.c is UP only driver */ + + if (freqs.old == freqs.new) + return 0; + + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + speedstep_set_state(newstate); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); return 0; } diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index d9c97dae4..aafc78898 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c @@ -546,15 +546,21 @@ static __init int ignore_timer_override(struct dmi_blacklist *d) #ifdef CONFIG_ACPI_PCI static __init int disable_acpi_irq(struct dmi_blacklist *d) -{ - printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n", d->ident); - acpi_noirq_set(); +{ + if (!acpi_force) { + printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n", + d->ident); + acpi_noirq_set(); + } return 0; } static __init int disable_acpi_pci(struct dmi_blacklist *d) -{ - printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n", d->ident); - acpi_disable_pci(); +{ + if (!acpi_force) { + printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n", + d->ident); + acpi_disable_pci(); + } return 0; } #endif diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c index 33bd6a351..fd4988dcc 100644 --- a/arch/i386/kernel/efi.c +++ b/arch/i386/kernel/efi.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #define EFI_DEBUG 0 diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c index 2df68a3bb..2bc9aae72 100644 --- a/arch/i386/kernel/i386_ksyms.c +++ b/arch/i386/kernel/i386_ksyms.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c index 0be8d6b87..92061fd4c 100644 --- a/arch/i386/kernel/i8259.c +++ b/arch/i386/kernel/i8259.c @@ -317,16 +317,11 @@ void init_8259A(int auto_eoi) * be shot. */ -/* - * =PC9800NOTE= In NEC PC-9800, we use irq8 instead of irq13! - */ static irqreturn_t math_error_irq(int cpl, void *dev_id, struct pt_regs *regs) { extern void math_error(void *); -#ifndef CONFIG_X86_PC9800 outb(0,0xF0); -#endif if (ignore_fpu_irq || !boot_cpu_data.hard_math) return IRQ_NONE; math_error((void *)regs->eip); diff --git a/arch/i386/kernel/init_task.c b/arch/i386/kernel/init_task.c index dfe1a1e3a..7422d73ee 100644 --- a/arch/i386/kernel/init_task.c +++ b/arch/i386/kernel/init_task.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 3ea997f30..70f329ed6 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -41,10 +41,6 @@ #include "io_ports.h" -#undef APIC_LOCKUP_DEBUG - -#define APIC_LOCKUP_DEBUG - static spinlock_t ioapic_lock = SPIN_LOCK_UNLOCKED; /* @@ -127,83 +123,47 @@ static void __init replace_pin_at_irq(unsigned int irq, } } -/* mask = 1 */ -static void __mask_IO_APIC_irq (unsigned int irq) +static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsigned long disable) { - int pin; struct irq_pin_list *entry = irq_2_pin + irq; + unsigned int pin, reg; for (;;) { - unsigned int reg; pin = entry->pin; if (pin == -1) break; reg = io_apic_read(entry->apic, 0x10 + pin*2); - io_apic_modify(entry->apic, 0x10 + pin*2, reg |= 0x00010000); + reg &= ~disable; + reg |= enable; + io_apic_modify(entry->apic, 0x10 + pin*2, reg); if (!entry->next) break; entry = irq_2_pin + entry->next; } - io_apic_sync(entry->apic); +} + +/* mask = 1 */ +static void __mask_IO_APIC_irq (unsigned int irq) +{ + __modify_IO_APIC_irq(irq, 0x00010000, 0); } /* mask = 0 */ static void __unmask_IO_APIC_irq (unsigned int irq) { - int pin; - struct irq_pin_list *entry = irq_2_pin + irq; - - for (;;) { - unsigned int reg; - pin = entry->pin; - if (pin == -1) - break; - reg = io_apic_read(entry->apic, 0x10 + pin*2); - io_apic_modify(entry->apic, 0x10 + pin*2, reg &= 0xfffeffff); - if (!entry->next) - break; - entry = irq_2_pin + entry->next; - } + __modify_IO_APIC_irq(irq, 0, 0x00010000); } /* mask = 1, trigger = 0 */ static void __mask_and_edge_IO_APIC_irq (unsigned int irq) { - int pin; - struct irq_pin_list *entry = irq_2_pin + irq; - - for (;;) { - unsigned int reg; - pin = entry->pin; - if (pin == -1) - break; - reg = io_apic_read(entry->apic, 0x10 + pin*2); - reg = (reg & 0xffff7fff) | 0x00010000; - io_apic_modify(entry->apic, 0x10 + pin*2, reg); - if (!entry->next) - break; - entry = irq_2_pin + entry->next; - } + __modify_IO_APIC_irq(irq, 0x00010000, 0x00008000); } /* mask = 0, trigger = 1 */ static void __unmask_and_level_IO_APIC_irq (unsigned int irq) { - int pin; - struct irq_pin_list *entry = irq_2_pin + irq; - - for (;;) { - unsigned int reg; - pin = entry->pin; - if (pin == -1) - break; - reg = io_apic_read(entry->apic, 0x10 + pin*2); - reg = (reg & 0xfffeffff) | 0x00008000; - io_apic_modify(entry->apic, 0x10 + pin*2, reg); - if (!entry->next) - break; - entry = irq_2_pin + entry->next; - } + __modify_IO_APIC_irq(irq, 0x00008000, 0x00010000); } static void mask_IO_APIC_irq (unsigned int irq) @@ -1366,7 +1326,7 @@ void __init print_IO_APIC(void) printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); printk(KERN_DEBUG "....... : LTS : %X\n", reg_00.bits.LTS); - if (reg_00.bits.ID >= APIC_BROADCAST_ID) + if (reg_00.bits.ID >= get_physical_broadcast()) UNEXPECTED_IO_APIC(); if (reg_00.bits.__reserved_1 || reg_00.bits.__reserved_2) UNEXPECTED_IO_APIC(); @@ -1682,7 +1642,7 @@ static void __init setup_ioapic_ids_from_mpc(void) old_id = mp_ioapics[apic].mpc_apicid; - if (mp_ioapics[apic].mpc_apicid >= APIC_BROADCAST_ID) { + if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) { printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", apic, mp_ioapics[apic].mpc_apicid); printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", @@ -1703,10 +1663,10 @@ static void __init setup_ioapic_ids_from_mpc(void) mp_ioapics[apic].mpc_apicid)) { printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", apic, mp_ioapics[apic].mpc_apicid); - for (i = 0; i < APIC_BROADCAST_ID; i++) + for (i = 0; i < get_physical_broadcast(); i++) if (!physid_isset(i, phys_id_present_map)) break; - if (i >= APIC_BROADCAST_ID) + if (i >= get_physical_broadcast()) panic("Max APIC ID exceeded!\n"); printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", i); @@ -1893,30 +1853,11 @@ static void end_level_ioapic_irq (unsigned int irq) ack_APIC_irq(); if (!(v & (1 << (i & 0x1f)))) { -#ifdef APIC_LOCKUP_DEBUG - struct irq_pin_list *entry; -#endif - #ifdef APIC_MISMATCH_DEBUG atomic_inc(&irq_mis_count); #endif spin_lock(&ioapic_lock); __mask_and_edge_IO_APIC_irq(irq); -#ifdef APIC_LOCKUP_DEBUG - for (entry = irq_2_pin + irq;;) { - unsigned int reg; - - if (entry->pin == -1) - break; - reg = io_apic_read(entry->apic, 0x10 + entry->pin * 2); - if (reg & 0x00004000) - printk(KERN_CRIT "Aieee!!! Remote IRR" - " still set after unlock!\n"); - if (!entry->next) - break; - entry = irq_2_pin + entry->next; - } -#endif __unmask_and_level_IO_APIC_irq(irq); spin_unlock(&ioapic_lock); } @@ -2322,8 +2263,6 @@ late_initcall(io_apic_bug_finalize); #ifdef CONFIG_ACPI_BOOT -#define IO_APIC_MAX_ID APIC_BROADCAST_ID - int __init io_apic_get_unique_id (int ioapic, int apic_id) { union IO_APIC_reg_00 reg_00; @@ -2348,7 +2287,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id) reg_00.raw = io_apic_read(ioapic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); - if (apic_id >= IO_APIC_MAX_ID) { + if (apic_id >= get_physical_broadcast()) { printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " "%d\n", ioapic, apic_id, reg_00.bits.ID); apic_id = reg_00.bits.ID; @@ -2360,12 +2299,12 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id) */ if (check_apicid_used(apic_id_map, apic_id)) { - for (i = 0; i < IO_APIC_MAX_ID; i++) { + for (i = 0; i < get_physical_broadcast(); i++) { if (!check_apicid_used(apic_id_map, i)) break; } - if (i == IO_APIC_MAX_ID) + if (i == get_physical_broadcast()) panic("Max apic_id exceeded!\n"); printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index d57a137e3..2f4963949 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -241,6 +240,7 @@ static void __report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret) irq, action_ret); } else { printk(KERN_ERR "irq %d: nobody cared! (screaming interrupt?)\n", irq); + printk(KERN_ERR "irq %d: Please try booting with acpi=off and report a bug\n", irq); } dump_stack(); printk(KERN_ERR "handlers:\n"); diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 55e4c29a3..51a750849 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -23,12 +23,12 @@ #include #include #include +#include #include #include #include #include -#include #include #include @@ -104,6 +104,21 @@ static int __init mpf_checksum(unsigned char *mp, int len) static int mpc_record; static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; +#ifdef CONFIG_X86_NUMAQ +static int MP_valid_apicid(int apicid, int version) +{ + return hweight_long(apicid & 0xf) == 1 && (apicid >> 4) != 0xf; +} +#else +static int MP_valid_apicid(int apicid, int version) +{ + if (version >= 0x14) + return apicid < 0xff; + else + return apicid < 0xf; +} +#endif + void __init MP_processor_info (struct mpc_config_processor *m) { int ver, apicid; @@ -180,14 +195,14 @@ void __init MP_processor_info (struct mpc_config_processor *m) return; } num_processors++; + ver = m->mpc_apicver; - if (MAX_APICS - m->mpc_apicid <= 0) { + if (!MP_valid_apicid(apicid, ver)) { printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n", m->mpc_apicid, MAX_APICS); --num_processors; return; } - ver = m->mpc_apicver; tmp = apicid_to_cpu_present(apicid); physids_or(phys_cpu_present_map, phys_cpu_present_map, tmp); @@ -844,7 +859,7 @@ void __init mp_register_lapic ( MP_processor_info(&processor); } -#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) +#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) #define MP_ISA_BUS 0 #define MP_MAX_IOAPIC_PIN 127 @@ -857,7 +872,7 @@ struct mp_ioapic_routing { } mp_ioapic_routing[MAX_IO_APICS]; -static int __init mp_find_ioapic ( +static int mp_find_ioapic ( int gsi) { int i = 0; @@ -1002,6 +1017,7 @@ void __init mp_config_acpi_legacy_irqs (void) for (idx = 0; idx < mp_irq_entries; idx++) if (mp_irqs[idx].mpc_srcbus == MP_ISA_BUS && + (mp_irqs[idx].mpc_dstapic == ioapic) && (mp_irqs[idx].mpc_srcbusirq == i || mp_irqs[idx].mpc_dstirq == i)) break; @@ -1025,96 +1041,56 @@ void __init mp_config_acpi_legacy_irqs (void) } } -extern FADT_DESCRIPTOR acpi_fadt; - -#ifdef CONFIG_ACPI_PCI - int (*platform_rename_gsi)(int ioapic, int gsi); -void __init mp_parse_prt (void) +void mp_register_gsi (u32 gsi, int edge_level, int active_high_low) { - struct list_head *node = NULL; - struct acpi_prt_entry *entry = NULL; int ioapic = -1; int ioapic_pin = 0; - int gsi = 0; int idx, bit = 0; - int edge_level = 0; - int active_high_low = 0; - /* - * Parsing through the PCI Interrupt Routing Table (PRT) and program - * routing for all entries. - */ - list_for_each(node, &acpi_prt.entries) { - entry = list_entry(node, struct acpi_prt_entry, node); - - /* Need to get gsi for dynamic entry */ - if (entry->link.handle) { - gsi = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); - if (!gsi) - continue; - } - else { - /* Hardwired GSI. Assume PCI standard settings */ - gsi = entry->link.index; - edge_level = 1; - active_high_low = 1; - } +#ifdef CONFIG_ACPI_BUS + /* Don't set up the ACPI SCI because it's already set up */ + if (acpi_fadt.sci_int == gsi) + return; +#endif - /* Don't set up the ACPI SCI because it's already set up */ - if (acpi_fadt.sci_int == gsi) { - /* we still need to set entry's irq */ - acpi_gsi_to_irq(gsi, &entry->irq); - continue; - } - - ioapic = mp_find_ioapic(gsi); - if (ioapic < 0) - continue; - ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; - - if (platform_rename_gsi) - gsi = platform_rename_gsi(ioapic, gsi); - - /* - * Avoid pin reprogramming. PRTs typically include entries - * with redundant pin->gsi mappings (but unique PCI devices); - * we only only program the IOAPIC on the first. - */ - bit = ioapic_pin % 32; - idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); - if (idx > 3) { - printk(KERN_ERR "Invalid reference to IOAPIC pin " - "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, - ioapic_pin); - continue; - } - if ((1<irq); - continue; - } + ioapic = mp_find_ioapic(gsi); + if (ioapic < 0) { + printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi); + return; + } - mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<irq); - } - printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d %s %s\n", - entry->id.segment, entry->id.bus, - entry->id.device, ('A' + entry->pin), - mp_ioapic_routing[ioapic].apic_id, ioapic_pin, - entry->irq, edge_level ? "level" : "edge", - active_high_low ? "low" : "high"); + if (platform_rename_gsi) + gsi = platform_rename_gsi(ioapic, gsi); + + /* + * Avoid pin reprogramming. PRTs typically include entries + * with redundant pin->gsi mappings (but unique PCI devices); + * we only program the IOAPIC on the first. + */ + bit = ioapic_pin % 32; + idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); + if (idx > 3) { + printk(KERN_ERR "Invalid reference to IOAPIC pin " + "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, + ioapic_pin); + return; + } + if ((1< 1) printk("WARNING: polling idle and HT enabled, performance may degrade.\n"); #endif diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 76f34d082..95e9fa75e 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include "setup_arch_pre.h" /* This value is set up by the early boot code to point to the value @@ -133,8 +133,203 @@ static char command_line[COMMAND_LINE_SIZE]; unsigned char __initdata boot_params[PARAM_SIZE]; -static struct resource code_resource = { "Kernel code", 0x100000, 0 }; -static struct resource data_resource = { "Kernel data", 0, 0 }; +static struct resource data_resource = { + .name = "Kernel data", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource code_resource = { + .name = "Kernel code", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource system_rom_resource = { + .name = "System ROM", + .start = 0xf0000, + .end = 0xfffff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; + +static struct resource extension_rom_resource = { + .name = "Extension ROM", + .start = 0xe0000, + .end = 0xeffff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; + +static struct resource adapter_rom_resources[] = { { + .name = "Adapter ROM", + .start = 0xc8000, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}, { + .name = "Adapter ROM", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +} }; + +#define ADAPTER_ROM_RESOURCES \ + (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0]) + +static struct resource video_rom_resource = { + .name = "Video ROM", + .start = 0xc0000, + .end = 0xc7fff, + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM +}; + +static struct resource video_ram_resource = { + .name = "Video RAM area", + .start = 0xa0000, + .end = 0xbffff, + .flags = IORESOURCE_BUSY | IORESOURCE_MEM +}; + +static struct resource standard_io_resources[] = { { + .name = "dma1", + .start = 0x0000, + .end = 0x001f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "pic1", + .start = 0x0020, + .end = 0x0021, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "timer", + .start = 0x0040, + .end = 0x005f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "keyboard", + .start = 0x0060, + .end = 0x006f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "dma page reg", + .start = 0x0080, + .end = 0x008f, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "pic2", + .start = 0x00a0, + .end = 0x00a1, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "dma2", + .start = 0x00c0, + .end = 0x00df, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +}, { + .name = "fpu", + .start = 0x00f0, + .end = 0x00ff, + .flags = IORESOURCE_BUSY | IORESOURCE_IO +} }; + +#define STANDARD_IO_RESOURCES \ + (sizeof standard_io_resources / sizeof standard_io_resources[0]) + +#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) + +static int __init romchecksum(unsigned char *rom, unsigned long length) +{ + unsigned char *p, sum = 0; + + for (p = rom; p < rom + length; p++) + sum += *p; + return sum == 0; +} + +static void __init probe_roms(void) +{ + unsigned long start, length, upper; + unsigned char *rom; + int i; + + /* video rom */ + upper = adapter_rom_resources[0].start; + for (start = video_rom_resource.start; start < upper; start += 2048) { + rom = isa_bus_to_virt(start); + if (!romsignature(rom)) + continue; + + video_rom_resource.start = start; + + /* 0 < length <= 0x7f * 512, historically */ + length = rom[2] * 512; + + /* if checksum okay, trust length byte */ + if (length && romchecksum(rom, length)) + video_rom_resource.end = start + length - 1; + + request_resource(&iomem_resource, &video_rom_resource); + break; + } + + start = (video_rom_resource.end + 1 + 2047) & ~2047UL; + if (start < upper) + start = upper; + + /* system rom */ + request_resource(&iomem_resource, &system_rom_resource); + upper = system_rom_resource.start; + + /* check for extension rom (ignore length byte!) */ + rom = isa_bus_to_virt(extension_rom_resource.start); + if (romsignature(rom)) { + length = extension_rom_resource.end - extension_rom_resource.start + 1; + if (romchecksum(rom, length)) { + request_resource(&iomem_resource, &extension_rom_resource); + upper = extension_rom_resource.start; + } + } + + /* check for adapter roms on 2k boundaries */ + for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { + rom = isa_bus_to_virt(start); + if (!romsignature(rom)) + continue; + + /* 0 < length <= 0x7f * 512, historically */ + length = rom[2] * 512; + + /* but accept any length that fits if checksum okay */ + if (!length || start + length > upper || !romchecksum(rom, length)) + continue; + + adapter_rom_resources[i].start = start; + adapter_rom_resources[i].end = start + length - 1; + request_resource(&iomem_resource, &adapter_rom_resources[i]); + + start = adapter_rom_resources[i++].end & ~2047UL; + } +} static void __init limit_regions(unsigned long long size) { @@ -948,6 +1143,7 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat static void __init register_memory(unsigned long max_low_pfn) { unsigned long low_mem_size; + int i; if (efi_enabled) efi_initialize_iomem_resources(&code_resource, &data_resource); @@ -955,10 +1151,11 @@ static void __init register_memory(unsigned long max_low_pfn) legacy_init_iomem_resources(&code_resource, &data_resource); /* EFI systems may still have VGA */ - request_graphics_resource(); + request_resource(&iomem_resource, &video_ram_resource); /* request I/O space for devices used on all i[345]86 PCs */ - request_standard_io_resources(); + for (i = 0; i < STANDARD_IO_RESOURCES; i++) + request_resource(&ioport_resource, &standard_io_resources[i]); /* Tell the PCI layer not to allocate too close to the RAM area.. */ low_mem_size = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff; diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c index 3c50ed275..1667d9999 100644 --- a/arch/i386/kernel/signal.c +++ b/arch/i386/kernel/signal.c @@ -56,16 +56,15 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask) } asmlinkage int -sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) +sys_rt_sigsuspend(struct pt_regs regs) { - struct pt_regs * regs = (struct pt_regs *) &unewset; sigset_t saveset, newset; /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) + if (regs.ecx != sizeof(sigset_t)) return -EINVAL; - if (copy_from_user(&newset, unewset, sizeof(newset))) + if (copy_from_user(&newset, (sigset_t __user *)regs.ebx, sizeof(newset))) return -EFAULT; sigdelsetmask(&newset, ~_BLOCKABLE); @@ -75,11 +74,11 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - regs->eax = -EINTR; + regs.eax = -EINTR; while (1) { current->state = TASK_INTERRUPTIBLE; schedule(); - if (do_signal(regs, &saveset)) + if (do_signal(®s, &saveset)) return -EINTR; } } @@ -117,10 +116,11 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, } asmlinkage int -sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) +sys_sigaltstack(struct pt_regs regs) { - struct pt_regs *regs = (struct pt_regs *) &uss; - return do_sigaltstack(uss, uoss, regs->esp); + const stack_t __user *uss = (const stack_t __user *)regs.ebx; + stack_t __user *uoss = (stack_t __user *)regs.ecx; + return do_sigaltstack(uss, uoss, regs.esp); } diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c index afd92719d..13c171432 100644 --- a/arch/i386/kernel/smp.c +++ b/arch/i386/kernel/smp.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 45e8fbab3..c3fa2538a 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -47,7 +47,6 @@ #include #include -#include #include #include #include diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c index a281711ec..25a6a89af 100644 --- a/arch/i386/kernel/time_hpet.c +++ b/arch/i386/kernel/time_hpet.c @@ -21,6 +21,7 @@ #include #include +#include unsigned long hpet_period; /* fsecs / HPET clock */ unsigned long hpet_tick; /* hpet clks count per tick */ @@ -135,6 +136,51 @@ int __init hpet_enable(void) hpet_writel(cfg, HPET_CFG); use_hpet = 1; + +#ifdef CONFIG_HPET + { + struct hpet_data hd; + unsigned int ntimer; + + memset(&hd, 0, sizeof (hd)); + + ntimer = hpet_readl(HPET_ID); + ntimer = (ntimer & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT; + ntimer++; + + /* + * Register with driver. + * Timer0 and Timer1 is used by platform. + */ + hd.hd_address = hpet_virt_address; + hd.hd_nirqs = ntimer; + hd.hd_flags = HPET_DATA_PLATFORM; +#ifndef CONFIG_HPET_EMULATE_RTC + hd.hd_state = 0x1; +#else + hd.hd_state = 0x3; +#endif + hd.hd_irq[0] = HPET_LEGACY_8254; + hd.hd_irq[1] = HPET_LEGACY_RTC; + if (ntimer > 2) { + struct hpet *hpet; + struct hpet_timer *timer; + int i; + + hpet = (struct hpet *) hpet_virt_address; + + for (i = 2, timer = &hpet->hpet_timers[2]; i < ntimer; + timer++, i++) + hd.hd_irq[i] = (timer->hpet_config & + Tn_INT_ROUTE_CNF_MASK) >> + Tn_INT_ROUTE_CNF_SHIFT; + + } + + hpet_alloc(&hd); + } +#endif + #ifdef CONFIG_X86_LOCAL_APIC wait_timer_tick = wait_hpet_tick; #endif diff --git a/arch/i386/kernel/timers/timer_cyclone.c b/arch/i386/kernel/timers/timer_cyclone.c index 9f80757d1..34f1f3d1c 100644 --- a/arch/i386/kernel/timers/timer_cyclone.c +++ b/arch/i386/kernel/timers/timer_cyclone.c @@ -17,6 +17,7 @@ #include #include #include +#include "io_ports.h" extern spinlock_t i8253_lock; @@ -62,6 +63,17 @@ static void mark_offset_cyclone(void) count = inb_p(0x40); /* read the latched count */ count |= inb(0x40) << 8; + + /* + * VIA686a test code... reset the latch if count > max + 1 + * from timer_pit.c - cjb + */ + if (count > LATCH) { + outb_p(0x34, PIT_MODE); + outb_p(LATCH & 0xff, PIT_CH0); + outb(LATCH >> 8, PIT_CH0); + count = LATCH - 1; + } spin_unlock(&i8253_lock); /* lost tick compensation */ diff --git a/arch/i386/kernel/timers/timer_pm.c b/arch/i386/kernel/timers/timer_pm.c index 7aa63c9b8..737a0219d 100644 --- a/arch/i386/kernel/timers/timer_pm.c +++ b/arch/i386/kernel/timers/timer_pm.c @@ -21,6 +21,14 @@ #include #include +#include +#include "mach_timer.h" + +/* Number of PMTMR ticks expected during calibration run */ +#define PMTMR_TICKS_PER_SEC 3579545 +#define PMTMR_EXPECTED_RATE \ + ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10)) + /* The I/O port the PMTMR resides at. * The location is detected during setup_arch(), @@ -57,6 +65,33 @@ static inline u32 read_pmtmr(void) return v2 & ACPI_PM_MASK; } + +/* + * Some boards have the PMTMR running way too fast. We check + * the PMTMR rate against PIT channel 2 to catch these cases. + */ +static int verify_pmtmr_rate(void) +{ + u32 value1, value2; + unsigned long count, delta; + + mach_prepare_counter(); + value1 = read_pmtmr(); + mach_countup(&count); + value2 = read_pmtmr(); + delta = (value2 - value1) & ACPI_PM_MASK; + + /* Check that the PMTMR delta is within 5% of what we expect */ + if (delta < (PMTMR_EXPECTED_RATE * 19) / 20 || + delta > (PMTMR_EXPECTED_RATE * 21) / 20) { + printk(KERN_INFO "PM-Timer running at invalid rate: %lu%% of normal - aborting.\n", 100UL * delta / PMTMR_EXPECTED_RATE); + return -1; + } + + return 0; +} + + static int init_pmtmr(char* override) { u32 value1, value2; @@ -89,6 +124,9 @@ static int init_pmtmr(char* override) return -ENODEV; pm_good: + if (verify_pmtmr_rate() != 0) + return -ENODEV; + init_cpu_khz(); return 0; } diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index ae775d4cf..3d08b2d9c 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -47,7 +47,6 @@ #include #include -#include #include #include @@ -159,7 +158,6 @@ void show_trace(struct task_struct *task, unsigned long * stack) break; printk(" =======================\n"); } - printk("\n"); } void show_stack(struct task_struct *task, unsigned long *esp) @@ -279,7 +277,7 @@ static void handle_BUG(struct pt_regs *regs) file = ""; printk("------------[ cut here ]------------\n"); - printk("kernel BUG at %s:%d!\n", file, line); + printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); no_bug: return; @@ -300,7 +298,7 @@ void die(const char * str, struct pt_regs * regs, long err) spin_lock_irq(&die_lock); bust_spinlocks(1); handle_BUG(regs); - printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); + printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); #ifdef CONFIG_PREEMPT printk("PREEMPT "); nl = 1; diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c index e0e3bdfe2..bd8f958ef 100644 --- a/arch/i386/kernel/vm86.c +++ b/arch/i386/kernel/vm86.c @@ -44,7 +44,6 @@ #include #include -#include #include #include #include @@ -178,8 +177,9 @@ out: static int do_vm86_irq_handling(int subfunction, int irqnumber); static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); -asmlinkage int sys_vm86old(struct vm86_struct __user * v86) +asmlinkage int sys_vm86old(struct pt_regs regs) { + struct vm86_struct __user *v86 = (struct vm86_struct __user *)regs.ebx; struct kernel_vm86_struct info; /* declare this _on top_, * this avoids wasting of stack space. * This remains on the stack until we @@ -198,7 +198,7 @@ asmlinkage int sys_vm86old(struct vm86_struct __user * v86) if (tmp) goto out; memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus); - info.regs32 = (struct pt_regs *) &v86; + info.regs32 = ®s; tsk->thread.vm86_info = v86; do_sys_vm86(&info, tsk); ret = 0; /* we never return here */ @@ -207,7 +207,7 @@ out: } -asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct __user * v86) +asmlinkage int sys_vm86(struct pt_regs regs) { struct kernel_vm86_struct info; /* declare this _on top_, * this avoids wasting of stack space. @@ -216,14 +216,15 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct __user */ struct task_struct *tsk; int tmp, ret; + struct vm86plus_struct __user *v86; tsk = current; - switch (subfunction) { + switch (regs.ebx) { case VM86_REQUEST_IRQ: case VM86_FREE_IRQ: case VM86_GET_IRQ_BITS: case VM86_GET_AND_RESET_IRQ: - ret = do_vm86_irq_handling(subfunction,(int)v86); + ret = do_vm86_irq_handling(regs.ebx, (int)regs.ecx); goto out; case VM86_PLUS_INSTALL_CHECK: /* NOTE: on old vm86 stuff this will return the error @@ -239,13 +240,14 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct __user ret = -EPERM; if (tsk->thread.saved_esp0) goto out; + v86 = (struct vm86plus_struct __user *)regs.ecx; tmp = copy_from_user(&info, v86, VM86_REGS_SIZE1); tmp += copy_from_user(&info.regs.VM86_REGS_PART2, &v86->regs.VM86_REGS_PART2, (long)&info.regs32 - (long)&info.regs.VM86_REGS_PART2); ret = -EFAULT; if (tmp) goto out; - info.regs32 = (struct pt_regs *) &subfunction; + info.regs32 = ®s; info.vm86plus.is_vm86pus = 1; tsk->thread.vm86_info = (struct vm86_struct __user *)v86; do_sys_vm86(&info, tsk); @@ -486,9 +488,10 @@ static inline int is_revectored(int nr, struct revectored_struct * bitmap) * in userspace is always better than an Oops anyway.) [KD] */ static void do_int(struct kernel_vm86_regs *regs, int i, - unsigned char * ssp, unsigned short sp) + unsigned char __user * ssp, unsigned short sp) { - unsigned long *intr_ptr, segoffs; + unsigned long __user *intr_ptr; + unsigned long segoffs; if (regs->cs == BIOSSEG) goto cannot_handle; @@ -496,7 +499,7 @@ static void do_int(struct kernel_vm86_regs *regs, int i, goto cannot_handle; if (i==0x21 && is_revectored(AH(regs),&KVM86->int21_revectored)) goto cannot_handle; - intr_ptr = (unsigned long *) (i << 2); + intr_ptr = (unsigned long __user *) (i << 2); if (get_user(segoffs, intr_ptr)) goto cannot_handle; if ((segoffs >> 16) == BIOSSEG) @@ -521,7 +524,7 @@ int handle_vm86_trap(struct kernel_vm86_regs * regs, long error_code, int trapno if (VMPI.is_vm86pus) { if ( (trapno==3) || (trapno==1) ) return_to_32bit(regs, VM86_TRAP + (trapno << 8)); - do_int(regs, trapno, (unsigned char *) (regs->ss << 4), SP(regs)); + do_int(regs, trapno, (unsigned char __user *) (regs->ss << 4), SP(regs)); return 0; } if (trapno !=1) @@ -541,7 +544,9 @@ int handle_vm86_trap(struct kernel_vm86_regs * regs, long error_code, int trapno void handle_vm86_fault(struct kernel_vm86_regs * regs, long error_code) { - unsigned char *csp, *ssp, opcode; + unsigned char opcode; + unsigned char __user *csp; + unsigned char __user *ssp; unsigned short ip, sp; int data32, pref_done; @@ -553,8 +558,8 @@ void handle_vm86_fault(struct kernel_vm86_regs * regs, long error_code) return_to_32bit(regs, VM86_PICRETURN); \ return; } while (0) - csp = (unsigned char *) (regs->cs << 4); - ssp = (unsigned char *) (regs->ss << 4); + csp = (unsigned char __user *) (regs->cs << 4); + ssp = (unsigned char __user *) (regs->ss << 4); sp = SP(regs); ip = IP(regs); diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index 518cebc21..135484329 100644 --- a/arch/i386/lib/Makefile +++ b/arch/i386/lib/Makefile @@ -3,9 +3,8 @@ # -lib-y = checksum.o delay.o \ - usercopy.o getuser.o \ - memcpy.o strstr.o +lib-y = checksum.o delay.o usercopy.o getuser.o memcpy.o strstr.o \ + bitops.o lib-$(CONFIG_X86_USE_3DNOW) += mmx.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff --git a/arch/i386/lib/delay.c b/arch/i386/lib/delay.c index 028dd9bbd..97b97af9c 100644 --- a/arch/i386/lib/delay.c +++ b/arch/i386/lib/delay.c @@ -31,15 +31,16 @@ void __delay(unsigned long loops) inline void __const_udelay(unsigned long xloops) { int d0; + xloops *= 4; __asm__("mull %0" :"=d" (xloops), "=&a" (d0) - :"1" (xloops),"0" (current_cpu_data.loops_per_jiffy)); - __delay(xloops * HZ); + :"1" (xloops),"0" (current_cpu_data.loops_per_jiffy * (HZ/4))); + __delay(++xloops); } void __udelay(unsigned long usecs) { - __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */ + __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ } void __ndelay(unsigned long nsecs) diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c index 70db26443..784576c53 100644 --- a/arch/i386/mach-es7000/es7000plat.c +++ b/arch/i386/mach-es7000/es7000plat.c @@ -50,7 +50,6 @@ struct mip_reg *mip_reg; struct mip_reg *host_reg; int mip_port; unsigned long mip_addr, host_addr; -extern int (*platform_rename_gsi)(); static int __init es7000_rename_gsi(int ioapic, int gsi) @@ -134,7 +133,6 @@ parse_unisys_oem (char *oemptr, int oem_entries) } if (success < 2) { - printk("\nNo ES7000 found.\n"); es7000_plat = 0; } else { printk("\nEnabling ES7000 specific features...\n"); diff --git a/arch/i386/mach-visws/mpparse.c b/arch/i386/mach-visws/mpparse.c index dd1525aa5..fa800641a 100644 --- a/arch/i386/mach-visws/mpparse.c +++ b/arch/i386/mach-visws/mpparse.c @@ -57,12 +57,12 @@ void __init MP_processor_info (struct mpc_config_processor *m) boot_cpu_logical_apicid = logical_apicid; } - if (m->mpc_apicid > MAX_APICS) { + ver = m->mpc_apicver; + if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) { printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", m->mpc_apicid, MAX_APICS); return; } - ver = m->mpc_apicver; apic_cpus = apicid_to_cpu_present(m->mpc_apicid); physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus); diff --git a/arch/i386/mach-visws/traps.c b/arch/i386/mach-visws/traps.c index a3c22c093..964353992 100644 --- a/arch/i386/mach-visws/traps.c +++ b/arch/i386/mach-visws/traps.c @@ -8,7 +8,6 @@ #include #include -#include #include #include #include "cobalt.h" diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c index 528bc8f8d..61a481423 100644 --- a/arch/i386/mach-voyager/voyager_basic.c +++ b/arch/i386/mach-voyager/voyager_basic.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c index 2bdc18fff..b99561d19 100644 --- a/arch/i386/mach-voyager/voyager_smp.c +++ b/arch/i386/mach-voyager/voyager_smp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c index b091fcf01..9980eef31 100644 --- a/arch/i386/mach-voyager/voyager_thread.c +++ b/arch/i386/mach-voyager/voyager_thread.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/arch/i386/math-emu/errors.c b/arch/i386/math-emu/errors.c index 486154541..f755641cf 100644 --- a/arch/i386/math-emu/errors.c +++ b/arch/i386/math-emu/errors.c @@ -41,18 +41,18 @@ void Un_impl(void) RE_ENTRANT_CHECK_OFF; /* No need to verify_area(), we have previously fetched these bytes. */ - printk("Unimplemented FPU Opcode at eip=%p : ", (void *) address); + printk("Unimplemented FPU Opcode at eip=%p : ", (void __user *) address); if ( FPU_CS == __USER_CS ) { while ( 1 ) { - FPU_get_user(byte1, (u_char *) address); + FPU_get_user(byte1, (u_char __user *) address); if ( (byte1 & 0xf8) == 0xd8 ) break; printk("[%02x]", byte1); address++; } printk("%02x ", byte1); - FPU_get_user(FPU_modrm, 1 + (u_char *) address); + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address); if (FPU_modrm >= 0300) printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7); @@ -98,7 +98,7 @@ void FPU_printall(void) #define MAX_PRINTED_BYTES 20 for ( i = 0; i < MAX_PRINTED_BYTES; i++ ) { - FPU_get_user(byte1, (u_char *) address); + FPU_get_user(byte1, (u_char __user *) address); if ( (byte1 & 0xf8) == 0xd8 ) { printk(" %02x", byte1); @@ -111,7 +111,7 @@ void FPU_printall(void) printk(" [more..]\n"); else { - FPU_get_user(FPU_modrm, 1 + (u_char *) address); + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address); if (FPU_modrm >= 0300) printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7); diff --git a/arch/i386/math-emu/fpu_arith.c b/arch/i386/math-emu/fpu_arith.c index fcad7ec08..6972dec01 100644 --- a/arch/i386/math-emu/fpu_arith.c +++ b/arch/i386/math-emu/fpu_arith.c @@ -16,7 +16,7 @@ #include "status_w.h" -void fadd__() +void fadd__(void) { /* fadd st,st(i) */ int i = FPU_rm; @@ -25,7 +25,7 @@ void fadd__() } -void fmul__() +void fmul__(void) { /* fmul st,st(i) */ int i = FPU_rm; @@ -35,7 +35,7 @@ void fmul__() -void fsub__() +void fsub__(void) { /* fsub st,st(i) */ clear_C1(); @@ -43,7 +43,7 @@ void fsub__() } -void fsubr_() +void fsubr_(void) { /* fsubr st,st(i) */ clear_C1(); @@ -51,7 +51,7 @@ void fsubr_() } -void fdiv__() +void fdiv__(void) { /* fdiv st,st(i) */ clear_C1(); @@ -59,7 +59,7 @@ void fdiv__() } -void fdivr_() +void fdivr_(void) { /* fdivr st,st(i) */ clear_C1(); @@ -68,7 +68,7 @@ void fdivr_() -void fadd_i() +void fadd_i(void) { /* fadd st(i),st */ int i = FPU_rm; @@ -77,7 +77,7 @@ void fadd_i() } -void fmul_i() +void fmul_i(void) { /* fmul st(i),st */ clear_C1(); @@ -85,7 +85,7 @@ void fmul_i() } -void fsubri() +void fsubri(void) { /* fsubr st(i),st */ clear_C1(); @@ -93,7 +93,7 @@ void fsubri() } -void fsub_i() +void fsub_i(void) { /* fsub st(i),st */ clear_C1(); @@ -101,7 +101,7 @@ void fsub_i() } -void fdivri() +void fdivri(void) { /* fdivr st(i),st */ clear_C1(); @@ -109,7 +109,7 @@ void fdivri() } -void fdiv_i() +void fdiv_i(void) { /* fdiv st(i),st */ clear_C1(); @@ -118,7 +118,7 @@ void fdiv_i() -void faddp_() +void faddp_(void) { /* faddp st(i),st */ int i = FPU_rm; @@ -128,7 +128,7 @@ void faddp_() } -void fmulp_() +void fmulp_(void) { /* fmulp st(i),st */ clear_C1(); @@ -138,7 +138,7 @@ void fmulp_() -void fsubrp() +void fsubrp(void) { /* fsubrp st(i),st */ clear_C1(); @@ -147,7 +147,7 @@ void fsubrp() } -void fsubp_() +void fsubp_(void) { /* fsubp st(i),st */ clear_C1(); @@ -156,7 +156,7 @@ void fsubp_() } -void fdivrp() +void fdivrp(void) { /* fdivrp st(i),st */ clear_C1(); @@ -165,7 +165,7 @@ void fdivrp() } -void fdivp_() +void fdivp_(void) { /* fdivp st(i),st */ clear_C1(); diff --git a/arch/i386/math-emu/fpu_aux.c b/arch/i386/math-emu/fpu_aux.c index 112c173f2..0251b2c6b 100644 --- a/arch/i386/math-emu/fpu_aux.c +++ b/arch/i386/math-emu/fpu_aux.c @@ -30,7 +30,7 @@ void fclex(void) } /* Needs to be externally visible */ -void finit() +void finit(void) { control_word = 0x037f; partial_status = 0; @@ -58,7 +58,7 @@ static FUNC const finit_table[] = { fsetpm, FPU_illegal, FPU_illegal, FPU_illegal }; -void finit_() +void finit_(void) { (finit_table[FPU_rm])(); } @@ -75,7 +75,7 @@ static FUNC const fstsw_table[] = { FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal }; -void fstsw_() +void fstsw_(void) { (fstsw_table[FPU_rm])(); } @@ -86,13 +86,13 @@ static FUNC const fp_nop_table[] = { FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal }; -void fp_nop() +void fp_nop(void) { (fp_nop_table[FPU_rm])(); } -void fld_i_() +void fld_i_(void) { FPU_REG *st_new_ptr; int i; @@ -124,7 +124,7 @@ void fld_i_() } -void fxch_i() +void fxch_i(void) { /* fxch st(i) */ FPU_REG t; @@ -173,14 +173,14 @@ void fxch_i() } -void ffree_() +void ffree_(void) { /* ffree st(i) */ FPU_settagi(FPU_rm, TAG_Empty); } -void ffreep() +void ffreep(void) { /* ffree st(i) + pop - unofficial code */ FPU_settagi(FPU_rm, TAG_Empty); @@ -188,14 +188,14 @@ void ffreep() } -void fst_i_() +void fst_i_(void) { /* fst st(i) */ FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm); } -void fstp_i() +void fstp_i(void) { /* fstp st(i) */ FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm); diff --git a/arch/i386/math-emu/fpu_entry.c b/arch/i386/math-emu/fpu_entry.c index baebe5c08..633f954c3 100644 --- a/arch/i386/math-emu/fpu_entry.c +++ b/arch/i386/math-emu/fpu_entry.c @@ -128,7 +128,7 @@ static u_char const type_table[64] = { u_char emulating=0; #endif /* RE_ENTRANT_CHECKING */ -static int valid_prefix(u_char *Byte, u_char **fpu_eip, +static int valid_prefix(u_char *Byte, u_char __user **fpu_eip, overrides *override); asmlinkage void math_emulate(long arg) @@ -140,7 +140,7 @@ asmlinkage void math_emulate(long arg) FPU_REG loaded_data; FPU_REG *st0_ptr; u_char loaded_tag, st0_tag; - void *data_address; + void __user *data_address; struct address data_sel_off; struct address entry_sel_off; unsigned long code_base = 0; @@ -192,7 +192,8 @@ asmlinkage void math_emulate(long arg) math_abort(FPU_info, SIGILL); } - if ( SEG_D_SIZE(code_descriptor = LDT_DESCRIPTOR(FPU_CS)) ) + code_descriptor = LDT_DESCRIPTOR(FPU_CS); + if ( SEG_D_SIZE(code_descriptor) ) { /* The above test may be wrong, the book is not clear */ /* Segmented 32 bit protected mode */ @@ -214,7 +215,7 @@ asmlinkage void math_emulate(long arg) if (current->ptrace & PT_PTRACED) FPU_lookahead = 0; - if ( !valid_prefix(&byte1, (u_char **)&FPU_EIP, + if ( !valid_prefix(&byte1, (u_char __user **)&FPU_EIP, &addr_modes.override) ) { RE_ENTRANT_CHECK_OFF; @@ -257,7 +258,7 @@ do_another_FPU_instruction: RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(1); - FPU_get_user(FPU_modrm, (u_char *) FPU_EIP); + FPU_get_user(FPU_modrm, (u_char __user *) FPU_EIP); RE_ENTRANT_CHECK_ON; FPU_EIP++; @@ -336,23 +337,23 @@ do_another_FPU_instruction: switch ( (byte1 >> 1) & 3 ) { case 0: - unmasked = FPU_load_single((float *)data_address, + unmasked = FPU_load_single((float __user *)data_address, &loaded_data); loaded_tag = unmasked & 0xff; unmasked &= ~0xff; break; case 1: - loaded_tag = FPU_load_int32((long *)data_address, &loaded_data); + loaded_tag = FPU_load_int32((long __user *)data_address, &loaded_data); break; case 2: - unmasked = FPU_load_double((double *)data_address, + unmasked = FPU_load_double((double __user *)data_address, &loaded_data); loaded_tag = unmasked & 0xff; unmasked &= ~0xff; break; case 3: default: /* Used here to suppress gcc warnings. */ - loaded_tag = FPU_load_int16((short *)data_address, &loaded_data); + loaded_tag = FPU_load_int16((short __user *)data_address, &loaded_data); break; } @@ -563,7 +564,7 @@ FPU_fwait_done: if (FPU_lookahead && !need_resched()) { FPU_ORIG_EIP = FPU_EIP - code_base; - if ( valid_prefix(&byte1, (u_char **)&FPU_EIP, + if ( valid_prefix(&byte1, (u_char __user **)&FPU_EIP, &addr_modes.override) ) goto do_another_FPU_instruction; } @@ -579,11 +580,11 @@ FPU_fwait_done: all prefix bytes, further changes are needed in the emulator code which accesses user address space. Access to separate segments is important for msdos emulation. */ -static int valid_prefix(u_char *Byte, u_char **fpu_eip, +static int valid_prefix(u_char *Byte, u_char __user **fpu_eip, overrides *override) { u_char byte; - u_char *ip = *fpu_eip; + u_char __user *ip = *fpu_eip; *override = (overrides) { 0, 0, PREFIX_DEFAULT }; /* defaults */ @@ -679,9 +680,9 @@ void math_abort(struct info * info, unsigned int signal) #define sstatus_word() \ ((S387->swd & ~SW_Top & 0xffff) | ((S387->ftop << SW_Top_Shift) & SW_Top)) -int restore_i387_soft(void *s387, struct _fpstate *buf) +int restore_i387_soft(void *s387, struct _fpstate __user *buf) { - u_char *d = (u_char *)buf; + u_char __user *d = (u_char __user *)buf; int offset, other, i, tags, regnr, tag, newtop; RE_ENTRANT_CHECK_OFF; @@ -725,9 +726,9 @@ int restore_i387_soft(void *s387, struct _fpstate *buf) } -int save_i387_soft(void *s387, struct _fpstate * buf) +int save_i387_soft(void *s387, struct _fpstate __user * buf) { - u_char *d = (u_char *)buf; + u_char __user *d = (u_char __user *)buf; int offset = (S387->ftop & 7) * 10, other = 80 - offset; RE_ENTRANT_CHECK_OFF; diff --git a/arch/i386/math-emu/fpu_etc.c b/arch/i386/math-emu/fpu_etc.c index ba562d129..e3b5d4655 100644 --- a/arch/i386/math-emu/fpu_etc.c +++ b/arch/i386/math-emu/fpu_etc.c @@ -137,7 +137,7 @@ static FUNC_ST0 const fp_etc_table[] = { ftst_, fxam, (FUNC_ST0)FPU_illegal, (FUNC_ST0)FPU_illegal }; -void FPU_etc() +void FPU_etc(void) { (fp_etc_table[FPU_rm])(&st(0), FPU_gettag0()); } diff --git a/arch/i386/math-emu/fpu_proto.h b/arch/i386/math-emu/fpu_proto.h index fb6116382..a8618dfd6 100644 --- a/arch/i386/math-emu/fpu_proto.h +++ b/arch/i386/math-emu/fpu_proto.h @@ -77,13 +77,13 @@ extern void FPU_copy_to_reg0(FPU_REG const *r, u_char tag); extern void FPU_triga(void); extern void FPU_trigb(void); /* get_address.c */ -extern void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, +extern void __user *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, struct address *addr, fpu_addr_modes addr_modes); -extern void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, +extern void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, struct address *addr, fpu_addr_modes addr_modes); /* load_store.c */ extern int FPU_load_store(u_char type, fpu_addr_modes addr_modes, - void *data_address); + void __user *data_address); /* poly_2xm1.c */ extern int poly_2xm1(u_char sign, FPU_REG *arg, FPU_REG *result); /* poly_atan.c */ @@ -112,26 +112,26 @@ extern void fucompp(void); /* reg_constant.c */ extern void fconst(void); /* reg_ld_str.c */ -extern int FPU_load_extended(long double *s, int stnr); -extern int FPU_load_double(double *dfloat, FPU_REG *loaded_data); -extern int FPU_load_single(float *single, FPU_REG *loaded_data); -extern int FPU_load_int64(long long *_s); -extern int FPU_load_int32(long *_s, FPU_REG *loaded_data); -extern int FPU_load_int16(short *_s, FPU_REG *loaded_data); -extern int FPU_load_bcd(u_char *s); +extern int FPU_load_extended(long double __user *s, int stnr); +extern int FPU_load_double(double __user *dfloat, FPU_REG *loaded_data); +extern int FPU_load_single(float __user *single, FPU_REG *loaded_data); +extern int FPU_load_int64(long long __user *_s); +extern int FPU_load_int32(long __user *_s, FPU_REG *loaded_data); +extern int FPU_load_int16(short __user *_s, FPU_REG *loaded_data); +extern int FPU_load_bcd(u_char __user *s); extern int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, - long double *d); -extern int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat); -extern int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single); -extern int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long *d); -extern int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long *d); -extern int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short *d); -extern int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char *d); + long double __user *d); +extern int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double __user *dfloat); +extern int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float __user *single); +extern int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long __user *d); +extern int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long __user *d); +extern int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short __user *d); +extern int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char __user *d); extern int FPU_round_to_int(FPU_REG *r, u_char tag); -extern u_char *fldenv(fpu_addr_modes addr_modes, u_char *s); -extern void frstor(fpu_addr_modes addr_modes, u_char *data_address); -extern u_char *fstenv(fpu_addr_modes addr_modes, u_char *d); -extern void fsave(fpu_addr_modes addr_modes, u_char *data_address); +extern u_char __user *fldenv(fpu_addr_modes addr_modes, u_char __user *s); +extern void frstor(fpu_addr_modes addr_modes, u_char __user *data_address); +extern u_char __user *fstenv(fpu_addr_modes addr_modes, u_char __user *d); +extern void fsave(fpu_addr_modes addr_modes, u_char __user *data_address); extern int FPU_tagof(FPU_REG *ptr); /* reg_mul.c */ extern int FPU_mul(FPU_REG const *b, u_char tagb, int deststnr, int control_w); diff --git a/arch/i386/math-emu/fpu_system.h b/arch/i386/math-emu/fpu_system.h index 78693a5c3..7ff3286fa 100644 --- a/arch/i386/math-emu/fpu_system.h +++ b/arch/i386/math-emu/fpu_system.h @@ -81,7 +81,7 @@ /* A simpler test than verify_area() can probably be done for FPU_code_verify_area() because the only possible error is to step past the upper boundary of a legal code area. */ -#define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void *)FPU_EIP,z) +#define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void __user *)FPU_EIP,z) #endif #define FPU_get_user(x,y) get_user((x),(y)) diff --git a/arch/i386/math-emu/get_address.c b/arch/i386/math-emu/get_address.c index dd568ade9..59eee7218 100644 --- a/arch/i386/math-emu/get_address.c +++ b/arch/i386/math-emu/get_address.c @@ -82,7 +82,7 @@ static int sib(int mod, unsigned long *fpu_eip) RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(1); - FPU_get_user(base, (u_char *) (*fpu_eip)); /* The SIB byte */ + FPU_get_user(base, (u_char __user *) (*fpu_eip)); /* The SIB byte */ RE_ENTRANT_CHECK_ON; (*fpu_eip)++; ss = base >> 6; @@ -112,7 +112,7 @@ static int sib(int mod, unsigned long *fpu_eip) long displacement; RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(1); - FPU_get_user(displacement, (signed char *) (*fpu_eip)); + FPU_get_user(displacement, (signed char __user *) (*fpu_eip)); offset += displacement; RE_ENTRANT_CHECK_ON; (*fpu_eip)++; @@ -123,7 +123,7 @@ static int sib(int mod, unsigned long *fpu_eip) long displacement; RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(4); - FPU_get_user(displacement, (long *) (*fpu_eip)); + FPU_get_user(displacement, (long __user *) (*fpu_eip)); offset += displacement; RE_ENTRANT_CHECK_ON; (*fpu_eip) += 4; @@ -241,7 +241,7 @@ static long pm_address(u_char FPU_modrm, u_char segment, */ -void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, +void __user *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, struct address *addr, fpu_addr_modes addr_modes) { @@ -277,24 +277,24 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, /* Special case: disp32 */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(4); - FPU_get_user(address, (unsigned long *) (*fpu_eip)); + FPU_get_user(address, (unsigned long __user *) (*fpu_eip)); (*fpu_eip) += 4; RE_ENTRANT_CHECK_ON; addr->offset = address; - return (void *) address; + return (void __user *) address; } else { address = *cpu_reg_ptr; /* Just return the contents of the cpu register */ addr->offset = address; - return (void *) address; + return (void __user *) address; } case 1: /* 8 bit signed displacement */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(1); - FPU_get_user(address, (signed char *) (*fpu_eip)); + FPU_get_user(address, (signed char __user *) (*fpu_eip)); RE_ENTRANT_CHECK_ON; (*fpu_eip)++; break; @@ -302,7 +302,7 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, /* 32 bit displacement */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(4); - FPU_get_user(address, (long *) (*fpu_eip)); + FPU_get_user(address, (long __user *) (*fpu_eip)); (*fpu_eip) += 4; RE_ENTRANT_CHECK_ON; break; @@ -331,11 +331,11 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, EXCEPTION(EX_INTERNAL|0x133); } - return (void *)address; + return (void __user *)address; } -void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, +void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, struct address *addr, fpu_addr_modes addr_modes) { @@ -363,7 +363,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, /* Special case: disp16 */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(2); - FPU_get_user(address, (unsigned short *) (*fpu_eip)); + FPU_get_user(address, (unsigned short __user *) (*fpu_eip)); (*fpu_eip) += 2; RE_ENTRANT_CHECK_ON; goto add_segment; @@ -373,7 +373,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, /* 8 bit signed displacement */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(1); - FPU_get_user(address, (signed char *) (*fpu_eip)); + FPU_get_user(address, (signed char __user *) (*fpu_eip)); RE_ENTRANT_CHECK_ON; (*fpu_eip)++; break; @@ -381,7 +381,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, /* 16 bit displacement */ RE_ENTRANT_CHECK_OFF; FPU_code_verify_area(2); - FPU_get_user(address, (unsigned short *) (*fpu_eip)); + FPU_get_user(address, (unsigned short __user *) (*fpu_eip)); (*fpu_eip) += 2; RE_ENTRANT_CHECK_ON; break; @@ -445,5 +445,5 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, EXCEPTION(EX_INTERNAL|0x131); } - return (void *)address ; + return (void __user *)address ; } diff --git a/arch/i386/math-emu/load_store.c b/arch/i386/math-emu/load_store.c index 27d2f4032..ff3a61766 100644 --- a/arch/i386/math-emu/load_store.c +++ b/arch/i386/math-emu/load_store.c @@ -61,7 +61,7 @@ u_char const data_sizes_32[32] = { }; int FPU_load_store(u_char type, fpu_addr_modes addr_modes, - void *data_address) + void __user *data_address) { FPU_REG loaded_data; FPU_REG *st0_ptr; @@ -119,7 +119,7 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, { case 000: /* fld m32real */ clear_C1(); - loaded_tag = FPU_load_single((float *)data_address, &loaded_data); + loaded_tag = FPU_load_single((float __user *)data_address, &loaded_data); if ( (loaded_tag == TAG_Special) && isNaN(&loaded_data) && (real_1op_NaN(&loaded_data) < 0) ) @@ -131,12 +131,12 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, break; case 001: /* fild m32int */ clear_C1(); - loaded_tag = FPU_load_int32((long *)data_address, &loaded_data); + loaded_tag = FPU_load_int32((long __user *)data_address, &loaded_data); FPU_copy_to_reg0(&loaded_data, loaded_tag); break; case 002: /* fld m64real */ clear_C1(); - loaded_tag = FPU_load_double((double *)data_address, &loaded_data); + loaded_tag = FPU_load_double((double __user *)data_address, &loaded_data); if ( (loaded_tag == TAG_Special) && isNaN(&loaded_data) && (real_1op_NaN(&loaded_data) < 0) ) @@ -148,68 +148,68 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, break; case 003: /* fild m16int */ clear_C1(); - loaded_tag = FPU_load_int16((short *)data_address, &loaded_data); + loaded_tag = FPU_load_int16((short __user *)data_address, &loaded_data); FPU_copy_to_reg0(&loaded_data, loaded_tag); break; case 010: /* fst m32real */ clear_C1(); - FPU_store_single(st0_ptr, st0_tag, (float *)data_address); + FPU_store_single(st0_ptr, st0_tag, (float __user *)data_address); break; case 011: /* fist m32int */ clear_C1(); - FPU_store_int32(st0_ptr, st0_tag, (long *)data_address); + FPU_store_int32(st0_ptr, st0_tag, (long __user *)data_address); break; case 012: /* fst m64real */ clear_C1(); - FPU_store_double(st0_ptr, st0_tag, (double *)data_address); + FPU_store_double(st0_ptr, st0_tag, (double __user *)data_address); break; case 013: /* fist m16int */ clear_C1(); - FPU_store_int16(st0_ptr, st0_tag, (short *)data_address); + FPU_store_int16(st0_ptr, st0_tag, (short __user *)data_address); break; case 014: /* fstp m32real */ clear_C1(); - if ( FPU_store_single(st0_ptr, st0_tag, (float *)data_address) ) + if ( FPU_store_single(st0_ptr, st0_tag, (float __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 015: /* fistp m32int */ clear_C1(); - if ( FPU_store_int32(st0_ptr, st0_tag, (long *)data_address) ) + if ( FPU_store_int32(st0_ptr, st0_tag, (long __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 016: /* fstp m64real */ clear_C1(); - if ( FPU_store_double(st0_ptr, st0_tag, (double *)data_address) ) + if ( FPU_store_double(st0_ptr, st0_tag, (double __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 017: /* fistp m16int */ clear_C1(); - if ( FPU_store_int16(st0_ptr, st0_tag, (short *)data_address) ) + if ( FPU_store_int16(st0_ptr, st0_tag, (short __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 020: /* fldenv m14/28byte */ - fldenv(addr_modes, (u_char *)data_address); + fldenv(addr_modes, (u_char __user *)data_address); /* Ensure that the values just loaded are not changed by fix-up operations. */ return 1; case 022: /* frstor m94/108byte */ - frstor(addr_modes, (u_char *)data_address); + frstor(addr_modes, (u_char __user *)data_address); /* Ensure that the values just loaded are not changed by fix-up operations. */ return 1; case 023: /* fbld m80dec */ clear_C1(); - loaded_tag = FPU_load_bcd((u_char *)data_address); + loaded_tag = FPU_load_bcd((u_char __user *)data_address); FPU_settag0(loaded_tag); break; case 024: /* fldcw */ RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_READ, data_address, 2); - FPU_get_user(control_word, (unsigned short *) data_address); + FPU_get_user(control_word, (unsigned short __user *) data_address); RE_ENTRANT_CHECK_ON; if ( partial_status & ~control_word & CW_Exceptions ) partial_status |= (SW_Summary | SW_Backward); @@ -221,47 +221,47 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, return 1; case 025: /* fld m80real */ clear_C1(); - loaded_tag = FPU_load_extended((long double *)data_address, 0); + loaded_tag = FPU_load_extended((long double __user *)data_address, 0); FPU_settag0(loaded_tag); break; case 027: /* fild m64int */ clear_C1(); - loaded_tag = FPU_load_int64((long long *)data_address); + loaded_tag = FPU_load_int64((long long __user *)data_address); FPU_settag0(loaded_tag); break; case 030: /* fstenv m14/28byte */ - fstenv(addr_modes, (u_char *)data_address); + fstenv(addr_modes, (u_char __user *)data_address); return 1; case 032: /* fsave */ - fsave(addr_modes, (u_char *)data_address); + fsave(addr_modes, (u_char __user *)data_address); return 1; case 033: /* fbstp m80dec */ clear_C1(); - if ( FPU_store_bcd(st0_ptr, st0_tag, (u_char *)data_address) ) + if ( FPU_store_bcd(st0_ptr, st0_tag, (u_char __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 034: /* fstcw m16int */ RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,data_address,2); - FPU_put_user(control_word, (unsigned short *) data_address); + FPU_put_user(control_word, (unsigned short __user *) data_address); RE_ENTRANT_CHECK_ON; return 1; case 035: /* fstp m80real */ clear_C1(); - if ( FPU_store_extended(st0_ptr, st0_tag, (long double *)data_address) ) + if ( FPU_store_extended(st0_ptr, st0_tag, (long double __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; case 036: /* fstsw m2byte */ RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,data_address,2); - FPU_put_user(status_word(),(unsigned short *) data_address); + FPU_put_user(status_word(),(unsigned short __user *) data_address); RE_ENTRANT_CHECK_ON; return 1; case 037: /* fistp m64int */ clear_C1(); - if ( FPU_store_int64(st0_ptr, st0_tag, (long long *)data_address) ) + if ( FPU_store_int64(st0_ptr, st0_tag, (long long __user *)data_address) ) pop_0(); /* pop only if the number was actually stored (see the 80486 manual p16-28) */ break; diff --git a/arch/i386/math-emu/reg_compare.c b/arch/i386/math-emu/reg_compare.c index afd222cb6..f37c5b5a3 100644 --- a/arch/i386/math-emu/reg_compare.c +++ b/arch/i386/math-emu/reg_compare.c @@ -324,14 +324,14 @@ static int compare_u_st_st(int nr) /*---------------------------------------------------------------------------*/ -void fcom_st() +void fcom_st(void) { /* fcom st(i) */ compare_st_st(FPU_rm); } -void fcompst() +void fcompst(void) { /* fcomp st(i) */ if ( !compare_st_st(FPU_rm) ) @@ -339,7 +339,7 @@ void fcompst() } -void fcompp() +void fcompp(void) { /* fcompp */ if (FPU_rm != 1) @@ -352,7 +352,7 @@ void fcompp() } -void fucom_() +void fucom_(void) { /* fucom st(i) */ compare_u_st_st(FPU_rm); @@ -360,7 +360,7 @@ void fucom_() } -void fucomp() +void fucomp(void) { /* fucomp st(i) */ if ( !compare_u_st_st(FPU_rm) ) @@ -368,7 +368,7 @@ void fucomp() } -void fucompp() +void fucompp(void) { /* fucompp */ if (FPU_rm == 1) diff --git a/arch/i386/math-emu/reg_ld_str.c b/arch/i386/math-emu/reg_ld_str.c index cdd3746e6..699fe331c 100644 --- a/arch/i386/math-emu/reg_ld_str.c +++ b/arch/i386/math-emu/reg_ld_str.c @@ -86,7 +86,7 @@ int FPU_tagof(FPU_REG *ptr) /* Get a long double from user memory */ -int FPU_load_extended(long double *s, int stnr) +int FPU_load_extended(long double __user *s, int stnr) { FPU_REG *sti_ptr = &st(stnr); @@ -100,15 +100,15 @@ int FPU_load_extended(long double *s, int stnr) /* Get a double from user memory */ -int FPU_load_double(double *dfloat, FPU_REG *loaded_data) +int FPU_load_double(double __user *dfloat, FPU_REG *loaded_data) { int exp, tag, negative; unsigned m64, l64; RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_READ, dfloat, 8); - FPU_get_user(m64, 1 + (unsigned long *) dfloat); - FPU_get_user(l64, (unsigned long *) dfloat); + FPU_get_user(m64, 1 + (unsigned long __user *) dfloat); + FPU_get_user(l64, (unsigned long __user *) dfloat); RE_ENTRANT_CHECK_ON; negative = (m64 & 0x80000000) ? SIGN_Negative : SIGN_Positive; @@ -172,14 +172,14 @@ int FPU_load_double(double *dfloat, FPU_REG *loaded_data) /* Get a float from user memory */ -int FPU_load_single(float *single, FPU_REG *loaded_data) +int FPU_load_single(float __user *single, FPU_REG *loaded_data) { unsigned m32; int exp, tag, negative; RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_READ, single, 4); - FPU_get_user(m32, (unsigned long *) single); + FPU_get_user(m32, (unsigned long __user *) single); RE_ENTRANT_CHECK_ON; negative = (m32 & 0x80000000) ? SIGN_Negative : SIGN_Positive; @@ -236,7 +236,7 @@ int FPU_load_single(float *single, FPU_REG *loaded_data) /* Get a long long from user memory */ -int FPU_load_int64(long long *_s) +int FPU_load_int64(long long __user *_s) { long long s; int sign; @@ -268,7 +268,7 @@ int FPU_load_int64(long long *_s) /* Get a long from user memory */ -int FPU_load_int32(long *_s, FPU_REG *loaded_data) +int FPU_load_int32(long __user *_s, FPU_REG *loaded_data) { long s; int negative; @@ -297,7 +297,7 @@ int FPU_load_int32(long *_s, FPU_REG *loaded_data) /* Get a short from user memory */ -int FPU_load_int16(short *_s, FPU_REG *loaded_data) +int FPU_load_int16(short __user *_s, FPU_REG *loaded_data) { int s, negative; @@ -326,7 +326,7 @@ int FPU_load_int16(short *_s, FPU_REG *loaded_data) /* Get a packed bcd array from user memory */ -int FPU_load_bcd(u_char *s) +int FPU_load_bcd(u_char __user *s) { FPU_REG *st0_ptr = &st(0); int pos; @@ -341,7 +341,7 @@ int FPU_load_bcd(u_char *s) { l *= 10; RE_ENTRANT_CHECK_OFF; - FPU_get_user(bcd, (u_char *) s+pos); + FPU_get_user(bcd, s+pos); RE_ENTRANT_CHECK_ON; l += bcd >> 4; l *= 10; @@ -349,7 +349,7 @@ int FPU_load_bcd(u_char *s) } RE_ENTRANT_CHECK_OFF; - FPU_get_user(sign, (u_char *) s+9); + FPU_get_user(sign, s+9); sign = sign & 0x80 ? SIGN_Negative : SIGN_Positive; RE_ENTRANT_CHECK_ON; @@ -369,7 +369,7 @@ int FPU_load_bcd(u_char *s) /*===========================================================================*/ /* Put a long double into user memory */ -int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, long double *d) +int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, long double __user *d) { /* The only exception raised by an attempt to store to an @@ -382,9 +382,9 @@ int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, long double *d) RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE, d, 10); - FPU_put_user(st0_ptr->sigl, (unsigned long *) d); - FPU_put_user(st0_ptr->sigh, (unsigned long *) ((u_char *)d + 4)); - FPU_put_user(exponent16(st0_ptr), (unsigned short *) ((u_char *)d + 8)); + FPU_put_user(st0_ptr->sigl, (unsigned long __user *) d); + FPU_put_user(st0_ptr->sigh, (unsigned long __user *) ((u_char __user *)d + 4)); + FPU_put_user(exponent16(st0_ptr), (unsigned short __user *) ((u_char __user *)d + 8)); RE_ENTRANT_CHECK_ON; return 1; @@ -398,9 +398,9 @@ int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, long double *d) /* Put out the QNaN indefinite */ RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,d,10); - FPU_put_user(0, (unsigned long *) d); - FPU_put_user(0xc0000000, 1 + (unsigned long *) d); - FPU_put_user(0xffff, 4 + (short *) d); + FPU_put_user(0, (unsigned long __user *) d); + FPU_put_user(0xc0000000, 1 + (unsigned long __user *) d); + FPU_put_user(0xffff, 4 + (short __user *) d); RE_ENTRANT_CHECK_ON; return 1; } @@ -411,7 +411,7 @@ int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, long double *d) /* Put a double into user memory */ -int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat) +int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double __user *dfloat) { unsigned long l[2]; unsigned long increment = 0; /* avoid gcc warnings */ @@ -607,9 +607,9 @@ int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat) /* The masked response */ /* Put out the QNaN indefinite */ RE_ENTRANT_CHECK_OFF; - FPU_verify_area(VERIFY_WRITE,(void *)dfloat,8); - FPU_put_user(0, (unsigned long *) dfloat); - FPU_put_user(0xfff80000, 1 + (unsigned long *) dfloat); + FPU_verify_area(VERIFY_WRITE,dfloat,8); + FPU_put_user(0, (unsigned long __user *) dfloat); + FPU_put_user(0xfff80000, 1 + (unsigned long __user *) dfloat); RE_ENTRANT_CHECK_ON; return 1; } @@ -620,9 +620,9 @@ int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat) l[1] |= 0x80000000; RE_ENTRANT_CHECK_OFF; - FPU_verify_area(VERIFY_WRITE,(void *)dfloat,8); - FPU_put_user(l[0], (unsigned long *)dfloat); - FPU_put_user(l[1], 1 + (unsigned long *)dfloat); + FPU_verify_area(VERIFY_WRITE,dfloat,8); + FPU_put_user(l[0], (unsigned long __user *)dfloat); + FPU_put_user(l[1], 1 + (unsigned long __user *)dfloat); RE_ENTRANT_CHECK_ON; return 1; @@ -630,7 +630,7 @@ int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat) /* Put a float into user memory */ -int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single) +int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float __user *single) { long templ = 0; unsigned long increment = 0; /* avoid gcc warnings */ @@ -826,8 +826,8 @@ int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single) /* The masked response */ /* Put out the QNaN indefinite */ RE_ENTRANT_CHECK_OFF; - FPU_verify_area(VERIFY_WRITE,(void *)single,4); - FPU_put_user(0xffc00000, (unsigned long *) single); + FPU_verify_area(VERIFY_WRITE,single,4); + FPU_put_user(0xffc00000, (unsigned long __user *) single); RE_ENTRANT_CHECK_ON; return 1; } @@ -845,8 +845,8 @@ int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single) templ |= 0x80000000; RE_ENTRANT_CHECK_OFF; - FPU_verify_area(VERIFY_WRITE,(void *)single,4); - FPU_put_user(templ,(unsigned long *) single); + FPU_verify_area(VERIFY_WRITE,single,4); + FPU_put_user(templ,(unsigned long __user *) single); RE_ENTRANT_CHECK_ON; return 1; @@ -854,7 +854,7 @@ int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single) /* Put a long long into user memory */ -int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long *d) +int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long __user *d) { FPU_REG t; long long tll; @@ -906,7 +906,7 @@ int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long *d) } RE_ENTRANT_CHECK_OFF; - FPU_verify_area(VERIFY_WRITE,(void *)d,8); + FPU_verify_area(VERIFY_WRITE,d,8); copy_to_user(d, &tll, 8); RE_ENTRANT_CHECK_ON; @@ -915,7 +915,7 @@ int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long *d) /* Put a long into user memory */ -int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long *d) +int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long __user *d) { FPU_REG t; int precision_loss; @@ -964,7 +964,7 @@ int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long *d) RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,d,4); - FPU_put_user(t.sigl, (unsigned long *) d); + FPU_put_user(t.sigl, (unsigned long __user *) d); RE_ENTRANT_CHECK_ON; return 1; @@ -972,7 +972,7 @@ int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long *d) /* Put a short into user memory */ -int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short *d) +int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short __user *d) { FPU_REG t; int precision_loss; @@ -1021,7 +1021,7 @@ int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short *d) RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,d,2); - FPU_put_user((short)t.sigl,(short *) d); + FPU_put_user((short)t.sigl, d); RE_ENTRANT_CHECK_ON; return 1; @@ -1029,7 +1029,7 @@ int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short *d) /* Put a packed bcd array into user memory */ -int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char *d) +int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char __user *d) { FPU_REG t; unsigned long long ll; @@ -1071,10 +1071,10 @@ int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char *d) RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,d,10); for ( i = 0; i < 7; i++) - FPU_put_user(0, (u_char *) d+i); /* These bytes "undefined" */ - FPU_put_user(0xc0, (u_char *) d+7); /* This byte "undefined" */ - FPU_put_user(0xff, (u_char *) d+8); - FPU_put_user(0xff, (u_char *) d+9); + FPU_put_user(0, d+i); /* These bytes "undefined" */ + FPU_put_user(0xc0, d+7); /* This byte "undefined" */ + FPU_put_user(0xff, d+8); + FPU_put_user(0xff, d+9); RE_ENTRANT_CHECK_ON; return 1; } @@ -1095,11 +1095,11 @@ int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char *d) b = FPU_div_small(&ll, 10); b |= (FPU_div_small(&ll, 10)) << 4; RE_ENTRANT_CHECK_OFF; - FPU_put_user(b,(u_char *) d+i); + FPU_put_user(b, d+i); RE_ENTRANT_CHECK_ON; } RE_ENTRANT_CHECK_OFF; - FPU_put_user(sign,(u_char *) d+9); + FPU_put_user(sign, d+9); RE_ENTRANT_CHECK_ON; return 1; @@ -1175,7 +1175,7 @@ int FPU_round_to_int(FPU_REG *r, u_char tag) /*===========================================================================*/ -u_char *fldenv(fpu_addr_modes addr_modes, u_char *s) +u_char __user *fldenv(fpu_addr_modes addr_modes, u_char __user *s) { unsigned short tag_word = 0; u_char tag; @@ -1187,13 +1187,13 @@ u_char *fldenv(fpu_addr_modes addr_modes, u_char *s) { RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_READ, s, 0x0e); - FPU_get_user(control_word, (unsigned short *) s); - FPU_get_user(partial_status, (unsigned short *) (s+2)); - FPU_get_user(tag_word, (unsigned short *) (s+4)); - FPU_get_user(instruction_address.offset, (unsigned short *) (s+6)); - FPU_get_user(instruction_address.selector, (unsigned short *) (s+8)); - FPU_get_user(operand_address.offset, (unsigned short *) (s+0x0a)); - FPU_get_user(operand_address.selector, (unsigned short *) (s+0x0c)); + FPU_get_user(control_word, (unsigned short __user *) s); + FPU_get_user(partial_status, (unsigned short __user *) (s+2)); + FPU_get_user(tag_word, (unsigned short __user *) (s+4)); + FPU_get_user(instruction_address.offset, (unsigned short __user *) (s+6)); + FPU_get_user(instruction_address.selector, (unsigned short __user *) (s+8)); + FPU_get_user(operand_address.offset, (unsigned short __user *) (s+0x0a)); + FPU_get_user(operand_address.selector, (unsigned short __user *) (s+0x0c)); RE_ENTRANT_CHECK_ON; s += 0x0e; if ( addr_modes.default_mode == VM86 ) @@ -1207,14 +1207,14 @@ u_char *fldenv(fpu_addr_modes addr_modes, u_char *s) { RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_READ, s, 0x1c); - FPU_get_user(control_word, (unsigned short *) s); - FPU_get_user(partial_status, (unsigned short *) (s+4)); - FPU_get_user(tag_word, (unsigned short *) (s+8)); - FPU_get_user(instruction_address.offset, (unsigned long *) (s+0x0c)); - FPU_get_user(instruction_address.selector, (unsigned short *) (s+0x10)); - FPU_get_user(instruction_address.opcode, (unsigned short *) (s+0x12)); - FPU_get_user(operand_address.offset, (unsigned long *) (s+0x14)); - FPU_get_user(operand_address.selector, (unsigned long *) (s+0x18)); + FPU_get_user(control_word, (unsigned short __user *) s); + FPU_get_user(partial_status, (unsigned short __user *) (s+4)); + FPU_get_user(tag_word, (unsigned short __user *) (s+8)); + FPU_get_user(instruction_address.offset, (unsigned long __user *) (s+0x0c)); + FPU_get_user(instruction_address.selector, (unsigned short __user *) (s+0x10)); + FPU_get_user(instruction_address.opcode, (unsigned short __user *) (s+0x12)); + FPU_get_user(operand_address.offset, (unsigned long __user *) (s+0x14)); + FPU_get_user(operand_address.selector, (unsigned long __user *) (s+0x18)); RE_ENTRANT_CHECK_ON; s += 0x1c; } @@ -1266,10 +1266,10 @@ u_char *fldenv(fpu_addr_modes addr_modes, u_char *s) } -void frstor(fpu_addr_modes addr_modes, u_char *data_address) +void frstor(fpu_addr_modes addr_modes, u_char __user *data_address) { int i, regnr; - u_char *s = fldenv(addr_modes, data_address); + u_char __user *s = fldenv(addr_modes, data_address); int offset = (top & 7) * 10, other = 80 - offset; /* Copy all registers in stack order. */ @@ -1291,7 +1291,7 @@ void frstor(fpu_addr_modes addr_modes, u_char *data_address) } -u_char *fstenv(fpu_addr_modes addr_modes, u_char *d) +u_char __user *fstenv(fpu_addr_modes addr_modes, u_char __user *d) { if ( (addr_modes.default_mode == VM86) || ((addr_modes.default_mode == PM16) @@ -1300,25 +1300,25 @@ u_char *fstenv(fpu_addr_modes addr_modes, u_char *d) RE_ENTRANT_CHECK_OFF; FPU_verify_area(VERIFY_WRITE,d,14); #ifdef PECULIAR_486 - FPU_put_user(control_word & ~0xe080, (unsigned long *) d); + FPU_put_user(control_word & ~0xe080, (unsigned long __user *) d); #else - FPU_put_user(control_word, (unsigned short *) d); + FPU_put_user(control_word, (unsigned short __user *) d); #endif /* PECULIAR_486 */ - FPU_put_user(status_word(), (unsigned short *) (d+2)); - FPU_put_user(fpu_tag_word, (unsigned short *) (d+4)); - FPU_put_user(instruction_address.offset, (unsigned short *) (d+6)); - FPU_put_user(operand_address.offset, (unsigned short *) (d+0x0a)); + FPU_put_user(status_word(), (unsigned short __user *) (d+2)); + FPU_put_user(fpu_tag_word, (unsigned short __user *) (d+4)); + FPU_put_user(instruction_address.offset, (unsigned short __user *) (d+6)); + FPU_put_user(operand_address.offset, (unsigned short __user *) (d+0x0a)); if ( addr_modes.default_mode == VM86 ) { FPU_put_user((instruction_address.offset & 0xf0000) >> 4, - (unsigned short *) (d+8)); + (unsigned short __user *) (d+8)); FPU_put_user((operand_address.offset & 0xf0000) >> 4, - (unsigned short *) (d+0x0c)); + (unsigned short __user *) (d+0x0c)); } else { - FPU_put_user(instruction_address.selector, (unsigned short *) (d+8)); - FPU_put_user(operand_address.selector, (unsigned short *) (d+0x0c)); + FPU_put_user(instruction_address.selector, (unsigned short __user *) (d+8)); + FPU_put_user(operand_address.selector, (unsigned short __user *) (d+0x0c)); } RE_ENTRANT_CHECK_ON; d += 0x0e; @@ -1348,9 +1348,9 @@ u_char *fstenv(fpu_addr_modes addr_modes, u_char *d) } -void fsave(fpu_addr_modes addr_modes, u_char *data_address) +void fsave(fpu_addr_modes addr_modes, u_char __user *data_address) { - u_char *d; + u_char __user *d; int offset = (top & 7) * 10, other = 80 - offset; d = fstenv(addr_modes, data_address); diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index 97d4af301..4ea886fd9 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -451,7 +450,7 @@ no_context: else printk(KERN_ALERT "Unable to handle kernel paging request"); printk(" at virtual address %08lx\n",address); - printk(" printing eip:\n"); + printk(KERN_ALERT " printing eip:\n"); printk("%08lx\n", regs->eip); asm("movl %%cr3,%0":"=r" (page)); page = ((unsigned long *) __va(page))[address >> 22]; diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c index 0397fe963..1ed596236 100644 --- a/arch/i386/mm/hugetlbpage.c +++ b/arch/i386/mm/hugetlbpage.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -245,8 +244,15 @@ int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma) ret = -ENOMEM; goto out; } - if (!pte_none(*pte)) - continue; + + if (!pte_none(*pte)) { + pmd_t *pmd = (pmd_t *) pte; + + page = pmd_page(*pmd); + pmd_clear(pmd); + dec_page_state(nr_page_table_pages); + page_cache_release(page); + } idx = ((addr - vma->vm_start) >> HPAGE_SHIFT) + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT)); diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 77179eb95..837110f5b 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index 8c1593278..7b11be028 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c index d0a5b7904..86ce01655 100644 --- a/arch/i386/pci/acpi.c +++ b/arch/i386/pci/acpi.c @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "pci.h" struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) @@ -15,18 +17,31 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do static int __init pci_acpi_init(void) { + struct pci_dev *dev = NULL; + if (pcibios_scanned) return 0; - if (!acpi_noirq) { - if (!acpi_pci_irq_init()) { - printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); - pcibios_scanned++; - pcibios_enable_irq = acpi_pci_irq_enable; - } else - printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n"); + if (acpi_noirq) + return 0; - } + printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); + acpi_irq_penalty_init(); + pcibios_scanned++; + pcibios_enable_irq = acpi_pci_irq_enable; + + /* + * PCI IRQ routing is set up by pci_enable_device(), but we + * also do it here in case there are still broken drivers that + * don't use pci_enable_device(). + */ + while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) + acpi_pci_irq_enable(dev); + +#ifdef CONFIG_X86_IO_APIC + if (acpi_ioapic) + print_IO_APIC(); +#endif return 0; } diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c index ac6acb3ce..a8b1954ae 100644 --- a/arch/i386/pci/fixup.c +++ b/arch/i386/pci/fixup.c @@ -226,7 +226,12 @@ static void __init pci_fixup_nforce2(struct pci_dev *dev) fixed_val = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01; pci_read_config_dword(dev, 0x6c, &val); - if (val != fixed_val) { + + /* + * Apply fixup only if C1 Halt Disconnect is enabled + * (bit28) because it is not supported on some boards. + */ + if ((val & (1 << 28)) && val != fixed_val) { printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n"); pci_write_config_dword(dev, 0x6c, fixed_val); } diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index b856ffae3..573b7499f 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -75,15 +75,6 @@ config IA64_HP_SIM endchoice -config HOTPLUG_CPU - bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" - depends on SMP && HOTPLUG && EXPERIMENTAL - default n - ---help--- - Say Y here to experiment with turning CPUs off and on. CPUs - can be controlled through /sys/devices/system/cpu/cpu#. - Say N if you want to disable cpu hotplug. - choice prompt "Processor type" default ITANIUM @@ -250,6 +241,15 @@ config NR_CPUS than 64 will cause the use of a CPU mask array, causing a small performance hit. +config HOTPLUG_CPU + bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" + depends on SMP && HOTPLUG && EXPERIMENTAL + default n + ---help--- + Say Y here to experiment with turning CPUs off and on. CPUs + can be controlled through /sys/devices/system/cpu/cpu#. + Say N if you want to disable CPU hotplug. + config PREEMPT bool "Preemptible Kernel" help diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c index 30f2b84c3..a8becf084 100644 --- a/arch/ia64/ia32/binfmt_elf32.c +++ b/arch/ia64/ia32/binfmt_elf32.c @@ -218,3 +218,16 @@ elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int p return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type, eppnt->p_offset - pgoff); } + +#define cpu_uses_ia32el() (local_cpu_data->family > 0x1f) + +static int __init check_elf32_binfmt(void) +{ + if (cpu_uses_ia32el()) { + printk("Please use IA-32 EL for executing IA-32 binaries\n"); + return unregister_binfmt(&elf_format); + } + return 0; +} + +module_init(check_elf32_binfmt) diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index 4ee1e551f..0c7db9e10 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S @@ -349,7 +349,7 @@ ia32_syscall_table: data8 sys_setfsuid /* 16-bit version */ data8 sys_setfsgid /* 16-bit version */ data8 sys_llseek /* 140 */ - data8 sys32_getdents + data8 compat_sys_getdents data8 compat_sys_select data8 sys_flock data8 sys32_msync @@ -428,7 +428,7 @@ ia32_syscall_table: data8 sys_pivot_root data8 sys_mincore data8 sys_madvise - data8 sys_getdents64 /* 220 */ + data8 compat_sys_getdents64 /* 220 */ data8 compat_sys_fcntl64 data8 sys_ni_syscall /* reserved for TUX */ data8 sys_ni_syscall /* reserved for Security */ diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 10f2c7cd7..28264441b 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -521,9 +521,14 @@ acpi_numa_arch_fixup (void) #endif /* CONFIG_ACPI_NUMA */ unsigned int -acpi_register_gsi (u32 gsi, int polarity, int trigger) +acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) { - return acpi_register_irq(gsi, polarity, trigger); + if (has_8259 && gsi < 16) + return isa_irq_to_vector(gsi); + + return iosapic_register_intr(gsi, + (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, + (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); } EXPORT_SYMBOL(acpi_register_gsi); @@ -548,7 +553,7 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size) if (fadt->iapc_boot_arch & BAF_LEGACY_DEVICES) acpi_legacy_devices = 1; - acpi_register_gsi(fadt->sci_int, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE); + acpi_register_gsi(fadt->sci_int, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); return 0; } @@ -662,16 +667,4 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq) return 0; } -int -acpi_register_irq (u32 gsi, u32 polarity, u32 trigger) -{ - if (has_8259 && gsi < 16) - return isa_irq_to_vector(gsi); - - return iosapic_register_intr(gsi, - (polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, - (trigger == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); -} -EXPORT_SYMBOL(acpi_register_irq); - #endif /* CONFIG_ACPI_BOOT */ diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 75a3aa62d..933e4f190 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -21,7 +21,7 @@ * Jonathan Nicklin * Patrick O'Rourke * 11/07/2000 - / + */ /* * Global (preserved) predicate usage on syscall entry/exit path: * diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index c6e88e482..874bb10b7 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S @@ -502,6 +502,7 @@ ENTRY(fsys_fallback_syscall) adds r17=-1024,r15 movl r14=sys_call_table ;; + rsm psr.i shladd r18=r17,3,r14 ;; ld8 r18=[r18] // load normal (heavy-weight) syscall entry-point @@ -542,7 +543,7 @@ GLOBAL_ENTRY(fsys_bubble_down) * to synthesize. */ # define PSR_ONE_BITS ((3 << IA64_PSR_CPL0_BIT) | (0x1 << IA64_PSR_RI_BIT) \ - | IA64_PSR_BN) + | IA64_PSR_BN | IA64_PSR_I) invala movl r8=PSR_ONE_BITS diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S index 36e8a24ff..a4dba3648 100644 --- a/arch/ia64/kernel/gate.S +++ b/arch/ia64/kernel/gate.S @@ -91,16 +91,18 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc) cmp.geu p6,p7=r19,r17 // (syscall > 0 && syscall < 1024+NR_syscalls)? ;; (p6) ld8 r18=[r18] - mov r29=psr // read psr (12 cyc load latency) + mov r21=ar.fpsr add r14=-8,r14 // r14 <- addr of fsys_bubble_down entry ;; (p6) mov b7=r18 (p6) tbit.z p8,p0=r18,0 (p8) br.dptk.many b7 +(p6) rsm psr.i mov r27=ar.rsc - mov r21=ar.fpsr mov r26=ar.pfs + ;; + mov r29=psr // read psr (12 cyc load latency) /* * brl.cond doesn't work as intended because the linker would convert this branch * into a branch to a PLT. Perhaps there will be a way to avoid this with some diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index 6f74b9a12..0a5eb48d5 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S @@ -815,6 +815,42 @@ GLOBAL_ENTRY(ia64_delay_loop) br.ret.sptk.many rp END(ia64_delay_loop) +/* + * Return a CPU-local timestamp in nano-seconds. This timestamp is + * NOT synchronized across CPUs its return value must never be + * compared against the values returned on another CPU. The usage in + * kernel/sched.c ensures that. + * + * The return-value of sched_clock() is NOT supposed to wrap-around. + * If it did, it would cause some scheduling hiccups (at the worst). + * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even + * that would happen only once every 5+ years. + * + * The code below basically calculates: + * + * (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT + * + * except that the multiplication and the shift are done with 128-bit + * intermediate precision so that we can produce a full 64-bit result. + */ +GLOBAL_ENTRY(sched_clock) + addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 + mov.m r9=ar.itc // fetch cycle-counter (35 cyc) + ;; + ldf8 f8=[r8] + ;; + setf.sig f9=r9 // certain to stall, so issue it _after_ ldf8... + ;; + xmpy.lu f10=f9,f8 // calculate low 64 bits of 128-bit product (4 cyc) + xmpy.hu f11=f9,f8 // calculate high 64 bits of 128-bit product + ;; + getf.sig r8=f10 // (5 cyc) + getf.sig r9=f11 + ;; + shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT + br.ret.sptk.many rp +END(sched_clock) + GLOBAL_ENTRY(start_kernel_thread) .prologue .save rp, r0 // this is the end of the call-chain diff --git a/arch/ia64/kernel/init_task.c b/arch/ia64/kernel/init_task.c index 46cf054d3..b69c397ed 100644 --- a/arch/ia64/kernel/init_task.c +++ b/arch/ia64/kernel/init_task.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 33044bcb1..1e1f05c98 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c @@ -100,7 +100,7 @@ #endif static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED; -cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; +extern cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; /* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */ @@ -483,7 +483,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery, index = find_iosapic(gsi); if (index < 0) { - printk(KERN_WARNING "%s: No IOSAPIC for GSI 0x%x\n", __FUNCTION__, gsi); + printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi); return; } @@ -512,6 +512,42 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery, } } +static unsigned int +get_target_cpu (void) +{ +#ifdef CONFIG_SMP + static int cpu = -1; + + /* + * If the platform supports redirection via XTP, let it + * distribute interrupts. + */ + if (smp_int_redirect & SMP_IRQ_REDIRECTION) + return hard_smp_processor_id(); + + /* + * Some interrupts (ACPI SCI, for instance) are registered + * before the BSP is marked as online. + */ + if (!cpu_online(smp_processor_id())) + return hard_smp_processor_id(); + + /* + * Otherwise, round-robin interrupt vectors across all the + * processors. (It'd be nice if we could be smarter in the + * case of NUMA.) + */ + do { + if (++cpu >= NR_CPUS) + cpu = 0; + } while (!cpu_online(cpu)); + + return cpu_physical_id(cpu); +#else + return hard_smp_processor_id(); +#endif +} + /* * ACPI can describe IOSAPIC interrupts via static tables and namespace * methods. This provides an interface to register those interrupts and @@ -522,21 +558,35 @@ iosapic_register_intr (unsigned int gsi, unsigned long polarity, unsigned long trigger) { int vector; - unsigned int dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff; + unsigned int dest; + unsigned long flags; - vector = gsi_to_vector(gsi); - if (vector < 0) - vector = assign_irq_vector(AUTO_ASSIGN); + /* + * If this GSI has already been registered (i.e., it's a + * shared interrupt, or we lost a race to register it), + * don't touch the RTE. + */ + spin_lock_irqsave(&iosapic_lock, flags); + { + vector = gsi_to_vector(gsi); + if (vector > 0) { + spin_unlock_irqrestore(&iosapic_lock, flags); + return vector; + } - register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, - polarity, trigger); + vector = assign_irq_vector(AUTO_ASSIGN); + dest = get_target_cpu(); + register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, + polarity, trigger); + } + spin_unlock_irqrestore(&iosapic_lock, flags); - printk(KERN_INFO "GSI 0x%x(%s,%s) -> CPU 0x%04x vector %d\n", - gsi, (polarity == IOSAPIC_POL_HIGH ? "high" : "low"), - (trigger == IOSAPIC_EDGE ? "edge" : "level"), dest, vector); + printk(KERN_INFO "GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n", + gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"), + (polarity == IOSAPIC_POL_HIGH ? "high" : "low"), + cpu_logical_id(dest), dest, vector); - /* program the IOSAPIC routing table */ - set_rte(vector, dest, 0); + set_rte(vector, dest, 1); return vector; } @@ -549,8 +599,9 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi, int iosapic_vector, u16 eid, u16 id, unsigned long polarity, unsigned long trigger) { + static const char * const name[] = {"unknown", "PMI", "INIT", "CPEI"}; unsigned char delivery; - int vector; + int vector, mask = 0; unsigned int dest = ((id << 8) | eid) & 0xffff; switch (int_type) { @@ -570,21 +621,22 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi, case ACPI_INTERRUPT_CPEI: vector = IA64_CPE_VECTOR; delivery = IOSAPIC_LOWEST_PRIORITY; + mask = 1; break; default: - printk(KERN_ERR "iosapic_register_platform_irq(): invalid int type\n"); + printk(KERN_ERR "iosapic_register_platform_irq(): invalid int type 0x%x\n", int_type); return -1; } - register_intr(gsi, vector, delivery, polarity, - trigger); + register_intr(gsi, vector, delivery, polarity, trigger); - printk(KERN_INFO "PLATFORM int 0x%x: GSI 0x%x(%s,%s) -> CPU 0x%04x vector %d\n", - int_type, gsi, (polarity == IOSAPIC_POL_HIGH ? "high" : "low"), - (trigger == IOSAPIC_EDGE ? "edge" : "level"), dest, vector); + printk(KERN_INFO "PLATFORM int %s (0x%x): GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n", + int_type < ARRAY_SIZE(name) ? name[int_type] : "unknown", + int_type, gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"), + (polarity == IOSAPIC_POL_HIGH ? "high" : "low"), + cpu_logical_id(dest), dest, vector); - /* program the IOSAPIC routing table */ - set_rte(vector, dest, 0); + set_rte(vector, dest, mask); return vector; } @@ -599,18 +651,18 @@ iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, unsigned long trigger) { int vector; - unsigned int dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff; + unsigned int dest = hard_smp_processor_id(); vector = isa_irq_to_vector(isa_irq); register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, polarity, trigger); - DBG("ISA: IRQ %u -> GSI 0x%x (%s,%s) -> CPU 0x%04x vector %d\n", - isa_irq, gsi, polarity == IOSAPIC_POL_HIGH ? "high" : "low", - trigger == IOSAPIC_EDGE ? "edge" : "level", dest, vector); + DBG("ISA: IRQ %u -> GSI %u (%s,%s) -> CPU %d (0x%04x) vector %d\n", + isa_irq, gsi, trigger == IOSAPIC_EDGE ? "edge" : "level", + polarity == IOSAPIC_POL_HIGH ? "high" : "low", + cpu_logical_id(dest), dest, vector); - /* program the IOSAPIC routing table */ - set_rte(vector, dest, 0); + set_rte(vector, dest, 1); } void __init @@ -665,104 +717,3 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base) iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE); } } - -void -iosapic_enable_intr (unsigned int vector) -{ - unsigned int dest; - irq_desc_t *desc; - - /* - * In the case of a shared interrupt, do not re-route the vector, and - * especially do not mask a running interrupt (startup will not get - * called for a shared interrupt). - */ - desc = irq_descp(vector); - if (desc->action) - return; - -#ifdef CONFIG_SMP - /* - * For platforms that do not support interrupt redirect via the XTP interface, we - * can round-robin the PCI device interrupts to the processors - */ - if (!(smp_int_redirect & SMP_IRQ_REDIRECTION)) { - static int cpu_index = -1; - - do - if (++cpu_index >= NR_CPUS) - cpu_index = 0; - while (!cpu_online(cpu_index)); - - dest = cpu_physical_id(cpu_index) & 0xffff; - } else { - /* - * Direct the interrupt vector to the current cpu, platform redirection - * will distribute them. - */ - dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff; - } -#else - /* direct the interrupt vector to the running cpu id */ - dest = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff; -#endif - set_rte(vector, dest, 1); - - printk(KERN_INFO "IOSAPIC: vector %d -> CPU 0x%04x, enabled\n", - vector, dest); -} - -#ifdef CONFIG_ACPI_PCI - -void __init -iosapic_parse_prt (void) -{ - struct acpi_prt_entry *entry; - struct list_head *node; - unsigned int gsi; - int vector; - char pci_id[16]; - struct hw_interrupt_type *irq_type = &irq_type_iosapic_level; - irq_desc_t *idesc; - - list_for_each(node, &acpi_prt.entries) { - entry = list_entry(node, struct acpi_prt_entry, node); - - /* We're only interested in static (non-link) entries. */ - if (entry->link.handle) - continue; - - gsi = entry->link.index; - - vector = gsi_to_vector(gsi); - if (vector < 0) { - if (find_iosapic(gsi) < 0) - continue; - - /* allocate a vector for this interrupt line */ - if (pcat_compat && (gsi < 16)) - vector = isa_irq_to_vector(gsi); - else - /* new GSI; allocate a vector for it */ - vector = assign_irq_vector(AUTO_ASSIGN); - - register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, IOSAPIC_POL_LOW, - IOSAPIC_LEVEL); - } - entry->irq = vector; - snprintf(pci_id, sizeof(pci_id), "%02x:%02x:%02x[%c]", - entry->id.segment, entry->id.bus, entry->id.device, 'A' + entry->pin); - - /* - * If vector was previously initialized to a different - * handler, re-initialize. - */ - idesc = irq_descp(vector); - if (idesc->handler != irq_type) - register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, IOSAPIC_POL_LOW, - IOSAPIC_LEVEL); - - } -} - -#endif /* CONFIG_ACPI */ diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index 37c17881d..42056fbaa 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c @@ -56,7 +56,6 @@ #include #include -extern cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; /* * Linux has a controller-independent x86 interrupt architecture. @@ -85,6 +84,11 @@ irq_desc_t _irq_desc[NR_IRQS] __cacheline_aligned = { } }; +/* + * This is updated when the user sets irq affinity via /proc + */ +cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; + #ifdef CONFIG_IA64_GENERIC irq_desc_t * __ia64_irq_desc (unsigned int irq) { diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 26eb18052..aa2cb4fc3 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -330,18 +330,8 @@ setup_arch (char **cmdline_p) setup_serial_hcdp(efi.hcdp); } #endif - /* - * Without HCDP, we won't discover any serial ports until the serial driver looks - * in the ACPI namespace. If ACPI claims there are some legacy devices, register - * the legacy COM ports so serial console works earlier. This is slightly dangerous - * because we don't *really* know whether there's anything there, but we hope that - * all new boxes will implement HCDP. - */ - { - extern unsigned char acpi_legacy_devices; - if (!efi.hcdp && acpi_legacy_devices) - setup_serial_legacy(); - } + if (!efi.hcdp) + setup_serial_legacy(); #endif #ifdef CONFIG_VT @@ -635,6 +625,9 @@ cpu_init (void) ia32_cpu_init(); #endif + /* Clear ITC to eliminiate sched_clock() overflows in human time. */ + ia64_set_itc(0); + /* disable all local interrupt sources: */ ia64_set_itv(1 << 16); ia64_set_lrr0(1 << 16); diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 8058fb588..8cef119ac 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c @@ -202,7 +202,6 @@ ia64_sync_itc (unsigned int master) { long i, delta, adj, adjust_latency = 0, done = 0; unsigned long flags, rt, master_time_stamp, bound; - extern void ia64_cpu_local_tick (void); #if DEBUG_ITC_SYNC struct { long rt; /* roundtrip time */ @@ -525,7 +524,7 @@ build_cpu_to_node_map (void) #else # error Fixme: Dunno how to build CPU-to-node map. #endif - cpu_to_node_map[cpu] = node; + cpu_to_node_map[cpu] = (node >= 0) ? node : 0; if (node >= 0) cpu_set(cpu, node_to_cpu_mask[node]); } diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 3ebc74a5d..e33bcb661 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -45,14 +45,6 @@ EXPORT_SYMBOL(last_cli_ip); #endif -unsigned long long -sched_clock (void) -{ - unsigned long offset = ia64_get_itc(); - - return (offset * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT; -} - static void itc_reset (void) { diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 5c45718a9..57912212b 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -195,11 +195,10 @@ SECTIONS .data : AT(ADDR(.data) - LOAD_OFFSET) { *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS } - . = ALIGN(16); - __gp = . + 0x200000; /* gp must be 16-byte aligned for exc. table */ - + . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */ .got : AT(ADDR(.got) - LOAD_OFFSET) { *(.got.plt) *(.got) } + __gp = ADDR(.got) + 0x200000; /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ diff --git a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile index 218de3efc..1902c3c2e 100644 --- a/arch/ia64/lib/Makefile +++ b/arch/ia64/lib/Makefile @@ -6,7 +6,7 @@ obj-y := io.o lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ __divdi3.o __udivdi3.o __moddi3.o __umoddi3.o \ - checksum.o clear_page.o csum_partial_copy.o copy_page.o \ + bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \ clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ flush.o ip_fast_csum.o do_csum.o \ memset.o strlen.o swiotlb.o diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 662674017..82204f1bd 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -134,10 +134,18 @@ static struct pci_ops pci_root_ops = { static int __init pci_acpi_init (void) { - if (!acpi_pci_irq_init()) - printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); - else - printk(KERN_WARNING "PCI: Invalid ACPI-PCI IRQ routing table\n"); + struct pci_dev *dev = NULL; + + printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); + + /* + * PCI IRQ routing is set up by pci_enable_device(), but we + * also do it here in case there are still broken drivers that + * don't use pci_enable_device(). + */ + while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) + acpi_pci_irq_enable(dev); + return 0; } @@ -323,8 +331,10 @@ pcibios_fixup_device_resources (struct pci_dev *dev, struct pci_bus *bus) struct pci_controller *controller = PCI_CONTROLLER(dev); struct pci_window *window; int i, j; + int limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? \ + PCI_ROM_RESOURCE : PCI_NUM_RESOURCES; - for (i = 0; i < PCI_NUM_RESOURCES; i++) { + for (i = 0; i < limit; i++) { if (!dev->resource[i].start) continue; diff --git a/arch/ia64/sn/io/machvec/iomv.c b/arch/ia64/sn/io/machvec/iomv.c index df17cc049..10ee752ea 100644 --- a/arch/ia64/sn/io/machvec/iomv.c +++ b/arch/ia64/sn/io/machvec/iomv.c @@ -71,6 +71,6 @@ sn_mmiob (void) { while ((((volatile unsigned long) (*pda->pio_write_status_addr)) & SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) != SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) - udelay(1); + cpu_relax(); } EXPORT_SYMBOL(sn_mmiob); diff --git a/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c index f8147fec7..a4d7c5615 100644 --- a/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c +++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c @@ -3,7 +3,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2001-2003 Silicon Graphics, Inc. All rights reserved. + * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved. */ #include @@ -1615,6 +1615,46 @@ pcibr_piomap_probe(pcibr_piomap_t piomap, off_t offset, int len, void *valp) piomap->bp_kvaddr + offset, len, valp); } +static uint64_t +pcibr_disable_mst_timeout(pcibr_soft_t pcibr_soft) +{ + uint64_t old_enable; + uint64_t new_enable; + uint64_t intr_bits; + + intr_bits = PIC_ISR_PCI_MST_TIMEOUT + | PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG; + old_enable = pcireg_intr_enable_get(pcibr_soft); + pcireg_intr_enable_bit_clr(pcibr_soft, intr_bits); + new_enable = pcireg_intr_enable_get(pcibr_soft); + + if (old_enable == new_enable) { + return 0; /* was already disabled */ + } else { + return 1; + } +} + +static int +pcibr_enable_mst_timeout(pcibr_soft_t pcibr_soft) +{ + uint64_t old_enable; + uint64_t new_enable; + uint64_t intr_bits; + + intr_bits = PIC_ISR_PCI_MST_TIMEOUT + | PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG; + old_enable = pcireg_intr_enable_get(pcibr_soft); + pcireg_intr_enable_bit_set(pcibr_soft, intr_bits); + new_enable = pcireg_intr_enable_get(pcibr_soft); + + if (old_enable == new_enable) { + return 0; /* was alread enabled */ + } else { + return 1; + } +} + /* * pcibr_probe_slot: read a config space word * while trapping any errors; return zero if @@ -1628,7 +1668,7 @@ pcibr_probe_work(pcibr_soft_t pcibr_soft, int len, void *valp) { - int rv; + int rv, changed; /* * Sanity checks ... @@ -1642,15 +1682,19 @@ pcibr_probe_work(pcibr_soft_t pcibr_soft, return -1; /* invalid alignment */ } + changed = pcibr_disable_mst_timeout(pcibr_soft); + rv = snia_badaddr_val((void *)addr, len, valp); /* Clear the int_view register incase it was set */ pcireg_intr_reset_set(pcibr_soft, BRIDGE_IRR_MULTI_CLR); + if (changed) { + pcibr_enable_mst_timeout(pcibr_soft); + } return (rv ? 1 : 0); /* return 1 for snia_badaddr_val error, 0 if ok */ } - void pcibr_device_info_free(vertex_hdl_t pcibr_vhdl, pciio_slot_t slot) { diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 552bd2ff1..b426ab55a 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c index 51ee0a032..3897043a1 100644 --- a/arch/m68knommu/kernel/init_task.c +++ b/arch/m68knommu/kernel/init_task.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c index 945606b2e..aeda7f583 100644 --- a/arch/mips/kernel/init_task.c +++ b/arch/mips/kernel/init_task.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c index ed4fb5858..c71b9462b 100644 --- a/arch/parisc/kernel/init_task.c +++ b/arch/parisc/kernel/init_task.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c index 226214c66..d9df49ceb 100644 --- a/arch/ppc/8260_io/fcc_enet.c +++ b/arch/ppc/8260_io/fcc_enet.c @@ -158,12 +158,21 @@ static int fcc_enet_set_mac_address(struct net_device *dev, void *addr); #define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV) #define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER) +#ifdef CONFIG_SBC82xx +/* rx is clk9, tx is clk10 + */ +#define PC_F1RXCLK ((uint)0x00000100) +#define PC_F1TXCLK ((uint)0x00000200) +#define CMX1_CLK_ROUTE ((uint)0x25000000) +#define CMX1_CLK_MASK ((uint)0xff000000) +#else /* CLK12 is receive, CLK11 is transmit. These are board specific. */ #define PC_F1RXCLK ((uint)0x00000800) #define PC_F1TXCLK ((uint)0x00000400) #define CMX1_CLK_ROUTE ((uint)0x3e000000) #define CMX1_CLK_MASK ((uint)0xff000000) +#endif /* !CONFIG_SBC82xx */ /* I/O Pin assignment for FCC2. I don't yet know the best way to do this, * but there is little variation among the choices. @@ -288,6 +297,8 @@ struct fcc_enet_private { ushort skb_cur; ushort skb_dirty; + atomic_t n_pkts; /* Number of packets in tx ring */ + /* CPM dual port RAM relative addresses. */ cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ @@ -347,6 +358,7 @@ fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv; volatile cbd_t *bdp; + int idx; if (!cep->link) { /* Link is down or autonegotiation is in progress. */ @@ -379,13 +391,24 @@ fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) bdp->cbd_datlen = skb->len; bdp->cbd_bufaddr = __pa(skb->data); + spin_lock_irq(&cep->lock); + /* Save skb pointer. */ - cep->tx_skbuff[cep->skb_cur] = skb; + idx = cep->skb_cur & TX_RING_MOD_MASK; + if (cep->tx_skbuff[idx]) { + /* This should never happen (any more). + Leave the sanity check in for now... */ + printk(KERN_ERR "EEP. cep->tx_skbuff[%d] is %p not NULL in %s\n", + idx, cep->tx_skbuff[idx], __func__); + printk(KERN_ERR "Expect to lose %d bytes of sock space", + cep->tx_skbuff[idx]->truesize); + } + cep->tx_skbuff[idx] = skb; cep->stats.tx_bytes += skb->len; - cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK; + cep->skb_cur++; - spin_lock_irq(&cep->lock); + atomic_inc(&cep->n_pkts); /* Send it on its way. Tell CPM its ready, interrupt when done, * its the last BD of the frame, and to put the CRC on the end. @@ -404,9 +427,13 @@ fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) else bdp++; - if (bdp->cbd_sc & BD_ENET_TX_READY) { - netif_stop_queue(dev); + + /* If the tx_ring is full, stop the queue */ + if (atomic_read(&cep->n_pkts) >= (TX_RING_SIZE-1)) { + if (!netif_queue_stopped(dev)) { + netif_stop_queue(dev); cep->tx_full = 1; + } } cep->cur_tx = (cbd_t *)bdp; @@ -460,6 +487,7 @@ fcc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs) volatile cbd_t *bdp; ushort int_events; int must_restart; + int idx; cep = (struct fcc_enet_private *)dev->priv; @@ -522,8 +550,12 @@ fcc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs) cep->stats.collisions++; /* Free the sk buffer associated with this last transmit. */ - dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]); - cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK; + idx = cep->skb_dirty & TX_RING_MOD_MASK; + dev_kfree_skb_irq(cep->tx_skbuff[idx]); + cep->tx_skbuff[idx] = NULL; + cep->skb_dirty++; + + atomic_dec(&cep->n_pkts); /* Update pointer to next buffer descriptor to be transmitted. */ if (bdp->cbd_sc & BD_ENET_TX_WRAP) @@ -1594,11 +1626,21 @@ init_fcc_param(fcc_info_t *fip, struct net_device *dev, */ eap = (unsigned char *)&(ep->fen_paddrh); for (i=5; i>=0; i--) { +#ifdef CONFIG_SBC82xx + if (i == 5) { + /* bd->bi_enetaddr holds the SCC0 address; the FCC + devices count up from there */ + dev->dev_addr[i] = bd->bi_enetaddr[i] & ~3; + dev->dev_addr[i] += 1 + fip->fc_fccnum; + *eap++ = dev->dev_addr[i]; + } +#else if (i == 3) { dev->dev_addr[i] = bd->bi_enetaddr[i]; dev->dev_addr[i] |= (1 << (7 - fip->fc_fccnum)); *eap++ = dev->dev_addr[i]; } +#endif else { *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i]; } @@ -1683,6 +1725,7 @@ init_fcc_param(fcc_info_t *fip, struct net_device *dev, while (cp->cp_cpcr & CPM_CR_FLG); cep->skb_cur = cep->skb_dirty = 0; + atomic_set(&cep->n_pkts, 0); } /* Let 'er rip. diff --git a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c index 3e9f887ee..23c0322d5 100644 --- a/arch/ppc/8260_io/uart.c +++ b/arch/ppc/8260_io/uart.c @@ -161,7 +161,7 @@ static struct serial_state rs_table[] = { #ifndef CONFIG_SCC1_ENET { 0, 0, PROFF_SCC1, SIU_INT_SCC1, 0, SCC_NUM_BASE}, /* SCC1 ttyS2 */ #endif -#ifndef CONFIG_SCC2_ENET +#if !defined(CONFIG_SBC82xx) && !defined(CONFIG_SCC2_ENET) { 0, 0, PROFF_SCC2, SIU_INT_SCC2, 0, SCC_NUM_BASE + 1}, /* SCC2 ttyS3 */ #endif }; @@ -475,7 +475,7 @@ static _INLINE_ void receive_chars(ser_info_t *info, struct pt_regs *regs) if (break_pressed && info->line == sercons.index) { if (ch != 0 && time_before(jiffies, break_pressed + HZ*5)) { - handle_sysrq(ch, regs, NULL, NULL); + handle_sysrq(ch, regs, NULL); break_pressed = 0; goto ignore_char; } else diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index faeb15e37..2b49740fb 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -72,8 +72,21 @@ config POWER4 config 8xx bool "8xx" +config E500 + bool "e500" + endchoice +config BOOKE + bool + depends on E500 + default y + +config FSL_BOOKE + bool + depends on E500 + default y + config PTE_64BIT bool depends on 44x @@ -96,6 +109,21 @@ config ALTIVEC If in doubt, say Y here. +config SPE + bool "SPE Support" + depends on E500 + ---help--- + This option enables kernel support for the Signal Processing + Extensions (SPE) to the PowerPC processor. The kernel currently + supports saving and restoring SPE registers, and turning on the + 'spe enable' bit so user processes can execute SPE instructions. + + This option is only usefully if you have a processor that supports + SPE (e500, otherwise known as 85xx series), but does not have any + affect on a non-spe cpu (it does, however add code to the kernel). + + If in doubt, say Y here. + config TAU bool "Thermal Management Support" depends on 6xx && !8260 @@ -142,7 +170,7 @@ config TAU_AVERAGE config MATH_EMULATION bool "Math emulation" - depends on 4xx || 8xx + depends on 4xx || 8xx || E500 ---help--- Some PowerPC chips designed for embedded applications do not have a floating-point unit and therefore do not implement the @@ -198,6 +226,7 @@ config PPC601_SYNC_FIX If in doubt, say Y here. source arch/ppc/platforms/4xx/Kconfig +source arch/ppc/platforms/85xx/Kconfig config PPC64BRIDGE bool @@ -542,6 +571,15 @@ config EST8260 , but the EST8260 cannot be found on it and has probably been discontinued or rebadged. +config SBC82xx + bool "SBC82xx" + ---help--- + SBC PowerQUICC II, single-board computer with MPC82xx CPU + Manufacturer: Wind River Systems, Inc. + Date of Release: May 2003 + End of Life: - + URL: + config SBS8260 bool "SBS8260" @@ -575,7 +613,7 @@ config EMBEDDEDBOOT config 8260 bool "MPC8260 CPM Support" if WILLOW depends on 6xx - default y if TQM8260 || RPXSUPER || EST8260 || SBS8260 + default y if TQM8260 || RPXSUPER || EST8260 || SBS8260 || SBC82xx help The MPC8260 CPM (Communications Processor Module) is a typical embedded CPU made by Motorola. Selecting this option means that @@ -965,8 +1003,8 @@ config MCA bool config PCI - bool "PCI support" if 40x || 8260 - default y if !40x && !8260 && !8xx && !APUS + bool "PCI support" if 40x || 8260 || 85xx + default y if !40x && !8260 && !8xx && !APUS && !85xx default PCI_PERMEDIA if !4xx && !8260 && !8xx && APUS default PCI_QSPAN if !4xx && !8260 && 8xx help @@ -1264,7 +1302,7 @@ config SERIAL_TEXT_DEBUG config PPC_OCP bool - depends on IBM_OCP + depends on IBM_OCP || FSL_OCP default y endmenu diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index 36d94afe2..cf7a3a47a 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile @@ -17,19 +17,24 @@ LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic CPPFLAGS += -Iarch/$(ARCH) AFLAGS += -Iarch/$(ARCH) cflags-y += -Iarch/$(ARCH) -msoft-float -pipe \ - -ffixed-r2 -Wno-uninitialized -mmultiple -mstring + -ffixed-r2 -Wno-uninitialized -mmultiple CPP = $(CC) -E $(CFLAGS) +ifndef CONFIG_E500 +cflags-y += -mstring +endif + cflags-$(CONFIG_4xx) += -Wa,-m405 +cflags-$(CONFIG_E500) += -Wa,-me500 cflags-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge CFLAGS += $(cflags-y) - head-y := arch/ppc/kernel/head.o head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o head-$(CONFIG_4xx) := arch/ppc/kernel/head_4xx.o head-$(CONFIG_44x) := arch/ppc/kernel/head_44x.o +head-$(CONFIG_E500) := arch/ppc/kernel/head_e500.o head-$(CONFIG_6xx) += arch/ppc/kernel/idle_6xx.o head-$(CONFIG_POWER4) += arch/ppc/kernel/idle_power4.o @@ -37,6 +42,7 @@ head-$(CONFIG_POWER4) += arch/ppc/kernel/idle_power4.o core-y += arch/ppc/kernel/ arch/ppc/platforms/ \ arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/ core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/ +core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/ core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/ core-$(CONFIG_XMON) += arch/ppc/xmon/ core-$(CONFIG_APUS) += arch/ppc/amiga/ @@ -87,7 +93,7 @@ include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s ifdef CONFIG_6xx # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later -NEW_AS := $(shell echo dssall | $(AS) -o /dev/null >/dev/null 2>&1 ; echo $$?) +NEW_AS := $(shell echo dssall | $(AS) -many -o /dev/null >/dev/null 2>&1 ; echo $$?) GOODVER := 2.12.1 else NEW_AS := 0 @@ -95,7 +101,7 @@ endif ifneq ($(NEW_AS),0) checkbin: - @echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build' + @echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' @echo 'correctly with old versions of binutils.' @echo '*** Please upgrade your binutils to ${GOODVER} or newer' @false diff --git a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c index 8f40dd1a1..4dc12e6ab 100644 --- a/arch/ppc/boot/simple/embed_config.c +++ b/arch/ppc/boot/simple/embed_config.c @@ -10,6 +10,7 @@ #include #include #include +#include #ifdef CONFIG_8xx #include #endif @@ -402,14 +403,18 @@ embed_config(bd_t **bdp) #ifdef CONFIG_8260 /* Compute 8260 clock values if the rom doesn't provide them. - * We can't compute the internal core frequency (I don't know how to - * do that). */ +static unsigned char bus2core_8260[] = { +/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, 2, + 6, 5, 13, 2, 14, 4, 15, 2, 3, 11, 8, 10, 16, 12, 7, 2, +}; + static void clk_8260(bd_t *bd) { uint scmr, vco_out, clkin; - uint plldf, pllmf, busdf, brgdf, cpmdf; + uint plldf, pllmf, corecnf; volatile immap_t *ip; ip = (immap_t *)IMAP_ADDR; @@ -423,8 +428,7 @@ clk_8260(bd_t *bd) */ plldf = (scmr >> 12) & 1; pllmf = scmr & 0xfff; - cpmdf = (scmr >> 16) & 0x0f; - busdf = (scmr >> 20) & 0x0f; + corecnf = (scmr >> 24) &0x1f; /* This is arithmetic from the 8260 manual. */ @@ -433,6 +437,7 @@ clk_8260(bd_t *bd) bd->bi_vco = vco_out; /* Save for later */ bd->bi_cpmfreq = vco_out / 2; /* CPM Freq, in MHz */ + bd->bi_intfreq = bd->bi_busfreq * bus2core_8260[corecnf] / 2; /* Set Baud rate divisor. The power up default is divide by 16, * but we set it again here in case it was changed. @@ -440,8 +445,79 @@ clk_8260(bd_t *bd) ip->im_clkrst.car_sccr = 1; /* DIV 16 BRG */ bd->bi_brgfreq = vco_out / 16; } + +static unsigned char bus2core_8280[] = { +/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + 3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, 2, + 6, 5, 13, 2, 14, 2, 15, 2, 3, 2, 2, 2, 16, 2, 2, 2, +}; + +static void +clk_8280(bd_t *bd) +{ + uint scmr, main_clk, clkin; + uint pllmf, corecnf; + volatile immap_t *ip; + + ip = (immap_t *)IMAP_ADDR; + scmr = ip->im_clkrst.car_scmr; + + /* The clkin is always bus frequency. + */ + clkin = bd->bi_busfreq; + + /* Collect the bits from the scmr. + */ + pllmf = scmr & 0xf; + corecnf = (scmr >> 24) & 0x1f; + + /* This is arithmetic from the 8280 manual. + */ + main_clk = clkin * (pllmf + 1); + + bd->bi_cpmfreq = main_clk / 2; /* CPM Freq, in MHz */ + bd->bi_intfreq = bd->bi_busfreq * bus2core_8280[corecnf] / 2; + + /* Set Baud rate divisor. The power up default is divide by 16, + * but we set it again here in case it was changed. + */ + ip->im_clkrst.car_sccr = (ip->im_clkrst.car_sccr & 0x3) | 0x1; + bd->bi_brgfreq = main_clk / 16; +} #endif +#ifdef CONFIG_SBC82xx +void +embed_config(bd_t **bdp) +{ + u_char *cp; + int i; + bd_t *bd; + unsigned long pvr; + + bd = *bdp; + + bd = &bdinfo; + *bdp = bd; + bd->bi_baudrate = 9600; + bd->bi_memsize = 256 * 1024 * 1024; /* just a guess */ + + cp = (void*)SBC82xx_MACADDR_NVRAM_SCC1; + memcpy(bd->bi_enetaddr, cp, 6); + + /* can busfreq be calculated? */ + pvr = mfspr(PVR); + if ((pvr & 0xffff0000) == 0x80820000) { + bd->bi_busfreq = 100000000; + clk_8280(bd); + } else { + bd->bi_busfreq = 66000000; + clk_8260(bd); + } + +} +#endif /* SBC82xx */ + #if defined(CONFIG_EST8260) || defined(CONFIG_TQM8260) void embed_config(bd_t **bdp) diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile index 1934cd3f8..c3b03b618 100644 --- a/arch/ppc/kernel/Makefile +++ b/arch/ppc/kernel/Makefile @@ -8,10 +8,14 @@ endif ifdef CONFIG_4xx EXTRA_AFLAGS := -Wa,-m405 endif +ifdef CONFIG_E500 +EXTRA_AFLAGS := -Wa,-me500 +endif extra-$(CONFIG_PPC_STD_MMU) := head.o extra-$(CONFIG_40x) := head_4xx.o extra-$(CONFIG_44x) := head_44x.o +extra-$(CONFIG_E500) := head_e500.o extra-$(CONFIG_8xx) := head_8xx.o extra-$(CONFIG_6xx) += idle_6xx.o extra-$(CONFIG_POWER4) += idle_power4.o diff --git a/arch/ppc/kernel/align.c b/arch/ppc/kernel/align.c index 59a20f388..39f51985e 100644 --- a/arch/ppc/kernel/align.c +++ b/arch/ppc/kernel/align.c @@ -21,7 +21,7 @@ struct aligninfo { unsigned char flags; }; -#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) +#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE) #define OPCD(inst) (((inst) & 0xFC000000) >> 26) #define RS(inst) (((inst) & 0x03E00000) >> 21) #define RA(inst) (((inst) & 0x001F0000) >> 16) @@ -184,7 +184,7 @@ int fix_alignment(struct pt_regs *regs) { int instr, nb, flags; -#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) +#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE) int opcode, f1, f2, f3; #endif int i, t; @@ -199,8 +199,8 @@ fix_alignment(struct pt_regs *regs) CHECK_FULL_REGS(regs); -#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) - /* The 4xx-family processors have no DSISR register, +#if defined(CONFIG_4xx) || defined(CONFIG_POWER4) || defined(CONFIG_BOOKE) + /* The 4xx-family & Book-E processors have no DSISR register, * so we emulate it. * The POWER4 has a DSISR register but doesn't set it on * an alignment fault. -- paulus @@ -250,7 +250,7 @@ fix_alignment(struct pt_regs *regs) flags = aligninfo[instr].flags; - /* For the 4xx-family processors, the 'dar' field of the + /* For the 4xx-family & Book-E processors, the 'dar' field of the * pt_regs structure is overloaded and is really from the DEAR. */ diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index e41af4ff4..1999a42d8 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c @@ -44,7 +44,7 @@ main(void) DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode)); DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0])); DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr)); -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); DEFINE(PT_PTRACED, PT_PTRACED); #endif @@ -54,6 +54,12 @@ main(void) DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr)); DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr)); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0])); + DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc)); + DEFINE(THREAD_SPEFSCR, offsetof(struct thread_struct, spefscr)); + DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe)); +#endif /* CONFIG_SPE */ /* Interrupt register frame */ DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD); DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs)); diff --git a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c index 45732ae13..4f560f560 100644 --- a/arch/ppc/kernel/cputable.c +++ b/arch/ppc/kernel/cputable.c @@ -34,7 +34,8 @@ extern void __setup_cpu_8xx(unsigned long offset, int cpu_nr, struct cpu_spec* s extern void __setup_cpu_generic(unsigned long offset, int cpu_nr, struct cpu_spec* spec); #define CLASSIC_PPC (!defined(CONFIG_8xx) && !defined(CONFIG_4xx) && \ - !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4)) + !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \ + !defined(CONFIG_BOOKE)) /* This table only contains "desktop" CPUs, it need to be filled with embedded * ones as well... @@ -350,6 +351,14 @@ struct cpu_spec cpu_specs[] = { 32, 32, __setup_cpu_603 }, + { /* 8280 is a G2_LE (603e core, plus some) */ + 0x7fff0000, 0x00820000, "8280", + CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB | + CPU_FTR_CAN_NAP | CPU_FTR_HAS_HIGH_BATS, + COMMON_PPC, + 32, 32, + __setup_cpu_603 + }, { /* default match, we assume split I/D cache & TB (non-601)... */ 0x00000000, 0x00000000, "(generic PPC)", CPU_FTR_COMMON | @@ -553,6 +562,16 @@ struct cpu_spec cpu_specs[] = { 0, /*__setup_cpu_440 */ }, #endif /* CONFIG_44x */ +#ifdef CONFIG_E500 + { /* e500 */ + 0xffff0000, 0x80200000, "e500", + /* xxx - galak: add CPU_FTR_CAN_DOZE */ + CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB, + PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, + 32, 32, + 0, /*__setup_cpu_e500 */ + }, +#endif #if !CLASSIC_PPC { /* default match */ 0x00000000, 0x00000000, "(generic PPC)", diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index 8108917ea..4963b79c7 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S @@ -36,7 +36,7 @@ #undef SHOW_SYSCALLS_TASK /* - * MSR_KERNEL is > 0x10000 on 4xx since it include MSR_CE. + * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE. */ #if MSR_KERNEL >= 0x10000 #define LOAD_MSR_KERNEL(r, x) lis r,(x)@h; ori r,r,(x)@l @@ -45,7 +45,7 @@ #endif #ifdef CONFIG_BOOKE -#define COR r8 +#define COR r8 /* Critical Offset Register (COR) */ #define BOOKE_LOAD_COR lis COR,crit_save@ha #define BOOKE_REST_COR mfspr COR,SPRG2 #define BOOKE_SAVE_COR mtspr SPRG2,COR @@ -241,11 +241,11 @@ ret_from_syscall: andi. r0,r9,(_TIF_SYSCALL_TRACE|_TIF_SIGPENDING|_TIF_NEED_RESCHED) bne- syscall_exit_work syscall_exit_cont: -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) /* If the process has its own DBCR0 value, load it up */ lwz r0,PTRACE(r2) andi. r0,r0,PT_PTRACED - bnel- load_4xx_dbcr0 + bnel- load_dbcr0 #endif stwcx. r0,0,r1 /* to clear the reservation */ lwz r4,_LINK(r1) @@ -510,7 +510,12 @@ BEGIN_FTR_SECTION stw r12,THREAD+THREAD_VRSAVE(r2) END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) #endif /* CONFIG_ALTIVEC */ - and. r0,r0,r11 /* FP or altivec enabled? */ +#ifdef CONFIG_SPE + oris r0,r0,MSR_SPE@h /* Disable SPE */ + mfspr r12,SPRN_SPEFSCR /* save spefscr register value */ + stw r12,THREAD+THREAD_SPEFSCR(r2) +#endif /* CONFIG_SPE */ + and. r0,r0,r11 /* FP or altivec or SPE enabled? */ beq+ 1f andc r11,r11,r0 MTMSRD(r11) @@ -543,6 +548,10 @@ BEGIN_FTR_SECTION mtspr SPRN_VRSAVE,r0 /* if G4, restore VRSAVE reg */ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + lwz r0,THREAD+THREAD_SPEFSCR(r2) + mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */ +#endif /* CONFIG_SPE */ lwz r0,_CCR(r1) mtcrf 0xFF,r0 @@ -589,11 +598,11 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ bne do_work restore_user: -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) /* Check whether this process has its own DBCR0 value */ lwz r0,PTRACE(r2) andi. r0,r0,PT_PTRACED - bnel- load_4xx_dbcr0 + bnel- load_dbcr0 #endif #ifdef CONFIG_PREEMPT @@ -645,7 +654,7 @@ restore: PPC405_ERR77(0,r1) stwcx. r0,0,r1 /* to clear the reservation */ -#ifndef CONFIG_4xx +#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) lwz r9,_MSR(r1) andi. r10,r9,MSR_RI /* check if this exception occurred */ beql nonrecoverable /* at a bad place (MSR:RI = 0) */ @@ -681,9 +690,9 @@ exc_exit_restart_end: SYNC RFI -#else /* CONFIG_4xx */ +#else /* !(CONFIG_4xx || CONFIG_BOOKE) */ /* - * This is a bit different on 4xx because 4xx doesn't have + * This is a bit different on 4xx/Book-E because it doesn't have * the RI bit in the MSR. * The TLB miss handler checks if we have interrupted * the exception exit path and restarts it if so @@ -720,6 +729,9 @@ exc_exit_restart_end: * give the wrong answer). * We have to restore various SPRs that may have been in use at the * time of the critical interrupt. + * + * Note that SPRG6 is used for machine check on CONFIG_BOOKE parts and + * thus not saved in the critical handler */ .globl ret_from_crit_exc ret_from_crit_exc: @@ -866,7 +878,7 @@ ret_from_mcheck_exc: * Load the DBCR0 value for a task that is being ptraced, * having first saved away the global DBCR0. */ -load_4xx_dbcr0: +load_dbcr0: mfmsr r0 /* first disable debug exceptions */ rlwinm r0,r0,0,~MSR_DE mtmsr r0 @@ -885,7 +897,7 @@ load_4xx_dbcr0: blr .comm global_dbcr0,8 -#endif /* CONFIG_4xx */ +#endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ do_work: /* r10 contains MSR_KERNEL here */ andi. r0,r9,_TIF_NEED_RESCHED diff --git a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c index c1df60395..f3c0d2cc2 100644 --- a/arch/ppc/kernel/irq.c +++ b/arch/ppc/kernel/irq.c @@ -304,8 +304,10 @@ void disable_irq_nosync(unsigned int irq) void disable_irq(unsigned int irq) { + irq_desc_t *desc = irq_desc + irq; disable_irq_nosync(irq); - synchronize_irq(irq); + if (desc->action) + synchronize_irq(irq); } /** @@ -626,7 +628,9 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { - cpumask_t *mask = (cpumask_t *)data, full_count = count, err; + int err; + int full_count = count; + cpumask_t *mask = (cpumask_t *)data; cpumask_t new_value; err = cpumask_parse(buffer, count, new_value); diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S index c3ed5ed1d..38cd36d6c 100644 --- a/arch/ppc/kernel/misc.S +++ b/arch/ppc/kernel/misc.S @@ -419,7 +419,24 @@ _GLOBAL(_tlbia) ble 1b isync -#else /* !(CONFIG_40x || CONFIG_44x) */ +#elif defined(CONFIG_FSL_BOOKE) + /* Invalidate all entries in TLB0 */ + li r3, 0x04 + tlbivax 0,3 + /* Invalidate all entries in TLB1 */ + li r3, 0x0c + tlbivax 0,3 + /* Invalidate all entries in TLB2 */ + li r3, 0x14 + tlbivax 0,3 + /* Invalidate all entries in TLB3 */ + li r3, 0x1c + tlbivax 0,3 + msync +#ifdef CONFIG_SMP + tlbsync +#endif /* CONFIG_SMP */ +#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */ #if defined(CONFIG_SMP) rlwinm r8,r1,0,0,18 lwz r8,TI_CPU(r8) @@ -487,7 +504,20 @@ _GLOBAL(_tlbie) tlbwe r3, r3, PPC44x_TLB_PAGEID isync 10: -#else /* !(CONFIG_40x || CONFIG_44x) */ +#elif defined(CONFIG_FSL_BOOKE) + rlwinm r4, r3, 0, 0, 19 + ori r5, r4, 0x08 /* TLBSEL = 1 */ + ori r6, r4, 0x10 /* TLBSEL = 2 */ + ori r7, r4, 0x18 /* TLBSEL = 3 */ + tlbivax 0, r4 + tlbivax 0, r5 + tlbivax 0, r6 + tlbivax 0, r7 + msync +#if defined(CONFIG_SMP) + tlbsync +#endif /* CONFIG_SMP */ +#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */ #if defined(CONFIG_SMP) rlwinm r8,r1,0,0,18 lwz r8,TI_CPU(r8) @@ -544,6 +574,10 @@ _GLOBAL(flush_instruction_cache) lis r3, KERNELBASE@h iccci 0,r3 #endif +#elif CONFIG_FSL_BOOKE + mfspr r3,SPRN_L1CSR1 + ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR + mtspr SPRN_L1CSR1,r3 #else mfspr r3,PVR rlwinm r3,r3,16,16,31 @@ -1047,7 +1081,7 @@ _GLOBAL(_get_SP) * and exceptions as if the cpu had performed the load or store. */ -#if defined(CONFIG_4xx) +#if defined(CONFIG_4xx) || defined(CONFIG_E500) _GLOBAL(cvt_fd) lfs 0,0(r3) stfd 0,0(r4) diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 5b4965534..f095fcd74 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c @@ -128,7 +128,7 @@ pcibios_fixup_resources(struct pci_dev *dev) struct resource *res = dev->resource + i; if (!res->flags) continue; - if (!res->start || res->end == 0xffffffff) { + if (res->end == 0xffffffff) { DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", pci_name(dev), i, res->start, res->end); res->end -= res->start; @@ -347,6 +347,8 @@ pci_relocate_bridge_resource(struct pci_bus *bus, int i) return -1; } res = bus->resource[i]; + if (res == NULL) + return -1; pr = NULL; for (j = 0; j < 4; j++) { struct resource *r = parent->resource[j]; @@ -659,11 +661,11 @@ make_one_node_map(struct device_node* node, u8 pci_bus) return; bus_range = (int *) get_property(node, "bus-range", &len); if (bus_range == NULL || len < 2 * sizeof(int)) { - printk(KERN_WARNING "Can't get bus-range for %s\n", - node->full_name); - return; - } - pci_to_OF_bus_map[pci_bus] = bus_range[0]; + printk(KERN_WARNING "Can't get bus-range for %s, " + "assuming it starts at 0\n", node->full_name); + pci_to_OF_bus_map[pci_bus] = 0; + } else + pci_to_OF_bus_map[pci_bus] = bus_range[0]; for (node=node->child; node != 0;node = node->sibling) { struct pci_dev* dev; @@ -1073,6 +1075,8 @@ do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga) u16 w; struct resource res; + if (bus->resource[0] == NULL) + return; res = *(bus->resource[0]); DBG("Remapping Bus %d, bridge: %s\n", bus->number, bridge->slot_name); @@ -1168,7 +1172,8 @@ do_fixup_p2p_level(struct pci_bus *bus) int has_vga = 0; for (parent_io=0; parent_io<4; parent_io++) - if (bus->resource[parent_io]->flags & IORESOURCE_IO) + if (bus->resource[parent_io] + && bus->resource[parent_io]->flags & IORESOURCE_IO) break; if (parent_io >= 4) return; diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c index 7d2f3a5cd..ad7808fa6 100644 --- a/arch/ppc/kernel/ppc_htab.c +++ b/arch/ppc/kernel/ppc_htab.c @@ -101,7 +101,7 @@ static ssize_t ppc_htab_read(struct file * file, char __user * buf, { unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0; int n = 0; -#ifdef CONFIG_PPC_STD_MMU +#if defined(CONFIG_PPC_STD_MMU) && !defined(CONFIG_PPC64BRIDGE) unsigned int kptes = 0, uptes = 0; PTE *ptr; #endif /* CONFIG_PPC_STD_MMU */ @@ -135,6 +135,7 @@ static ssize_t ppc_htab_read(struct file * file, char __user * buf, goto return_string; } +#ifndef CONFIG_PPC64BRIDGE for (ptr = Hash; ptr < Hash_end; ptr++) { unsigned int mctx, vsid; @@ -148,6 +149,7 @@ static ssize_t ppc_htab_read(struct file * file, char __user * buf, else uptes++; } +#endif n += sprintf( buffer + n, "PTE Hash Table Information\n" @@ -155,16 +157,20 @@ static ssize_t ppc_htab_read(struct file * file, char __user * buf, "Buckets\t\t: %lu\n" "Address\t\t: %08lx\n" "Entries\t\t: %lu\n" +#ifndef CONFIG_PPC64BRIDGE "User ptes\t: %u\n" "Kernel ptes\t: %u\n" - "Percent full\t: %lu%%\n", - (unsigned long)(Hash_size>>10), + "Percent full\t: %lu%%\n" +#endif + , (unsigned long)(Hash_size>>10), (Hash_size/(sizeof(PTE)*8)), (unsigned long)Hash, - Hash_size/sizeof(PTE), - uptes, + Hash_size/sizeof(PTE) +#ifndef CONFIG_PPC64BRIDGE + , uptes, kptes, ((kptes+uptes)*100) / (Hash_size/sizeof(PTE)) +#endif ); n += sprintf( buffer + n, diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 0bcd36a64..9bd46c140 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c @@ -199,16 +199,11 @@ EXPORT_SYMBOL(flush_tlb_page); EXPORT_SYMBOL(last_task_used_altivec); EXPORT_SYMBOL(giveup_altivec); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE +EXPORT_SYMBOL(last_task_used_spe); +EXPORT_SYMBOL(giveup_spe); +#endif /* CONFIG_SPE */ #ifdef CONFIG_SMP -#ifdef CONFIG_DEBUG_SPINLOCK -EXPORT_SYMBOL(_raw_spin_lock); -EXPORT_SYMBOL(_raw_spin_unlock); -EXPORT_SYMBOL(_raw_spin_trylock); -EXPORT_SYMBOL(_raw_read_lock); -EXPORT_SYMBOL(_raw_read_unlock); -EXPORT_SYMBOL(_raw_write_lock); -EXPORT_SYMBOL(_raw_write_unlock); -#endif EXPORT_SYMBOL(smp_call_function); EXPORT_SYMBOL(smp_hw_index); EXPORT_SYMBOL(synchronize_irq); @@ -333,7 +328,7 @@ EXPORT_SYMBOL(debugger_fault_handler); EXPORT_SYMBOL(cpm_install_handler); EXPORT_SYMBOL(cpm_free_handler); #endif /* CONFIG_8xx */ -#if defined(CONFIG_8xx) || defined(CONFIG_40x) +#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx) EXPORT_SYMBOL(__res); #endif #if defined(CONFIG_8xx) diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index 19515a1f9..f6d8cd314 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,7 @@ extern unsigned long _get_SP(void); struct task_struct *last_task_used_math = NULL; struct task_struct *last_task_used_altivec = NULL; +struct task_struct *last_task_used_spe = NULL; static struct fs_struct init_fs = INIT_FS; static struct files_struct init_files = INIT_FILES; @@ -163,7 +165,7 @@ dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) void enable_kernel_altivec(void) { - WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); + WARN_ON(preemptible()); #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) @@ -177,10 +179,38 @@ enable_kernel_altivec(void) EXPORT_SYMBOL(enable_kernel_altivec); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE +int +dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs) +{ + if (regs->msr & MSR_SPE) + giveup_spe(current); + /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */ + memcpy(evrregs, ¤t->thread.evr[0], sizeof(u32) * 35); + return 1; +} + +void +enable_kernel_spe(void) +{ + WARN_ON(preemptible()); + +#ifdef CONFIG_SMP + if (current->thread.regs && (current->thread.regs->msr & MSR_SPE)) + giveup_spe(current); + else + giveup_spe(NULL); /* just enable SPE for kernel - force */ +#else + giveup_spe(last_task_used_spe); +#endif /* __SMP __ */ +} +EXPORT_SYMBOL(enable_kernel_spe); +#endif /* CONFIG_SPE */ + void enable_kernel_fp(void) { - WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled()); + WARN_ON(preemptible()); #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) @@ -244,6 +274,17 @@ struct task_struct *__switch_to(struct task_struct *prev, if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC))) giveup_altivec(prev); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + /* + * If the previous thread used spe in the last quantum + * (thus changing spe regs) then save them. + * + * On SMP we always save/restore spe regs just to avoid the + * complexity of changing processors. + */ + if ((prev->thread.regs && (prev->thread.regs->msr & MSR_SPE))) + giveup_spe(prev); +#endif /* CONFIG_SPE */ #endif /* CONFIG_SMP */ /* Avoid the trap. On smp this this never happens since @@ -251,6 +292,13 @@ struct task_struct *__switch_to(struct task_struct *prev, */ if (new->thread.regs && last_task_used_altivec == new) new->thread.regs->msr |= MSR_VEC; +#ifdef CONFIG_SPE + /* Avoid the trap. On smp this this never happens since + * we don't set last_task_used_spe + */ + if (new->thread.regs && last_task_used_spe == new) + new->thread.regs->msr |= MSR_SPE; +#endif /* CONFIG_SPE */ new_thread = &new->thread; old_thread = ¤t->thread; last = _switch(old_thread, new_thread); @@ -354,6 +402,10 @@ void prepare_to_copy(struct task_struct *tsk) if (regs->msr & MSR_VEC) giveup_altivec(current); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + if (regs->msr & MSR_SPE) + giveup_spe(current); +#endif /* CONFIG_SPE */ preempt_enable(); } @@ -438,18 +490,45 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp) current->thread.vrsave = 0; current->thread.used_vr = 0; #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + memset(current->thread.evr, 0, sizeof(current->thread.evr)); + current->thread.acc = 0; + current->thread.spefscr = 0; + current->thread.used_spe = 0; +#endif /* CONFIG_SPE */ } +#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \ + | PR_FP_EXC_RES | PR_FP_EXC_INV) + int set_fpexc_mode(struct task_struct *tsk, unsigned int val) { struct pt_regs *regs = tsk->thread.regs; - if (val > PR_FP_EXC_PRECISE) + /* This is a bit hairy. If we are an SPE enabled processor + * (have embedded fp) we store the IEEE exception enable flags in + * fpexc_mode. fpexc_mode is also used for setting FP exception + * mode (asyn, precise, disabled) for 'Classic' FP. */ + if (val & PR_FP_EXC_SW_ENABLE) { +#ifdef CONFIG_SPE + tsk->thread.fpexc_mode = val & + (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT); +#else return -EINVAL; - tsk->thread.fpexc_mode = __pack_fe01(val); - if (regs != NULL && (regs->msr & MSR_FP) != 0) - regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1)) - | tsk->thread.fpexc_mode; +#endif + } else { + /* on a CONFIG_SPE this does not hurt us. The bits that + * __pack_fe01 use do not overlap with bits used for + * PR_FP_EXC_SW_ENABLE. Additionally, the MSR[FE0,FE1] bits + * on CONFIG_SPE implementations are reserved so writing to + * them does not change anything */ + if (val > PR_FP_EXC_PRECISE) + return -EINVAL; + tsk->thread.fpexc_mode = __pack_fe01(val); + if (regs != NULL && (regs->msr & MSR_FP) != 0) + regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1)) + | tsk->thread.fpexc_mode; + } return 0; } @@ -457,7 +536,14 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) { unsigned int val; - val = __unpack_fe01(tsk->thread.fpexc_mode); + if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) +#ifdef CONFIG_SPE + val = tsk->thread.fpexc_mode; +#else + return -EINVAL; +#endif + else + val = __unpack_fe01(tsk->thread.fpexc_mode); return put_user(val, (unsigned int *) adr); } @@ -506,6 +592,10 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, if (regs->msr & MSR_VEC) giveup_altivec(current); #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + if (regs->msr & MSR_SPE) + giveup_spe(current); +#endif /* CONFIG_SPE */ preempt_enable(); error = do_execve(filename, (char __user *__user *) a1, (char __user *__user *) a2, regs); diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c index 2ddfb1a37..30a81ffb5 100644 --- a/arch/ppc/kernel/ptrace.c +++ b/arch/ppc/kernel/ptrace.c @@ -35,7 +35,7 @@ /* * Set of msr bits that gdb can change on behalf of a process. */ -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) #define MSR_DEBUGCHANGE 0 #else #define MSR_DEBUGCHANGE (MSR_SE | MSR_BE) @@ -131,13 +131,77 @@ static inline int set_vrregs(struct task_struct *task, unsigned long *data) } #endif +#ifdef CONFIG_SPE + +/* + * For get_evrregs/set_evrregs functions 'data' has the following layout: + * + * struct { + * u32 evr[32]; + * u64 acc; + * u32 spefscr; + * } + */ + +/* + * Get contents of SPE register state in task TASK. + */ +static inline int get_evrregs(unsigned long *data, struct task_struct *task) +{ + int i; + + if (!access_ok(VERIFY_WRITE, data, 35 * sizeof(unsigned long))) + return -EFAULT; + + /* copy SPEFSCR */ + if (__put_user(task->thread.spefscr, &data[34])) + return -EFAULT; + + /* copy SPE registers EVR[0] .. EVR[31] */ + for (i = 0; i < 32; i++, data++) + if (__put_user(task->thread.evr[i], data)) + return -EFAULT; + + /* copy ACC */ + if (__put_user64(task->thread.acc, (unsigned long long *)data)) + return -EFAULT; + + return 0; +} + +/* + * Write contents of SPE register state into task TASK. + */ +static inline int set_evrregs(struct task_struct *task, unsigned long *data) +{ + int i; + + if (!access_ok(VERIFY_READ, data, 35 * sizeof(unsigned long))) + return -EFAULT; + + /* copy SPEFSCR */ + if (__get_user(task->thread.spefscr, &data[34])) + return -EFAULT; + + /* copy SPE registers EVR[0] .. EVR[31] */ + for (i = 0; i < 32; i++, data++) + if (__get_user(task->thread.evr[i], data)) + return -EFAULT; + /* copy ACC */ + if (__get_user64(task->thread.acc, (unsigned long long*)data)) + return -EFAULT; + + return 0; +} +#endif /* CONFIG_SPE */ + static inline void set_single_step(struct task_struct *task) { struct pt_regs *regs = task->thread.regs; if (regs != NULL) { -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC; /* MSR.DE should already be set */ #else @@ -152,7 +216,7 @@ clear_single_step(struct task_struct *task) struct pt_regs *regs = task->thread.regs; if (regs != NULL) { -#ifdef CONFIG_4xx +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) task->thread.dbcr0 = 0; #else regs->msr &= ~MSR_SE; @@ -360,6 +424,23 @@ int sys_ptrace(long request, long pid, long addr, long data) ret = set_vrregs(child, (unsigned long *)data); break; #endif +#ifdef CONFIG_SPE + case PTRACE_GETEVRREGS: + /* Get the child spe register state. */ + if (child->thread.regs->msr & MSR_SPE) + giveup_spe(child); + ret = get_evrregs((unsigned long *)data, child); + break; + + case PTRACE_SETEVRREGS: + /* Set the child spe register state. */ + /* this is to clear the MSR_SPE bit to force a reload + * of register state from memory */ + if (child->thread.regs->msr & MSR_SPE) + giveup_spe(child); + ret = set_evrregs(child, (unsigned long *)data); + break; +#endif default: ret = ptrace_request(child, request, addr, data); diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c index e4f23902c..82f6cf8e1 100644 --- a/arch/ppc/kernel/signal.c +++ b/arch/ppc/kernel/signal.c @@ -183,8 +183,8 @@ struct rt_sigframe /* * Save the current user registers on the user stack. - * We only save the altivec registers if the process has used - * altivec instructions at some point. + * We only save the altivec/spe registers if the process has used + * altivec/spe instructions at some point. */ static int save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret) @@ -197,6 +197,10 @@ save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret) #ifdef CONFIG_ALTIVEC if (current->thread.used_vr && (regs->msr & MSR_VEC)) giveup_altivec(current); +#endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + if (current->thread.used_spe && (regs->msr & MSR_SPE)) + giveup_spe(current); #endif /* CONFIG_ALTIVEC */ preempt_enable(); @@ -229,6 +233,24 @@ save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret) return 1; #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + /* save spe registers */ + if (current->thread.used_spe) { + if (__copy_to_user(&frame->mc_vregs, current->thread.evr, + ELF_NEVRREG * sizeof(u32))) + return 1; + /* set MSR_SPE in the saved MSR value to indicate that + frame->mc_vregs contains valid data */ + if (__put_user(regs->msr | MSR_SPE, &frame->mc_gregs[PT_MSR])) + return 1; + } + /* else assert((regs->msr & MSR_SPE) == 0) */ + + /* We always copy to/from spefscr */ + if (__put_user(current->thread.spefscr, (u32 *)&frame->mc_vregs + ELF_NEVRREG)) + return 1; +#endif /* CONFIG_SPE */ + if (sigret) { /* Set up the sigreturn trampoline: li r0,sigret; sc */ if (__put_user(0x38000000UL + sigret, &frame->tramp[0]) @@ -249,7 +271,7 @@ static int restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig) { unsigned long save_r2; -#ifdef CONFIG_ALTIVEC +#if defined(CONFIG_ALTIVEC) || defined(CONFIG_SPE) unsigned long msr; #endif @@ -290,6 +312,23 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig) return 1; #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_SPE + /* force the process to reload the spe registers from + current->thread when it next does spe instructions */ + regs->msr &= ~MSR_SPE; + if (!__get_user(msr, &sr->mc_gregs[PT_MSR]) && (msr & MSR_SPE) != 0) { + /* restore spe registers from the stack */ + if (__copy_from_user(current->thread.evr, &sr->mc_vregs, + sizeof(sr->mc_vregs))) + return 1; + } else if (current->thread.used_spe) + memset(¤t->thread.evr, 0, ELF_NEVRREG * sizeof(u32)); + + /* Always get SPEFSCR back */ + if (__get_user(current->thread.spefscr, (u32 *)&sr->mc_vregs + ELF_NEVRREG)) + return 1; +#endif /* CONFIG_SPE */ + return 0; } diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c index cc500228e..ebe93fe94 100644 --- a/arch/ppc/kernel/traps.c +++ b/arch/ppc/kernel/traps.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -171,6 +172,11 @@ static inline int check_io_access(struct pt_regs *regs) /* On 4xx, the reason for the machine check or program exception is in the ESR. */ #define get_reason(regs) ((regs)->dsisr) +#ifndef CONFIG_E500 +#define get_mc_reason(regs) ((regs)->dsisr) +#else +#define get_mc_reason(regs) (mfspr(SPRN_MCSR)) +#endif #define REASON_FP 0 #define REASON_ILLEGAL ESR_PIL #define REASON_PRIVILEGED ESR_PPR @@ -184,6 +190,7 @@ static inline int check_io_access(struct pt_regs *regs) /* On non-4xx, the reason for the machine check or program exception is in the MSR. */ #define get_reason(regs) ((regs)->msr) +#define get_mc_reason(regs) ((regs)->msr) #define REASON_FP 0x100000 #define REASON_ILLEGAL 0x80000 #define REASON_PRIVILEGED 0x40000 @@ -196,7 +203,7 @@ static inline int check_io_access(struct pt_regs *regs) void MachineCheckException(struct pt_regs *regs) { - unsigned long reason = get_reason(regs); + unsigned long reason = get_mc_reason(regs); if (user_mode(regs)) { regs->msr |= MSR_RI; @@ -256,7 +263,37 @@ MachineCheckException(struct pt_regs *regs) /* Clear MCSR */ mtspr(SPRN_MCSR, mcsr); } -#else /* !CONFIG_4xx */ +#elif defined (CONFIG_E500) + printk("Machine check in kernel mode.\n"); + printk("Caused by (from MCSR=%lx): ", reason); + + if (reason & MCSR_MCP) + printk("Machine Check Signal\n"); + if (reason & MCSR_ICPERR) + printk("Instruction Cache Parity Error\n"); + if (reason & MCSR_DCP_PERR) + printk("Data Cache Push Parity Error\n"); + if (reason & MCSR_DCPERR) + printk("Data Cache Parity Error\n"); + if (reason & MCSR_GL_CI) + printk("Guarded Load or Cache-Inhibited stwcx.\n"); + if (reason & MCSR_BUS_IAERR) + printk("Bus - Instruction Address Error\n"); + if (reason & MCSR_BUS_RAERR) + printk("Bus - Read Address Error\n"); + if (reason & MCSR_BUS_WAERR) + printk("Bus - Write Address Error\n"); + if (reason & MCSR_BUS_IBERR) + printk("Bus - Instruction Data Error\n"); + if (reason & MCSR_BUS_RBERR) + printk("Bus - Read Data Bus Error\n"); + if (reason & MCSR_BUS_WBERR) + printk("Bus - Read Data Bus Error\n"); + if (reason & MCSR_BUS_IPERR) + printk("Bus - Instruction Parity Error\n"); + if (reason & MCSR_BUS_RPERR) + printk("Bus - Read Parity Error\n"); +#else /* !CONFIG_4xx && !CONFIG_E500 */ printk("Machine check in kernel mode.\n"); printk("Caused by (from SRR1=%lx): ", reason); switch (reason & 0x601F0000) { @@ -682,6 +719,56 @@ AltivecAssistException(struct pt_regs *regs) } #endif /* CONFIG_ALTIVEC */ +#ifdef CONFIG_FSL_BOOKE +void CacheLockingException(struct pt_regs *regs, unsigned long address, + unsigned long error_code) +{ + /* We treat cache locking instructions from the user + * as priv ops, in the future we could try to do + * something smarter + */ + if (error_code & (ESR_DLK|ESR_ILK)) + _exception(SIGILL, regs, ILL_PRVOPC, regs->nip); + return; +} +#endif /* CONFIG_FSL_BOOKE */ + +#ifdef CONFIG_SPE +void +SPEFloatingPointException(struct pt_regs *regs) +{ + unsigned long spefscr; + int fpexc_mode; + int code = 0; + + spefscr = current->thread.spefscr; + fpexc_mode = current->thread.fpexc_mode; + + /* Hardware does not neccessarily set sticky + * underflow/overflow/invalid flags */ + if ((spefscr & SPEFSCR_FOVF) && (fpexc_mode & PR_FP_EXC_OVF)) { + code = FPE_FLTOVF; + spefscr |= SPEFSCR_FOVFS; + } + else if ((spefscr & SPEFSCR_FUNF) && (fpexc_mode & PR_FP_EXC_UND)) { + code = FPE_FLTUND; + spefscr |= SPEFSCR_FUNFS; + } + else if ((spefscr & SPEFSCR_FDBZ) && (fpexc_mode & PR_FP_EXC_DIV)) + code = FPE_FLTDIV; + else if ((spefscr & SPEFSCR_FINV) && (fpexc_mode & PR_FP_EXC_INV)) { + code = FPE_FLTINV; + spefscr |= SPEFSCR_FINVS; + } + else if ((spefscr & (SPEFSCR_FG | SPEFSCR_FX)) && (fpexc_mode & PR_FP_EXC_RES)) + code = FPE_FLTRES; + + current->thread.spefscr = spefscr; + + _exception(SIGFPE, regs, code, regs->nip); + return; +} +#endif void __init trap_init(void) { diff --git a/arch/ppc/lib/locks.c b/arch/ppc/lib/locks.c index 1f85f3ef2..0eaffa9b5 100644 --- a/arch/ppc/lib/locks.c +++ b/arch/ppc/lib/locks.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,7 @@ * since they may inhibit forward progress by other CPUs in getting * a lock. */ -unsigned long __spin_trylock(volatile unsigned long *lock) +static inline unsigned long __spin_trylock(volatile unsigned long *lock) { unsigned long ret; @@ -62,6 +63,7 @@ void _raw_spin_lock(spinlock_t *lock) lock->owner_pc = (unsigned long)__builtin_return_address(0); lock->owner_cpu = cpu; } +EXPORT_SYMBOL(_raw_spin_lock); int _raw_spin_trylock(spinlock_t *lock) { @@ -71,6 +73,7 @@ int _raw_spin_trylock(spinlock_t *lock) lock->owner_pc = (unsigned long)__builtin_return_address(0); return 1; } +EXPORT_SYMBOL(_raw_spin_trylock); void _raw_spin_unlock(spinlock_t *lp) { @@ -86,6 +89,7 @@ void _raw_spin_unlock(spinlock_t *lp) wmb(); lp->lock = 0; } +EXPORT_SYMBOL(_raw_spin_unlock); /* @@ -119,6 +123,7 @@ again: } wmb(); } +EXPORT_SYMBOL(_raw_read_lock); void _raw_read_unlock(rwlock_t *rw) { @@ -129,6 +134,7 @@ void _raw_read_unlock(rwlock_t *rw) wmb(); atomic_dec((atomic_t *) &(rw)->lock); } +EXPORT_SYMBOL(_raw_read_unlock); void _raw_write_lock(rwlock_t *rw) { @@ -169,6 +175,22 @@ again: } wmb(); } +EXPORT_SYMBOL(_raw_write_lock); + +int _raw_write_trylock(rwlock_t *rw) +{ + if (test_and_set_bit(31, &(rw)->lock)) /* someone has a write lock */ + return 0; + + if ((rw)->lock & ~(1<<31)) { /* someone has a read lock */ + /* clear our write lock and wait for reads to go away */ + clear_bit(31,&(rw)->lock); + return 0; + } + wmb(); + return 1; +} +EXPORT_SYMBOL(_raw_write_trylock); void _raw_write_unlock(rwlock_t *rw) { @@ -179,5 +201,6 @@ void _raw_write_unlock(rwlock_t *rw) wmb(); clear_bit(31,&(rw)->lock); } +EXPORT_SYMBOL(_raw_write_unlock); #endif diff --git a/arch/ppc/mm/Makefile b/arch/ppc/mm/Makefile index 038260878..458e67106 100644 --- a/arch/ppc/mm/Makefile +++ b/arch/ppc/mm/Makefile @@ -12,3 +12,4 @@ obj-y := fault.o init.o mem_pieces.o \ obj-$(CONFIG_PPC_STD_MMU) += hashtable.o ppc_mmu.o tlb.o obj-$(CONFIG_40x) += 4xx_mmu.o obj-$(CONFIG_44x) += 44x_mmu.o +obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c index 7a280f9da..2a4029cbc 100644 --- a/arch/ppc/mm/fault.c +++ b/arch/ppc/mm/fault.c @@ -99,7 +99,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, struct mm_struct *mm = current->mm; siginfo_t info; int code = SEGV_MAPERR; -#if defined(CONFIG_4xx) +#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE) int is_write = error_code & ESR_DST; #else int is_write = 0; @@ -114,20 +114,20 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, error_code &= 0x48200000; else is_write = error_code & 0x02000000; -#endif /* CONFIG_4xx */ +#endif /* CONFIG_4xx || CONFIG_BOOKE */ #if defined(CONFIG_XMON) || defined(CONFIG_KGDB) if (debugger_fault_handler && TRAP(regs) == 0x300) { debugger_fault_handler(regs); return 0; } -#if !defined(CONFIG_4xx) +#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) if (error_code & 0x00400000) { /* DABR match */ if (debugger_dabr_match(regs)) return 0; } -#endif /* !CONFIG_4xx */ +#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/ #endif /* CONFIG_XMON || CONFIG_KGDB */ if (in_atomic() || mm == NULL) @@ -200,8 +200,8 @@ good_area: if (is_write) { if (!(vma->vm_flags & VM_WRITE)) goto bad_area; -#if defined(CONFIG_4xx) - /* an exec - 4xx allows for per-page execute permission */ +#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) + /* an exec - 4xx/Book-E allows for per-page execute permission */ } else if (TRAP(regs) == 0x400) { pte_t *ptep; @@ -214,7 +214,7 @@ good_area: goto bad_area; #endif - /* Since 4xx supports per-page execute permission, + /* Since 4xx/Book-E supports per-page execute permission, * we lazily flush dcache to icache. */ ptep = NULL; if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) { diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index 5584e1dde..bf4bd63fd 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c @@ -253,6 +253,12 @@ void __init MMU_init(void) if (__max_memory && total_memory > __max_memory) total_memory = __max_memory; total_lowmem = total_memory; +#ifdef CONFIG_FSL_BOOKE + /* Freescale Book-E parts expect lowmem to be mapped by fixed TLB + * entries, so we need to adjust lowmem to match the amount we can map + * in the fixed entries */ + adjust_total_lowmem(); +#endif /* CONFIG_FSL_BOOKE */ if (total_lowmem > __max_low_memory) { total_lowmem = __max_low_memory; #ifndef CONFIG_HIGHMEM diff --git a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h index 5f8b04538..4699d6f64 100644 --- a/arch/ppc/mm/mmu_decl.h +++ b/arch/ppc/mm/mmu_decl.h @@ -27,6 +27,9 @@ extern int map_page(unsigned long va, phys_addr_t pa, int flags); extern void setbat(int index, unsigned long virt, unsigned long phys, unsigned int size, int flags); extern void reserve_phys_mem(unsigned long start, unsigned long size); +extern void settlbcam(int index, unsigned long virt, phys_addr_t phys, + unsigned int size, int flags, unsigned int pid); +extern void invalidate_tlbcam_entry(int index); extern int __map_without_bats; extern unsigned long ioremap_base; @@ -53,6 +56,12 @@ extern unsigned long Hash_size, Hash_mask; extern void MMU_init_hw(void); extern unsigned long mmu_mapin_ram(void); +#elif defined(CONFIG_FSL_BOOKE) +#define flush_HPTE(X, va, pg) _tlbie(va) +extern void MMU_init_hw(void); +extern unsigned long mmu_mapin_ram(void); +extern void adjust_total_lowmem(void); + #else /* anything except 4xx or 8xx */ extern void MMU_init_hw(void); diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c index 04c148127..c16d4cce4 100644 --- a/arch/ppc/mm/pgtable.c +++ b/arch/ppc/mm/pgtable.c @@ -42,6 +42,10 @@ int io_bat_index; #define HAVE_BATS 1 #endif +#if defined(CONFIG_FSL_BOOKE) +#define HAVE_TLBCAM 1 +#endif + extern char etext[], _stext[]; #ifdef CONFIG_SMP @@ -59,6 +63,16 @@ void setbat(int index, unsigned long virt, unsigned long phys, #define p_mapped_by_bats(x) (0UL) #endif /* HAVE_BATS */ +#ifdef HAVE_TLBCAM +extern unsigned int tlbcam_index; +extern unsigned int num_tlbcam_entries; +extern unsigned long v_mapped_by_tlbcam(unsigned long va); +extern unsigned long p_mapped_by_tlbcam(unsigned long pa); +#else /* !HAVE_TLBCAM */ +#define v_mapped_by_tlbcam(x) (0UL) +#define p_mapped_by_tlbcam(x) (0UL) +#endif /* HAVE_TLBCAM */ + #ifdef CONFIG_44x /* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */ #define PGDIR_ORDER 1 @@ -210,6 +224,9 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags) if ((v = p_mapped_by_bats(p)) /*&& p_mapped_by_bats(p+size-1)*/ ) goto out; + if ((v = p_mapped_by_tlbcam(p))) + goto out; + if (mem_init_done) { struct vm_struct *area; area = get_vm_area(size, VM_IOREMAP); @@ -300,6 +317,9 @@ void __init mapin_ram(void) /* is x a power of 2? */ #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) +/* is x a power of 4? */ +#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1)) + /* * Set up a mapping for a block of I/O. * virt, phys, size must all be page-aligned. @@ -325,6 +345,18 @@ void __init io_block_mapping(unsigned long virt, phys_addr_t phys, } #endif /* HAVE_BATS */ +#ifdef HAVE_TLBCAM + /* + * Use a CAM for this if possible... + */ + if (tlbcam_index < num_tlbcam_entries && is_power_of_4(size) + && (virt & (size - 1)) == 0 && (phys & (size - 1)) == 0) { + settlbcam(tlbcam_index, virt, phys, size, flags, 0); + ++tlbcam_index; + return; + } +#endif /* HAVE_TLBCAM */ + /* No BATs available, put it in the page tables. */ for (i = 0; i < size; i += PAGE_SIZE) map_page(virt + i, phys + i, flags); diff --git a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c index 3bf70f65f..34605ba4a 100644 --- a/arch/ppc/mm/tlb.c +++ b/arch/ppc/mm/tlb.c @@ -66,6 +66,17 @@ void flush_hash_one_pte(pte_t *ptep) flush_hash_pages(mm->context, addr, ptephys, 1); } +/* + * Called by ptep_set_access_flags, must flush on CPUs for which the + * DSI handler can't just "fixup" the TLB on a write fault + */ +void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr) +{ + if (Hash != 0) + return; + _tlbie(addr); +} + /* * Called at the end of a mmu_gather operation to make sure the * TLB flush is completely done. diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile index 31f2d3067..6f0c42645 100644 --- a/arch/ppc/platforms/Makefile +++ b/arch/ppc/platforms/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_PPLUS) += pplus.o obj-$(CONFIG_PRPMC750) += prpmc750.o obj-$(CONFIG_PRPMC800) += prpmc800.o obj-$(CONFIG_SANDPOINT) += sandpoint.o +obj-$(CONFIG_SBC82xx) += sbc82xx.o obj-$(CONFIG_SPRUCE) += spruce.o ifeq ($(CONFIG_SMP),y) diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 626b77acd..75c8e3dfc 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -8,9 +8,12 @@ endif ifdef CONFIG_4xx EXTRA_AFLAGS := -Wa,-m405 endif +ifdef CONFIG_E500 +EXTRA_AFLAGS := -Wa,-me500 +endif -CFLAGS_prom_init.o += -mrelocatable-lib -CFLAGS_btext.o += -mrelocatable-lib +CFLAGS_prom_init.o += -fPIC +CFLAGS_btext.o += -fPIC obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o obj-$(CONFIG_PPC_OCP) += ocp.o @@ -63,6 +66,7 @@ obj-$(CONFIG_PRPMC750) += open_pic.o indirect_pci.o pci_auto.o \ obj-$(CONFIG_HARRIER) += harrier.o obj-$(CONFIG_PRPMC800) += open_pic.o indirect_pci.o pci_auto.o obj-$(CONFIG_SANDPOINT) += i8259.o open_pic.o pci_auto.o todc_time.o +obj-$(CONFIG_SBC82xx) += todc_time.o obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \ todc_time.o obj-$(CONFIG_8260) += m8260_setup.o ppc8260_pic.o @@ -72,3 +76,9 @@ obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o endif obj-$(CONFIG_BOOTX_TEXT) += btext.o obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o +obj-$(CONFIG_40x) += dcr.o +obj-$(CONFIG_BOOKE) += dcr.o +obj-$(CONFIG_85xx) += open_pic.o ppc85xx_common.o ppc85xx_setup.o +ifeq ($(CONFIG_85xx),y) +obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o +endif diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c index 42e71af3e..e39c88fd1 100644 --- a/arch/ppc/syslib/open_pic.c +++ b/arch/ppc/syslib/open_pic.c @@ -28,7 +28,7 @@ #include "open_pic_defs.h" -#ifdef CONFIG_PRPMC800 +#if defined(CONFIG_PRPMC800) || defined(CONFIG_85xx) #define OPENPIC_BIG_ENDIAN #endif diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig index f0a6ef197..9acd44330 100644 --- a/arch/ppc64/Kconfig +++ b/arch/ppc64/Kconfig @@ -198,7 +198,6 @@ config SCHED_SMT config PREEMPT bool "Preemptible Kernel" - depends on BROKEN help This option reduces the latency of the kernel when reacting to real-time or interactive events by allowing a low priority process to diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile index 00ffc9ffe..5381ba1c2 100644 --- a/arch/ppc64/Makefile +++ b/arch/ppc64/Makefile @@ -17,7 +17,7 @@ KERNELLOAD := 0xc000000000000000 HAS_BIARCH := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;) ifeq ($(HAS_BIARCH),y) -AS := $(AS) -64 +AS := $(AS) -a64 LD := $(LD) -m elf64ppc CC := $(CC) -m64 endif diff --git a/arch/ppc64/kernel/align.c b/arch/ppc64/kernel/align.c index 58a5eb9e3..853b3ae74 100644 --- a/arch/ppc64/kernel/align.c +++ b/arch/ppc64/kernel/align.c @@ -22,8 +22,6 @@ #include #include -void disable_kernel_fp(void); /* asm function from head.S */ - struct aligninfo { unsigned char len; unsigned char flags; @@ -280,8 +278,11 @@ fix_alignment(struct pt_regs *regs) } /* Force the fprs into the save area so we can reference them */ - if ((flags & F) && (regs->msr & MSR_FP)) - giveup_fpu(current); + if (flags & F) { + if (!user_mode(regs)) + return 0; + flush_fp_to_thread(current); + } /* If we are loading, get the data from user space */ if (flags & LD) { @@ -310,9 +311,11 @@ fix_alignment(struct pt_regs *regs) if (flags & F) { if (nb == 4) { /* Doing stfs, have to convert to single */ + preempt_disable(); enable_kernel_fp(); cvt_df(¤t->thread.fpr[reg], (float *)&data.v[4], ¤t->thread.fpscr); disable_kernel_fp(); + preempt_enable(); } else data.dd = current->thread.fpr[reg]; @@ -344,9 +347,11 @@ fix_alignment(struct pt_regs *regs) if (flags & F) { if (nb == 4) { /* Doing lfs, have to convert to double */ + preempt_disable(); enable_kernel_fp(); cvt_fd((float *)&data.v[4], ¤t->thread.fpr[reg], ¤t->thread.fpscr); disable_kernel_fp(); + preempt_enable(); } else current->thread.fpr[reg] = data.dd; diff --git a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c index 9368fb0ff..27d694d6e 100644 --- a/arch/ppc64/kernel/asm-offsets.c +++ b/arch/ppc64/kernel/asm-offsets.c @@ -48,6 +48,8 @@ int main(void) DEFINE(THREAD_SHIFT, THREAD_SHIFT); DEFINE(THREAD_SIZE, THREAD_SIZE); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); + DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); + DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror)); /* task_struct->thread */ DEFINE(THREAD, offsetof(struct task_struct, thread)); @@ -99,7 +101,10 @@ int main(void) DEFINE(PACALPPACA, offsetof(struct paca_struct, xLpPaca)); DEFINE(LPPACA, offsetof(struct paca_struct, xLpPaca)); DEFINE(PACAREGSAV, offsetof(struct paca_struct, xRegSav)); - DEFINE(PACAEXC, offsetof(struct paca_struct, exception_stack)); + DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen)); + DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); + DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); + DEFINE(PACA_EXDSI, offsetof(struct paca_struct, exdsi)); DEFINE(PACAGUARD, offsetof(struct paca_struct, guard)); DEFINE(LPPACASRR0, offsetof(struct ItLpPaca, xSavedSrr0)); DEFINE(LPPACASRR1, offsetof(struct ItLpPaca, xSavedSrr1)); @@ -136,6 +141,10 @@ int main(void) DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7])); DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8])); DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9])); + DEFINE(GPR10, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[10])); + DEFINE(GPR11, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[11])); + DEFINE(GPR12, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[12])); + DEFINE(GPR13, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[13])); DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20])); DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21])); DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22])); @@ -154,7 +163,7 @@ int main(void) DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr)); DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3)); DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result)); - DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap)); + DEFINE(_TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap)); DEFINE(SOFTE, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, softe)); /* These _only_ to be used with {PROM,RTAS}_FRAME_SIZE!!! */ diff --git a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S index 9f08385a8..e7d88ca76 100644 --- a/arch/ppc64/kernel/entry.S +++ b/arch/ppc64/kernel/entry.S @@ -35,15 +35,9 @@ #define DO_SOFT_DISABLE #endif -#undef SHOW_SYSCALLS -#undef SHOW_SYSCALLS_TASK - -#ifdef SHOW_SYSCALLS_TASK - .data -show_syscalls_task: - .long -1 -#endif - +/* + * System calls. + */ .section ".toc","aw" .SYS_CALL_TABLE: .tc .sys_call_table[TC],.sys_call_table @@ -51,107 +45,175 @@ show_syscalls_task: .SYS_CALL_TABLE32: .tc .sys_call_table32[TC],.sys_call_table32 +/* This value is used to mark exception frames on the stack. */ +exception_marker: + .tc ID_72656773_68657265[TC],0x7265677368657265 + .section ".text" - .align 3 + .align 7 -/* - * Handle a system call. - */ -_GLOBAL(DoSyscall) +#undef SHOW_SYSCALLS + + .globl SystemCall_common +SystemCall_common: + andi. r10,r12,MSR_PR + mr r10,r1 + addi r1,r1,-INT_FRAME_SIZE + beq- 1f + ld r1,PACAKSAVE(r13) +1: std r10,0(r1) + std r11,_NIP(r1) + std r12,_MSR(r1) + std r0,GPR0(r1) + std r10,GPR1(r1) + std r2,GPR2(r1) + std r3,GPR3(r1) + std r4,GPR4(r1) + std r5,GPR5(r1) + std r6,GPR6(r1) + std r7,GPR7(r1) + std r8,GPR8(r1) + li r11,0 + std r11,GPR9(r1) + std r11,GPR10(r1) + std r11,GPR11(r1) + std r11,GPR12(r1) + std r9,GPR13(r1) + crclr so + mfcr r9 + mflr r10 + li r11,0xc01 + std r9,_CCR(r1) + std r10,_LINK(r1) + std r11,_TRAP(r1) + mfxer r9 + mfctr r10 + std r9,_XER(r1) + std r10,_CTR(r1) std r3,ORIG_GPR3(r1) - ld r11,_CCR(r1) /* Clear SO bit in CR */ - lis r10,0x1000 - andc r11,r11,r10 - std r11,_CCR(r1) + ld r2,PACATOC(r13) + addi r9,r1,STACK_FRAME_OVERHEAD + ld r11,exception_marker@toc(r2) + std r11,-16(r9) /* "regshere" marker */ +#ifdef CONFIG_PPC_ISERIES + /* Hack for handling interrupts when soft-enabling on iSeries */ + cmpdi cr1,r0,0x5555 /* syscall 0x5555 */ + andi. r10,r12,MSR_PR /* from kernel */ + crand 4*cr0+eq,4*cr1+eq,4*cr0+eq + beq HardwareInterrupt_entry + lbz r10,PACAPROCENABLED(r13) + std r10,SOFTE(r1) +#endif + mfmsr r11 + ori r11,r11,MSR_EE + mtmsrd r11,1 + #ifdef SHOW_SYSCALLS -#ifdef SHOW_SYSCALLS_TASK - LOADBASE(r31,show_syscalls_task) - ld r31,show_syscalls_task@l(r31) - ld r10,PACACURRENT(r13) - cmp 0,r10,r31 - bne 1f + bl .do_show_syscall + REST_GPR(0,r1) + REST_4GPRS(3,r1) + REST_2GPRS(7,r1) + addi r9,r1,STACK_FRAME_OVERHEAD #endif - LOADADDR(r3,7f) - ld r4,GPR0(r1) - ld r5,GPR3(r1) - ld r6,GPR4(r1) - ld r7,GPR5(r1) - ld r8,GPR6(r1) - ld r9,GPR7(r1) - bl .printk - LOADADDR(r3,77f) - ld r4,GPR8(r1) - ld r5,GPR9(r1) - ld r6, PACACURRENT(r13) - bl .printk - ld r0,GPR0(r1) - ld r3,GPR3(r1) - ld r4,GPR4(r1) - ld r5,GPR5(r1) - ld r6,GPR6(r1) - ld r7,GPR7(r1) - ld r8,GPR8(r1) -1: -#endif /* SHOW_SYSCALLS */ - clrrdi r10,r1,THREAD_SHIFT - ld r10,TI_FLAGS(r10) + clrrdi r11,r1,THREAD_SHIFT + li r12,0 + ld r10,TI_FLAGS(r11) + stb r12,TI_SC_NOERR(r11) andi. r11,r10,_TIF_SYSCALL_T_OR_A - bne- 50f + bne- syscall_dotrace +syscall_dotrace_cont: cmpli 0,r0,NR_syscalls - bge- 66f + bge- syscall_enosys + +system_call: /* label this so stack traces look sane */ /* * Need to vector to 32 Bit or default sys_call_table here, * based on caller's run-mode / personality. */ - andi. r11,r10,_TIF_32BIT + ld r11,.SYS_CALL_TABLE@toc(2) + andi. r10,r10,_TIF_32BIT beq- 15f - ld r10,.SYS_CALL_TABLE32@toc(2) -/* - * We now zero extend all six arguments (r3 - r8), the compatibility - * layer assumes this. - */ + ld r11,.SYS_CALL_TABLE32@toc(2) clrldi r3,r3,32 clrldi r4,r4,32 clrldi r5,r5,32 clrldi r6,r6,32 clrldi r7,r7,32 clrldi r8,r8,32 - b 17f 15: - ld r10,.SYS_CALL_TABLE@toc(2) -17: slwi r0,r0,3 - ldx r10,r10,r0 /* Fetch system call handler [ptr] */ + slwi r0,r0,3 + ldx r10,r11,r0 /* Fetch system call handler [ptr] */ mtlr r10 - addi r9,r1,STACK_FRAME_OVERHEAD blrl /* Call handler */ -_GLOBAL(ret_from_syscall_1) - std r3,RESULT(r1) /* Save result */ + +syscall_exit: #ifdef SHOW_SYSCALLS -#ifdef SHOW_SYSCALLS_TASK - ld r10, PACACURRENT(13) - cmp 0,r10,r31 - bne 91f -#endif - mr r4,r3 - LOADADDR(r3,79f) - bl .printk - ld r3,RESULT(r1) -91: + std r3,GPR3(r1) + bl .do_show_syscall_exit + ld r3,GPR3(r1) #endif + std r3,RESULT(r1) + ld r5,_CCR(r1) li r10,-_LAST_ERRNO - cmpld 0,r3,r10 - blt 30f + cmpld r3,r10 + clrrdi r12,r1,THREAD_SHIFT + bge- syscall_error +syscall_error_cont: + + /* check for syscall tracing or audit */ + ld r9,TI_FLAGS(r12) + andi. r0,r9,_TIF_SYSCALL_T_OR_A + bne- syscall_exit_trace +syscall_exit_trace_cont: + + /* disable interrupts so current_thread_info()->flags can't change, + and so that we don't get interrupted after loading SRR0/1. */ + ld r8,_MSR(r1) + andi. r10,r8,MSR_RI + beq- unrecov_restore + mfmsr r10 + rldicl r10,r10,48,1 + rotldi r10,r10,16 + mtmsrd r10,1 + ld r9,TI_FLAGS(r12) + andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED) + bne- syscall_exit_work + ld r7,_NIP(r1) + stdcx. r0,0,r1 /* to clear the reservation */ + andi. r6,r8,MSR_PR + ld r4,_LINK(r1) + beq 1f /* only restore r13 if */ + ld r13,GPR13(r1) /* returning to usermode */ +1: ld r2,GPR2(r1) + ld r1,GPR1(r1) + li r12,MSR_RI + andc r10,r10,r12 + mtmsrd r10,1 /* clear MSR.RI */ + mtlr r4 + mtcr r5 + mtspr SRR0,r7 + mtspr SRR1,r8 + rfid + +syscall_enosys: + li r3,-ENOSYS + std r3,RESULT(r1) + clrrdi r12,r1,THREAD_SHIFT + ld r5,_CCR(r1) + +syscall_error: + lbz r11,TI_SC_NOERR(r12) + cmpi 0,r11,0 + bne- syscall_error_cont neg r3,r3 -22: ld r10,_CCR(r1) /* Set SO bit in CR */ - oris r10,r10,0x1000 - std r10,_CCR(r1) -30: std r3,GPR3(r1) /* Update return value */ - b .ret_from_except -66: li r3,ENOSYS - b 22b + oris r5,r5,0x1000 /* Set SO bit in CR */ + std r5,_CCR(r1) + b syscall_error_cont /* Traced system call support */ -50: addi r3,r1,STACK_FRAME_OVERHEAD +syscall_dotrace: + bl .save_nvgprs + addi r3,r1,STACK_FRAME_OVERHEAD bl .do_syscall_trace_enter ld r0,GPR0(r1) /* Restore original registers */ ld r3,GPR3(r1) @@ -160,65 +222,82 @@ _GLOBAL(ret_from_syscall_1) ld r6,GPR6(r1) ld r7,GPR7(r1) ld r8,GPR8(r1) - /* XXX check this - Anton */ - ld r9,GPR9(r1) - cmpli 0,r0,NR_syscalls - bge- 66f -/* - * Need to vector to 32 Bit or default sys_call_table here, - * based on caller's run-mode / personality. - */ + addi r9,r1,STACK_FRAME_OVERHEAD clrrdi r10,r1,THREAD_SHIFT ld r10,TI_FLAGS(r10) - andi. r11,r10,_TIF_32BIT - beq- 55f - ld r10,.SYS_CALL_TABLE32@toc(2) + b syscall_dotrace_cont + +syscall_exit_trace: + std r3,GPR3(r1) + bl .save_nvgprs + bl .do_syscall_trace_leave + REST_NVGPRS(r1) + ld r3,GPR3(r1) + ld r5,_CCR(r1) + clrrdi r12,r1,THREAD_SHIFT + b syscall_exit_trace_cont + +/* Stuff to do on exit from a system call. */ +syscall_exit_work: + std r3,GPR3(r1) + std r5,_CCR(r1) + b .ret_from_except_lite + +/* Save non-volatile GPRs, if not already saved. */ +_GLOBAL(save_nvgprs) + ld r11,_TRAP(r1) + andi. r0,r11,1 + beqlr- + SAVE_NVGPRS(r1) + clrrdi r0,r11,1 + std r0,_TRAP(r1) + blr + /* - * We now zero extend all six arguments (r3 - r8), the compatibility - * layer assumes this. + * The sigsuspend and rt_sigsuspend system calls can call do_signal + * and thus put the process into the stopped state where we might + * want to examine its user state with ptrace. Therefore we need + * to save all the nonvolatile registers (r14 - r31) before calling + * the C code. Similarly, fork, vfork and clone need the full + * register state on the stack so that it can be copied to the child. */ - clrldi r3,r3,32 - clrldi r4,r4,32 - clrldi r5,r5,32 - clrldi r6,r6,32 - clrldi r7,r7,32 - clrldi r8,r8,32 - b 57f -55: - ld r10,.SYS_CALL_TABLE@toc(2) -57: - slwi r0,r0,3 - ldx r10,r10,r0 /* Fetch system call handler [ptr] */ - mtlr r10 - addi r9,r1,STACK_FRAME_OVERHEAD - blrl /* Call handler */ -_GLOBAL(ret_from_syscall_2) - std r3,RESULT(r1) /* Save result */ - li r10,-_LAST_ERRNO - cmpld 0,r3,r10 - blt 60f - neg r3,r3 -57: ld r10,_CCR(r1) /* Set SO bit in CR */ - oris r10,r10,0x1000 - std r10,_CCR(r1) -60: std r3,GPR3(r1) /* Update return value */ - bl .do_syscall_trace_leave - b .ret_from_except -66: li r3,ENOSYS - b 57b -#ifdef SHOW_SYSCALLS -7: .string "syscall %d(%x, %x, %x, %x, %x, " -77: .string "%x, %x), current=%p\n" -79: .string " -> %x\n" - .align 2,0 -#endif +_GLOBAL(ppc32_sigsuspend) + bl .save_nvgprs + bl .sys32_sigsuspend + b syscall_exit + +_GLOBAL(ppc64_rt_sigsuspend) + bl .save_nvgprs + bl .sys_rt_sigsuspend + b syscall_exit + +_GLOBAL(ppc32_rt_sigsuspend) + bl .save_nvgprs + bl .sys32_rt_sigsuspend + b syscall_exit + +_GLOBAL(ppc_fork) + bl .save_nvgprs + bl .sys_fork + b syscall_exit + +_GLOBAL(ppc_vfork) + bl .save_nvgprs + bl .sys_vfork + b syscall_exit + +_GLOBAL(ppc_clone) + bl .save_nvgprs + bl .sys_clone + b syscall_exit - _GLOBAL(ppc32_swapcontext) + bl .save_nvgprs bl .sys32_swapcontext b 80f _GLOBAL(ppc64_swapcontext) + bl .save_nvgprs bl .sys_swapcontext b 80f @@ -233,17 +312,20 @@ _GLOBAL(ppc32_rt_sigreturn) _GLOBAL(ppc64_rt_sigreturn) bl .sys_rt_sigreturn -80: clrrdi r4,r1,THREAD_SHIFT +80: cmpdi 0,r3,0 + blt syscall_exit + clrrdi r4,r1,THREAD_SHIFT ld r4,TI_FLAGS(r4) andi. r4,r4,_TIF_SYSCALL_T_OR_A - bne- 81f - cmpi 0,r3,0 - bge .ret_from_except - b .ret_from_syscall_1 -81: cmpi 0,r3,0 - blt .ret_from_syscall_2 + beq+ 81f bl .do_syscall_trace_leave - b .ret_from_except +81: b .ret_from_except + +_GLOBAL(ret_from_fork) + bl .schedule_tail + REST_NVGPRS(r1) + li r3,0 + b syscall_exit /* * This routine switches between two different tasks. The process @@ -263,6 +345,7 @@ _GLOBAL(ppc64_rt_sigreturn) * The code which creates the new task context is in 'copy_thread' * in arch/ppc64/kernel/process.c */ + .align 7 _GLOBAL(_switch) mflr r0 std r0,16(r1) @@ -315,7 +398,10 @@ BEGIN_FTR_SECTION 2: END_FTR_SECTION_IFSET(CPU_FTR_SLB) clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ - addi r7,r7,THREAD_SIZE-INT_FRAME_SIZE + /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE + because we don't need to leave the 288-byte ABI gap at the + top of the kernel stack. */ + addi r7,r7,THREAD_SIZE-SWITCH_FRAME_SIZE mr r1,r8 /* start using new stack pointer */ std r7,PACAKSAVE(r13) @@ -350,60 +436,56 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) addi r1,r1,SWITCH_FRAME_SIZE blr -_GLOBAL(ret_from_fork) - bl .schedule_tail - clrrdi r4,r1,THREAD_SHIFT - ld r4,TI_FLAGS(r4) - andi. r4,r4,_TIF_SYSCALL_T_OR_A - beq+ .ret_from_except - bl .do_syscall_trace_leave - b .ret_from_except - + .align 7 _GLOBAL(ret_from_except) + ld r11,_TRAP(r1) + andi. r0,r11,1 + bne .ret_from_except_lite + REST_NVGPRS(r1) + +_GLOBAL(ret_from_except_lite) /* * Disable interrupts so that current_thread_info()->flags * can't change between when we test it and when we return * from the interrupt. */ mfmsr r10 /* Get current interrupt state */ - li r4,0 - ori r4,r4,MSR_EE - andc r9,r10,r4 /* clear MSR_EE */ + rldicl r9,r10,48,1 /* clear MSR_EE */ + rotldi r9,r9,16 mtmsrd r9,1 /* Update machine state */ +#ifdef CONFIG_PREEMPT + clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ + li r0,_TIF_NEED_RESCHED /* bits to check */ + ld r3,_MSR(r1) + ld r4,TI_FLAGS(r9) + /* Move MSR_PR bit in r3 to _TIF_SIGPENDING position in r0 */ + rlwimi r0,r3,32+TIF_SIGPENDING-MSR_PR_LG,_TIF_SIGPENDING + and. r0,r4,r0 /* check NEED_RESCHED and maybe SIGPENDING */ + bne do_work + +#else /* !CONFIG_PREEMPT */ ld r3,_MSR(r1) /* Returning to user mode? */ andi. r3,r3,MSR_PR beq restore /* if not, just restore regs and return */ /* Check current_thread_info()->flags */ - clrrdi r3,r1,THREAD_SHIFT - ld r3,TI_FLAGS(r3) - andi. r0,r3,_TIF_USER_WORK_MASK + clrrdi r9,r1,THREAD_SHIFT + ld r4,TI_FLAGS(r9) + andi. r0,r4,_TIF_USER_WORK_MASK bne do_work - - addi r0,r1,INT_FRAME_SIZE /* size of frame */ - ld r4,PACACURRENT(r13) - std r0,THREAD+KSP(r4) /* save kernel stack pointer */ - - /* - * r13 is our per cpu area, only restore it if we are returning to - * userspace - */ - REST_GPR(13,r1) +#endif restore: #ifdef CONFIG_PPC_ISERIES ld r5,SOFTE(r1) - mfspr r4,SPRG3 /* get paca address */ cmpdi 0,r5,0 beq 4f /* Check for pending interrupts (iSeries) */ - /* this is CHECKANYINT except that we already have the paca address */ - ld r3,PACALPPACA+LPPACAANYINT(r4) + ld r3,PACALPPACA+LPPACAANYINT(r13) cmpdi r3,0 beq+ 4f /* skip do_IRQ if no interrupts */ - mfspr r13,SPRG3 /* get paca pointer back */ li r3,0 stb r3,PACAPROCENABLED(r13) /* ensure we are soft-disabled */ mtmsrd r10 /* hard-enable again */ @@ -411,13 +493,22 @@ restore: bl .do_IRQ b .ret_from_except /* loop back and handle more */ -4: stb r5,PACAPROCENABLED(r4) +4: stb r5,PACAPROCENABLED(r13) #endif ld r3,_MSR(r1) - andi. r3,r3,MSR_RI + andi. r0,r3,MSR_RI beq- unrecov_restore + andi. r0,r3,MSR_PR + + /* + * r13 is our per cpu area, only restore it if we are returning to + * userspace + */ + beq 1f + REST_GPR(13, r1) +1: ld r3,_CTR(r1) ld r0,_LINK(r1) mtctr r3 @@ -426,8 +517,6 @@ restore: mtspr XER,r3 REST_8GPRS(5, r1) - REST_10GPRS(14, r1) - REST_8GPRS(24, r1) stdcx. r0,0,r1 /* to clear the reservation */ @@ -451,26 +540,62 @@ restore: ld r1,GPR1(r1) rfid + b . -/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */ +/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */ do_work: +#ifdef CONFIG_PREEMPT + andi. r0,r3,MSR_PR /* Returning to user mode? */ + bne user_work + /* Check that preempt_count() == 0 and interrupts are enabled */ + lwz r8,TI_PREEMPT(r9) + cmpwi cr1,r8,0 +#ifdef CONFIG_PPC_ISERIES + ld r0,SOFTE(r1) + cmpdi r0,0 +#else + andi. r0,r3,MSR_EE +#endif + crandc eq,cr1*4+eq,eq + bne restore + /* here we are preempting the current task */ +1: lis r0,PREEMPT_ACTIVE@h + stw r0,TI_PREEMPT(r9) +#ifdef CONFIG_PPC_ISERIES + li r0,1 + stb r0,PACAPROCENABLED(r13) +#endif + mtmsrd r10,1 /* reenable interrupts */ + bl .schedule + mfmsr r10 + clrrdi r9,r1,THREAD_SHIFT + rldicl r10,r10,48,1 /* disable interrupts again */ + li r0,0 + rotldi r10,r10,16 + mtmsrd r10,1 + ld r4,TI_FLAGS(r9) + andi. r0,r4,_TIF_NEED_RESCHED + bne 1b + stw r0,TI_PREEMPT(r9) + b restore + +user_work: +#endif /* Enable interrupts */ mtmsrd r10,1 - andi. r0,r3,_TIF_NEED_RESCHED + andi. r0,r4,_TIF_NEED_RESCHED beq 1f bl .schedule - b .ret_from_except + b .ret_from_except_lite -1: andi. r0,r3,_TIF_SIGPENDING - beq .ret_from_except +1: bl .save_nvgprs li r3,0 addi r4,r1,STACK_FRAME_OVERHEAD bl .do_signal b .ret_from_except unrecov_restore: - mfspr r13,SPRG3 addi r3,r1,STACK_FRAME_OVERHEAD bl .unrecoverable_exception b unrecov_restore @@ -488,7 +613,7 @@ _GLOBAL(enter_rtas) mflr r0 std r0,16(r1) stdu r1,-RTAS_FRAME_SIZE(r1) /* Save SP and create stack space. */ - + /* Because RTAS is running in 32b mode, it clobbers the high order half * of all registers that it saves. We therefore save those registers * RTAS might touch to the stack. (r0, r3-r13 are caller saved) diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S index 6b22a87d9..83601a8b0 100644 --- a/arch/ppc64/kernel/head.S +++ b/arch/ppc64/kernel/head.S @@ -40,15 +40,6 @@ #define DO_SOFT_DISABLE #endif -/* copy saved SOFTE bit or EE bit from saved MSR depending - * if we are doing soft-disable or not - */ -#ifdef DO_SOFT_DISABLE -#define DO_COPY_EE() ld r20,SOFTE(r1) -#else -#define DO_COPY_EE() rldicl r20,r23,49,63 -#endif - /* * hcall interface to pSeries LPAR */ @@ -177,11 +168,18 @@ _GLOBAL(__secondary_hold) #endif #endif +/* This value is used to mark exception frames on the stack. */ + .section ".toc","aw" +exception_marker: + .tc ID_72656773_68657265[TC],0x7265677368657265 + .text + /* * The following macros define the code that appears as * the prologue to each of the exception handlers. They * are split into two parts to allow a single kernel binary - * to be used for pSeries, and iSeries. + * to be used for pSeries and iSeries. + * LOL. One day... - paulus */ /* @@ -194,81 +192,55 @@ _GLOBAL(__secondary_hold) * This is the start of the interrupt handlers for pSeries * This code runs with relocation off. */ -#define EX_SRR0 0 -#define EX_SRR1 8 -#define EX_R20 16 -#define EX_R21 24 -#define EX_R22 32 -#define EX_R23 40 +#define EX_R9 0 +#define EX_R10 8 +#define EX_R11 16 +#define EX_R12 24 +#define EX_R13 32 +#define EX_SRR0 40 #define EX_DAR 48 #define EX_DSISR 56 #define EX_CCR 60 -#define EX_TRAP 60 - -#define EXCEPTION_PROLOG_PSERIES(n,label) \ - mtspr SPRG2,r20; /* use SPRG2 as scratch reg */ \ - mtspr SPRG1,r21; /* save r21 */ \ - mfspr r20,SPRG3; /* get paca virt addr */ \ - ld r21,PACAEXCSP(r20); /* get exception stack ptr */ \ - addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */ \ - std r22,EX_R22(r21); /* Save r22 in exc. frame */ \ - li r22,n; /* Save the ex # in exc. frame*/ \ - stw r22,EX_TRAP(r21); /* */ \ - std r23,EX_R23(r21); /* Save r23 in exc. frame */ \ - mfspr r22,SRR0; /* EA of interrupted instr */ \ - std r22,EX_SRR0(r21); /* Save SRR0 in exc. frame */ \ - mfspr r23,SRR1; /* machine state at interrupt */ \ - std r23,EX_SRR1(r21); /* Save SRR1 in exc. frame */ \ - \ - mfspr r23,DAR; /* Save DAR in exc. frame */ \ - std r23,EX_DAR(r21); \ - mfspr r23,DSISR; /* Save DSISR in exc. frame */ \ - stw r23,EX_DSISR(r21); \ - mfspr r23,SPRG2; /* Save r20 in exc. frame */ \ - std r23,EX_R20(r21); \ - \ - clrrdi r22,r20,60; /* Get 0xc part of the vaddr */ \ - ori r22,r22,(label)@l; /* add in the vaddr offset */ \ - /* assumes *_common < 16b */ \ - mfmsr r23; \ - rotldi r23,r23,4; \ - ori r23,r23,0x32B; /* Set IR, DR, RI, SF, ISF, HV*/ \ - rotldi r23,r23,60; /* for generic handlers */ \ - mtspr SRR0,r22; \ - mtspr SRR1,r23; \ - mfcr r23; /* save CR in r23 */ \ + +#define EXCEPTION_PROLOG_PSERIES(area, label) \ + mfspr r13,SPRG3; /* get paca address into r13 */ \ + std r9,area+EX_R9(r13); /* save r9 - r12 */ \ + std r10,area+EX_R10(r13); \ + std r11,area+EX_R11(r13); \ + std r12,area+EX_R12(r13); \ + mfspr r9,SPRG1; \ + std r9,area+EX_R13(r13); \ + mfcr r9; \ + clrrdi r12,r13,32; /* get high part of &label */ \ + mfmsr r10; \ + mfspr r11,SRR0; /* save SRR0 */ \ + ori r12,r12,(label)@l; /* virt addr of handler */ \ + ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \ + mtspr SRR0,r12; \ + mfspr r12,SRR1; /* and SRR1 */ \ + mtspr SRR1,r10; \ rfid /* * This is the start of the interrupt handlers for iSeries * This code runs with relocation on. */ -#define EXCEPTION_PROLOG_ISERIES(n) \ - mtspr SPRG2,r20; /* use SPRG2 as scratch reg */ \ - mtspr SPRG1,r21; /* save r21 */ \ - mfspr r20,SPRG3; /* get paca */ \ - ld r21,PACAEXCSP(r20); /* get exception stack ptr */ \ - addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */ \ - std r22,EX_R22(r21); /* save r22 on exception frame */ \ - li r22,n; /* Save the ex # in exc. frame */ \ - stw r22,EX_TRAP(r21); /* */ \ - std r23,EX_R23(r21); /* Save r23 in exc. frame */ \ - ld r22,LPPACA+LPPACASRR0(r20); /* Get SRR0 from ItLpPaca */ \ - std r22,EX_SRR0(r21); /* save SRR0 in exc. frame */ \ - ld r23,LPPACA+LPPACASRR1(r20); /* Get SRR1 from ItLpPaca */ \ - std r23,EX_SRR1(r21); /* save SRR1 in exc. frame */ \ - \ - mfspr r23,DAR; /* Save DAR in exc. frame */ \ - std r23,EX_DAR(r21); \ - mfspr r23,DSISR; /* Save DSISR in exc. frame */ \ - stw r23,EX_DSISR(r21); \ - mfspr r23,SPRG2; /* Save r20 in exc. frame */ \ - std r23,EX_R20(r21); \ - \ - mfmsr r22; /* set MSR.RI */ \ - ori r22,r22,MSR_RI; \ - mtmsrd r22,1; \ - mfcr r23; /* save CR in r23 */ +#define EXCEPTION_PROLOG_ISERIES_1(area) \ + mfspr r13,SPRG3; /* get paca address into r13 */ \ + std r9,area+EX_R9(r13); /* save r9 - r12 */ \ + std r10,area+EX_R10(r13); \ + std r11,area+EX_R11(r13); \ + std r12,area+EX_R12(r13); \ + mfspr r9,SPRG1; \ + std r9,area+EX_R13(r13); \ + mfcr r9 + +#define EXCEPTION_PROLOG_ISERIES_2 \ + mfmsr r10; \ + ld r11,LPPACA+LPPACASRR0(r13); \ + ld r12,LPPACA+LPPACASRR1(r13); \ + ori r10,r10,MSR_RI; \ + mtmsrd r10,1 /* * The common exception prolog is used for all except a few exceptions @@ -276,107 +248,154 @@ _GLOBAL(__secondary_hold) * to take another exception from the point where we first touch the * kernel stack onwards. * - * On entry r20 points to the paca and r21 points to the exception - * frame on entry, r23 contains the saved CR, and relocation is on. - */ -#define EXCEPTION_PROLOG_COMMON \ - mfspr r22,SPRG1; /* Save r21 in exc. frame */ \ - std r22,EX_R21(r21); \ - std r21,PACAEXCSP(r20); /* update exception stack ptr */ \ - ld r22,EX_SRR1(r21); /* Get SRR1 from exc. frame */ \ - andi. r22,r22,MSR_PR; /* Set CR for later branch */ \ - mr r22,r1; /* Save r1 */ \ - subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ - beq- 1f; \ - ld r1,PACAKSAVE(r20); /* kernel stack to use */ \ -1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ - bge cr1,bad_stack; /* abort if it is */ \ - std r22,GPR1(r1); /* save r1 in stackframe */ \ - std r22,0(r1); /* make stack chain pointer */ \ - std r23,_CCR(r1); /* save CR in stackframe */ \ - ld r22,EX_R20(r21); /* move r20 to stackframe */ \ - std r22,GPR20(r1); \ - ld r23,EX_R21(r21); /* move r21 to stackframe */ \ - std r23,GPR21(r1); \ - ld r22,EX_R22(r21); /* move r22 to stackframe */ \ - std r22,GPR22(r1); \ - ld r23,EX_R23(r21); /* move r23 to stackframe */ \ - std r23,GPR23(r1); \ - mflr r22; /* save LR in stackframe */ \ - std r22,_LINK(r1); \ - mfctr r23; /* save CTR in stackframe */ \ - std r23,_CTR(r1); \ - mfspr r22,XER; /* save XER in stackframe */ \ - std r22,_XER(r1); \ - ld r23,EX_DAR(r21); /* move DAR to stackframe */ \ - std r23,_DAR(r1); \ - lwz r22,EX_DSISR(r21); /* move DSISR to stackframe */ \ - std r22,_DSISR(r1); \ - lbz r22,PACAPROCENABLED(r20); \ - std r22,SOFTE(r1); \ - ld r22,EX_SRR0(r21); /* get SRR0 from exc. frame */ \ - ld r23,EX_SRR1(r21); /* get SRR1 from exc. frame */ \ - addi r21,r21,-EXC_FRAME_SIZE;/* pop off exception frame */ \ - std r21,PACAEXCSP(r20); \ - SAVE_GPR(0, r1); /* save r0 in stackframe */ \ - SAVE_8GPRS(2, r1); /* save r2 - r13 in stackframe */ \ - SAVE_4GPRS(10, r1); \ - ld r2,PACATOC(r20); \ - mr r13,r20 - -/* - * Note: code which follows this uses cr0.eq (set if from kernel), - * r1, r22 (SRR0), and r23 (SRR1). + * On entry r13 points to the paca, r9-r13 are saved in the paca, + * r9 contains the saved CR, r11 and r12 contain the saved SRR0 and + * SRR1, and relocation is on. */ +#define EXCEPTION_PROLOG_COMMON(n, area) \ + andi. r10,r12,MSR_PR; /* See if coming from user */ \ + mr r10,r1; /* Save r1 */ \ + subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ + beq- 1f; \ + ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ +1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ + bge- cr1,bad_stack; /* abort if it is */ \ + std r9,_CCR(r1); /* save CR in stackframe */ \ + std r11,_NIP(r1); /* save SRR0 in stackframe */ \ + std r12,_MSR(r1); /* save SRR1 in stackframe */ \ + std r10,0(r1); /* make stack chain pointer */ \ + std r0,GPR0(r1); /* save r0 in stackframe */ \ + std r10,GPR1(r1); /* save r1 in stackframe */ \ + std r2,GPR2(r1); /* save r2 in stackframe */ \ + SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ + SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ + ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \ + ld r10,area+EX_R10(r13); \ + std r9,GPR9(r1); \ + std r10,GPR10(r1); \ + ld r9,area+EX_R11(r13); /* move r11 - r13 to stackframe */ \ + ld r10,area+EX_R12(r13); \ + ld r11,area+EX_R13(r13); \ + std r9,GPR11(r1); \ + std r10,GPR12(r1); \ + std r11,GPR13(r1); \ + ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \ + mflr r9; /* save LR in stackframe */ \ + std r9,_LINK(r1); \ + mfctr r10; /* save CTR in stackframe */ \ + std r10,_CTR(r1); \ + mfspr r11,XER; /* save XER in stackframe */ \ + std r11,_XER(r1); \ + li r9,(n)+1; \ + std r9,_TRAP(r1); /* set trap number */ \ + li r10,0; \ + ld r11,exception_marker@toc(r2); \ + std r10,RESULT(r1); /* clear regs->result */ \ + std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ /* * Exception vectors. */ -#define STD_EXCEPTION_PSERIES(n, label ) \ - . = n; \ - .globl label##_Pseries; \ -label##_Pseries: \ - EXCEPTION_PROLOG_PSERIES( n, label##_common ) - -#define STD_EXCEPTION_ISERIES( n, label ) \ - .globl label##_Iseries; \ -label##_Iseries: \ - EXCEPTION_PROLOG_ISERIES( n ); \ +#define STD_EXCEPTION_PSERIES(n, label ) \ + . = n; \ + .globl label##_Pseries; \ +label##_Pseries: \ + mtspr SPRG1,r13; /* save r13 */ \ + EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) + +#define STD_EXCEPTION_ISERIES(n, label, area) \ + .globl label##_Iseries; \ +label##_Iseries: \ + mtspr SPRG1,r13; /* save r13 */ \ + EXCEPTION_PROLOG_ISERIES_1(area); \ + EXCEPTION_PROLOG_ISERIES_2; \ b label##_common -#define MASKABLE_EXCEPTION_ISERIES( n, label ) \ - .globl label##_Iseries; \ -label##_Iseries: \ - EXCEPTION_PROLOG_ISERIES( n ); \ - lbz r22,PACAPROFENABLED(r20); \ - cmpi 0,r22,0; \ - bne- label##_Iseries_profile; \ -label##_Iseries_prof_ret: \ - lbz r22,PACAPROCENABLED(r20); \ - cmpi 0,r22,0; \ - beq- label##_Iseries_masked; \ - b label##_common; \ -label##_Iseries_profile: \ - std r24,48(r21); \ - std r25,56(r21); \ - mflr r24; \ - bl do_profile; \ - mtlr r24; \ - ld r24,48(r21); \ - ld r25,56(r21); \ +#define MASKABLE_EXCEPTION_ISERIES( n, label ) \ + .globl label##_Iseries; \ +label##_Iseries: \ + mtspr SPRG1,r13; /* save r13 */ \ + EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ + lbz r10,PACAPROFENABLED(r13); \ + cmpwi r10,0; \ + bne- label##_Iseries_profile; \ +label##_Iseries_prof_ret: \ + lbz r10,PACAPROCENABLED(r13); \ + cmpwi 0,r10,0; \ + beq- label##_Iseries_masked; \ + EXCEPTION_PROLOG_ISERIES_2; \ + b label##_common; \ +label##_Iseries_profile: \ + ld r12,LPPACA+LPPACASRR1(r13); \ + andi. r12,r12,MSR_PR; /* Test if in kernel */ \ + bne label##_Iseries_prof_ret; \ + ld r11,LPPACA+LPPACASRR0(r13); \ + ld r12,PACAPROFSTEXT(r13); /* _stext */ \ + subf r11,r12,r11; /* offset into kernel */ \ + lwz r12,PACAPROFSHIFT(r13); \ + srd r11,r11,r12; \ + lwz r12,PACAPROFLEN(r13); /* profile table length - 1 */ \ + cmpd r11,r12; /* off end? */ \ + ble 1f; \ + mr r11,r12; /* force into last entry */ \ +1: sldi r11,r11,2; /* convert to offset */ \ + ld r12,PACAPROFBUFFER(r13);/* profile buffer */ \ + add r12,r12,r11; \ +2: lwarx r11,0,r12; /* atomically increment */ \ + addi r11,r11,1; \ + stwcx. r11,0,r12; \ + bne- 2b; \ b label##_Iseries_prof_ret +#ifdef DO_SOFT_DISABLE +#define DISABLE_INTS \ + lbz r10,PACAPROCENABLED(r13); \ + li r11,0; \ + std r10,SOFTE(r1); \ + mfmsr r10; \ + stb r11,PACAPROCENABLED(r13); \ + ori r10,r10,MSR_EE; \ + mtmsrd r10,1 + +#define ENABLE_INTS \ + lbz r10,PACAPROCENABLED(r13); \ + mfmsr r11; \ + std r10,SOFTE(r1); \ + ori r11,r11,MSR_EE; \ + mtmsrd r11,1 + +#else /* hard enable/disable interrupts */ +#define DISABLE_INTS + +#define ENABLE_INTS \ + ld r12,_MSR(r1); \ + mfmsr r11; \ + rlwimi r11,r12,0,MSR_EE; \ + mtmsrd r11,1 + +#endif + #define STD_EXCEPTION_COMMON( trap, label, hdlr ) \ - .globl label##_common; \ -label##_common: \ - EXCEPTION_PROLOG_COMMON; \ - addi r3,r1,STACK_FRAME_OVERHEAD; \ - li r20,0; \ - li r6,trap; \ - bl .save_remaining_regs; \ - bl hdlr; \ + .align 7; \ + .globl label##_common; \ +label##_common: \ + EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ + DISABLE_INTS; \ + bl .save_nvgprs; \ + addi r3,r1,STACK_FRAME_OVERHEAD; \ + bl hdlr; \ b .ret_from_except +#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \ + .align 7; \ + .globl label##_common; \ +label##_common: \ + EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ + DISABLE_INTS; \ + addi r3,r1,STACK_FRAME_OVERHEAD; \ + bl hdlr; \ + b .ret_from_except_lite + /* * Start of pSeries system interrupt routines */ @@ -385,9 +404,45 @@ label##_common: \ __start_interrupts: STD_EXCEPTION_PSERIES( 0x100, SystemReset ) - STD_EXCEPTION_PSERIES( 0x200, MachineCheck ) - STD_EXCEPTION_PSERIES( 0x300, DataAccess ) - STD_EXCEPTION_PSERIES( 0x380, DataAccessSLB ) + + . = 0x200 + .globl MachineCheck_Pseries +_MachineCheckPseries: + mtspr SPRG1,r13 /* save r13 */ + EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common) + + . = 0x300 + .globl DataAccess_Pseries +DataAccess_Pseries: + mtspr SPRG1,r13 +BEGIN_FTR_SECTION + mtspr SPRG2,r12 + mfspr r13,DAR + mfspr r12,DSISR + srdi r13,r13,60 + rlwimi r13,r12,16,0x20 + mfcr r12 + cmpwi r13,0x2c + beq .do_stab_bolted_Pseries + mtcrf 0x80,r12 + mfspr r12,SPRG2 +END_FTR_SECTION_IFCLR(CPU_FTR_SLB) + EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, DataAccess_common) + + . = 0x380 + .globl DataAccessSLB_Pseries +DataAccessSLB_Pseries: + mtspr SPRG1,r13 + mtspr SPRG2,r12 + mfspr r13,DAR + mfcr r12 + srdi r13,r13,60 + cmpdi r13,0xc + beq .do_slb_bolted_Pseries + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, DataAccessSLB_common) + STD_EXCEPTION_PSERIES( 0x400, InstructionAccess ) STD_EXCEPTION_PSERIES( 0x480, InstructionAccessSLB ) STD_EXCEPTION_PSERIES( 0x500, HardwareInterrupt ) @@ -397,7 +452,23 @@ __start_interrupts: STD_EXCEPTION_PSERIES( 0x900, Decrementer ) STD_EXCEPTION_PSERIES( 0xa00, Trap_0a ) STD_EXCEPTION_PSERIES( 0xb00, Trap_0b ) - STD_EXCEPTION_PSERIES( 0xc00, SystemCall ) + + . = 0xc00 + .globl SystemCall_Pseries +SystemCall_Pseries: + mr r9,r13 + mfmsr r10 + mfspr r13,SPRG3 + mfspr r11,SRR0 + clrrdi r12,r13,32 + oris r12,r12,SystemCall_common@h + ori r12,r12,SystemCall_common@l + mtspr SRR0,r12 + ori r10,r10,MSR_IR|MSR_DR|MSR_RI + mfspr r12,SRR1 + mtspr SRR1,r10 + rfid + STD_EXCEPTION_PSERIES( 0xd00, SingleStep ) STD_EXCEPTION_PSERIES( 0xe00, Trap_0e ) @@ -407,25 +478,26 @@ __start_interrupts: * trickery is thus necessary */ . = 0xf00 - b .PerformanceMonitor_Pseries - . = 0xf20 - b .AltivecUnavailable_Pseries + b PerformanceMonitor_Pseries + + STD_EXCEPTION_PSERIES(0xf20, AltivecUnavailable) STD_EXCEPTION_PSERIES( 0x1300, InstructionBreakpoint ) STD_EXCEPTION_PSERIES( 0x1700, AltivecAssist ) - /* Here are the "moved" performance monitor and - * altivec unavailable exceptions - */ - . = 0x3000 - .globl PerformanceMonitor_Pseries; -.PerformanceMonitor_Pseries: - EXCEPTION_PROLOG_PSERIES(0xf00, PerformanceMonitor_common) + /* moved from 0xf00 */ + STD_EXCEPTION_PSERIES(0x3000, PerformanceMonitor) . = 0x3100 - .globl AltivecUnavailable_Pseries; -.AltivecUnavailable_Pseries: - EXCEPTION_PROLOG_PSERIES(0xf20, AltivecUnavailable_common) +_GLOBAL(do_stab_bolted_Pseries) + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) + +_GLOBAL(do_slb_bolted_Pseries) + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_slb_bolted) /* Space for the naca. Architected to be located at real address @@ -484,31 +556,82 @@ __end_systemcfg: /*** ISeries-LPAR interrupt handlers ***/ - STD_EXCEPTION_ISERIES( 0x200, MachineCheck ) - STD_EXCEPTION_ISERIES( 0x300, DataAccess ) - STD_EXCEPTION_ISERIES( 0x380, DataAccessSLB ) - STD_EXCEPTION_ISERIES( 0x400, InstructionAccess ) - STD_EXCEPTION_ISERIES( 0x480, InstructionAccessSLB ) - MASKABLE_EXCEPTION_ISERIES( 0x500, HardwareInterrupt ) - STD_EXCEPTION_ISERIES( 0x600, Alignment ) - STD_EXCEPTION_ISERIES( 0x700, ProgramCheck ) - STD_EXCEPTION_ISERIES( 0x800, FPUnavailable ) - MASKABLE_EXCEPTION_ISERIES( 0x900, Decrementer ) - STD_EXCEPTION_ISERIES( 0xa00, Trap_0a ) - STD_EXCEPTION_ISERIES( 0xb00, Trap_0b ) - STD_EXCEPTION_ISERIES( 0xc00, SystemCall ) - STD_EXCEPTION_ISERIES( 0xd00, SingleStep ) - STD_EXCEPTION_ISERIES( 0xe00, Trap_0e ) - STD_EXCEPTION_ISERIES( 0xf00, PerformanceMonitor ) + STD_EXCEPTION_ISERIES(0x200, MachineCheck, PACA_EXMC) + + .globl DataAccess_Iseries +DataAccess_Iseries: + mtspr SPRG1,r13 +BEGIN_FTR_SECTION + mtspr SPRG2,r12 + mfspr r13,DAR + mfspr r12,DSISR + srdi r13,r13,60 + rlwimi r13,r12,16,0x20 + mfcr r12 + cmpwi r13,0x2c + beq .do_stab_bolted_Iseries + mtcrf 0x80,r12 + mfspr r12,SPRG2 +END_FTR_SECTION_IFCLR(CPU_FTR_SLB) + EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN) + EXCEPTION_PROLOG_ISERIES_2 + b DataAccess_common + +.do_stab_bolted_Iseries: + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) + EXCEPTION_PROLOG_ISERIES_2 + b .do_stab_bolted + + .globl DataAccessSLB_Iseries +DataAccessSLB_Iseries: + mtspr SPRG1,r13 /* save r13 */ + mtspr SPRG2,r12 + mfspr r13,DAR + mfcr r12 + srdi r13,r13,60 + cmpdi r13,0xc + beq .do_slb_bolted_Iseries + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN) + EXCEPTION_PROLOG_ISERIES_2 + b DataAccessSLB_common + +.do_slb_bolted_Iseries: + mtcrf 0x80,r12 + mfspr r12,SPRG2 + EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) + EXCEPTION_PROLOG_ISERIES_2 + b .do_slb_bolted + + STD_EXCEPTION_ISERIES(0x400, InstructionAccess, PACA_EXGEN) + STD_EXCEPTION_ISERIES(0x480, InstructionAccessSLB, PACA_EXGEN) + MASKABLE_EXCEPTION_ISERIES(0x500, HardwareInterrupt) + STD_EXCEPTION_ISERIES(0x600, Alignment, PACA_EXGEN) + STD_EXCEPTION_ISERIES(0x700, ProgramCheck, PACA_EXGEN) + STD_EXCEPTION_ISERIES(0x800, FPUnavailable, PACA_EXGEN) + MASKABLE_EXCEPTION_ISERIES(0x900, Decrementer) + STD_EXCEPTION_ISERIES(0xa00, Trap_0a, PACA_EXGEN) + STD_EXCEPTION_ISERIES(0xb00, Trap_0b, PACA_EXGEN) + + .globl SystemCall_Iseries +SystemCall_Iseries: + mr r9,r13 + mfspr r13,SPRG3 + EXCEPTION_PROLOG_ISERIES_2 + b SystemCall_common + + STD_EXCEPTION_ISERIES( 0xd00, SingleStep, PACA_EXGEN) + STD_EXCEPTION_ISERIES( 0xe00, Trap_0e, PACA_EXGEN) + STD_EXCEPTION_ISERIES( 0xf00, PerformanceMonitor, PACA_EXGEN) .globl SystemReset_Iseries SystemReset_Iseries: mfspr r13,SPRG3 /* Get paca address */ - mfmsr r24 - ori r24,r24,MSR_RI - mtmsrd r24 /* RI on */ lhz r24,PACAPACAINDEX(r13) /* Get processor # */ - cmpi 0,r24,0 /* Are we processor 0? */ + cmpwi 0,r24,0 /* Are we processor 0? */ beq .__start_initialization_iSeries /* Start up the first processor */ mfspr r4,CTRLF li r5,RUNLATCH /* Turn off the run light */ @@ -527,7 +650,7 @@ SystemReset_Iseries: addi r1,r3,THREAD_SIZE subi r1,r1,STACK_FRAME_OVERHEAD - cmpi 0,r23,0 + cmpwi 0,r23,0 beq iseries_secondary_smp_loop /* Loop until told to go */ #ifdef SECONDARY_PROCESSORS bne .__secondary_start /* Loop until told to go */ @@ -552,28 +675,29 @@ iseries_secondary_smp_loop: b 1b /* If SMP not configured, secondaries * loop forever */ - .globl HardwareInterrupt_Iseries_masked -HardwareInterrupt_Iseries_masked: - b maskable_exception_exit - .globl Decrementer_Iseries_masked Decrementer_Iseries_masked: - li r22,1 - stb r22,PACALPPACA+LPPACADECRINT(r20) - lwz r22,PACADEFAULTDECR(r20) - mtspr DEC,r22 -maskable_exception_exit: - mtcrf 0xff,r23 /* Restore regs and free exception frame */ - ld r22,EX_SRR0(r21) - ld r23,EX_SRR1(r21) - mtspr SRR0,r22 - mtspr SRR1,r23 - ld r22,EX_R22(r21) - ld r23,EX_R23(r21) - mfspr r21,SPRG1 - mfspr r20,SPRG2 + li r11,1 + stb r11,PACALPPACA+LPPACADECRINT(r13) + lwz r12,PACADEFAULTDECR(r13) + mtspr DEC,r12 + /* fall through */ + + .globl HardwareInterrupt_Iseries_masked +HardwareInterrupt_Iseries_masked: + mtcrf 0x80,r9 /* Restore regs */ + ld r11,LPPACA+LPPACASRR0(r13) + ld r12,LPPACA+LPPACASRR1(r13) + mtspr SRR0,r11 + mtspr SRR1,r12 + ld r9,PACA_EXGEN+EX_R9(r13) + ld r10,PACA_EXGEN+EX_R10(r13) + ld r11,PACA_EXGEN+EX_R11(r13) + ld r12,PACA_EXGEN+EX_R12(r13) + ld r13,PACA_EXGEN+EX_R13(r13) rfid #endif + /* * Data area reserved for FWNMI option. */ @@ -587,10 +711,12 @@ fwnmi_data_area: . = 0x8000 .globl SystemReset_FWNMI SystemReset_FWNMI: - EXCEPTION_PROLOG_PSERIES(0x100, SystemReset_common) + mtspr SPRG1,r13 /* save r13 */ + EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, SystemReset_common) .globl MachineCheck_FWNMI MachineCheck_FWNMI: - EXCEPTION_PROLOG_PSERIES(0x200, MachineCheck_common) + mtspr SPRG1,r13 /* save r13 */ + EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common) /* * Space for the initial segment table @@ -609,8 +735,22 @@ __end_stab: /*** Common interrupt handlers ***/ STD_EXCEPTION_COMMON( 0x100, SystemReset, .SystemResetException ) - STD_EXCEPTION_COMMON( 0x200, MachineCheck, .MachineCheckException ) - STD_EXCEPTION_COMMON( 0x900, Decrementer, .timer_interrupt ) + + /* + * Machine check is different because we use a different + * save area: PACA_EXMC instead of PACA_EXGEN. + */ + .align 7 + .globl MachineCheck_common +MachineCheck_common: + EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) + DISABLE_INTS + bl .save_nvgprs + addi r3,r1,STACK_FRAME_OVERHEAD + bl .MachineCheckException + b .ret_from_except + + STD_EXCEPTION_COMMON_LITE(0x900, Decrementer, .timer_interrupt) STD_EXCEPTION_COMMON( 0xa00, Trap_0a, .UnknownException ) STD_EXCEPTION_COMMON( 0xb00, Trap_0b, .UnknownException ) STD_EXCEPTION_COMMON( 0xd00, SingleStep, .SingleStepException ) @@ -624,65 +764,56 @@ __end_stab: #endif /* - * Here the exception frame is filled out and we have detected that - * the kernel stack pointer is bad. R23 contains the saved CR, r20 - * points to the paca, r21 points to the exception frame, and r22 - * contains the (bad) kernel stack pointer. + * Here we have detected that the kernel stack pointer is bad. + * R9 contains the saved CR, r13 points to the paca, + * r10 contains the (bad) kernel stack pointer, + * r11 and r12 contain the saved SRR0 and SRR1. * We switch to using the paca guard page as an emergency stack, - * save the registers on there, and call kernel_bad_stack(), - * which panics. + * save the registers there, and call kernel_bad_stack(), which panics. */ bad_stack: - addi r1,r20,8192-64-INT_FRAME_SIZE - std r22,GPR1(r1) - std r23,_CCR(r1) - ld r22,EX_R20(r21) - std r22,GPR20(r1) - ld r23,EX_R21(r21) - std r23,GPR21(r1) - ld r22,EX_R22(r21) - std r22,GPR22(r1) - ld r23,EX_R23(r21) - std r23,GPR23(r1) - ld r23,EX_DAR(r21) - std r23,_DAR(r1) - lwz r22,EX_DSISR(r21) - std r22,_DSISR(r1) - lwz r23,EX_TRAP(r21) - std r23,TRAP(r1) - ld r22,EX_SRR0(r21) - ld r23,EX_SRR1(r21) - std r22,_NIP(r1) - std r23,_MSR(r1) - addi r21,r21,-EXC_FRAME_SIZE - std r21,PACAEXCSP(r20) - mflr r22 - std r22,_LINK(r1) - mfctr r23 - std r23,_CTR(r1) - mfspr r22,XER - std r22,_XER(r1) + addi r1,r13,8192-64-INT_FRAME_SIZE + std r9,_CCR(r1) + std r10,GPR1(r1) + std r11,_NIP(r1) + std r12,_MSR(r1) + mfspr r11,DAR + mfspr r12,DSISR + std r11,_DAR(r1) + std r12,_DSISR(r1) + mflr r10 + mfctr r11 + mfxer r12 + std r10,_LINK(r1) + std r11,_CTR(r1) + std r12,_XER(r1) SAVE_GPR(0, r1) - SAVE_10GPRS(2, r1) - SAVE_8GPRS(12, r1) - SAVE_8GPRS(24, r1) - addi r21,r1,INT_FRAME_SIZE - std r21,0(r1) - li r22,0 - std r22,0(r21) - ld r2,PACATOC(r20) - mr r13,r20 + SAVE_GPR(2,r1) + SAVE_4GPRS(3,r1) + SAVE_2GPRS(7,r1) + SAVE_10GPRS(12,r1) + SAVE_10GPRS(22,r1) + addi r11,r1,INT_FRAME_SIZE + std r11,0(r1) + li r12,0 + std r12,0(r11) + ld r2,PACATOC(r13) 1: addi r3,r1,STACK_FRAME_OVERHEAD bl .kernel_bad_stack b 1b /* - * Return from an exception which is handled without calling - * save_remaining_regs. The caller is assumed to have done - * EXCEPTION_PROLOG_COMMON. + * Return from an exception with minimal checks. + * The caller is assumed to have done EXCEPTION_PROLOG_COMMON. + * If interrupts have been enabled, or anything has been + * done that might have changed the scheduling status of + * any task or sent any task a signal, you should use + * ret_from_except or ret_from_except_lite instead of this. */ fast_exception_return: - andi. r3,r23,MSR_RI /* check if RI is set */ + ld r12,_MSR(r1) + ld r11,_NIP(r1) + andi. r3,r12,MSR_RI /* check if RI is set */ beq- unrecov_fer ld r3,_CCR(r1) ld r4,_LINK(r1) @@ -691,244 +822,178 @@ fast_exception_return: mtcr r3 mtlr r4 mtctr r5 - mtspr XER,r6 + mtxer r6 REST_GPR(0, r1) REST_8GPRS(2, r1) - REST_4GPRS(10, r1) - mfmsr r20 - li r21, MSR_RI - andc r20,r20,r21 - mtmsrd r20,1 + mfmsr r10 + clrrdi r10,r10,2 /* clear RI (LE is 0 already) */ + mtmsrd r10,1 - mtspr SRR1,r23 - mtspr SRR0,r22 - REST_4GPRS(20, r1) + mtspr SRR1,r12 + mtspr SRR0,r11 + REST_4GPRS(10, r1) ld r1,GPR1(r1) rfid unrecov_fer: - li r6,0x4000 - li r20,0 - bl .save_remaining_regs + bl .save_nvgprs 1: addi r3,r1,STACK_FRAME_OVERHEAD bl .unrecoverable_exception b 1b /* - * Here r20 points to the PACA, r21 to the exception frame, - * r23 contains the saved CR. - * r20 - r23, SRR0 and SRR1 are saved in the exception frame. + * Here r13 points to the paca, r9 contains the saved CR, + * SRR0 and SRR1 are saved in r11 and r12, + * r9 - r13 are saved in paca->exgen. */ + .align 7 .globl DataAccess_common DataAccess_common: -BEGIN_FTR_SECTION - mfspr r22,DAR - srdi r22,r22,60 - cmpi 0,r22,0xc - - /* Segment fault on a bolted segment. Go off and map that segment. */ - beq- .do_stab_bolted -END_FTR_SECTION_IFCLR(CPU_FTR_SLB) -stab_bolted_user_return: - EXCEPTION_PROLOG_COMMON - ld r3,_DSISR(r1) - andis. r0,r3,0xa450 /* weird error? */ - bne 1f /* if not, try to put a PTE */ - andis. r0,r3,0x0020 /* Is it a page table fault? */ - rlwinm r4,r3,32-23,29,29 /* DSISR_STORE -> _PAGE_RW */ - ld r3,_DAR(r1) /* into the hash table */ - -BEGIN_FTR_SECTION - beq+ 2f /* If so handle it */ - li r4,0x300 /* Trap number */ - bl .do_stab_SI - b 1f -END_FTR_SECTION_IFCLR(CPU_FTR_SLB) - -2: li r5,0x300 - bl .do_hash_page_DSI /* Try to handle as hpte fault */ -1: - ld r4,_DAR(r1) - ld r5,_DSISR(r1) - addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0x300 - bl .save_remaining_regs - bl .do_page_fault - b .ret_from_except - + mfspr r10,DAR + std r10,PACA_EXGEN+EX_DAR(r13) + mfspr r10,DSISR + stw r10,PACA_EXGEN+EX_DSISR(r13) + EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN) + ld r3,PACA_EXGEN+EX_DAR(r13) + lwz r4,PACA_EXGEN+EX_DSISR(r13) + li r5,0x300 + b .do_hash_page /* Try to handle as hpte fault */ + + .align 7 .globl DataAccessSLB_common DataAccessSLB_common: - mfspr r22,DAR - srdi r22,r22,60 - cmpi 0,r22,0xc - - /* Segment fault on a bolted segment. Go off and map that segment. */ - beq .do_slb_bolted - - EXCEPTION_PROLOG_COMMON - ld r3,_DAR(r1) - li r4,0x380 /* Exception vector */ + mfspr r10,DAR + std r10,PACA_EXGEN+EX_DAR(r13) + EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN) + ld r3,PACA_EXGEN+EX_DAR(r13) + std r3,_DAR(r1) bl .slb_allocate - or. r3,r3,r3 /* Check return code */ + cmpdi r3,0 /* Check return code */ beq fast_exception_return /* Return if we succeeded */ - addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - ld r4,_DAR(r1) - li r6,0x380 li r5,0 - bl .save_remaining_regs - bl .do_page_fault - b .ret_from_except + std r5,_DSISR(r1) + b .handle_page_fault + .align 7 .globl InstructionAccess_common InstructionAccess_common: - EXCEPTION_PROLOG_COMMON - -BEGIN_FTR_SECTION - andis. r0,r23,0x0020 /* no ste found? */ - beq+ 2f - mr r3,r22 /* SRR0 at interrupt */ - li r4,0x400 /* Trap number */ - bl .do_stab_SI - b 1f -END_FTR_SECTION_IFCLR(CPU_FTR_SLB) - -2: mr r3,r22 + EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) + ld r3,_NIP(r1) + andis. r4,r12,0x5820 li r5,0x400 - bl .do_hash_page_ISI /* Try to handle as hpte fault */ -1: - mr r4,r22 - rlwinm r5,r23,0,4,4 /* We only care about PR in error_code */ - addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0x400 - bl .save_remaining_regs - bl .do_page_fault - b .ret_from_except + b .do_hash_page /* Try to handle as hpte fault */ + .align 7 .globl InstructionAccessSLB_common InstructionAccessSLB_common: - EXCEPTION_PROLOG_COMMON - mr r3,r22 /* SRR0 = NIA */ - li r4,0x480 /* Exception vector */ + EXCEPTION_PROLOG_COMMON(0x480, PACA_EXGEN) + ld r3,_NIP(r1) /* SRR0 = NIA */ bl .slb_allocate or. r3,r3,r3 /* Check return code */ beq+ fast_exception_return /* Return if we succeeded */ - addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - mr r4,r22 /* SRR0 = NIA */ - li r6,0x480 + ld r4,_NIP(r1) li r5,0 - bl .save_remaining_regs - bl .do_page_fault - b .ret_from_except + std r4,_DAR(r1) + std r5,_DSISR(r1) + b .handle_page_fault + .align 7 .globl HardwareInterrupt_common + .globl HardwareInterrupt_entry HardwareInterrupt_common: - EXCEPTION_PROLOG_COMMON + EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) HardwareInterrupt_entry: + DISABLE_INTS addi r3,r1,STACK_FRAME_OVERHEAD - li r20,0 - li r6,0x500 - bl .save_remaining_regs bl .do_IRQ - b .ret_from_except + b .ret_from_except_lite + .align 7 .globl Alignment_common Alignment_common: - EXCEPTION_PROLOG_COMMON + mfspr r10,DAR + std r10,PACA_EXGEN+EX_DAR(r13) + mfspr r10,DSISR + stw r10,PACA_EXGEN+EX_DSISR(r13) + EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN) + ld r3,PACA_EXGEN+EX_DAR(r13) + lwz r4,PACA_EXGEN+EX_DSISR(r13) + std r3,_DAR(r1) + std r4,_DSISR(r1) + bl .save_nvgprs addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0x600 - bl .save_remaining_regs + ENABLE_INTS bl .AlignmentException b .ret_from_except + .align 7 .globl ProgramCheck_common ProgramCheck_common: - EXCEPTION_PROLOG_COMMON + EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) + bl .save_nvgprs addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0x700 - bl .save_remaining_regs + ENABLE_INTS bl .ProgramCheckException b .ret_from_except + .align 7 .globl FPUnavailable_common FPUnavailable_common: - EXCEPTION_PROLOG_COMMON + EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN) bne .load_up_fpu /* if from user, just load it up */ + bl .save_nvgprs addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0x800 - bl .save_remaining_regs + ENABLE_INTS bl .KernelFPUnavailableException BUG_OPCODE + .align 7 .globl AltivecUnavailable_common AltivecUnavailable_common: - EXCEPTION_PROLOG_COMMON + EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN) #ifdef CONFIG_ALTIVEC - bne .load_up_altivec /* if from user, just load it up */ + bne .load_up_altivec /* if from user, just load it up */ #endif + bl .save_nvgprs addi r3,r1,STACK_FRAME_OVERHEAD - DO_COPY_EE() - li r6,0xf20 - bl .save_remaining_regs -#ifdef CONFIG_ALTIVEC - bl .KernelAltivecUnavailableException -#else - bl .UnknownException -#endif - BUG_OPCODE + ENABLE_INTS + bl .AltivecUnavailableException + b .ret_from_except - .globl SystemCall_common -SystemCall_common: - EXCEPTION_PROLOG_COMMON -#ifdef CONFIG_PPC_ISERIES - cmpi 0,r0,0x5555 /* Special syscall to handle pending */ - bne+ 1f /* interrupts */ - andi. r6,r23,MSR_PR /* Only allowed from kernel */ - beq+ HardwareInterrupt_entry -1: -#endif - DO_COPY_EE() - li r6,0xC00 - bl .save_remaining_regs - bl .DoSyscall - b .ret_from_except +/* + * Hash table stuff + */ + .align 7 +_GLOBAL(do_hash_page) + std r3,_DAR(r1) + std r4,_DSISR(r1) + + andis. r0,r4,0xa450 /* weird error? */ + bne- .handle_page_fault /* if not, try to insert a HPTE */ +BEGIN_FTR_SECTION + andis. r0,r4,0x0020 /* Is it a segment table fault? */ + bne- .do_ste_alloc /* If so handle it */ +END_FTR_SECTION_IFCLR(CPU_FTR_SLB) -_GLOBAL(do_hash_page_ISI) - li r4,0 -_GLOBAL(do_hash_page_DSI) /* * We need to set the _PAGE_USER bit if MSR_PR is set or if we are * accessing a userspace segment (even from the kernel). We assume * kernel addresses always have the high bit set. */ - rotldi r0,r3,15 /* Move high bit into MSR_PR position */ - orc r0,r23,r0 - rlwimi r4,r0,32-13,30,30 /* Insert into _PAGE_USER */ + rlwinm r4,r4,32-23,29,29 /* DSISR_STORE -> _PAGE_RW */ + rotldi r0,r3,15 /* Move high bit into MSR_PR posn */ + orc r0,r12,r0 /* MSR_PR | ~high_bit */ + rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */ ori r4,r4,1 /* add _PAGE_PRESENT */ - mflr r21 /* Save LR in r21 */ - -#ifdef DO_SOFT_DISABLE /* - * We hard enable here (but first soft disable) so that the hash_page - * code can spin on the hash_table_lock with problem on a shared - * processor. + * On iSeries, we soft-disable interrupts here, then + * hard-enable interrupts so that the hash_page code can spin on + * the hash_table_lock without problems on a shared processor. */ - li r0,0 - stb r0,PACAPROCENABLED(r20) /* Soft Disabled */ - - mfmsr r0 - ori r0,r0,MSR_EE+MSR_RI - mtmsrd r0 /* Hard Enable, RI on */ -#endif + DISABLE_INTS /* * r3 contains the faulting address @@ -937,184 +1002,159 @@ _GLOBAL(do_hash_page_DSI) * * at return r3 = 0 for success */ - bl .hash_page /* build HPTE if possible */ + cmpdi r3,0 /* see if hash_page succeeded */ #ifdef DO_SOFT_DISABLE /* - * Now go back to hard disabled. + * If we had interrupts soft-enabled at the point where the + * DSI/ISI occurred, and an interrupt came in during hash_page, + * handle it now. + * We jump to ret_from_except_lite rather than fast_exception_return + * because ret_from_except_lite will check for and handle pending + * interrupts if necessary. */ - mfmsr r0 - li r4,0 - ori r4,r4,MSR_EE+MSR_RI - andc r0,r0,r4 - mtmsrd r0 /* Hard Disable, RI off */ - - ld r0,SOFTE(r1) - cmpdi 0,r0,0 /* See if we will soft enable in */ - /* save_remaining_regs */ - beq 5f - CHECKANYINT(r4,r5) - bne- HardwareInterrupt_entry /* Convert this DSI into an External */ - /* to process interrupts which occurred */ - /* during hash_page */ -5: - stb r0,PACAPROCENABLED(r20) /* Restore soft enable/disable status */ + beq .ret_from_except_lite + /* + * hash_page couldn't handle it, set soft interrupt enable back + * to what it was before the trap. Note that .local_irq_restore + * handles any interrupts pending at this point. + */ + ld r3,SOFTE(r1) + bl .local_irq_restore + b 11f +#else + beq+ fast_exception_return /* Return from exception on success */ + /* fall through */ #endif - or. r3,r3,r3 /* Check return code */ - beq fast_exception_return /* Return from exception on success */ - mtlr r21 /* restore LR */ - blr /* Return to DSI or ISI on failure */ +/* Here we have a page fault that hash_page can't handle. */ +_GLOBAL(handle_page_fault) + ENABLE_INTS +11: ld r4,_DAR(r1) + ld r5,_DSISR(r1) + addi r3,r1,STACK_FRAME_OVERHEAD + bl .do_page_fault + cmpdi r3,0 + beq+ .ret_from_except_lite + bl .save_nvgprs + mr r5,r3 + addi r3,r1,STACK_FRAME_OVERHEAD + lwz r4,_DAR(r1) + bl .bad_page_fault + b .ret_from_except + + /* here we have a segment miss */ +_GLOBAL(do_ste_alloc) + bl .ste_allocate /* try to insert stab entry */ + cmpdi r3,0 + beq+ fast_exception_return + b .handle_page_fault /* - * r20 points to the PACA, r21 to the exception frame, - * r23 contains the saved CR. - * r20 - r23, SRR0 and SRR1 are saved in the exception frame. + * r13 points to the PACA, r9 contains the saved CR, + * r11 and r12 contain the saved SRR0 and SRR1. + * r9 - r13 are saved in paca->exslb. * We assume we aren't going to take any exceptions during this procedure. + * We assume (DAR >> 60) == 0xc. */ + .align 7 _GLOBAL(do_stab_bolted) - stw r23,EX_CCR(r21) /* save CR in exc. frame */ + stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ + std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ - mfspr r22,DSISR - andis. r22,r22,0x0020 - beq- stab_bolted_user_return + /* Hash to the primary group */ + ld r10,PACASTABVIRT(r13) + mfspr r11,DAR + srdi r11,r11,28 + rldimi r10,r11,7,52 /* r10 = first ste of the group */ + /* Calculate VSID */ /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ - mfspr r21,DAR - rldicl r20,r21,36,51 - sldi r20,r20,15 - srdi r21,r21,60 - or r20,r20,r21 + rldic r11,r11,15,36 + ori r11,r11,0xc /* VSID_RANDOMIZER */ - li r21,9 - sldi r21,r21,32 - oris r21,r21,58231 - ori r21,r21,39831 - - mulld r20,r20,r21 - clrldi r20,r20,28 /* r20 = vsid */ + li r9,9 + sldi r9,r9,32 + oris r9,r9,58231 + ori r9,r9,39831 - mfsprg r21,3 - ld r21,PACASTABVIRT(r21) - - /* Hash to the primary group */ - mfspr r22,DAR - rldicl r22,r22,36,59 - rldicr r22,r22,7,56 - or r21,r21,r22 /* r21 = first ste of the group */ + mulld r9,r11,r9 + rldic r9,r9,12,16 /* r9 = vsid << 12 */ /* Search the primary group for a free entry */ - li r22,0 -1: - ld r23,0(r21) /* Test valid bit of the current ste */ - rldicl r23,r23,57,63 - cmpwi r23,0 - bne 2f - li r23,0 - rldimi r23,r20,12,0 /* Insert the new vsid value */ - std r23,8(r21) /* Put new entry back into the stab */ - eieio /* Order vsid update */ - li r23,0 - mfspr r20,DAR /* Get the new esid */ - rldicl r20,r20,36,28 /* Permits a full 36b of ESID */ - rldimi r23,r20,28,0 /* Insert the new esid value */ - ori r23,r23,144 /* Turn on valid and kp */ - std r23,0(r21) /* Put new entry back into the stab */ - sync /* Order the update */ - b 3f -2: - addi r22,r22,1 - addi r21,r21,16 - cmpldi r22,7 - ble 1b +1: ld r11,0(r10) /* Test valid bit of the current ste */ + andi. r11,r11,0x80 + beq 2f + addi r10,r10,16 + andi. r11,r10,0x70 + bne 1b /* Stick for only searching the primary group for now. */ /* At least for now, we use a very simple random castout scheme */ /* Use the TB as a random number ; OR in 1 to avoid entry 0 */ - mftb r22 - andi. r22,r22,7 - ori r22,r22,1 - sldi r22,r22,4 + mftb r11 + rldic r11,r11,4,57 /* r11 = (r11 << 4) & 0x70 */ + ori r11,r11,0x10 - /* r21 currently points to and ste one past the group of interest */ + /* r10 currently points to an ste one past the group of interest */ /* make it point to the randomly selected entry */ - subi r21,r21,128 - or r21,r21,r22 /* r21 is the entry to invalidate */ + subi r10,r10,128 + or r10,r10,r11 /* r10 is the entry to invalidate */ isync /* mark the entry invalid */ - ld r23,0(r21) - li r22,-129 - and r23,r23,r22 - std r23,0(r21) + ld r11,0(r10) + rldicl r11,r11,56,1 /* clear the valid bit */ + rotldi r11,r11,8 + std r11,0(r10) sync - li r23,0 - rldimi r23,r20,12,0 - std r23,8(r21) + clrrdi r11,r11,28 /* Get the esid part of the ste */ + slbie r11 + +2: std r9,8(r10) /* Store the vsid part of the ste */ eieio - ld r22,0(r21) /* Get the esid part of the ste */ - li r23,0 - mfspr r20,DAR /* Get the new esid */ - rldicl r20,r20,36,28 /* Permits a full 32b of ESID */ - rldimi r23,r20,28,0 /* Insert the new esid value */ - ori r23,r23,144 /* Turn on valid and kp */ - std r23,0(r21) /* Put new entry back into the stab */ - - rldicl r22,r22,36,28 - rldicr r22,r22,28,35 - slbie r22 + mfspr r11,DAR /* Get the new esid */ + clrrdi r11,r11,28 /* Permits a full 32b of ESID */ + ori r11,r11,0x90 /* Turn on valid and kp */ + std r11,0(r10) /* Put new entry back into the stab */ + sync -3: /* All done -- return from exception. */ - mfsprg r20,3 /* Load the PACA pointer */ - ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */ - addi r21,r21,EXC_FRAME_SIZE - lwz r23,EX_CCR(r21) /* get saved CR */ - - ld r22,EX_SRR1(r21) - andi. r22,r22,MSR_RI - beq- unrecov_stab - - /* note that this is almost identical to maskable_exception_exit */ - mtcr r23 /* restore CR */ - - mfmsr r22 - li r23, MSR_RI - andc r22,r22,r23 - mtmsrd r22,1 - - ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */ - ld r23,EX_SRR1(r21) /* Get SRR1 from exc. frame */ - mtspr SRR0,r22 - mtspr SRR1,r23 - ld r22,EX_R22(r21) /* restore r22 and r23 */ - ld r23,EX_R23(r21) - mfspr r20,SPRG2 - mfspr r21,SPRG1 - rfid + lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ + ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */ -unrecov_stab: - EXCEPTION_PROLOG_COMMON - li r6,0x4100 - li r20,0 - bl .save_remaining_regs -1: addi r3,r1,STACK_FRAME_OVERHEAD - bl .unrecoverable_exception - b 1b + andi. r10,r12,MSR_RI + beq- unrecov_slb + + mtcrf 0x80,r9 /* restore CR */ + + mfmsr r10 + clrrdi r10,r10,2 + mtmsrd r10,1 + + mtspr SRR0,r11 + mtspr SRR1,r12 + ld r9,PACA_EXSLB+EX_R9(r13) + ld r10,PACA_EXSLB+EX_R10(r13) + ld r11,PACA_EXSLB+EX_R11(r13) + ld r12,PACA_EXSLB+EX_R12(r13) + ld r13,PACA_EXSLB+EX_R13(r13) + rfid /* - * r20 points to the PACA, r21 to the exception frame, - * r23 contains the saved CR. - * r20 - r23, SRR0 and SRR1 are saved in the exception frame. + * r13 points to the PACA, r9 contains the saved CR, + * r11 and r12 contain the saved SRR0 and SRR1. + * r9 - r13 are saved in paca->exslb. * We assume we aren't going to take any exceptions during this procedure. */ /* XXX note fix masking in get_kernel_vsid to match */ _GLOBAL(do_slb_bolted) - stw r23,EX_CCR(r21) /* save CR in exc. frame */ + stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ + std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ /* * We take the next entry, round robin. Previously we tried @@ -1122,15 +1162,15 @@ _GLOBAL(do_slb_bolted) * we dont have any LRU information to help us choose a slot. */ - /* r20 = paca */ -1: ld r22,PACASTABRR(r20) - addi r21,r22,1 - cmpdi r21,SLB_NUM_ENTRIES + /* r13 = paca */ +1: ld r10,PACASTABRR(r13) + addi r9,r10,1 + cmpdi r9,SLB_NUM_ENTRIES blt+ 2f - li r21,2 /* dont touch slot 0 or 1 */ -2: std r21,PACASTABRR(r20) + li r9,2 /* dont touch slot 0 or 1 */ +2: std r9,PACASTABRR(r13) - /* r20 = paca, r22 = entry */ + /* r13 = paca, r10 = entry */ /* * Never cast out the segment for our kernel stack. Since we @@ -1139,8 +1179,8 @@ _GLOBAL(do_slb_bolted) * which gets invalidated due to a tlbie from another cpu at a * non recoverable point (after setting srr0/1) - Anton */ - slbmfee r21,r22 - srdi r21,r21,27 + slbmfee r9,r10 + srdi r9,r9,27 /* * Use paca->ksave as the value of the kernel stack pointer, * because this is valid at all times. @@ -1150,74 +1190,71 @@ _GLOBAL(do_slb_bolted) * switch (between updating r1 and updating paca->ksave), * we check against both r1 and paca->ksave. */ - srdi r23,r1,27 - ori r23,r23,1 - cmpd r23,r21 + srdi r11,r1,27 + ori r11,r11,1 + cmpd r11,r9 beq- 1b - ld r23,PACAKSAVE(r20) - srdi r23,r23,27 - ori r23,r23,1 - cmpd r23,r21 + ld r11,PACAKSAVE(r13) + srdi r11,r11,27 + ori r11,r11,1 + cmpd r11,r9 beq- 1b - /* r20 = paca, r22 = entry */ + /* r13 = paca, r10 = entry */ /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ - mfspr r21,DAR - rldicl r23,r21,36,51 - sldi r23,r23,15 - srdi r21,r21,60 - or r23,r23,r21 + mfspr r9,DAR + rldicl r11,r9,36,51 + sldi r11,r11,15 + srdi r9,r9,60 + or r11,r11,r9 /* VSID_RANDOMIZER */ - li r21,9 - sldi r21,r21,32 - oris r21,r21,58231 - ori r21,r21,39831 + li r9,9 + sldi r9,r9,32 + oris r9,r9,58231 + ori r9,r9,39831 /* vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK */ - mulld r23,r23,r21 - clrldi r23,r23,28 + mulld r11,r11,r9 + clrldi r11,r11,28 - /* r20 = paca, r22 = entry, r23 = vsid */ + /* r13 = paca, r10 = entry, r11 = vsid */ /* Put together slb word1 */ - sldi r23,r23,12 + sldi r11,r11,12 BEGIN_FTR_SECTION /* set kp and c bits */ - ori r23,r23,0x480 + ori r11,r11,0x480 END_FTR_SECTION_IFCLR(CPU_FTR_16M_PAGE) BEGIN_FTR_SECTION /* set kp, l and c bits */ - ori r23,r23,0x580 + ori r11,r11,0x580 END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) - /* r20 = paca, r22 = entry, r23 = slb word1 */ + /* r13 = paca, r10 = entry, r11 = slb word1 */ /* Put together slb word0 */ - mfspr r21,DAR - rldicr r21,r21,0,35 /* get the new esid */ - oris r21,r21,2048 /* set valid bit */ - rldimi r21,r22,0,52 /* insert entry */ + mfspr r9,DAR + clrrdi r9,r9,28 /* get the new esid */ + oris r9,r9,0x800 /* set valid bit */ + rldimi r9,r10,0,52 /* insert entry */ - /* r20 = paca, r21 = slb word0, r23 = slb word1 */ + /* r13 = paca, r9 = slb word0, r11 = slb word1 */ /* * No need for an isync before or after this slbmte. The exception * we enter with and the rfid we exit with are context synchronizing . */ - slbmte r23,r21 + slbmte r11,r9 /* All done -- return from exception. */ - ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */ - addi r21,r21,EXC_FRAME_SIZE - lwz r23,EX_CCR(r21) /* get saved CR */ - /* note that this is almost identical to maskable_exception_exit */ + lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ + ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */ - ld r22,EX_SRR1(r21) - andi. r22,r22,MSR_RI - beq- unrecov_stab + andi. r10,r12,MSR_RI /* check for unrecoverable exception */ + beq- unrecov_slb /* * Until everyone updates binutils hardwire the POWER4 optimised @@ -1226,124 +1263,32 @@ END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) #if 0 .machine push .machine "power4" - mtcrf 0x80,r23 + mtcrf 0x80,r9 .machine pop #else - .long 0x7ef80120 + .long 0x7d380120 #endif - mfmsr r22 - li r23, MSR_RI - andc r22,r22,r23 - mtmsrd r22,1 - - ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */ - ld r23,EX_SRR1(r21) /* Get SRR1 from exc. frame */ - mtspr SRR0,r22 - mtspr SRR1,r23 - ld r22,EX_R22(r21) /* restore r22 and r23 */ - ld r23,EX_R23(r21) - ld r20,EX_R20(r21) - mfspr r21,SPRG1 + mfmsr r10 + clrrdi r10,r10,2 + mtmsrd r10,1 + + mtspr SRR0,r11 + mtspr SRR1,r12 + ld r9,PACA_EXSLB+EX_R9(r13) + ld r10,PACA_EXSLB+EX_R10(r13) + ld r11,PACA_EXSLB+EX_R11(r13) + ld r12,PACA_EXSLB+EX_R12(r13) + ld r13,PACA_EXSLB+EX_R13(r13) rfid -_GLOBAL(do_stab_SI) - mflr r21 /* Save LR in r21 */ - - /* - * r3 contains the faulting address - * r4 contains the required access permissions - * - * at return r3 = 0 for success - */ - - bl .ste_allocate /* build STE if possible */ - or. r3,r3,r3 /* Check return code */ - beq fast_exception_return /* Return from exception on success */ - mtlr r21 /* restore LR */ - blr /* Return to DSI or ISI on failure */ - -/* - * This code finishes saving the registers to the exception frame. - * Address translation is already on. - */ -_GLOBAL(save_remaining_regs) - /* - * Save the rest of the registers into the pt_regs structure - */ - std r22,_NIP(r1) - std r23,_MSR(r1) - std r6,TRAP(r1) - ld r6,GPR6(r1) - SAVE_2GPRS(14, r1) - SAVE_4GPRS(16, r1) - SAVE_8GPRS(24, r1) - - /* Set the marker value "regshere" just before the reg values */ - SET_REG_TO_CONST(r22, 0x7265677368657265) - std r22,STACK_FRAME_OVERHEAD-16(r1) - - /* - * Clear the RESULT field - */ - li r22,0 - std r22,RESULT(r1) - - /* - * Test if from user state; result will be tested later - */ - andi. r23,r23,MSR_PR /* Set CR for later branch */ - - /* - * Indicate that r1 contains the kernel stack and - * get the Kernel TOC pointer from the paca - */ - ld r2,PACATOC(r13) /* Get Kernel TOC pointer */ - - /* - * If from user state, update THREAD.regs - */ - beq 2f /* Modify THREAD.regs if from user */ - addi r23,r1,STACK_FRAME_OVERHEAD - ld r22, PACACURRENT(r13) - std r23,THREAD+PT_REGS(r22) -2: - SET_REG_TO_CONST(r22, MSR_KERNEL) - -#ifdef DO_SOFT_DISABLE - stb r20,PACAPROCENABLED(r13) /* possibly soft enable */ - ori r22,r22,MSR_EE /* always hard enable */ -#else - rldimi r22,r20,15,48 /* Insert desired EE value */ -#endif - - mtmsrd r22,1 - blr - -/* - * Kernel profiling with soft disable on iSeries - */ -do_profile: - ld r22,8(r21) /* Get SRR1 */ - andi. r22,r22,MSR_PR /* Test if in kernel */ - bnelr /* return if not in kernel */ - ld r22,0(r21) /* Get SRR0 */ - ld r25,PACAPROFSTEXT(r20) /* _stext */ - subf r22,r25,r22 /* offset into kernel */ - lwz r25,PACAPROFSHIFT(r20) - srd r22,r22,r25 - lwz r25,PACAPROFLEN(r20) /* length of profile table (-1) */ - cmp 0,r22,r25 /* off end? */ - ble 1f - mr r22,r25 /* force into last entry */ -1: sldi r22,r22,2 /* convert to offset into buffer */ - ld r25,PACAPROFBUFFER(r20) /* profile buffer */ - add r25,r25,r22 -2: lwarx r22,0,r25 /* atomically increment */ - addi r22,r22,1 - stwcx. r22,0,r25 - bne- 2b - blr +unrecov_slb: + EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB) + DISABLE_INTS + bl .save_nvgprs +1: addi r3,r1,STACK_FRAME_OVERHEAD + bl .unrecoverable_exception + b 1b /* @@ -1375,7 +1320,7 @@ _GLOBAL(pseries_secondary_smp_init) addi r1,r1,0x1000 subi r1,r1,STACK_FRAME_OVERHEAD - cmpi 0,r23,0 + cmpwi 0,r23,0 #ifdef CONFIG_SMP #ifdef SECONDARY_PROCESSORS bne .__secondary_start @@ -1594,9 +1539,9 @@ _STATIC(load_up_fpu) * */ #ifndef CONFIG_SMP - LOADBASE(r3,last_task_used_math) - ld r4,last_task_used_math@l(r3) - cmpi 0,r4,0 + ld r3,last_task_used_math@got(r2) + ld r4,0(r3) + cmpdi 0,r4,0 beq 1f /* Save FP state to last_task_used_math's THREAD struct */ addi r4,r4,THREAD @@ -1606,8 +1551,8 @@ _STATIC(load_up_fpu) /* Disable FP for last_task_used_math */ ld r5,PT_REGS(r4) ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - li r20,MSR_FP|MSR_FE0|MSR_FE1 - andc r4,r4,r20 + li r6,MSR_FP|MSR_FE0|MSR_FE1 + andc r4,r4,r6 std r4,_MSR-STACK_FRAME_OVERHEAD(r5) 1: #endif /* CONFIG_SMP */ @@ -1615,15 +1560,16 @@ _STATIC(load_up_fpu) ld r4,PACACURRENT(r13) addi r5,r4,THREAD /* Get THREAD */ ld r4,THREAD_FPEXC_MODE(r5) - ori r23,r23,MSR_FP - or r23,r23,r4 + ori r12,r12,MSR_FP + or r12,r12,r4 + std r12,_MSR(r1) lfd fr0,THREAD_FPSCR(r5) mtfsf 0xff,fr0 REST_32FPRS(0, r5) #ifndef CONFIG_SMP /* Update last_task_used_math to 'current' */ subi r4,r5,THREAD /* Back to 'current' */ - std r4,last_task_used_math@l(r3) + std r4,0(r3) #endif /* CONFIG_SMP */ /* restore registers and return */ b fast_exception_return @@ -1651,11 +1597,11 @@ _GLOBAL(giveup_fpu) ori r5,r5,MSR_FP mtmsrd r5 /* enable use of fpu now */ isync - cmpi 0,r3,0 + cmpdi 0,r3,0 beqlr- /* if no previous owner, done */ addi r3,r3,THREAD /* want THREAD of task */ ld r5,PT_REGS(r3) - cmpi 0,r5,0 + cmpdi 0,r5,0 SAVE_32FPRS(0, r3) mffs fr0 stfd fr0,THREAD_FPSCR(r3) @@ -1667,8 +1613,8 @@ _GLOBAL(giveup_fpu) 1: #ifndef CONFIG_SMP li r5,0 - LOADBASE(r4,last_task_used_math) - std r5,last_task_used_math@l(r4) + ld r4,last_task_used_math@got(r2) + std r5,0(r4) #endif /* CONFIG_SMP */ blr @@ -1699,9 +1645,9 @@ _STATIC(load_up_altivec) * avoid saving all of the VREGs here... */ #ifndef CONFIG_SMP - LOADBASE(r3,last_task_used_altivec) - ld r4,last_task_used_altivec@l(r3) - cmpi 0,r4,0 + ld r3,last_task_used_altivec@got(r2) + ld r4,0(r3) + cmpdi 0,r4,0 beq 1f /* Save VMX state to last_task_used_altivec's THREAD struct */ addi r4,r4,THREAD @@ -1712,8 +1658,8 @@ _STATIC(load_up_altivec) /* Disable VMX for last_task_used_altivec */ ld r5,PT_REGS(r4) ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - lis r20,MSR_VEC@h - andc r4,r4,r20 + lis r6,MSR_VEC@h + andc r4,r4,r6 std r4,_MSR-STACK_FRAME_OVERHEAD(r5) 1: #endif /* CONFIG_SMP */ @@ -1723,7 +1669,7 @@ _STATIC(load_up_altivec) * all 1's */ mfspr r4,SPRN_VRSAVE - cmpi 0,r4,0 + cmpdi 0,r4,0 bne+ 1f li r4,-1 mtspr SPRN_VRSAVE,r4 @@ -1731,7 +1677,8 @@ _STATIC(load_up_altivec) /* enable use of VMX after return */ ld r4,PACACURRENT(r13) addi r5,r4,THREAD /* Get THREAD */ - oris r23,r23,MSR_VEC@h + oris r12,r12,MSR_VEC@h + std r12,_MSR(r1) li r4,1 li r10,THREAD_VSCR stw r4,THREAD_USED_VR(r5) @@ -1740,7 +1687,7 @@ _STATIC(load_up_altivec) #ifndef CONFIG_SMP /* Update last_task_used_math to 'current' */ subi r4,r5,THREAD /* Back to 'current' */ - std r4,last_task_used_altivec@l(r3) + std r4,0(r3) #endif /* CONFIG_SMP */ /* restore registers and return */ b fast_exception_return @@ -1768,11 +1715,11 @@ _GLOBAL(giveup_altivec) oris r5,r5,MSR_VEC@h mtmsrd r5 /* enable use of VMX now */ isync - cmpi 0,r3,0 + cmpdi 0,r3,0 beqlr- /* if no previous owner, done */ addi r3,r3,THREAD /* want THREAD of task */ ld r5,PT_REGS(r3) - cmpi 0,r5,0 + cmpdi 0,r5,0 SAVE_32VRS(0,r4,r3) mfvscr vr0 li r4,THREAD_VSCR @@ -1785,8 +1732,8 @@ _GLOBAL(giveup_altivec) 1: #ifndef CONFIG_SMP li r5,0 - LOADBASE(r4,last_task_used_altivec) - std r5,last_task_used_altivec@l(r4) + ld r4,last_task_used_altivec@got(r2) + std r5,0(r4) #endif /* CONFIG_SMP */ blr @@ -1885,8 +1832,9 @@ _GLOBAL(__secondary_start) LOADADDR(r3,current_set) sldi r28,r24,3 /* get current_set[cpu#] */ ldx r1,r3,r28 - addi r1,r1,THREAD_SIZE - subi r1,r1,STACK_FRAME_OVERHEAD + addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD + li r0,0 + std r0,0(r1) std r1,PACAKSAVE(r13) ld r3,PACASTABREAL(r13) /* get raddr of segment table */ @@ -1943,7 +1891,7 @@ _GLOBAL(start_secondary_prolog) #endif /* - * This subroutine clobbers r11, r12 and the LR + * This subroutine clobbers r11 and r12 */ _GLOBAL(enable_64b_mode) mfmsr r11 /* grab the current MSR */ @@ -2144,7 +2092,6 @@ _STATIC(start_here_common) std r4,PACACURRENT(r13) std r2,PACATOC(r13) - li r5,0 std r1,PACAKSAVE(r13) /* Restore the parms passed in from the bootloader. */ diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c index 3f17d5e25..a3549809a 100644 --- a/arch/ppc64/kernel/iSeries_setup.c +++ b/arch/ppc64/kernel/iSeries_setup.c @@ -357,15 +357,14 @@ void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5, HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256, HvLpDma_Direction_RemoteToLocal); - p = q = cmd_line + 255; - while (p > cmd_line) { - if ((*p == 0) || (*p == ' ') || (*p == '\n')) - --p; - else + p = cmd_line; + q = cmd_line + 255; + while( p < q ) { + if (!*p || *p == '\n') break; + ++p; } - if (p < q) - *(p + 1) = 0; + *p = 0; if (strstr(cmd_line, "dprofile=")) { for (q = cmd_line; (p = strstr(q, "dprofile=")) != 0; ) { diff --git a/arch/ppc64/kernel/init_task.c b/arch/ppc64/kernel/init_task.c index 38cb7aeb1..941043ae0 100644 --- a/arch/ppc64/kernel/init_task.c +++ b/arch/ppc64/kernel/init_task.c @@ -4,6 +4,7 @@ #include #include #include +#include #include static struct fs_struct init_fs = INIT_FS; diff --git a/arch/ppc64/kernel/mf_proc.c b/arch/ppc64/kernel/mf_proc.c index 5d48ce84a..3ac36a5b9 100644 --- a/arch/ppc64/kernel/mf_proc.c +++ b/arch/ppc64/kernel/mf_proc.c @@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off, { int len = count; char *p; - + + if (off) { + *eof = 1; + return 0; + } + len = mf_getCmdLine(page, &len, (u64)data); - p = page + len - 1; - while (p > page) { - if ((*p == 0) || (*p == ' ')) - --p; - else + p = page; + while (len < (count - 1)) { + if (!*p || *p == '\n') break; + p++; + len++; } - if (*p != '\n') { - ++p; - *p = '\n'; - } - ++p; + *p = '\n'; + p++; *p = 0; - len = p - page; - - len -= off; - if (len < count) { - *eof = 1; - if (len <= 0) - return 0; - } else - len = count; - *start = page + off; - return len; + + return p - page; } #if 0 diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S index 3cdd1a097..e0417edab 100644 --- a/arch/ppc64/kernel/misc.S +++ b/arch/ppc64/kernel/misc.S @@ -85,16 +85,17 @@ _GLOBAL(local_irq_restore) cmpw 0,r3,r5 beqlr /* are we enabling interrupts? */ - cmpi 0,r3,0 + cmpdi 0,r3,0 stb r3,PACAPROCENABLED(r13) beqlr /* Check pending interrupts */ /* A decrementer, IPI or PMC interrupt may have occurred * while we were in the hypervisor (which enables) */ - CHECKANYINT(r4,r5) + ld r4,PACALPPACA+LPPACAANYINT(r13) + cmpdi r4,0 beqlr - /* + /* * Handle pending interrupts in interrupt context */ li r0,0x5555 @@ -608,7 +609,7 @@ _GLOBAL(kernel_thread) _GLOBAL(sys_call_table32) .llong .sys_restart_syscall /* 0 */ .llong .sys_exit - .llong .sys_fork + .llong .ppc_fork .llong .sys_read .llong .sys_write .llong .sys32_open /* 5 */ @@ -678,7 +679,7 @@ _GLOBAL(sys_call_table32) .llong .sys32_ssetmask .llong .sys_setreuid /* 70 */ .llong .sys_setregid - .llong .sys32_sigsuspend + .llong .ppc32_sigsuspend .llong .compat_sys_sigpending .llong .sys32_sethostname .llong .compat_sys_setrlimit /* 75 */ @@ -726,7 +727,7 @@ _GLOBAL(sys_call_table32) .llong .sys32_ipc .llong .sys_fsync .llong .ppc32_sigreturn - .llong .sys_clone /* 120 */ + .llong .ppc_clone /* 120 */ .llong .sys32_setdomainname .llong .ppc64_newuname .llong .sys_ni_syscall /* old modify_ldt syscall */ @@ -784,7 +785,7 @@ _GLOBAL(sys_call_table32) .llong .sys32_rt_sigpending /* 175 */ .llong .sys32_rt_sigtimedwait .llong .sys32_rt_sigqueueinfo - .llong .sys32_rt_sigsuspend + .llong .ppc32_rt_sigsuspend .llong .sys32_pread64 .llong .sys32_pwrite64 /* 180 */ .llong .sys_chown @@ -795,7 +796,7 @@ _GLOBAL(sys_call_table32) .llong .sys32_sendfile .llong .sys_ni_syscall /* reserved for streams1 */ .llong .sys_ni_syscall /* reserved for streams2 */ - .llong .sys_vfork + .llong .ppc_vfork .llong .compat_sys_getrlimit /* 190 */ .llong .sys32_readahead .llong .sys32_mmap2 @@ -888,7 +889,7 @@ _GLOBAL(sys_call_table32) _GLOBAL(sys_call_table) .llong .sys_restart_syscall /* 0 */ .llong .sys_exit - .llong .sys_fork + .llong .ppc_fork .llong .sys_read .llong .sys_write .llong .sys_open /* 5 */ @@ -1006,7 +1007,7 @@ _GLOBAL(sys_call_table) .llong .sys_ipc .llong .sys_fsync .llong .sys_ni_syscall - .llong .sys_clone /* 120 */ + .llong .ppc_clone /* 120 */ .llong .sys_setdomainname .llong .ppc64_newuname .llong .sys_ni_syscall /* old modify_ldt syscall */ @@ -1064,7 +1065,7 @@ _GLOBAL(sys_call_table) .llong .sys_rt_sigpending /* 175 */ .llong .sys_rt_sigtimedwait .llong .sys_rt_sigqueueinfo - .llong .sys_rt_sigsuspend + .llong .ppc64_rt_sigsuspend .llong .sys_pread64 .llong .sys_pwrite64 /* 180 */ .llong .sys_chown @@ -1075,7 +1076,7 @@ _GLOBAL(sys_call_table) .llong .sys_sendfile64 .llong .sys_ni_syscall /* reserved for streams1 */ .llong .sys_ni_syscall /* reserved for streams2 */ - .llong .sys_vfork + .llong .ppc_vfork .llong .sys_getrlimit /* 190 */ .llong .sys_readahead .llong .sys_ni_syscall /* 32bit only mmap2 */ diff --git a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c index d283f4897..2cf631bb8 100644 --- a/arch/ppc64/kernel/pacaData.c +++ b/arch/ppc64/kernel/pacaData.c @@ -62,8 +62,6 @@ struct systemcfg *systemcfg; .xDesc = 0xd397d9e2, /* "LpRS" */ \ .xSize = sizeof(struct ItLpRegSave) \ }, \ - .exception_sp = \ - (&paca[number].exception_stack[0]) - EXC_FRAME_SIZE, \ } struct paca_struct paca[] __page_aligned = { diff --git a/arch/ppc64/kernel/pmac_feature.c b/arch/ppc64/kernel/pmac_feature.c index dbc94842d..c059a7608 100644 --- a/arch/ppc64/kernel/pmac_feature.c +++ b/arch/ppc64/kernel/pmac_feature.c @@ -343,6 +343,10 @@ static struct pmac_mb_def pmac_mb_defs[] __pmacdata = { PMAC_TYPE_POWERMAC_G5, g5_features, 0, }, + { "RackMac3,1", "XServe G5", + PMAC_TYPE_POWERMAC_G5, g5_features, + 0, + }, }; /* diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index be153b959..5acc56729 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c @@ -65,8 +65,43 @@ struct mm_struct ioremap_mm = { .page_table_lock = SPIN_LOCK_UNLOCKED, }; +/* + * Make sure the floating-point register state in the + * the thread_struct is up to date for task tsk. + */ +void flush_fp_to_thread(struct task_struct *tsk) +{ + if (tsk->thread.regs) { + /* + * We need to disable preemption here because if we didn't, + * another process could get scheduled after the regs->msr + * test but before we have finished saving the FP registers + * to the thread_struct. That process could take over the + * FPU, and then when we get scheduled again we would store + * bogus values for the remaining FP registers. + */ + preempt_disable(); + if (tsk->thread.regs->msr & MSR_FP) { +#ifdef CONFIG_SMP + /* + * This should only ever be called for current or + * for a stopped child process. Since we save away + * the FP register state on context switch on SMP, + * there is something wrong if a stopped child appears + * to still have its FP state in the CPU registers. + */ + BUG_ON(tsk != current); +#endif + giveup_fpu(current); + } + preempt_enable(); + } +} + void enable_kernel_fp(void) { + WARN_ON(preemptible()); + #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) giveup_fpu(current); @@ -80,12 +115,9 @@ EXPORT_SYMBOL(enable_kernel_fp); int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) { - struct pt_regs *regs = tsk->thread.regs; - - if (!regs) + if (!tsk->thread.regs) return 0; - if (tsk == current && (regs->msr & MSR_FP)) - giveup_fpu(current); + flush_fp_to_thread(current); memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs)); @@ -96,6 +128,8 @@ int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) void enable_kernel_altivec(void) { + WARN_ON(preemptible()); + #ifdef CONFIG_SMP if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) giveup_altivec(current); @@ -107,10 +141,29 @@ void enable_kernel_altivec(void) } EXPORT_SYMBOL(enable_kernel_altivec); +/* + * Make sure the VMX/Altivec register state in the + * the thread_struct is up to date for task tsk. + */ +void flush_altivec_to_thread(struct task_struct *tsk) +{ +#ifdef CONFIG_ALTIVEC + if (tsk->thread.regs) { + preempt_disable(); + if (tsk->thread.regs->msr & MSR_VEC) { +#ifdef CONFIG_SMP + BUG_ON(tsk != current); +#endif + giveup_altivec(current); + } + preempt_enable(); + } +#endif +} + int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) { - if (regs->msr & MSR_VEC) - giveup_altivec(current); + flush_altivec_to_thread(current); memcpy(vrregs, ¤t->thread.vr[0], sizeof(*vrregs)); return 1; } @@ -166,6 +219,7 @@ struct task_struct *__switch_to(struct task_struct *prev, void show_regs(struct pt_regs * regs) { int i; + unsigned long trap; printk("NIP: %016lX XER: %016lX LR: %016lX\n", regs->nip, regs->xer, regs->link); @@ -176,7 +230,8 @@ void show_regs(struct pt_regs * regs) regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0, regs->msr&MSR_IR ? 1 : 0, regs->msr&MSR_DR ? 1 : 0); - if (regs->trap == 0x300 || regs->trap == 0x380 || regs->trap == 0x600) + trap = TRAP(regs); + if (trap == 0x300 || trap == 0x380 || trap == 0x600) printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr); printk("TASK: %p[%d] '%s' THREAD: %p", current, current->pid, current->comm, current->thread_info); @@ -191,6 +246,8 @@ void show_regs(struct pt_regs * regs) } printk("%016lX ", regs->gpr[i]); + if (i == 13 && !FULL_REGS(regs)) + break; } printk("\n"); /* @@ -245,16 +302,8 @@ release_thread(struct task_struct *t) */ void prepare_to_copy(struct task_struct *tsk) { - struct pt_regs *regs = tsk->thread.regs; - - if (regs == NULL) - return; - if (regs->msr & MSR_FP) - giveup_fpu(current); -#ifdef CONFIG_ALTIVEC - if (regs->msr & MSR_VEC) - giveup_altivec(current); -#endif /* CONFIG_ALTIVEC */ + flush_fp_to_thread(current); + flush_altivec_to_thread(current); } /* @@ -439,12 +488,8 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - if (regs->msr & MSR_FP) - giveup_fpu(current); -#ifdef CONFIG_ALTIVEC - if (regs->msr & MSR_VEC) - giveup_altivec(current); -#endif /* CONFIG_ALTIVEC */ + flush_fp_to_thread(current); + flush_altivec_to_thread(current); error = do_execve(filename, (char __user * __user *) a1, (char __user * __user *) a2, regs); diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index efc9dbd3b..aeead8375 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c @@ -119,8 +119,7 @@ int sys_ptrace(long request, long pid, long addr, long data) if (index < PT_FPR0) { tmp = get_reg(child, (int)index); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0]; } ret = put_user(tmp,(unsigned long __user *) data); @@ -152,8 +151,7 @@ int sys_ptrace(long request, long pid, long addr, long data) if (index < PT_FPR0) { ret = put_reg(child, index, data); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); ((unsigned long *)child->thread.fpr)[index - PT_FPR0] = data; ret = 0; } @@ -245,8 +243,7 @@ int sys_ptrace(long request, long pid, long addr, long data) unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; unsigned long __user *tmp = (unsigned long __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -263,8 +260,7 @@ int sys_ptrace(long request, long pid, long addr, long data) unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; unsigned long __user *tmp = (unsigned long __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp); diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c index 309db1c08..3484e4804 100644 --- a/arch/ppc64/kernel/ptrace32.c +++ b/arch/ppc64/kernel/ptrace32.c @@ -136,8 +136,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) if (index < PT_FPR0) { tmp = get_reg(child, index); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); /* * the user space code considers the floating point * to be an array of unsigned int (32 bits) - the @@ -179,8 +178,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) break; if (numReg >= PT_FPR0) { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0]; } else { /* register within PT_REGS struct */ tmp = get_reg(child, numReg); @@ -244,8 +242,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) if (index < PT_FPR0) { ret = put_reg(child, index, data); } else { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); /* * the user space code considers the floating point * to be an array of unsigned int (32 bits) - the @@ -283,8 +280,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) || ((numReg > PT_CCR) && (numReg < PT_FPR0))) break; if (numReg >= PT_FPR0) { - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); } if (numReg == PT_MSR) data = (data & MSR_DEBUGCHANGE) @@ -379,8 +375,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; unsigned int __user *tmp = (unsigned int __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = put_user(*reg, tmp); @@ -397,8 +392,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) unsigned long *reg = &((unsigned long *)child->thread.fpr)[0]; unsigned int __user *tmp = (unsigned int __user *)addr; - if (child->thread.regs->msr & MSR_FP) - giveup_fpu(child); + flush_fp_to_thread(child); for (i = 0; i < 32; i++) { ret = get_user(*reg, tmp); diff --git a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c index 603c9db19..77c24004e 100644 --- a/arch/ppc64/kernel/rtas.c +++ b/arch/ppc64/kernel/rtas.c @@ -70,10 +70,11 @@ char rtas_data_buf[RTAS_DATA_BUF_SIZE]__page_aligned; void call_rtas_display_status(char c) { - struct rtas_args *args = &(get_paca()->xRtas); + struct rtas_args *args; unsigned long s; spin_lock_irqsave(&rtas.lock, s); + args = &(get_paca()->xRtas); args->token = 10; args->nargs = 1; @@ -147,7 +148,7 @@ rtas_call(int token, int nargs, int nret, va_list list; int i, logit = 0; unsigned long s; - struct rtas_args *rtas_args = &(get_paca()->xRtas); + struct rtas_args *rtas_args; long ret; PPCDBG(PPCDBG_RTAS, "Entering rtas_call\n"); @@ -160,6 +161,7 @@ rtas_call(int token, int nargs, int nret, /* Gotta do something different here, use global lock for now... */ spin_lock_irqsave(&rtas.lock, s); + rtas_args = &(get_paca()->xRtas); rtas_args->token = token; rtas_args->nargs = nargs; diff --git a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c index ce066788c..8323d7355 100644 --- a/arch/ppc64/kernel/signal.c +++ b/arch/ppc64/kernel/signal.c @@ -131,8 +131,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, #endif long err = 0; - if (regs->msr & MSR_FP) - giveup_fpu(current); + flush_fp_to_thread(current); /* Make sure signal doesn't get spurrious FP exceptions */ current->thread.fpscr = 0; @@ -141,9 +140,8 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, err |= __put_user(v_regs, &sc->v_regs); /* save altivec registers */ - if (current->thread.used_vr) { - if (regs->msr & MSR_VEC) - giveup_altivec(current); + if (current->thread.used_vr) { + flush_altivec_to_thread(current); /* Copy 33 vec registers (vr0..31 and vscr) to the stack */ err |= __copy_to_user(v_regs, current->thread.vr, 33 * sizeof(vector128)); /* set MSR_VEC in the MSR value in the frame to indicate that sc->v_reg) @@ -530,13 +528,13 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) struct k_sigaction *ka = ¤t->sighand->action[signr-1]; /* Whee! Actually deliver the signal. */ - if (regs->trap == 0x0C00) + if (TRAP(regs) == 0x0C00) syscall_restart(regs, ka); handle_signal(signr, ka, &info, oldset, regs); return 1; } - if (regs->trap == 0x0C00) { /* System Call! */ + if (TRAP(regs) == 0x0C00) { /* System Call! */ if ((int)regs->result == -ERESTARTNOHAND || (int)regs->result == -ERESTARTSYS || (int)regs->result == -ERESTARTNOINTR) { diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c index c8f6294a2..ba2c8f7c3 100644 --- a/arch/ppc64/kernel/signal32.c +++ b/arch/ppc64/kernel/signal32.c @@ -130,11 +130,10 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext32 __user *frame, { elf_greg_t64 *gregs = (elf_greg_t64 *)regs; int i, err = 0; - - /* Make sure floating point registers are stored in regs */ - if (regs->msr & MSR_FP) - giveup_fpu(current); - + + /* Make sure floating point registers are stored in regs */ + flush_fp_to_thread(current); + /* save general and floating-point registers */ for (i = 0; i <= PT_RESULT; i ++) err |= __put_user((unsigned int)gregs[i], &frame->mc_gregs[i]); @@ -148,8 +147,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext32 __user *frame, #ifdef CONFIG_ALTIVEC /* save altivec registers */ if (current->thread.used_vr) { - if (regs->msr & MSR_VEC) - giveup_altivec(current); + flush_altivec_to_thread(current); if (__copy_to_user(&frame->mc_vregs, current->thread.vr, ELF_NVRREG32 * sizeof(vector128))) return 1; @@ -934,7 +932,7 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs) ka = (signr == 0)? NULL: ¤t->sighand->action[signr-1]; - if (regs->trap == 0x0C00 /* System Call! */ + if (TRAP(regs) == 0x0C00 /* System Call! */ && regs->ccr & 0x10000000 /* error signalled */ && ((ret = regs->gpr[3]) == ERESTARTSYS || ret == ERESTARTNOHAND || ret == ERESTARTNOINTR diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c index ae52b2050..662437514 100644 --- a/arch/ppc64/kernel/smp.c +++ b/arch/ppc64/kernel/smp.c @@ -390,8 +390,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) } /* Fixup atomic count: it exited inside IRQ handler. */ - ((struct task_struct *)paca[lcpu].xCurrent)->thread_info->preempt_count - = 0; + paca[lcpu].xCurrent->thread_info->preempt_count = 0; /* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */ paca[lcpu].xStab_data.next_round_robin = 0; @@ -819,7 +818,7 @@ static void __init smp_create_idle(unsigned int cpu) init_idle(p, cpu); unhash_process(p); - paca[cpu].xCurrent = (u64)p; + paca[cpu].xCurrent = p; current_set[cpu] = p->thread_info; } @@ -871,7 +870,7 @@ void __devinit smp_prepare_boot_cpu(void) /* cpu_possible is set up in prom.c */ cpu_set(boot_cpuid, cpu_online_map); - paca[boot_cpuid].xCurrent = (u64)current; + paca[boot_cpuid].xCurrent = current; current_set[boot_cpuid] = current->thread_info; } @@ -914,8 +913,20 @@ int __devinit __cpu_up(unsigned int cpu) * use this value that I found through experimentation. * -- Cort */ - for (c = 5000; c && !cpu_callin_map[cpu]; c--) - udelay(100); + if (system_state == SYSTEM_BOOTING) + for (c = 5000; c && !cpu_callin_map[cpu]; c--) + udelay(100); +#ifdef CONFIG_HOTPLUG_CPU + else + /* + * CPUs can take much longer to come up in the + * hotplug case. Wait five seconds. + */ + for (c = 25; c && !cpu_callin_map[cpu]; c--) { + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(HZ/5); + } +#endif if (!cpu_callin_map[cpu]) { printk("Processor %u is stuck.\n", cpu); diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c index ca8014224..26e5e8dd9 100644 --- a/arch/ppc64/kernel/sys_ppc32.c +++ b/arch/ppc64/kernel/sys_ppc32.c @@ -617,12 +617,8 @@ long sys32_execve(unsigned long a0, unsigned long a1, unsigned long a2, error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - if (regs->msr & MSR_FP) - giveup_fpu(current); -#ifdef CONFIG_ALTIVEC - if (regs->msr & MSR_VEC) - giveup_altivec(current); -#endif /* CONFIG_ALTIVEC */ + flush_fp_to_thread(current); + flush_altivec_to_thread(current); error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); diff --git a/arch/ppc64/kernel/syscalls.c b/arch/ppc64/kernel/syscalls.c index 4ae0825ee..930b93f3c 100644 --- a/arch/ppc64/kernel/syscalls.c +++ b/arch/ppc64/kernel/syscalls.c @@ -237,5 +237,19 @@ asmlinkage time_t sys64_time(time_t __user * tloc) return secs; } +void do_show_syscall(unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, unsigned long r7, unsigned long r8, + struct pt_regs *regs) +{ + printk("syscall %ld(%lx, %lx, %lx, %lx, %lx, %lx) regs=%p current=%p" + " cpu=%d\n", regs->gpr[0], r3, r4, r5, r6, r7, r8, regs, + current, smp_processor_id()); +} + +void do_show_syscall_exit(unsigned long r3) +{ + printk(" -> %lx, current=%p cpu=%d\n", r3, current, smp_processor_id()); +} + /* Only exists on P-series. */ cond_syscall(ppc_rtas); diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c index 244550256..97a83ff75 100644 --- a/arch/ppc64/kernel/sysfs.c +++ b/arch/ppc64/kernel/sysfs.c @@ -328,6 +328,16 @@ static int __init topology_init(void) #ifdef CONFIG_NUMA parent = &node_devices[cpu_to_node(cpu)]; #endif + /* + * For now, we just see if the system supports making + * the RTAS calls for CPU hotplug. But, there may be a + * more comprehensive way to do this for an individual + * CPU. For instance, the boot cpu might never be valid + * for hotplugging. + */ + if (systemcfg->platform != PLATFORM_PSERIES_LPAR) + c->no_control = 1; + register_cpu(c, cpu, parent); register_cpu_pmc(&c->sysdev); diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c index 7c1594d0c..593319735 100644 --- a/arch/ppc64/kernel/traps.c +++ b/arch/ppc64/kernel/traps.c @@ -308,8 +308,7 @@ static void parse_fpe(struct pt_regs *regs) siginfo_t info; unsigned long fpscr; - if (regs->msr & MSR_FP) - giveup_fpu(current); + flush_fp_to_thread(current); fpscr = current->thread.fpscr; @@ -442,8 +441,22 @@ void KernelFPUnavailableException(struct pt_regs *regs) die("Unrecoverable FP Unavailable Exception", regs, SIGABRT); } -void KernelAltivecUnavailableException(struct pt_regs *regs) +void AltivecUnavailableException(struct pt_regs *regs) { +#ifndef CONFIG_ALTIVEC + if (user_mode(regs)) { + /* A user program has executed an altivec instruction, + but this kernel doesn't support altivec. */ + siginfo_t info; + + memset(&info, 0, sizeof(info)); + info.si_signo = SIGILL; + info.si_code = ILL_ILLOPC; + info.si_addr = (void *) regs->nip; + _exception(SIGILL, &info, regs); + return; + } +#endif printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception " "%lx at %lx\n", regs->trap, regs->nip); die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); @@ -466,6 +479,18 @@ SingleStepException(struct pt_regs *regs) _exception(SIGTRAP, &info, regs); } +/* + * After we have successfully emulated an instruction, we have to + * check if the instruction was being single-stepped, and if so, + * pretend we got a single-step exception. This was pointed out + * by Kumar Gala. -- paulus + */ +static inline void emulate_single_step(struct pt_regs *regs) +{ + if (regs->msr & MSR_SE) + SingleStepException(regs); +} + static void dummy_perf(struct pt_regs *regs) { } @@ -487,10 +512,8 @@ AlignmentException(struct pt_regs *regs) fixed = fix_alignment(regs); if (fixed == 1) { - if (!user_mode(regs)) - PPCDBG(PPCDBG_ALIGNFIXUP, "fix alignment at %lx\n", - regs->nip); regs->nip += 4; /* skip over emulated instruction */ + emulate_single_step(regs); return; } @@ -521,8 +544,7 @@ AlignmentException(struct pt_regs *regs) void AltivecAssistException(struct pt_regs *regs) { - if (regs->msr & MSR_VEC) - giveup_altivec(current); + flush_altivec_to_thread(current); /* XXX quick hack for now: set the non-Java bit in the VSCR */ current->thread.vscr.u[3] |= 0x10000; } diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index ce758a3c6..78b05df91 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c @@ -32,7 +32,9 @@ extern struct subsystem devices_subsys; /* needed for vio_find_name() */ -struct iommu_table *vio_build_iommu_table(struct vio_dev *dev); +static struct iommu_table *vio_build_iommu_table(struct vio_dev *); +static const struct vio_device_id *vio_match_device( + const struct vio_device_id *, const struct vio_dev *); #ifdef CONFIG_PPC_PSERIES static int vio_num_address_cells; @@ -136,15 +138,15 @@ EXPORT_SYMBOL(vio_unregister_driver); * system is in its list of supported devices. Returns the matching * vio_device_id structure or NULL if there is no match. */ -const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, +static const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, const struct vio_dev *dev) { DBGENTER(); #ifdef CONFIG_PPC_PSERIES while (ids->type) { - if ((strncmp(dev->archdata->type, ids->type, strlen(ids->type)) == 0) && - device_is_compatible((struct device_node*)dev->archdata, ids->compat)) + if ((strncmp(((struct device_node *)dev->dev.platform_data)->type, ids->type, strlen(ids->type)) == 0) && + device_is_compatible(dev->dev.platform_data, ids->compat)) return ids; ids++; } @@ -263,14 +265,13 @@ static void __devinit vio_dev_release(struct device *dev) DBGENTER(); /* XXX free TCE table */ - of_node_put(viodev->archdata); + of_node_put(viodev->dev.platform_data); kfree(viodev); } static ssize_t viodev_show_devspec(struct device *dev, char *buf) { - struct vio_dev *viodev = to_vio_dev(dev); - struct device_node *of_node = viodev->archdata; + struct device_node *of_node = dev->platform_data; return sprintf(buf, "%s\n", of_node->full_name); } @@ -278,8 +279,7 @@ DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL); static ssize_t viodev_show_name(struct device *dev, char *buf) { - struct vio_dev *viodev = to_vio_dev(dev); - struct device_node *of_node = viodev->archdata; + struct device_node *of_node = dev->platform_data; return sprintf(buf, "%s\n", of_node->name); } @@ -290,7 +290,7 @@ DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL); * @of_node: The OF node for this device. * * Creates and initializes a vio_dev structure from the data in - * of_node (archdata) and adds it to the list of virtual devices. + * of_node (dev.platform_data) and adds it to the list of virtual devices. * Returns a pointer to the created vio_dev or NULL if node has * NULL device_type or compatible fields. */ @@ -324,7 +324,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node) } memset(viodev, 0, sizeof(struct vio_dev)); - viodev->archdata = (void *)of_node_get(of_node); + viodev->dev.platform_data = of_node_get(of_node); viodev->unit_address = *unit_address; viodev->iommu_table = vio_build_iommu_table(viodev); @@ -380,7 +380,7 @@ EXPORT_SYMBOL(vio_unregister_device); */ const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length) { - return get_property((struct device_node *)vdev->archdata, (char*)which, length); + return get_property(vdev->dev.platform_data, (char*)which, length); } EXPORT_SYMBOL(vio_get_attribute); @@ -427,7 +427,7 @@ EXPORT_SYMBOL(vio_find_node); * Returns a pointer to the built tce tree, or NULL if it can't * find property. */ -struct iommu_table * vio_build_iommu_table(struct vio_dev *dev) +static struct iommu_table * vio_build_iommu_table(struct vio_dev *dev) { unsigned int *dma_window; struct iommu_table *newTceTable; @@ -435,7 +435,7 @@ struct iommu_table * vio_build_iommu_table(struct vio_dev *dev) unsigned long size; int dma_window_property_size; - dma_window = (unsigned int *) get_property((struct device_node *)dev->archdata, "ibm,my-dma-window", &dma_window_property_size); + dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size); if(!dma_window) { return NULL; } diff --git a/arch/ppc64/kernel/viopath.c b/arch/ppc64/kernel/viopath.c index f0cb2d70a..3fbdd00d3 100644 --- a/arch/ppc64/kernel/viopath.c +++ b/arch/ppc64/kernel/viopath.c @@ -191,7 +191,6 @@ static int proc_viopath_show(struct seq_file *m, void *v) { char *buf; u16 vlanMap; - int vlanIndex; dma_addr_t handle; HvLpEvent_Rc hvrc; DECLARE_MUTEX_LOCKED(Semaphore); @@ -219,17 +218,10 @@ static int proc_viopath_show(struct seq_file *m, void *v) down(&Semaphore); vlanMap = HvLpConfig_getVirtualLanIndexMap(); - vlanIndex = 0; - while (vlanMap != 0){ - if (vlanMap & 0x8000) - vlanIndex++;; - vlanMap = vlanMap << 1; - } buf[PAGE_SIZE-1] = '\0'; seq_printf(m, "%s", buf); - - seq_printf(m, "AVAILABLE_VETH=%d\n", vlanIndex ); + seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n", e2a(xItExtVpdPanel.mfgID[2]), e2a(xItExtVpdPanel.mfgID[3]), diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c index ca2b86d56..72eba98f4 100644 --- a/arch/ppc64/mm/fault.c +++ b/arch/ppc64/mm/fault.c @@ -80,36 +80,45 @@ static int store_updates_sp(struct pt_regs *regs) * - DSISR for a non-SLB data access fault, * - SRR1 & 0x08000000 for a non-SLB instruction access fault * - 0 any SLB fault. + * The return value is 0 if the fault was handled, or the signal + * number if this is a kernel fault that can't be handled here. */ -void do_page_fault(struct pt_regs *regs, unsigned long address, - unsigned long error_code) +int do_page_fault(struct pt_regs *regs, unsigned long address, + unsigned long error_code) { struct vm_area_struct * vma; struct mm_struct *mm = current->mm; siginfo_t info; unsigned long code = SEGV_MAPERR; unsigned long is_write = error_code & 0x02000000; + unsigned long trap = TRAP(regs); - if (regs->trap == 0x300 || regs->trap == 0x380) { + if (trap == 0x300 || trap == 0x380) { if (debugger_fault_handler(regs)) - return; + return 0; } /* On a kernel SLB miss we can only check for a valid exception entry */ - if (!user_mode(regs) && (regs->trap == 0x380)) { - bad_page_fault(regs, address, SIGSEGV); - return; - } + if (!user_mode(regs) && (trap == 0x380 || address >= TASK_SIZE)) + return SIGSEGV; if (error_code & 0x00400000) { if (debugger_dabr_match(regs)) - return; + return 0; } if (in_atomic() || mm == NULL) { - bad_page_fault(regs, address, SIGSEGV); - return; + if (!user_mode(regs)) + return SIGSEGV; + /* in_atomic() in user mode is really bad, + as is current->mm == NULL. */ + printk(KERN_EMERG "Page fault in user mode with" + "in_atomic() = %d mm = %p\n", in_atomic(), mm); + printk(KERN_EMERG "NIP = %lx MSR = %lx\n", + regs->nip, regs->msr); + die("Weird page fault", regs, SIGSEGV); } + down_read(&mm->mmap_sem); vma = find_vma(mm, address); if (!vma) @@ -195,7 +204,7 @@ good_area: } up_read(&mm->mmap_sem); - return; + return 0; bad_area: up_read(&mm->mmap_sem); @@ -207,11 +216,10 @@ bad_area: info.si_code = code; info.si_addr = (void *) address; force_sig_info(SIGSEGV, &info, current); - return; + return 0; } - bad_page_fault(regs, address, SIGSEGV); - return; + return SIGSEGV; /* * We ran out of memory, or some other thing happened to us that made @@ -227,18 +235,19 @@ out_of_memory: printk("VM: killing process %s\n", current->comm); if (user_mode(regs)) do_exit(SIGKILL); - bad_page_fault(regs, address, SIGKILL); - return; + return SIGKILL; do_sigbus: up_read(&mm->mmap_sem); - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void *)address; - force_sig_info (SIGBUS, &info, current); - if (!user_mode(regs)) - bad_page_fault(regs, address, SIGBUS); + if (user_mode(regs)) { + info.si_signo = SIGBUS; + info.si_errno = 0; + info.si_code = BUS_ADRERR; + info.si_addr = (void *)address; + force_sig_info(SIGBUS, &info, current); + return 0; + } + return SIGBUS; } /* diff --git a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c index 1df6d97e2..4e6b5299f 100644 --- a/arch/ppc64/mm/hash_utils.c +++ b/arch/ppc64/mm/hash_utils.c @@ -251,6 +251,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap) struct mm_struct *mm; pte_t *ptep; int ret; + int cpu; int user_region = 0; int local = 0; cpumask_t tmp; @@ -302,7 +303,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap) if (pgdir == NULL) return 1; - tmp = cpumask_of_cpu(smp_processor_id()); + cpu = get_cpu(); + tmp = cpumask_of_cpu(cpu); if (user_region && cpus_equal(mm->cpu_vm_mask, tmp)) local = 1; @@ -311,11 +313,13 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap) ret = hash_huge_page(mm, access, ea, vsid, local); else { ptep = find_linux_pte(pgdir, ea); - if (ptep == NULL) + if (ptep == NULL) { + put_cpu(); return 1; + } ret = __hash_page(ea, access, vsid, ptep, trap, local); } - + put_cpu(); return ret; } diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c index d660b0d28..b704e00d2 100644 --- a/arch/ppc64/mm/hugetlbpage.c +++ b/arch/ppc64/mm/hugetlbpage.c @@ -375,6 +375,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long addr; hugepte_t *ptep; struct page *page; + int cpu; int local = 0; cpumask_t tmp; @@ -383,7 +384,8 @@ void unmap_hugepage_range(struct vm_area_struct *vma, BUG_ON((end % HPAGE_SIZE) != 0); /* XXX are there races with checking cpu_vm_mask? - Anton */ - tmp = cpumask_of_cpu(smp_processor_id()); + cpu = get_cpu(); + tmp = cpumask_of_cpu(cpu); if (cpus_equal(vma->vm_mm->cpu_vm_mask, tmp)) local = 1; @@ -406,6 +408,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, put_page(page); } + put_cpu(); mm->rss -= (end - start) >> PAGE_SHIFT; } diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c index 84ceb2db2..5043702a4 100644 --- a/arch/ppc64/mm/init.c +++ b/arch/ppc64/mm/init.c @@ -764,6 +764,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea, void *pgdir; pte_t *ptep; int local = 0; + int cpu; cpumask_t tmp; /* handle i-cache coherency */ @@ -794,12 +795,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea, vsid = get_vsid(vma->vm_mm->context.id, ea); - tmp = cpumask_of_cpu(smp_processor_id()); + cpu = get_cpu(); + tmp = cpumask_of_cpu(cpu); if (cpus_equal(vma->vm_mm->cpu_vm_mask, tmp)) local = 1; __hash_page(ea, pte_val(pte) & (_PAGE_USER|_PAGE_RW), vsid, ptep, 0x300, local); + put_cpu(); } void * reserve_phb_iospace(unsigned long size) diff --git a/arch/ppc64/mm/tlb.c b/arch/ppc64/mm/tlb.c index b616f9a40..980443beb 100644 --- a/arch/ppc64/mm/tlb.c +++ b/arch/ppc64/mm/tlb.c @@ -41,6 +41,33 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); unsigned long pte_freelist_forced_free; +void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage) +{ + /* This is safe as we are holding page_table_lock */ + cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id()); + struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); + + if (atomic_read(&tlb->mm->mm_users) < 2 || + cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) { + pte_free(ptepage); + return; + } + + if (*batchp == NULL) { + *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC); + if (*batchp == NULL) { + pte_free_now(ptepage); + return; + } + (*batchp)->index = 0; + } + (*batchp)->pages[(*batchp)->index++] = ptepage; + if ((*batchp)->index == PTE_FREELIST_SIZE) { + pte_free_submit(*batchp); + *batchp = NULL; + } +} + /* * Update the MMU hash table to correspond with a change to * a Linux PTE. If wrprot is true, it is permissible to @@ -91,12 +118,15 @@ void hpte_update(pte_t *ptep, unsigned long pte, int wrprot) void __flush_tlb_pending(struct ppc64_tlb_batch *batch) { int i; - cpumask_t tmp = cpumask_of_cpu(smp_processor_id()); + int cpu; + cpumask_t tmp; int local = 0; BUG_ON(in_interrupt()); + cpu = get_cpu(); i = batch->index; + tmp = cpumask_of_cpu(cpu); if (cpus_equal(batch->mm->cpu_vm_mask, tmp)) local = 1; @@ -106,6 +136,7 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch) else flush_hash_range(batch->context, i, local); batch->index = 0; + put_cpu(); } #ifdef CONFIG_SMP diff --git a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c index 97b1509ac..679a4846e 100644 --- a/arch/ppc64/xmon/xmon.c +++ b/arch/ppc64/xmon/xmon.c @@ -44,9 +44,6 @@ static int xmon_owner; static int xmon_gate; #endif /* CONFIG_SMP */ -#define TRAP(regs) ((regs)->trap) -#define FULL_REGS(regs) 1 - static unsigned long in_xmon = 0; static unsigned long adrs; diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 2d7efbf4f..0f8c08ad9 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -85,9 +85,10 @@ struct appldata_parameter_list { */ static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata"; static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp); + void __user *buffer, size_t *lenp); static int appldata_interval_handler(ctl_table *ctl, int write, - struct file *filp, void *buffer, + struct file *filp, + void __user *buffer, size_t *lenp); static struct ctl_table_header *appldata_sysctl_header; @@ -192,7 +193,8 @@ static void appldata_tasklet_function(unsigned long data) * wrapper function for mod_virt_timer(), because smp_call_function_on() * accepts only one parameter. */ -static void appldata_mod_vtimer_wrap(struct appldata_mod_vtimer_args *args) { +static void appldata_mod_vtimer_wrap(void *p) { + struct appldata_mod_vtimer_args *args = p; mod_virt_timer(args->timer, args->expires); } @@ -252,7 +254,7 @@ static int appldata_diag(char record_nr, u16 function, unsigned long buffer, */ static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int len, i; char buf[2]; @@ -309,7 +311,7 @@ out: */ static int appldata_interval_handler(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { int len, i, interval; char buf[16]; @@ -347,7 +349,7 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp, appldata_mod_vtimer_args.expires = per_cpu_interval; smp_call_function_on( - (void *) appldata_mod_vtimer_wrap, + appldata_mod_vtimer_wrap, &appldata_mod_vtimer_args, 0, 1, i); } @@ -370,7 +372,7 @@ out: */ static int appldata_generic_handler(ctl_table *ctl, int write, struct file *filp, - void *buffer, size_t *lenp) + void __user *buffer, size_t *lenp) { struct appldata_ops *ops = NULL, *tmp_ops; int rc, len, found; diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 3fb822396..c694ae543 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig @@ -28,6 +28,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -112,7 +113,6 @@ CONFIG_CHR_DEV_SG=y # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_REPORT_LUNS is not set CONFIG_SCSI_CONSTANTS=y CONFIG_SCSI_LOGGING=y @@ -126,6 +126,7 @@ CONFIG_SCSI_LOGGING=y # SCSI low-level drivers # # CONFIG_SCSI_AIC7XXX_OLD is not set +# CONFIG_SCSI_DPT_I2O is not set # CONFIG_SCSI_SATA is not set # CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_DEBUG is not set @@ -310,11 +311,7 @@ CONFIG_NET_ETHERNET=y # CONFIG_MII is not set # -# Ethernet (1000 Mbit) -# - -# -# Ethernet (10000 Mbit) +# Gigabit Ethernet (1000/10000 Mbit) # # diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index a35e11af2..ce2b03578 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -32,6 +32,7 @@ int main(void) DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),); DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),); BLANK(); + DEFINE(__PT_ARGS, offsetof(struct pt_regs, args),); DEFINE(__PT_PSW, offsetof(struct pt_regs, psw),); DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs),); DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2),); diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 3886a27b8..67134eee7 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c @@ -53,7 +53,7 @@ typedef struct asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); -int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from) +int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from) { int err; @@ -130,7 +130,8 @@ sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t } asmlinkage int -sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize) +sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset, + size_t sigsetsize) { sigset_t saveset, newset; compat_sigset_t set32; @@ -162,11 +163,11 @@ sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigse if (do_signal(regs, &saveset)) return -EINTR; } -} +} asmlinkage long -sys32_sigaction(int sig, const struct old_sigaction32 *act, - struct old_sigaction32 *oact) +sys32_sigaction(int sig, const struct old_sigaction32 __user *act, + struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -199,9 +200,9 @@ sys32_sigaction(int sig, const struct old_sigaction32 *act, int do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact); -asmlinkage long -sys32_rt_sigaction(int sig, const struct sigaction32 *act, - struct sigaction32 *oact, size_t sigsetsize) +asmlinkage long +sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, + struct sigaction32 __user *oact, size_t sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -258,7 +259,8 @@ sys32_rt_sigaction(int sig, const struct sigaction32 *act, } asmlinkage long -sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) +sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss, + struct pt_regs *regs) { stack_t kss, koss; int ret, err = 0; @@ -275,7 +277,9 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) } set_fs (KERNEL_DS); - ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]); + ret = do_sigaltstack((stack_t __user *) (uss ? &kss : NULL), + (stack_t __user *) (uoss ? &koss : NULL), + regs->gprs[15]); set_fs (old_fs); if (!ret && uoss) { @@ -290,7 +294,7 @@ sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) return ret; } -static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) +static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) { _s390_regs_common32 regs32; int err, i; @@ -311,7 +315,7 @@ static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) sizeof(_s390_fp_regs32)); } -static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) +static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) { _s390_regs_common32 regs32; int err, i; @@ -343,7 +347,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) asmlinkage long sys32_sigreturn(struct pt_regs *regs) { - sigframe32 *frame = (sigframe32 *)regs->gprs[15]; + sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; sigset_t set; if (verify_area(VERIFY_READ, frame, sizeof(*frame))) @@ -365,11 +369,11 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs) badframe: force_sig(SIGSEGV, current); return 0; -} +} asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) { - rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15]; + rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; sigset_t set; stack_t st; __u32 ss_sp; @@ -399,8 +403,8 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) /* It is more difficult to avoid calling this function than to call it and ignore errors. */ - set_fs (KERNEL_DS); - do_sigaltstack(&st, NULL, regs->gprs[15]); + set_fs (KERNEL_DS); + do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]); set_fs (old_fs); return regs->gprs[2]; @@ -418,7 +422,7 @@ badframe: /* * Determine which stack to use.. */ -static inline void * +static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) { unsigned long sp; @@ -439,7 +443,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) sp = (unsigned long) ka->sa.sa_restorer; } - return (void *)((sp - frame_size) & -8ul); + return (void __user *)((sp - frame_size) & -8ul); } static inline int map_signal(int sig) @@ -455,7 +459,7 @@ static inline int map_signal(int sig) static void setup_frame32(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { - sigframe32 *frame = get_sigframe(ka, regs, sizeof(sigframe32)); + sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32))) goto give_sigsegv; @@ -474,12 +478,12 @@ static void setup_frame32(int sig, struct k_sigaction *ka, } else { regs->gprs[14] = (__u64) frame->retcode; if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, - (u16 *)(frame->retcode))) + (u16 __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ - if (__put_user(regs->gprs[15], (unsigned int *) frame)) + if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ @@ -505,7 +509,7 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { int err = 0; - rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); + rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32))) goto give_sigsegv; @@ -531,11 +535,11 @@ static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, } else { regs->gprs[14] = (__u64) frame->retcode; err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, - (u16 *)(frame->retcode)); + (u16 __user *)(frame->retcode)); } /* Set up backchain. */ - if (__put_user(regs->gprs[15], (unsigned int *) frame)) + if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index a0c43663e..41adc6120 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S @@ -1097,6 +1097,8 @@ compat_sys_futex_wrapper: lgfr %r4,%r4 # int llgtr %r5,%r5 # struct compat_timespec * llgtr %r6,%r6 # u32 * + lgf %r0,164(%r15) # int + stg %r0,160(%r15) jg compat_sys_futex # branch to system call .globl sys32_setxattr_wrapper diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index d2980b671..540a9a8bc 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -62,9 +62,9 @@ extern void tod_to_timeval(uint64_t todval, struct timeval *xtime); /* internal function prototyes */ static int debug_init(void); -static ssize_t debug_output(struct file *file, char *user_buf, +static ssize_t debug_output(struct file *file, char __user *user_buf, size_t user_len, loff_t * offset); -static ssize_t debug_input(struct file *file, const char *user_buf, +static ssize_t debug_input(struct file *file, const char __user *user_buf, size_t user_len, loff_t * offset); static int debug_open(struct inode *inode, struct file *file); static int debug_close(struct inode *inode, struct file *file); @@ -74,10 +74,10 @@ static void debug_info_put(debug_info_t *); static int debug_prolog_level_fn(debug_info_t * id, struct debug_view *view, char *out_buf); static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, + struct file *file, const char __user *user_buf, size_t user_buf_size, loff_t * offset); static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, + struct file *file, const char __user *user_buf, size_t user_buf_size, loff_t * offset); static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view, char *out_buf, const char *in_buf); @@ -416,10 +416,10 @@ out: * - copies formated debug entries to the user buffer */ -static ssize_t debug_output(struct file *file, /* file descriptor */ - char *user_buf, /* user buffer */ - size_t len, /* length of buffer */ - loff_t *offset /* offset in the file */ ) +static ssize_t debug_output(struct file *file, /* file descriptor */ + char __user *user_buf, /* user buffer */ + size_t len, /* length of buffer */ + loff_t *offset) /* offset in the file */ { size_t count = 0; size_t entry_offset, size = 0; @@ -462,7 +462,7 @@ out: */ static ssize_t debug_input(struct file *file, - const char *user_buf, size_t length, + const char __user *user_buf, size_t length, loff_t *offset) { int rc = 0; @@ -942,7 +942,7 @@ static int debug_prolog_level_fn(debug_info_t * id, */ static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, + struct file *file, const char __user *user_buf, size_t in_buf_size, loff_t * offset) { char input_buf[1]; @@ -1004,9 +1004,9 @@ void debug_flush(debug_info_t* id, int area) /* * view function: flushes debug areas */ - + static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, + struct file *file, const char __user *user_buf, size_t in_buf_size, loff_t * offset) { char input_buf[1]; diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 4cce894cc..f716b41f0 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -24,7 +24,8 @@ * Stack layout for the system_call stack entry. * The first few entries are identical to the user_regs_struct. */ -SP_PTREGS = STACK_FRAME_OVERHEAD +SP_PTREGS = STACK_FRAME_OVERHEAD +SP_ARGS = STACK_FRAME_OVERHEAD + __PT_ARGS SP_PSW = STACK_FRAME_OVERHEAD + __PT_PSW SP_R0 = STACK_FRAME_OVERHEAD + __PT_GPRS SP_R1 = STACK_FRAME_OVERHEAD + __PT_GPRS + 4 @@ -47,7 +48,8 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE -_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC) +_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ + _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED) #define BASED(name) name-system_call(%r13) @@ -229,13 +231,16 @@ system_call: lh %r7,0x8a # get svc number from lowcore sysc_enter: GET_THREAD_INFO # load pointer to task_struct to R9 +sysc_do_svc: sla %r7,2 # *4 and test for svc 0 - bnz BASED(sysc_do_restart) # svc number > 0 + bnz BASED(sysc_nr_ok) # svc number > 0 # svc 0: system call number in %r1 cl %r1,BASED(.Lnr_syscalls) - bnl BASED(sysc_do_restart) + bnl BASED(sysc_nr_ok) lr %r7,%r1 # copy svc number to %r7 sla %r7,2 # *4 +sysc_nr_ok: + mvc SP_ARGS(4,%r15),SP_R7(%r15) sysc_do_restart: tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr. @@ -262,7 +267,6 @@ sysc_work_loop: bz BASED(sysc_leave) # there is no work to do # # One of the work bits is on. Find out which one. -# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED # sysc_work: tm __TI_flags+3(%r9),_TIF_NEED_RESCHED @@ -271,6 +275,8 @@ sysc_work: bo BASED(sysc_sigpending) tm __TI_flags+3(%r9),_TIF_RESTART_SVC bo BASED(sysc_restart) + tm __TI_flags+3(%r9),_TIF_SINGLE_STEP + bo BASED(sysc_singlestep) b BASED(sysc_leave) # @@ -304,6 +310,17 @@ sysc_restart: lm %r2,%r6,SP_R2(%r15) # load svc arguments b BASED(sysc_do_restart) # restart svc +# +# _TIF_SINGLE_STEP is set, call do_debugger_trap +# +sysc_singlestep: + ni __TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP + mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check + la %r2,SP_PTREGS(%r15) # address of register-save area + l %r1,BASED(.Lhandle_per) # load adr. of per handler + la %r14,BASED(sysc_return) # load adr. of system return + br %r1 # branch to do_debugger_trap + __critical_end: # @@ -495,71 +512,15 @@ pgm_per_only: # pgm_svcper: SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1 - lh %r7,0x8a # get svc number from lowcore - GET_THREAD_INFO # load pointer to task_struct to R9 + lh %r7,0x8a # get svc number from lowcore + GET_THREAD_INFO # load pointer to task_struct to R9 l %r1,__TI_task(%r9) mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID - stosm 24(%r15),0x03 # reenable interrupts - sla %r7,2 # *4 and test for svc 0 - bnz BASED(pgm_svcstd) # svc number > 0 ? - # svc 0: system call number in %r1 - cl %r1,BASED(.Lnr_syscalls) - bnl BASED(pgm_svcstd) - lr %r7,%r1 # copy svc number to %r7 - sla %r7,2 # *4 -pgm_svcstd: - tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) - l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr. - bnz BASED(pgm_tracesys) - basr %r14,%r8 # call sys_xxxx - st %r2,SP_R2(%r15) # store return value (change R2 on stack) - # ATTENTION: check sys_execve_glue before - # changing anything here !! - -pgm_svcret: - tm __TI_flags+3(%r9),_TIF_SIGPENDING - bno BASED(pgm_svcper_nosig) - la %r2,SP_PTREGS(%r15) # load pt_regs - sr %r3,%r3 # clear *oldset - l %r1,BASED(.Ldo_signal) - basr %r14,%r1 # call do_signal - -pgm_svcper_nosig: - mvi SP_TRAP+3(%r15),0x28 # set trap indication to pgm check - la %r2,SP_PTREGS(15) # address of register-save area - l %r1,BASED(.Lhandle_per) # load adr. of per handler - la %r14,BASED(sysc_return) # load adr. of system return - br %r1 # branch to do_debugger_trap -# -# call trace before and after sys_call -# -pgm_tracesys: - l %r1,BASED(.Ltrace) - la %r2,SP_PTREGS(%r15) # load pt_regs - la %r3,0 - srl %r7,2 - st %r7,SP_R2(%r15) - basr %r14,%r1 - clc SP_R2(4,%r15),BASED(.Lnr_syscalls) - bnl BASED(pgm_svc_nogo) - l %r7,SP_R2(%r15) # strace changed the syscall - sll %r7,2 - l %r8,sys_call_table-system_call(%r7,%r13) -pgm_svc_go: - lm %r3,%r6,SP_R3(%r15) - l %r2,SP_ORIG_R2(%r15) - basr %r14,%r8 # call sys_xxx - st %r2,SP_R2(%r15) # store return value -pgm_svc_nogo: - tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) - bz BASED(pgm_svcret) - l %r1,BASED(.Ltrace) - la %r2,SP_PTREGS(%r15) # load pt_regs - la %r3,1 - la %r14,BASED(pgm_svcret) - br %r1 + oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP + stosm 24(%r15),0x03 # reenable interrupts + b BASED(sysc_do_svc) /* * IO interrupt handler routine diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 85a9876f7..533fa85ce 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S @@ -24,7 +24,8 @@ * Stack layout for the system_call stack entry. * The first few entries are identical to the user_regs_struct. */ -SP_PTREGS = STACK_FRAME_OVERHEAD +SP_PTREGS = STACK_FRAME_OVERHEAD +SP_ARGS = STACK_FRAME_OVERHEAD + __PT_ARGS SP_PSW = STACK_FRAME_OVERHEAD + __PT_PSW SP_R0 = STACK_FRAME_OVERHEAD + __PT_GPRS SP_R1 = STACK_FRAME_OVERHEAD + __PT_GPRS + 8 @@ -47,7 +48,8 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE -_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC) +_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ + _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED) /* @@ -213,14 +215,17 @@ system_call: llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore sysc_enter: GET_THREAD_INFO # load pointer to task_struct to R9 +sysc_do_svc: slag %r7,%r7,2 # *4 and test for svc 0 - jnz sysc_do_restart + jnz sysc_nr_ok # svc 0: system call number in %r1 lghi %r0,NR_syscalls clr %r1,%r0 - jnl sysc_do_restart + jnl sysc_nr_ok lgfr %r7,%r1 # clear high word in r1 slag %r7,%r7,2 # svc 0: system call number in %r1 +sysc_nr_ok: + mvc SP_ARGS(8,%r15),SP_R7(%r15) sysc_do_restart: larl %r10,sys_call_table #ifdef CONFIG_S390_SUPPORT @@ -254,7 +259,6 @@ sysc_work_loop: jz sysc_leave # there is no work to do # # One of the work bits is on. Find out which one. -# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED # sysc_work: tm __TI_flags+7(%r9),_TIF_NEED_RESCHED @@ -263,6 +267,8 @@ sysc_work: jo sysc_sigpending tm __TI_flags+7(%r9),_TIF_RESTART_SVC jo sysc_restart + tm __TI_flags+7(%r9),_TIF_SINGLE_STEP + jo sysc_singlestep j sysc_leave # @@ -294,6 +300,17 @@ sysc_restart: lmg %r2,%r6,SP_R2(%r15) # load svc arguments j sysc_do_restart # restart svc +# +# _TIF_SINGLE_STEP is set, call do_debugger_trap +# +sysc_singlestep: + ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP + mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check + la %r2,SP_PTREGS(%r15) # address of register-save area + larl %r14,sysc_return # load adr. of system return + jg do_debugger_trap # branch to do_debugger_trap + + __critical_end: # @@ -528,75 +545,15 @@ pgm_per_only: # pgm_svcper: SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1 - llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore - GET_THREAD_INFO # load pointer to task_struct to R9 + llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore + GET_THREAD_INFO # load pointer to task_struct to R9 lg %r1,__TI_task(%r9) mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID mvc __THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID - stosm 48(%r15),0x03 # reenable interrupts - slag %r7,%r7,2 # *4 and test for svc 0 - jnz pgm_svcstd - # svc 0: system call number in %r1 - lghi %r0,NR_syscalls - clr %r1,%r0 - slag %r7,%r1,2 -pgm_svcstd: - larl %r10,sys_call_table -#ifdef CONFIG_S390_SUPPORT - tm SP_PSW+3(%r15),0x01 # are we running in 31 bit mode ? - jo pgm_svcper_noemu - larl %r10,sys_call_table_emu # use 31 bit emulation system calls -pgm_svcper_noemu: -#endif - tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) - lgf %r8,0(%r7,%r10) # load address of system call routine - jnz pgm_tracesys - basr %r14,%r8 # call sys_xxxx - stg %r2,SP_R2(%r15) # store return value (change R2 on stack) - # ATTENTION: check sys_execve_glue before - # changing anything here !! - -pgm_svcret: - tm __TI_flags+7(%r9),_TIF_SIGPENDING - jno pgm_svcper_nosig - la %r2,SP_PTREGS(%r15) # load pt_regs - sgr %r3,%r3 # clear *oldset - brasl %r14,do_signal - -pgm_svcper_nosig: - lhi %r0,__LC_PGM_OLD_PSW # set trap indication back to pgm_chk - st %r0,SP_TRAP(%r15) - la %r2,SP_PTREGS(15) # address of register-save area - larl %r14,sysc_return # load adr. of system return - jg do_debugger_trap -# -# call trace before and after sys_call -# -pgm_tracesys: - la %r2,SP_PTREGS(%r15) # load pt_regs - la %r3,0 - srlg %r7,%r7,2 - stg %r7,SP_R2(%r15) - brasl %r14,syscall_trace - lghi %r0,NR_syscalls - clg %r0,SP_R2(%r15) - jnh pgm_svc_nogo - lg %r7,SP_R2(%r15) - sllg %r7,%r7,2 # strace wants to change the syscall - lgf %r8,0(%r7,%r10) -pgm_svc_go: - lmg %r3,%r6,SP_R3(%r15) - lg %r2,SP_ORIG_R2(%r15) - basr %r14,%r8 # call sys_xxx - stg %r2,SP_R2(%r15) # store return value -pgm_svc_nogo: - tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) - jz pgm_svcret - la %r2,SP_PTREGS(%r15) # load pt_regs - la %r3,1 - larl %r14,pgm_svcret # return point is sysc_return - jg syscall_trace + oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP + stosm 48(%r15),0x03 # reenable interrupts + j sysc_do_svc /* * IO interrupt handler routine diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index 229f4aff8..068653a5e 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S @@ -478,9 +478,80 @@ startup:basr %r13,0 # get base mvcle %r2,%r4,0 # clear mem jo .-4 # branch back, if not finish + l %r2,.Lrcp-.LPG1(%r13) # Read SCP forced command word +.Lservicecall: + stosm .Lpmask-.LPG1(%r13),0x01 # authorize ext interrupts + + stctl %r0, %r0,.Lcr-.LPG1(%r13) # get cr0 + la %r1,0x200 # set bit 22 + o %r1,.Lcr-.LPG1(%r13) # or old cr0 with r1 + st %r1,.Lcr-.LPG1(%r13) + lctl %r0, %r0,.Lcr-.LPG1(%r13) # load modified cr0 + + mvc __LC_EXT_NEW_PSW(8),.Lpcext-.LPG1(%r13) # set postcall psw + la %r1, .Lsclph-.LPG1(%r13) + a %r1,__LC_EXT_NEW_PSW+4 # set handler + st %r1,__LC_EXT_NEW_PSW+4 + + la %r4,_pstart-.LPG1(%r13) # %r4 is our index for sccb stuff + la %r1, .Lsccb-PARMAREA(%r4) # our sccb + .insn rre,0xb2200000,%r2,%r1 # service call + ipm %r1 + srl %r1,28 # get cc code + xr %r3, %r3 + chi %r1,3 + be .Lfchunk-.LPG1(%r13) # leave + chi %r1,2 + be .Lservicecall-.LPG1(%r13) + lpsw .Lwaitsclp-.LPG1(%r13) +.Lsclph: + lh %r1,.Lsccbr-PARMAREA(%r4) + chi %r1,0x10 # 0x0010 is the sucess code + je .Lprocsccb # let's process the sccb + chi %r1,0x1f0 + bne .Lfchunk-.LPG1(%r13) # unhandled error code + c %r2, .Lrcp-.LPG1(%r13) # Did we try Read SCP forced + bne .Lfchunk-.LPG1(%r13) # if no, give up + l %r2, .Lrcp2-.LPG1(%r13) # try with Read SCP + b .Lservicecall-.LPG1(%r13) +.Lprocsccb: + lh %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 + chi %r1,0x00 + jne .Lscnd + l %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one +.Lscnd: + xr %r3,%r3 # same logic + ic %r3,.Lscpa1-PARMAREA(%r4) + chi %r3,0x00 + jne .Lcompmem + l %r3,.Lscpa2-PARMAREA(%r13) +.Lcompmem: + mr %r2,%r1 # mem in MB on 128-bit + l %r1,.Lonemb-.LPG1(%r13) + mr %r2,%r1 # mem size in bytes in %r3 + b .Lfchunk-.LPG1(%r13) + +.Lpmask: + .byte 0 +.align 8 +.Lpcext:.long 0x00080000,0x80000000 +.Lcr: + .long 0x00 # place holder for cr0 +.Lwaitsclp: + .long 0x020A0000 + .long .Lsclph +.Lrcp: + .int 0x00120001 # Read SCP forced code +.Lrcp2: + .int 0x00020001 # Read SCP code +.Lonemb: + .int 0x100000 +.Lfchunk: + # # find memory chunks. # + lr %r9,%r3 # end of mem mvc __LC_PGM_NEW_PSW(8),.Lpcmem-.LPG1(%r13) la %r1,1 # test in increments of 128KB sll %r1,17 @@ -488,38 +559,46 @@ startup:basr %r13,0 # get base slr %r4,%r4 # set start of chunk to zero slr %r5,%r5 # set end of chunk to zero slr %r6,%r6 # set access code to zero + la %r10, MEMORY_CHUNKS # number of chunks .Lloop: tprot 0(%r5),0 # test protection of first byte ipm %r7 srl %r7,28 clr %r6,%r7 # compare cc with last access code be .Lsame-.LPG1(%r13) - clr %r4,%r5 # chunk size > 0? - be .Lsize0-.LPG1(%r13) - st %r4,0(%r3) # store start address of chunk - lr %r0,%r5 - slr %r0,%r4 - st %r0,4(%r3) # store size of chunk - st %r6,8(%r3) # store type of chunk - la %r3,12(%r3) - lr %r4,%r5 # set start to end -.Lsize0: - lr %r6,%r7 # set access code to last cc + b .Lchkmem-.LPG1(%r13) .Lsame: ar %r5,%r1 # add 128KB to end of chunk bno .Lloop-.LPG1(%r13) # r1 < 0x80000000 -> loop .Lchkmem: # > 2GB or tprot got a program check clr %r4,%r5 # chunk size > 0? - be .Ldonemem-.LPG1(%r13) + be .Lchkloop-.LPG1(%r13) st %r4,0(%r3) # store start address of chunk lr %r0,%r5 slr %r0,%r4 st %r0,4(%r3) # store size of chunk st %r6,8(%r3) # store type of chunk + la %r3,12(%r3) + l %r4,.Lmemsize-.LPG1(%r13) # address of variable memory_size + st %r5,0(%r4) # store last end to memory size + ahi %r10,-1 # update chunk number +.Lchkloop: + lr %r6,%r7 # set access code to last cc + # we got an exception or we're starting a new + # chunk , we must check if we should + # still try to find valid memory (if we detected + # the amount of available storage), and if we + # have chunks left + xr %r0,%r0 + clr %r0,%r9 # did we detect memory? + je .Ldonemem # if not, leave + chi %r10,0 # do we have chunks left? + je .Ldonemem + alr %r5,%r1 # add 128KB to end of chunk + lr %r4,%r5 # potential new chunk + clr %r5,%r9 # should we go on? + jl .Lloop .Ldonemem: - l %r1,.Lmemsize-.LPG1(%r13) # address of variable memory_size - st %r5,0(%r1) # store last end to memory size - l %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags # # find out if we are running under VM @@ -631,6 +710,23 @@ _pstart: .byte "root=/dev/ram0 ro" .byte 0 .org 0x11000 +.Lsccb: + .hword 0x1000 # length, one page + .byte 0x00,0x00,0x00 + .byte 0x80 # variable response bit set +.Lsccbr: + .hword 0x00 # response code +.Lscpincr1: + .hword 0x00 +.Lscpa1: + .byte 0x00 + .fill 89,1,0 +.Lscpa2: + .int 0x00 +.Lscpincr2: + .quad 0x00 + .fill 3984,1,0 + .org 0x12000 .global _pend _pend: diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index c380e2b9c..26caebd7d 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S @@ -480,12 +480,81 @@ startup:basr %r13,0 # get base mvcle %r2,%r4,0 # clear mem jo .-4 # branch back, if not finish + l %r2,.Lrcp-.LPG1(%r13) # Read SCP forced command word +.Lservicecall: + stosm .Lpmask-.LPG1(%r13),0x01 # authorize ext interrupts + + stctg %r0,%r0,.Lcr-.LPG1(%r13) # get cr0 + la %r1,0x200 # set bit 22 + og %r1,.Lcr-.LPG1(%r13) # or old cr0 with r1 + stg %r1,.Lcr-.LPG1(%r13) + lctlg %r0,%r0,.Lcr-.LPG1(%r13) # load modified cr0 + + mvc __LC_EXT_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) # set postcall psw + larl %r1,.Lsclph + stg %r1,__LC_EXT_NEW_PSW+8 # set handler + + larl %r4,_pstart # %r4 is our index for sccb stuff + la %r1,.Lsccb-PARMAREA(%r4) # our sccb + .insn rre,0xb2200000,%r2,%r1 # service call + ipm %r1 + srl %r1,28 # get cc code + xr %r3,%r3 + chi %r1,3 + be .Lfchunk-.LPG1(%r13) # leave + chi %r1,2 + be .Lservicecall-.LPG1(%r13) + lpsw .Lwaitsclp-.LPG1(%r13) +.Lsclph: + lh %r1,.Lsccbr-PARMAREA(%r4) + chi %r1,0x10 # 0x0010 is the sucess code + je .Lprocsccb # let's process the sccb + chi %r1,0x1f0 + bne .Lfchunk-.LPG1(%r13) # unhandled error code + c %r2,.Lrcp-.LPG1(%r13) # Did we try Read SCP forced + bne .Lfchunk-.LPG1(%r13) # if no, give up + l %r2,.Lrcp2-.LPG1(%r13) # try with Read SCP + b .Lservicecall-.LPG1(%r13) +.Lprocsccb: + lh %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 + chi %r1,0x00 + jne .Lscnd + lg %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one +.Lscnd: + xr %r3,%r3 # same logic + ic %r3,.Lscpa1-PARMAREA(%r4) + chi %r3,0x00 + jne .Lcompmem + l %r3,.Lscpa2-PARMAREA(%r13) +.Lcompmem: + mlgr %r2,%r1 # mem in MB on 128-bit + l %r1,.Lonemb-.LPG1(%r13) + mlgr %r2,%r1 # mem size in bytes in %r3 + b .Lfchunk-.LPG1(%r13) + +.Lpmask: + .byte 0 + .align 8 +.Lcr: + .quad 0x00 # place holder for cr0 +.Lwaitsclp: + .long 0x020A0000 + .quad .Lsclph +.Lrcp: + .int 0x00120001 # Read SCP forced code +.Lrcp2: + .int 0x00020001 # Read SCP code +.Lonemb: + .int 0x100000 + +.Lfchunk: # set program check new psw mask mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) # # find memory chunks. # + lgr %r9,%r3 # end of mem larl %r1,.Lchkmem # set program check address stg %r1,__LC_PGM_NEW_PSW+8 la %r1,1 # test in increments of 128KB @@ -494,51 +563,51 @@ startup:basr %r13,0 # get base slgr %r4,%r4 # set start of chunk to zero slgr %r5,%r5 # set end of chunk to zero slr %r6,%r6 # set access code to zero + la %r10,MEMORY_CHUNKS # number of chunks .Lloop: tprot 0(%r5),0 # test protection of first byte ipm %r7 srl %r7,28 clr %r6,%r7 # compare cc with last access code je .Lsame - clgr %r4,%r5 # chunk size > 0? - je .Lsize0 - stg %r4,0(%r3) # store start address of chunk - lgr %r0,%r5 - slgr %r0,%r4 - stg %r0,8(%r3) # store size of chunk - st %r6,20(%r3) # store type of chunk - la %r3,24(%r3) - lgr %r4,%r5 # set start to end - larl %r8,memory_size - stg %r5,0(%r8) # store memory size -.Lsize0: - lr %r6,%r7 # set access code to last cc + j .Lchkmem .Lsame: algr %r5,%r1 # add 128KB to end of chunk - brc 12,.Lloop + # no need to check here, + brc 12,.Lloop # this is the same chunk .Lchkmem: # > 16EB or tprot got a program check clgr %r4,%r5 # chunk size > 0? - je .Ldonemem + je .Lchkloop stg %r4,0(%r3) # store start address of chunk lgr %r0,%r5 slgr %r0,%r4 stg %r0,8(%r3) # store size of chunk st %r6,20(%r3) # store type of chunk la %r3,24(%r3) - lgr %r4,%r5 larl %r8,memory_size stg %r5,0(%r8) # store memory size -# -# Running native the HSA is located at 2GB and we will get an -# addressing exception trying to access it. We have to restart -# the scan at 2GB to find out if the machine has more than 2GB. -# + ahi %r10,-1 # update chunk number +.Lchkloop: + lr %r6,%r7 # set access code to last cc + # we got an exception or we're starting a new + # chunk , we must check if we should + # still try to find valid memory (if we detected + # the amount of available storage), and if we + # have chunks left lghi %r4,1 sllg %r4,%r4,31 clgr %r5,%r4 - jhe .Ldonemem - lgr %r5,%r4 - j .Lloop + je .Lhsaskip + xr %r0, %r0 + clgr %r0, %r9 # did we detect memory? + je .Ldonemem # if not, leave + chi %r10, 0 # do we have chunks left? + je .Ldonemem +.Lhsaskip: + algr %r5,%r1 # add 128KB to end of chunk + lgr %r4,%r5 # potential new chunk + clgr %r5,%r9 # should we go on? + jl .Lloop .Ldonemem: larl %r12,machine_flags @@ -640,6 +709,23 @@ _pstart: .byte "root=/dev/ram0 ro" .byte 0 .org 0x11000 +.Lsccb: + .hword 0x1000 # length, one page + .byte 0x00,0x00,0x00 + .byte 0x80 # variable response bit set +.Lsccbr: + .hword 0x00 # response code +.Lscpincr1: + .hword 0x00 +.Lscpa1: + .byte 0x00 + .fill 89,1,0 +.Lscpa2: + .int 0x00 +.Lscpincr2: + .quad 0x00 + .fill 3984,1,0 + .org 0x12000 .global _pend _pend: diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c index 652c42325..d73a74013 100644 --- a/arch/s390/kernel/init_task.c +++ b/arch/s390/kernel/init_task.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index a18d5f444..63818a50e 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -292,12 +293,12 @@ asmlinkage long sys_clone(struct pt_regs regs) { unsigned long clone_flags; unsigned long newsp; - int *parent_tidptr, *child_tidptr; + int __user *parent_tidptr, *child_tidptr; clone_flags = regs.gprs[3]; newsp = regs.orig_gpr2; - parent_tidptr = (int *) regs.gprs[4]; - child_tidptr = (int *) regs.gprs[5]; + parent_tidptr = (int __user *) regs.gprs[4]; + child_tidptr = (int __user *) regs.gprs[5]; if (!newsp) newsp = regs.gprs[15]; return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, ®s, 0, @@ -328,12 +329,12 @@ asmlinkage long sys_execve(struct pt_regs regs) int error; char * filename; - filename = getname((char *) regs.orig_gpr2); + filename = getname((char __user *) regs.orig_gpr2); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; - error = do_execve(filename, (char **) regs.gprs[3], - (char **) regs.gprs[4], ®s); + error = do_execve(filename, (char __user * __user *) regs.gprs[3], + (char __user * __user *) regs.gprs[4], ®s); if (error == 0) { current->ptrace &= ~PT_DTRACE; current->thread.fp_regs.fpc = 0; diff --git a/arch/s390/kernel/profile.c b/arch/s390/kernel/profile.c index a6fad9c93..f219748d7 100644 --- a/arch/s390/kernel/profile.c +++ b/arch/s390/kernel/profile.c @@ -19,7 +19,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, return len; } -static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, +static int prof_cpu_mask_write_proc (struct file *file, + const char __user *buffer, unsigned long count, void *data) { cpumask_t *mask = (cpumask_t *)data; diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 1176b4f5b..a0ddc4f7d 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -141,7 +141,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data) /* * psw and gprs are stored on the stack */ - tmp = *(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr); + tmp = *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr); if (addr == (addr_t) &dummy->regs.psw.mask) /* Remove per bit from user psw. */ tmp &= ~PSW_MASK_PER; @@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data) } else tmp = 0; - return put_user(tmp, (addr_t *) data); + return put_user(tmp, (addr_t __user *) data); } /* @@ -215,7 +215,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data) high order bit but older gdb's rely on it */ data |= PSW_ADDR_AMODE; #endif - *(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr) = data; + *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr) = data; } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { /* @@ -269,7 +269,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); if (copied != sizeof(tmp)) return -EIO; - return put_user(tmp, (unsigned long *) data); + return put_user(tmp, (unsigned long __user *) data); case PTRACE_PEEKUSR: /* read the word at location addr in the USER area. */ @@ -291,7 +291,8 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) case PTRACE_PEEKUSR_AREA: case PTRACE_POKEUSR_AREA: - if (copy_from_user(&parea, (void *) addr, sizeof(parea))) + if (copy_from_user(&parea, (void __user *) addr, + sizeof(parea))) return -EFAULT; addr = parea.kernel_addr; data = parea.process_addr; @@ -301,7 +302,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data) ret = peek_user(child, addr, data); else { addr_t tmp; - if (get_user (tmp, (addr_t *) data)) + if (get_user (tmp, (addr_t __user *) data)) return -EFAULT; ret = poke_user(child, addr, tmp); } @@ -360,7 +361,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) PSW32_ADDR_AMODE31; } else { /* gpr 0-15 */ - tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + + tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw + addr*2 + 4); } } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { @@ -402,7 +403,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) } else tmp = 0; - return put_user(tmp, (__u32 *) data); + return put_user(tmp, (__u32 __user *) data); } /* @@ -439,8 +440,8 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) (__u64) tmp & PSW32_ADDR_INSN; } else { /* gpr 0-15 */ - *(__u32*)((addr_t) __KSTK_PTREGS(child) + addr*2 + 4) = - tmp; + *(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw + + addr*2 + 4) = tmp; } } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { /* @@ -509,7 +510,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); if (copied != sizeof(tmp)) return -EIO; - return put_user(tmp, (unsigned int *) data); + return put_user(tmp, (unsigned int __user *) data); case PTRACE_PEEKUSR: /* read the word at location addr in the USER area. */ @@ -530,7 +531,8 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) case PTRACE_PEEKUSR_AREA: case PTRACE_POKEUSR_AREA: - if (copy_from_user(&parea, (void *) addr, sizeof(parea))) + if (copy_from_user(&parea, (void __user *) addr, + sizeof(parea))) return -EFAULT; addr = parea.kernel_addr; data = parea.process_addr; @@ -540,7 +542,7 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) ret = peek_user_emu31(child, addr, data); else { __u32 tmp; - if (get_user (tmp, (__u32 *) data)) + if (get_user (tmp, (__u32 __user *) data)) return -EFAULT; ret = poke_user_emu31(child, addr, tmp); } diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c index 832e7582a..5ba86ba1a 100644 --- a/arch/s390/kernel/s390_ksyms.c +++ b/arch/s390/kernel/s390_ksyms.c @@ -44,25 +44,6 @@ EXPORT_SYMBOL(__up); EXPORT_SYMBOL(__down); EXPORT_SYMBOL(__down_interruptible); -/* - * string functions - */ -EXPORT_SYMBOL_NOVERS(memcmp); -EXPORT_SYMBOL_NOVERS(memset); -EXPORT_SYMBOL_NOVERS(memmove); -EXPORT_SYMBOL_NOVERS(memscan); -EXPORT_SYMBOL_NOVERS(strlen); -EXPORT_SYMBOL_NOVERS(strchr); -EXPORT_SYMBOL_NOVERS(strcmp); -EXPORT_SYMBOL_NOVERS(strncat); -EXPORT_SYMBOL_NOVERS(strncmp); -EXPORT_SYMBOL_NOVERS(strncpy); -EXPORT_SYMBOL_NOVERS(strnlen); -EXPORT_SYMBOL_NOVERS(strrchr); -EXPORT_SYMBOL_NOVERS(strstr); -EXPORT_SYMBOL_NOVERS(strpbrk); -EXPORT_SYMBOL_NOVERS(strcpy); - /* * binfmt_elf loader */ diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 7ca8a8706..d549ad5c2 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -53,7 +53,9 @@ unsigned int console_device = -1; unsigned int console_irq = -1; unsigned long memory_size = 0; unsigned long machine_flags = 0; -struct { unsigned long addr, size, type; } memory_chunk[16] = { { 0 } }; +struct { + unsigned long addr, size, type; +} memory_chunk[MEMORY_CHUNKS] = { { 0 } }; #define CHUNK_READ_WRITE 0 #define CHUNK_READ_ONLY 1 int cpus_initialized = 0; diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 2379b6734..d32b2c44b 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c @@ -77,8 +77,9 @@ sys_sigsuspend(struct pt_regs * regs, int history0, int history1, } } -asmlinkage int -sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) +asmlinkage long +sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset, + size_t sigsetsize) { sigset_t saveset, newset; @@ -105,9 +106,9 @@ sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) } } -asmlinkage int -sys_sigaction(int sig, const struct old_sigaction *act, - struct old_sigaction *oact) +asmlinkage long +sys_sigaction(int sig, const struct old_sigaction __user *act, + struct old_sigaction __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -137,8 +138,9 @@ sys_sigaction(int sig, const struct old_sigaction *act, return ret; } -asmlinkage int -sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) +asmlinkage long +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, + struct pt_regs *regs) { return do_sigaltstack(uss, uoss, regs->gprs[15]); } @@ -146,7 +148,7 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) /* Returns non-zero on fault. */ -static int save_sigregs(struct pt_regs *regs, _sigregs *sregs) +static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) { unsigned long old_mask = regs->psw.mask; int err; @@ -175,7 +177,7 @@ static int save_sigregs(struct pt_regs *regs, _sigregs *sregs) } /* Returns positive number on error */ -static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs) +static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) { unsigned long old_mask = regs->psw.mask; int err; @@ -208,7 +210,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs) asmlinkage long sys_sigreturn(struct pt_regs *regs) { - sigframe *frame = (sigframe *)regs->gprs[15]; + sigframe __user *frame = (sigframe __user *)regs->gprs[15]; sigset_t set; if (verify_area(VERIFY_READ, frame, sizeof(*frame))) @@ -234,7 +236,7 @@ badframe: asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) { - rt_sigframe *frame = (rt_sigframe *)regs->gprs[15]; + rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; sigset_t set; if (verify_area(VERIFY_READ, frame, sizeof(*frame))) @@ -269,7 +271,7 @@ badframe: /* * Determine which stack to use.. */ -static inline void * +static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) { unsigned long sp; @@ -290,7 +292,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) sp = (unsigned long) ka->sa.sa_restorer; } - return (void *)((sp - frame_size) & -8ul); + return (void __user *)((sp - frame_size) & -8ul); } static inline int map_signal(int sig) @@ -306,7 +308,9 @@ static inline int map_signal(int sig) static void setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) { - sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe)); + sigframe __user *frame; + + frame = get_sigframe(ka, regs, sizeof(sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe))) goto give_sigsegv; @@ -326,13 +330,13 @@ static void setup_frame(int sig, struct k_sigaction *ka, } else { regs->gprs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE; - if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, - (u16 *)(frame->retcode))) + if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, + (u16 __user *)(frame->retcode))) goto give_sigsegv; } /* Set up backchain. */ - if (__put_user(regs->gprs[15], (addr_t *) frame)) + if (__put_user(regs->gprs[15], (addr_t __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ @@ -358,7 +362,9 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { int err = 0; - rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); + rt_sigframe __user *frame; + + frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe))) goto give_sigsegv; @@ -385,12 +391,12 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, } else { regs->gprs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE; - err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, - (u16 *)(frame->retcode)); + err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, + (u16 __user *)(frame->retcode)); } /* Set up backchain. */ - if (__put_user(regs->gprs[15], (addr_t *) frame)) + if (__put_user(regs->gprs[15], (addr_t __user *) frame)) goto give_sigsegv; /* Set up registers for signal handler */ diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index c51ff0d13..9ea8becb8 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c @@ -37,7 +37,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way Unix traditionally does this, though. */ -asmlinkage long sys_pipe(unsigned long * fildes) +asmlinkage long sys_pipe(unsigned long __user *fildes) { int fd[2]; int error; @@ -92,7 +92,7 @@ struct mmap_arg_struct { unsigned long offset; }; -asmlinkage long sys_mmap2(struct mmap_arg_struct *arg) +asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg) { struct mmap_arg_struct a; int error = -EFAULT; @@ -104,7 +104,7 @@ out: return error; } -asmlinkage long old_mmap(struct mmap_arg_struct *arg) +asmlinkage long old_mmap(struct mmap_arg_struct __user *arg) { struct mmap_arg_struct a; long error = -EFAULT; @@ -128,7 +128,7 @@ struct sel_arg_struct { struct timeval *tvp; }; -asmlinkage long old_select(struct sel_arg_struct *arg) +asmlinkage long old_select(struct sel_arg_struct __user *arg) { struct sel_arg_struct a; @@ -145,37 +145,37 @@ asmlinkage long old_select(struct sel_arg_struct *arg) * * This is really horribly ugly. */ -asmlinkage long sys_ipc (uint call, int first, int second, - unsigned long third, void *ptr) +asmlinkage long sys_ipc(uint call, int first, int second, + unsigned long third, void __user *ptr) { struct ipc_kludge tmp; int ret; switch (call) { case SEMOP: - return sys_semtimedop (first, (struct sembuf *) ptr, second, + return sys_semtimedop (first, (struct sembuf __user *) ptr, second, NULL); case SEMTIMEDOP: - return sys_semtimedop (first, (struct sembuf *) ptr, second, - (const struct timespec *) third); + return sys_semtimedop (first, (struct sembuf __user *) ptr, second, + (const struct timespec __user *) third); case SEMGET: return sys_semget (first, second, third); case SEMCTL: { union semun fourth; if (!ptr) return -EINVAL; - if (get_user(fourth.__pad, (void **) ptr)) + if (get_user(fourth.__pad, (void __user * __user *) ptr)) return -EFAULT; return sys_semctl (first, second, third, fourth); - } + } case MSGSND: - return sys_msgsnd (first, (struct msgbuf *) ptr, + return sys_msgsnd (first, (struct msgbuf __user *) ptr, second, third); break; case MSGRCV: if (!ptr) return -EINVAL; - if (copy_from_user (&tmp, (struct ipc_kludge *) ptr, + if (copy_from_user (&tmp, (struct ipc_kludge __user *) ptr, sizeof (struct ipc_kludge))) return -EFAULT; return sys_msgrcv (first, tmp.msgp, @@ -183,33 +183,33 @@ asmlinkage long sys_ipc (uint call, int first, int second, case MSGGET: return sys_msgget ((key_t) first, second); case MSGCTL: - return sys_msgctl (first, second, (struct msqid_ds *) ptr); - + return sys_msgctl (first, second, (struct msqid_ds __user *) ptr); + case SHMAT: { ulong raddr; - ret = do_shmat (first, (char *) ptr, second, &raddr); + ret = do_shmat (first, (char __user *) ptr, second, &raddr); if (ret) return ret; - return put_user (raddr, (ulong *) third); + return put_user (raddr, (ulong __user *) third); break; } - case SHMDT: - return sys_shmdt ((char *)ptr); + case SHMDT: + return sys_shmdt ((char __user *)ptr); case SHMGET: return sys_shmget (first, second, third); case SHMCTL: return sys_shmctl (first, second, - (struct shmid_ds *) ptr); + (struct shmid_ds __user *) ptr); default: return -ENOSYS; } - + return -EINVAL; } #ifdef CONFIG_ARCH_S390X -asmlinkage long s390x_newuname(struct new_utsname * name) +asmlinkage long s390x_newuname(struct new_utsname __user *name) { int ret = sys_newuname(name); @@ -256,7 +256,7 @@ struct fadvise64_64_args { }; asmlinkage long -s390_fadvise64_64(struct fadvise64_64_args *args) +s390_fadvise64_64(struct fadvise64_64_args __user *args) { struct fadvise64_64_args a; diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index b2e83876f..537700fbe 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -188,7 +188,7 @@ void show_registers(struct pt_regs *regs) printk("%s Code: ", mode); for (i = 0; i < 20; i++) { unsigned char c; - if (__get_user(c, (char *)(regs->psw.addr + i))) { + if (__get_user(c, (char __user *)(regs->psw.addr + i))) { printk(" Bad PSW."); break; } @@ -391,7 +391,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code) local_irq_enable(); if (regs->psw.mask & PSW_MASK_PSTATE) - get_user(*((__u16 *) opcode), location); + get_user(*((__u16 *) opcode), (__u16 __user *)location); else *((__u16 *)opcode)=*((__u16 *)location); if (*((__u16 *)opcode)==S390_BREAKPOINT_U16) diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index 3cf8418ae..a8758b1d2 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile @@ -4,6 +4,6 @@ EXTRA_AFLAGS := -traditional -lib-y += delay.o -lib-$(CONFIG_ARCH_S390_31) += memset.o strcmp.o strcpy.o strncpy.o uaccess.o -lib-$(CONFIG_ARCH_S390X) += memset64.o strcmp64.o strcpy64.o strncpy64.o uaccess64.o +lib-y += delay.o string.o +lib-$(CONFIG_ARCH_S390_31) += uaccess.o +lib-$(CONFIG_ARCH_S390X) += uaccess64.o diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S index ef26df4c9..e8029ef42 100644 --- a/arch/s390/lib/uaccess.S +++ b/arch/s390/lib/uaccess.S @@ -154,46 +154,57 @@ __clear_user_asm: .align 4 .text .globl __strncpy_from_user_asm - # %r2 = dst, %r3 = src, %r4 = count + # %r2 = count, %r3 = dst, %r4 = src __strncpy_from_user_asm: lhi %r0,0 - lhi %r1,1 - lhi %r5,0 -0: mvcp 0(%r1,%r2),0(%r3),%r0 - tm 0(%r2),0xff - jz 1f - la %r2,1(%r2) - la %r3,1(%r3) - ahi %r5,1 - clr %r5,%r4 - jl 0b -1: lr %r2,%r5 + lr %r1,%r4 + la %r4,0(%r4) # clear high order bit from %r4 + la %r2,0(%r2,%r4) # %r2 points to first byte after string + sacf 256 +0: srst %r2,%r1 + jo 0b + sacf 0 + lr %r1,%r2 + jh 1f # \0 found in string ? + ahi %r1,1 # include \0 in copy +1: slr %r1,%r4 # %r1 = copy length (without \0) + slr %r2,%r4 # %r2 = return length (including \0) +2: mvcp 0(%r1,%r3),0(%r4),%r0 + jnz 3f br %r14 -2: lhi %r2,-EFAULT +3: la %r3,256(%r3) + la %r4,256(%r4) + ahi %r1,-256 + mvcp 0(%r1,%r3),0(%r4),%r0 + jnz 3b br %r14 - .section __ex_table,"a" - .long 0b,2b +4: sacf 0 + lhi %r2,-EFAULT + br %r14 + .section __ex_table,"a" + .long 0b,4b .previous .align 4 .text .globl __strnlen_user_asm - # %r2 = src, %r3 = count + # %r2 = count, %r3 = src __strnlen_user_asm: lhi %r0,0 - lhi %r1,1 - lhi %r5,0 -0: mvcp 24(%r1,%r15),0(%r2),%r0 - ahi %r5,1 - tm 24(%r15),0xff - jz 1f - la %r2,1(%r2) - clr %r5,%r3 - jl 0b -1: lr %r2,%r5 + lr %r1,%r3 + la %r3,0(%r3) # clear high order bit from %r4 + la %r2,0(%r2,%r3) # %r2 points to first byte after string + sacf 256 +0: srst %r2,%r1 + jo 0b + sacf 0 + jh 1f # \0 found in string ? + ahi %r2,1 # strnlen_user result includes the \0 +1: slr %r2,%r3 br %r14 -2: lhi %r2,-EFAULT +2: sacf 0 + lhi %r2,-EFAULT br %r14 - .section __ex_table,"a" + .section __ex_table,"a" .long 0b,2b .previous diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S index c12f70a67..0ca56972f 100644 --- a/arch/s390/lib/uaccess64.S +++ b/arch/s390/lib/uaccess64.S @@ -152,46 +152,55 @@ __clear_user_asm: .align 4 .text .globl __strncpy_from_user_asm - # %r2 = dst, %r3 = src, %r4 = count + # %r2 = count, %r3 = dst, %r4 = src __strncpy_from_user_asm: lghi %r0,0 - lghi %r1,1 - lghi %r5,0 -0: mvcp 0(%r1,%r2),0(%r3),%r0 - tm 0(%r2),0xff - jz 1f - la %r2,1(%r2) - la %r3,1(%r3) - aghi %r5,1 - clgr %r5,%r4 - jl 0b -1: lgr %r2,%r5 + lgr %r1,%r4 + la %r2,0(%r2,%r4) # %r2 points to first byte after string + sacf 256 +0: srst %r2,%r1 + jo 0b + sacf 0 + lgr %r1,%r2 + jh 1f # \0 found in string ? + aghi %r1,1 # include \0 in copy +1: slgr %r1,%r4 # %r1 = copy length (without \0) + slgr %r2,%r4 # %r2 = return length (including \0) +2: mvcp 0(%r1,%r3),0(%r4),%r0 + jnz 3f br %r14 -2: lghi %r2,-EFAULT +3: la %r3,256(%r3) + la %r4,256(%r4) + aghi %r1,-256 + mvcp 0(%r1,%r3),0(%r4),%r0 + jnz 3b br %r14 - .section __ex_table,"a" - .quad 0b,2b +4: sacf 0 + lghi %r2,-EFAULT + br %r14 + .section __ex_table,"a" + .quad 0b,4b .previous .align 4 .text .globl __strnlen_user_asm - # %r2 = src, %r3 = count + # %r2 = count, %r3 = src __strnlen_user_asm: lghi %r0,0 - lghi %r1,1 - lghi %r5,0 -0: mvcp 24(%r1,%r15),0(%r2),%r0 - aghi %r5,1 - tm 24(%r15),0xff - jz 1f - la %r2,1(%r2) - clgr %r5,%r3 - jl 0b -1: lgr %r2,%r5 + lgr %r1,%r3 + la %r2,0(%r2,%r3) # %r2 points to first byte after string + sacf 256 +0: srst %r2,%r1 + jo 0b + sacf 0 + jh 1f # \0 found in string ? + aghi %r2,1 # strnlen_user result includes the \0 +1: slgr %r2,%r3 br %r14 -2: lghi %r2,-EFAULT +2: sacf 0 + lghi %r2,-EFAULT br %r14 - .section __ex_table,"a" + .section __ex_table,"a" .quad 0b,2b .previous diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c index ea3db122d..b0b2714ea 100644 --- a/arch/s390/mm/extmem.c +++ b/arch/s390/mm/extmem.c @@ -55,7 +55,9 @@ struct dcss_segment { static spinlock_t dcss_lock = SPIN_LOCK_UNLOCKED; static struct list_head dcss_list = LIST_HEAD_INIT(dcss_list); -extern struct {unsigned long addr, size, type;} memory_chunk[16]; +extern struct { + unsigned long addr, size, type; +} memory_chunk[MEMORY_CHUNKS]; /* * Create the 8 bytes, ebcdic VM segment name from @@ -258,16 +260,16 @@ int segment_load(char *name, int segtype, unsigned long *addr, shared segment */ dcss_diag_query(dcss_name, &rwattr, &shattr, &segstart, &segend); /* does segment collide with main memory? */ - for (i=0; i<16; i++) { - if (memory_chunk[i].type != 0) - continue; - if (memory_chunk[i].addr > segend) - continue; - if (memory_chunk[i].addr + memory_chunk[i].size <= segstart) - continue; - spin_unlock(&dcss_lock); - return -ENOENT; - } + for (i=0; i < MEMORY_CHUNKS; i++) { + if (memory_chunk[i].type != 0) + continue; + if (memory_chunk[i].addr > segend) + continue; + if (memory_chunk[i].addr + memory_chunk[i].size <= segstart) + continue; + spin_unlock(&dcss_lock); + return -ENOENT; + } /* or does it collide with other (loaded) segments? */ list_for_each(l, &dcss_list) { tmp = list_entry(l, struct dcss_segment, list); diff --git a/arch/s390/mm/ioremap.c b/arch/s390/mm/ioremap.c index b0e1ba5c4..c6c39d868 100644 --- a/arch/s390/mm/ioremap.c +++ b/arch/s390/mm/ioremap.c @@ -134,5 +134,5 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag void iounmap(void *addr) { if (addr > high_memory) - return vfree(addr); + vfree(addr); } diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c index 469a988d4..44053ea92 100644 --- a/arch/sh/kernel/init_task.c +++ b/arch/sh/kernel/init_task.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c index 0b29e5fa1..af81a999f 100644 --- a/arch/sparc/kernel/init_task.c +++ b/arch/sparc/kernel/init_task.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,6 @@ EXPORT_SYMBOL(init_task); * in etrap.S which assumes it. */ union thread_union init_thread_union - __attribute__((section (".text"))) + __attribute__((section (".text,#alloc"))) __attribute__((aligned (THREAD_SIZE))) = { INIT_THREAD_INFO(init_task) }; diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned.c index 3a1ccaccb..a9a9e0c73 100644 --- a/arch/sparc/kernel/unaligned.c +++ b/arch/sparc/kernel/unaligned.c @@ -137,8 +137,8 @@ static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *re return &win->locals[reg - 16]; } -static inline unsigned long compute_effective_address(struct pt_regs *regs, - unsigned int insn) +static unsigned long compute_effective_address(struct pt_regs *regs, + unsigned int insn) { unsigned int rs1 = (insn >> 14) & 0x1f; unsigned int rs2 = insn & 0x1f; @@ -153,8 +153,8 @@ static inline unsigned long compute_effective_address(struct pt_regs *regs, } } -static inline unsigned long safe_compute_effective_address(struct pt_regs *regs, - unsigned int insn) +unsigned long safe_compute_effective_address(struct pt_regs *regs, + unsigned int insn) { unsigned int rs1 = (insn >> 14) & 0x1f; unsigned int rs2 = insn & 0x1f; diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c index 44db33516..cc857f681 100644 --- a/arch/sparc/mm/fault.c +++ b/arch/sparc/mm/fault.c @@ -201,6 +201,25 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc, return 0; } +extern unsigned long safe_compute_effective_address(struct pt_regs *, + unsigned int); + +static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) +{ + unsigned int insn; + + if (text_fault) + return regs->pc; + + if (regs->psr & PSR_PS) { + insn = *(unsigned int *) regs->pc; + } else { + __get_user(insn, (unsigned int *) regs->pc); + } + + return safe_compute_effective_address(regs, insn); +} + asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, unsigned long address) { @@ -307,7 +326,7 @@ bad_area_nosemaphore: info.si_errno = 0; /* info.si_code set above to make clear whether this was a SEGV_MAPERR or SEGV_ACCERR fault. */ - info.si_addr = (void *)address; + info.si_addr = (void *) compute_si_addr(regs, text_fault); info.si_trapno = 0; force_sig_info (SIGSEGV, &info, tsk); return; @@ -361,7 +380,7 @@ do_sigbus: info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRERR; - info.si_addr = (void *)address; + info.si_addr = (void *) compute_si_addr(regs, text_fault); info.si_trapno = 0; force_sig_info (SIGBUS, &info, tsk); if (!from_user) @@ -530,7 +549,7 @@ bad_area: info.si_errno = 0; /* info.si_code set above to make clear whether this was a SEGV_MAPERR or SEGV_ACCERR fault. */ - info.si_addr = (void *)address; + info.si_addr = (void *) address; info.si_trapno = 0; force_sig_info (SIGSEGV, &info, tsk); return; @@ -540,7 +559,7 @@ do_sigbus: info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRERR; - info.si_addr = (void *)address; + info.si_addr = (void *) address; info.si_trapno = 0; force_sig_info (SIGBUS, &info, tsk); } diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 810a7ed25..45469d2f6 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -174,7 +174,7 @@ static inline int srmmu_pmd_present(pmd_t pmd) static inline void srmmu_pmd_clear(pmd_t *pmdp) { int i; - for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++) + for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) srmmu_set_pte((pte_t *)&pmdp->pmdv[i], __pte(0)); } @@ -234,9 +234,9 @@ static void srmmu_pmd_set(pmd_t *pmdp, pte_t *ptep) int i; ptp = __nocache_pa((unsigned long) ptep) >> 4; - for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++) { + for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); - ptp += (SRMMU_PTRS_PER_PTE*sizeof(pte_t) >> 4); + ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); } } @@ -246,9 +246,9 @@ static void srmmu_pmd_populate(pmd_t *pmdp, struct page *ptep) int i; ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4); /* watch for overflow */ - for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++) { + for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); - ptp += (SRMMU_PTRS_PER_PTE*sizeof(pte_t) >> 4); + ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); } } @@ -263,7 +263,7 @@ extern inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long addre static inline pmd_t *srmmu_pmd_offset(pgd_t * dir, unsigned long address) { return (pmd_t *) srmmu_pgd_page(*dir) + - ((address >> SRMMU_PMD_SHIFT_SOFT) & (SRMMU_PTRS_PER_PMD_SOFT - 1)); + ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1)); } /* Find an entry in the third-level page table.. */ @@ -273,7 +273,7 @@ static inline pte_t *srmmu_pte_offset(pmd_t * dir, unsigned long address) pte = __nocache_va((dir->pmdv[0] & SRMMU_PTD_PMASK) << 4); return (pte_t *) pte + - ((address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE_SOFT - 1)); + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } static unsigned long srmmu_swp_type(swp_entry_t entry) @@ -487,7 +487,7 @@ static void srmmu_pmd_free(pmd_t * pmd) static pte_t * srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { - return (pte_t *)srmmu_get_nocache(SRMMU_PTE_SZ_SOFT, SRMMU_PTE_SZ_SOFT); + return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE); } static struct page * @@ -502,7 +502,7 @@ srmmu_pte_alloc_one(struct mm_struct *mm, unsigned long address) static void srmmu_free_pte_fast(pte_t *pte) { - srmmu_free_nocache((unsigned long)pte, SRMMU_PTE_SZ_SOFT); + srmmu_free_nocache((unsigned long)pte, PTE_SIZE); } static void srmmu_pte_free(struct page *pte) @@ -514,7 +514,7 @@ static void srmmu_pte_free(struct page *pte) BUG(); p = page_to_pfn(pte) << PAGE_SHIFT; /* Physical address */ p = (unsigned long) __nocache_va(p); /* Nocached virtual */ - srmmu_free_nocache(p, SRMMU_PTE_SZ_SOFT); + srmmu_free_nocache(p, PTE_SIZE); } /* @@ -829,7 +829,7 @@ static void cypress_flush_cache_range(struct vm_area_struct *vma, unsigned long a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0; - start &= SRMMU_PMD_MASK; + start &= SRMMU_REAL_PMD_MASK; while(start < end) { faddr = (start + (0x10000 - 0x100)); goto inside; @@ -849,7 +849,7 @@ static void cypress_flush_cache_range(struct vm_area_struct *vma, unsigned long "r" (a), "r" (b), "r" (c), "r" (d), "r" (e), "r" (f), "r" (g)); } while (faddr != start); - start += SRMMU_PMD_SIZE; + start += SRMMU_REAL_PMD_SIZE; } srmmu_set_context(octx); local_irq_restore(flags); @@ -1067,16 +1067,15 @@ void __init srmmu_early_allocate_ptable_skeleton(unsigned long start, unsigned l } pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { - ptep = (pte_t *)__srmmu_get_nocache(SRMMU_PTE_SZ_SOFT, - SRMMU_PTE_SZ_SOFT); + ptep = (pte_t *)__srmmu_get_nocache(PTE_SIZE, PTE_SIZE); if (ptep == NULL) early_pgtable_allocfail("pte"); - memset(__nocache_fix(ptep), 0, SRMMU_PTE_SZ_SOFT); + memset(__nocache_fix(ptep), 0, PTE_SIZE); srmmu_pmd_set(__nocache_fix(pmdp), ptep); } - if (start > (0xffffffffUL - SRMMU_PMD_SIZE_SOFT)) + if (start > (0xffffffffUL - PMD_SIZE)) break; - start = (start + SRMMU_PMD_SIZE_SOFT) & SRMMU_PMD_MASK_SOFT; + start = (start + PMD_SIZE) & PMD_MASK; } } @@ -1097,16 +1096,16 @@ void __init srmmu_allocate_ptable_skeleton(unsigned long start, unsigned long en } pmdp = srmmu_pmd_offset(pgdp, start); if(srmmu_pmd_none(*pmdp)) { - ptep = (pte_t *) __srmmu_get_nocache(SRMMU_PTE_SZ_SOFT, - SRMMU_PTE_SZ_SOFT); + ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE, + PTE_SIZE); if (ptep == NULL) early_pgtable_allocfail("pte"); - memset(ptep, 0, SRMMU_PTE_SZ_SOFT); + memset(ptep, 0, PTE_SIZE); srmmu_pmd_set(pmdp, ptep); } - if (start > (0xffffffffUL - SRMMU_PMD_SIZE_SOFT)) + if (start > (0xffffffffUL - PMD_SIZE)) break; - start = (start + SRMMU_PMD_SIZE_SOFT) & SRMMU_PMD_MASK_SOFT; + start = (start + PMD_SIZE) & PMD_MASK; } } @@ -1136,8 +1135,8 @@ void __init srmmu_inherit_prom_mappings(unsigned long start,unsigned long end) /* A red snapper, see what it really is. */ what = 0; - if(!(start & ~(SRMMU_PMD_MASK))) { - if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_PMD_SIZE) == prompte) + if(!(start & ~(SRMMU_REAL_PMD_MASK))) { + if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_REAL_PMD_SIZE) == prompte) what = 1; } @@ -1162,11 +1161,11 @@ void __init srmmu_inherit_prom_mappings(unsigned long start,unsigned long end) } pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { - ptep = (pte_t *) __srmmu_get_nocache(SRMMU_PTE_SZ_SOFT, - SRMMU_PTE_SZ_SOFT); + ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE, + PTE_SIZE); if (ptep == NULL) early_pgtable_allocfail("pte"); - memset(__nocache_fix(ptep), 0, SRMMU_PTE_SZ_SOFT); + memset(__nocache_fix(ptep), 0, PTE_SIZE); srmmu_pmd_set(__nocache_fix(pmdp), ptep); } if(what == 1) { @@ -1176,9 +1175,9 @@ void __init srmmu_inherit_prom_mappings(unsigned long start,unsigned long end) * good hardware PTE piece. Alternatives seem worse. */ unsigned int x; /* Index of HW PMD in soft cluster */ - x = (start >> SRMMU_PMD_SHIFT) & 15; + x = (start >> PMD_SHIFT) & 15; *(unsigned long *)__nocache_fix(&pmdp->pmdv[x]) = prompte; - start += SRMMU_PMD_SIZE; + start += SRMMU_REAL_PMD_SIZE; continue; } ptep = srmmu_pte_offset(__nocache_fix(pmdp), start); @@ -2139,16 +2138,11 @@ void __init ld_mmu_srmmu(void) extern void ld_mmu_iounit(void); extern void ___xchg32_sun4md(void); - BTFIXUPSET_SIMM13(pmd_shift, SRMMU_PMD_SHIFT_SOFT); - BTFIXUPSET_SETHI(pmd_size, SRMMU_PMD_SIZE_SOFT); - BTFIXUPSET_SETHI(pmd_mask, SRMMU_PMD_MASK_SOFT); - BTFIXUPSET_SIMM13(pgdir_shift, SRMMU_PGDIR_SHIFT); BTFIXUPSET_SETHI(pgdir_size, SRMMU_PGDIR_SIZE); BTFIXUPSET_SETHI(pgdir_mask, SRMMU_PGDIR_MASK); - BTFIXUPSET_SIMM13(ptrs_per_pte, SRMMU_PTRS_PER_PTE_SOFT); - BTFIXUPSET_SIMM13(ptrs_per_pmd, SRMMU_PTRS_PER_PMD_SOFT); + BTFIXUPSET_SIMM13(ptrs_per_pmd, SRMMU_PTRS_PER_PMD); BTFIXUPSET_SIMM13(ptrs_per_pgd, SRMMU_PTRS_PER_PGD); BTFIXUPSET_INT(page_none, pgprot_val(SRMMU_PAGE_NONE)); diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 4b9fc1d67..f169a4838 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -2137,14 +2137,10 @@ void __init ld_mmu_sun4c(void) printk("Loading sun4c MMU routines\n"); /* First the constants */ - BTFIXUPSET_SIMM13(pmd_shift, SUN4C_PMD_SHIFT); - BTFIXUPSET_SETHI(pmd_size, SUN4C_PMD_SIZE); - BTFIXUPSET_SETHI(pmd_mask, SUN4C_PMD_MASK); BTFIXUPSET_SIMM13(pgdir_shift, SUN4C_PGDIR_SHIFT); BTFIXUPSET_SETHI(pgdir_size, SUN4C_PGDIR_SIZE); BTFIXUPSET_SETHI(pgdir_mask, SUN4C_PGDIR_MASK); - BTFIXUPSET_SIMM13(ptrs_per_pte, SUN4C_PTRS_PER_PTE); BTFIXUPSET_SIMM13(ptrs_per_pmd, SUN4C_PTRS_PER_PMD); BTFIXUPSET_SIMM13(ptrs_per_pgd, SUN4C_PTRS_PER_PGD); BTFIXUPSET_SIMM13(user_ptrs_per_pgd, KERNBASE / SUN4C_PGDIR_SIZE); diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 3891ac582..dfedd7e73 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -233,7 +233,6 @@ CONFIG_BLK_DEV_IDE=y # CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set -# CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECD=y CONFIG_BLK_DEV_IDETAPE=m # CONFIG_BLK_DEV_IDEFLOPPY is not set @@ -342,7 +341,6 @@ CONFIG_SCSI_SATA_SIS=m CONFIG_SCSI_SATA_VIA=m CONFIG_SCSI_SATA_VITESSE=m # CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CPQFCTS is not set CONFIG_SCSI_DMX3191D=m # CONFIG_SCSI_EATA is not set CONFIG_SCSI_EATA_PIO=m @@ -864,9 +862,8 @@ CONFIG_VIA_RHINE=m # CONFIG_VIA_RHINE_MMIO is not set # -# Gigabit Ethernet (1000/10000 Mbit) +# Ethernet (1000 Mbit) # -CONFIG_NET_GIGE=y CONFIG_ACENIC=m # CONFIG_ACENIC_OMIT_TIGON_I is not set CONFIG_DL2K=m @@ -879,6 +876,10 @@ CONFIG_YELLOWFIN=m CONFIG_R8169=m CONFIG_SK98LIN=m CONFIG_TIGON3=m + +# +# Ethernet (10000 Mbit) +# CONFIG_IXGB=m CONFIG_IXGB_NAPI=y CONFIG_S2IO=m @@ -1584,6 +1585,7 @@ CONFIG_USB_HPUSBSCSI=m # CONFIG_USB_IBMCAM is not set # CONFIG_USB_KONICAWC is not set # CONFIG_USB_OV511 is not set +CONFIG_USB_PWC=m # CONFIG_USB_SE401 is not set # CONFIG_USB_STV680 is not set CONFIG_USB_W9968CF=m diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c index 6e39a101f..2296525af 100644 --- a/arch/sparc64/kernel/chmc.c +++ b/arch/sparc64/kernel/chmc.c @@ -243,8 +243,9 @@ int chmc_getunumber(int syndrome_code, static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset) { unsigned long ret; + int this_cpu = get_cpu(); - if (mp->portid == smp_processor_id()) { + if (mp->portid == this_cpu) { __asm__ __volatile__("ldxa [%1] %2, %0" : "=r" (ret) : "r" (offset), "i" (ASI_MCU_CTRL_REG)); @@ -254,6 +255,8 @@ static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset) : "r" (mp->regs + offset), "i" (ASI_PHYS_BYPASS_EC_E)); } + put_cpu(); + return ret; } diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc64/kernel/init_task.c index e4525064b..329b38fa5 100644 --- a/arch/sparc64/kernel/init_task.c +++ b/arch/sparc64/kernel/init_task.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 9a48757d3..b7f6a1eb9 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -174,6 +174,8 @@ void enable_irq(unsigned int irq) if (imap == 0UL) return; + preempt_disable(); + if (tlb_type == cheetah || tlb_type == cheetah_plus) { unsigned long ver; @@ -214,6 +216,8 @@ void enable_irq(unsigned int irq) * Things like FFB can now be handled via the new IRQ mechanism. */ upa_writel(tid | IMAP_VALID, imap); + + preempt_enable(); } /* This now gets passed true ino's as well. */ diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 040323b38..64b873212 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -547,15 +547,18 @@ retry: static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, cpumask_t mask) { u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff)); + int this_cpu = get_cpu(); cpus_and(mask, mask, cpu_online_map); - cpu_clear(smp_processor_id(), mask); + cpu_clear(this_cpu, mask); if (tlb_type == spitfire) spitfire_xcall_deliver(data0, data1, data2, mask); else cheetah_xcall_deliver(data0, data1, data2, mask); /* NOTE: Caller runs local copy on master. */ + + put_cpu(); } extern unsigned long xcall_sync_tick; @@ -685,11 +688,12 @@ static __inline__ void __local_flush_dcache_page(struct page *page) void smp_flush_dcache_page_impl(struct page *page, int cpu) { cpumask_t mask = cpumask_of_cpu(cpu); + int this_cpu = get_cpu(); #ifdef CONFIG_DEBUG_DCFLUSH atomic_inc(&dcpage_flushes); #endif - if (cpu == smp_processor_id()) { + if (cpu == this_cpu) { __local_flush_dcache_page(page); } else if (cpu_online(cpu)) { u64 data0; @@ -714,14 +718,17 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu) atomic_inc(&dcpage_flushes_xcall); #endif } + + put_cpu(); } void flush_dcache_page_all(struct mm_struct *mm, struct page *page) { cpumask_t mask = cpu_online_map; u64 data0; + int this_cpu = get_cpu(); - cpu_clear(smp_processor_id(), mask); + cpu_clear(this_cpu, mask); #ifdef CONFIG_DEBUG_DCFLUSH atomic_inc(&dcpage_flushes); @@ -747,6 +754,8 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page) #endif flush_self: __local_flush_dcache_page(page); + + put_cpu(); } void smp_receive_signal(int cpu) @@ -842,7 +851,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm) { u32 ctx = CTX_HWBITS(mm->context); - int cpu = smp_processor_id(); + int cpu = get_cpu(); if (atomic_read(&mm->mm_users) == 1) { /* See smp_flush_tlb_page for info about this. */ @@ -856,6 +865,8 @@ void smp_flush_tlb_mm(struct mm_struct *mm) local_flush_and_out: __flush_tlb_mm(ctx, SECONDARY_CONTEXT); + + put_cpu(); } } @@ -863,7 +874,7 @@ void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end) { u32 ctx = CTX_HWBITS(mm->context); - int cpu = smp_processor_id(); + int cpu = get_cpu(); start &= PAGE_MASK; end = PAGE_ALIGN(end); @@ -880,6 +891,8 @@ void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, local_flush_and_out: __flush_tlb_range(ctx, start, SECONDARY_CONTEXT, end, PAGE_SIZE, (end-start)); + + put_cpu(); } void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end) @@ -898,7 +911,7 @@ void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page) { { u32 ctx = CTX_HWBITS(mm->context); - int cpu = smp_processor_id(); + int cpu = get_cpu(); page &= PAGE_MASK; if (mm == current->active_mm && @@ -938,6 +951,8 @@ void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page) local_flush_and_out: __flush_tlb_page(ctx, page, SECONDARY_CONTEXT); + + put_cpu(); } } diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index ea2c0e3b0..10c782137 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -189,6 +189,11 @@ EXPORT_SYMBOL(___test_and_change_bit); EXPORT_SYMBOL(___test_and_set_le_bit); EXPORT_SYMBOL(___test_and_clear_le_bit); +/* Bit searching */ +EXPORT_SYMBOL(find_next_bit); +EXPORT_SYMBOL(find_next_zero_bit); +EXPORT_SYMBOL(find_next_zero_le_bit); + EXPORT_SYMBOL(ivector_table); EXPORT_SYMBOL(enable_irq); EXPORT_SYMBOL(disable_irq); diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S index 95e3d3ace..7a5d4f4e5 100644 --- a/arch/sparc64/kernel/sys32.S +++ b/arch/sparc64/kernel/sys32.S @@ -91,7 +91,7 @@ SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) SIGN1(sys32_select, compat_sys_select, %o0) SIGN1(sys32_mkdir, sys_mkdir, %o1) -SIGN2(sys32_futex, compat_sys_futex, %o1, %o2) +SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) SIGN1(sys32_sysfs, compat_sys_sysfs, %o0) SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3) SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1) diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index c1c064021..0ed11eaec 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -800,8 +800,8 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) } /* So stupid... */ -extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int, - struct compat_rusage *); +extern long compat_sys_wait4(compat_pid_t, compat_uint_t __user *, int, + struct compat_rusage __user *); asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru) { diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c index 5b664354e..646a788fa 100644 --- a/arch/sparc64/kernel/unaligned.c +++ b/arch/sparc64/kernel/unaligned.c @@ -158,8 +158,8 @@ static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs) } } -static unsigned long compute_effective_address(struct pt_regs *regs, - unsigned int insn, unsigned int rd) +unsigned long compute_effective_address(struct pt_regs *regs, + unsigned int insn, unsigned int rd) { unsigned int rs1 = (insn >> 14) & 0x1f; unsigned int rs2 = insn & 0x1f; diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile index 14a4c728b..230e59f18 100644 --- a/arch/sparc64/lib/Makefile +++ b/arch/sparc64/lib/Makefile @@ -10,7 +10,8 @@ lib-y := PeeCeeI.o blockops.o strlen.o strncmp.o \ VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o \ VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o \ U3memcpy.o U3copy_from_user.o U3copy_to_user.o \ - U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o splock.o + U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o splock.o \ + find_bit.o lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff --git a/arch/sparc64/lib/debuglocks.c b/arch/sparc64/lib/debuglocks.c index 7b68a4deb..9e083e27d 100644 --- a/arch/sparc64/lib/debuglocks.c +++ b/arch/sparc64/lib/debuglocks.c @@ -55,7 +55,7 @@ void _do_spin_lock(spinlock_t *lock, char *str) { unsigned long caller, val; int stuck = INIT_STUCK; - int cpu = smp_processor_id(); + int cpu = get_cpu(); int shown = 0; GET_CALLER(caller); @@ -80,12 +80,14 @@ again: lock->owner_cpu = cpu; current->thread.smp_lock_count++; current->thread.smp_lock_pc = ((unsigned int)caller); + + put_cpu(); } int _spin_trylock(spinlock_t *lock) { unsigned long val, caller; - int cpu = smp_processor_id(); + int cpu = get_cpu(); GET_CALLER(caller); __asm__ __volatile__("ldstub [%1], %0" @@ -99,6 +101,9 @@ int _spin_trylock(spinlock_t *lock) current->thread.smp_lock_count++; current->thread.smp_lock_pc = ((unsigned int)caller); } + + put_cpu(); + return val == 0; } @@ -117,7 +122,7 @@ void _do_read_lock (rwlock_t *rw, char *str) { unsigned long caller, val; int stuck = INIT_STUCK; - int cpu = smp_processor_id(); + int cpu = get_cpu(); int shown = 0; GET_CALLER(caller); @@ -148,13 +153,15 @@ wlock_again: rw->reader_pc[cpu] = ((unsigned int)caller); current->thread.smp_lock_count++; current->thread.smp_lock_pc = ((unsigned int)caller); + + put_cpu(); } void _do_read_unlock (rwlock_t *rw, char *str) { unsigned long caller, val; int stuck = INIT_STUCK; - int cpu = smp_processor_id(); + int cpu = get_cpu(); int shown = 0; GET_CALLER(caller); @@ -181,13 +188,15 @@ runlock_again: } goto runlock_again; } + + put_cpu(); } void _do_write_lock (rwlock_t *rw, char *str) { unsigned long caller, val; int stuck = INIT_STUCK; - int cpu = smp_processor_id(); + int cpu = get_cpu(); int shown = 0; GET_CALLER(caller); @@ -263,6 +272,8 @@ wlock_again: rw->writer_cpu = cpu; current->thread.smp_lock_count++; current->thread.smp_lock_pc = ((unsigned int)caller); + + put_cpu(); } void _do_write_unlock(rwlock_t *rw) @@ -302,7 +313,7 @@ wlock_again: int _do_write_trylock (rwlock_t *rw, char *str) { unsigned long caller, val; - int cpu = smp_processor_id(); + int cpu = get_cpu(); GET_CALLER(caller); @@ -322,8 +333,10 @@ int _do_write_trylock (rwlock_t *rw, char *str) : "0" (&(rw->lock)) : "g3", "g5", "g7", "memory"); - if (val) + if (val) { + put_cpu(); return 0; + } if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) { /* Readers still around, drop the write @@ -342,6 +355,8 @@ int _do_write_trylock (rwlock_t *rw, char *str) : "r" (&(rw->lock)) : "g3", "g5", "g7", "cc", "memory"); + put_cpu(); + return 0; } @@ -351,6 +366,8 @@ int _do_write_trylock (rwlock_t *rw, char *str) current->thread.smp_lock_count++; current->thread.smp_lock_pc = ((unsigned int)caller); + put_cpu(); + return 1; } diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc64/math-emu/sfp-util.h index bdde3da0f..31e474738 100644 --- a/arch/sparc64/math-emu/sfp-util.h +++ b/arch/sparc64/math-emu/sfp-util.h @@ -11,106 +11,106 @@ #include #include -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addcc %4,%5,%1\n\ - add %2,%3,%0\n\ - bcs,a,pn %%xcc, 1f\n\ - add %0, 1, %0\n\ - 1:" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)) \ - : "r" ((UDItype)(ah)), \ - "r" ((UDItype)(bh)), \ - "r" ((UDItype)(al)), \ - "r" ((UDItype)(bl)) \ +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + __asm__ ("addcc %4,%5,%1\n\t" \ + "add %2,%3,%0\n\t" \ + "bcs,a,pn %%xcc, 1f\n\t" \ + "add %0, 1, %0\n" \ + "1:" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)) \ + : "r" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "r" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ : "cc") -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subcc %4,%5,%1\n\ - sub %2,%3,%0\n\ - bcs,a,pn %%xcc, 1f\n\ - sub %0, 1, %0\n\ - 1:" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)) \ - : "r" ((UDItype)(ah)), \ - "r" ((UDItype)(bh)), \ - "r" ((UDItype)(al)), \ - "r" ((UDItype)(bl)) \ +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("subcc %4,%5,%1\n\t" \ + "sub %2,%3,%0\n\t" \ + "bcs,a,pn %%xcc, 1f\n\t" \ + "sub %0, 1, %0\n" \ + "1:" \ + : "=r" ((UDItype)(sh)), \ + "=&r" ((UDItype)(sl)) \ + : "r" ((UDItype)(ah)), \ + "r" ((UDItype)(bh)), \ + "r" ((UDItype)(al)), \ + "r" ((UDItype)(bl)) \ : "cc") -#define umul_ppmm(wh, wl, u, v) \ - do { \ - UDItype tmp1, tmp2, tmp3, tmp4; \ - __asm__ __volatile__ ( \ - "srl %7,0,%3\n\ - mulx %3,%6,%1\n\ - srlx %6,32,%2\n\ - mulx %2,%3,%4\n\ - sllx %4,32,%5\n\ - srl %6,0,%3\n\ - sub %1,%5,%5\n\ - srlx %5,32,%5\n\ - addcc %4,%5,%4\n\ - srlx %7,32,%5\n\ - mulx %3,%5,%3\n\ - mulx %2,%5,%5\n\ - sethi %%hi(0x80000000),%2\n\ - addcc %4,%3,%4\n\ - srlx %4,32,%4\n\ - add %2,%2,%2\n\ - movcc %%xcc,%%g0,%2\n\ - addcc %5,%4,%5\n\ - sllx %3,32,%3\n\ - add %1,%3,%1\n\ - add %5,%2,%0" \ - : "=r" ((UDItype)(wh)), \ - "=&r" ((UDItype)(wl)), \ - "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ - : "r" ((UDItype)(u)), \ - "r" ((UDItype)(v)) \ - : "cc"); \ +#define umul_ppmm(wh, wl, u, v) \ + do { \ + UDItype tmp1, tmp2, tmp3, tmp4; \ + __asm__ __volatile__ ( \ + "srl %7,0,%3\n\t" \ + "mulx %3,%6,%1\n\t" \ + "srlx %6,32,%2\n\t" \ + "mulx %2,%3,%4\n\t" \ + "sllx %4,32,%5\n\t" \ + "srl %6,0,%3\n\t" \ + "sub %1,%5,%5\n\t" \ + "srlx %5,32,%5\n\t" \ + "addcc %4,%5,%4\n\t" \ + "srlx %7,32,%5\n\t" \ + "mulx %3,%5,%3\n\t" \ + "mulx %2,%5,%5\n\t" \ + "sethi %%hi(0x80000000),%2\n\t" \ + "addcc %4,%3,%4\n\t" \ + "srlx %4,32,%4\n\t" \ + "add %2,%2,%2\n\t" \ + "movcc %%xcc,%%g0,%2\n\t" \ + "addcc %5,%4,%5\n\t" \ + "sllx %3,32,%3\n\t" \ + "add %1,%3,%1\n\t" \ + "add %5,%2,%0" \ + : "=r" ((UDItype)(wh)), \ + "=&r" ((UDItype)(wl)), \ + "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ + : "r" ((UDItype)(u)), \ + "r" ((UDItype)(v)) \ + : "cc"); \ } while (0) -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ - __d1 = (d >> 32); \ - __d0 = (USItype)d; \ - \ - __r1 = (n1) % __d1; \ - __q1 = (n1) / __d1; \ - __m = (UWtype) __q1 * __d0; \ - __r1 = (__r1 << 32) | (n0 >> 32); \ - if (__r1 < __m) \ - { \ - __q1--, __r1 += (d); \ - if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \ - if (__r1 < __m) \ - __q1--, __r1 += (d); \ - } \ - __r1 -= __m; \ - \ - __r0 = __r1 % __d1; \ - __q0 = __r1 / __d1; \ - __m = (UWtype) __q0 * __d0; \ - __r0 = (__r0 << 32) | ((USItype)n0); \ - if (__r0 < __m) \ - { \ - __q0--, __r0 += (d); \ - if (__r0 >= (d)) \ - if (__r0 < __m) \ - __q0--, __r0 += (d); \ - } \ - __r0 -= __m; \ - \ - (q) = (UWtype) (__q1 << 32) | __q0; \ - (r) = __r0; \ +#define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ + __d1 = (d >> 32); \ + __d0 = (USItype)d; \ + \ + __r1 = (n1) % __d1; \ + __q1 = (n1) / __d1; \ + __m = (UWtype) __q1 * __d0; \ + __r1 = (__r1 << 32) | (n0 >> 32); \ + if (__r1 < __m) \ + { \ + __q1--, __r1 += (d); \ + if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \ + if (__r1 < __m) \ + __q1--, __r1 += (d); \ + } \ + __r1 -= __m; \ + \ + __r0 = __r1 % __d1; \ + __q0 = __r1 / __d1; \ + __m = (UWtype) __q0 * __d0; \ + __r0 = (__r0 << 32) | ((USItype)n0); \ + if (__r0 < __m) \ + { \ + __q0--, __r0 += (d); \ + if (__r0 >= (d)) \ + if (__r0 < __m) \ + __q0--, __r0 += (d); \ + } \ + __r0 -= __m; \ + \ + (q) = (UWtype) (__q1 << 32) | __q0; \ + (r) = __r0; \ } while (0) #define UDIV_NEEDS_NORMALIZATION 1 -#define abort() \ +#define abort() \ return 0 #ifdef __BIG_ENDIAN diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 348f206f0..5fc4644aa 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -207,14 +207,21 @@ outret: return insn; } -static void do_fault_siginfo(int code, int sig, unsigned long address) +extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); + +static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, + unsigned int insn, int fault_code) { siginfo_t info; info.si_code = code; info.si_signo = sig; info.si_errno = 0; - info.si_addr = (void *) address; + if (fault_code & FAULT_CODE_ITLB) + info.si_addr = (void *) regs->tpc; + else + info.si_addr = (void *) + compute_effective_address(regs, insn, 0); info.si_trapno = 0; force_sig_info(sig, &info, current); } @@ -295,7 +302,7 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, /* The si_code was set to make clear whether * this was a SEGV_MAPERR or SEGV_ACCERR fault. */ - do_fault_siginfo(si_code, SIGSEGV, address); + do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code); return; } @@ -471,7 +478,7 @@ do_sigbus: * Send a sigbus, regardless of whether we were in kernel * or user mode. */ - do_fault_siginfo(BUS_ADRERR, SIGBUS, address); + do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code); /* Kernel mode? Handle exceptions or die */ if (regs->tstate & TSTATE_PRIV) diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 1e9519db0..043861f31 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -152,9 +152,9 @@ __inline__ void flush_dcache_page_impl(struct page *page) #define dcache_dirty_cpu(page) \ (((page)->flags >> 24) & (NR_CPUS - 1UL)) -static __inline__ void set_dcache_dirty(struct page *page) +static __inline__ void set_dcache_dirty(struct page *page, int this_cpu) { - unsigned long mask = smp_processor_id(); + unsigned long mask = this_cpu; unsigned long non_cpu_bits = ~((NR_CPUS - 1UL) << 24UL); mask = (mask << 24) | (1UL << PG_dcache_dirty); __asm__ __volatile__("1:\n\t" @@ -206,16 +206,19 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t p (page = pfn_to_page(pfn), page_mapping(page)) && ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) { int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL)); + int this_cpu = get_cpu(); /* This is just to optimize away some function calls * in the SMP case. */ - if (cpu == smp_processor_id()) + if (cpu == this_cpu) flush_dcache_page_impl(page); else smp_flush_dcache_page_impl(page, cpu); clear_dcache_dirty_cpu(page, cpu); + + put_cpu(); } if (get_thread_fault_code()) __update_mmu_cache(vma->vm_mm->context & TAG_CONTEXT_BITS, @@ -227,14 +230,15 @@ void flush_dcache_page(struct page *page) struct address_space *mapping = page_mapping(page); int dirty = test_bit(PG_dcache_dirty, &page->flags); int dirty_cpu = dcache_dirty_cpu(page); + int this_cpu = get_cpu(); if (mapping && !mapping_mapped(mapping)) { if (dirty) { - if (dirty_cpu == smp_processor_id()) - return; + if (dirty_cpu == this_cpu) + goto out; smp_flush_dcache_page_impl(page, dirty_cpu); } - set_dcache_dirty(page); + set_dcache_dirty(page, this_cpu); } else { /* We could delay the flush for the !page_mapping * case too. But that case is for exec env/arg @@ -243,6 +247,9 @@ void flush_dcache_page(struct page *page) */ flush_dcache_page_impl(page); } + +out: + put_cpu(); } /* When shared+writable mmaps of files go away, we lose all dirty diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c index 7d6bb961d..be82cafe9 100644 --- a/arch/um/kernel/init_task.c +++ b/arch/um/kernel/init_task.c @@ -9,6 +9,7 @@ #include "linux/sched.h" #include "linux/init_task.h" #include "linux/version.h" +#include "linux/mqueue.h" #include "asm/uaccess.h" #include "asm/pgtable.h" #include "user_util.h" diff --git a/arch/v850/kernel/init_task.c b/arch/v850/kernel/init_task.c index a5dac3a83..ed2f93cf7 100644 --- a/arch/v850/kernel/init_task.c +++ b/arch/v850/kernel/init_task.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 896873b9d..9b9a504ef 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile @@ -37,6 +37,8 @@ LDFLAGS := -m elf_x86_64 OBJCOPYFLAGS := -O binary -R .note -R .comment -S LDFLAGS_vmlinux := -e stext +CHECK := $(CHECK) -D__x86_64__=1 + cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,) cflags-$(CONFIG_MPSC) += $(call check_gcc,-march=nocona,) CFLAGS += $(cflags-y) diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index df768a0e9..e569a1435 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig @@ -34,6 +34,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +CONFIG_KALLSYMS_ALL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y @@ -234,6 +235,7 @@ CONFIG_BLK_DEV_PIIX=y # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_IDE_ARM is not set CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set CONFIG_IDEDMA_AUTO=y @@ -258,7 +260,6 @@ CONFIG_BLK_DEV_SD=y # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # # CONFIG_SCSI_MULTI_LUN is not set -# CONFIG_SCSI_REPORT_LUNS is not set # CONFIG_SCSI_CONSTANTS is not set # CONFIG_SCSI_LOGGING is not set @@ -789,7 +790,6 @@ CONFIG_USB_HIDINPUT=y # Firmware Drivers # # CONFIG_EDD is not set -# CONFIG_SMBIOS is not set # # File systems diff --git a/arch/x86_64/ia32/fpu32.c b/arch/x86_64/ia32/fpu32.c index c6d0b02a1..f9a2638c8 100644 --- a/arch/x86_64/ia32/fpu32.c +++ b/arch/x86_64/ia32/fpu32.c @@ -72,15 +72,15 @@ static inline unsigned long twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave) static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave, - struct _fpstate_ia32 *buf) + struct _fpstate_ia32 __user *buf) { struct _fpxreg *to; - struct _fpreg *from; + struct _fpreg __user *from; int i; u32 v; int err = 0; -#define G(num,val) err |= __get_user(val, num + (u32 *)buf) +#define G(num,val) err |= __get_user(val, num + (u32 __user *)buf) G(0, fxsave->cwd); G(1, fxsave->swd); G(2, fxsave->twd); @@ -104,12 +104,12 @@ static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave, } -static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf, +static inline int convert_fxsr_to_user(struct _fpstate_ia32 __user *buf, struct i387_fxsave_struct *fxsave, struct pt_regs *regs, struct task_struct *tsk) { - struct _fpreg *to; + struct _fpreg __user *to; struct _fpxreg *from; int i; u16 cs,ds; @@ -125,7 +125,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf, cs = regs->cs; } -#define P(num,val) err |= __put_user(val, num + (u32 *)buf) +#define P(num,val) err |= __put_user(val, num + (u32 __user *)buf) P(0, (u32)fxsave->cwd | 0xffff0000); P(1, (u32)fxsave->swd | 0xffff0000); P(2, twd_fxsr_to_i387(fxsave)); @@ -147,7 +147,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf, return 0; } -int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave) +int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave) { clear_fpu(tsk); if (!fsave) { @@ -162,7 +162,7 @@ int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fs } int save_i387_ia32(struct task_struct *tsk, - struct _fpstate_ia32 *buf, + struct _fpstate_ia32 __user *buf, struct pt_regs *regs, int fsave) { diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c index d39795746..8c6964245 100644 --- a/arch/x86_64/ia32/ia32_ioctl.c +++ b/arch/x86_64/ia32/ia32_ioctl.c @@ -21,7 +21,7 @@ #ifndef TIOCGDEV #define TIOCGDEV _IOR('T',0x32, unsigned int) #endif -static int tiocgdev(unsigned fd, unsigned cmd, unsigned int *ptr) +static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr) { struct file *file = fget(fd); @@ -54,7 +54,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg) ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); set_fs(oldfs); if (!ret) - ret = put_user(val, (unsigned int*) arg); + ret = put_user(val, (unsigned int __user *) arg); return ret; case RTC_IRQP_SET32: @@ -66,7 +66,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg) ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); set_fs(oldfs); if (!ret) - ret = put_user(val, (unsigned int*) arg); + ret = put_user(val, (unsigned int __user *) arg); return ret; case RTC_EPOCH_SET32: @@ -113,7 +113,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg) struct mtrr_gentry g; struct mtrr_sentry s; int get = 0, err = 0; - struct mtrr_gentry32 *g32 = (struct mtrr_gentry32 *)arg; + struct mtrr_gentry32 __user *g32 = (struct mtrr_gentry32 __user *)arg; mm_segment_t oldfs = get_fs(); switch (cmd) { @@ -139,7 +139,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg) arg = (unsigned long)&g; } else { - struct mtrr_sentry32 *s32 = (struct mtrr_sentry32 *)arg; + struct mtrr_sentry32 __user *s32 = (struct mtrr_sentry32 __user *)arg; err = get_user(s.base, &s32->base); err |= get_user(s.size, &s32->size); err |= get_user(s.type, &s32->type); diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c index 7e95c0a6e..2fe68d976 100644 --- a/arch/x86_64/ia32/ia32_signal.c +++ b/arch/x86_64/ia32/ia32_signal.c @@ -42,7 +42,7 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); -void signal_fault(struct pt_regs *regs, void *frame, char *where); +void signal_fault(struct pt_regs *regs, void __user *frame, char *where); int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from) { @@ -136,8 +136,9 @@ sys32_sigsuspend(int history0, int history1, old_sigset_t mask, struct pt_regs r } asmlinkage long -sys32_sigaltstack(const stack_ia32_t *uss_ptr, stack_ia32_t *uoss_ptr, - struct pt_regs regs) +sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, + stack_ia32_t __user *uoss_ptr, + struct pt_regs regs) { stack_t uss,uoss; int ret; @@ -193,7 +194,7 @@ struct rt_sigframe }; static int -ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsigned int *peax) +ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 __user *sc, unsigned int *peax) { unsigned int err = 0; @@ -252,9 +253,9 @@ ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsign { u32 tmp; - struct _fpstate_ia32 * buf; + struct _fpstate_ia32 __user * buf; err |= __get_user(tmp, &sc->fpstate); - buf = (struct _fpstate_ia32 *) (u64)tmp; + buf = compat_ptr(tmp); if (buf) { if (verify_area(VERIFY_READ, buf, sizeof(*buf))) goto badframe; @@ -275,7 +276,7 @@ badframe: asmlinkage long sys32_sigreturn(struct pt_regs regs) { - struct sigframe *frame = (struct sigframe *)(regs.rsp - 8); + struct sigframe __user *frame = (struct sigframe __user *)(regs.rsp-8); sigset_t set; unsigned int eax; @@ -304,9 +305,8 @@ badframe: asmlinkage long sys32_rt_sigreturn(struct pt_regs regs) { - struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 4); + struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs.rsp - 4); sigset_t set; - stack_t st; unsigned int eax; if (verify_area(VERIFY_READ, frame, sizeof(*frame))) @@ -338,20 +338,20 @@ badframe: */ static int -ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate, +ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate, struct pt_regs *regs, unsigned int mask) { int tmp, err = 0; tmp = 0; __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->gs); + err |= __put_user(tmp, (unsigned int __user *)&sc->gs); __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->fs); + err |= __put_user(tmp, (unsigned int __user *)&sc->fs); __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->ds); + err |= __put_user(tmp, (unsigned int __user *)&sc->ds); __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); - err |= __put_user(tmp, (unsigned int *)&sc->es); + err |= __put_user(tmp, (unsigned int __user *)&sc->es); err |= __put_user((u32)regs->rdi, &sc->edi); err |= __put_user((u32)regs->rsi, &sc->esi); @@ -388,7 +388,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate, /* * Determine which stack to use.. */ -static void * +static void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) { unsigned long rsp; @@ -409,13 +409,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) rsp = (unsigned long) ka->sa.sa_restorer; } - return (void *)((rsp - frame_size) & -8UL); + return (void __user *)((rsp - frame_size) & -8UL); } void ia32_setup_frame(int sig, struct k_sigaction *ka, compat_sigset_t *set, struct pt_regs * regs) { - struct sigframe *frame; + struct sigframe __user *frame; int err = 0; frame = get_sigframe(ka, regs, sizeof(*frame)); @@ -502,7 +502,7 @@ give_sigsegv: void ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, compat_sigset_t *set, struct pt_regs * regs) { - struct rt_sigframe *frame; + struct rt_sigframe __user *frame; int err = 0; frame = get_sigframe(ka, regs, sizeof(*frame)); diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 1b988918e..0a2fb66b6 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S @@ -322,7 +322,7 @@ ia32_sys_call_table: .quad sys_mknod .quad sys_chmod /* 15 */ .quad sys_lchown16 - .quad ni_syscall /* old break syscall holder */ + .quad quiet_ni_syscall /* old break syscall holder */ .quad sys_stat .quad sys32_lseek .quad sys_getpid /* 20 */ @@ -336,11 +336,11 @@ ia32_sys_call_table: .quad sys_fstat /* (old)fstat */ .quad sys_pause .quad compat_sys_utime /* 30 */ - .quad ni_syscall /* old stty syscall holder */ - .quad ni_syscall /* old gtty syscall holder */ + .quad quiet_ni_syscall /* old stty syscall holder */ + .quad quiet_ni_syscall /* old gtty syscall holder */ .quad sys_access .quad sys_nice - .quad ni_syscall /* 35 */ /* old ftime syscall holder */ + .quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */ .quad sys_sync .quad sys32_kill .quad sys_rename @@ -349,7 +349,7 @@ ia32_sys_call_table: .quad sys_dup .quad sys32_pipe .quad compat_sys_times - .quad ni_syscall /* old prof syscall holder */ + .quad quiet_ni_syscall /* old prof syscall holder */ .quad sys_brk /* 45 */ .quad sys_setgid16 .quad sys_getgid16 @@ -358,12 +358,12 @@ ia32_sys_call_table: .quad sys_getegid16 /* 50 */ .quad sys_acct .quad sys_umount /* new_umount */ - .quad ni_syscall /* old lock syscall holder */ + .quad quiet_ni_syscall /* old lock syscall holder */ .quad compat_sys_ioctl .quad compat_sys_fcntl64 /* 55 */ - .quad ni_syscall /* old mpx syscall holder */ + .quad quiet_ni_syscall /* old mpx syscall holder */ .quad sys_setpgid - .quad ni_syscall /* old ulimit syscall holder */ + .quad quiet_ni_syscall /* old ulimit syscall holder */ .quad sys32_olduname .quad sys_umask /* 60 */ .quad sys_chroot @@ -403,7 +403,7 @@ ia32_sys_call_table: .quad sys_fchown16 /* 95 */ .quad sys_getpriority .quad sys_setpriority - .quad ni_syscall /* old profil syscall holder */ + .quad quiet_ni_syscall /* old profil syscall holder */ .quad compat_sys_statfs .quad compat_sys_fstatfs /* 100 */ .quad sys_ioperm @@ -417,7 +417,7 @@ ia32_sys_call_table: .quad sys32_uname .quad stub32_iopl /* 110 */ .quad sys_vhangup - .quad ni_syscall /* old "idle" system call */ + .quad quiet_ni_syscall /* old "idle" system call */ .quad sys32_vm86_warning /* vm86old */ .quad compat_sys_wait4 .quad sys_swapoff /* 115 */ @@ -442,7 +442,7 @@ ia32_sys_call_table: .quad quiet_ni_syscall /* bdflush */ .quad sys_sysfs /* 135 */ .quad sys_personality - .quad ni_syscall /* for afs_syscall */ + .quad quiet_ni_syscall /* for afs_syscall */ .quad sys_setfsuid16 .quad sys_setfsgid16 .quad sys_llseek /* 140 */ @@ -493,8 +493,8 @@ ia32_sys_call_table: .quad sys_capset .quad stub32_sigaltstack .quad sys32_sendfile - .quad ni_syscall /* streams1 */ - .quad ni_syscall /* streams2 */ + .quad quiet_ni_syscall /* streams1 */ + .quad quiet_ni_syscall /* streams2 */ .quad stub32_vfork /* 190 */ .quad compat_sys_getrlimit .quad sys32_mmap2 @@ -543,51 +543,52 @@ ia32_sys_call_table: .quad sys_removexattr /* 235 */ .quad sys_lremovexattr .quad sys_fremovexattr - .quad sys_tkill /* 238 */ + .quad sys_tkill .quad sys_sendfile64 .quad compat_sys_futex /* 240 */ - .quad compat_sys_sched_setaffinity - .quad compat_sys_sched_getaffinity + .quad compat_sys_sched_setaffinity + .quad compat_sys_sched_getaffinity .quad sys32_set_thread_area .quad sys32_get_thread_area - .quad sys32_io_setup + .quad sys32_io_setup /* 245 */ .quad sys_io_destroy .quad sys32_io_getevents .quad sys32_io_submit .quad sys_io_cancel - .quad sys_fadvise64 - .quad quiet_ni_syscall /* free_huge_pages */ - .quad sys_exit_group /* exit_group */ + .quad sys_fadvise64 /* 250 */ + .quad quiet_ni_syscall /* free_huge_pages */ + .quad sys_exit_group .quad sys_lookup_dcookie .quad sys_epoll_create - .quad sys_epoll_ctl + .quad sys_epoll_ctl /* 255 */ .quad sys_epoll_wait .quad sys_remap_file_pages .quad sys_set_tid_address .quad sys32_timer_create - .quad compat_timer_settime + .quad compat_timer_settime /* 260 */ .quad compat_timer_gettime .quad sys_timer_getoverrun .quad sys_timer_delete .quad compat_clock_settime - .quad compat_clock_gettime + .quad compat_clock_gettime /* 265 */ .quad compat_clock_getres .quad compat_clock_nanosleep - .quad compat_statfs64 /* statfs64 */ - .quad compat_fstatfs64 /* fstatfs64 */ - .quad sys_tgkill + .quad compat_statfs64 + .quad compat_fstatfs64 + .quad sys_tgkill /* 270 */ .quad compat_sys_utimes .quad sys32_fadvise64_64 - .quad sys_ni_syscall /* sys_vserver */ - .quad sys_ni_syscall /* sys_mbind */ - .quad sys_ni_syscall /* 275 sys_get_mempolicy */ - .quad sys_ni_syscall /* sys_set_mempolicy */ + .quad quiet_ni_syscall /* sys_vserver */ + .quad sys_mbind + .quad compat_get_mempolicy /* 275 */ + .quad sys_set_mempolicy .quad compat_sys_mq_open .quad sys_mq_unlink .quad compat_sys_mq_timedsend .quad compat_sys_mq_timedreceive /* 280 */ .quad compat_sys_mq_notify .quad compat_sys_mq_getsetattr + .quad quiet_ni_syscall /* reserved for kexec */ /* don't forget to change IA32_NR_syscalls */ ia32_syscall_end: .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index c2ef94295..01202b792 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -228,6 +229,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) { struct task_struct *child; struct pt_regs *childregs; + void __user *datap = compat_ptr(data); int ret; __u32 val; @@ -264,7 +266,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) if (access_process_vm(child, addr, &val, sizeof(u32), 0)!=sizeof(u32)) ret = -EIO; else - ret = put_user(val, (unsigned int *)(u64)data); + ret = put_user(val, (unsigned int __user *)datap); break; case PTRACE_POKEDATA: @@ -277,7 +279,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) case PTRACE_PEEKUSR: ret = getreg32(child, addr, &val); if (ret == 0) - ret = put_user(val, (__u32 *)(unsigned long) data); + ret = put_user(val, (__u32 __user *)datap); break; case PTRACE_POKEUSR: @@ -286,15 +288,15 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) case PTRACE_GETREGS: { /* Get all gp regs from the child. */ int i; - if (!access_ok(VERIFY_WRITE, (unsigned *)(unsigned long)data, 16*4)) { + if (!access_ok(VERIFY_WRITE, datap, 16*4)) { ret = -EIO; break; } ret = 0; for ( i = 0; i <= 16*4 ; i += sizeof(__u32) ) { getreg32(child, i, &val); - ret |= __put_user(val,(u32 *) (unsigned long) data); - data += sizeof(u32); + ret |= __put_user(val,(u32 __user *)datap); + datap += sizeof(u32); } break; } @@ -302,40 +304,40 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) case PTRACE_SETREGS: { /* Set all gp regs in the child. */ unsigned long tmp; int i; - if (!access_ok(VERIFY_READ, (unsigned *)(unsigned long)data, 16*4)) { + if (!access_ok(VERIFY_READ, datap, 16*4)) { ret = -EIO; break; } ret = 0; for ( i = 0; i <= 16*4; i += sizeof(u32) ) { - ret |= __get_user(tmp, (u32 *) (unsigned long) data); + ret |= __get_user(tmp, (u32 __user *)datap); putreg32(child, i, tmp); - data += sizeof(u32); + datap += sizeof(u32); } break; } case PTRACE_GETFPREGS: ret = -EIO; - if (!access_ok(VERIFY_READ, (void *)(u64)data, + if (!access_ok(VERIFY_READ, compat_ptr(data), sizeof(struct user_i387_struct))) break; - save_i387_ia32(child, (void *)(u64)data, childregs, 1); + save_i387_ia32(child, datap, childregs, 1); ret = 0; break; case PTRACE_SETFPREGS: ret = -EIO; - if (!access_ok(VERIFY_WRITE, (void *)(u64)data, + if (!access_ok(VERIFY_WRITE, datap, sizeof(struct user_i387_struct))) break; ret = 0; /* don't check EFAULT to be bug-to-bug compatible to i386 */ - restore_i387_ia32(child, (void *)(u64)data, 1); + restore_i387_ia32(child, datap, 1); break; case PTRACE_GETFPXREGS: { - struct user32_fxsr_struct *u = (void *)(u64)data; + struct user32_fxsr_struct __user *u = datap; init_fpu(child); ret = -EIO; if (!access_ok(VERIFY_WRITE, u, sizeof(*u))) @@ -348,7 +350,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) break; } case PTRACE_SETFPXREGS: { - struct user32_fxsr_struct *u = (void *)(u64)data; + struct user32_fxsr_struct __user *u = datap; unlazy_fpu(child); ret = -EIO; if (!access_ok(VERIFY_READ, u, sizeof(*u))) diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 465476e09..af5f3218a 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c @@ -76,9 +76,9 @@ #define A(__x) ((unsigned long)(__x)) #define AA(__x) ((unsigned long)(__x)) #define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1))) -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) -int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf) +int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; @@ -110,7 +110,7 @@ int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf) } asmlinkage long -sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high) +sys32_truncate64(char __user * filename, unsigned long offset_low, unsigned long offset_high) { return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); } @@ -125,7 +125,7 @@ sys32_ftruncate64(unsigned int fd, unsigned long offset_low, unsigned long offse support for 64bit inode numbers. */ static int -cp_stat64(struct stat64 *ubuf, struct kstat *stat) +cp_stat64(struct stat64 __user *ubuf, struct kstat *stat) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; @@ -154,7 +154,7 @@ cp_stat64(struct stat64 *ubuf, struct kstat *stat) } asmlinkage long -sys32_stat64(char * filename, struct stat64 *statbuf) +sys32_stat64(char __user * filename, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_stat(filename, &stat); @@ -164,7 +164,7 @@ sys32_stat64(char * filename, struct stat64 *statbuf) } asmlinkage long -sys32_lstat64(char * filename, struct stat64 *statbuf) +sys32_lstat64(char __user * filename, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_lstat(filename, &stat); @@ -174,7 +174,7 @@ sys32_lstat64(char * filename, struct stat64 *statbuf) } asmlinkage long -sys32_fstat64(unsigned int fd, struct stat64 *statbuf) +sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf) { struct kstat stat; int ret = vfs_fstat(fd, &stat); @@ -199,7 +199,7 @@ struct mmap_arg_struct { }; asmlinkage long -sys32_mmap(struct mmap_arg_struct *arg) +sys32_mmap(struct mmap_arg_struct __user *arg) { struct mmap_arg_struct a; struct file *file = NULL; @@ -241,7 +241,7 @@ sys32_mprotect(unsigned long start, size_t len, unsigned long prot) } asmlinkage long -sys32_pipe(int *fd) +sys32_pipe(int __user *fd) { int retval; int fds[2]; @@ -256,8 +256,8 @@ sys32_pipe(int *fd) } asmlinkage long -sys32_rt_sigaction(int sig, struct sigaction32 *act, - struct sigaction32 *oact, unsigned int sigsetsize) +sys32_rt_sigaction(int sig, struct sigaction32 __user *act, + struct sigaction32 __user *oact, unsigned int sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -321,7 +321,7 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, } asmlinkage long -sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact) +sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact) { struct k_sigaction new_ka, old_ka; int ret; @@ -395,7 +395,7 @@ sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, } static inline long -get_tv32(struct timeval *o, struct compat_timeval *i) +get_tv32(struct timeval *o, struct compat_timeval __user *i) { int err = -EFAULT; if (access_ok(VERIFY_READ, i, sizeof(*i))) { @@ -406,7 +406,7 @@ get_tv32(struct timeval *o, struct compat_timeval *i) } static inline long -put_tv32(struct compat_timeval *o, struct timeval *i) +put_tv32(struct compat_timeval __user *o, struct timeval *i) { int err = -EFAULT; if (access_ok(VERIFY_WRITE, o, sizeof(*o))) { @@ -442,7 +442,7 @@ sys32_alarm(unsigned int seconds) extern struct timezone sys_tz; asmlinkage long -sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { if (tv) { struct timeval ktv; @@ -458,7 +458,7 @@ sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) } asmlinkage long -sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) +sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) { struct timeval ktv; struct timespec kts; @@ -493,14 +493,14 @@ struct old_linux32_dirent { }; struct getdents32_callback { - struct linux32_dirent * current_dir; - struct linux32_dirent * previous; + struct linux32_dirent __user * current_dir; + struct linux32_dirent __user * previous; int count; int error; }; struct readdir32_callback { - struct old_linux32_dirent * dirent; + struct old_linux32_dirent __user * dirent; int count; }; @@ -508,7 +508,7 @@ static int filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, unsigned int d_type) { - struct linux32_dirent * dirent; + struct linux32_dirent __user * dirent; struct getdents32_callback * buf = (struct getdents32_callback *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2, 4); @@ -524,18 +524,18 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, put_user(reclen, &dirent->d_reclen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); - put_user(d_type, (char *)dirent + reclen - 1); - dirent = ((void *)dirent) + reclen; + put_user(d_type, (char __user *)dirent + reclen - 1); + dirent = ((void __user *)dirent) + reclen; buf->current_dir = dirent; buf->count -= reclen; return 0; } asmlinkage long -sys32_getdents (unsigned int fd, void * dirent, unsigned int count) +sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count) { struct file * file; - struct linux32_dirent * lastdirent; + struct linux32_dirent __user * lastdirent; struct getdents32_callback buf; int error; @@ -544,7 +544,7 @@ sys32_getdents (unsigned int fd, void * dirent, unsigned int count) if (!file) goto out; - buf.current_dir = (struct linux32_dirent *) dirent; + buf.current_dir = (struct linux32_dirent __user *) dirent; buf.previous = NULL; buf.count = count; buf.error = 0; @@ -569,7 +569,7 @@ static int fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned d_type) { struct readdir32_callback * buf = (struct readdir32_callback *) __buf; - struct old_linux32_dirent * dirent; + struct old_linux32_dirent __user * dirent; if (buf->count) return -EINVAL; @@ -584,7 +584,7 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t } asmlinkage long -sys32_oldreaddir (unsigned int fd, void * dirent, unsigned int count) +sys32_oldreaddir (unsigned int fd, void __user * dirent, unsigned int count) { int error; struct file * file; @@ -615,7 +615,7 @@ struct sel_arg_struct { }; asmlinkage long -sys32_old_select(struct sel_arg_struct *arg) +sys32_old_select(struct sel_arg_struct __user *arg) { struct sel_arg_struct a; @@ -630,7 +630,7 @@ sys32_old_select(struct sel_arg_struct *arg) * sys_gettimeofday(). x86-64 did this but i386 Linux did not * so we have to implement this system call here. */ -asmlinkage long sys32_time(int * tloc) +asmlinkage long sys32_time(int __user * tloc) { int i; struct timeval tv; @@ -693,7 +693,7 @@ struct sysinfo32 { }; asmlinkage long -sys32_sysinfo(struct sysinfo32 *info) +sys32_sysinfo(struct sysinfo32 __user *info) { struct sysinfo s; int ret; @@ -742,7 +742,7 @@ sys32_sysinfo(struct sysinfo32 *info) } asmlinkage long -sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval) +sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval) { struct timespec t; int ret; @@ -782,8 +782,8 @@ sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) asmlinkage long -sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, - struct compat_timespec *uts, compat_size_t sigsetsize) +sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo, + struct compat_timespec __user *uts, compat_size_t sigsetsize) { sigset_t s; compat_sigset_t s32; @@ -820,7 +820,7 @@ sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, } asmlinkage long -sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) +sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo) { siginfo_t info; int ret; @@ -856,7 +856,7 @@ struct sysctl_ia32 { asmlinkage long -sys32_sysctl(struct sysctl_ia32 *args32) +sys32_sysctl(struct sysctl_ia32 __user *args32) { #ifndef CONFIG_SYSCTL return -ENOSYS; @@ -906,14 +906,14 @@ sys32_sysctl(struct sysctl_ia32 *args32) /* warning: next two assume little endian */ asmlinkage long -sys32_pread(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi) +sys32_pread(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi) { return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); } asmlinkage long -sys32_pwrite(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi) +sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi) { return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); @@ -934,7 +934,7 @@ sys32_personality(unsigned long personality) } asmlinkage long -sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) +sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) { mm_segment_t old_fs = get_fs(); int ret; @@ -971,7 +971,7 @@ struct timex32 { extern int do_adjtimex(struct timex *); asmlinkage long -sys32_adjtimex(struct timex32 *utp) +sys32_adjtimex(struct timex32 __user *utp) { struct timex txc; int ret; @@ -1056,7 +1056,7 @@ asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, return error; } -asmlinkage long sys32_olduname(struct oldold_utsname * name) +asmlinkage long sys32_olduname(struct oldold_utsname __user * name) { int error; @@ -1090,7 +1090,7 @@ asmlinkage long sys32_olduname(struct oldold_utsname * name) return error; } -long sys32_uname(struct old_utsname * name) +long sys32_uname(struct old_utsname __user * name) { int err; if (!name) @@ -1124,7 +1124,7 @@ long sys32_ustat(unsigned dev, struct ustat32 __user *u32p) return ret; } -asmlinkage long sys32_execve(char *name, compat_uptr_t __user *argv, +asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, struct pt_regs regs) { long error; @@ -1143,8 +1143,8 @@ asmlinkage long sys32_execve(char *name, compat_uptr_t __user *argv, asmlinkage long sys32_clone(unsigned int clone_flags, unsigned int newsp, struct pt_regs regs) { - void *parent_tid = (void *)regs.rdx; - void *child_tid = (void *)regs.rdi; + void __user *parent_tid = (void __user *)regs.rdx; + void __user *child_tid = (void __user *)regs.rdi; if (!newsp) newsp = regs.rsp; return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, ®s, 0, @@ -1166,7 +1166,7 @@ long sys32_kill(int pid, int sig) } -long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) +long sys32_io_setup(unsigned nr_reqs, u32 __user *ctx32p) { long ret; aio_context_t ctx64; @@ -1181,7 +1181,7 @@ long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) } asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr, - compat_uptr_t *iocbpp) + compat_uptr_t __user *iocbpp) { struct kioctx *ctx; long ret = 0; @@ -1201,7 +1201,8 @@ asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr, for (i=0; i 32bit use arch_prctl() */ -int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info) +int do_set_thread_area(struct thread_struct *t, struct user_desc __user *u_info) { struct user_desc info; struct n_desc_struct *desc; @@ -75,7 +75,7 @@ int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info) return 0; } -asmlinkage long sys32_set_thread_area(struct user_desc *u_info) +asmlinkage long sys32_set_thread_area(struct user_desc __user *u_info) { return do_set_thread_area(¤t->thread, u_info); } @@ -102,7 +102,7 @@ asmlinkage long sys32_set_thread_area(struct user_desc *u_info) #define GET_USEABLE(desc) (((desc)->b >> 20) & 1) #define GET_LONGMODE(desc) (((desc)->b >> 21) & 1) -int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info) +int do_get_thread_area(struct thread_struct *t, struct user_desc __user *u_info) { struct user_desc info; struct n_desc_struct *desc; @@ -132,7 +132,7 @@ int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info) return 0; } -asmlinkage long sys32_get_thread_area(struct user_desc *u_info) +asmlinkage long sys32_get_thread_area(struct user_desc __user *u_info) { return do_get_thread_area(¤t->thread, u_info); } @@ -141,10 +141,11 @@ asmlinkage long sys32_get_thread_area(struct user_desc *u_info) int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs) { struct n_desc_struct *desc; - struct user_desc info, *cp; + struct user_desc info; + struct user_desc __user *cp; int idx; - cp = (void *)childregs->rsi; + cp = (void __user *)childregs->rsi; if (copy_from_user(&info, cp, sizeof(info))) return -EFAULT; if (LDT_empty(&info)) diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c index 20e9266df..3331a564f 100644 --- a/arch/x86_64/kernel/acpi/sleep.c +++ b/arch/x86_64/kernel/acpi/sleep.c @@ -114,7 +114,6 @@ void __init acpi_reserve_bootmem(void) acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); - printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address); } static int __init acpi_sleep_setup(char *str) diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index 6235eab18..90fb84690 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c @@ -34,7 +34,7 @@ unsigned long end_pfn_map; */ unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; -extern struct resource code_resource, data_resource, vram_resource; +extern struct resource code_resource, data_resource; /* Check for some hardcoded bad areas that early boot is not allowed to touch */ static inline int bad_addr(unsigned long *addrp, unsigned long size) diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c index b04a1add2..4055c78d2 100644 --- a/arch/x86_64/kernel/head64.c +++ b/arch/x86_64/kernel/head64.c @@ -73,6 +73,8 @@ static void __init setup_boot_cpu_data(void) boot_cpu_data.x86_mask = eax & 0xf; } +extern char _end[]; + void __init x86_64_start_kernel(char * real_mode_data) { char *s; @@ -80,6 +82,9 @@ void __init x86_64_start_kernel(char * real_mode_data) clear_bss(); pda_init(0); copy_bootdata(real_mode_data); +#ifdef CONFIG_SMP + cpu_set(0, cpu_online_map); +#endif /* default console: */ if (!strstr(saved_command_line, "console=")) strcat(saved_command_line, " console=tty0"); @@ -95,6 +100,10 @@ void __init x86_64_start_kernel(char * real_mode_data) if (strstr(saved_command_line, "disableapic")) disable_apic = 1; #endif + /* You need early console to see that */ + if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE) + panic("Kernel too big for kernel mapping\n"); + setup_boot_cpu_data(); start_kernel(); } diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c index 1aa4deb43..6bc3d64e0 100644 --- a/arch/x86_64/kernel/i387.c +++ b/arch/x86_64/kernel/i387.c @@ -77,7 +77,7 @@ void init_fpu(struct task_struct *child) * Signal frame handlers. */ -int save_i387(struct _fpstate *buf) +int save_i387(struct _fpstate __user *buf) { struct task_struct *tsk = current; int err = 0; @@ -95,7 +95,7 @@ int save_i387(struct _fpstate *buf) return 0; tsk->used_math = 0; /* trigger finit */ if (tsk->thread_info->status & TS_USEDFPU) { - err = save_i387_checking((struct i387_fxsave_struct *)buf); + err = save_i387_checking((struct i387_fxsave_struct __user *)buf); if (err) return err; stts(); } else { @@ -110,14 +110,14 @@ int save_i387(struct _fpstate *buf) * ptrace request handlers. */ -int get_fpregs(struct user_i387_struct *buf, struct task_struct *tsk) +int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk) { init_fpu(tsk); - return __copy_to_user((void *)buf, &tsk->thread.i387.fxsave, + return __copy_to_user(buf, &tsk->thread.i387.fxsave, sizeof(struct user_i387_struct)) ? -EFAULT : 0; } -int set_fpregs(struct task_struct *tsk, struct user_i387_struct *buf) +int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf) { if (__copy_from_user(&tsk->thread.i387.fxsave, buf, sizeof(struct user_i387_struct))) diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c index 57ec2f0ee..33185ca33 100644 --- a/arch/x86_64/kernel/init_task.c +++ b/arch/x86_64/kernel/init_task.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index f7625f3ee..718504a32 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c @@ -252,7 +252,8 @@ void __init check_ioapic(void) switch (vendor) { case PCI_VENDOR_ID_VIA: #ifdef CONFIG_GART_IOMMU - if (end_pfn >= (0xffffffff>>PAGE_SHIFT) && + if ((end_pfn >= (0xffffffff>>PAGE_SHIFT) || + force_iommu) && !iommu_aperture_allowed) { printk(KERN_INFO "Looks like a VIA chipset. Disabling IOMMU. Overwrite with \"iommu=allowed\"\n"); diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index 732a6f4d3..bfdb95e8b 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c @@ -833,7 +833,8 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, return len; } -static int irq_affinity_write_proc (struct file *file, const char *buffer, +static int irq_affinity_write_proc (struct file *file, + const char __user *buffer, unsigned long count, void *data) { int irq = (long) data, full_count = count, err; @@ -871,7 +872,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, return len; } -static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, +static int prof_cpu_mask_write_proc (struct file *file, + const char __user *buffer, unsigned long count, void *data) { unsigned long full_count = count, err; diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c index 1b6252c09..4e43e53a1 100644 --- a/arch/x86_64/kernel/ldt.c +++ b/arch/x86_64/kernel/ldt.c @@ -125,7 +125,7 @@ void destroy_context(struct mm_struct *mm) } } -static int read_ldt(void * ptr, unsigned long bytecount) +static int read_ldt(void __user * ptr, unsigned long bytecount) { int err; unsigned long size; @@ -153,7 +153,7 @@ static int read_ldt(void * ptr, unsigned long bytecount) return bytecount; } -static int read_default_ldt(void * ptr, unsigned long bytecount) +static int read_default_ldt(void __user * ptr, unsigned long bytecount) { /* Arbitrary number */ /* x86-64 default LDT is all zeros */ @@ -164,7 +164,7 @@ static int read_default_ldt(void * ptr, unsigned long bytecount) return bytecount; } -static int write_ldt(void * ptr, unsigned long bytecount, int oldmode) +static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) { struct task_struct *me = current; struct mm_struct * mm = me->mm; @@ -225,7 +225,7 @@ out: return error; } -asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount) +asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) { int ret = -ENOSYS; diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 922d62fcf..3bb678f1e 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c @@ -25,8 +25,9 @@ #define NR_BANKS 5 static int mce_disabled __initdata; -/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic */ -static int tolerant = 2; +/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic, + 3: never panic or exit (for testing only) */ +static int tolerant = 1; static int banks; static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL }; @@ -96,7 +97,8 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start) int i; oops_begin(); for (i = 0; i < MCE_LOG_LEN; i++) { - if (mcelog.entry[i].tsc < start) + unsigned long tsc = mcelog.entry[i].tsc; + if (time_before(tsc, start)) continue; print_mce(&mcelog.entry[i]); if (mcelog.entry[i].tsc == backup->tsc) @@ -104,7 +106,10 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start) } if (backup) print_mce(backup); - panic(msg); + if (tolerant >= 3) + printk("Fake panic: %s\n", msg); + else + panic(msg); } static int mce_available(struct cpuinfo_x86 *c) @@ -120,8 +125,8 @@ static int mce_available(struct cpuinfo_x86 *c) void do_machine_check(struct pt_regs * regs, long error_code) { - struct mce m; - int nowayout = 0; + struct mce m, panicm; + int nowayout = (tolerant < 1); int kill_it = 0; u64 mcestart; int i; @@ -149,13 +154,31 @@ void do_machine_check(struct pt_regs * regs, long error_code) for (i = 0; i < banks; i++) { if (!bank[i]) continue; + + m.misc = 0; + m.addr = 0; rdmsrl(MSR_IA32_MC0_STATUS + i*4, m.status); if ((m.status & MCI_STATUS_VAL) == 0) continue; + /* Should be implied by the banks check above, but + check it anyways */ + if ((m.status & MCI_STATUS_EN) == 0) + continue; - nowayout |= (tolerant < 1); - nowayout |= !!(m.status & (MCI_STATUS_OVER|MCI_STATUS_PCC)); + /* Did this bank cause the exception? */ + /* Assume that the bank with uncorrectable errors did it, + and that there is only a single one. */ + if (m.status & MCI_STATUS_UC) { + panicm = m; + } else { + m.rip = 0; + m.cs = 0; + } + + /* In theory _OVER could be a nowayout too, but + assume any overflowed errors were no fatal. */ + nowayout |= !!(m.status & MCI_STATUS_PCC); kill_it |= !!(m.status & MCI_STATUS_UC); m.bank = i; @@ -176,7 +199,10 @@ void do_machine_check(struct pt_regs * regs, long error_code) if (nowayout) mce_panic("Machine check", &m, mcestart); if (kill_it) { - int user_space = (m.rip && (m.cs & 3)); + int user_space = 0; + + if (m.mcgstatus & MCG_STATUS_RIPV) + user_space = m.rip && (m.cs & 3); /* When the machine was in user space and the CPU didn't get confused it's normally not necessary to panic, unless you @@ -187,11 +213,12 @@ void do_machine_check(struct pt_regs * regs, long error_code) it is best to just halt the machine. */ if ((!user_space && (panic_on_oops || tolerant < 2)) || (unsigned)current->pid <= 1) - mce_panic("Uncorrected machine check", &m, mcestart); + mce_panic("Uncorrected machine check", &panicm, mcestart); /* do_exit takes an awful lot of locks and has as slight risk of deadlocking. If you don't want that don't set tolerant >= 2 */ - do_exit(SIGBUS); + if (tolerant < 3) + do_exit(SIGBUS); } } @@ -207,7 +234,7 @@ static void mce_clear_all(void) * Periodic polling timer for "silent" machine check errors. */ -static int check_interval = 3600; /* one hour */ +static int check_interval = 5 * 60; /* 5 minutes */ static void mcheck_timer(void *data); static DECLARE_WORK(mcheck_work, mcheck_timer, NULL); @@ -297,12 +324,12 @@ static void collect_tscs(void *data) rdtscll(cpu_tsc[smp_processor_id()]); } -static ssize_t mce_read(struct file *filp, char *ubuf, size_t usize, loff_t *off) +static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off) { unsigned long cpu_tsc[NR_CPUS]; static DECLARE_MUTEX(mce_read_sem); unsigned next; - char *buf = ubuf; + char __user *buf = ubuf; int i, err; down(&mce_read_sem); @@ -348,19 +375,20 @@ static ssize_t mce_read(struct file *filp, char *ubuf, size_t usize, loff_t *off static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned long arg) { + int __user *p = (int __user *)arg; if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { case MCE_GET_RECORD_LEN: - return put_user(sizeof(struct mce), (int *)arg); + return put_user(sizeof(struct mce), p); case MCE_GET_LOG_LEN: - return put_user(MCE_LOG_LEN, (int *)arg); + return put_user(MCE_LOG_LEN, p); case MCE_GETCLEAR_FLAGS: { unsigned flags; do { flags = mcelog.flags; } while (cmpxchg(&mcelog.flags, flags, 0) != flags); - return put_user(flags, (int *)arg); + return put_user(flags, p); } default: return -ENOTTY; diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 27122be57..c43bb7bb2 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c @@ -575,6 +575,7 @@ static int __init smp_scan_config (unsigned long base, unsigned long length) extern void __bad_mpf_size(void); unsigned int *bp = phys_to_virt(base); struct intel_mp_floating *mpf; + static int printed __initdata; Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length); if (sizeof(*mpf) != 16) @@ -598,7 +599,10 @@ static int __init smp_scan_config (unsigned long base, unsigned long length) bp += 4; length -= 16; } - printk(KERN_INFO "No mptable found.\n"); + if (!printed) { + printk(KERN_INFO "No mptable found.\n"); + printed = 1; + } return 0; } @@ -712,7 +716,7 @@ struct mp_ioapic_routing { } mp_ioapic_routing[MAX_IO_APICS]; -static int __init mp_find_ioapic ( +static int mp_find_ioapic ( int gsi) { int i = 0; @@ -857,6 +861,7 @@ void __init mp_config_acpi_legacy_irqs (void) for (idx = 0; idx < mp_irq_entries; idx++) if (mp_irqs[idx].mpc_srcbus == MP_ISA_BUS && + (mp_irqs[idx].mpc_dstapic == ioapic) && (mp_irqs[idx].mpc_srcbusirq == i || mp_irqs[idx].mpc_dstirq == i)) break; @@ -884,91 +889,54 @@ void __init mp_config_acpi_legacy_irqs (void) return; } - -extern FADT_DESCRIPTOR acpi_fadt; - -#ifdef CONFIG_ACPI_PCI - -void __init mp_parse_prt (void) +void mp_register_gsi (u32 gsi, int edge_level, int active_high_low) { - struct list_head *node = NULL; - struct acpi_prt_entry *entry = NULL; int ioapic = -1; int ioapic_pin = 0; - int gsi = 0; int idx, bit = 0; - int edge_level = 0; - int active_high_low = 0; - /* - * Parsing through the PCI Interrupt Routing Table (PRT) and program - * routing for all static (IOAPIC-direct) entries. - */ - list_for_each(node, &acpi_prt.entries) { - entry = list_entry(node, struct acpi_prt_entry, node); - - /* Need to get gsi for dynamic entry */ - if (entry->link.handle) { - gsi = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); - if (!gsi) - continue; - } else { - /* Hardwired GSI. Assume PCI standard settings */ - gsi = entry->link.index; - edge_level = 1; - active_high_low = 1; - } + if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) + return; - /* Don't set up the ACPI SCI because it's already set up */ - if (acpi_fadt.sci_int == gsi) { - /* we still need to set up the entry's irq */ - acpi_gsi_to_irq(gsi, &entry->irq); - continue; - } +#ifdef CONFIG_ACPI_BUS + /* Don't set up the ACPI SCI because it's already set up */ + if (acpi_fadt.sci_int == gsi) + return; +#endif - ioapic = mp_find_ioapic(gsi); - if (ioapic < 0) - continue; - ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_start; + ioapic = mp_find_ioapic(gsi); + if (ioapic < 0) { + printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi); + return; + } - /* - * Avoid pin reprogramming. PRTs typically include entries - * with redundant pin->gsi mappings (but unique PCI devices); - * we only only program the IOAPIC on the first. - */ - bit = ioapic_pin % 32; - idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); - if (idx > 3) { - printk(KERN_ERR "Invalid reference to IOAPIC pin " - "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, - ioapic_pin); - continue; - } - if ((1<irq); - continue; - } + ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_start; - mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<irq); - } - printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", - entry->id.segment, entry->id.bus, - entry->id.device, ('A' + entry->pin), - mp_ioapic_routing[ioapic].apic_id, ioapic_pin, - entry->irq); + /* + * Avoid pin reprogramming. PRTs typically include entries + * with redundant pin->gsi mappings (but unique PCI devices); + * we only program the IOAPIC on the first. + */ + bit = ioapic_pin % 32; + idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); + if (idx > 3) { + printk(KERN_ERR "Invalid reference to IOAPIC pin " + "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, + ioapic_pin); + return; + } + if ((1<f_dentry->d_inode); struct cpuinfo_x86 *c = &(cpu_data)[cpu]; - if (!cpu_online(cpu)) + if (cpu >= NR_CPUS || !cpu_online(cpu)) return -ENXIO; /* No such CPU */ if ( !cpu_has(c, X86_FEATURE_MSR) ) return -EIO; /* MSR not supported */ diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 6b7861945..f7d3cf3ca 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -521,7 +521,8 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct * * sys_execve() executes a new program. */ asmlinkage -long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs) +long sys_execve(char __user *name, char __user * __user *argv, + char __user * __user *envp, struct pt_regs regs) { long error; char * filename; @@ -550,7 +551,7 @@ asmlinkage long sys_fork(struct pt_regs regs) return do_fork(SIGCHLD, regs.rsp, ®s, 0, NULL, NULL); } -asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void *parent_tid, void *child_tid, struct pt_regs regs) +asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, struct pt_regs regs) { if (!newsp) newsp = regs.rsp; @@ -664,7 +665,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) rdmsrl(MSR_FS_BASE, base); } else base = task->thread.fs; - ret = put_user(base, (unsigned long *)addr); + ret = put_user(base, (unsigned long __user *)addr); break; } case ARCH_GET_GS: { @@ -675,7 +676,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) rdmsrl(MSR_KERNEL_GS_BASE, base); } else base = task->thread.gs; - ret = put_user(base, (unsigned long *)addr); + ret = put_user(base, (unsigned long __user *)addr); break; } diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index a97bee6f2..5dd7752ae 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -232,7 +232,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -271,7 +271,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data tmp = 0; break; } - ret = put_user(tmp,(unsigned long *) data); + ret = put_user(tmp,(unsigned long __user *) data); break; } @@ -360,19 +360,20 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data don't use it against 64bit processes, use PTRACE_ARCH_PRCTL instead. */ case PTRACE_SET_THREAD_AREA: { + struct user_desc __user *p; int old; - get_user(old, &((struct user_desc *)data)->entry_number); - put_user(addr, &((struct user_desc *)data)->entry_number); - ret = do_set_thread_area(&child->thread, - (struct user_desc *)data); - put_user(old, &((struct user_desc *)data)->entry_number); + p = (struct user_desc __user *)data; + get_user(old, &p->entry_number); + put_user(addr, &p->entry_number); + ret = do_set_thread_area(&child->thread, p); + put_user(old, &p->entry_number); break; case PTRACE_GET_THREAD_AREA: - get_user(old, &((struct user_desc *)data)->entry_number); - put_user(addr, &((struct user_desc *)data)->entry_number); - ret = do_get_thread_area(&child->thread, - (struct user_desc *)data); - put_user(old, &((struct user_desc *)data)->entry_number); + p = (struct user_desc __user *)data; + get_user(old, &p->entry_number); + put_user(addr, &p->entry_number); + ret = do_get_thread_area(&child->thread, p); + put_user(old, &p->entry_number); break; } #endif @@ -428,12 +429,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data break; case PTRACE_GETREGS: { /* Get all gp regs from the child. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE)) { + if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, FRAME_SIZE)) { ret = -EIO; break; } for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) { - __put_user(getreg(child, ui),(unsigned long *) data); + __put_user(getreg(child, ui),(unsigned long __user *) data); data += sizeof(long); } ret = 0; @@ -442,12 +443,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data case PTRACE_SETREGS: { /* Set all gp regs in the child. */ unsigned long tmp; - if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE)) { + if (!access_ok(VERIFY_READ, (unsigned __user *)data, FRAME_SIZE)) { ret = -EIO; break; } for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) { - __get_user(tmp, (unsigned long *) data); + __get_user(tmp, (unsigned long __user *) data); putreg(child, ui, tmp); data += sizeof(long); } @@ -456,23 +457,23 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data } case PTRACE_GETFPREGS: { /* Get the child extended FPU state. */ - if (!access_ok(VERIFY_WRITE, (unsigned *)data, + if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, sizeof(struct user_i387_struct))) { ret = -EIO; break; } - ret = get_fpregs((struct user_i387_struct *)data, child); + ret = get_fpregs((struct user_i387_struct __user *)data, child); break; } case PTRACE_SETFPREGS: { /* Set the child extended FPU state. */ - if (!access_ok(VERIFY_READ, (unsigned *)data, + if (!access_ok(VERIFY_READ, (unsigned __user *)data, sizeof(struct user_i387_struct))) { ret = -EIO; break; } child->used_math = 1; - ret = set_fpregs(child, (struct user_i387_struct *)data); + ret = set_fpregs(child, (struct user_i387_struct __user *)data); break; } diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 09f9c7222..094949f96 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c @@ -116,9 +116,10 @@ struct resource standard_io_resources[] = { #define STANDARD_IO_RESOURCES \ (sizeof standard_io_resources / sizeof standard_io_resources[0]) -struct resource code_resource = { "Kernel code", 0x100000, 0, IORESOURCE_MEM }; -struct resource data_resource = { "Kernel data", 0, 0, IORESOURCE_MEM }; -struct resource vram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_BUSY | IORESOURCE_MEM }; +#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM) + +struct resource data_resource = { "Kernel data", 0, 0, IORESOURCE_RAM }; +struct resource code_resource = { "Kernel code", 0, 0, IORESOURCE_RAM }; #define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM) @@ -138,10 +139,11 @@ static struct resource adapter_rom_resources[] = { (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0]) static struct resource video_rom_resource = { "Video ROM", 0xc0000, 0xc7fff, IORESOURCE_ROM }; +static struct resource video_ram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_RAM }; #define romsignature(x) (*(unsigned short *)(x) == 0xaa55) -static int __init checksum(unsigned char *rom, unsigned long length) +static int __init romchecksum(unsigned char *rom, unsigned long length) { unsigned char *p, sum = 0; @@ -169,7 +171,7 @@ static void __init probe_roms(void) length = rom[2] * 512; /* if checksum okay, trust length byte */ - if (length && checksum(rom, length)) + if (length && romchecksum(rom, length)) video_rom_resource.end = start + length - 1; request_resource(&iomem_resource, &video_rom_resource); @@ -188,7 +190,7 @@ static void __init probe_roms(void) rom = isa_bus_to_virt(extension_rom_resource.start); if (romsignature(rom)) { length = extension_rom_resource.end - extension_rom_resource.start + 1; - if (checksum(rom, length)) { + if (romchecksum(rom, length)) { request_resource(&iomem_resource, &extension_rom_resource); upper = extension_rom_resource.start; } @@ -204,7 +206,7 @@ static void __init probe_roms(void) length = rom[2] * 512; /* but accept any length that fits if checksum okay */ - if (!length || start + length > upper || !checksum(rom, length)) + if (!length || start + length > upper || !romchecksum(rom, length)) continue; adapter_rom_resources[i].start = start; @@ -253,6 +255,8 @@ static __init void parse_cmdline_early (char ** cmdline_p) /* acpi=ht just means: do ACPI MADT parsing at bootup, but don't enable the full ACPI interpreter */ if (!memcmp(from, "acpi=ht", 7)) { + /* if (!acpi_force) */ + disable_acpi(); acpi_ht = 1; } else if (!memcmp(from, "pci=noacpi", 10)) @@ -535,8 +539,7 @@ void __init setup_arch(char **cmdline_p) * the bootmem allocator) but before get_smp_config (to allow parsing * of MADT). */ - if (!acpi_disabled) - acpi_boot_init(); + acpi_boot_init(); #endif #ifdef CONFIG_X86_LOCAL_APIC /* @@ -554,13 +557,13 @@ void __init setup_arch(char **cmdline_p) probe_roms(); e820_reserve_resources(); - request_resource(&iomem_resource, &vram_resource); + request_resource(&iomem_resource, &video_ram_resource); { unsigned i; /* request I/O space for devices used on all i[345]86 PCs */ for (i = 0; i < STANDARD_IO_RESOURCES; i++) - request_resource(&ioport_resource, standard_io_resources+i); + request_resource(&ioport_resource, &standard_io_resources[i]); } /* Will likely break when you have unassigned resources with more @@ -909,7 +912,7 @@ void __init early_identify_cpu(struct cpuinfo_x86 *c) c->x86_model += ((tfms >> 16) & 0xF) << 4; } if (c->x86_capability[0] & (1<<19)) - c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; + c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; } else { /* Have CPUID level 0 only - unheard of */ c->x86 = 4; @@ -967,7 +970,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) display_cacheinfo(c); break; } - + select_idle_routine(c); detect_ht(c); diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index dd0d41548..9d3137a55 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c @@ -39,7 +39,7 @@ extern unsigned char __per_cpu_start[], __per_cpu_end[]; extern struct desc_ptr cpu_gdt_descr[]; struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; -char boot_cpu_stack[IRQSTACKSIZE] __cacheline_aligned; +char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); unsigned long __supported_pte_mask = ~0UL; static int do_not_nx __initdata = 0; @@ -190,7 +190,8 @@ void pda_init(int cpu) pda->irqstackptr += IRQSTACKSIZE-64; } -char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ]; +char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] +__attribute__((section(".bss.page_aligned"))); void __init syscall_init(void) { diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c index fc81ceb32..d814db6e3 100644 --- a/arch/x86_64/kernel/signal.c +++ b/arch/x86_64/kernel/signal.c @@ -40,7 +40,7 @@ void ia32_setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs); asmlinkage long -sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs) +sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs regs) { sigset_t saveset, newset; @@ -57,7 +57,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs) current->blocked = newset; recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n", saveset, newset, ®s, regs.rip); #endif @@ -71,7 +71,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs) } asmlinkage long -sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs regs) +sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, struct pt_regs regs) { return do_sigaltstack(uss, uoss, regs.rsp); } @@ -89,7 +89,7 @@ struct rt_sigframe }; static int -restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *prax) +restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned long *prax) { unsigned int err = 0; @@ -117,7 +117,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *p } { - struct _fpstate * buf; + struct _fpstate __user * buf; err |= __get_user(buf, &sc->fpstate); if (buf) { @@ -136,10 +136,11 @@ badframe: asmlinkage long sys_rt_sigreturn(struct pt_regs regs) { - struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 8); + struct rt_sigframe __user *frame; sigset_t set; long eax; + frame = (struct rt_sigframe __user *)(regs.rsp - 8); if (verify_area(VERIFY_READ, frame, sizeof(*frame))) { goto badframe; } @@ -157,7 +158,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs regs) goto badframe; } -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",current->pid,regs.rip,regs.rsp,frame,eax); #endif @@ -176,7 +177,7 @@ badframe: */ static inline int -setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) { int err = 0; @@ -213,7 +214,7 @@ setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask * Determine which stack to use.. */ -static void * +static void __user * get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size) { unsigned long rsp; @@ -228,20 +229,20 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size) rsp = current->sas_ss_sp + current->sas_ss_size; } - return (void *)round_down(rsp - size, 16); + return (void __user *)round_down(rsp - size, 16); } static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs * regs) { - struct rt_sigframe *frame; - struct _fpstate *fp = NULL; + struct rt_sigframe __user *frame; + struct _fpstate __user *fp = NULL; int err = 0; struct task_struct *me = current; if (me->used_math) { fp = get_stack(ka, regs, sizeof(struct _fpstate)); - frame = (void *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8; + frame = (void __user *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8; if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) { goto give_sigsegv; @@ -294,7 +295,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, goto give_sigsegv; } -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("%d old rip %lx old rsp %lx old rax %lx\n", current->pid,regs->rip,regs->rsp,regs->rax); #endif @@ -319,7 +320,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, set_fs(USER_DS); regs->eflags &= ~TF_MASK; -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", current->comm, current->pid, frame, regs->rip, frame->pretcode); #endif @@ -342,7 +343,7 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset, { struct k_sigaction *ka = ¤t->sighand->action[sig-1]; -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n", current->pid, sig, regs->rip, regs->rsp, regs); #endif @@ -454,7 +455,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags) { -#if DEBUG_SIG +#ifdef DEBUG_SIG printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n", thread_info_flags, regs->rip, regs->rsp, __builtin_return_address(0),signal_pending(current)); #endif @@ -470,7 +471,7 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_ do_signal(regs,oldset); } -void signal_fault(struct pt_regs *regs, void *frame, char *where) +void signal_fault(struct pt_regs *regs, void __user *frame, char *where) { struct task_struct *me = current; if (exception_trace) diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 3ea64ef6d..ba2cba68d 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -895,15 +895,17 @@ static void __init smp_boot_cpus(unsigned int max_cpus) cpu_set(i, cpu_sibling_map[cpu]); } } - } else { + } else { siblings++; cpu_set(cpu, cpu_sibling_map[cpu]); } - if (siblings != smp_num_siblings) - printk(KERN_WARNING - "WARNING: %d siblings found for CPU%d, should be %d\n", + if (siblings != smp_num_siblings) { + printk(KERN_WARNING + "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings); + smp_num_siblings = siblings; + } } Dprintk("Boot done.\n"); diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c index e518c1f29..38a286ca3 100644 --- a/arch/x86_64/kernel/sys_x86_64.c +++ b/arch/x86_64/kernel/sys_x86_64.c @@ -25,7 +25,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way Unix traditionally does this, though. */ -asmlinkage long sys_pipe(int *fildes) +asmlinkage long sys_pipe(int __user *fildes) { int fd[2]; int error; @@ -142,7 +142,7 @@ full_search: } } -asmlinkage long sys_uname(struct new_utsname * name) +asmlinkage long sys_uname(struct new_utsname __user * name) { int err; down_read(&uts_sem); @@ -153,13 +153,13 @@ asmlinkage long sys_uname(struct new_utsname * name) return err ? -EFAULT : 0; } -asmlinkage long wrap_sys_shmat(int shmid, char *shmaddr, int shmflg) +asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg) { unsigned long raddr; return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr; } -asmlinkage long sys_time64(long * tloc) +asmlinkage long sys_time64(long __user * tloc) { struct timeval now; int i; diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 70a170032..d82da80d8 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -302,7 +302,7 @@ void handle_BUG(struct pt_regs *regs) if (__get_user(tmp, f.filename)) f.filename = "unmapped filename"; printk("----------- [cut here ] --------- [please bite here ] ---------\n"); - printk("Kernel BUG at %.50s:%d\n", f.filename, f.line); + printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line); } void out_of_line_bug(void) @@ -356,7 +356,7 @@ void __die(const char * str, struct pt_regs * regs, long err) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); show_registers(regs); /* Executive summary in case the oops scrolled away */ - printk("RIP "); + printk(KERN_ALERT "RIP "); printk_address(regs->rip); printk(" RSP <%016lx>\n", regs->rsp); } diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index c612e4d21..21383547b 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S @@ -39,6 +39,7 @@ SECTIONS __bss_start = .; /* BSS */ .bss : { + *(.bss.page_aligned) *(.bss) } __bss_end = .; @@ -75,8 +76,8 @@ SECTIONS . = ALIGN(8192); /* init_task */ .data.init_task : { *(.data.init_task) } - . = ALIGN(4096); - .data.boot_pgt : { *(.data.boot_pgt) } + . = ALIGN(4096); + .data.page_aligned : { *(.data.page_aligned) } . = ALIGN(4096); /* Init code and data */ __init_begin = .; diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c index a1f892b1e..2b0d63924 100644 --- a/arch/x86_64/kernel/x8664_ksyms.c +++ b/arch/x86_64/kernel/x8664_ksyms.c @@ -219,6 +219,3 @@ EXPORT_SYMBOL_GPL(flush_tlb_all); #endif EXPORT_SYMBOL(sys_ioctl); - -EXPORT_SYMBOL(memcpy_toio); -EXPORT_SYMBOL(memcpy_fromio); diff --git a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile index f09cbc34c..32b206440 100644 --- a/arch/x86_64/lib/Makefile +++ b/arch/x86_64/lib/Makefile @@ -4,9 +4,11 @@ CFLAGS_csum-partial.o := -funroll-loops +obj-y := io.o + lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ usercopy.o getuser.o putuser.o \ - thunk.o io.o clear_page.o copy_page.o bitstr.o + thunk.o clear_page.o copy_page.o bitstr.o lib-y += memcpy.o memmove.o memset.o copy_user.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o diff --git a/arch/x86_64/lib/csum-wrappers.c b/arch/x86_64/lib/csum-wrappers.c index b89aca460..a8e4c189f 100644 --- a/arch/x86_64/lib/csum-wrappers.c +++ b/arch/x86_64/lib/csum-wrappers.c @@ -19,7 +19,7 @@ * src and dst are best aligned to 64bits. */ unsigned int -csum_partial_copy_from_user(const char *src, char *dst, +csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int isum, int *errp) { *errp = 0; @@ -33,7 +33,7 @@ csum_partial_copy_from_user(const char *src, char *dst, if (unlikely((unsigned long)src & 6)) { while (((unsigned long)src & 6) && len >= 2) { __u16 val16; - *errp = __get_user(val16, (__u16 *)src); + *errp = __get_user(val16, (__u16 __user *)src); if (*errp) return isum; *(__u16 *)dst = val16; @@ -43,7 +43,7 @@ csum_partial_copy_from_user(const char *src, char *dst, len -= 2; } } - isum = csum_partial_copy_generic(src,dst,len,isum,errp,NULL); + isum = csum_partial_copy_generic((void *)src,dst,len,isum,errp,NULL); if (likely(*errp == 0)) return isum; } @@ -66,7 +66,7 @@ EXPORT_SYMBOL(csum_partial_copy_from_user); * src and dst are best aligned to 64bits. */ unsigned int -csum_partial_copy_to_user(const char *src, char *dst, +csum_partial_copy_to_user(const char *src, char __user *dst, int len, unsigned int isum, int *errp) { if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { @@ -78,7 +78,7 @@ csum_partial_copy_to_user(const char *src, char *dst, while (((unsigned long)dst & 6) && len >= 2) { __u16 val16 = *(__u16 *)src; isum = add32_with_carry(isum, val16); - *errp = __put_user(val16, (__u16 *)dst); + *errp = __put_user(val16, (__u16 __user *)dst); if (*errp) return isum; src += 2; @@ -88,7 +88,7 @@ csum_partial_copy_to_user(const char *src, char *dst, } *errp = 0; - return csum_partial_copy_generic(src,dst,len,isum,NULL,errp); + return csum_partial_copy_generic(src, (void *)dst,len,isum,NULL,errp); } EXPORT_SYMBOL(csum_partial_copy_to_user); diff --git a/arch/x86_64/lib/io.c b/arch/x86_64/lib/io.c index ca08e3141..5950b821d 100644 --- a/arch/x86_64/lib/io.c +++ b/arch/x86_64/lib/io.c @@ -2,12 +2,14 @@ #include #include -void *memcpy_toio(void *dst,const void*src,unsigned len) +void *__memcpy_toio(unsigned long dst,const void*src,unsigned len) { - return __inline_memcpy(dst,src,len); + return __inline_memcpy((void *) dst,src,len); } +EXPORT_SYMBOL(__memcpy_toio); -void *memcpy_fromio(void *dst,const void*src,unsigned len) +void *__memcpy_fromio(void *dst,unsigned long src,unsigned len) { - return __inline_memcpy(dst,src,len); + return __inline_memcpy(dst,(const void *) src,len); } +EXPORT_SYMBOL(__memcpy_fromio); diff --git a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c index 4a8603efa..c83825e5c 100644 --- a/arch/x86_64/lib/usercopy.c +++ b/arch/x86_64/lib/usercopy.c @@ -40,7 +40,7 @@ do { \ } while (0) long -__strncpy_from_user(char *dst, const char *src, long count) +__strncpy_from_user(char *dst, const char __user *src, long count) { long res; __do_strncpy_from_user(dst, src, count, res); @@ -48,7 +48,7 @@ __strncpy_from_user(char *dst, const char *src, long count) } long -strncpy_from_user(char *dst, const char *src, long count) +strncpy_from_user(char *dst, const char __user *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, 1)) @@ -60,7 +60,7 @@ strncpy_from_user(char *dst, const char *src, long count) * Zero Userspace */ -unsigned long __clear_user(void *addr, unsigned long size) +unsigned long __clear_user(void __user *addr, unsigned long size) { long __d0; /* no memory constraint because it doesn't change any memory gcc knows @@ -94,7 +94,7 @@ unsigned long __clear_user(void *addr, unsigned long size) } -unsigned long clear_user(void *to, unsigned long n) +unsigned long clear_user(void __user *to, unsigned long n) { if (access_ok(VERIFY_WRITE, to, n)) return __clear_user(to, n); @@ -107,7 +107,7 @@ unsigned long clear_user(void *to, unsigned long n) * Return 0 on exception, a value greater than N if too long */ -long strnlen_user(const char *s, long n) +long strnlen_user(const char __user *s, long n) { long res = 0; char c; @@ -127,7 +127,7 @@ long strnlen_user(const char *s, long n) } } -long strlen_user(const char *s) +long strlen_user(const char __user *s) { long res = 0; char c; @@ -142,10 +142,10 @@ long strlen_user(const char *s) } } -unsigned long copy_in_user(void *to, const void *from, unsigned len) +unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len) { if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) { - return copy_user_generic(to, from, len); + return copy_user_generic((void *)to, (void *)from, len); } return len; } diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index e5fd0d445..2cdf34b99 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c @@ -211,7 +211,8 @@ static int is_errata93(struct pt_regs *regs, unsigned long address) int unhandled_signal(struct task_struct *tsk, int sig) { /* Warn for strace, but not for gdb */ - if ((tsk->ptrace & (PT_PTRACED|PT_TRACESYSGOOD)) == PT_PTRACED) + if (!test_ti_thread_flag(tsk->thread_info, TIF_SYSCALL_TRACE) && + (tsk->ptrace & PT_PTRACED)) return 0; return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) || (tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL); @@ -374,7 +375,7 @@ bad_area_nosemaphore: (address >> 32)) return; - if (exception_trace && !unhandled_signal(tsk, SIGSEGV)) { + if (exception_trace && unhandled_signal(tsk, SIGSEGV)) { printk(KERN_INFO "%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", tsk->comm, tsk->pid, address, regs->rip, @@ -423,8 +424,9 @@ no_context: printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); else printk(KERN_ALERT "Unable to handle kernel paging request"); - printk(" at %016lx RIP: \n",address); + printk(" at %016lx RIP: \n" KERN_ALERT,address); printk_address(regs->rip); + printk("\n"); dump_pagetable(address); __die("Oops", regs, error_code); /* Executive summary in case the body of the oops scrolled away */ diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 80266166a..186242e13 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c @@ -512,9 +512,7 @@ void __init reserve_bootmem_generic(unsigned long phys, unsigned len) /* Should check here against the e820 map to avoid double free */ #ifdef CONFIG_DISCONTIGMEM int nid = phys_to_nid(phys); - if (phys < HIGH_MEMORY && nid) - panic("reserve of %lx at node %d", phys, nid); - reserve_bootmem_node(NODE_DATA(nid), phys, len); + reserve_bootmem_node(NODE_DATA(nid), phys, len); #else reserve_bootmem(phys, len); #endif diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c index 8d1cb38a0..0cc4a612f 100644 --- a/arch/x86_64/mm/ioremap.c +++ b/arch/x86_64/mm/ioremap.c @@ -158,6 +158,7 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag area = get_vm_area(size, VM_IOREMAP); if (!area) return NULL; + area->phys_addr = phys_addr; addr = area->addr; if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vunmap(addr); diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index e891e9dc3..598a35c19 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c @@ -124,7 +124,7 @@ void __init setup_node_zones(int nodeid) start_pfn = node_start_pfn(nodeid); end_pfn = node_end_pfn(nodeid); - printk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn); + Dprintk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn); /* All nodes > 0 have a zero length zone DMA */ dma_end_pfn = __pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT; @@ -182,7 +182,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) numnodes = 1; for (i = 0; i < NR_CPUS; i++) cpu_to_node[i] = 0; - node_to_cpumask[0] = 1; + node_to_cpumask[0] = cpumask_of_cpu(0); setup_node_bootmem(0, start_pfn<> PAGE_SHIFT, - addr == address ? prot : PAGE_KERNEL); + addr == address ? prot : ref_prot); } return base; } @@ -95,7 +96,7 @@ static inline void save_page(unsigned long address, struct page *fpage) * No more special protections in this 2/4MB area - revert to a * large page again. */ -static void revert_page(struct page *kpte_page, unsigned long address) +static void revert_page(unsigned long address, pgprot_t ref_prot) { pgd_t *pgd; pmd_t *pmd; @@ -104,12 +105,14 @@ static void revert_page(struct page *kpte_page, unsigned long address) pgd = pgd_offset_k(address); pmd = pmd_offset(pgd, address); BUG_ON(pmd_val(*pmd) & _PAGE_PSE); - large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, PAGE_KERNEL_LARGE); + pgprot_val(ref_prot) |= _PAGE_PSE; + large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot); set_pte((pte_t *)pmd, large_pte); } static int -__change_page_attr(unsigned long address, struct page *page, pgprot_t prot) +__change_page_attr(unsigned long address, struct page *page, pgprot_t prot, + pgprot_t ref_prot) { pte_t *kpte; struct page *kpte_page; @@ -119,29 +122,29 @@ __change_page_attr(unsigned long address, struct page *page, pgprot_t prot) if (!kpte) return 0; kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK); kpte_flags = pte_val(*kpte); - if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) { + if (pgprot_val(prot) != pgprot_val(ref_prot)) { if ((kpte_flags & _PAGE_PSE) == 0) { pte_t old = *kpte; - pte_t standard = mk_pte(page, PAGE_KERNEL); + pte_t standard = mk_pte(page, ref_prot); set_pte(kpte, mk_pte(page, prot)); if (pte_same(old,standard)) get_page(kpte_page); } else { - struct page *split = split_large_page(address, prot); + struct page *split = split_large_page(address, prot, ref_prot); if (!split) return -ENOMEM; get_page(kpte_page); - set_pte(kpte,mk_pte(split, PAGE_KERNEL)); + set_pte(kpte,mk_pte(split, ref_prot)); } } else if ((kpte_flags & _PAGE_PSE) == 0) { - set_pte(kpte, mk_pte(page, PAGE_KERNEL)); + set_pte(kpte, mk_pte(page, ref_prot)); __put_page(kpte_page); } if (page_count(kpte_page) == 1) { save_page(address, kpte_page); - revert_page(kpte_page, address); + revert_page(address, ref_prot); } return 0; } @@ -167,13 +170,17 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot) down_write(&init_mm.mmap_sem); for (i = 0; i < numpages; !err && i++, page++) { unsigned long address = (unsigned long)page_address(page); - err = __change_page_attr(address, page, prot); + err = __change_page_attr(address, page, prot, PAGE_KERNEL); if (err) break; - /* Handle kernel mapping too which aliases part of the lowmem */ - if (page_to_phys(page) < KERNEL_TEXT_SIZE) { - unsigned long addr2 = __START_KERNEL_map + page_to_phys(page); - err = __change_page_attr(addr2, page, prot); + /* Handle kernel mapping too which aliases part of the + * lowmem */ + /* Disabled right now. Fixme */ + if (0 && page_to_phys(page) < KERNEL_TEXT_SIZE) { + unsigned long addr2; + addr2 = __START_KERNEL_map + page_to_phys(page); + err = __change_page_attr(addr2, page, prot, + PAGE_KERNEL_EXEC); } } up_write(&init_mm.mmap_sem); diff --git a/crypto/digest.c b/crypto/digest.c index 30dabe203..d9b6ac9db 100644 --- a/crypto/digest.c +++ b/crypto/digest.c @@ -27,13 +27,28 @@ static void update(struct crypto_tfm *tfm, struct scatterlist *sg, unsigned int nsg) { unsigned int i; - + for (i = 0; i < nsg; i++) { - char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset; - tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), - p, sg[i].length); - crypto_kunmap(p, 0); - crypto_yield(tfm); + + struct page *pg = sg[i].page; + unsigned int offset = sg[i].offset; + unsigned int l = sg[i].length; + + do { + unsigned int bytes_from_page = min(l, ((unsigned int) + (PAGE_SIZE)) - + offset); + char *p = crypto_kmap(pg, 0) + offset; + + tfm->__crt_alg->cra_digest.dia_update + (crypto_tfm_ctx(tfm), p, + bytes_from_page); + crypto_kunmap(p, 0); + crypto_yield(tfm); + offset = 0; + pg++; + l -= bytes_from_page; + } while (l > 0); } } diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 1a537e08e..a742764db 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -267,7 +267,7 @@ config X86_PM_TIMER (TSC) timing source. So, if you see messages like 'Losing too many ticks!' in the - kernel logs, and/or you are using a this on a notebook which + kernel logs, and/or you are using this on a notebook which does not yet have an HPET, you should say "Y" here. endmenu diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 8e73079df..23e994522 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -35,12 +35,6 @@ #include #include #include -#ifdef CONFIG_X86_IO_APIC -#include -#endif -#ifdef CONFIG_IOSAPIC -# include -#endif #include #include @@ -50,10 +44,6 @@ ACPI_MODULE_NAME ("pci_irq") struct acpi_prt_list acpi_prt; -#ifdef CONFIG_X86 -extern void eisa_set_level_irq(unsigned int irq); -#endif - /* -------------------------------------------------------------------------- PCI IRQ Routing Table (PRT) Support @@ -237,12 +227,18 @@ acpi_pci_irq_add_prt ( PCI Interrupt Routing Support -------------------------------------------------------------------------- */ -int -acpi_pci_irq_lookup (struct pci_bus *bus, int device, int pin) +static int +acpi_pci_irq_lookup ( + struct pci_bus *bus, + int device, + int pin, + int *edge_level, + int *active_high_low) { struct acpi_prt_entry *entry = NULL; int segment = pci_domain_nr(bus); int bus_nr = bus->number; + int irq; ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); @@ -255,28 +251,30 @@ acpi_pci_irq_lookup (struct pci_bus *bus, int device, int pin) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); return_VALUE(0); } - - if (!entry->irq && entry->link.handle) { - entry->irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, NULL, NULL); - if (!entry->irq) { + + if (entry->link.handle) { + irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, edge_level, active_high_low); + if (!irq) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); return_VALUE(0); } - } - else if (!entry->irq) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid static routing entry (IRQ 0)\n")); - return_VALUE(0); + } else { + irq = entry->link.index; + *edge_level = ACPI_LEVEL_SENSITIVE; + *active_high_low = ACPI_ACTIVE_LOW; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", entry->irq)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); - return_VALUE(entry->irq); + return_VALUE(irq); } static int acpi_pci_irq_derive ( struct pci_dev *dev, - int pin) + int pin, + int *edge_level, + int *active_high_low) { struct pci_dev *bridge = dev; int irq = 0; @@ -308,8 +306,8 @@ acpi_pci_irq_derive ( pin = bridge_pin; } - irq = acpi_pci_irq_lookup(bridge->bus, - PCI_SLOT(bridge->devfn), pin); + irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), + pin, edge_level, active_high_low); } if (!irq) { @@ -330,6 +328,8 @@ acpi_pci_irq_enable ( { int irq = 0; u8 pin = 0; + int edge_level = ACPI_LEVEL_SENSITIVE; + int active_high_low = ACPI_ACTIVE_LOW; ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); @@ -352,21 +352,22 @@ acpi_pci_irq_enable ( * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT * values override any BIOS-assigned IRQs set during boot. */ - irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin); + irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, &edge_level, &active_high_low); /* * If no PRT entry was found, we'll try to derive an IRQ from the * device's parent bridge. */ if (!irq) - irq = acpi_pci_irq_derive(dev, pin); + irq = acpi_pci_irq_derive(dev, pin, &edge_level, &active_high_low); /* * No IRQ known to the ACPI subsystem - maybe the BIOS / * driver reported one, then use it. Exit in any case. */ if (!irq) { - printk(KERN_WARNING PREFIX "No IRQ known for interrupt pin %c of device %s", ('A' + pin), pci_name(dev)); + printk(KERN_WARNING PREFIX "PCI interrupt %s[%c]: no GSI", + pci_name(dev), ('A' + pin)); /* Interrupt Line values above 0xF are forbidden */ if (dev->irq && (dev->irq <= 0xF)) { printk(" - using IRQ %d\n", dev->irq); @@ -378,62 +379,14 @@ acpi_pci_irq_enable ( } } - dev->irq = irq; + dev->irq = acpi_register_gsi(irq, edge_level, active_high_low); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device %s using IRQ %d\n", pci_name(dev), dev->irq)); - - /* - * Make sure all (legacy) PCI IRQs are set as level-triggered. - */ -#ifdef CONFIG_X86 - { - static u16 irq_mask; - if ((dev->irq < 16) && !((1 << dev->irq) & irq_mask)) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Setting IRQ %d as level-triggered\n", dev->irq)); - irq_mask |= (1 << dev->irq); - eisa_set_level_irq(dev->irq); - } - } -#endif -#ifdef CONFIG_IOSAPIC - if (acpi_irq_model == ACPI_IRQ_MODEL_IOSAPIC) - iosapic_enable_intr(dev->irq); -#endif + printk(KERN_INFO PREFIX "PCI interrupt %s[%c] -> GSI %u " + "(%s, %s) -> IRQ %d\n", + pci_name(dev), 'A' + pin, irq, + (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", + (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", + dev->irq); return_VALUE(dev->irq); } - - -int __init -acpi_pci_irq_init (void) -{ - struct pci_dev *dev = NULL; - - ACPI_FUNCTION_TRACE("acpi_pci_irq_init"); - - if (!acpi_prt.count) { - printk(KERN_WARNING PREFIX "ACPI tables contain no PCI IRQ " - "routing entries\n"); - return_VALUE(-ENODEV); - } - - /* Make sure all link devices have a valid IRQ. */ - if (acpi_pci_link_check()) { - return_VALUE(-ENODEV); - } - -#ifdef CONFIG_X86_IO_APIC - /* Program IOAPICs using data from PRT entries. */ - if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) - mp_parse_prt(); -#endif -#ifdef CONFIG_IOSAPIC - if (acpi_irq_model == ACPI_IRQ_MODEL_IOSAPIC) - iosapic_parse_prt(); -#endif - - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) - acpi_pci_irq_enable(dev); - - return_VALUE(0); -} diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8940e11df..13e922551 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -308,31 +308,12 @@ acpi_pci_link_set ( struct acpi_resource end; } resource; struct acpi_buffer buffer = {sizeof(resource)+1, &resource}; - int i = 0; - int valid = 0; ACPI_FUNCTION_TRACE("acpi_pci_link_set"); if (!link || !irq) return_VALUE(-EINVAL); - /* We don't check irqs the first time around */ - if (link->irq.setonboot) { - /* See if we're already at the target IRQ. */ - if (irq == link->irq.active) - return_VALUE(0); - - /* Make sure the target IRQ in the list of possible IRQs. */ - for (i=0; iirq.possible_count; i++) { - if (irq == link->irq.possible[i]) - valid = 1; - } - if (!valid) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Target IRQ %d invalid\n", irq)); - return_VALUE(-EINVAL); - } - } - memset(&resource, 0, sizeof(resource)); switch(link->irq.resource_type) { @@ -487,13 +468,13 @@ static int __initdata acpi_irq_penalty[ACPI_MAX_IRQS] = { }; int -acpi_pci_link_check (void) +acpi_irq_penalty_init(void) { struct list_head *node = NULL; struct acpi_pci_link *link = NULL; int i = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_check"); + ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); /* * Update penalties to facilitate IRQ balancing. @@ -703,6 +684,9 @@ acpi_pci_link_add ( acpi_link.count++; end: + /* disable all links -- to be activated on use */ + acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); + if (result) kfree(link); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 3d19331bc..dd08b633a 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -113,6 +113,40 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) } } +static acpi_status +get_root_bridge_busnr_callback (struct acpi_resource *resource, void *data) +{ + int *busnr = (int *)data; + struct acpi_resource_address64 address; + + if (resource->id != ACPI_RSTYPE_ADDRESS16 && + resource->id != ACPI_RSTYPE_ADDRESS32 && + resource->id != ACPI_RSTYPE_ADDRESS64) + return AE_OK; + + acpi_resource_to_address64(resource, &address); + if ((address.address_length > 0) && + (address.resource_type == ACPI_BUS_NUMBER_RANGE)) + *busnr = address.min_address_range; + + return AE_OK; +} + +static acpi_status +try_get_root_bridge_busnr(acpi_handle handle, int *busnum) +{ + acpi_status status; + + *busnum = -1; + status = acpi_walk_resources(handle, METHOD_NAME__CRS, get_root_bridge_busnr_callback, busnum); + if (ACPI_FAILURE(status)) + return status; + /* Check if we really get a bus number from _CRS */ + if (*busnum == -1) + return AE_ERROR; + return AE_OK; +} + static int acpi_pci_root_add ( struct acpi_device *device) @@ -190,9 +224,22 @@ acpi_pci_root_add ( /* Some systems have wrong _BBN */ list_for_each_entry(tmp, &acpi_pci_roots, node) { if ((tmp->id.segment == root->id.segment) - && (tmp->id.bus == root->id.bus)) + && (tmp->id.bus == root->id.bus)) { + int bus = 0; + acpi_status status; + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); + + status = try_get_root_bridge_busnr(root->handle, &bus); + if (ACPI_FAILURE(status)) + break; + if (bus != root->id.bus) { + printk(KERN_INFO PREFIX "PCI _CRS %d overrides _BBN 0\n", bus); + root->id.bus = bus; + } + break; + } } /* * Device & Function diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index d87764ebd..a1844bc88 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -131,7 +131,7 @@ acpi_table_print_madt_entry ( { struct acpi_table_ioapic *p = (struct acpi_table_ioapic*) header; - printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] global_irq_base[0x%x])\n", + printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", p->id, p->address, p->global_irq_base); } break; @@ -185,8 +185,8 @@ acpi_table_print_madt_entry ( { struct acpi_table_iosapic *p = (struct acpi_table_iosapic*) header; - printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] global_irq_base[0x%x] address[%p])\n", - p->id, p->global_irq_base, (void *) (unsigned long) p->address); + printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", + p->id, (void *) (unsigned long) p->address, p->global_irq_base); } break; diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 00c80593a..7b94ac081 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -289,6 +289,13 @@ acpi_thermal_set_cooling_mode ( status = acpi_get_handle(tz->handle, "_SCP", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); + status = acpi_get_handle(tz->handle, "_PSV", &handle); + if(!ACPI_FAILURE(status)) { + tz->cooling_mode = 1; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", + mode?"passive":"active")); + return_VALUE(0); + } return_VALUE(-ENODEV); } diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index b293bb7f9..c26a12e56 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c @@ -1706,105 +1706,108 @@ static void destroy_queues (amb_dev * dev) { } /********** basic loader commands and error handling **********/ +// centisecond timeouts - guessing away here +static unsigned int command_timeouts [] = { + [host_memory_test] = 15, + [read_adapter_memory] = 2, + [write_adapter_memory] = 2, + [adapter_start] = 50, + [get_version_number] = 10, + [interrupt_host] = 1, + [flash_erase_sector] = 1, + [adap_download_block] = 1, + [adap_erase_flash] = 1, + [adap_run_in_iram] = 1, + [adap_end_download] = 1 +}; + + +unsigned int command_successes [] = { + [host_memory_test] = COMMAND_PASSED_TEST, + [read_adapter_memory] = COMMAND_READ_DATA_OK, + [write_adapter_memory] = COMMAND_WRITE_DATA_OK, + [adapter_start] = COMMAND_COMPLETE, + [get_version_number] = COMMAND_COMPLETE, + [interrupt_host] = COMMAND_COMPLETE, + [flash_erase_sector] = COMMAND_COMPLETE, + [adap_download_block] = COMMAND_COMPLETE, + [adap_erase_flash] = COMMAND_COMPLETE, + [adap_run_in_iram] = COMMAND_COMPLETE, + [adap_end_download] = COMMAND_COMPLETE +}; + +static int decode_loader_result (loader_command cmd, u32 result) +{ + int res; + const char *msg; + + if (result == command_successes[cmd]) + return 0; + + switch (result) { + case BAD_COMMAND: + res = -EINVAL; + msg = "bad command"; + break; + case COMMAND_IN_PROGRESS: + res = -ETIMEDOUT; + msg = "command in progress"; + break; + case COMMAND_PASSED_TEST: + res = 0; + msg = "command passed test"; + break; + case COMMAND_FAILED_TEST: + res = -EIO; + msg = "command failed test"; + break; + case COMMAND_READ_DATA_OK: + res = 0; + msg = "command read data ok"; + break; + case COMMAND_READ_BAD_ADDRESS: + res = -EINVAL; + msg = "command read bad address"; + break; + case COMMAND_WRITE_DATA_OK: + res = 0; + msg = "command write data ok"; + break; + case COMMAND_WRITE_BAD_ADDRESS: + res = -EINVAL; + msg = "command write bad address"; + break; + case COMMAND_WRITE_FLASH_FAILURE: + res = -EIO; + msg = "command write flash failure"; + break; + case COMMAND_COMPLETE: + res = 0; + msg = "command complete"; + break; + case COMMAND_FLASH_ERASE_FAILURE: + res = -EIO; + msg = "command flash erase failure"; + break; + case COMMAND_WRITE_BAD_DATA: + res = -EINVAL; + msg = "command write bad data"; + break; + default: + res = -EINVAL; + msg = "unknown error"; + PRINTD (DBG_LOAD|DBG_ERR, + "decode_loader_result got %d=%x !", + result, result); + break; + } + + PRINTK (KERN_ERR, "%s", msg); + return res; +} static int __init do_loader_command (volatile loader_block * lb, const amb_dev * dev, loader_command cmd) { - // centisecond timeouts - guessing away here - unsigned int command_timeouts [] = { - [host_memory_test] = 15, - [read_adapter_memory] = 2, - [write_adapter_memory] = 2, - [adapter_start] = 50, - [get_version_number] = 10, - [interrupt_host] = 1, - [flash_erase_sector] = 1, - [adap_download_block] = 1, - [adap_erase_flash] = 1, - [adap_run_in_iram] = 1, - [adap_end_download] = 1 - }; - - unsigned int command_successes [] = { - [host_memory_test] = COMMAND_PASSED_TEST, - [read_adapter_memory] = COMMAND_READ_DATA_OK, - [write_adapter_memory] = COMMAND_WRITE_DATA_OK, - [adapter_start] = COMMAND_COMPLETE, - [get_version_number] = COMMAND_COMPLETE, - [interrupt_host] = COMMAND_COMPLETE, - [flash_erase_sector] = COMMAND_COMPLETE, - [adap_download_block] = COMMAND_COMPLETE, - [adap_erase_flash] = COMMAND_COMPLETE, - [adap_run_in_iram] = COMMAND_COMPLETE, - [adap_end_download] = COMMAND_COMPLETE - }; - - int decode_loader_result (loader_command cmd, u32 result) { - int res; - const char * msg; - - if (result == command_successes[cmd]) - return 0; - - switch (result) { - case BAD_COMMAND: - res = -EINVAL; - msg = "bad command"; - break; - case COMMAND_IN_PROGRESS: - res = -ETIMEDOUT; - msg = "command in progress"; - break; - case COMMAND_PASSED_TEST: - res = 0; - msg = "command passed test"; - break; - case COMMAND_FAILED_TEST: - res = -EIO; - msg = "command failed test"; - break; - case COMMAND_READ_DATA_OK: - res = 0; - msg = "command read data ok"; - break; - case COMMAND_READ_BAD_ADDRESS: - res = -EINVAL; - msg = "command read bad address"; - break; - case COMMAND_WRITE_DATA_OK: - res = 0; - msg = "command write data ok"; - break; - case COMMAND_WRITE_BAD_ADDRESS: - res = -EINVAL; - msg = "command write bad address"; - break; - case COMMAND_WRITE_FLASH_FAILURE: - res = -EIO; - msg = "command write flash failure"; - break; - case COMMAND_COMPLETE: - res = 0; - msg = "command complete"; - break; - case COMMAND_FLASH_ERASE_FAILURE: - res = -EIO; - msg = "command flash erase failure"; - break; - case COMMAND_WRITE_BAD_DATA: - res = -EINVAL; - msg = "command write bad data"; - break; - default: - res = -EINVAL; - msg = "unknown error"; - PRINTD (DBG_LOAD|DBG_ERR, "decode_loader_result got %d=%x !", - result, result); - break; - } - - PRINTK (KERN_ERR, "%s", msg); - return res; - } unsigned long timeout; @@ -1930,6 +1933,11 @@ static int __init loader_start (loader_block * lb, /********** reset card **********/ +static inline void sf (const char * msg) +{ + PRINTK (KERN_ERR, "self-test failed: %s", msg); +} + static int amb_reset (amb_dev * dev, int diags) { u32 word; @@ -1974,9 +1982,6 @@ static int amb_reset (amb_dev * dev, int diags) { // XXX double check byte-order word = rd_mem (dev, offsetof(amb_mem, mb.loader.result)); if (word & SELF_TEST_FAILURE) { - void sf (const char * msg) { - PRINTK (KERN_ERR, "self-test failed: %s", msg); - } if (word & GPINT_TST_FAILURE) sf ("interrupt"); if (word & SUNI_DATA_PATTERN_FAILURE) @@ -2044,31 +2049,31 @@ static int __init ucode_init (loader_block * lb, amb_dev * dev) { } /********** give adapter parameters **********/ + +static inline u32 bus_addr(void * addr) { + return cpu_to_be32 (virt_to_bus (addr)); +} static int __init amb_talk (amb_dev * dev) { adap_talk_block a; unsigned char pool; unsigned long timeout; - u32 x (void * addr) { - return cpu_to_be32 (virt_to_bus (addr)); - } - PRINTD (DBG_FLOW, "amb_talk %p", dev); - a.command_start = x (dev->cq.ptrs.start); - a.command_end = x (dev->cq.ptrs.limit); - a.tx_start = x (dev->txq.in.start); - a.tx_end = x (dev->txq.in.limit); - a.txcom_start = x (dev->txq.out.start); - a.txcom_end = x (dev->txq.out.limit); + a.command_start = bus_addr (dev->cq.ptrs.start); + a.command_end = bus_addr (dev->cq.ptrs.limit); + a.tx_start = bus_addr (dev->txq.in.start); + a.tx_end = bus_addr (dev->txq.in.limit); + a.txcom_start = bus_addr (dev->txq.out.start); + a.txcom_end = bus_addr (dev->txq.out.limit); for (pool = 0; pool < NUM_RX_POOLS; ++pool) { // the other "a" items are set up by the adapter - a.rec_struct[pool].buffer_start = x (dev->rxq[pool].in.start); - a.rec_struct[pool].buffer_end = x (dev->rxq[pool].in.limit); - a.rec_struct[pool].rx_start = x (dev->rxq[pool].out.start); - a.rec_struct[pool].rx_end = x (dev->rxq[pool].out.limit); + a.rec_struct[pool].buffer_start = bus_addr (dev->rxq[pool].in.start); + a.rec_struct[pool].buffer_end = bus_addr (dev->rxq[pool].in.limit); + a.rec_struct[pool].rx_start = bus_addr (dev->rxq[pool].out.start); + a.rec_struct[pool].rx_end = bus_addr (dev->rxq[pool].out.limit); a.rec_struct[pool].buffer_size = cpu_to_be32 (dev->rxq[pool].buffer_size); } @@ -2111,15 +2116,10 @@ static void __init amb_ucode_version (amb_dev * dev) { minor = be32_to_cpu (cmd.args.version.minor); PRINTK (KERN_INFO, "microcode version is %u.%u", major, minor); } - -// get end station address -static void __init amb_esi (amb_dev * dev, u8 * esi) { - u32 lower4; - u16 upper2; - command cmd; - // swap bits within byte to get Ethernet ordering - u8 bit_swap (u8 byte) { +// swap bits within byte to get Ethernet ordering +u8 bit_swap (u8 byte) +{ const u8 swap[] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, @@ -2127,7 +2127,13 @@ static void __init amb_esi (amb_dev * dev, u8 * esi) { 0x3, 0xb, 0x7, 0xf }; return ((swap[byte & 0xf]<<4) | swap[byte>>4]); - } +} + +// get end station address +static void __init amb_esi (amb_dev * dev, u8 * esi) { + u32 lower4; + u16 upper2; + command cmd; cmd.request = cpu_to_be32 (SRB_GET_BIA); while (command_do (dev, &cmd)) { @@ -2155,29 +2161,31 @@ static void __init amb_esi (amb_dev * dev, u8 * esi) { return; } + +static void fixup_plx_window (amb_dev *dev, loader_block *lb) +{ + // fix up the PLX-mapped window base address to match the block + unsigned long blb; + u32 mapreg; + blb = virt_to_bus(lb); + // the kernel stack had better not ever cross a 1Gb boundary! + mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10])); + mapreg &= ~onegigmask; + mapreg |= blb & onegigmask; + wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg); + return; +} -static int __init amb_init (amb_dev * dev) { +static int __init amb_init (amb_dev * dev) +{ loader_block lb; - void fixup_plx_window (void) { - // fix up the PLX-mapped window base address to match the block - unsigned long blb; - u32 mapreg; - blb = virt_to_bus (&lb); - // the kernel stack had better not ever cross a 1Gb boundary! - mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10])); - mapreg &= ~onegigmask; - mapreg |= blb & onegigmask; - wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg); - return; - } - u32 version; if (amb_reset (dev, 1)) { PRINTK (KERN_ERR, "card reset failed!"); } else { - fixup_plx_window (); + fixup_plx_window (dev, &lb); if (get_loader_version (&lb, dev, &version)) { PRINTK (KERN_INFO, "failed to get loader version"); @@ -2207,31 +2215,20 @@ static int __init amb_init (amb_dev * dev) { } /* amb_reset */ - return -1; + return -EINVAL; } -static int __init amb_probe (void) { - struct pci_dev * pci_dev; - int devs; - - void __init do_pci_device (void) { - amb_dev * dev; - - // read resources from PCI configuration space - u8 irq = pci_dev->irq; - u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0)); - u32 iobase = pci_resource_start (pci_dev, 1); - - void setup_dev (void) { +static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev) +{ unsigned char pool; memset (dev, 0, sizeof(amb_dev)); // set up known dev items straight away dev->pci_dev = pci_dev; - dev->iobase = iobase; - dev->irq = irq; - dev->membase = membase; + dev->iobase = pci_resource_start (pci_dev, 1); + dev->irq = pci_dev->irq; + dev->membase = bus_to_virt(pci_resource_start(pci_dev, 0)); // flags (currently only dead) dev->flags = 0; @@ -2258,101 +2255,125 @@ static int __init amb_probe (void) { spin_lock_init (&dev->txq.lock); for (pool = 0; pool < NUM_RX_POOLS; ++pool) spin_lock_init (&dev->rxq[pool].lock); - } - - void setup_pci_dev (void) { - unsigned char lat; - - /* XXX check return value */ - pci_enable_device (pci_dev); +} - // enable bus master accesses - pci_set_master (pci_dev); - - // frobnicate latency (upwards, usually) - pci_read_config_byte (pci_dev, PCI_LATENCY_TIMER, &lat); - if (pci_lat) { - PRINTD (DBG_INIT, "%s PCI latency timer from %hu to %hu", - "changing", lat, pci_lat); - pci_write_config_byte (pci_dev, PCI_LATENCY_TIMER, pci_lat); - } else if (lat < MIN_PCI_LATENCY) { - PRINTK (KERN_INFO, "%s PCI latency timer from %hu to %hu", - "increasing", lat, MIN_PCI_LATENCY); - pci_write_config_byte (pci_dev, PCI_LATENCY_TIMER, MIN_PCI_LATENCY); - } - } - - PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at" - " IO %x, IRQ %u, MEM %p", iobase, irq, membase); - - // check IO region - if (!request_region (iobase, AMB_EXTENT, DEV_LABEL)) { - PRINTK (KERN_ERR, "IO range already in use!"); - return; - } - - dev = kmalloc (sizeof(amb_dev), GFP_KERNEL); - if (!dev) { - // perhaps we should be nice: deregister all adapters and abort? - PRINTK (KERN_ERR, "out of memory!"); - release_region (iobase, AMB_EXTENT); - return; - } - - setup_dev(); - - if (amb_init (dev)) { - PRINTK (KERN_ERR, "adapter initialisation failure"); - } else { +static int setup_pci_dev(struct pci_dev *pci_dev) +{ + unsigned char lat; + int ret; - setup_pci_dev(); + // enable bus master accesses + pci_set_master(pci_dev); - // grab (but share) IRQ and install handler - if (request_irq (irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev)) { - PRINTK (KERN_ERR, "request IRQ failed!"); - // free_irq is at "endif" - } else { - + ret = pci_enable_device(pci_dev); + if (ret < 0) + goto out; + + // frobnicate latency (upwards, usually) + pci_read_config_byte (pci_dev, PCI_LATENCY_TIMER, &lat); + + if (!pci_lat) + pci_lat = (lat < MIN_PCI_LATENCY) ? MIN_PCI_LATENCY : lat; + + if (lat != pci_lat) { + PRINTK (KERN_INFO, "Changing PCI latency timer from %hu to %hu", + lat, pci_lat); + pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, pci_lat); + } +out: + return ret; +} + +static int __init do_pci_device(struct pci_dev *pci_dev) +{ + amb_dev * dev; + int err; + + // read resources from PCI configuration space + u8 irq = pci_dev->irq; + u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0)); + u32 iobase = pci_resource_start (pci_dev, 1); + + PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at" + " IO %x, IRQ %u, MEM %p", iobase, irq, membase); + + // check IO region + err = pci_request_region(pci_dev, 1, DEV_LABEL); + if (err < 0) { + PRINTK (KERN_ERR, "IO range already in use!"); + goto out; + } + + dev = kmalloc (sizeof(amb_dev), GFP_KERNEL); + if (!dev) { + PRINTK (KERN_ERR, "out of memory!"); + err = -ENOMEM; + goto out_release; + } + + setup_dev(dev, pci_dev); + + err = amb_init(dev); + if (err < 0) { + PRINTK (KERN_ERR, "adapter initialisation failure"); + goto out_free; + } + + err = setup_pci_dev(pci_dev); + if (err < 0) + goto out_reset; + + // grab (but share) IRQ and install handler + err = request_irq(irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev); + if (err < 0) { + PRINTK (KERN_ERR, "request IRQ failed!"); + goto out_disable; + } + dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL); if (!dev->atm_dev) { - PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); - } else { - - PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p", - dev->atm_dev->number, dev, dev->atm_dev); - dev->atm_dev->dev_data = (void *) dev; - - // register our address - amb_esi (dev, dev->atm_dev->esi); - - // 0 bits for vpi, 10 bits for vci - dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS; - dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS; - - // update count and linked list - ++devs; - dev->prev = amb_devs; - amb_devs = dev; - - // enable host interrupts - interrupts_on (dev); - - // success - return; - - // not currently reached - atm_dev_deregister (dev->atm_dev); - } /* atm_dev_register */ - - free_irq (irq, dev); - } /* request_irq */ - - amb_reset (dev, 0); - } /* amb_init */ - - kfree (dev); - release_region (iobase, AMB_EXTENT); - } /* kmalloc, end-of-fn */ + PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); + err = -EINVAL; + goto out_free_irq; + } + + PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p", + dev->atm_dev->number, dev, dev->atm_dev); + dev->atm_dev->dev_data = (void *) dev; + + // register our address + amb_esi (dev, dev->atm_dev->esi); + + // 0 bits for vpi, 10 bits for vci + dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS; + dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS; + + // update linked list + dev->prev = amb_devs; + amb_devs = dev; + + // enable host interrupts + interrupts_on (dev); + +out: + return err; + +out_free_irq: + free_irq(irq, dev); +out_disable: + pci_disable_device(pci_dev); +out_reset: + amb_reset(dev, 0); +out_free: + kfree(dev); +out_release: + pci_release_region(pci_dev, 1); + goto out; +} + +static int __init amb_probe (void) { + struct pci_dev * pci_dev; + int devs; PRINTD (DBG_FLOW, "amb_probe"); @@ -2360,8 +2381,11 @@ static int __init amb_probe (void) { pci_dev = NULL; while ((pci_dev = pci_find_device (PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_AMBASSADOR, pci_dev) - )) - do_pci_device(); + )) { + if (do_pci_device(pci_dev) == 0) + devs++; + } + pci_dev = NULL; while ((pci_dev = pci_find_device @@ -2474,7 +2498,10 @@ static void __exit amb_module_exit (void) { del_timer_sync(&housekeeping); while (amb_devs) { + struct pci_dev *pdev; + dev = amb_devs; + pdev = dev->pci_dev; amb_devs = dev->prev; PRINTD (DBG_INFO|DBG_INIT, "closing %p (atm_dev = %p)", dev, dev->atm_dev); @@ -2482,11 +2509,12 @@ static void __exit amb_module_exit (void) { drain_rx_pools (dev); interrupts_off (dev); amb_reset (dev, 0); + free_irq (dev->irq, dev); + pci_disable_device (pdev); destroy_queues (dev); atm_dev_deregister (dev->atm_dev); - free_irq (dev->irq, dev); - release_region (dev->iobase, AMB_EXTENT); kfree (dev); + pci_release_region (pdev, 1); } return; diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index aa1cbe395..0572f724b 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c @@ -152,7 +152,7 @@ static void atmtcp_v_close(struct atm_vcc *vcc) } -static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct atm_cirange ci; struct atm_vcc *vcc; @@ -161,7 +161,7 @@ static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) int i; if (cmd != ATM_SETCIRANGE) return -ENOIOCTLCMD; - if (copy_from_user(&ci,(void *) arg,sizeof(ci))) return -EFAULT; + if (copy_from_user(&ci, arg,sizeof(ci))) return -EFAULT; if (ci.vpi_bits == ATM_CI_MAX) ci.vpi_bits = MAX_VPI_BITS; if (ci.vci_bits == ATM_CI_MAX) ci.vci_bits = MAX_VCI_BITS; if (ci.vpi_bits > MAX_VPI_BITS || ci.vpi_bits < 0 || diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index b76058900..8b137034d 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c @@ -1968,7 +1968,7 @@ static int eni_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flgs) } -static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct eni_dev *eni_dev = ENI_DEV(dev); @@ -1983,7 +1983,7 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) struct eni_multipliers mult; if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(&mult,(void *) arg, + if (copy_from_user(&mult, arg, sizeof(struct eni_multipliers))) return -EFAULT; if ((mult.tx && mult.tx <= 100) || (mult.rx &&mult.rx <= 100) || @@ -1996,7 +1996,7 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) if (cmd == ATM_SETCIRANGE) { struct atm_cirange ci; - if (copy_from_user(&ci,(void *) arg,sizeof(struct atm_cirange))) + if (copy_from_user(&ci, arg,sizeof(struct atm_cirange))) return -EFAULT; if ((ci.vpi_bits == 0 || ci.vpi_bits == ATM_CI_MAX) && (ci.vci_bits == NR_VCI_LD || ci.vpi_bits == ATM_CI_MAX)) @@ -2009,14 +2009,14 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index f45adbb4c..025c692fd 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c @@ -1220,7 +1220,7 @@ static int fs_send (struct atm_vcc *atm_vcc, struct sk_buff *skb) /* Some function placeholders for functions we don't yet support. */ #if 0 -static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { func_enter (); func_exit (); @@ -1229,7 +1229,7 @@ static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { func_enter (); func_exit (); @@ -1238,7 +1238,7 @@ static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname, static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { func_enter (); func_exit (); diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index e46d01b9b..e33b5357e 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -682,7 +683,7 @@ fore200e_pca_prom_read(struct fore200e* fore200e, struct prom_data* prom) opcode.opcode = OPCODE_GET_PROM; opcode.pad = 0; - prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE); + prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), DMA_FROM_DEVICE); fore200e->bus->write(prom_dma, &entry->cp_entry->cmd.prom_block.prom_haddr); @@ -694,7 +695,7 @@ fore200e_pca_prom_read(struct fore200e* fore200e, struct prom_data* prom) *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get PROM data from device %s\n", fore200e->name); @@ -1003,7 +1004,7 @@ fore200e_tx_irq(struct fore200e* fore200e) /* remove DMA mapping */ fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length, - FORE200E_DMA_TODEVICE); + DMA_TO_DEVICE); vc_map = entry->vc_map; @@ -1228,12 +1229,12 @@ fore200e_push_rpd(struct fore200e* fore200e, struct atm_vcc* vcc, struct rpd* rp buffer = FORE200E_HDL2BUF(rpd->rsd[ i ].handle); /* Make device DMA transfer visible to CPU. */ - fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); memcpy(skb_put(skb, rpd->rsd[ i ].length), buffer->data.align_addr, rpd->rsd[ i ].length); /* Now let the device get at it again. */ - fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE); } DPRINTK(3, "rx skb: len = %d, truesize = %d\n", skb->len, skb->truesize); @@ -1807,7 +1808,7 @@ fore200e_send(struct atm_vcc *vcc, struct sk_buff *skb) entry->data = tx_copy ? data : NULL; tpd = entry->tpd; - tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, FORE200E_DMA_TODEVICE); + tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, DMA_TO_DEVICE); tpd->tsd[ 0 ].length = tx_len; FORE200E_NEXT_ENTRY(txq->head, QUEUE_SIZE_TX); @@ -1881,7 +1882,7 @@ fore200e_getstats(struct fore200e* fore200e) } stats_dma_addr = fore200e->bus->dma_map(fore200e, fore200e->stats, - sizeof(struct stats), FORE200E_DMA_FROMDEVICE); + sizeof(struct stats), DMA_FROM_DEVICE); FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); @@ -1898,7 +1899,7 @@ fore200e_getstats(struct fore200e* fore200e) *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get statistics from device %s\n", fore200e->name); @@ -1910,7 +1911,7 @@ fore200e_getstats(struct fore200e* fore200e) static int -fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen) +fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) { /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ @@ -1922,7 +1923,7 @@ fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, i static int -fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen) +fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen) { /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */ @@ -1943,7 +1944,7 @@ fore200e_get_oc3(struct fore200e* fore200e, struct oc3_regs* regs) int ok; u32 oc3_regs_dma_addr; - oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE); + oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), DMA_FROM_DEVICE); FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD); @@ -1962,7 +1963,7 @@ fore200e_get_oc3(struct fore200e* fore200e, struct oc3_regs* regs) *entry->status = STATUS_FREE; - fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE); + fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), DMA_FROM_DEVICE); if (ok == 0) { printk(FORE200E "unable to get OC-3 regs of device %s\n", fore200e->name); @@ -2058,7 +2059,7 @@ fore200e_swap(unsigned int in) static int -fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats* arg) +fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg) { struct sonet_stats tmp; @@ -2087,7 +2088,7 @@ fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats* arg) static int -fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void* arg) +fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void __user * arg) { struct fore200e* fore200e = FORE200E_DEV(dev); @@ -2096,19 +2097,19 @@ fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void* arg) switch (cmd) { case SONET_GETSTAT: - return fore200e_fetch_stats(fore200e, (struct sonet_stats*)arg); + return fore200e_fetch_stats(fore200e, (struct sonet_stats __user *)arg); case SONET_GETDIAG: - return put_user(0, (int*)arg) ? -EFAULT : 0; + return put_user(0, (int __user *)arg) ? -EFAULT : 0; case ATM_SETLOOP: return fore200e_setloop(fore200e, (int)(unsigned long)arg); case ATM_GETLOOP: - return put_user(fore200e->loop_mode, (int*)arg) ? -EFAULT : 0; + return put_user(fore200e->loop_mode, (int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: - return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int*)arg) ? -EFAULT : 0; + return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int __user *)arg) ? -EFAULT : 0; } return -ENOSYS; /* not implemented */ @@ -2257,7 +2258,7 @@ fore200e_alloc_rx_buf(struct fore200e* fore200e) /* allocate the receive buffer body */ if (fore200e_chunk_alloc(fore200e, &buffer[ i ].data, size, fore200e->bus->buffer_alignment, - FORE200E_DMA_FROMDEVICE) < 0) { + DMA_FROM_DEVICE) < 0) { while (i > 0) fore200e_chunk_free(fore200e, &buffer[ --i ].data); diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index 6a9d2ee97..aca550b66 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h @@ -556,7 +556,7 @@ typedef struct host_bsq_entry { typedef struct host_cmdq_entry { struct cp_cmdq_entry* cp_entry; /* addr of cp resident cmd queue entry */ - enum status* status; /* addr of host resident status */ + enum status *status; /* addr of host resident status */ } host_cmdq_entry_t; @@ -668,7 +668,7 @@ typedef struct bs_spec { typedef struct init_block { enum opcode opcode; /* initialize command */ - enum status status; /* related status word */ + enum status status; /* related status word */ u32 receive_threshold; /* not used */ u32 num_connect; /* ATM connections */ u32 cmd_queue_len; /* length of command queue */ @@ -827,28 +827,6 @@ typedef struct fore200e_bus { int (*proc_read)(struct fore200e*, char*); } fore200e_bus_t; - -#if defined(CONFIG_ATM_FORE200E_SBA) -# if defined(CONFIG_ATM_FORE200E_PCA) -# define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE -# else -# define FORE200E_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE SBUS_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE SBUS_DMA_FROMDEVICE -# endif -#else -# ifndef CONFIG_ATM_FORE200E_PCA -# warning compiling the fore200e driver without any hardware support enabled! -# include -# endif -# define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL -# define FORE200E_DMA_TODEVICE PCI_DMA_TODEVICE -# define FORE200E_DMA_FROMDEVICE PCI_DMA_FROMDEVICE -#endif - - /* vc mapping */ typedef struct fore200e_vc_map { diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 72123ecfb..ad746d981 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -134,7 +134,7 @@ static char *version = "$Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $"; static int he_open(struct atm_vcc *vcc); static void he_close(struct atm_vcc *vcc); static int he_send(struct atm_vcc *vcc, struct sk_buff *skb); -static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); +static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg); static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs); static void he_tasklet(unsigned long data); static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page); @@ -2809,7 +2809,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb) } static int -he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void *arg) +he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg) { unsigned long flags; struct he_dev *he_dev = HE_DEV(atm_dev); @@ -2821,8 +2821,8 @@ he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void *arg) if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(®, (struct he_ioctl_reg *) arg, - sizeof(struct he_ioctl_reg))) + if (copy_from_user(®, arg, + sizeof(struct he_ioctl_reg))) return -EFAULT; spin_lock_irqsave(&he_dev->global_lock, flags); @@ -2848,7 +2848,7 @@ he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void *arg) } spin_unlock_irqrestore(&he_dev->global_lock, flags); if (err == 0) - if (copy_to_user((struct he_ioctl_reg *) arg, ®, + if (copy_to_user(arg, ®, sizeof(struct he_ioctl_reg))) return -EFAULT; break; diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 90e407a9a..a794610da 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -597,126 +597,112 @@ static inline u16 rx_q_entry_to_rx_channel (u32 x) { // p ranges from 1 to a power of 2 #define CR_MAXPEXP 4 - + static int make_rate (const hrz_dev * dev, u32 c, rounding r, - u16 * bits, unsigned int * actual) { - - // note: rounding the rate down means rounding 'p' up - - const unsigned long br = test_bit(ultra, &dev->flags) ? BR_ULT : BR_HRZ; - - u32 div = CR_MIND; - u32 pre; + u16 * bits, unsigned int * actual) +{ + // note: rounding the rate down means rounding 'p' up + const unsigned long br = test_bit(ultra, &dev->flags) ? BR_ULT : BR_HRZ; - // local fn to build the timer bits - int set_cr (void) { - // paranoia - if (div > CR_MAXD || (!pre) || pre > 1<> 1; - ++br_exp; - } - // (br >>br_exp) <> 1; + ++br_exp; + } + // (br >>br_exp) < CR_MAXD || (!pre) || pre > 1<> 1; - CLOCK_IT(); + CLOCK_IT(dev, ctrl); if (rd_regl (dev, CONTROL_0_REG) & SEEPROM_DO) res |= (1 << (data_bits-1)); } ctrl &= ~(SEEPROM_SK | SEEPROM_CS); - WRITE_IT_WAIT(); + WRITE_IT_WAIT(dev, ctrl); return res; } diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index c95ca296b..c1fb6c710 100644 --- a/drivers/atm/idt77105.c +++ b/drivers/atm/idt77105.c @@ -141,7 +141,7 @@ static void idt77105_restart_timer_func(unsigned long dummy) } -static int fetch_stats(struct atm_dev *dev,struct idt77105_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct idt77105_stats __user *arg,int zero) { unsigned long flags; struct idt77105_stats stats; @@ -188,7 +188,7 @@ static int set_loopback(struct atm_dev *dev,int mode) } -static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { printk(KERN_NOTICE "%s(%d) idt77105_ioctl() called\n",dev->type,dev->number); switch (cmd) { @@ -196,16 +196,15 @@ static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) if (!capable(CAP_NET_ADMIN)) return -EPERM; /* fall through */ case IDT77105_GETSTAT: - return fetch_stats(dev,(struct idt77105_stats *) arg, - cmd == IDT77105_GETSTATZ); + return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ); case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_ATM | ATM_LM_RMT_ATM, - (int *) arg) ? -EFAULT : 0; + (int __user *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 2b6b9c6eb..3c964ecfb 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -2738,12 +2738,12 @@ static int ia_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags) return 0; } -static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) +static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) { IA_CMDBUF ia_cmds; IADEV *iadev; int i, board; - u16 *tmps; + u16 __user *tmps; IF_EVENT(printk(">ia_ioctl\n");) if (cmd != IA_CMD) { if (!dev->phy->ioctl) return -EINVAL; @@ -2766,7 +2766,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) break; case MEMDUMP_SEGREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - tmps = (u16 *)ia_cmds.buf; + tmps = (u16 __user *)ia_cmds.buf; for(i=0; i<0x80; i+=2, tmps++) if(put_user((u16)(readl(iadev->seg_reg+i) & 0xffff), tmps)) return -EFAULT; ia_cmds.status = 0; @@ -2774,7 +2774,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) break; case MEMDUMP_REASSREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - tmps = (u16 *)ia_cmds.buf; + tmps = (u16 __user *)ia_cmds.buf; for(i=0; i<0x80; i+=2, tmps++) if(put_user((u16)(readl(iadev->reass_reg+i) & 0xffff), tmps)) return -EFAULT; ia_cmds.status = 0; @@ -2874,14 +2874,14 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) } static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname, - void *optval, int optlen) + void __user *optval, int optlen) { IF_EVENT(printk(">ia_getsockopt\n");) return -EINVAL; } static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname, - void *optval, int optlen) + void __user *optval, int optlen) { IF_EVENT(printk(">ia_setsockopt\n");) return -EINVAL; diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index 1134bda43..92e514c79 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h @@ -141,7 +141,7 @@ typedef struct { int len; u32 maddr; int status; - void *buf; + void __user *buf; } IA_CMDBUF, *PIA_CMDBUF; /* cmds */ diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index 5a7037af6..ac80b9efd 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c @@ -2435,7 +2435,7 @@ static int lanai_open(struct atm_vcc *atmvcc) #if 0 /* ioctl operations for card */ /* NOTE: these are all DEBUGGING ONLY currently */ -static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void *arg) +static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg) { int result = 0; struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data; diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index 11875f784..b63669c1f 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c @@ -239,7 +239,7 @@ static void recycle_iov_buf(ns_dev *card, struct sk_buff *iovb); static void dequeue_sm_buf(ns_dev *card, struct sk_buff *sb); static void dequeue_lg_buf(ns_dev *card, struct sk_buff *lb); static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page); -static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg); +static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg); static void which_list(ns_dev *card, struct sk_buff *skb); static void ns_poll(unsigned long arg); static int ns_parse_mac(char *mac, unsigned char *esi); @@ -2765,7 +2765,7 @@ static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page) -static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) +static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) { ns_dev *card; pool_levels pl; @@ -2776,7 +2776,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) switch (cmd) { case NS_GETPSTAT: - if (get_user(pl.buftype, &((pool_levels *) arg)->buftype)) + if (get_user(pl.buftype, &((pool_levels __user *) arg)->buftype)) return -EFAULT; switch (pl.buftype) { @@ -2812,7 +2812,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) return -ENOIOCTLCMD; } - if (!copy_to_user((pool_levels *) arg, &pl, sizeof(pl))) + if (!copy_to_user((pool_levels __user *) arg, &pl, sizeof(pl))) return (sizeof(pl)); else return -EFAULT; @@ -2820,7 +2820,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg) case NS_SETBUFLEV: if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (copy_from_user(&pl, (pool_levels *) arg, sizeof(pl))) + if (copy_from_user(&pl, (pool_levels __user *) arg, sizeof(pl))) return -EFAULT; if (pl.level.min >= pl.level.init || pl.level.init >= pl.level.max) return -EINVAL; diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c index e245e94bd..e5a0f5cbd 100644 --- a/drivers/atm/suni.c +++ b/drivers/atm/suni.c @@ -95,7 +95,7 @@ static void suni_hz(unsigned long from_timer) #undef ADD_LIMITED -static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero) { struct sonet_stats tmp; int error = 0; @@ -115,11 +115,11 @@ static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero) } -static int change_diag(struct atm_dev *dev,void *arg,int set) +static int change_diag(struct atm_dev *dev,void __user *arg,int set) { int todo; - if (get_user(todo,(int *) arg)) return -EFAULT; + if (get_user(todo,(int __user *)arg)) return -EFAULT; HANDLE_FLAG(SONET_INS_SBIP,TSOP_DIAG,SUNI_TSOP_DIAG_DBIP8); HANDLE_FLAG(SONET_INS_LBIP,TLOP_DIAG,SUNI_TLOP_DIAG_DBIP); HANDLE_FLAG(SONET_INS_PBIP,TPOP_CD,SUNI_TPOP_DIAG_DB3); @@ -128,14 +128,14 @@ static int change_diag(struct atm_dev *dev,void *arg,int set) HANDLE_FLAG(SONET_INS_PAIS,TPOP_CD,SUNI_TPOP_DIAG_PAIS); HANDLE_FLAG(SONET_INS_LOS,TSOP_DIAG,SUNI_TSOP_DIAG_DLOS); HANDLE_FLAG(SONET_INS_HCS,TACP_CS,SUNI_TACP_CS_DHCS); - return put_user(todo,(int *) arg) ? -EFAULT : 0; + return put_user(todo,(int __user *)arg) ? -EFAULT : 0; } #undef HANDLE_FLAG -static int get_diag(struct atm_dev *dev,void *arg) +static int get_diag(struct atm_dev *dev,void __user *arg) { int set; @@ -148,7 +148,7 @@ static int get_diag(struct atm_dev *dev,void *arg) if (GET(TPOP_CD) & SUNI_TPOP_DIAG_PAIS) set |= SONET_INS_PAIS; if (GET(TSOP_DIAG) & SUNI_TSOP_DIAG_DLOS) set |= SONET_INS_LOS; if (GET(TACP_CS) & SUNI_TACP_CS_DHCS) set |= SONET_INS_HCS; - return put_user(set,(int *) arg) ? -EFAULT : 0; + return put_user(set,(int __user *)arg) ? -EFAULT : 0; } @@ -175,13 +175,12 @@ static int set_loopback(struct atm_dev *dev,int mode) } -static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: - return fetch_stats(dev,(struct sonet_stats *) arg, - cmd == SONET_GETSTATZ); + return fetch_stats(dev, arg, cmd == SONET_GETSTATZ); case SONET_SETDIAG: return change_diag(dev,arg,1); case SONET_CLRDIAG: @@ -192,18 +191,18 @@ static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) if (arg != SONET_FRAME_SONET) return -EINVAL; return 0; case SONET_GETFRAMING: - return put_user(SONET_FRAME_SONET,(int *) arg) ? + return put_user(SONET_FRAME_SONET,(int __user *)arg) ? -EFAULT : 0; case SONET_GETFRSENSE: return -EINVAL; case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, - (int *) arg) ? -EFAULT : 0; + (int __user *) arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff --git a/drivers/atm/uPD98402.c b/drivers/atm/uPD98402.c index 0bc05c960..da33eaddc 100644 --- a/drivers/atm/uPD98402.c +++ b/drivers/atm/uPD98402.c @@ -37,7 +37,7 @@ struct uPD98402_priv { #define GET(reg) dev->ops->phy_get(dev,uPD98402_##reg) -static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero) +static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero) { struct sonet_stats tmp; int error = 0; @@ -83,7 +83,7 @@ static int set_framing(struct atm_dev *dev,unsigned char framing) } -static int get_sense(struct atm_dev *dev,u8 *arg) +static int get_sense(struct atm_dev *dev,u8 __user *arg) { unsigned long flags; unsigned char s[3]; @@ -132,29 +132,28 @@ static int set_loopback(struct atm_dev *dev,int mode) } -static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { switch (cmd) { case SONET_GETSTATZ: case SONET_GETSTAT: - return fetch_stats(dev,(struct sonet_stats *) arg, - cmd == SONET_GETSTATZ); + return fetch_stats(dev,arg, cmd == SONET_GETSTATZ); case SONET_SETFRAMING: return set_framing(dev,(int) (long) arg); case SONET_GETFRAMING: - return put_user(PRIV(dev)->framing,(int *) arg) ? + return put_user(PRIV(dev)->framing,(int __user *)arg) ? -EFAULT : 0; case SONET_GETFRSENSE: return get_sense(dev,arg); case ATM_SETLOOP: return set_loopback(dev,(int) (long) arg); case ATM_GETLOOP: - return put_user(PRIV(dev)->loop_mode,(int *) arg) ? + return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ? -EFAULT : 0; case ATM_QUERYLOOP: return put_user(ATM_LM_LOC_PHY | ATM_LM_LOC_ATM | - ATM_LM_RMT_PHY,(int *) arg) ? -EFAULT : 0; + ATM_LM_RMT_PHY,(int __user *)arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 9027baa42..88d548a18 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c @@ -1429,7 +1429,7 @@ static int zatm_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flags) } -static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) +static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) { struct zatm_dev *zatm_dev; unsigned long flags; @@ -1445,7 +1445,7 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) int pool; if (get_user(pool, - &((struct zatm_pool_req *) arg)->pool_num)) + &((struct zatm_pool_req __user *) arg)->pool_num)) return -EFAULT; if (pool < 0 || pool > ZATM_LAST_POOL) return -EINVAL; @@ -1457,7 +1457,7 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) } spin_unlock_irqrestore(&zatm_dev->lock, flags); return copy_to_user( - &((struct zatm_pool_req *) arg)->info, + &((struct zatm_pool_req __user *) arg)->info, &info,sizeof(info)) ? -EFAULT : 0; } case ZATM_SETPOOL: @@ -1467,12 +1467,12 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) if (!capable(CAP_NET_ADMIN)) return -EPERM; if (get_user(pool, - &((struct zatm_pool_req *) arg)->pool_num)) + &((struct zatm_pool_req __user *) arg)->pool_num)) return -EFAULT; if (pool < 0 || pool > ZATM_LAST_POOL) return -EINVAL; if (copy_from_user(&info, - &((struct zatm_pool_req *) arg)->info, + &((struct zatm_pool_req __user *) arg)->info, sizeof(info))) return -EFAULT; if (!info.low_water) info.low_water = zatm_dev-> @@ -1504,14 +1504,14 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg) static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname, - void *optval,int optlen) + void __user *optval,int optlen) { return -EINVAL; } diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 82b4430ab..aa66d7198 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -58,6 +58,8 @@ static inline void register_cpu_control(struct cpu *cpu) /* * register_cpu - Setup a driverfs device for a CPU. + * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to + * generate a control file in sysfs for this CPU. * @num - CPU number to use when creating the device. * * Initialize and register the CPU device. @@ -75,7 +77,7 @@ int __init register_cpu(struct cpu *cpu, int num, struct node *root) error = sysfs_create_link(&root->sysdev.kobj, &cpu->sysdev.kobj, kobject_name(&cpu->sysdev.kobj)); - if (!error) + if (!error && !cpu->no_control) register_cpu_control(cpu); return error; } diff --git a/drivers/base/node.c b/drivers/base/node.c index 7508df373..b5aa9dc6c 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -21,9 +21,10 @@ static ssize_t node_read_cpumap(struct sys_device * dev, char * buf) cpumask_t mask = node_dev->cpumap; int len; - /* FIXME - someone should pass us a buffer size (count) or - * use seq_file or something to avoid buffer overrun risk. */ - len = cpumask_scnprintf(buf, 99 /* XXX FIXME */, mask); + /* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */ + BUILD_BUG_ON(NR_CPUS/4 > PAGE_SIZE/2); + + len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask); len += sprintf(buf + len, "\n"); return len; } diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 02a29e86c..040acbb33 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -97,7 +97,8 @@ static int DAC960_ioctl(struct inode *inode, struct file *file, struct gendisk *disk = inode->i_bdev->bd_disk; DAC960_Controller_T *p = disk->queue->queuedata; int drive_nr = (long)disk->private_data; - struct hd_geometry g, *loc = (struct hd_geometry *)arg; + struct hd_geometry g; + struct hd_geometry __user *loc = (struct hd_geometry __user *)arg; if (cmd != HDIO_GETGEO || !loc) return -EINVAL; @@ -6465,7 +6466,8 @@ static int DAC960_ProcReadUserCommand(char *Page, char **Start, off_t Offset, DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command. */ -static int DAC960_ProcWriteUserCommand(struct file *file, const char *Buffer, +static int DAC960_ProcWriteUserCommand(struct file *file, + const char __user *Buffer, unsigned long Count, void *Data) { DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data; @@ -6553,8 +6555,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, return DAC960_ControllerCount; case DAC960_IOCTL_GET_CONTROLLER_INFO: { - DAC960_ControllerInfo_T *UserSpaceControllerInfo = - (DAC960_ControllerInfo_T *) Argument; + DAC960_ControllerInfo_T __user *UserSpaceControllerInfo = + (DAC960_ControllerInfo_T __user *) Argument; DAC960_ControllerInfo_T ControllerInfo; DAC960_Controller_T *Controller; int ControllerNumber; @@ -6584,8 +6586,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, } case DAC960_IOCTL_V1_EXECUTE_COMMAND: { - DAC960_V1_UserCommand_T *UserSpaceUserCommand = - (DAC960_V1_UserCommand_T *) Argument; + DAC960_V1_UserCommand_T __user *UserSpaceUserCommand = + (DAC960_V1_UserCommand_T __user *) Argument; DAC960_V1_UserCommand_T UserCommand; DAC960_Controller_T *Controller; DAC960_Command_T *Command = NULL; @@ -6744,8 +6746,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, } case DAC960_IOCTL_V2_EXECUTE_COMMAND: { - DAC960_V2_UserCommand_T *UserSpaceUserCommand = - (DAC960_V2_UserCommand_T *) Argument; + DAC960_V2_UserCommand_T __user *UserSpaceUserCommand = + (DAC960_V2_UserCommand_T __user *) Argument; DAC960_V2_UserCommand_T UserCommand; DAC960_Controller_T *Controller; DAC960_Command_T *Command = NULL; @@ -6898,8 +6900,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, } case DAC960_IOCTL_V2_GET_HEALTH_STATUS: { - DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus = - (DAC960_V2_GetHealthStatus_T *) Argument; + DAC960_V2_GetHealthStatus_T __user *UserSpaceGetHealthStatus = + (DAC960_V2_GetHealthStatus_T __user *) Argument; DAC960_V2_GetHealthStatus_T GetHealthStatus; DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer; DAC960_Controller_T *Controller; diff --git a/drivers/block/DAC960.h b/drivers/block/DAC960.h index 676c07808..be8f8992a 100644 --- a/drivers/block/DAC960.h +++ b/drivers/block/DAC960.h @@ -1914,8 +1914,8 @@ typedef struct DAC960_V1_UserCommand unsigned char ControllerNumber; DAC960_V1_CommandMailbox_T CommandMailbox; int DataTransferLength; - void *DataTransferBuffer; - DAC960_V1_DCDB_T *DCDB; + void __user *DataTransferBuffer; + DAC960_V1_DCDB_T __user *DCDB; } DAC960_V1_UserCommand_T; @@ -1948,8 +1948,8 @@ typedef struct DAC960_V2_UserCommand DAC960_V2_CommandMailbox_T CommandMailbox; int DataTransferLength; int RequestSenseLength; - void *DataTransferBuffer; - void *RequestSenseBuffer; + void __user *DataTransferBuffer; + void __user *RequestSenseBuffer; } DAC960_V2_UserCommand_T; @@ -1980,7 +1980,7 @@ DAC960_V2_KernelCommand_T; typedef struct DAC960_V2_GetHealthStatus { unsigned char ControllerNumber; - DAC960_V2_HealthStatusBuffer_T *HealthStatusBuffer; + DAC960_V2_HealthStatusBuffer_T __user *HealthStatusBuffer; } DAC960_V2_GetHealthStatus_T; diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index ecbc4e489..0e18df6b7 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -6,7 +6,7 @@ menu "Block devices" config BLK_DEV_FD tristate "Normal floppy disk support" - depends on (!X86_PC9800 && !ARCH_S390 && !M68K && !IA64) || Q40 || (SUN3X && BROKEN) + depends on (!ARCH_S390 && !M68K && !IA64) || Q40 || (SUN3X && BROKEN) ---help--- If you want to use the floppy disk drive(s) of your PC under Linux, say Y. Information about this driver, especially important for IBM @@ -26,13 +26,6 @@ config ATARI_FLOPPY tristate "Atari floppy support" depends on ATARI -config BLK_DEV_FD98 - tristate "NEC PC-9800 floppy disk support" - depends on X86_PC9800 - ---help--- - If you want to use the floppy disk drive(s) of NEC PC-9801/PC-9821, - say Y. - config BLK_DEV_SWIM_IOP bool "Macintosh IIfx/Quadra 900/Quadra 950 floppy support (EXPERIMENTAL)" depends on MAC && EXPERIMENTAL && BROKEN diff --git a/drivers/block/carmel.c b/drivers/block/carmel.c index 6a5ed6483..38fd6fe42 100644 --- a/drivers/block/carmel.c +++ b/drivers/block/carmel.c @@ -413,7 +413,7 @@ static unsigned long carm_major_alloc; static int carm_bdev_ioctl(struct inode *ino, struct file *fil, unsigned int cmd, unsigned long arg) { - void __user *usermem = (void *) arg; + void __user *usermem = (void __user *) arg; struct carm_port *port = ino->i_bdev->bd_disk->private_data; struct hd_geometry geom; diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b22099f1f..24d72c79a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -135,7 +135,6 @@ static int register_new_disk(ctlr_info_t *h); static void cciss_getgeometry(int cntl_num); -static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c); static void start_io( ctlr_info_t *h); static int sendcmd( __u8 cmd, int ctlr, void *buff, size_t size, unsigned int use_unit_num, unsigned int log_unit, __u8 page_code, @@ -157,6 +156,36 @@ static struct block_device_operations cciss_fops = { .revalidate_disk= cciss_revalidate, }; +/* + * Enqueuing and dequeuing functions for cmdlists. + */ +static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c) +{ + if (*Qptr == NULL) { + *Qptr = c; + c->next = c->prev = c; + } else { + c->prev = (*Qptr)->prev; + c->next = (*Qptr); + (*Qptr)->prev->next = c; + (*Qptr)->prev = c; + } +} + +static inline CommandList_struct *removeQ(CommandList_struct **Qptr, + CommandList_struct *c) +{ + if (c && c->next != c) { + if (*Qptr == c) *Qptr = c->next; + c->prev->next = c->next; + c->next->prev = c->prev; + } else { + *Qptr = NULL; + } + return c; +} +#ifdef CONFIG_PROC_FS + #include "cciss_scsi.c" /* For SCSI tape support */ /* @@ -167,7 +196,6 @@ static struct block_device_operations cciss_fops = { #define RAID_UNKNOWN 6 static const char *raid_label[] = {"0","4","1(0+1)","5","5+1","ADG", "UNKNOWN"}; -#ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_cciss; @@ -257,7 +285,7 @@ static int cciss_proc_get_info(char *buffer, char **start, off_t offset, } static int -cciss_proc_write(struct file *file, const char *buffer, +cciss_proc_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { unsigned char cmd[80]; @@ -451,6 +479,148 @@ static int cciss_release(struct inode *inode, struct file *filep) return 0; } +#ifdef CONFIG_COMPAT +/* for AMD 64 bit kernel compatibility with 32-bit userland ioctls */ +extern long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); +extern int +register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, + unsigned int, unsigned long, struct file *)); +extern int unregister_ioctl32_conversion(unsigned int cmd); + +static int cciss_ioctl32_passthru(unsigned int fd, unsigned cmd, unsigned long arg, struct file *file); +static int cciss_ioctl32_big_passthru(unsigned int fd, unsigned cmd, unsigned long arg, + struct file *file); + +typedef int (*handler_type) (unsigned int, unsigned int, unsigned long, struct file *); + +static struct ioctl32_map { + unsigned int cmd; + handler_type handler; + int registered; +} cciss_ioctl32_map[] = { + { CCISS_GETPCIINFO, (handler_type) sys_ioctl, 0 }, + { CCISS_GETINTINFO, (handler_type) sys_ioctl, 0 }, + { CCISS_SETINTINFO, (handler_type) sys_ioctl, 0 }, + { CCISS_GETNODENAME, (handler_type) sys_ioctl, 0 }, + { CCISS_SETNODENAME, (handler_type) sys_ioctl, 0 }, + { CCISS_GETHEARTBEAT, (handler_type) sys_ioctl, 0 }, + { CCISS_GETBUSTYPES, (handler_type) sys_ioctl, 0 }, + { CCISS_GETFIRMVER, (handler_type) sys_ioctl, 0 }, + { CCISS_GETDRIVVER, (handler_type) sys_ioctl, 0 }, + { CCISS_REVALIDVOLS, (handler_type) sys_ioctl, 0 }, + { CCISS_PASSTHRU32, cciss_ioctl32_passthru, 0 }, + { CCISS_DEREGDISK, (handler_type) sys_ioctl, 0 }, + { CCISS_REGNEWDISK, (handler_type) sys_ioctl, 0 }, + { CCISS_REGNEWD, (handler_type) sys_ioctl, 0 }, + { CCISS_RESCANDISK, (handler_type) sys_ioctl, 0 }, + { CCISS_GETLUNINFO, (handler_type) sys_ioctl, 0 }, + { CCISS_BIG_PASSTHRU32, cciss_ioctl32_big_passthru, 0 }, +}; +#define NCCISS_IOCTL32_ENTRIES (sizeof(cciss_ioctl32_map) / sizeof(cciss_ioctl32_map[0])) +static void register_cciss_ioctl32(void) +{ + int i, rc; + + for (i=0; i < NCCISS_IOCTL32_ENTRIES; i++) { + rc = register_ioctl32_conversion( + cciss_ioctl32_map[i].cmd, + cciss_ioctl32_map[i].handler); + if (rc != 0) { + printk(KERN_WARNING "cciss: failed to register " + "32 bit compatible ioctl 0x%08x\n", + cciss_ioctl32_map[i].cmd); + cciss_ioctl32_map[i].registered = 0; + } else + cciss_ioctl32_map[i].registered = 1; + } +} +static void unregister_cciss_ioctl32(void) +{ + int i, rc; + + for (i=0; i < NCCISS_IOCTL32_ENTRIES; i++) { + if (!cciss_ioctl32_map[i].registered) + continue; + rc = unregister_ioctl32_conversion( + cciss_ioctl32_map[i].cmd); + if (rc == 0) { + cciss_ioctl32_map[i].registered = 0; + continue; + } + printk(KERN_WARNING "cciss: failed to unregister " + "32 bit compatible ioctl 0x%08x\n", + cciss_ioctl32_map[i].cmd); + } +} +int cciss_ioctl32_passthru(unsigned int fd, unsigned cmd, unsigned long arg, + struct file *file) +{ + IOCTL32_Command_struct *arg32 = + (IOCTL32_Command_struct *) arg; + IOCTL_Command_struct arg64; + mm_segment_t old_fs; + int err; + unsigned long cp; + + err = 0; + err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, sizeof(arg64.LUN_info)); + err |= copy_from_user(&arg64.Request, &arg32->Request, sizeof(arg64.Request)); + err |= copy_from_user(&arg64.error_info, &arg32->error_info, sizeof(arg64.error_info)); + err |= get_user(arg64.buf_size, &arg32->buf_size); + err |= get_user(cp, &arg32->buf); + arg64.buf = (BYTE *)cp; + + if (err) + return -EFAULT; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + err = sys_ioctl(fd, CCISS_PASSTHRU, (unsigned long) &arg64); + set_fs(old_fs); + if (err) + return err; + err |= copy_to_user(&arg32->error_info, &arg64.error_info, sizeof(&arg32->error_info)); + if (err) + return -EFAULT; + return err; +} +int cciss_ioctl32_big_passthru(unsigned int fd, unsigned cmd, unsigned long arg, + struct file *file) +{ + BIG_IOCTL32_Command_struct *arg32 = + (BIG_IOCTL32_Command_struct *) arg; + BIG_IOCTL_Command_struct arg64; + mm_segment_t old_fs; + int err; + unsigned long cp; + + err = 0; + err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, sizeof(arg64.LUN_info)); + err |= copy_from_user(&arg64.Request, &arg32->Request, sizeof(arg64.Request)); + err |= copy_from_user(&arg64.error_info, &arg32->error_info, sizeof(arg64.error_info)); + err |= get_user(arg64.buf_size, &arg32->buf_size); + err |= get_user(arg64.malloc_size, &arg32->malloc_size); + err |= get_user(cp, &arg32->buf); + arg64.buf = (BYTE *)cp; + + if (err) + return -EFAULT; + + old_fs = get_fs(); + set_fs(KERNEL_DS); + err = sys_ioctl(fd, CCISS_BIG_PASSTHRU, (unsigned long) &arg64); + set_fs(old_fs); + if (err) + return err; + err |= copy_to_user(&arg32->error_info, &arg64.error_info, sizeof(&arg32->error_info)); + if (err) + return -EFAULT; + return err; +} +#else +static inline void register_cciss_ioctl32(void) {} +static inline void unregister_cciss_ioctl32(void) {} +#endif /* * ioctl */ @@ -462,6 +632,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, ctlr_info_t *host = get_host(disk); drive_info_struct *drv = get_drv(disk); int ctlr = host->ctlr; + void __user *argp = (void __user *)arg; #ifdef CCISS_DEBUG printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg); @@ -478,8 +649,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, } else return -ENXIO; driver_geo.start= get_start_sect(inode->i_bdev); - if (copy_to_user((void *) arg, &driver_geo, - sizeof( struct hd_geometry))) + if (copy_to_user(argp, &driver_geo, sizeof(struct hd_geometry))) return -EFAULT; return(0); } @@ -492,7 +662,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, pciinfo.bus = host->pdev->bus->number; pciinfo.dev_fn = host->pdev->devfn; pciinfo.board_id = host->board_id; - if (copy_to_user((void *) arg, &pciinfo, sizeof( cciss_pci_info_struct ))) + if (copy_to_user(argp, &pciinfo, sizeof( cciss_pci_info_struct ))) return -EFAULT; return(0); } @@ -502,7 +672,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; intinfo.delay = readl(&host->cfgtable->HostWrite.CoalIntDelay); intinfo.count = readl(&host->cfgtable->HostWrite.CoalIntCount); - if (copy_to_user((void *) arg, &intinfo, sizeof( cciss_coalint_struct ))) + if (copy_to_user(argp, &intinfo, sizeof( cciss_coalint_struct ))) return -EFAULT; return(0); } @@ -514,7 +684,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (copy_from_user(&intinfo, (void *) arg, sizeof( cciss_coalint_struct))) + if (copy_from_user(&intinfo, argp, sizeof( cciss_coalint_struct))) return -EFAULT; if ( (intinfo.delay == 0 ) && (intinfo.count == 0)) @@ -550,7 +720,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; for(i=0;i<16;i++) NodeName[i] = readb(&host->cfgtable->ServerName[i]); - if (copy_to_user((void *) arg, NodeName, sizeof( NodeName_type))) + if (copy_to_user(argp, NodeName, sizeof( NodeName_type))) return -EFAULT; return(0); } @@ -563,7 +733,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (copy_from_user(NodeName, (void *) arg, sizeof( NodeName_type))) + if (copy_from_user(NodeName, argp, sizeof( NodeName_type))) return -EFAULT; spin_lock_irqsave(CCISS_LOCK(ctlr), flags); @@ -593,7 +763,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; heartbeat = readl(&host->cfgtable->HeartBeat); - if (copy_to_user((void *) arg, &heartbeat, sizeof( Heartbeat_type))) + if (copy_to_user(argp, &heartbeat, sizeof( Heartbeat_type))) return -EFAULT; return(0); } @@ -603,7 +773,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; BusTypes = readl(&host->cfgtable->BusTypes); - if (copy_to_user((void *) arg, &BusTypes, sizeof( BusTypes_type) )) + if (copy_to_user(argp, &BusTypes, sizeof( BusTypes_type) )) return -EFAULT; return(0); } @@ -614,7 +784,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; memcpy(firmware, host->firm_ver, 4); - if (copy_to_user((void *) arg, firmware, sizeof( FirmwareVer_type))) + if (copy_to_user(argp, firmware, sizeof( FirmwareVer_type))) return -EFAULT; return(0); } @@ -624,7 +794,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!arg) return -EINVAL; - if (copy_to_user((void *) arg, &DriverVer, sizeof( DriverVer_type) )) + if (copy_to_user(argp, &DriverVer, sizeof( DriverVer_type) )) return -EFAULT; return(0); } @@ -648,7 +818,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (disk->part[i]->nr_sects != 0) luninfo.num_parts++; } - if (copy_to_user((void *) arg, &luninfo, + if (copy_to_user(argp, &luninfo, sizeof(LogvolInfo_struct))) return -EFAULT; return(0); @@ -672,7 +842,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, if (!capable(CAP_SYS_RAWIO)) return -EPERM; - if (copy_from_user(&iocommand, (void *) arg, sizeof( IOCTL_Command_struct) )) + if (copy_from_user(&iocommand, argp, sizeof( IOCTL_Command_struct) )) return -EFAULT; if((iocommand.buf_size < 1) && (iocommand.Request.Type.Direction != XFER_NONE)) @@ -753,7 +923,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, /* Copy the error information out */ iocommand.error_info = *(c->err_info); - if ( copy_to_user((void *) arg, &iocommand, sizeof( IOCTL_Command_struct) ) ) + if ( copy_to_user(argp, &iocommand, sizeof( IOCTL_Command_struct) ) ) { kfree(buff); cmd_free(host, c, 0); @@ -787,7 +957,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, DECLARE_COMPLETION(wait); __u32 left; __u32 sz; - BYTE *data_ptr; + BYTE __user *data_ptr; if (!arg) return -EINVAL; @@ -799,7 +969,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, status = -ENOMEM; goto cleanup1; } - if (copy_from_user(ioc, (void *) arg, sizeof(*ioc))) { + if (copy_from_user(ioc, argp, sizeof(*ioc))) { status = -EFAULT; goto cleanup1; } @@ -831,7 +1001,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, goto cleanup1; } left = ioc->buf_size; - data_ptr = (BYTE *) ioc->buf; + data_ptr = ioc->buf; while (left) { sz = (left > ioc->malloc_size) ? ioc->malloc_size : left; buff_size[sg_used] = sz; @@ -896,14 +1066,14 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, } /* Copy the error information out */ ioc->error_info = *(c->err_info); - if (copy_to_user((void *) arg, ioc, sizeof(*ioc))) { + if (copy_to_user(argp, ioc, sizeof(*ioc))) { cmd_free(host, c, 0); status = -EFAULT; goto cleanup1; } if (ioc->Request.Type.Direction == XFER_READ) { /* Copy the data out of the buffer we created */ - BYTE *ptr = (BYTE *) ioc->buf; + BYTE __user *ptr = ioc->buf; for(i=0; i< sg_used; i++) { if (copy_to_user(ptr, buff[i], buff_size[i])) { cmd_free(host, c, 0); @@ -1685,35 +1855,6 @@ static ulong remap_pci_mem(ulong base, ulong size) return (ulong) (page_remapped ? (page_remapped + page_offs) : 0UL); } -/* - * Enqueuing and dequeuing functions for cmdlists. - */ -static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c) -{ - if (*Qptr == NULL) { - *Qptr = c; - c->next = c->prev = c; - } else { - c->prev = (*Qptr)->prev; - c->next = (*Qptr); - (*Qptr)->prev->next = c; - (*Qptr)->prev = c; - } -} - -static inline CommandList_struct *removeQ(CommandList_struct **Qptr, - CommandList_struct *c) -{ - if (c && c->next != c) { - if (*Qptr == c) *Qptr = c->next; - c->prev->next = c->next; - c->next->prev = c->prev; - } else { - *Qptr = NULL; - } - return c; -} - /* * Takes jobs of the Q and sends them to the hardware, then puts it on * the Q to wait for completion. @@ -2729,6 +2870,7 @@ int __init cciss_init(void) static int __init init_cciss_module(void) { + register_cciss_ioctl32(); return ( cciss_init()); } @@ -2736,6 +2878,7 @@ static void __exit cleanup_cciss_module(void) { int i; + unregister_cciss_ioctl32(); pci_unregister_driver(&cciss_pci_driver); /* double check that all controller entrys have been removed */ for (i=0; i< MAX_CTLR; i++) diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 9636ac51e..9df82b8e9 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c @@ -29,7 +29,7 @@ physical nor logical disks are presented through the scsi layer. */ #include "../scsi/scsi.h" -#include "../scsi/hosts.h" +#include #include #include #include diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index 977d32ddd..3b8059af6 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c @@ -59,6 +59,14 @@ struct cfq_data { unsigned int max_queued; mempool_t *crq_pool; + + request_queue_t *queue; + + /* + * tunables + */ + unsigned int cfq_quantum; + unsigned int cfq_queued; }; struct cfq_queue { @@ -89,7 +97,8 @@ struct cfq_rq { static void cfq_put_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq); static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *cfqd, int pid); -static void cfq_dispatch_sort(struct list_head *head, struct cfq_rq *crq); +static void cfq_dispatch_sort(struct cfq_data *cfqd, struct cfq_queue *cfqq, + struct cfq_rq *crq); /* * lots of deadline iosched dupes, can be abstracted later... @@ -206,8 +215,7 @@ retry: return; } - cfq_del_crq_rb(cfqq, __alias); - cfq_dispatch_sort(cfqd->dispatch, __alias); + cfq_dispatch_sort(cfqd, cfqq, __alias); goto retry; } @@ -321,11 +329,16 @@ cfq_merged_requests(request_queue_t *q, struct request *req, cfq_remove_request(q, next); } -static void cfq_dispatch_sort(struct list_head *head, struct cfq_rq *crq) +static void +cfq_dispatch_sort(struct cfq_data *cfqd, struct cfq_queue *cfqq, + struct cfq_rq *crq) { - struct list_head *entry = head; + struct list_head *head = cfqd->dispatch, *entry = head; struct request *__rq; + cfq_del_crq_rb(cfqq, crq); + cfq_remove_merge_hints(cfqd->queue, crq); + if (!list_empty(head)) { __rq = list_entry_rq(head->next); @@ -352,9 +365,7 @@ __cfq_dispatch_requests(request_queue_t *q, struct cfq_data *cfqd, { struct cfq_rq *crq = rb_entry_crq(rb_first(&cfqq->sort_list)); - cfq_del_crq_rb(cfqq, crq); - cfq_remove_merge_hints(q, crq); - cfq_dispatch_sort(cfqd->dispatch, crq); + cfq_dispatch_sort(cfqd, cfqq, crq); } static int cfq_dispatch_requests(request_queue_t *q, struct cfq_data *cfqd) @@ -385,7 +396,7 @@ restart: ret = 1; } - if ((queued < cfq_quantum) && good_queues) + if ((queued < cfqd->cfq_quantum) && good_queues) goto restart; return ret; @@ -556,7 +567,7 @@ static int cfq_may_queue(request_queue_t *q, int rw) cfqq = cfq_find_cfq_hash(cfqd, current->tgid); if (cfqq) { - int limit = (q->nr_requests - cfq_queued) / cfqd->busy_queues; + int limit = (q->nr_requests - cfqd->cfq_queued) / cfqd->busy_queues; if (limit < 3) limit = 3; @@ -574,6 +585,8 @@ static void cfq_put_request(request_queue_t *q, struct request *rq) { struct cfq_data *cfqd = q->elevator.elevator_data; struct cfq_rq *crq = RQ_DATA(rq); + struct request_list *rl; + int other_rw; if (crq) { BUG_ON(q->last_merge == rq); @@ -582,6 +595,23 @@ static void cfq_put_request(request_queue_t *q, struct request *rq) mempool_free(crq, cfqd->crq_pool); rq->elevator_private = NULL; } + + /* + * work-around for may_queue "bug": if a read gets issued and refused + * to queue because writes ate all the allowed slots and no other + * reads are pending for this queue, it could get stuck infinitely + * since freed_request() only checks the waitqueue for writes when + * freeing them. or vice versa for a single write vs many reads. + * so check here whether "the other" data direction might be able + * to queue and wake them + */ + rl = &q->rq; + other_rw = rq_data_dir(rq) ^ 1; + if (rl->count[other_rw] <= q->nr_requests) { + smp_mb(); + if (waitqueue_active(&rl->wait[other_rw])) + wake_up(&rl->wait[other_rw]); + } } static int cfq_set_request(request_queue_t *q, struct request *rq, int gfp_mask) @@ -643,6 +673,7 @@ static int cfq_init(request_queue_t *q, elevator_t *e) cfqd->dispatch = &q->queue_head; e->elevator_data = cfqd; + cfqd->queue = q; /* * just set it to some high value, we want anyone to be able to queue @@ -651,6 +682,9 @@ static int cfq_init(request_queue_t *q, elevator_t *e) cfqd->max_queued = q->nr_requests; q->nr_requests = 8192; + cfqd->cfq_queued = cfq_queued; + cfqd->cfq_quantum = cfq_quantum; + return 0; out_crqpool: kfree(cfqd->cfq_hash); @@ -685,8 +719,110 @@ static int __init cfq_slab_setup(void) subsys_initcall(cfq_slab_setup); +/* + * sysfs parts below --> + */ +struct cfq_fs_entry { + struct attribute attr; + ssize_t (*show)(struct cfq_data *, char *); + ssize_t (*store)(struct cfq_data *, const char *, size_t); +}; + +static ssize_t +cfq_var_show(unsigned int var, char *page) +{ + return sprintf(page, "%d\n", var); +} + +static ssize_t +cfq_var_store(unsigned int *var, const char *page, size_t count) +{ + char *p = (char *) page; + + *var = simple_strtoul(p, &p, 10); + return count; +} + +#define SHOW_FUNCTION(__FUNC, __VAR) \ +static ssize_t __FUNC(struct cfq_data *cfqd, char *page) \ +{ \ + return cfq_var_show(__VAR, (page)); \ +} +SHOW_FUNCTION(cfq_quantum_show, cfqd->cfq_quantum); +SHOW_FUNCTION(cfq_queued_show, cfqd->cfq_queued); +#undef SHOW_FUNCTION + +#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \ +static ssize_t __FUNC(struct cfq_data *cfqd, const char *page, size_t count) \ +{ \ + int ret = cfq_var_store(__PTR, (page), count); \ + if (*(__PTR) < (MIN)) \ + *(__PTR) = (MIN); \ + else if (*(__PTR) > (MAX)) \ + *(__PTR) = (MAX); \ + return ret; \ +} +STORE_FUNCTION(cfq_quantum_store, &cfqd->cfq_quantum, 1, INT_MAX); +STORE_FUNCTION(cfq_queued_store, &cfqd->cfq_queued, 1, INT_MAX); +#undef STORE_FUNCTION + +static struct cfq_fs_entry cfq_quantum_entry = { + .attr = {.name = "quantum", .mode = S_IRUGO | S_IWUSR }, + .show = cfq_quantum_show, + .store = cfq_quantum_store, +}; +static struct cfq_fs_entry cfq_queued_entry = { + .attr = {.name = "queued", .mode = S_IRUGO | S_IWUSR }, + .show = cfq_queued_show, + .store = cfq_queued_store, +}; + +static struct attribute *default_attrs[] = { + &cfq_quantum_entry.attr, + &cfq_queued_entry.attr, + NULL, +}; + +#define to_cfq(atr) container_of((atr), struct cfq_fs_entry, attr) + +static ssize_t +cfq_attr_show(struct kobject *kobj, struct attribute *attr, char *page) +{ + elevator_t *e = container_of(kobj, elevator_t, kobj); + struct cfq_fs_entry *entry = to_cfq(attr); + + if (!entry->show) + return 0; + + return entry->show(e->elevator_data, page); +} + +static ssize_t +cfq_attr_store(struct kobject *kobj, struct attribute *attr, + const char *page, size_t length) +{ + elevator_t *e = container_of(kobj, elevator_t, kobj); + struct cfq_fs_entry *entry = to_cfq(attr); + + if (!entry->store) + return -EINVAL; + + return entry->store(e->elevator_data, page, length); +} + +static struct sysfs_ops cfq_sysfs_ops = { + .show = cfq_attr_show, + .store = cfq_attr_store, +}; + +struct kobj_type cfq_ktype = { + .sysfs_ops = &cfq_sysfs_ops, + .default_attrs = default_attrs, +}; + elevator_t iosched_cfq = { .elevator_name = "cfq", + .elevator_ktype = &cfq_ktype, .elevator_merge_fn = cfq_merge, .elevator_merged_fn = cfq_merged_request, .elevator_merge_req_fn = cfq_merged_requests, diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index f6f781898..b42a8d33f 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -1157,8 +1157,8 @@ static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); int error; int diskinfo[4]; - struct hd_geometry *geo = (struct hd_geometry *)arg; - ida_ioctl_t *io = (ida_ioctl_t*)arg; + struct hd_geometry __user *geo = (struct hd_geometry __user *)arg; + ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg; ida_ioctl_t *my_io; switch(cmd) { @@ -1202,7 +1202,7 @@ out_passthru: return error; case IDAGETCTLRSIG: if (!arg) return -EINVAL; - put_user(host->ctlr_sig, (int*)arg); + put_user(host->ctlr_sig, (int __user *)arg); return 0; case IDAREVALIDATEVOLS: if (iminor(inode) != 0) @@ -1210,7 +1210,7 @@ out_passthru: return revalidate_allvol(host); case IDADRIVERVERSION: if (!arg) return -EINVAL; - put_user(DRIVER_VERSION, (unsigned long*)arg); + put_user(DRIVER_VERSION, (unsigned long __user *)arg); return 0; case IDAGETPCIINFO: { @@ -1221,7 +1221,7 @@ out_passthru: pciinfo.bus = host->pci_dev->bus->number; pciinfo.dev_fn = host->pci_dev->devfn; pciinfo.board_id = host->board_id; - if(copy_to_user((void *) arg, &pciinfo, + if(copy_to_user((void __user *) arg, &pciinfo, sizeof( ida_pci_info_struct))) return -EFAULT; return(0); @@ -1272,7 +1272,7 @@ static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io) cmd_free(h, c, 0); return(error); } - if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) { + if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) { kfree(p); cmd_free(h, c, 0); return -EFAULT; @@ -1313,7 +1313,7 @@ static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io) cmd_free(h, c, 0); return(error); } - if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) { + if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) { kfree(p); cmd_free(h, c, 0); return -EFAULT; @@ -1354,7 +1354,7 @@ static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io) case DIAG_PASS_THRU: case SENSE_CONTROLLER_PERFORMANCE: case READ_FLASH_ROM: - if (copy_to_user((void*)io->sg[0].addr, p, io->sg[0].size)) { + if (copy_to_user(io->sg[0].addr, p, io->sg[0].size)) { kfree(p); return -EFAULT; } diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 4ce5ca130..da60f83d0 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c @@ -181,6 +181,14 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, rq->q = q; q->elevator.elevator_add_req_fn(q, rq, where); + + if (blk_queue_plugged(q)) { + int nrq = q->rq.count[READ] + q->rq.count[WRITE] - q->in_flight; + + if (nrq == q->unplug_thresh) + __generic_unplug_device(q); + } + } void elv_add_request(request_queue_t *q, struct request *rq, int where, diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index f1cc33409..70375a056 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4238,7 +4238,7 @@ int __init floppy_init(void) } disks[dr]->major = FLOPPY_MAJOR; - disks[dr]->first_minor = TOMINOR(i); + disks[dr]->first_minor = TOMINOR(dr); disks[dr]->fops = &floppy_fops; sprintf(disks[dr]->disk_name, "fd%d", dr); diff --git a/drivers/block/ida_ioctl.h b/drivers/block/ida_ioctl.h index e90825be7..4159e52e8 100644 --- a/drivers/block/ida_ioctl.h +++ b/drivers/block/ida_ioctl.h @@ -57,7 +57,7 @@ typedef struct { /* currently, sg_cnt is assumed to be 1: only the 0th element of sg is used */ struct { - void *addr; + void __user *addr; size_t size; } sg[SG_MAX]; int sg_cnt; diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index e4a8c0dee..8d3d38bd8 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -1123,7 +1123,7 @@ EXPORT_SYMBOL(blk_remove_plug); /* * remove the plug and let it rip.. */ -static inline void __generic_unplug_device(request_queue_t *q) +inline void __generic_unplug_device(request_queue_t *q) { if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) return; @@ -1137,6 +1137,7 @@ static inline void __generic_unplug_device(request_queue_t *q) if (elv_next_request(q)) q->request_fn(q); } +EXPORT_SYMBOL(__generic_unplug_device); /** * generic_unplug_device - fire a request queue @@ -2280,13 +2281,9 @@ get_rq: out: if (freereq) __blk_put_request(q, freereq); + if (bio_sync(bio)) + __generic_unplug_device(q); - if (blk_queue_plugged(q)) { - int nrq = q->rq.count[READ] + q->rq.count[WRITE] - q->in_flight; - - if (nrq == q->unplug_thresh || bio_sync(bio)) - __generic_unplug_device(q); - } spin_unlock_irq(q->queue_lock); return 0; diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 95ec95cfa..f1250943c 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -308,7 +308,9 @@ lo_read_actor(read_descriptor_t *desc, struct page *page, page->index); desc->error = -EINVAL; } - + + flush_dcache_page(p->page); + desc->count = count - size; desc->written += size; p->offset += size; diff --git a/drivers/block/paride/epat.c b/drivers/block/paride/epat.c index 4f090dcc5..55d1c0a1f 100644 --- a/drivers/block/paride/epat.c +++ b/drivers/block/paride/epat.c @@ -31,6 +31,12 @@ #define j44(a,b) (((a>>4)&0x0f)+(b&0xf0)) #define j53(a,b) (((a>>3)&0x1f)+((b<<4)&0xe0)) +static int epatc8; + +module_param(epatc8, int, 0); +MODULE_PARM_DESC(epatc8, "support for the Shuttle EP1284 chip, " + "used in any recent Imation SuperDisk (LS-120) drive."); + /* cont = 0 IDE register file cont = 1 IDE control registers cont = 2 internal EPAT registers @@ -209,15 +215,18 @@ static void epat_connect ( PIA *pi ) { pi->saved_r0 = r0(); pi->saved_r2 = r2(); -#ifdef CONFIG_PARIDE_EPATC8 /* Initialize the chip */ - CPP(0);CPP(0x40);CPP(0xe0); - w0(0);w2(1);w2(4); - WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10); - WR(0xe,0xf);WR(0xf,4); - /* WR(0xe,0xa);WR(0xf,4); */ - WR(0xe,0xd);WR(0xf,0); - /* CPP(0x30); */ + CPP(0); + + if (epatc8) { + CPP(0x40);CPP(0xe0); + w0(0);w2(1);w2(4); + WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10); + WR(0xe,0xf);WR(0xf,4); + /* WR(0xe,0xa);WR(0xf,4); */ + WR(0xe,0xd);WR(0xf,0); + /* CPP(0x30); */ + } /* Connect to the chip */ CPP(0xe0); @@ -227,15 +236,10 @@ static void epat_connect ( PIA *pi ) /* Request EPP */ w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4); } -#else - CPP(0); CPP(0xe0); - w0(0); w2(1); w2(4); - if (pi->mode >= 3) { - w0(0); w2(1); w2(4); w2(0xc); - w0(0x40); w2(6); w2(7); w2(4); w2(0xc); w2(4); + + if (!epatc8) { + WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10); } - WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10); -#endif } static void epat_disconnect (PIA *pi) @@ -320,6 +324,9 @@ static struct pi_protocol epat = { static int __init epat_init(void) { +#ifdef CONFIG_PARIDE_EPATC8 + epatc8 = 1; +#endif return pi_register(&epat)-1; } diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 1e430e5c8..b4a696e73 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c @@ -337,7 +337,7 @@ static int pf_open(struct inode *inode, struct file *file) static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; - struct hd_geometry *geo = (struct hd_geometry *) arg; + struct hd_geometry __user *geo = (struct hd_geometry __user *) arg; struct hd_geometry g; sector_t capacity; diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 5ccc106fc..d73e3ec9f 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -212,9 +212,9 @@ MODULE_PARM(drive3, "1-6i"); static int pg_open(struct inode *inode, struct file *file); static int pg_release(struct inode *inode, struct file *file); -static ssize_t pg_read(struct file *filp, char *buf, +static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos); -static ssize_t pg_write(struct file *filp, const char *buf, +static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos); static int pg_detect(void); @@ -571,7 +571,7 @@ static int pg_release(struct inode *inode, struct file *file) return 0; } -static ssize_t pg_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos) { struct pg *dev = filp->private_data; struct pg_write_hdr hdr; @@ -582,7 +582,7 @@ static ssize_t pg_write(struct file *filp, const char *buf, size_t count, loff_t if (count < hs) return -EINVAL; - if (copy_from_user((char *) &hdr, buf, hs)) + if (copy_from_user(&hdr, buf, hs)) return -EFAULT; if (hdr.magic != PG_MAGIC) @@ -619,7 +619,7 @@ static ssize_t pg_write(struct file *filp, const char *buf, size_t count, loff_t return count; } -static ssize_t pg_read(struct file *filp, char *buf, size_t count, loff_t *ppos) +static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { struct pg *dev = filp->private_data; struct pg_read_hdr hdr; @@ -651,7 +651,7 @@ static ssize_t pg_read(struct file *filp, char *buf, size_t count, loff_t *ppos) hdr.duration = (jiffies - dev->start + HZ / 2) / HZ; hdr.scsi = dev->status & 0x0f; - if (copy_to_user(buf, (char *) &hdr, hs)) + if (copy_to_user(buf, &hdr, hs)) return -EFAULT; if (copy > 0) if (copy_to_user(buf + hs, dev->bufptr, copy)) diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 81c4690cf..44b12134d 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -212,9 +212,9 @@ static int pt_open(struct inode *inode, struct file *file); static int pt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static int pt_release(struct inode *inode, struct file *file); -static ssize_t pt_read(struct file *filp, char *buf, +static ssize_t pt_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos); -static ssize_t pt_write(struct file *filp, const char *buf, +static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos); static int pt_detect(void); @@ -710,12 +710,12 @@ static int pt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct pt_unit *tape = file->private_data; + struct mtop __user *p = (void __user *)arg; struct mtop mtop; switch (cmd) { case MTIOCTOP: - if (copy_from_user((char *) &mtop, (char *) arg, - sizeof (struct mtop))) + if (copy_from_user(&mtop, p, sizeof(struct mtop))) return -EFAULT; switch (mtop.mt_op) { @@ -764,7 +764,7 @@ pt_release(struct inode *inode, struct file *file) } -static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t pt_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { struct pt_unit *tape = filp->private_data; struct pi_adapter *pi = tape->pi; @@ -861,7 +861,7 @@ static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos } -static ssize_t pt_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { struct pt_unit *tape = filp->private_data; struct pi_adapter *pi = tape->pi; diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c index 87b324086..82a5f19fd 100644 --- a/drivers/block/ps2esdi.c +++ b/drivers/block/ps2esdi.c @@ -1063,17 +1063,17 @@ static int ps2esdi_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg) { struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data; - struct ps2esdi_geometry *geometry = (struct ps2esdi_geometry *) arg; - int err; + struct ps2esdi_geometry geom; if (cmd != HDIO_GETGEO) return -EINVAL; - if ((err = verify_area(VERIFY_WRITE, geometry, sizeof(*geometry)))) - return (err); - put_user(p->head, (char *) &geometry->heads); - put_user(p->sect, (char *) &geometry->sectors); - put_user(p->cyl, (short *) &geometry->cylinders); - put_user(get_start_sect(inode->i_bdev), (long *) &geometry->start); + memset(&geom, 0, sizeof(geom)); + geom.heads = p->head; + geom.sectors = p->sect; + geom.cylinders = p->cyl; + geom.start = get_start_sect(inode->i_bdev); + if (copy_to_user((void __user *)arg, &geom, sizeof(geom))) + return -EFAULT; return 0; } diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 5566351d4..fe8332e34 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -108,8 +108,21 @@ static void make_page_uptodate(struct page *page) struct buffer_head *head = bh; do { - if (!buffer_uptodate(bh)) + if (!buffer_uptodate(bh)) { memset(bh->b_data, 0, bh->b_size); + /* + * akpm: I'm totally undecided about this. The + * buffer has just been magically brought "up to + * date", but nobody should want to be reading + * it anyway, because it hasn't been used for + * anything yet. It is still in a "not read + * from disk yet" state. + * + * But non-uptodate buffers against an uptodate + * page are against the rules. So do it anyway. + */ + set_buffer_uptodate(bh); + } } while ((bh = bh->b_this_page) != head); } else { memset(page_address(page), 0, PAGE_CACHE_SIZE); diff --git a/drivers/block/umem.c b/drivers/block/umem.c index f7488ae75..2b126d8d2 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -833,7 +833,7 @@ static int mm_ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned geo.start = get_start_sect(i->i_bdev); geo.cylinders = size / (geo.heads * geo.sectors); - if (copy_to_user((void *) arg, &geo, sizeof(geo))) + if (copy_to_user((void __user *) arg, &geo, sizeof(geo))) return -EFAULT; return 0; } diff --git a/drivers/block/xd.c b/drivers/block/xd.c index b4ae8414c..1fd72e005 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -330,12 +330,12 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) case HDIO_GETGEO: { struct hd_geometry g; - struct hd_geometry *geometry = (struct hd_geometry *) arg; + struct hd_geometry __user *geom= (void __user *)arg; g.heads = p->heads; g.sectors = p->sectors; g.cylinders = p->cylinders; g.start = get_start_sect(inode->i_bdev); - return copy_to_user(geometry, &g, sizeof g) ? -EFAULT : 0; + return copy_to_user(geom, &g, sizeof(g)) ? -EFAULT : 0; } case HDIO_SET_DMA: if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -354,9 +354,9 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg) } return 0; case HDIO_GET_DMA: - return put_user(!nodma, (long *) arg); + return put_user(!nodma, (long __user *) arg); case HDIO_GET_MULTCOUNT: - return put_user(xd_maxsectors, (long *) arg); + return put_user(xd_maxsectors, (long __user *) arg); default: return -EINVAL; } diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index dda06e9a6..5ba134216 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -498,11 +498,11 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file * file, /* * We don't provide read/write/poll interface for user space. */ -static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char *buf, size_t nr) +static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char __user *buf, size_t nr) { return 0; } -static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char *data, size_t count) +static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char __user *data, size_t count) { return 0; } diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 871f38329..9faa8a08a 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -127,7 +127,7 @@ static unsigned int hci_vhci_chr_poll(struct file *file, poll_table * wait) } /* Get packet from user space buffer(already verified) */ -static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char *buf, size_t count) +static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char __user *buf, size_t count) { struct sk_buff *skb; @@ -152,7 +152,7 @@ static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const } /* Write */ -static ssize_t hci_vhci_chr_write(struct file * file, const char * buf, +static ssize_t hci_vhci_chr_write(struct file * file, const char __user * buf, size_t count, loff_t *pos) { struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; @@ -165,10 +165,11 @@ static ssize_t hci_vhci_chr_write(struct file * file, const char * buf, /* Put packet to user space buffer(already verified) */ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci, - struct sk_buff *skb, char *buf, int count) + struct sk_buff *skb, char __user *buf, + int count) { int len = count, total = 0; - char *ptr = buf; + char __user *ptr = buf; len = min_t(unsigned int, skb->len, len); if (copy_to_user(ptr, skb->data, len)) @@ -194,7 +195,7 @@ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci, } /* Read */ -static ssize_t hci_vhci_chr_read(struct file * file, char * buf, size_t count, loff_t *pos) +static ssize_t hci_vhci_chr_read(struct file * file, char __user * buf, size_t count, loff_t *pos) { struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; DECLARE_WAITQUEUE(wait, current); diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index 83086769f..97ab1b33f 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -873,7 +873,7 @@ static int aztUpdateToc(void) /* Read the table of contents header, i.e. no. of tracks and start of first * track */ -static int aztGetDiskInfo() +static int aztGetDiskInfo(void) { int limit; unsigned char test; @@ -1167,6 +1167,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, struct azt_Toc *tocPtr; struct cdrom_subchnl subchnl; struct cdrom_volctrl volctrl; + void __user *argp = (void __user *)arg; #ifdef AZT_DEBUG printk("aztcd: starting aztcd_ioctl - Command:%x Time: %li\n", @@ -1230,8 +1231,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, #ifdef AZT_DEBUG printk("aztcd ioctl MULTISESSION\n"); #endif - if (copy_from_user - (&ms, (void *) arg, + if (copy_from_user(&ms, argp, sizeof(struct cdrom_multisession))) return -EFAULT; if (ms.addr_format == CDROM_MSF) { @@ -1248,8 +1248,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, else return -EINVAL; ms.xa_flag = DiskInfo.xa; - if (copy_to_user - ((void *) arg, &ms, + if (copy_to_user(argp, &ms, sizeof(struct cdrom_multisession))) return -EFAULT; #ifdef AZT_DEBUG @@ -1272,7 +1271,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, return 0; } case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */ - if (copy_from_user(&ti, (void *) arg, sizeof ti)) + if (copy_from_user(&ti, argp, sizeof ti)) return -EFAULT; if (ti.cdti_trk0 < DiskInfo.first || ti.cdti_trk0 > DiskInfo.last @@ -1303,7 +1302,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, aztAudioStatus = CDROM_AUDIO_NO_STATUS; } */ - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); @@ -1335,11 +1334,11 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, case CDROMREADTOCHDR: /* Read the table of contents header */ tocHdr.cdth_trk0 = DiskInfo.first; tocHdr.cdth_trk1 = DiskInfo.last; - if (copy_to_user((void *) arg, &tocHdr, sizeof tocHdr)) + if (copy_to_user(argp, &tocHdr, sizeof tocHdr)) return -EFAULT; break; case CDROMREADTOCENTRY: /* Read an entry in the table of contents */ - if (copy_from_user(&entry, (void *) arg, sizeof entry)) + if (copy_from_user(&entry, argp, sizeof entry)) return -EFAULT; if ((!aztTocUpToDate) || aztDiskChanged) aztUpdateToc(); @@ -1365,12 +1364,12 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, } else { return -EINVAL; } - if (copy_to_user((void *) arg, &entry, sizeof entry)) + if (copy_to_user(argp, &entry, sizeof entry)) return -EFAULT; break; case CDROMSUBCHNL: /* Get subchannel info */ if (copy_from_user - (&subchnl, (void *) arg, sizeof(struct cdrom_subchnl))) + (&subchnl, argp, sizeof(struct cdrom_subchnl))) return -EFAULT; if (aztGetQChannelInfo(&qInfo) < 0) { #ifdef AZT_DEBUG @@ -1405,16 +1404,14 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, subchnl.cdsc_reladdr.msf.frame = azt_bcd2bin(qInfo.trackTime.frame); } - if (copy_to_user - ((void *) arg, &subchnl, sizeof(struct cdrom_subchnl))) + if (copy_to_user(argp, &subchnl, sizeof(struct cdrom_subchnl))) return -EFAULT; break; case CDROMVOLCTRL: /* Volume control * With my Aztech CD268-01A volume control does not work, I can only turn the channels on (any value !=0) or off (value==0). Maybe it works better with your drive */ - if (copy_from_user - (&volctrl, (char *) arg, sizeof(volctrl))) + if (copy_from_user(&volctrl, argp, sizeof(volctrl))) return -EFAULT; azt_Play.start.min = 0x21; azt_Play.start.sec = 0x84; @@ -1457,7 +1454,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, case CDROMREADCOOKED: /*read data in mode 1 (2048 Bytes) */ case CDROMREADRAW: /*read data in mode 2 (2336 Bytes) */ { - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); @@ -1476,16 +1473,11 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, if (DiskInfo.xa) { return -1; /*XA Disks can't be read raw */ } else { - if (sendAztCmd - (ACMD_PLAY_READ_RAW, - &azt_Play)) + if (sendAztCmd(ACMD_PLAY_READ_RAW, &azt_Play)) return -1; DTEN_LOW; - insb(DATA_PORT, buf, - CD_FRAMESIZE_RAW); - if (copy_to_user - ((void *) arg, &buf, - CD_FRAMESIZE_RAW)) + insb(DATA_PORT, buf, CD_FRAMESIZE_RAW); + if (copy_to_user(argp, &buf, CD_FRAMESIZE_RAW)) return -EFAULT; } } else @@ -1494,14 +1486,13 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, return -1; DTEN_LOW; insb(DATA_PORT, buf, CD_FRAMESIZE); - if (copy_to_user - ((void *) arg, &buf, CD_FRAMESIZE)) + if (copy_to_user(argp, &buf, CD_FRAMESIZE)) return -EFAULT; } } break; case CDROMSEEK: /*seek msf address */ - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, argp, sizeof msf)) return -EFAULT; /* convert to bcd */ azt_bin2bcd(&msf.cdmsf_min0); diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 01867107d..e4c1ae352 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -508,6 +508,8 @@ int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write) unsigned char buffer[16]; int ret; + *write = 0; + init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); cgc.cmd[0] = GPCMD_GET_CONFIGURATION; @@ -521,8 +523,10 @@ int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write) mfd = (struct mrw_feature_desc *)&buffer[sizeof(struct feature_header)]; *write = mfd->write; - if ((ret = cdrom_mrw_probe_pc(cdi))) + if ((ret = cdrom_mrw_probe_pc(cdi))) { + *write = 0; return ret; + } return 0; } @@ -651,7 +655,6 @@ int cdrom_get_random_writable(struct cdrom_device_info *cdi, { struct packet_command cgc; char buffer[24]; - struct feature_header *fh; int ret; init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); @@ -664,14 +667,7 @@ int cdrom_get_random_writable(struct cdrom_device_info *cdi, if ((ret = cdi->ops->generic_packet(cdi, &cgc))) return ret; - fh = (struct feature_header *)&buffer[0]; - if (be32_to_cpu(fh->data_len) >= (sizeof(struct feature_header)+ - sizeof(struct rwrt_feature_desc))) - memcpy(rfd, &buffer[sizeof(struct feature_header)], - sizeof (*rfd)); - else - memset(rfd, 0, sizeof(*rfd)); - + memcpy(rfd, &buffer[sizeof(struct feature_header)], sizeof (*rfd)); return 0; } @@ -679,28 +675,24 @@ int cdrom_has_defect_mgt(struct cdrom_device_info *cdi) { struct packet_command cgc; char buffer[16]; - struct feature_header *fh; __u16 *feature_code; int ret; init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); - cgc.cmd[0] = GPCMD_GET_CONFIGURATION; /* often 0x46 */ - cgc.cmd[3] = CDF_HWDM; /* often 0x0024 */ - cgc.cmd[8] = sizeof(buffer); /* often 0x10 */ + cgc.cmd[0] = GPCMD_GET_CONFIGURATION; + cgc.cmd[3] = CDF_HWDM; + cgc.cmd[8] = sizeof(buffer); cgc.quiet = 1; if ((ret = cdi->ops->generic_packet(cdi, &cgc))) return ret; - fh = (struct feature_header *)&buffer[0]; - ret = 1; - if (be32_to_cpu(fh->data_len) >= (sizeof(struct feature_header)+8)) { - feature_code = (__u16 *)&buffer[sizeof(struct feature_header)]; - if (CDF_HWDM == be16_to_cpu(*feature_code)) - ret = 0; - } - return ret; + feature_code = (__u16 *) &buffer[sizeof(struct feature_header)]; + if (be16_to_cpu(*feature_code) == CDF_HWDM) + return 0; + + return 1; } @@ -834,8 +826,30 @@ static int cdrom_ram_open_write(struct cdrom_device_info *cdi) */ static int cdrom_open_write(struct cdrom_device_info *cdi) { + int mrw, mrw_write, ram_write; int ret = 1; + mrw = 0; + if (!cdrom_is_mrw(cdi, &mrw_write)) + mrw = 1; + + (void) cdrom_is_random_writable(cdi, &ram_write); + + if (mrw) + cdi->mask &= ~CDC_MRW; + else + cdi->mask |= CDC_MRW; + + if (mrw_write) + cdi->mask &= ~CDC_MRW_W; + else + cdi->mask |= CDC_MRW_W; + + if (ram_write) + cdi->mask &= ~CDC_RAM; + else + cdi->mask |= CDC_RAM; + if (CDROM_CAN(CDC_MRW_W)) ret = cdrom_mrw_open_write(cdi); else if (CDROM_CAN(CDC_DVD_RAM)) @@ -878,6 +892,9 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp) if ((fp->f_flags & O_NONBLOCK) && (cdi->options & CDO_USE_FFLAGS)) { ret = cdi->ops->open(cdi, 1); } else { + ret = open_for_data(cdi); + if (ret) + goto err; if (fp->f_mode & FMODE_WRITE) { ret = -EROFS; if (!CDROM_CAN(CDC_RAM)) @@ -885,7 +902,6 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp) if (cdrom_open_write(cdi)) goto err; } - ret = open_for_data(cdi); } if (ret) diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 4b3834923..3a758a020 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -2595,11 +2595,10 @@ static int read_audio(struct cdrom_read_audio *ra) retval = -EIO; goto exit_read_audio; } - } else if (copy_to_user((char *)(ra->buf + + } else if (copy_to_user(ra->buf + (CD_FRAMESIZE_RAW - * cframe)), - (char *) - readahead_buffer, + * cframe), + readahead_buffer, CD_FRAMESIZE_RAW)) { retval = -EFAULT; goto exit_read_audio; @@ -2612,8 +2611,7 @@ static int read_audio(struct cdrom_read_audio *ra) retval = -EIO; goto exit_read_audio; } - } else if (copy_to_user((char *)(ra->buf + (CD_FRAMESIZE_RAW * - cframe)), + } else if (copy_to_user(ra->buf + (CD_FRAMESIZE_RAW * cframe), (char *)readahead_buffer, CD_FRAMESIZE_RAW)) { retval = -EFAULT; @@ -2945,6 +2943,7 @@ static int scd_audio_ioctl(struct cdrom_device_info *cdi, static int scd_dev_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; int i; switch (cmd) { @@ -2959,7 +2958,7 @@ static int scd_dev_ioctl(struct cdrom_device_info *cdi, return -EIO; } - if (copy_from_user(&ra, (char *) arg, sizeof(ra))) + if (copy_from_user(&ra, argp, sizeof(ra))) return -EFAULT; if (ra.nframes == 0) { diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index 7e9758fe7..62e2d11b3 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -1440,12 +1440,12 @@ static int cdromresume(void) } -static int cdromplaymsf(unsigned long arg) +static int cdromplaymsf(void __user *arg) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1461,13 +1461,13 @@ static int cdromplaymsf(unsigned long arg) } -static int cdromplaytrkind(unsigned long arg) +static int cdromplaytrkind(void __user *arg) { int status; struct cdrom_ti ti; struct cdrom_msf msf; - if (copy_from_user(&ti, (void *) arg, sizeof ti)) + if (copy_from_user(&ti, arg, sizeof ti)) return -EFAULT; if (ti.cdti_trk0 < disk_info.first @@ -1505,23 +1505,23 @@ static int cdromplaytrkind(unsigned long arg) } -static int cdromreadtochdr(unsigned long arg) +static int cdromreadtochdr(void __user *arg) { struct cdrom_tochdr tochdr; tochdr.cdth_trk0 = disk_info.first; tochdr.cdth_trk1 = disk_info.last; - return copy_to_user((void *)arg, &tochdr, sizeof tochdr) ? -EFAULT : 0; + return copy_to_user(arg, &tochdr, sizeof tochdr) ? -EFAULT : 0; } -static int cdromreadtocentry(unsigned long arg) +static int cdromreadtocentry(void __user *arg) { struct cdrom_tocentry entry; struct cdrom_subchnl *tocptr; - if (copy_from_user(&entry, (void *) arg, sizeof entry)) + if (copy_from_user(&entry, arg, sizeof entry)) return -EFAULT; if (entry.cdte_track == CDROM_LEADOUT) @@ -1544,17 +1544,17 @@ static int cdromreadtocentry(unsigned long arg) else if (entry.cdte_format != CDROM_MSF) return -EINVAL; - return copy_to_user((void *)arg, &entry, sizeof entry) ? -EFAULT : 0; + return copy_to_user(arg, &entry, sizeof entry) ? -EFAULT : 0; } -static int cdromvolctrl(unsigned long arg) +static int cdromvolctrl(void __user *arg) { int status; struct cdrom_volctrl volctrl; struct cdrom_msf msf; - if (copy_from_user(&volctrl, (char *) arg, sizeof volctrl)) + if (copy_from_user(&volctrl, arg, sizeof volctrl)) return -EFAULT; msf.cdmsf_min0 = 0x10; @@ -1573,12 +1573,12 @@ static int cdromvolctrl(unsigned long arg) } -static int cdromsubchnl(unsigned long arg) +static int cdromsubchnl(void __user *arg) { int status; struct cdrom_subchnl subchnl; - if (copy_from_user(&subchnl, (void *) arg, sizeof subchnl)) + if (copy_from_user(&subchnl, arg, sizeof subchnl)) return -EFAULT; if (subchnl.cdsc_format != CDROM_LBA @@ -1591,7 +1591,7 @@ static int cdromsubchnl(unsigned long arg) return -EIO; } - if (copy_to_user((void *)arg, &subchnl, sizeof subchnl)) + if (copy_to_user(arg, &subchnl, sizeof subchnl)) return -EFAULT; return 0; } @@ -1600,12 +1600,12 @@ static int cdromsubchnl(unsigned long arg) static struct gendisk *optcd_disk; -static int cdromread(unsigned long arg, int blocksize, int cmd) +static int cdromread(void __user *arg, int blocksize, int cmd) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *) arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1621,19 +1621,19 @@ static int cdromread(unsigned long arg, int blocksize, int cmd) fetch_data(optcd_disk->private_data, blocksize); - if (copy_to_user((void *)arg, optcd_disk->private_data, blocksize)) + if (copy_to_user(arg, optcd_disk->private_data, blocksize)) return -EFAULT; return 0; } -static int cdromseek(unsigned long arg) +static int cdromseek(void __user *arg) { int status; struct cdrom_msf msf; - if (copy_from_user(&msf, (void *)arg, sizeof msf)) + if (copy_from_user(&msf, arg, sizeof msf)) return -EFAULT; bin2bcd(&msf); @@ -1648,11 +1648,11 @@ static int cdromseek(unsigned long arg) #ifdef MULTISESSION -static int cdrommultisession(unsigned long arg) +static int cdrommultisession(void __user *arg) { struct cdrom_multisession ms; - if (copy_from_user(&ms, (void*) arg, sizeof ms)) + if (copy_from_user(&ms, arg, sizeof ms)) return -EFAULT; ms.addr.msf.minute = disk_info.last_session.minute; @@ -1667,7 +1667,7 @@ static int cdrommultisession(unsigned long arg) ms.xa_flag = disk_info.xa; - if (copy_to_user((void *)arg, &ms, sizeof(struct cdrom_multisession))) + if (copy_to_user(arg, &ms, sizeof(struct cdrom_multisession))) return -EFAULT; #if DEBUG_MULTIS @@ -1717,6 +1717,7 @@ static int opt_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { int status, err, retval = 0; + void __user *argp = (void __user *)arg; DEBUG((DEBUG_VFS, "starting opt_ioctl")); @@ -1767,10 +1768,10 @@ static int opt_ioctl(struct inode *ip, struct file *fp, switch (cmd) { case CDROMPAUSE: retval = cdrompause(); break; case CDROMRESUME: retval = cdromresume(); break; - case CDROMPLAYMSF: retval = cdromplaymsf(arg); break; - case CDROMPLAYTRKIND: retval = cdromplaytrkind(arg); break; - case CDROMREADTOCHDR: retval = cdromreadtochdr(arg); break; - case CDROMREADTOCENTRY: retval = cdromreadtocentry(arg); break; + case CDROMPLAYMSF: retval = cdromplaymsf(argp); break; + case CDROMPLAYTRKIND: retval = cdromplaytrkind(argp); break; + case CDROMREADTOCHDR: retval = cdromreadtochdr(argp); break; + case CDROMREADTOCENTRY: retval = cdromreadtocentry(argp); break; case CDROMSTOP: err = exec_cmd(COMSTOP); if (err < 0) { @@ -1799,8 +1800,8 @@ static int opt_ioctl(struct inode *ip, struct file *fp, } break; - case CDROMVOLCTRL: retval = cdromvolctrl(arg); break; - case CDROMSUBCHNL: retval = cdromsubchnl(arg); break; + case CDROMVOLCTRL: retval = cdromvolctrl(argp); break; + case CDROMSUBCHNL: retval = cdromsubchnl(argp); break; /* The drive detects the mode and automatically delivers the correct 2048 bytes, so we don't need these IOCTLs */ @@ -1814,7 +1815,7 @@ static int opt_ioctl(struct inode *ip, struct file *fp, break; #ifdef MULTISESSION - case CDROMMULTISESSION: retval = cdrommultisession(arg); break; + case CDROMMULTISESSION: retval = cdrommultisession(argp); break; #endif case CDROM_GET_MCN: retval = -EINVAL; break; /* not implemented */ @@ -1822,16 +1823,16 @@ static int opt_ioctl(struct inode *ip, struct file *fp, case CDROMREADRAW: /* this drive delivers 2340 bytes in raw mode */ - retval = cdromread(arg, CD_FRAMESIZE_RAW1, COMREADRAW); + retval = cdromread(argp, CD_FRAMESIZE_RAW1, COMREADRAW); break; case CDROMREADCOOKED: - retval = cdromread(arg, CD_FRAMESIZE, COMREAD); + retval = cdromread(argp, CD_FRAMESIZE, COMREAD); break; case CDROMREADALL: - retval = cdromread(arg, CD_FRAMESIZE_RAWER, COMREADALL); + retval = cdromread(argp, CD_FRAMESIZE_RAWER, COMREADALL); break; - case CDROMSEEK: retval = cdromseek(arg); break; + case CDROMSEEK: retval = cdromseek(argp); break; case CDROMPLAYBLK: retval = -EINVAL; break; /* not implemented */ case CDROMCLOSETRAY: break; /* The action was taken earlier */ default: retval = -EINVAL; diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index 810887818..0e60b5c6a 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -716,13 +716,11 @@ static int sjcd_tray_open(void) static int sjcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; #if defined( SJCD_TRACE ) printk("SJCD:ioctl\n"); #endif - if (ip == NULL) - return (-EINVAL); - sjcd_get_status(); if (!sjcd_status_valid) return (-EIO); @@ -795,7 +793,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, #if defined( SJCD_TRACE ) printk("SJCD: ioctl: playtrkind\n"); #endif - if (!copy_from_user(&ti, (void *) arg, sizeof(ti))) { + if (!copy_from_user(&ti, argp, sizeof(ti))) { s = 0; if (ti.cdti_trk0 < sjcd_first_track_no) return (-EINVAL); @@ -833,7 +831,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, printk("SJCD: ioctl: playmsf\n"); #endif if ((s = - verify_area(VERIFY_READ, (void *) arg, + verify_area(VERIFY_READ, argp, sizeof(sjcd_msf))) == 0) { if (sjcd_audio_status == CDROM_AUDIO_PLAY) { sjcd_send_cmd(SCMD_PAUSE); @@ -842,7 +840,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, CDROM_AUDIO_NO_STATUS; } - if (copy_from_user(&sjcd_msf, (void *) arg, + if (copy_from_user(&sjcd_msf, argp, sizeof(sjcd_msf))) return (-EFAULT); @@ -877,7 +875,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, #endif toc_header.cdth_trk0 = sjcd_first_track_no; toc_header.cdth_trk1 = sjcd_last_track_no; - if (copy_to_user((void *)arg, &toc_header, + if (copy_to_user(argp, &toc_header, sizeof(toc_header))) return -EFAULT; return 0; @@ -890,11 +888,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, printk("SJCD: ioctl: readtocentry\n"); #endif if ((s = - verify_area(VERIFY_WRITE, (void *) arg, + verify_area(VERIFY_WRITE, argp, sizeof(toc_entry))) == 0) { struct sjcd_hw_disk_info *tp; - if (copy_from_user(&toc_entry, (void *) arg, + if (copy_from_user(&toc_entry, argp, sizeof(toc_entry))) return (-EFAULT); if (toc_entry.cdte_track == CDROM_LEADOUT) @@ -931,7 +929,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, default: return (-EINVAL); } - if (copy_to_user((void *) arg, &toc_entry, + if (copy_to_user(argp, &toc_entry, sizeof(toc_entry))) s = -EFAULT; } @@ -945,11 +943,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, printk("SJCD: ioctl: subchnl\n"); #endif if ((s = - verify_area(VERIFY_WRITE, (void *) arg, + verify_area(VERIFY_WRITE, argp, sizeof(subchnl))) == 0) { struct sjcd_hw_qinfo q_info; - if (copy_from_user(&subchnl, (void *) arg, + if (copy_from_user(&subchnl, argp, sizeof(subchnl))) return (-EFAULT); @@ -990,7 +988,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, default: return (-EINVAL); } - if (copy_to_user((void *) arg, &subchnl, + if (copy_to_user(argp, &subchnl, sizeof(subchnl))) s = -EFAULT; } @@ -1004,11 +1002,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, printk("SJCD: ioctl: volctrl\n"); #endif if ((s = - verify_area(VERIFY_READ, (void *) arg, + verify_area(VERIFY_READ, argp, sizeof(vol_ctrl))) == 0) { unsigned char dummy[4]; - if (copy_from_user(&vol_ctrl, (void *) arg, + if (copy_from_user(&vol_ctrl, argp, sizeof(vol_ctrl))) return (-EFAULT); sjcd_send_4_cmd(SCMD_SET_VOLUME, @@ -1038,8 +1036,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp, #if defined( SJCD_TRACE ) printk("SJCD: ioctl: statistic\n"); #endif - if (copy_to_user((void *)arg, &statistic, - sizeof(statistic))) + if (copy_to_user(argp, &statistic, sizeof(statistic))) return -EFAULT; return 0; } diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c index 1d55bf861..a0c9c8d42 100644 --- a/drivers/cdrom/sonycd535.c +++ b/drivers/cdrom/sonycd535.c @@ -997,7 +997,7 @@ read_subcode(void) * (not BCD), so all the conversions are done. */ static int -sony_get_subchnl_info(long arg) +sony_get_subchnl_info(void __user *arg) { struct cdrom_subchnl schi; @@ -1009,7 +1009,7 @@ sony_get_subchnl_info(long arg) if (!sony_toc_read) { return -EIO; } - if (copy_from_user(&schi, (char *)arg, sizeof schi)) + if (copy_from_user(&schi, arg, sizeof schi)) return -EFAULT; switch (sony_audio_status) { @@ -1025,7 +1025,7 @@ sony_get_subchnl_info(long arg) case CDROM_AUDIO_NO_STATUS: schi.cdsc_audiostatus = sony_audio_status; - if (copy_to_user((char *)arg, &schi, sizeof schi)) + if (copy_to_user(arg, &schi, sizeof schi)) return -EFAULT; return 0; break; @@ -1053,7 +1053,7 @@ sony_get_subchnl_info(long arg) schi.cdsc_absaddr.lba = msf_to_log(last_sony_subcode->abs_msf); schi.cdsc_reladdr.lba = msf_to_log(last_sony_subcode->rel_msf); } - return copy_to_user((char *)arg, &schi, sizeof schi) ? -EFAULT : 0; + return copy_to_user(arg, &schi, sizeof schi) ? -EFAULT : 0; } @@ -1070,6 +1070,7 @@ cdu_ioctl(struct inode *inode, Byte cmd_buff[10], params[10]; int i; int dsc_status; + void __user *argp = (void __user *)arg; if (check_drive_status() != 0) return -EIO; @@ -1152,7 +1153,7 @@ cdu_ioctl(struct inode *inode, break; case CDROMPLAYMSF: /* Play starting at the given MSF address. */ - if (copy_from_user(params, (void *)arg, 6)) + if (copy_from_user(params, argp, 6)) return -EFAULT; spin_up_drive(status); set_drive_mode(SONY535_AUDIO_DRIVE_MODE, status); @@ -1184,13 +1185,12 @@ cdu_ioctl(struct inode *inode, case CDROMREADTOCHDR: /* Read the table of contents header */ { - struct cdrom_tochdr *hdr; + struct cdrom_tochdr __user *hdr = argp; struct cdrom_tochdr loc_hdr; sony_get_toc(); if (!sony_toc_read) return -EIO; - hdr = (struct cdrom_tochdr *)arg; loc_hdr.cdth_trk0 = bcd_to_int(sony_toc->first_track_num); loc_hdr.cdth_trk1 = bcd_to_int(sony_toc->last_track_num); if (copy_to_user(hdr, &loc_hdr, sizeof *hdr)) @@ -1201,7 +1201,7 @@ cdu_ioctl(struct inode *inode, case CDROMREADTOCENTRY: /* Read a given table of contents entry */ { - struct cdrom_tocentry *entry; + struct cdrom_tocentry __user *entry = argp; struct cdrom_tocentry loc_entry; int track_idx; Byte *msf_val = NULL; @@ -1210,7 +1210,6 @@ cdu_ioctl(struct inode *inode, if (!sony_toc_read) { return -EIO; } - entry = (struct cdrom_tocentry *)arg; if (copy_from_user(&loc_entry, entry, sizeof loc_entry)) return -EFAULT; @@ -1252,7 +1251,7 @@ cdu_ioctl(struct inode *inode, if (!sony_toc_read) return -EIO; - if (copy_from_user(&ti, (char *)arg, sizeof ti)) + if (copy_from_user(&ti, argp, sizeof ti)) return -EFAULT; if ((ti.cdti_trk0 < sony_toc->first_track_num) || (sony_toc->last_track_num < ti.cdti_trk0) @@ -1314,14 +1313,13 @@ cdu_ioctl(struct inode *inode, } case CDROMSUBCHNL: /* Get subchannel info */ - return sony_get_subchnl_info(arg); + return sony_get_subchnl_info(argp); case CDROMVOLCTRL: /* Volume control. What volume does this change, anyway? */ { struct cdrom_volctrl volctrl; - if (copy_from_user(&volctrl, (char *)arg, - sizeof volctrl)) + if (copy_from_user(&volctrl, argp, sizeof volctrl)) return -EFAULT; cmd_buff[0] = SONY535_SET_VOLUME; cmd_buff[1] = volctrl.channel0; diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 341348f2c..ee88dfc53 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -588,17 +588,6 @@ config HVC_CONSOLE console. This driver allows each pSeries partition to have a console which is accessed via the HMC. -config PC9800_OLDLP - tristate "NEC PC-9800 old-style printer port support" - depends on X86_PC9800 && !PARPORT - ---help--- - If you intend to attach a printer to the parallel port of NEC PC-9801 - /PC-9821 with OLD compatibility mode, Say Y. - -config PC9800_OLDLP_CONSOLE - bool "Support for console on line printer" - depends on PC9800_OLDLP - config QIC02_TAPE tristate "QIC-02 tape support" help @@ -742,7 +731,7 @@ config NVRAM config RTC tristate "Enhanced Real Time Clock Support" - depends on !PPC32 && !PARISC && !IA64 && !X86_PC9800 && !M68K + depends on !PPC32 && !PARISC && !IA64 && !M68K ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you @@ -795,15 +784,6 @@ config EFI_RTC bool "EFI Real Time Clock Services" depends on IA64 -config RTC98 - tristate "NEC PC-9800 Real Time Clock Support" - depends on X86_PC9800 - default y - ---help--- - If you say Y here and create a character special file /dev/rtc with - major number 10 and minor number 135 using mknod ("man mknod"), you - will get access to the real time clock (or hardware clock) built - config H8 bool "Tadpole ANA H8 Support (OBSOLETE)" depends on OBSOLETE && ALPHA_BOOK1 @@ -959,6 +939,33 @@ config RAW_DRIVER kernels. Applications should simply open the device (eg /dev/hda1) with the O_DIRECT flag. +config HPET + bool "HPET - High Precision Event Timer" if (X86 || IA64) + default n + depends on ACPI + help + If you say Y here, you will have a device named "/dev/hpet/XX" for + each timer supported by the HPET. The timers are + non-periodioc and/or periodic. + +config HPET_RTC_IRQ + bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC + default n + depends on HPET + help + If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It + is assumed the platform called hpet_alloc with the RTC IRQ values for + the HPET timers. + +config HPET_NOMMAP + bool "HPET - Control mmap capability." + default n + depends on HPET + help + If you say Y here, then the mmap interface for the HPET driver returns ENOSYS. + Some hardware implementations might not want all the memory in the page the + HPET control registers reside to be exposed. + config MAX_RAW_DEVS int "Maximum number of RAW devices to support (1-8192)" depends on RAW_DRIVER diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 53439fc47..8d46de32e 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -47,13 +47,13 @@ obj-$(CONFIG_VIOTAPE) += viotape.o obj-$(CONFIG_PRINTER) += lp.o obj-$(CONFIG_TIPAR) += tipar.o -obj-$(CONFIG_PC9800_OLDLP) += lp_old98.o obj-$(CONFIG_DTLK) += dtlk.o obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_RTC) += rtc.o +obj-$(CONFIG_HPET) += hpet.o obj-$(CONFIG_GEN_RTC) += genrtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o ifeq ($(CONFIG_GENERIC_NVRAM),y) diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 4d4eaf2e4..0b2c40e94 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -105,8 +105,8 @@ static unsigned int WriteErrorCount; /* number of write error */ static unsigned int ReadErrorCount; /* number of read error */ static unsigned int DeviceErrorCount; /* number of device error */ -static ssize_t ac_read (struct file *, char *, size_t, loff_t *); -static ssize_t ac_write (struct file *, const char *, size_t, loff_t *); +static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *); +static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *); static int ac_ioctl(struct inode *, struct file *, unsigned int, unsigned long); static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); @@ -343,7 +343,7 @@ int __init applicom_init(void) __initcall(applicom_init); #endif -static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t * ppos) +static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { unsigned int NumCard; /* Board number 1 -> 8 */ unsigned int IndexCard; /* Index board number 0 -> 7 */ @@ -467,7 +467,7 @@ static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t return 0; } -static int do_ac_read(int IndexCard, char *buf, +static int do_ac_read(int IndexCard, char __user *buf, struct st_ram_io *st_loc, struct mailbox *mailbox) { unsigned long from = (unsigned long)apbs[IndexCard].RamIO + RAM_TO_PC; @@ -521,7 +521,7 @@ static int do_ac_read(int IndexCard, char *buf, return (sizeof(struct st_ram_io) + sizeof(struct mailbox)); } -static ssize_t ac_read (struct file *filp, char *buf, size_t count, loff_t *ptr) +static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_t *ptr) { unsigned long flags; unsigned int i; @@ -689,6 +689,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un int ret = 0; volatile unsigned char byte_reset_it; struct st_ram_io *adgl; + void __user *argp = (void __user *)arg; /* In general, the device is only openable by root anyway, so we're not particularly concerned that bogus ioctls can flood the console. */ @@ -697,7 +698,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (!adgl) return -ENOMEM; - if (copy_from_user(adgl, (void *)arg,sizeof(struct st_ram_io))) { + if (copy_from_user(adgl, argp, sizeof(struct st_ram_io))) { kfree(adgl); return -EFAULT; } @@ -721,7 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un pmem = apbs[IndexCard].RamIO; for (i = 0; i < sizeof(struct st_ram_io); i++) ((unsigned char *)adgl)[i]=readb(pmem++); - if (copy_to_user((void *)arg, adgl, sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl, sizeof(struct st_ram_io))) ret = -EFAULT; break; case 1: @@ -742,7 +743,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un (readb(apbs[IndexCard].RamIO + SERIAL_NUMBER + 1) << 8) + (readb(apbs[IndexCard].RamIO + SERIAL_NUMBER + 2) ); - if (copy_to_user((void *)arg, adgl, sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl, sizeof(struct st_ram_io))) ret = -EFAULT; break; case 2: @@ -768,7 +769,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un pmem = apbs[IndexCard].RamIO + TIC_OWNER_TO_PC; adgl->tic_owner_to_pc = readb(pmem++); adgl->numcard_owner_to_pc = readb(pmem); - if (copy_to_user((void *)arg, adgl,sizeof(struct st_ram_io))) + if (copy_to_user(argp, adgl,sizeof(struct st_ram_io))) ret = -EFAULT; break; case 5: diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 48ae91c92..85f596496 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -676,8 +676,6 @@ static char rcsid[] = #include #include -#define cy_put_user put_user - static void cy_throttle (struct tty_struct *tty); static void cy_send_xchar (struct tty_struct *tty, char ch); @@ -3536,7 +3534,7 @@ set_line_char(struct cyclades_port * info) static int get_serial_info(struct cyclades_port * info, - struct serial_struct * retinfo) + struct serial_struct __user * retinfo) { struct serial_struct tmp; struct cyclades_card *cinfo = &cy_card[info->card]; @@ -3559,7 +3557,7 @@ get_serial_info(struct cyclades_port * info, static int set_serial_info(struct cyclades_port * info, - struct serial_struct * new_info) + struct serial_struct __user * new_info) { struct serial_struct new_serial; struct cyclades_port old_info; @@ -3613,7 +3611,7 @@ check_and_exit: * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. */ -static int get_lsr_info(struct cyclades_port *info, unsigned int *value) +static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) { int card, chip, channel, index; unsigned char status; @@ -3638,7 +3636,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int *value) /* Not supported yet */ return -EINVAL; } - return cy_put_user(result, (unsigned long *) value); + return put_user(result, (unsigned long __user *) value); } static int @@ -3916,7 +3914,7 @@ cy_break(struct tty_struct *tty, int break_state) } /* cy_break */ static int -get_mon_info(struct cyclades_port * info, struct cyclades_monitor * mon) +get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon) { if(copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor))) @@ -3961,7 +3959,7 @@ set_threshold(struct cyclades_port * info, unsigned long value) static int -get_threshold(struct cyclades_port * info, unsigned long *value) +get_threshold(struct cyclades_port * info, unsigned long __user *value) { unsigned char *base_addr; int card,channel,chip,index; @@ -3978,7 +3976,7 @@ get_threshold(struct cyclades_port * info, unsigned long *value) + (cy_chip_offset[chip]<default_threshold,value); + return put_user(info->default_threshold,value); }/* get_default_threshold */ @@ -4029,7 +4027,7 @@ set_timeout(struct cyclades_port * info, unsigned long value) static int -get_timeout(struct cyclades_port * info, unsigned long *value) +get_timeout(struct cyclades_port * info, unsigned long __user *value) { unsigned char *base_addr; int card,channel,chip,index; @@ -4046,7 +4044,7 @@ get_timeout(struct cyclades_port * info, unsigned long *value) + (cy_chip_offset[chip]<default_timeout,value); + return put_user(info->default_timeout,value); }/* get_default_timeout */ /* @@ -4079,9 +4077,10 @@ cy_ioctl(struct tty_struct *tty, struct file * file, { struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; struct cyclades_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; /* user space */ int ret_val = 0; unsigned long flags; + void __user *argp = (void __user *)arg; if (serial_paranoia_check(info, tty->name, "cy_ioctl")) return -ENODEV; @@ -4093,31 +4092,31 @@ cy_ioctl(struct tty_struct *tty, struct file * file, switch (cmd) { case CYGETMON: - ret_val = get_mon_info(info, (struct cyclades_monitor *)arg); + ret_val = get_mon_info(info, argp); break; case CYGETTHRESH: - ret_val = get_threshold(info, (unsigned long *)arg); + ret_val = get_threshold(info, argp); break; case CYSETTHRESH: - ret_val = set_threshold(info, (unsigned long)arg); + ret_val = set_threshold(info, arg); break; case CYGETDEFTHRESH: - ret_val = get_default_threshold(info, (unsigned long *)arg); + ret_val = get_default_threshold(info, argp); break; case CYSETDEFTHRESH: - ret_val = set_default_threshold(info, (unsigned long)arg); + ret_val = set_default_threshold(info, arg); break; case CYGETTIMEOUT: - ret_val = get_timeout(info, (unsigned long *)arg); + ret_val = get_timeout(info, argp); break; case CYSETTIMEOUT: - ret_val = set_timeout(info, (unsigned long)arg); + ret_val = set_timeout(info, arg); break; case CYGETDEFTIMEOUT: - ret_val = get_default_timeout(info, (unsigned long *)arg); + ret_val = get_default_timeout(info, argp); break; case CYSETDEFTIMEOUT: - ret_val = set_default_timeout(info, (unsigned long)arg); + ret_val = set_default_timeout(info, arg); break; case CYSETRFLOW: info->rflow = (int)arg; @@ -4134,7 +4133,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ret_val = info->rtsdtr_inv; break; case CYGETCARDINFO: - if (copy_to_user((void *)arg, (void *)&cy_card[info->card], + if (copy_to_user(argp, &cy_card[info->card], sizeof (struct cyclades_card))) { ret_val = -EFAULT; break; @@ -4161,13 +4160,13 @@ cy_ioctl(struct tty_struct *tty, struct file * file, ret_val = info->closing_wait / (HZ/100); break; case TIOCGSERIAL: - ret_val = get_serial_info(info, (struct serial_struct *) arg); + ret_val = get_serial_info(info, argp); break; case TIOCSSERIAL: - ret_val = set_serial_info(info, (struct serial_struct *) arg); + ret_val = set_serial_info(info, argp); break; case TIOCSERGETLSR: /* Get line status register */ - ret_val = get_lsr_info(info, (unsigned int *) arg); + ret_val = get_lsr_info(info, argp); break; /* * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change @@ -4215,7 +4214,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file, CY_LOCK(info, flags); cnow = info->icount; CY_UNLOCK(info, flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; ret_val = put_user(cnow.cts, &p_cuser->cts); if (ret_val) return ret_val; ret_val = put_user(cnow.dsr, &p_cuser->dsr); diff --git a/drivers/char/drm/drm_agpsupport.h b/drivers/char/drm/drm_agpsupport.h index 2abb7fa01..aa7fd54bb 100644 --- a/drivers/char/drm/drm_agpsupport.h +++ b/drivers/char/drm/drm_agpsupport.h @@ -109,8 +109,6 @@ int DRM(agp_acquire)(struct inode *inode, struct file *filp, return -EBUSY; if (!drm_agp->acquire) return -EINVAL; - if ( dev->agp->cant_use_aperture ) - return -EINVAL; if ((retcode = drm_agp->acquire())) return retcode; dev->agp->acquired = 1; diff --git a/drivers/char/drm/drm_ioctl.h b/drivers/char/drm/drm_ioctl.h index f89aa9ee3..cbf2dbf02 100644 --- a/drivers/char/drm/drm_ioctl.h +++ b/drivers/char/drm/drm_ioctl.h @@ -142,6 +142,13 @@ DRM(set_busid)(drm_device_t *dev) snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); + dev->devname = DRM(alloc)(strlen(dev->name) + dev->unique_len + 2, + DRM_MEM_DRIVER); + if (dev->devname == NULL) + return ENOMEM; + + sprintf(dev->devname, "%s@%s", dev->name, dev->unique); + return 0; } diff --git a/drivers/char/drm/gamma_dma.c b/drivers/char/drm/gamma_dma.c index d45f5195a..ed6a8358d 100644 --- a/drivers/char/drm/gamma_dma.c +++ b/drivers/char/drm/gamma_dma.c @@ -346,6 +346,9 @@ static int gamma_dma_priority(struct file *filp, drm_buf_t *buf; drm_buf_t *last_buf = NULL; drm_device_dma_t *dma = dev->dma; + int *send_indices = NULL; + int *send_sizes = NULL; + DECLARE_WAITQUEUE(entry, current); /* Turn off interrupt handling */ @@ -365,11 +368,31 @@ static int gamma_dma_priority(struct file *filp, ++must_free; } + send_indices = DRM(alloc)(d->send_count * sizeof(*send_indices), + DRM_MEM_DRIVER); + if (send_indices == NULL) + return -ENOMEM; + if (copy_from_user(send_indices, d->send_indices, + d->send_count * sizeof(*send_indices))) { + retcode = -EFAULT; + goto cleanup; + } + + send_sizes = DRM(alloc)(d->send_count * sizeof(*send_sizes), + DRM_MEM_DRIVER); + if (send_sizes == NULL) + return -ENOMEM; + if (copy_from_user(send_sizes, d->send_sizes, + d->send_count * sizeof(*send_sizes))) { + retcode = -EFAULT; + goto cleanup; + } + for (i = 0; i < d->send_count; i++) { - idx = d->send_indices[i]; + idx = send_indices[i]; if (idx < 0 || idx >= dma->buf_count) { DRM_ERROR("Index %d (of %d max)\n", - d->send_indices[i], dma->buf_count - 1); + send_indices[i], dma->buf_count - 1); continue; } buf = dma->buflist[ idx ]; @@ -391,7 +414,7 @@ static int gamma_dma_priority(struct file *filp, process closes the /dev/drm? handle, so it can't also be doing DMA. */ buf->list = DRM_LIST_PRIO; - buf->used = d->send_sizes[i]; + buf->used = send_sizes[i]; buf->context = d->context; buf->while_locked = d->flags & _DRM_DMA_WHILE_LOCKED; address = (unsigned long)buf->address; @@ -402,14 +425,14 @@ static int gamma_dma_priority(struct file *filp, if (buf->pending) { DRM_ERROR("Sending pending buffer:" " buffer %d, offset %d\n", - d->send_indices[i], i); + send_indices[i], i); retcode = -EINVAL; goto cleanup; } if (buf->waiting) { DRM_ERROR("Sending waiting buffer:" " buffer %d, offset %d\n", - d->send_indices[i], i); + send_indices[i], i); retcode = -EINVAL; goto cleanup; } @@ -458,6 +481,12 @@ cleanup: gamma_dma_ready(dev); gamma_free_buffer(dev, last_buf); } + if (send_indices) + DRM(free)(send_indices, d->send_count * sizeof(*send_indices), + DRM_MEM_DRIVER); + if (send_sizes) + DRM(free)(send_sizes, d->send_count * sizeof(*send_sizes), + DRM_MEM_DRIVER); if (must_free && !dev->context_flag) { if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, @@ -476,9 +505,13 @@ static int gamma_dma_send_buffers(struct file *filp, drm_buf_t *last_buf = NULL; int retcode = 0; drm_device_dma_t *dma = dev->dma; + int send_index; + + if (get_user(send_index, &d->send_indices[d->send_count-1])) + return -EFAULT; if (d->flags & _DRM_DMA_BLOCK) { - last_buf = dma->buflist[d->send_indices[d->send_count-1]]; + last_buf = dma->buflist[send_index]; add_wait_queue(&last_buf->dma_wait, &entry); } diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c index 81d220996..6ec11b025 100644 --- a/drivers/char/drm/r128_state.c +++ b/drivers/char/drm/r128_state.c @@ -916,7 +916,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { return DRM_ERR(EFAULT); @@ -1012,7 +1012,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); xbuf_size = count * sizeof(*x); ybuf_size = count * sizeof(*y); @@ -1131,7 +1131,7 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { return DRM_ERR(EFAULT); @@ -1176,7 +1176,7 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return DRM_ERR(EMSGSIZE); if ( count > dev_priv->depth_pitch ) { count = dev_priv->depth_pitch; diff --git a/drivers/char/drm/radeon.h b/drivers/char/drm/radeon.h index 9a22c0604..54fac7940 100644 --- a/drivers/char/drm/radeon.h +++ b/drivers/char/drm/radeon.h @@ -51,7 +51,7 @@ #define DRIVER_DATE "20020828" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 10 +#define DRIVER_MINOR 11 #define DRIVER_PATCHLEVEL 0 /* Interface history: @@ -84,6 +84,8 @@ * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which * clients use to tell the DRM where they think the framebuffer is * located in the card's address space + * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color + * and GL_EXT_blend_[func|equation]_separate on r200 */ #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h index c60c09fd4..735e04ef4 100644 --- a/drivers/char/drm/radeon_drm.h +++ b/drivers/char/drm/radeon_drm.h @@ -144,7 +144,8 @@ #define RADEON_EMIT_PP_TEX_SIZE_0 73 #define RADEON_EMIT_PP_TEX_SIZE_1 74 #define RADEON_EMIT_PP_TEX_SIZE_2 75 -#define RADEON_MAX_STATE_PACKETS 76 +#define R200_EMIT_RB3D_BLENDCOLOR 76 +#define RADEON_MAX_STATE_PACKETS 77 /* Commands understood by cmd_buffer ioctl. More can be added but diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index afa516e8b..45eafd056 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h @@ -690,6 +690,7 @@ extern void radeon_do_release(drm_device_t *dev); #define R200_SE_VTX_FMT_1 0x208c #define R200_RE_CNTL 0x1c50 +#define R200_RB3D_BLENDCOLOR 0x3218 /* Constants */ #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c index 3a3bf011a..83e2f6c04 100644 --- a/drivers/char/drm/radeon_mem.c +++ b/drivers/char/drm/radeon_mem.c @@ -137,12 +137,12 @@ static int init_heap(struct mem_block **heap, int start, int size) struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks)); if (!blocks) - return -ENOMEM; + return DRM_ERR(ENOMEM); *heap = DRM_MALLOC(sizeof(**heap)); if (!*heap) { DRM_FREE( blocks, sizeof(*blocks) ); - return -ENOMEM; + return DRM_ERR(ENOMEM); } blocks->start = start; diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index a8780bc90..64143d190 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c @@ -201,6 +201,7 @@ static __inline__ int radeon_check_and_fixup_packets( drm_radeon_private_t *dev_ case RADEON_EMIT_PP_TEX_SIZE_0: case RADEON_EMIT_PP_TEX_SIZE_1: case RADEON_EMIT_PP_TEX_SIZE_2: + case R200_EMIT_RB3D_BLENDCOLOR: /* These packets don't contain memory offsets */ break; @@ -563,6 +564,7 @@ static struct { { RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" }, { RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" }, { RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_1" }, + { R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" }, }; diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c index 80935d6a7..9a1078561 100644 --- a/drivers/char/drm/sis_mm.c +++ b/drivers/char/drm/sis_mm.c @@ -113,7 +113,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS ) DRM_COPY_TO_USER_IOCTL((drm_sis_mem_t *)data, fb, sizeof(fb)); - DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset); + DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, req.offset); return retval; } @@ -130,7 +130,7 @@ int sis_fb_free( DRM_IOCTL_ARGS ) if (!del_alloc_set(fb.context, VIDEO_TYPE, fb.free)) retval = DRM_ERR(EINVAL); - sis_free(fb.free); + sis_free((u32)fb.free); DRM_DEBUG("free fb, offset = %lu\n", fb.free); diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 577950510..ad4a96704 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -79,7 +79,7 @@ MODULE_PARM_DESC(force, "Force loading without checking for supported models"); MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set"); MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); -static ssize_t i8k_read(struct file *, char *, size_t, loff_t *); +static ssize_t i8k_read(struct file *, char __user *, size_t, loff_t *); static int i8k_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -330,10 +330,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, int val; int speed; unsigned char buff[16]; + int __user *argp = (int __user *)arg; - if (!arg) { + if (!argp) return -EINVAL; - } switch (cmd) { case I8K_BIOS_VERSION: @@ -358,14 +358,14 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, break; case I8K_GET_SPEED: - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } val = i8k_get_fan_speed(val); break; case I8K_GET_FAN: - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } val = i8k_get_fan_status(val); @@ -375,10 +375,10 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, if (restricted && !capable(CAP_SYS_ADMIN)) { return -EPERM; } - if (copy_from_user(&val, (int *)arg, sizeof(int))) { + if (copy_from_user(&val, argp, sizeof(int))) { return -EFAULT; } - if (copy_from_user(&speed, (int *)arg+1, sizeof(int))) { + if (copy_from_user(&speed, argp+1, sizeof(int))) { return -EFAULT; } val = i8k_set_fan(val, speed); @@ -394,17 +394,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, switch (cmd) { case I8K_BIOS_VERSION: - if (copy_to_user((int *)arg, &val, 4)) { + if (copy_to_user(argp, &val, 4)) { return -EFAULT; } break; case I8K_MACHINE_ID: - if (copy_to_user((int *)arg, buff, 16)) { + if (copy_to_user(argp, buff, 16)) { return -EFAULT; } break; default: - if (copy_to_user((int *)arg, &val, sizeof(int))) { + if (copy_to_user(argp, &val, sizeof(int))) { return -EFAULT; } break; @@ -462,7 +462,7 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length) return n; } -static ssize_t i8k_read(struct file *f, char *buffer, size_t len, loff_t *fpos) +static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos) { int n; char info[128]; diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index 6fc7077d9..7295bc559 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c @@ -31,7 +31,7 @@ #include /* for completion codes */ #include "ipmi_si_sm.h" -#define IPMI_BT_VERSION "v31" +#define IPMI_BT_VERSION "v32" static int bt_debug = 0x00; /* Production value 0, see following flags */ diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index afd1de325..0a2eeba3c 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c @@ -45,7 +45,7 @@ #include #include -#define IPMI_DEVINTF_VERSION "v31" +#define IPMI_DEVINTF_VERSION "v32" struct ipmi_file_private { @@ -199,7 +199,7 @@ static int handle_send_req(ipmi_user_t user, goto out; } - if (copy_from_user(&msgdata, + if (copy_from_user(msgdata, req->msg.data, req->msg.data_len)) { @@ -231,6 +231,7 @@ static int ipmi_ioctl(struct inode *inode, { int rv = -EINVAL; struct ipmi_file_private *priv = file->private_data; + void __user *arg = (void __user *)data; switch (cmd) { @@ -238,7 +239,7 @@ static int ipmi_ioctl(struct inode *inode, { struct ipmi_req req; - if (copy_from_user(&req, (void *) data, sizeof(req))) { + if (copy_from_user(&req, arg, sizeof(req))) { rv = -EFAULT; break; } @@ -254,7 +255,7 @@ static int ipmi_ioctl(struct inode *inode, { struct ipmi_req_settime req; - if (copy_from_user(&req, (void *) data, sizeof(req))) { + if (copy_from_user(&req, arg, sizeof(req))) { rv = -EFAULT; break; } @@ -277,7 +278,7 @@ static int ipmi_ioctl(struct inode *inode, rv = 0; - if (copy_from_user(&rsp, (void *) data, sizeof(rsp))) { + if (copy_from_user(&rsp, arg, sizeof(rsp))) { rv = -EFAULT; break; } @@ -344,7 +345,7 @@ static int ipmi_ioctl(struct inode *inode, rsp.msg.data_len = 0; } - if (copy_to_user((void *) data, &rsp, sizeof(rsp))) { + if (copy_to_user(arg, &rsp, sizeof(rsp))) { rv = -EFAULT; goto recv_putback_on_err; } @@ -371,7 +372,7 @@ static int ipmi_ioctl(struct inode *inode, { struct ipmi_cmdspec val; - if (copy_from_user(&val, (void *) data, sizeof(val))) { + if (copy_from_user(&val, arg, sizeof(val))) { rv = -EFAULT; break; } @@ -384,7 +385,7 @@ static int ipmi_ioctl(struct inode *inode, { struct ipmi_cmdspec val; - if (copy_from_user(&val, (void *) data, sizeof(val))) { + if (copy_from_user(&val, arg, sizeof(val))) { rv = -EFAULT; break; } @@ -397,7 +398,7 @@ static int ipmi_ioctl(struct inode *inode, { int val; - if (copy_from_user(&val, (void *) data, sizeof(val))) { + if (copy_from_user(&val, arg, sizeof(val))) { rv = -EFAULT; break; } @@ -410,7 +411,7 @@ static int ipmi_ioctl(struct inode *inode, { unsigned int val; - if (copy_from_user(&val, (void *) data, sizeof(val))) { + if (copy_from_user(&val, arg, sizeof(val))) { rv = -EFAULT; break; } @@ -426,7 +427,7 @@ static int ipmi_ioctl(struct inode *inode, val = ipmi_get_my_address(priv->user); - if (copy_to_user((void *) data, &val, sizeof(val))) { + if (copy_to_user(arg, &val, sizeof(val))) { rv = -EFAULT; break; } @@ -438,7 +439,7 @@ static int ipmi_ioctl(struct inode *inode, { unsigned int val; - if (copy_from_user(&val, (void *) data, sizeof(val))) { + if (copy_from_user(&val, arg, sizeof(val))) { rv = -EFAULT; break; } @@ -454,7 +455,7 @@ static int ipmi_ioctl(struct inode *inode, val = ipmi_get_my_LUN(priv->user); - if (copy_to_user((void *) data, &val, sizeof(val))) { + if (copy_to_user(arg, &val, sizeof(val))) { rv = -EFAULT; break; } @@ -465,7 +466,7 @@ static int ipmi_ioctl(struct inode *inode, { struct ipmi_timing_parms parms; - if (copy_from_user(&parms, (void *) data, sizeof(parms))) { + if (copy_from_user(&parms, arg, sizeof(parms))) { rv = -EFAULT; break; } @@ -483,7 +484,7 @@ static int ipmi_ioctl(struct inode *inode, parms.retries = priv->default_retries; parms.retry_time_ms = priv->default_retry_time_ms; - if (copy_to_user((void *) data, &parms, sizeof(parms))) { + if (copy_to_user(arg, &parms, sizeof(parms))) { rv = -EFAULT; break; } diff --git a/drivers/char/ipmi/ipmi_kcs_sm.c b/drivers/char/ipmi/ipmi_kcs_sm.c index f4dd321e9..d155f9a58 100644 --- a/drivers/char/ipmi/ipmi_kcs_sm.c +++ b/drivers/char/ipmi/ipmi_kcs_sm.c @@ -42,7 +42,7 @@ #include /* for completion codes */ #include "ipmi_si_sm.h" -#define IPMI_KCS_VERSION "v31" +#define IPMI_KCS_VERSION "v32" /* Set this if you want a printout of why the state machine was hosed when it gets hosed. */ diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index c1e4abf14..58c279a9a 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -46,7 +46,7 @@ #include #include -#define IPMI_MSGHANDLER_VERSION "v31" +#define IPMI_MSGHANDLER_VERSION "v32" struct ipmi_recv_msg *ipmi_alloc_recv_msg(void); static int ipmi_init_msghandler(void); @@ -123,6 +123,12 @@ struct ipmi_channel unsigned char protocol; }; +struct ipmi_proc_entry +{ + char *name; + struct ipmi_proc_entry *next; +}; + #define IPMI_IPMB_NUM_SEQ 64 #define IPMI_MAX_CHANNELS 8 struct ipmi_smi @@ -149,6 +155,11 @@ struct ipmi_smi struct ipmi_smi_handlers *handlers; void *send_info; + /* A list of proc entries for this interface. This does not + need a lock, only one thread creates it and only one thread + destroys it. */ + struct ipmi_proc_entry *proc_entries; + /* A table of sequence numbers for this interface. We use the sequence numbers for IPMB messages that go out of the interface to match them up with their responses. A routine @@ -1515,18 +1526,36 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, read_proc_t *read_proc, write_proc_t *write_proc, void *data, struct module *owner) { - struct proc_dir_entry *file; - int rv = 0; + struct proc_dir_entry *file; + int rv = 0; + struct ipmi_proc_entry *entry; + + /* Create a list element. */ + entry = kmalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) + return -ENOMEM; + entry->name = kmalloc(strlen(name)+1, GFP_KERNEL); + if (!entry->name) { + kfree(entry); + return -ENOMEM; + } + strcpy(entry->name, name); file = create_proc_entry(name, 0, smi->proc_dir); - if (!file) + if (!file) { + kfree(entry->name); + kfree(entry); rv = -ENOMEM; - else { + } else { file->nlink = 1; file->data = data; file->read_proc = read_proc; file->write_proc = write_proc; file->owner = owner; + + /* Stick it on the list. */ + entry->next = smi->proc_entries; + smi->proc_entries = entry; } return rv; @@ -1562,6 +1591,21 @@ static int add_proc_entries(ipmi_smi_t smi, int num) return rv; } +static void remove_proc_entries(ipmi_smi_t smi) +{ + struct ipmi_proc_entry *entry; + + while (smi->proc_entries) { + entry = smi->proc_entries; + smi->proc_entries = entry->next; + + remove_proc_entry(entry->name, smi->proc_dir); + kfree(entry->name); + kfree(entry); + } + remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); +} + static int send_channel_info_cmd(ipmi_smi_t intf, int chan) { @@ -1604,6 +1648,22 @@ channel_handler(ipmi_smi_t intf, struct ipmi_smi_msg *msg) /* It's the one we want */ if (msg->rsp[2] != 0) { /* Got an error from the channel, just go on. */ + + if (msg->rsp[2] == IPMI_INVALID_COMMAND_ERR) { + /* If the MC does not support this + command, that is legal. We just + assume it has one IPMB at channel + zero. */ + intf->channels[0].medium + = IPMI_CHANNEL_MEDIUM_IPMB; + intf->channels[0].protocol + = IPMI_CHANNEL_PROTOCOL_IPMB; + rv = -ENOSYS; + + intf->curr_channel = IPMI_MAX_CHANNELS; + wake_up(&intf->waitq); + goto out; + } goto next_channel; } if (msg->rsp_size < 6) { @@ -1627,10 +1687,20 @@ channel_handler(ipmi_smi_t intf, struct ipmi_smi_msg *msg) wake_up(&intf->waitq); printk(KERN_WARNING "ipmi_msghandler: Error sending" - "channel information: 0x%x\n", + "channel information: %d\n", rv); } } + out: + return; +} + +void ipmi_poll_interface(ipmi_user_t user) +{ + ipmi_smi_t intf = user->intf; + + if (intf->handlers->poll) + intf->handlers->poll(intf->send_info); } int ipmi_register_smi(struct ipmi_smi_handlers *handlers, @@ -1749,8 +1819,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, if (rv) { if (new_intf->proc_dir) - remove_proc_entry(new_intf->proc_dir_name, - proc_ipmi_root); + remove_proc_entries(new_intf); kfree(new_intf); } @@ -1806,8 +1875,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf) { for (i=0; iproc_dir_name, - proc_ipmi_root); + remove_proc_entries(intf); spin_lock_irqsave(&interfaces_lock, flags); ipmi_interfaces[i] = NULL; clean_up_interface_data(intf); @@ -3112,6 +3180,7 @@ EXPORT_SYMBOL(ipmi_request); EXPORT_SYMBOL(ipmi_request_settime); EXPORT_SYMBOL(ipmi_request_supply_msgs); EXPORT_SYMBOL(ipmi_request_with_source); +EXPORT_SYMBOL(ipmi_poll_interface); EXPORT_SYMBOL(ipmi_register_smi); EXPORT_SYMBOL(ipmi_unregister_smi); EXPORT_SYMBOL(ipmi_register_for_cmd); diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 34ceaeed6..85c9fec37 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -76,7 +76,7 @@ static inline void add_usec_to_timer(struct timer_list *t, long v) #include "ipmi_si_sm.h" #include -#define IPMI_SI_VERSION "v31" +#define IPMI_SI_VERSION "v32" /* Measure times between events in the driver. */ #undef DEBUG_TIMING @@ -712,6 +712,13 @@ static void set_run_to_completion(void *send_info, int i_run_to_completion) spin_unlock_irqrestore(&(smi_info->si_lock), flags); } +static void poll(void *send_info) +{ + struct smi_info *smi_info = send_info; + + smi_event_handler(smi_info, 0); +} + static void request_events(void *send_info) { struct smi_info *smi_info = send_info; @@ -851,7 +858,8 @@ static struct ipmi_smi_handlers handlers = .owner = THIS_MODULE, .sender = sender, .request_events = request_events, - .set_run_to_completion = set_run_to_completion + .set_run_to_completion = set_run_to_completion, + .poll = poll, }; /* There can be 4 IO ports passed in (with or without IRQs), 4 addresses, @@ -905,10 +913,10 @@ MODULE_PARM_DESC(irqs, "Sets the interrupt of each interface, the" " has an interrupt. Otherwise, set it to zero or leave" " it blank."); - -#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI) #define IPMI_MEM_ADDR_SPACE 1 #define IPMI_IO_ADDR_SPACE 2 + +#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI) static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr) { int i; @@ -1848,6 +1856,21 @@ static int init_one_smi(int intf_num, struct smi_info **smi) atomic_set(&new_smi->req_events, 0); new_smi->run_to_completion = 0; + new_smi->interrupt_disabled = 0; + new_smi->timer_stopped = 0; + new_smi->stop_operation = 0; + + /* The ipmi_register_smi() code does some operations to + determine the channel information, so we must be ready to + handle operations before it is called. This means we have + to stop the timer if we get an error after this point. */ + init_timer(&(new_smi->si_timer)); + new_smi->si_timer.data = (long) new_smi; + new_smi->si_timer.function = smi_timeout; + new_smi->last_timeout_jiffies = jiffies; + new_smi->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; + add_timer(&(new_smi->si_timer)); + rv = ipmi_register_smi(&handlers, new_smi, new_smi->ipmi_version_major, @@ -1857,7 +1880,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) printk(KERN_ERR "ipmi_si: Unable to register device: error %d\n", rv); - goto out_err; + goto out_err_stop_timer; } rv = ipmi_smi_add_proc_entry(new_smi->intf, "type", @@ -1867,7 +1890,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) printk(KERN_ERR "ipmi_si: Unable to create proc entry: %d\n", rv); - goto out_err; + goto out_err_stop_timer; } rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats", @@ -1877,7 +1900,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) printk(KERN_ERR "ipmi_si: Unable to create proc entry: %d\n", rv); - goto out_err; + goto out_err_stop_timer; } start_clear_flags(new_smi); @@ -1886,34 +1909,40 @@ static int init_one_smi(int intf_num, struct smi_info **smi) if (new_smi->irq) new_smi->si_state = SI_CLEARING_FLAGS_THEN_SET_IRQ; - new_smi->interrupt_disabled = 0; - new_smi->timer_stopped = 0; - new_smi->stop_operation = 0; - - init_timer(&(new_smi->si_timer)); - new_smi->si_timer.data = (long) new_smi; - new_smi->si_timer.function = smi_timeout; - new_smi->last_timeout_jiffies = jiffies; - new_smi->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; - add_timer(&(new_smi->si_timer)); - *smi = new_smi; printk(" IPMI %s interface initialized\n", si_type[intf_num]); return 0; + out_err_stop_timer: + new_smi->stop_operation = 1; + + /* Wait for the timer to stop. This avoids problems with race + conditions removing the timer here. */ + while (!new_smi->timer_stopped) { + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(1); + } + out_err: if (new_smi->intf) ipmi_unregister_smi(new_smi->intf); new_smi->irq_cleanup(new_smi); + + /* Wait until we know that we are out of any interrupt + handlers might have been running before we freed the + interrupt. */ + synchronize_kernel(); + if (new_smi->si_sm) { if (new_smi->handlers) new_smi->handlers->cleanup(new_smi->si_sm); kfree(new_smi->si_sm); } new_smi->io_cleanup(new_smi); + return rv; } diff --git a/drivers/char/ipmi/ipmi_smic_sm.c b/drivers/char/ipmi/ipmi_smic_sm.c index 7bd7041e3..b5c08d6e0 100644 --- a/drivers/char/ipmi/ipmi_smic_sm.c +++ b/drivers/char/ipmi/ipmi_smic_sm.c @@ -46,7 +46,7 @@ #include /* for completion codes */ #include "ipmi_si_sm.h" -#define IPMI_SMIC_VERSION "v31" +#define IPMI_SMIC_VERSION "v32" /* smic_debug is a bit-field * SMIC_DEBUG_ENABLE - turned on for now diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 50aa9590b..2d201d025 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -51,7 +51,7 @@ #include #endif -#define IPMI_WATCHDOG_VERSION "v31" +#define IPMI_WATCHDOG_VERSION "v32" /* * The IPMI command/response information for the watchdog timer. @@ -515,40 +515,37 @@ static struct watchdog_info ident= static int ipmi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; int i; int val; switch(cmd) { case WDIOC_GETSUPPORT: - i = copy_to_user((void*)arg, &ident, sizeof(ident)); + i = copy_to_user(argp, &ident, sizeof(ident)); return i ? -EFAULT : 0; case WDIOC_SETTIMEOUT: - i = copy_from_user(&val, (void *) arg, sizeof(int)); + i = copy_from_user(&val, argp, sizeof(int)); if (i) return -EFAULT; timeout = val; return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); case WDIOC_GETTIMEOUT: - i = copy_to_user((void *) arg, - &timeout, - sizeof(timeout)); + i = copy_to_user(argp, &timeout, sizeof(timeout)); if (i) return -EFAULT; return 0; case WDIOC_SET_PRETIMEOUT: - i = copy_from_user(&val, (void *) arg, sizeof(int)); + i = copy_from_user(&val, argp, sizeof(int)); if (i) return -EFAULT; pretimeout = val; return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); case WDIOC_GET_PRETIMEOUT: - i = copy_to_user((void *) arg, - &pretimeout, - sizeof(pretimeout)); + i = copy_to_user(argp, &pretimeout, sizeof(pretimeout)); if (i) return -EFAULT; return 0; @@ -557,7 +554,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file, return ipmi_heartbeat(); case WDIOC_SETOPTIONS: - i = copy_from_user(&val, (void *) arg, sizeof(int)); + i = copy_from_user(&val, argp, sizeof(int)); if (i) return -EFAULT; if (val & WDIOS_DISABLECARD) @@ -576,7 +573,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file, case WDIOC_GETSTATUS: val = 0; - i = copy_to_user((void *) arg, &val, sizeof(val)); + i = copy_to_user(argp, &val, sizeof(val)); if (i) return -EFAULT; return 0; @@ -587,7 +584,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file, } static ssize_t ipmi_write(struct file *file, - const char *buf, + const char __user *buf, size_t len, loff_t *ppos) { @@ -607,7 +604,7 @@ static ssize_t ipmi_write(struct file *file, } static ssize_t ipmi_read(struct file *file, - char *buf, + char __user *buf, size_t count, loff_t *ppos) { @@ -883,14 +880,12 @@ static int wdog_panic_handler(struct notifier_block *this, /* On a panic, if we have a panic timeout, make sure that the thing reboots, even if it hangs during that panic. */ - if (watchdog_user && !panic_event_handled && (panic_timeout > 0)) { + if (watchdog_user && !panic_event_handled) { /* Make sure the panic doesn't hang, and make sure we do this only once. */ panic_event_handled = 1; - timeout = panic_timeout + 120; - if (timeout > 255) - timeout = 255; + timeout = 255; pretimeout = 0; ipmi_watchdog_state = WDOG_TIMEOUT_RESET; panic_halt_ipmi_set_timeout(); diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 1a5a2df1b..ca512ad03 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -851,7 +851,7 @@ static void __exit istallion_module_exit(void) i = tty_unregister_driver(stli_serial); if (i) { printk("STALLION: failed to un-register tty driver, " - "errno=%d,%d\n", -i); + "errno=%d\n", -i); restore_flags(flags); return; } diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 010bff6e1..b703f5f2c 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -52,13 +52,12 @@ extern void ctrl_alt_del(void); /* * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on. - * This seems a good reason to start with NumLock off. On PC9800 and HIL keyboards + * This seems a good reason to start with NumLock off. On HIL keyboards * of PARISC machines however there is no NumLock key and everyone expects the keypad * to be used for numbers. */ -#if defined(CONFIG_X86_PC9800) || \ - defined(CONFIG_PARISC) && (defined(CONFIG_KEYBOARD_HIL) || defined(CONFIG_KEYBOARD_HIL_OLD)) +#if defined(CONFIG_PARISC) && (defined(CONFIG_KEYBOARD_HIL) || defined(CONFIG_KEYBOARD_HIL_OLD)) #define KBD_DEFLEDS (1 << VC_NUMLOCK) #else #define KBD_DEFLEDS 0 diff --git a/drivers/char/lp.c b/drivers/char/lp.c index a1c9cd056..945a25819 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -291,7 +291,7 @@ static int lp_wait_ready(int minor, int nonblock) return error; } -static ssize_t lp_write(struct file * file, const char * buf, +static ssize_t lp_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); @@ -407,7 +407,7 @@ static ssize_t lp_write(struct file * file, const char * buf, #ifdef CONFIG_PARPORT_1284 /* Status readback conforming to ieee1284 */ -static ssize_t lp_read(struct file * file, char * buf, +static ssize_t lp_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { unsigned int minor=iminor(file->f_dentry->d_inode); @@ -560,6 +560,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, unsigned int minor = iminor(inode); int status; int retval = 0; + void __user *argp = (void __user *)arg; #ifdef LP_DEBUG printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); @@ -603,7 +604,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, return -EINVAL; break; case LPGETIRQ: - if (copy_to_user((int *) arg, &LP_IRQ(minor), + if (copy_to_user(argp, &LP_IRQ(minor), sizeof(int))) return -EFAULT; break; @@ -612,7 +613,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, status = r_str(minor); lp_release_parport (&lp_table[minor]); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPRESET: @@ -620,7 +621,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, break; #ifdef LP_STATS case LPGETSTATS: - if (copy_to_user((int *) arg, &LP_STAT(minor), + if (copy_to_user(argp, &LP_STAT(minor), sizeof(struct lp_stats))) return -EFAULT; if (capable(CAP_SYS_ADMIN)) @@ -630,13 +631,12 @@ static int lp_ioctl(struct inode *inode, struct file *file, #endif case LPGETFLAGS: status = LP_F(minor); - if (copy_to_user((int *) arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; break; case LPSETTIMEOUT: - if (copy_from_user (&par_timeout, - (struct timeval *) arg, + if (copy_from_user (&par_timeout, argp, sizeof (struct timeval))) { return -EFAULT; } diff --git a/drivers/char/mem.c b/drivers/char/mem.c index d0b4d4d0f..82ab4365c 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -26,7 +26,6 @@ #include #include -#include #ifdef CONFIG_IA64 # include diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c index 0fb356e98..8832ed21d 100644 --- a/drivers/char/mwave/3780i.c +++ b/drivers/char/mwave/3780i.c @@ -467,10 +467,10 @@ int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings) } -int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr) { - unsigned short *pusBuffer = pvBuffer; + unsigned short __user *pusBuffer = pvBuffer; unsigned short val; @@ -508,10 +508,10 @@ int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void *pvBuffer, } int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO, - void *pvBuffer, unsigned uCount, + void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr) { - unsigned short *pusBuffer = pvBuffer; + unsigned short __user *pusBuffer = pvBuffer; unsigned short val; @@ -549,10 +549,10 @@ int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO, } -int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr) { - unsigned short *pusBuffer = pvBuffer; + unsigned short __user *pusBuffer = pvBuffer; PRINTK_5(TRACE_3780I, @@ -590,10 +590,10 @@ int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void *pvBuffer, } -int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr) { - unsigned short *pusBuffer = pvBuffer; + unsigned short __user *pusBuffer = pvBuffer; PRINTK_5(TRACE_3780I, "3780i::dsp3780I_ReadIStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n", @@ -637,10 +637,10 @@ int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void *pvBuffer, } -int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr) { - unsigned short *pusBuffer = pvBuffer; + unsigned short __user *pusBuffer = pvBuffer; PRINTK_5(TRACE_3780I, "3780i::dsp3780I_WriteIStore entry usDspBaseIO %x, pusBuffer %p, uCount %x, ulDSPAddr %lx\n", diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h index 863289096..3e7d020d1 100644 --- a/drivers/char/mwave/3780i.h +++ b/drivers/char/mwave/3780i.h @@ -323,16 +323,16 @@ int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings, int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings); int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings); int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings); -int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr); int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO, - void *pvBuffer, unsigned uCount, + void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr); -int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr); -int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr); -int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void *pvBuffer, +int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer, unsigned uCount, unsigned long ulDSPAddr); unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO, unsigned long ulMsaAddr); diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index f2365385c..7f54c84fd 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c @@ -121,6 +121,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file, { unsigned int retval = 0; pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd; + void __user *arg = (void __user *)ioarg; PRINTK_5(TRACE_MWAVE, "mwavedd::mwave_ioctl, entry inode %x file %x cmd %x arg %x\n", @@ -164,8 +165,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file, " retval %x from tp3780I_QueryAbilities\n", retval); if (retval == 0) { - if( copy_to_user((char *) ioarg, - (char *) &rAbilities, + if( copy_to_user(arg, &rAbilities, sizeof(MW_ABILITIES)) ) return -EFAULT; } @@ -179,13 +179,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file, case IOCTL_MW_READ_DATA: case IOCTL_MW_READCLEAR_DATA: { MW_READWRITE rReadData; - unsigned short *pusBuffer = 0; + unsigned short __user *pusBuffer = 0; - if( copy_from_user((char *) &rReadData, - (char *) ioarg, + if( copy_from_user(&rReadData, arg, sizeof(MW_READWRITE)) ) return -EFAULT; - pusBuffer = (unsigned short *) (rReadData.pBuf); + pusBuffer = (unsigned short __user *) (rReadData.pBuf); PRINTK_4(TRACE_MWAVE, "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA," @@ -193,7 +192,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file, rReadData.ulDataLength, ioarg, pusBuffer); retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, iocmd, - (void *) pusBuffer, + pusBuffer, rReadData.ulDataLength, rReadData.usDspAddress); } @@ -201,12 +200,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file, case IOCTL_MW_READ_INST: { MW_READWRITE rReadData; - unsigned short *pusBuffer = 0; + unsigned short __user *pusBuffer = 0; - if( copy_from_user((char *) &rReadData, (char *) ioarg, + if( copy_from_user(&rReadData, arg, sizeof(MW_READWRITE)) ) return -EFAULT; - pusBuffer = (unsigned short *) (rReadData.pBuf); + pusBuffer = (unsigned short __user *) (rReadData.pBuf); PRINTK_4(TRACE_MWAVE, "mwavedd::mwave_ioctl IOCTL_MW_READ_INST," @@ -222,13 +221,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file, case IOCTL_MW_WRITE_DATA: { MW_READWRITE rWriteData; - unsigned short *pusBuffer = 0; + unsigned short __user *pusBuffer = 0; - if( copy_from_user((char *) &rWriteData, - (char *) ioarg, + if( copy_from_user(&rWriteData, arg, sizeof(MW_READWRITE)) ) return -EFAULT; - pusBuffer = (unsigned short *) (rWriteData.pBuf); + pusBuffer = (unsigned short __user *) (rWriteData.pBuf); PRINTK_4(TRACE_MWAVE, "mwavedd::mwave_ioctl IOCTL_MW_WRITE_DATA," @@ -244,13 +242,12 @@ static int mwave_ioctl(struct inode *inode, struct file *file, case IOCTL_MW_WRITE_INST: { MW_READWRITE rWriteData; - unsigned short *pusBuffer = 0; + unsigned short __user *pusBuffer = 0; - if( copy_from_user((char *) &rWriteData, - (char *) ioarg, + if( copy_from_user(&rWriteData, arg, sizeof(MW_READWRITE)) ) return -EFAULT; - pusBuffer = (unsigned short *) (rWriteData.pBuf); + pusBuffer = (unsigned short __user *)(rWriteData.pBuf); PRINTK_4(TRACE_MWAVE, "mwavedd::mwave_ioctl IOCTL_MW_WRITE_INST," @@ -388,7 +385,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file, } -static ssize_t mwave_read(struct file *file, char *buf, size_t count, +static ssize_t mwave_read(struct file *file, char __user *buf, size_t count, loff_t * ppos) { PRINTK_5(TRACE_MWAVE, @@ -399,7 +396,7 @@ static ssize_t mwave_read(struct file *file, char *buf, size_t count, } -static ssize_t mwave_write(struct file *file, const char *buf, +static ssize_t mwave_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { PRINTK_5(TRACE_MWAVE, diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c index 373173de5..c830fc672 100644 --- a/drivers/char/mwave/tp3780i.c +++ b/drivers/char/mwave/tp3780i.c @@ -522,7 +522,7 @@ int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * pAbilities } int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, - void *pvBuffer, unsigned int uCount, + void __user *pvBuffer, unsigned int uCount, unsigned long ulDSPAddr) { int retval = 0; @@ -558,7 +558,7 @@ int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, int tp3780I_ReadWriteDspIStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, - void *pvBuffer, unsigned int uCount, + void __user *pvBuffer, unsigned int uCount, unsigned long ulDSPAddr) { int retval = 0; diff --git a/drivers/char/mwave/tp3780i.h b/drivers/char/mwave/tp3780i.h index fc049acc8..07685b685 100644 --- a/drivers/char/mwave/tp3780i.h +++ b/drivers/char/mwave/tp3780i.h @@ -93,10 +93,10 @@ int tp3780I_StartDSP(THINKPAD_BD_DATA * pBDData); int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * pAbilities); int tp3780I_Cleanup(THINKPAD_BD_DATA * pBDData); int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, - void *pvBuffer, unsigned int uCount, + void __user *pvBuffer, unsigned int uCount, unsigned long ulDSPAddr); int tp3780I_ReadWriteDspIStore(THINKPAD_BD_DATA * pBDData, unsigned int uOpcode, - void *pvBuffer, unsigned int uCount, + void __user *pvBuffer, unsigned int uCount, unsigned long ulDSPAddr); diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 7b6ee59ed..b5f32d65e 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -250,7 +250,7 @@ static loff_t nvram_llseek(struct file *file,loff_t offset, int origin ) } static ssize_t -nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) +nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; @@ -279,7 +279,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos) } static ssize_t -nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { unsigned char contents[NVRAM_BYTES]; unsigned i = *ppos; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index fb87f872f..970e2331a 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -1,7 +1,7 @@ /* * linux/drivers/char/pcmcia/synclink_cs.c * - * $Id: synclink_cs.c,v 4.21 2004/03/08 15:29:23 paulkf Exp $ + * $Id: synclink_cs.c,v 4.22 2004/06/01 20:27:46 paulkf Exp $ * * Device driver for Microgate SyncLink PC Card * multiprotocol serial adapter. @@ -438,15 +438,15 @@ static void bh_status(MGSLPC_INFO *info); static int tiocmget(struct tty_struct *tty, struct file *file); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); -static int get_stats(MGSLPC_INFO *info, struct mgsl_icount *user_icount); -static int get_params(MGSLPC_INFO *info, MGSL_PARAMS *user_params); -static int set_params(MGSLPC_INFO *info, MGSL_PARAMS *new_params); -static int get_txidle(MGSLPC_INFO *info, int*idle_mode); +static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount); +static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params); +static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params); +static int get_txidle(MGSLPC_INFO *info, int __user *idle_mode); static int set_txidle(MGSLPC_INFO *info, int idle_mode); static int set_txenable(MGSLPC_INFO *info, int enable); static int tx_abort(MGSLPC_INFO *info); static int set_rxenable(MGSLPC_INFO *info, int enable); -static int wait_events(MGSLPC_INFO *info, int *mask); +static int wait_events(MGSLPC_INFO *info, int __user *mask); #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1) @@ -489,7 +489,7 @@ MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i"); MODULE_LICENSE("GPL"); static char *driver_name = "SyncLink PC Card driver"; -static char *driver_version = "$Revision: 4.21 $"; +static char *driver_version = "$Revision: 4.22 $"; static struct tty_driver *serial_driver; @@ -521,8 +521,10 @@ static dev_link_t *dev_list = NULL; * (gdb) to get the .text address for the add-symbol-file command. * This allows remote debugging of dynamically loadable modules. */ -static void* mgslpc_get_text_ptr(void); -static void* mgslpc_get_text_ptr() {return mgslpc_get_text_ptr;} +static void* mgslpc_get_text_ptr(void) +{ + return mgslpc_get_text_ptr; +} static dev_link_t *mgslpc_attach(void) { @@ -1955,7 +1957,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty) /* get the current serial statistics */ -static int get_stats(MGSLPC_INFO * info, struct mgsl_icount *user_icount) +static int get_stats(MGSLPC_INFO * info, struct mgsl_icount __user *user_icount) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -1968,7 +1970,7 @@ static int get_stats(MGSLPC_INFO * info, struct mgsl_icount *user_icount) /* get the current serial parameters */ -static int get_params(MGSLPC_INFO * info, MGSL_PARAMS *user_params) +static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -1988,7 +1990,7 @@ static int get_params(MGSLPC_INFO * info, MGSL_PARAMS *user_params) * * Returns: 0 if success, otherwise error code */ -static int set_params(MGSLPC_INFO * info, MGSL_PARAMS *new_params) +static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params) { unsigned long flags; MGSL_PARAMS tmp_params; @@ -2014,7 +2016,7 @@ static int set_params(MGSLPC_INFO * info, MGSL_PARAMS *new_params) return 0; } -static int get_txidle(MGSLPC_INFO * info, int*idle_mode) +static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2037,7 +2039,7 @@ static int set_txidle(MGSLPC_INFO * info, int idle_mode) return 0; } -static int get_interface(MGSLPC_INFO * info, int*if_mode) +static int get_interface(MGSLPC_INFO * info, int __user *if_mode) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2136,7 +2138,7 @@ static int set_rxenable(MGSLPC_INFO * info, int enable) * of events triggerred, * otherwise error code */ -static int wait_events(MGSLPC_INFO * info, int * mask_ptr) +static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) { unsigned long flags; int s; @@ -2409,20 +2411,21 @@ int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg) { int error; struct mgsl_icount cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; /* user space */ + void __user *argp = (void __user *)arg; unsigned long flags; switch (cmd) { case MGSL_IOCGPARAMS: - return get_params(info,(MGSL_PARAMS *)arg); + return get_params(info, argp); case MGSL_IOCSPARAMS: - return set_params(info,(MGSL_PARAMS *)arg); + return set_params(info, argp); case MGSL_IOCGTXIDLE: - return get_txidle(info,(int*)arg); + return get_txidle(info, argp); case MGSL_IOCSTXIDLE: - return set_txidle(info,(int)arg); + return set_txidle(info, (int)arg); case MGSL_IOCGIF: - return get_interface(info,(int*)arg); + return get_interface(info, argp); case MGSL_IOCSIF: return set_interface(info,(int)arg); case MGSL_IOCTXENABLE: @@ -2432,16 +2435,16 @@ int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg) case MGSL_IOCTXABORT: return tx_abort(info); case MGSL_IOCGSTATS: - return get_stats(info,(struct mgsl_icount*)arg); + return get_stats(info, argp); case MGSL_IOCWAITEVENT: - return wait_events(info,(int*)arg); + return wait_events(info, argp); case TIOCMIWAIT: return modem_input_wait(info,(int)arg); case TIOCGICOUNT: spin_lock_irqsave(&info->lock,flags); cnow = info->icount; spin_unlock_irqrestore(&info->lock,flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; PUT_USER(error,cnow.cts, &p_cuser->cts); if (error) return error; PUT_USER(error,cnow.dsr, &p_cuser->dsr); @@ -3130,9 +3133,35 @@ static struct tty_operations mgslpc_ops = { .tiocmset = tiocmset, }; +static void synclink_cs_cleanup(void) +{ + int rc; + + printk("Unloading %s: version %s\n", driver_name, driver_version); + + while(mgslpc_device_list) + mgslpc_remove_device(mgslpc_device_list); + + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } + + pcmcia_unregister_driver(&mgslpc_driver); + + /* XXX: this really needs to move into generic code.. */ + while (dev_list != NULL) { + if (dev_list->state & DEV_CONFIG) + mgslpc_release((u_long)dev_list); + mgslpc_detach(dev_list); + } +} + static int __init synclink_cs_init(void) { - int error; + int rc; if (break_on_load) { mgslpc_get_text_ptr(); @@ -3141,14 +3170,13 @@ static int __init synclink_cs_init(void) printk("%s %s\n", driver_name, driver_version); - serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT); - if (!serial_driver) - return -ENOMEM; + if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0) + return rc; - error = pcmcia_register_driver(&mgslpc_driver); - if (error) { - put_tty_driver(serial_driver); - return error; + serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT); + if (!serial_driver) { + rc = -ENOMEM; + goto error; } /* Initialize the tty_driver structure */ @@ -3166,39 +3194,28 @@ static int __init synclink_cs_init(void) serial_driver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(serial_driver, &mgslpc_ops); - if (tty_register_driver(serial_driver) < 0) + if ((rc = tty_register_driver(serial_driver)) < 0) { printk("%s(%d):Couldn't register serial driver\n", __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + goto error; + } printk("%s %s, tty major#%d\n", driver_name, driver_version, serial_driver->major); return 0; + +error: + synclink_cs_cleanup(); + return rc; } static void __exit synclink_cs_exit(void) { - int rc; - - printk("Unloading %s: version %s\n", driver_name, driver_version); - - while(mgslpc_device_list) - mgslpc_remove_device(mgslpc_device_list); - - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); - put_tty_driver(serial_driver); - - pcmcia_unregister_driver(&mgslpc_driver); - - /* XXX: this really needs to move into generic code.. */ - while (dev_list != NULL) { - if (dev_list->state & DEV_CONFIG) - mgslpc_release((u_long)dev_list); - mgslpc_detach(dev_list); - } + synclink_cs_cleanup(); } module_init(synclink_cs_init); diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 56ae1f09d..5eda075c6 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -103,7 +103,7 @@ static inline void pp_enable_irq (struct pp_struct *pp) port->ops->enable_irq (port); } -static ssize_t pp_read (struct file * file, char * buf, size_t count, +static ssize_t pp_read (struct file * file, char __user * buf, size_t count, loff_t * ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); @@ -186,8 +186,8 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count, return bytes_read; } -static ssize_t pp_write (struct file * file, const char * buf, size_t count, - loff_t * ppos) +static ssize_t pp_write (struct file * file, const char __user * buf, + size_t count, loff_t * ppos) { unsigned int minor = iminor(file->f_dentry->d_inode); struct pp_struct *pp = file->private_data; @@ -335,6 +335,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, unsigned int minor = iminor(inode); struct pp_struct *pp = file->private_data; struct parport * port; + void __user *argp = (void __user *)arg; /* First handle the cases that don't take arguments. */ switch (cmd) { @@ -396,7 +397,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, case PPSETMODE: { int mode; - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; /* FIXME: validate mode */ pp->state.mode = mode; @@ -418,7 +419,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, } else { mode = pp->state.mode; } - if (copy_to_user ((int *)arg, &mode, sizeof (mode))) { + if (copy_to_user (argp, &mode, sizeof (mode))) { return -EFAULT; } return 0; @@ -426,7 +427,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, case PPSETPHASE: { int phase; - if (copy_from_user (&phase, (int *) arg, sizeof (phase))) { + if (copy_from_user (&phase, argp, sizeof (phase))) { return -EFAULT; } /* FIXME: validate phase */ @@ -447,7 +448,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, } else { phase = pp->state.phase; } - if (copy_to_user ((int *)arg, &phase, sizeof (phase))) { + if (copy_to_user (argp, &phase, sizeof (phase))) { return -EFAULT; } return 0; @@ -461,7 +462,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, return -ENODEV; modes = port->modes; - if (copy_to_user ((unsigned int *)arg, &modes, sizeof (modes))) { + if (copy_to_user (argp, &modes, sizeof (modes))) { return -EFAULT; } return 0; @@ -470,7 +471,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, { int uflags; - if (copy_from_user (&uflags, (int *)arg, sizeof (uflags))) { + if (copy_from_user (&uflags, argp, sizeof (uflags))) { return -EFAULT; } pp->flags &= ~PP_FLAGMASK; @@ -482,7 +483,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, int uflags; uflags = pp->flags & PP_FLAGMASK; - if (copy_to_user ((int *)arg, &uflags, sizeof (uflags))) { + if (copy_to_user (argp, &uflags, sizeof (uflags))) { return -EFAULT; } return 0; @@ -509,17 +510,17 @@ static int pp_ioctl(struct inode *inode, struct file *file, case PPRSTATUS: reg = parport_read_status (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPRDATA: reg = parport_read_data (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPRCONTROL: reg = parport_read_control (port); - if (copy_to_user ((unsigned char *) arg, ®, sizeof (reg))) + if (copy_to_user (argp, ®, sizeof (reg))) return -EFAULT; return 0; case PPYIELD: @@ -538,29 +539,29 @@ static int pp_ioctl(struct inode *inode, struct file *file, return 0; case PPWCONTROL: - if (copy_from_user (®, (unsigned char *) arg, sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; parport_write_control (port, reg); return 0; case PPWDATA: - if (copy_from_user (®, (unsigned char *) arg, sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; parport_write_data (port, reg); return 0; case PPFCONTROL: - if (copy_from_user (&mask, (unsigned char *) arg, + if (copy_from_user (&mask, argp, sizeof (mask))) return -EFAULT; - if (copy_from_user (®, 1 + (unsigned char *) arg, + if (copy_from_user (®, 1 + (unsigned char __user *) arg, sizeof (reg))) return -EFAULT; parport_frob_control (port, mask, reg); return 0; case PPDATADIR: - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; if (mode) port->ops->data_reverse (port); @@ -569,7 +570,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, return 0; case PPNEGOT: - if (copy_from_user (&mode, (int *) arg, sizeof (mode))) + if (copy_from_user (&mode, argp, sizeof (mode))) return -EFAULT; switch ((ret = parport_negotiate (port, mode))) { case 0: break; @@ -584,8 +585,7 @@ static int pp_ioctl(struct inode *inode, struct file *file, return ret; case PPWCTLONIRQ: - if (copy_from_user (®, (unsigned char *) arg, - sizeof (reg))) + if (copy_from_user (®, argp, sizeof (reg))) return -EFAULT; /* Remember what to set the control lines to, for next @@ -596,14 +596,13 @@ static int pp_ioctl(struct inode *inode, struct file *file, case PPCLRIRQ: ret = atomic_read (&pp->irqc); - if (copy_to_user ((int *) arg, &ret, sizeof (ret))) + if (copy_to_user (argp, &ret, sizeof (ret))) return -EFAULT; atomic_sub (ret, &pp->irqc); return 0; case PPSETTIME: - if (copy_from_user (&par_timeout, (struct timeval *)arg, - sizeof(struct timeval))) { + if (copy_from_user (&par_timeout, argp, sizeof(struct timeval))) { return -EFAULT; } /* Convert to jiffies, place in pp->pdev->timeout */ @@ -622,10 +621,8 @@ static int pp_ioctl(struct inode *inode, struct file *file, to_jiffies = pp->pdev->timeout; par_timeout.tv_sec = to_jiffies / HZ; par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ); - if (copy_to_user ((struct timeval *)arg, &par_timeout, - sizeof(struct timeval))) { + if (copy_to_user (argp, &par_timeout, sizeof(struct timeval))) return -EFAULT; - } return 0; default: diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 03b4f2097..641fe5e8a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -97,6 +97,11 @@ static unsigned long rtc_port; static int rtc_irq = PCI_IRQ_NONE; #endif +#ifdef CONFIG_HPET_RTC_IRQ +#undef RTC_IRQ +#define RTC_IRQ 0 +#endif + #ifdef RTC_IRQ static int rtc_has_irq = 1; #endif diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 3758fb1b1..e937346e1 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c @@ -26,7 +26,7 @@ static int major = 0; /* default to dynamic major */ MODULE_PARM(major, "i"); MODULE_PARM_DESC(major, "Major device number"); -static ssize_t scx200_gpio_write(struct file *file, const char *data, +static ssize_t scx200_gpio_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); @@ -77,7 +77,7 @@ static ssize_t scx200_gpio_write(struct file *file, const char *data, return len; } -static ssize_t scx200_gpio_read(struct file *file, char *buf, +static ssize_t scx200_gpio_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) { unsigned m = iminor(file->f_dentry->d_inode); diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a3780cdef..a906dfad2 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -461,8 +461,9 @@ static int sonypi_misc_open(struct inode * inode, struct file * file) { return 0; } -static ssize_t sonypi_misc_read(struct file * file, char * buf, - size_t count, loff_t *pos) { +static ssize_t sonypi_misc_read(struct file * file, char __user * buf, + size_t count, loff_t *pos) +{ DECLARE_WAITQUEUE(wait, current); ssize_t i = count; unsigned char c; @@ -504,6 +505,7 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table * wait) { static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { int ret = 0; + void __user *argp = (void __user *)arg; u8 val8; u16 val16; @@ -514,11 +516,11 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCSBRT: - if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { + if (copy_from_user(&val8, argp, sizeof(val8))) { ret = -EFAULT; break; } @@ -530,7 +532,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT1REM: @@ -538,7 +540,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT2CAP: @@ -546,7 +548,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBAT2REM: @@ -554,7 +556,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user((u16 *)arg, &val16, sizeof(val16))) + if (copy_to_user(argp, &val16, sizeof(val16))) ret = -EFAULT; break; case SONYPI_IOCGBATFLAGS: @@ -563,16 +565,16 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, break; } val8 &= 0x07; - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCGBLUE: val8 = sonypi_device.bluetooth_power; - if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) + if (copy_to_user(argp, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCSBLUE: - if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { + if (copy_from_user(&val8, argp, sizeof(val8))) { ret = -EFAULT; break; } diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index deefd713a..89f04b737 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -1,7 +1,7 @@ /* * linux/drivers/char/synclink.c * - * $Id: synclink.c,v 4.21 2004/03/08 15:29:22 paulkf Exp $ + * $Id: synclink.c,v 4.24 2004/06/03 14:50:09 paulkf Exp $ * * Device driver for Microgate SyncLink ISA and PCI * high speed multiprotocol serial adapters. @@ -782,7 +782,6 @@ int mgsl_claim_resources(struct mgsl_struct *info); void mgsl_release_resources(struct mgsl_struct *info); void mgsl_add_device(struct mgsl_struct *info); struct mgsl_struct* mgsl_allocate_device(void); -int mgsl_enum_isa_devices(void); /* * DMA buffer manupulation functions. @@ -853,19 +852,22 @@ static int tiocmget(struct tty_struct *tty, struct file *file); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount - *user_icount); -static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params); -static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params); -static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode); + __user *user_icount); +static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params); +static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params); +static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode); static int mgsl_set_txidle(struct mgsl_struct * info, int idle_mode); static int mgsl_txenable(struct mgsl_struct * info, int enable); static int mgsl_txabort(struct mgsl_struct * info); static int mgsl_rxenable(struct mgsl_struct * info, int enable); -static int mgsl_wait_event(struct mgsl_struct * info, int * mask); +static int mgsl_wait_event(struct mgsl_struct * info, int __user *mask); static int mgsl_loopmode_send_done( struct mgsl_struct * info ); #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1) +/* set non-zero on successful registration with PCI subsystem */ +static int pci_registered; + /* * Global linked list of SyncLink devices */ @@ -909,7 +911,7 @@ MODULE_PARM(txdmabufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); static char *driver_name = "SyncLink serial driver"; -static char *driver_version = "$Revision: 4.21 $"; +static char *driver_version = "$Revision: 4.24 $"; static int synclink_init_one (struct pci_dev *dev, const struct pci_device_id *ent); @@ -950,8 +952,10 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout); * (gdb) to get the .text address for the add-symbol-file command. * This allows remote debugging of dynamically loadable modules. */ -void* mgsl_get_text_ptr(void); -void* mgsl_get_text_ptr() {return mgsl_get_text_ptr;} +void* mgsl_get_text_ptr(void) +{ + return mgsl_get_text_ptr; +} /* * tmp_buf is used as a temporary buffer by mgsl_write. We need to @@ -2521,7 +2525,7 @@ static void mgsl_unthrottle(struct tty_struct * tty) * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount *user_icount) +static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount __user *user_icount) { int err; @@ -2550,7 +2554,7 @@ static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount *user_ic * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params) +static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2580,7 +2584,7 @@ static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params) * * Return Value: 0 if success, otherwise error code */ -static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params) +static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params) { unsigned long flags; MGSL_PARAMS tmp_params; @@ -2616,7 +2620,7 @@ static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params) * * Return Value: 0 if success, otherwise error code */ -static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode) +static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode) { int err; @@ -2763,7 +2767,7 @@ static int mgsl_rxenable(struct mgsl_struct * info, int enable) * of events triggerred, * otherwise error code */ -static int mgsl_wait_event(struct mgsl_struct * info, int * mask_ptr) +static int mgsl_wait_event(struct mgsl_struct * info, int __user * mask_ptr) { unsigned long flags; int s; @@ -3051,16 +3055,17 @@ int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long { int error; struct mgsl_icount cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + void __user *argp = (void __user *)arg; + struct serial_icounter_struct __user *p_cuser; /* user space */ unsigned long flags; switch (cmd) { case MGSL_IOCGPARAMS: - return mgsl_get_params(info,(MGSL_PARAMS *)arg); + return mgsl_get_params(info, argp); case MGSL_IOCSPARAMS: - return mgsl_set_params(info,(MGSL_PARAMS *)arg); + return mgsl_set_params(info, argp); case MGSL_IOCGTXIDLE: - return mgsl_get_txidle(info,(int*)arg); + return mgsl_get_txidle(info, argp); case MGSL_IOCSTXIDLE: return mgsl_set_txidle(info,(int)arg); case MGSL_IOCTXENABLE: @@ -3070,9 +3075,9 @@ int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long case MGSL_IOCTXABORT: return mgsl_txabort(info); case MGSL_IOCGSTATS: - return mgsl_get_stats(info,(struct mgsl_icount*)arg); + return mgsl_get_stats(info, argp); case MGSL_IOCWAITEVENT: - return mgsl_wait_event(info,(int*)arg); + return mgsl_wait_event(info, argp); case MGSL_IOCLOOPTXDONE: return mgsl_loopmode_send_done(info); /* Wait for modem input (DCD,RI,DSR,CTS) change @@ -3091,7 +3096,7 @@ int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long spin_lock_irqsave(&info->irq_spinlock,flags); cnow = info->icount; spin_unlock_irqrestore(&info->irq_spinlock,flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; PUT_USER(error,cnow.cts, &p_cuser->cts); if (error) return error; PUT_USER(error,cnow.dsr, &p_cuser->dsr); @@ -4425,7 +4430,7 @@ void mgsl_add_device( struct mgsl_struct *info ) * Arguments: none * Return Value: pointer to mgsl_struct if success, otherwise NULL */ -struct mgsl_struct* mgsl_allocate_device() +struct mgsl_struct* mgsl_allocate_device(void) { struct mgsl_struct *info; @@ -4484,10 +4489,11 @@ static struct tty_operations mgsl_ops = { /* * perform tty device initialization */ -int mgsl_init_tty(void); -int mgsl_init_tty() +static int mgsl_init_tty(void) { - serial_driver = alloc_tty_driver(mgsl_device_count); + int rc; + + serial_driver = alloc_tty_driver(128); if (!serial_driver) return -ENOMEM; @@ -4503,9 +4509,13 @@ int mgsl_init_tty() B9600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(serial_driver, &mgsl_ops); - if (tty_register_driver(serial_driver) < 0) + if ((rc = tty_register_driver(serial_driver)) < 0) { printk("%s(%d):Couldn't register serial driver\n", __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + return rc; + } printk("%s %s, tty major#%d\n", driver_name, driver_version, @@ -4515,7 +4525,7 @@ int mgsl_init_tty() /* enumerate user specified ISA adapters */ -int mgsl_enum_isa_devices() +static void mgsl_enum_isa_devices(void) { struct mgsl_struct *info; int i; @@ -4546,51 +4556,9 @@ int mgsl_enum_isa_devices() mgsl_add_device( info ); } - - return 0; } -/* mgsl_init() - * - * Driver initialization entry point. - * - * Arguments: None - * Return Value: 0 if success, otherwise error code - */ -int __init mgsl_init(void) -{ - int rc; - - printk("%s %s\n", driver_name, driver_version); - - mgsl_enum_isa_devices(); - pci_register_driver(&synclink_pci_driver); - - if ( !mgsl_device_list ) { - printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__); - return -ENODEV; - } - if ((rc = mgsl_init_tty())) - return rc; - - return 0; -} - -static int __init synclink_init(void) -{ -/* Uncomment this to kernel debug module. - * mgsl_get_text_ptr() leaves the .text address in eax - * which can be used with add-symbol-file with gdb. - */ - if (break_on_load) { - mgsl_get_text_ptr(); - BREAKPOINT(); - } - - return mgsl_init(); -} - -static void __exit synclink_exit(void) +static void synclink_cleanup(void) { int rc; struct mgsl_struct *info; @@ -4598,11 +4566,13 @@ static void __exit synclink_exit(void) printk("Unloading %s: %s\n", driver_name, driver_version); - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } - put_tty_driver(serial_driver); info = mgsl_device_list; while(info) { #ifdef CONFIG_SYNCLINK_SYNCPPP @@ -4620,7 +4590,40 @@ static void __exit synclink_exit(void) tmp_buf = NULL; } - pci_unregister_driver(&synclink_pci_driver); + if (pci_registered) + pci_unregister_driver(&synclink_pci_driver); +} + +static int __init synclink_init(void) +{ + int rc; + + if (break_on_load) { + mgsl_get_text_ptr(); + BREAKPOINT(); + } + + printk("%s %s\n", driver_name, driver_version); + + mgsl_enum_isa_devices(); + if ((rc = pci_register_driver(&synclink_pci_driver)) < 0) + printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); + else + pci_registered = 1; + + if ((rc = mgsl_init_tty()) < 0) + goto error; + + return 0; + +error: + synclink_cleanup(); + return rc; +} + +static void __exit synclink_exit(void) +{ + synclink_cleanup(); } module_init(synclink_init); diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index d82335ed7..eec88152d 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -1,5 +1,5 @@ /* - * $Id: synclinkmp.c,v 4.19 2004/03/08 15:29:23 paulkf Exp $ + * $Id: synclinkmp.c,v 4.22 2004/06/03 14:50:10 paulkf Exp $ * * Device driver for Microgate SyncLink Multiport * high speed multiprotocol serial adapter. @@ -494,7 +494,7 @@ MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICES) "i"); MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i"); static char *driver_name = "SyncLink MultiPort driver"; -static char *driver_version = "$Revision: 4.19 $"; +static char *driver_version = "$Revision: 4.22 $"; static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent); static void synclinkmp_remove_one(struct pci_dev *dev); @@ -567,17 +567,17 @@ static struct net_device_stats *sppp_cb_net_stats(struct net_device *dev); /* ioctl handlers */ -static int get_stats(SLMP_INFO *info, struct mgsl_icount *user_icount); -static int get_params(SLMP_INFO *info, MGSL_PARAMS *params); -static int set_params(SLMP_INFO *info, MGSL_PARAMS *params); -static int get_txidle(SLMP_INFO *info, int*idle_mode); +static int get_stats(SLMP_INFO *info, struct mgsl_icount __user *user_icount); +static int get_params(SLMP_INFO *info, MGSL_PARAMS __user *params); +static int set_params(SLMP_INFO *info, MGSL_PARAMS __user *params); +static int get_txidle(SLMP_INFO *info, int __user *idle_mode); static int set_txidle(SLMP_INFO *info, int idle_mode); static int tx_enable(SLMP_INFO *info, int enable); static int tx_abort(SLMP_INFO *info); static int rx_enable(SLMP_INFO *info, int enable); static int map_status(int signals); static int modem_input_wait(SLMP_INFO *info,int arg); -static int wait_mgsl_event(SLMP_INFO *info, int *mask_ptr); +static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr); static int tiocmget(struct tty_struct *tty, struct file *file); static int tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); @@ -692,7 +692,7 @@ static u32 sca_pci_load_interval = 64; * This allows remote debugging of dynamically loadable modules. */ static void* synclinkmp_get_text_ptr(void); -static void* synclinkmp_get_text_ptr() {return synclinkmp_get_text_ptr;} +static void* synclinkmp_get_text_ptr(void) {return synclinkmp_get_text_ptr;} static inline int sanity_check(SLMP_INFO *info, char *name, const char *routine) @@ -1333,8 +1333,9 @@ static int ioctl(struct tty_struct *tty, struct file *file, SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; int error; struct mgsl_icount cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; /* user space */ unsigned long flags; + void __user *argp = (void __user *)arg; if (debug_level >= DEBUG_LEVEL_INFO) printk("%s(%d):%s ioctl() cmd=%08X\n", __FILE__,__LINE__, @@ -1351,23 +1352,23 @@ static int ioctl(struct tty_struct *tty, struct file *file, switch (cmd) { case MGSL_IOCGPARAMS: - return get_params(info,(MGSL_PARAMS *)arg); + return get_params(info, argp); case MGSL_IOCSPARAMS: - return set_params(info,(MGSL_PARAMS *)arg); + return set_params(info, argp); case MGSL_IOCGTXIDLE: - return get_txidle(info,(int*)arg); + return get_txidle(info, argp); case MGSL_IOCSTXIDLE: - return set_txidle(info,(int)arg); + return set_txidle(info, (int)arg); case MGSL_IOCTXENABLE: - return tx_enable(info,(int)arg); + return tx_enable(info, (int)arg); case MGSL_IOCRXENABLE: - return rx_enable(info,(int)arg); + return rx_enable(info, (int)arg); case MGSL_IOCTXABORT: return tx_abort(info); case MGSL_IOCGSTATS: - return get_stats(info,(struct mgsl_icount*)arg); + return get_stats(info, argp); case MGSL_IOCWAITEVENT: - return wait_mgsl_event(info,(int*)arg); + return wait_mgsl_event(info, argp); case MGSL_IOCLOOPTXDONE: return 0; // TODO: Not supported, need to document /* Wait for modem input (DCD,RI,DSR,CTS) change @@ -1386,7 +1387,7 @@ static int ioctl(struct tty_struct *tty, struct file *file, spin_lock_irqsave(&info->lock,flags); cnow = info->icount; spin_unlock_irqrestore(&info->lock,flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; PUT_USER(error,cnow.cts, &p_cuser->cts); if (error) return error; PUT_USER(error,cnow.dsr, &p_cuser->dsr); @@ -2762,7 +2763,7 @@ static void change_params(SLMP_INFO *info) program_hw(info); } -static int get_stats(SLMP_INFO * info, struct mgsl_icount *user_icount) +static int get_stats(SLMP_INFO * info, struct mgsl_icount __user *user_icount) { int err; @@ -2781,7 +2782,7 @@ static int get_stats(SLMP_INFO * info, struct mgsl_icount *user_icount) return 0; } -static int get_params(SLMP_INFO * info, MGSL_PARAMS *user_params) +static int get_params(SLMP_INFO * info, MGSL_PARAMS __user *user_params) { int err; if (debug_level >= DEBUG_LEVEL_INFO) @@ -2799,7 +2800,7 @@ static int get_params(SLMP_INFO * info, MGSL_PARAMS *user_params) return 0; } -static int set_params(SLMP_INFO * info, MGSL_PARAMS *new_params) +static int set_params(SLMP_INFO * info, MGSL_PARAMS __user *new_params) { unsigned long flags; MGSL_PARAMS tmp_params; @@ -2825,7 +2826,7 @@ static int set_params(SLMP_INFO * info, MGSL_PARAMS *new_params) return 0; } -static int get_txidle(SLMP_INFO * info, int*idle_mode) +static int get_txidle(SLMP_INFO * info, int __user *idle_mode) { int err; @@ -2938,7 +2939,7 @@ static int map_status(int signals) /* wait for specified event to occur */ -static int wait_mgsl_event(SLMP_INFO * info, int * mask_ptr) +static int wait_mgsl_event(SLMP_INFO * info, int __user *mask_ptr) { unsigned long flags; int s; @@ -3781,56 +3782,7 @@ static struct tty_operations ops = { .tiocmset = tiocmset, }; -/* Driver initialization entry point. - */ - -static int __init synclinkmp_init(void) -{ - if (break_on_load) { - synclinkmp_get_text_ptr(); - BREAKPOINT(); - } - - printk("%s %s\n", driver_name, driver_version); - - synclinkmp_adapter_count = -1; - pci_register_driver(&synclinkmp_pci_driver); - - if ( !synclinkmp_device_list ) { - printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__); - return -ENODEV; - } - - serial_driver = alloc_tty_driver(synclinkmp_device_count); - if (!serial_driver) - return -ENOMEM; - - /* Initialize the tty_driver structure */ - - serial_driver->owner = THIS_MODULE; - serial_driver->driver_name = "synclinkmp"; - serial_driver->name = "ttySLM"; - serial_driver->major = ttymajor; - serial_driver->minor_start = 64; - serial_driver->type = TTY_DRIVER_TYPE_SERIAL; - serial_driver->subtype = SERIAL_TYPE_NORMAL; - serial_driver->init_termios = tty_std_termios; - serial_driver->init_termios.c_cflag = - B9600 | CS8 | CREAD | HUPCL | CLOCAL; - serial_driver->flags = TTY_DRIVER_REAL_RAW; - tty_set_operations(serial_driver, &ops); - if (tty_register_driver(serial_driver) < 0) - printk("%s(%d):Couldn't register serial driver\n", - __FILE__,__LINE__); - - printk("%s %s, tty major#%d\n", - driver_name, driver_version, - serial_driver->major); - - return 0; -} - -static void __exit synclinkmp_exit(void) +static void synclinkmp_cleanup(void) { unsigned long flags; int rc; @@ -3839,10 +3791,12 @@ static void __exit synclinkmp_exit(void) printk("Unloading %s %s\n", driver_name, driver_version); - if ((rc = tty_unregister_driver(serial_driver))) - printk("%s(%d) failed to unregister tty driver err=%d\n", - __FILE__,__LINE__,rc); - put_tty_driver(serial_driver); + if (serial_driver) { + if ((rc = tty_unregister_driver(serial_driver))) + printk("%s(%d) failed to unregister tty driver err=%d\n", + __FILE__,__LINE__,rc); + put_tty_driver(serial_driver); + } info = synclinkmp_device_list; while(info) { @@ -3882,6 +3836,69 @@ static void __exit synclinkmp_exit(void) pci_unregister_driver(&synclinkmp_pci_driver); } +/* Driver initialization entry point. + */ + +static int __init synclinkmp_init(void) +{ + int rc; + + if (break_on_load) { + synclinkmp_get_text_ptr(); + BREAKPOINT(); + } + + printk("%s %s\n", driver_name, driver_version); + + if ((rc = pci_register_driver(&synclinkmp_pci_driver)) < 0) { + printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc); + return rc; + } + + serial_driver = alloc_tty_driver(128); + if (!serial_driver) { + rc = -ENOMEM; + goto error; + } + + /* Initialize the tty_driver structure */ + + serial_driver->owner = THIS_MODULE; + serial_driver->driver_name = "synclinkmp"; + serial_driver->name = "ttySLM"; + serial_driver->major = ttymajor; + serial_driver->minor_start = 64; + serial_driver->type = TTY_DRIVER_TYPE_SERIAL; + serial_driver->subtype = SERIAL_TYPE_NORMAL; + serial_driver->init_termios = tty_std_termios; + serial_driver->init_termios.c_cflag = + B9600 | CS8 | CREAD | HUPCL | CLOCAL; + serial_driver->flags = TTY_DRIVER_REAL_RAW; + tty_set_operations(serial_driver, &ops); + if ((rc = tty_register_driver(serial_driver)) < 0) { + printk("%s(%d):Couldn't register serial driver\n", + __FILE__,__LINE__); + put_tty_driver(serial_driver); + serial_driver = NULL; + goto error; + } + + printk("%s %s, tty major#%d\n", + driver_name, driver_version, + serial_driver->major); + + return 0; + +error: + synclinkmp_cleanup(); + return rc; +} + +static void __exit synclinkmp_exit(void) +{ + synclinkmp_cleanup(); +} + module_init(synclinkmp_init); module_exit(synclinkmp_exit); diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 15e2c72ed..5b84af027 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c @@ -251,13 +251,14 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { SMMRegisters regs; + SMMRegisters __user *argp = (SMMRegisters __user *)arg; unsigned short ax,bx; int err; - if (!arg) + if (!argp) return -EINVAL; - if (copy_from_user(®s, (SMMRegisters *) arg, sizeof(SMMRegisters))) + if (copy_from_user(®s, argp, sizeof(SMMRegisters))) return -EFAULT; switch (cmd) { @@ -281,7 +282,7 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, return -EINVAL; } - if (copy_to_user((SMMRegisters *) arg, ®s, sizeof(SMMRegisters))) + if (copy_to_user(argp, ®s, sizeof(SMMRegisters))) return -EFAULT; return (err==0) ? 0:-EINVAL; diff --git a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c index 698c2c451..6ee95af21 100644 --- a/drivers/char/tpqic02.c +++ b/drivers/char/tpqic02.c @@ -1727,7 +1727,7 @@ static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id, * request would return the EOF flag for the previous file. */ -static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { int type = iminor(filp->f_dentry->d_inode); unsigned short flags = filp->f_flags; @@ -1905,7 +1905,7 @@ static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_ * tape device again. The driver will detect an exception status in (No Cartridge) * and force a rewind. After that tar may continue writing. */ -static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { int type = iminor(filp->f_dentry->d_inode); unsigned short flags = filp->f_flags; @@ -2400,6 +2400,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int struct mtop operation; unsigned char blk_addr[6]; struct mtpos ioctl_tell; + void __user *argp = (void __user *)ioarg; if (TP_DIAGS(current_type)) @@ -2416,7 +2417,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int if (c == _IOC_NR(MTIOCGETCONFIG)) { CHECK_IOC_SIZE(mtconfiginfo); - if (copy_to_user((char *) ioarg, (char *) &qic02_tape_dynconf, sizeof(qic02_tape_dynconf))) + if (copy_to_user(argp, &qic02_tape_dynconf, sizeof(qic02_tape_dynconf))) return -EFAULT; return 0; } else if (c == _IOC_NR(MTIOCSETCONFIG)) { @@ -2438,7 +2439,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int qic02_release_resources(); /* and go zombie */ /* copy struct from user space to kernel space */ - if (copy_from_user((char *) &qic02_tape_dynconf, (char *) ioarg, sizeof(qic02_tape_dynconf))) + if (copy_from_user(&qic02_tape_dynconf, argp, sizeof(qic02_tape_dynconf))) return -EFAULT; return update_ifc_masks(qic02_tape_dynconf.ifc_type); @@ -2452,7 +2453,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int CHECK_IOC_SIZE(mtop); /* copy mtop struct from user space to kernel space */ - if (copy_from_user((char *) &operation, (char *) ioarg, sizeof(operation))) + if (copy_from_user(&operation, argp, sizeof(operation))) return -EFAULT; /* ---note: mt_count is signed, negative seeks must be @@ -2507,7 +2508,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int */ /* copy results to user space */ - if (copy_to_user((char *) ioarg, (char *) &ioctl_status, sizeof(ioctl_status))) + if (copy_to_user(argp, &ioctl_status, sizeof(ioctl_status))) return -EFAULT; return 0; } else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) { @@ -2527,7 +2528,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int ioctl_tell.mt_blkno = (blk_addr[3] << 16) | (blk_addr[4] << 8) | blk_addr[5]; /* copy results to user space */ - if (copy_to_user((char *) ioarg, (char *) &ioctl_tell, sizeof(ioctl_tell))) + if (copy_to_user(argp, &ioctl_tell, sizeof(ioctl_tell))) return -EFAULT; return 0; @@ -2536,7 +2537,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int } /* qic02_tape_ioctl */ -static ssize_t qic02_do_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_do_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { int err; @@ -2547,7 +2548,7 @@ static ssize_t qic02_do_tape_read(struct file *filp, char *buf, size_t count, lo return err; } -static ssize_t qic02_do_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +static ssize_t qic02_do_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { int err; diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 0c762379a..280be2c98 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -91,6 +91,7 @@ #include #include #include +#include #include #include @@ -128,6 +129,8 @@ DECLARE_MUTEX(tty_sem); #ifdef CONFIG_UNIX98_PTYS extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */ extern int pty_limit; /* Config limit on Unix98 ptys */ +static DEFINE_IDR(allocated_ptys); +static DECLARE_MUTEX(allocated_ptys_lock); #endif extern void disable_early_printk(void); @@ -1065,6 +1068,7 @@ static void release_dev(struct file * filp) { struct tty_struct *tty, *o_tty; int pty_master, tty_closing, o_tty_closing, do_sleep; + int devpts_master; int idx; char buf[64]; @@ -1079,6 +1083,7 @@ static void release_dev(struct file * filp) idx = tty->index; pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER); + devpts_master = pty_master && (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM); o_tty = tty->link; #ifdef TTY_PARANOIA_CHECK @@ -1295,11 +1300,21 @@ static void release_dev(struct file * filp) o_tty->ldisc = ldiscs[N_TTY]; } - /* + /* * The release_mem function takes care of the details of clearing * the slots and preserving the termios structure. */ release_mem(tty, idx); + +#ifdef CONFIG_UNIX98_PTYS + /* Make this pty number available for reallocation */ + if (devpts_master) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, idx); + up(&allocated_ptys_lock); + } +#endif + } /* @@ -1322,8 +1337,12 @@ static int tty_open(struct inode * inode, struct file * filp) int index; dev_t device = inode->i_rdev; unsigned short saved_flags = filp->f_flags; + retry_open: noctty = filp->f_flags & O_NOCTTY; + index = -1; + retval = 0; + if (device == MKDEV(TTYAUX_MAJOR,0)) { if (!current->signal->tty) return -ENXIO; @@ -1361,24 +1380,40 @@ retry_open: #ifdef CONFIG_UNIX98_PTYS if (device == MKDEV(TTYAUX_MAJOR,2)) { + int idr_ret; + /* find a device that is not in use. */ - static int next_ptmx_dev = 0; - retval = -1; + down(&allocated_ptys_lock); + if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) { + up(&allocated_ptys_lock); + return -ENOMEM; + } + idr_ret = idr_get_new(&allocated_ptys, NULL, &index); + if (idr_ret < 0) { + up(&allocated_ptys_lock); + if (idr_ret == -EAGAIN) + return -ENOMEM; + return -EIO; + } + if (index >= pty_limit) { + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + return -EIO; + } + up(&allocated_ptys_lock); + driver = ptm_driver; - while (driver->refcount < pty_limit) { - index = next_ptmx_dev; - next_ptmx_dev = (next_ptmx_dev+1) % driver->num; - if (!init_dev(driver, index, &tty)) - goto ptmx_found; /* ok! */ + retval = init_dev(driver, index, &tty); + if (retval) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + return retval; } - return -EIO; /* no free ptys */ - ptmx_found: + set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ - if (devpts_pty_new(tty->link)) { - /* BADNESS - need to destroy both ptm and pts! */ - return -ENOMEM; - } - noctty = 1; + if (devpts_pty_new(tty->link)) + retval = -ENOMEM; } else #endif { @@ -1400,10 +1435,12 @@ got_driver: #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "opening %s...", tty->name); #endif - if (tty->driver->open) - retval = tty->driver->open(tty, filp); - else - retval = -ENODEV; + if (!retval) { + if (tty->driver->open) + retval = tty->driver->open(tty, filp); + else + retval = -ENODEV; + } filp->f_flags = saved_flags; if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN)) @@ -1415,6 +1452,14 @@ got_driver: tty->name); #endif +#ifdef CONFIG_UNIX98_PTYS + if (index != -1) { + down(&allocated_ptys_lock); + idr_remove(&allocated_ptys, index); + up(&allocated_ptys_lock); + } +#endif + release_dev(filp); if (retval != -ERESTARTSYS) return retval; diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c index acb25de93..2febb25a4 100644 --- a/drivers/char/watchdog/acquirewdt.c +++ b/drivers/char/watchdog/acquirewdt.c @@ -111,7 +111,7 @@ static void acq_stop(void) * /dev/watchdog handling. */ -static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -146,6 +146,8 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int options, retval = -EINVAL; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, @@ -156,22 +158,22 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, switch(cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ? -EFAULT : 0; + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: acq_keepalive(); return 0; case WDIOC_GETTIMEOUT: - return put_user(WATCHDOG_HEARTBEAT, (int *)arg); + return put_user(WATCHDOG_HEARTBEAT, p); case WDIOC_SETOPTIONS: { - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c index a92b3ae02..4090794ee 100644 --- a/drivers/char/watchdog/advantechwdt.c +++ b/drivers/char/watchdog/advantechwdt.c @@ -100,7 +100,7 @@ advwdt_disable(void) } static ssize_t -advwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -130,6 +130,8 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int new_timeout; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, @@ -138,20 +140,20 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) + if (copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; break; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: advwdt_ping(); break; case WDIOC_SETTIMEOUT: - if (get_user(new_timeout, (int *)arg)) + if (get_user(new_timeout, p)) return -EFAULT; if ((new_timeout < 1) || (new_timeout > 63)) return -EINVAL; @@ -160,13 +162,13 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); case WDIOC_SETOPTIONS: { int options, retval = -EINVAL; - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) { diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index 9a3207d81..f093a698f 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c @@ -138,7 +138,7 @@ static int ali_settimer(int t) * the next close to turn off the watchdog. */ -static ssize_t ali_write(struct file *file, const char *data, +static ssize_t ali_write(struct file *file, const char __user *data, size_t len, loff_t * ppos) { /* Can't seek (pwrite) on this device */ @@ -184,6 +184,8 @@ static ssize_t ali_write(struct file *file, const char *data, static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | @@ -194,12 +196,12 @@ static int ali_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *) arg, &ident, + return copy_to_user(argp, &ident, sizeof (ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_KEEPALIVE: ali_keepalive(); @@ -209,7 +211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, { int new_options, retval = -EINVAL; - if (get_user (new_options, (int *) arg)) + if (get_user (new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -229,7 +231,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, { int new_timeout; - if (get_user(new_timeout, (int *) arg)) + if (get_user(new_timeout, p)) return -EFAULT; if (ali_settimer(new_timeout)) @@ -240,7 +242,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); default: return -ENOIOCTLCMD; diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index 00baec945..c137cd3bc 100644 --- a/drivers/char/watchdog/alim7101_wdt.c +++ b/drivers/char/watchdog/alim7101_wdt.c @@ -148,7 +148,7 @@ static void wdt_keepalive(void) * /dev/watchdog handling */ -static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos) { /* We can't seek */ if(ppos != &file->f_pos) @@ -203,6 +203,8 @@ static int fop_close(struct inode * inode, struct file * file) static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, @@ -213,10 +215,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u switch(cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_keepalive(); return 0; @@ -224,7 +226,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u { int new_options, retval = -EINVAL; - if(get_user(new_options, (int *)arg)) + if(get_user(new_options, p)) return -EFAULT; if(new_options & WDIOS_DISABLECARD) { @@ -243,7 +245,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u { int new_timeout; - if(get_user(new_timeout, (int *)arg)) + if(get_user(new_timeout, p)) return -EFAULT; if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ @@ -254,7 +256,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u /* Fall through */ } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); default: return -ENOIOCTLCMD; } diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index dad804ff5..7e7b653a2 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c @@ -145,6 +145,7 @@ static int cpu5wdt_release(struct inode *inode, struct file *file) static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; unsigned int value; static struct watchdog_info ident = { @@ -159,15 +160,15 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm case WDIOC_GETSTATUS: value = inb(port + CPU5WDT_STATUS_REG); value = (value >> 2) & 1; - if ( copy_to_user((int *)arg, (int *)&value, sizeof(int)) ) + if ( copy_to_user(argp, &value, sizeof(int)) ) return -EFAULT; break; case WDIOC_GETSUPPORT: - if ( copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)) ) + if ( copy_to_user(argp, &ident, sizeof(ident)) ) return -EFAULT; break; case WDIOC_SETOPTIONS: - if ( copy_from_user(&value, (int *)arg, sizeof(int)) ) + if ( copy_from_user(&value, argp, sizeof(int)) ) return -EFAULT; switch(value) { case WDIOS_ENABLECARD: @@ -185,7 +186,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm return 0; } -static ssize_t cpu5wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { if ( !count ) return -EIO; diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index ab28ca2ac..01df6566b 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c @@ -196,8 +196,8 @@ static void eurwdt_ping(void) * write of data will do, as we we don't define content meaning. */ -static ssize_t eurwdt_write(struct file *file, const char *buf, size_t count, -loff_t *ppos) +static ssize_t eurwdt_write(struct file *file, const char __user *buf, +size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -237,6 +237,8 @@ loff_t *ppos) static int eurwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, @@ -251,19 +253,18 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file, return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, - sizeof(ident)) ? -EFAULT : 0; + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_KEEPALIVE: eurwdt_ping(); return 0; case WDIOC_SETTIMEOUT: - if (copy_from_user(&time, (int *) arg, sizeof(int))) + if (copy_from_user(&time, p, sizeof(int))) return -EFAULT; /* Sanity check */ @@ -275,10 +276,10 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(eurwdt_timeout, (int *)arg); + return put_user(eurwdt_timeout, p); case WDIOC_SETOPTIONS: - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) { eurwdt_disable_timer(); diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index efe3c1d9e..8a63f7fb7 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c @@ -212,7 +212,7 @@ static int i8xx_tco_release (struct inode *inode, struct file *file) return 0; } -static ssize_t i8xx_tco_write (struct file *file, const char *data, +static ssize_t i8xx_tco_write (struct file *file, const char __user *data, size_t len, loff_t * ppos) { /* Can't seek (pwrite) on this device */ @@ -249,6 +249,8 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, { int new_options, retval = -EINVAL; int new_heartbeat; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | @@ -259,12 +261,12 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *) arg, &ident, + return copy_to_user(argp, &ident, sizeof (ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user (0, (int *) arg); + return put_user (0, p); case WDIOC_KEEPALIVE: tco_timer_keepalive (); @@ -272,7 +274,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, case WDIOC_SETOPTIONS: { - if (get_user (new_options, (int *) arg)) + if (get_user (new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -291,7 +293,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, case WDIOC_SETTIMEOUT: { - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (tco_timer_set_heartbeat(new_heartbeat)) @@ -302,7 +304,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); default: return -ENOIOCTLCMD; diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c index 2e259a10f..0d48439c9 100644 --- a/drivers/char/watchdog/ib700wdt.c +++ b/drivers/char/watchdog/ib700wdt.c @@ -139,7 +139,7 @@ ibwdt_ping(void) } static ssize_t -ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -170,6 +170,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int i, new_margin; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, @@ -179,19 +181,19 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) + if (copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; break; case WDIOC_GETSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_KEEPALIVE: ibwdt_ping(); break; case WDIOC_SETTIMEOUT: - if (get_user(new_margin, (int *)arg)) + if (get_user(new_margin, p)) return -EFAULT; if ((new_margin < 0) || (new_margin > 30)) return -EINVAL; @@ -203,7 +205,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(wd_times[wd_margin], (int *)arg); + return put_user(wd_times[wd_margin], p); break; default: diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index 99c6b21b3..e8dc517b4 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c @@ -302,7 +302,7 @@ static void zf_ping(unsigned long data) } } -static ssize_t zf_write(struct file *file, const char *buf, size_t count, +static ssize_t zf_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -352,15 +352,16 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count, static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; switch(cmd){ case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, - &zf_info, sizeof(zf_info))) + if (copy_to_user(argp, &zf_info, sizeof(zf_info))) return -EFAULT; break; case WDIOC_GETSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_KEEPALIVE: zf_ping(0); diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index 6d3e7d5fa..2790f9c56 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c @@ -134,7 +134,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file) } -static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, loff_t *ppos) +static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { if (ppos != &file->f_pos) { return -ESPIPE; @@ -164,6 +164,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l static int mixcomwd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int status; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, @@ -178,13 +180,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, if (!nowayout) { status|=mixcomwd_timer_alive; } - if (copy_to_user((int *)arg, &status, sizeof(int))) { + if (copy_to_user(p, &status, sizeof(int))) { return -EFAULT; } break; case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, - sizeof(ident))) { + if (copy_to_user(argp, &ident, sizeof(ident))) { return -EFAULT; } break; diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index bd24b5348..295e11461 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c @@ -70,7 +70,7 @@ #include #include -#define WD_VER "1.16 (03/27/2004)" +#define WD_VER "1.16 (06/12/2004)" #define PFX "pcwd: " /* @@ -299,10 +299,11 @@ static int pcwd_stop(void) return 0; } -static void pcwd_keepalive(void) +static int pcwd_keepalive(void) { /* user land ping */ next_heartbeat = jiffies + (heartbeat * HZ); + return 0; } static int pcwd_set_heartbeat(int t) @@ -404,6 +405,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, int status; int temperature; int new_heartbeat; + int __user *argp = (int __user *)arg; static struct watchdog_info ident = { .options = WDIOF_OVERHEAT | WDIOF_CARDRESET | @@ -419,27 +421,27 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - if(copy_to_user((void*)arg, &ident, sizeof(ident))) + if(copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; return 0; case WDIOC_GETSTATUS: pcwd_get_status(&status); - return put_user(status, (int *) arg); + return put_user(status, argp); case WDIOC_GETBOOTSTATUS: - return put_user(initial_status, (int *) arg); + return put_user(initial_status, argp); case WDIOC_GETTEMP: if (pcwd_get_temperature(&temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, argp); case WDIOC_SETOPTIONS: if (revision == PCWD_REVISION_C) { - if(copy_from_user(&rv, (int*) arg, sizeof(int))) + if(copy_from_user(&rv, argp, sizeof(int))) return -EFAULT; if (rv & WDIOS_DISABLECARD) @@ -464,7 +466,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, argp)) return -EFAULT; if (pcwd_set_heartbeat(new_heartbeat)) @@ -474,13 +476,13 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, argp); } return 0; } -static ssize_t pcwd_write(struct file *file, const char *buf, size_t len, +static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -528,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file) { if (expect_close == 42) { pcwd_stop(); - atomic_inc( &open_allowed ); } else { printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); pcwd_keepalive(); } expect_close = 0; + atomic_inc( &open_allowed ); return 0; } @@ -541,7 +543,7 @@ static int pcwd_close(struct inode *inode, struct file *file) * /dev/temperature handling */ -static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count, +static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int temperature; diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index e24694c3e..ddfeee878 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c @@ -49,7 +49,7 @@ /* Module and version information */ #define WATCHDOG_VERSION "1.00" -#define WATCHDOG_DATE "13/03/2004" +#define WATCHDOG_DATE "12 Jun 2004" #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" #define WATCHDOG_NAME "pcwd_pci" #define PFX WATCHDOG_NAME ": " @@ -73,7 +73,7 @@ #define WD_PCI_TTRP 0x04 /* Temperature Trip status */ /* according to documentation max. time to process a command for the pci - watchdog card is 100 ms, so we give it 150 ms to do it's job */ + * watchdog card is 100 ms, so we give it 150 ms to do it's job */ #define PCI_COMMAND_TIMEOUT 150 /* Watchdog's internal commands */ @@ -258,7 +258,7 @@ static int pcipcwd_get_temperature(int *temperature) * /dev/watchdog handling */ -static ssize_t pcipcwd_write(struct file *file, const char *data, +static ssize_t pcipcwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -293,6 +293,8 @@ static ssize_t pcipcwd_write(struct file *file, const char *data, static int pcipcwd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_OVERHEAT | WDIOF_CARDRESET | @@ -305,7 +307,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *) arg, &ident, + return copy_to_user(argp, &ident, sizeof (ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: @@ -314,11 +316,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, pcipcwd_get_status(&status); - return put_user(status, (int *) arg); + return put_user(status, p); } case WDIOC_GETBOOTSTATUS: - return put_user(pcipcwd_private.boot_status, (int *) arg); + return put_user(pcipcwd_private.boot_status, p); case WDIOC_GETTEMP: { @@ -327,7 +329,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, if (pcipcwd_get_temperature(&temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, p); } case WDIOC_KEEPALIVE: @@ -338,7 +340,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, { int new_options, retval = -EINVAL; - if (get_user (new_options, (int *) arg)) + if (get_user (new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -363,7 +365,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, { int new_heartbeat; - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (pcipcwd_set_heartbeat(new_heartbeat)) @@ -374,7 +376,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); default: return -ENOIOCTLCMD; @@ -404,8 +406,8 @@ static int pcipcwd_release(struct inode *inode, struct file *file) printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); pcipcwd_keepalive(); } - clear_bit(0, &is_active); expect_release = 0; + clear_bit(0, &is_active); return 0; } @@ -413,7 +415,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file) * /dev/temperature handling */ -static ssize_t pcipcwd_temp_read(struct file *file, char *data, +static ssize_t pcipcwd_temp_read(struct file *file, char __user *data, size_t len, loff_t *ppos) { int temperature; @@ -585,15 +587,12 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); /* Check that the heartbeat value is within it's range ; if not reset to the default */ - if (heartbeat < 1 || heartbeat > 0xFFFF) { - heartbeat = WATCHDOG_HEARTBEAT; + if (pcipcwd_set_heartbeat(heartbeat)) { + pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT); printk(KERN_INFO PFX "heartbeat value must be 0" #define DRIVER_DESC "Berkshire USB-PC Watchdog driver" #define DRIVER_LICENSE "GPL" @@ -325,7 +326,7 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp * /dev/watchdog handling */ -static ssize_t usb_pcwd_write(struct file *file, const char *data, +static ssize_t usb_pcwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ @@ -360,6 +361,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char *data, static int usb_pcwd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | @@ -370,12 +373,12 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *) arg, &ident, + return copy_to_user(argp, &ident, sizeof (ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_GETTEMP: { @@ -384,7 +387,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, p); } case WDIOC_KEEPALIVE: @@ -395,7 +398,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, { int new_options, retval = -EINVAL; - if (get_user (new_options, (int *) arg)) + if (get_user (new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -415,7 +418,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, { int new_heartbeat; - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat)) @@ -426,7 +429,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); default: return -ENOIOCTLCMD; @@ -456,8 +459,8 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); usb_pcwd_keepalive(usb_pcwd_device); } - clear_bit(0, &is_active); expect_release = 0; + clear_bit(0, &is_active); return 0; } @@ -465,7 +468,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) * /dev/temperature handling */ -static ssize_t usb_pcwd_temperature_read(struct file *file, char *data, +static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data, size_t len, loff_t *ppos) { int temperature; @@ -477,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char *data, if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature)) return -EFAULT; - if (copy_to_user (data, &temperature, 1)) + if (copy_to_user(data, &temperature, 1)) return -EFAULT; return 1; @@ -681,15 +684,12 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi ((option_switches & 0x08) ? "ON" : "OFF")); /* Check that the heartbeat value is within it's range ; if not reset to the default */ - if (heartbeat < 1 || heartbeat > 0xFFFF) { - heartbeat = WATCHDOG_HEARTBEAT; + if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) { + usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT); printk(KERN_INFO PFX "heartbeat value must be 0exists = 0; /* Deregister */ - misc_deregister(&usb_pcwd_temperature_miscdev); misc_deregister(&usb_pcwd_miscdev); + misc_deregister(&usb_pcwd_temperature_miscdev); unregister_reboot_notifier(&usb_pcwd_notifier); up (&usb_pcwd->sem); @@ -791,7 +791,7 @@ static int __init usb_pcwd_init(void) return result; } - printk(KERN_INFO PFX DRIVER_DESC " " DRIVER_VERSION "\n"); + printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION " (" DRIVER_DATE ")\n"); return 0; } diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c index c533c4660..b1c29907b 100644 --- a/drivers/char/watchdog/sbc60xxwdt.c +++ b/drivers/char/watchdog/sbc60xxwdt.c @@ -166,7 +166,7 @@ static void wdt_keepalive(void) * /dev/watchdog handling */ -static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos) { /* We can't seek */ if(ppos != &file->f_pos) @@ -230,6 +230,8 @@ static int fop_close(struct inode * inode, struct file * file) static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident= { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, @@ -242,10 +244,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_keepalive(); return 0; @@ -253,7 +255,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_options, retval = -EINVAL; - if(get_user(new_options, (int *)arg)) + if(get_user(new_options, p)) return -EFAULT; if(new_options & WDIOS_DISABLECARD) { @@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_timeout; - if(get_user(new_timeout, (int *)arg)) + if(get_user(new_timeout, p)) return -EFAULT; if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ @@ -283,7 +285,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall through */ } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); } } diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index b7e48851f..df3816173 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c @@ -174,6 +174,8 @@ static int sc1200wdt_open(struct inode *inode, struct file *file) static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int new_timeout; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 0, @@ -185,22 +187,22 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int return -ENOIOCTLCMD; /* Keep Pavel Machek amused ;) */ case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof ident)) + if (copy_to_user(argp, &ident, sizeof ident)) return -EFAULT; return 0; case WDIOC_GETSTATUS: - return put_user(sc1200wdt_status(), (int *)arg); + return put_user(sc1200wdt_status(), p); case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: sc1200wdt_write_data(WDTO, timeout); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_timeout, (int *)arg)) + if (get_user(new_timeout, p)) return -EFAULT; /* the API states this is given in secs */ @@ -213,13 +215,13 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int /* fall through and return the new timeout */ case WDIOC_GETTIMEOUT: - return put_user(timeout * 60, (int *)arg); + return put_user(timeout * 60, p); case WDIOC_SETOPTIONS: { int options, retval = -EINVAL; - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) { @@ -254,7 +256,7 @@ static int sc1200wdt_release(struct inode *inode, struct file *file) } -static ssize_t sc1200wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) +static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { if (ppos != &file->f_pos) return -ESPIPE; diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index b54c47b72..ebd0bb14c 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c @@ -225,7 +225,7 @@ static int wdt_set_heartbeat(int t) * /dev/watchdog handling */ -static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos) { /* We can't seek */ if(ppos != &file->f_pos) @@ -285,6 +285,8 @@ static int fop_close(struct inode * inode, struct file * file) static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, @@ -296,10 +298,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_keepalive(); return 0; @@ -307,7 +309,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_options, retval = -EINVAL; - if(get_user(new_options, (int *)arg)) + if(get_user(new_options, p)) return -EFAULT; if(new_options & WDIOS_DISABLECARD) { @@ -326,7 +328,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_timeout; - if(get_user(new_timeout, (int *)arg)) + if(get_user(new_timeout, p)) return -EFAULT; if(wdt_set_heartbeat(new_timeout)) @@ -336,7 +338,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall through */ } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); } } diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c index 6f0657b2b..bc61e82c3 100644 --- a/drivers/char/watchdog/scx200_wdt.c +++ b/drivers/char/watchdog/scx200_wdt.c @@ -132,7 +132,7 @@ static struct notifier_block scx200_wdt_notifier = .notifier_call = scx200_wdt_notify_sys, }; -static ssize_t scx200_wdt_write(struct file *file, const char *data, +static ssize_t scx200_wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { if (ppos != &file->f_pos) @@ -163,6 +163,8 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data, static int scx200_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .identity = "NatSemi SCx200 Watchdog", .firmware_version = 1, @@ -174,20 +176,19 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - if(copy_to_user((struct watchdog_info *)arg, &ident, - sizeof(ident))) + if(copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; return 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - if (put_user(0, (int *)arg)) + if (put_user(0, p)) return -EFAULT; return 0; case WDIOC_KEEPALIVE: scx200_wdt_ping(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_margin, (int *)arg)) + if (get_user(new_margin, p)) return -EFAULT; if (new_margin < 1) return -EINVAL; @@ -195,7 +196,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, scx200_wdt_update_margin(); scx200_wdt_ping(); case WDIOC_GETTIMEOUT: - if (put_user(margin, (int *)arg)) + if (put_user(margin, p)) return -EFAULT; return 0; } diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index e9f4f22e7..832590d41 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c @@ -161,7 +161,7 @@ static int softdog_release(struct inode *inode, struct file *file) return 0; } -static ssize_t softdog_write(struct file *file, const char *data, size_t len, loff_t *ppos) +static ssize_t softdog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -194,6 +194,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo static int softdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int new_margin; static struct watchdog_info ident = { .options = WDIOF_SETTIMEOUT | @@ -206,23 +208,23 @@ static int softdog_ioctl(struct inode *inode, struct file *file, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0,(int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: softdog_keepalive(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_margin, (int *)arg)) + if (get_user(new_margin, p)) return -EFAULT; if (softdog_set_heartbeat(new_margin)) return -EINVAL; softdog_keepalive(); /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(soft_margin, (int *)arg); + return put_user(soft_margin, p); } } diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index 7a129302c..0a2196231 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c @@ -142,7 +142,7 @@ wdt_set_heartbeat(int t) } static ssize_t -wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -171,6 +171,8 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int new_timeout; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, @@ -180,20 +182,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) + if (copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; break; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_ping(); break; case WDIOC_SETTIMEOUT: - if (get_user(new_timeout, (int *)arg)) + if (get_user(new_timeout, p)) return -EFAULT; if (wdt_set_heartbeat(new_timeout)) return -EINVAL; @@ -201,13 +203,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); case WDIOC_SETOPTIONS: { int options, retval = -EINVAL; - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) { diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c index 2b657a522..21270dad0 100644 --- a/drivers/char/watchdog/w83877f_wdt.c +++ b/drivers/char/watchdog/w83877f_wdt.c @@ -188,7 +188,7 @@ static void wdt_keepalive(void) * /dev/watchdog handling */ -static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos) { /* We can't seek */ if(ppos != &file->f_pos) @@ -249,6 +249,8 @@ static int fop_close(struct inode * inode, struct file * file) static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident= { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, @@ -261,10 +263,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_keepalive(); return 0; @@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_options, retval = -EINVAL; - if(get_user(new_options, (int *)arg)) + if(get_user(new_options, p)) return -EFAULT; if(new_options & WDIOS_DISABLECARD) { @@ -291,7 +293,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { int new_timeout; - if(get_user(new_timeout, (int *)arg)) + if(get_user(new_timeout, p)) return -EFAULT; if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */ @@ -302,7 +304,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, /* Fall through */ } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); } } diff --git a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c index 464a5a796..26e232b74 100644 --- a/drivers/char/watchdog/wafer5823wdt.c +++ b/drivers/char/watchdog/wafer5823wdt.c @@ -95,7 +95,7 @@ wafwdt_stop(void) inb_p(wdt_stop); } -static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, loff_t * ppos) +static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -128,6 +128,8 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd unsigned long arg) { int new_timeout; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, .firmware_version = 1, @@ -136,21 +138,20 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user - ((struct watchdog_info *) arg, &ident, sizeof (ident))) + if (copy_to_user(argp, &ident, sizeof (ident))) return -EFAULT; break; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wafwdt_ping(); break; case WDIOC_SETTIMEOUT: - if (get_user(new_timeout, (int *)arg)) + if (get_user(new_timeout, p)) return -EFAULT; if ((new_timeout < 1) || (new_timeout > 255)) return -EINVAL; @@ -159,13 +160,13 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd wafwdt_start(); /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); case WDIOC_SETOPTIONS: { int options, retval = -EINVAL; - if (get_user(options, (int *)arg)) + if (get_user(options, p)) return -EFAULT; if (options & WDIOS_DISABLECARD) { diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index c606ce433..407690ba0 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c @@ -286,7 +286,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs) * write of data will do, as we we don't define content meaning. */ -static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -327,6 +327,8 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int new_heartbeat; int status; @@ -351,18 +353,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: wdt_get_status(&status); - return put_user(status,(int *)arg); + return put_user(status, p); case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdt_ping(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_heartbeat, (int *)arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (wdt_set_heartbeat(new_heartbeat)) @@ -371,7 +373,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, wdt_ping(); /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); } } @@ -435,7 +437,7 @@ static int wdt_release(struct inode *inode, struct file *file) * farenheit. It was designed by an imperial measurement luddite. */ -static ssize_t wdt_temp_read(struct file *file, char *buf, size_t count, loff_t *ptr) +static ssize_t wdt_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr) { int temperature; diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 395df48c8..c63d17ff6 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c @@ -331,7 +331,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs) * write of data will do, as we we don't define content meaning. */ -static ssize_t wdtpci_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* Can't seek (pwrite) on this device */ if (ppos != &file->f_pos) @@ -374,6 +374,8 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd { int new_heartbeat; int status; + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_SETTIMEOUT| @@ -396,18 +398,18 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd default: return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0; case WDIOC_GETSTATUS: wdtpci_get_status(&status); - return put_user(status,(int *)arg); + return put_user(status, p); case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: wdtpci_ping(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_heartbeat, (int *)arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (wdtpci_set_heartbeat(new_heartbeat)) @@ -416,7 +418,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd wdtpci_ping(); /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); } } @@ -484,7 +486,7 @@ static int wdtpci_release(struct inode *inode, struct file *file) * fahrenheit. It was designed by an imperial measurement luddite. */ -static ssize_t wdtpci_temp_read(struct file *file, char *buf, size_t count, loff_t *ptr) +static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, size_t count, loff_t *ptr) { int temperature; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a6f3510a1..a7fa79f5b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -722,7 +722,12 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { - return cpufreq_driver->target(policy, target_freq, relation); + int retval = -EINVAL; + lock_cpu_hotplug(); + if (cpu_online(policy->cpu)) + retval = cpufreq_driver->target(policy, target_freq, relation); + unlock_cpu_hotplug(); + return retval; } EXPORT_SYMBOL_GPL(__cpufreq_driver_target); diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 666c71790..510214470 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -206,7 +206,7 @@ cpufreq_sysctl(ctl_table *table, int __user *name, int nlen, if (oldlen != sizeof(unsigned int)) return -EINVAL; - if (put_user(cpufreq_get(cpu), (unsigned int *)oldval) || + if (put_user(cpufreq_get(cpu), (unsigned int __user *)oldval) || put_user(sizeof(unsigned int), oldlenp)) return -EFAULT; } @@ -216,7 +216,7 @@ cpufreq_sysctl(ctl_table *table, int __user *name, int nlen, if (newlen != sizeof(unsigned int)) return -EINVAL; - if (get_user(freq, (unsigned int *)newval)) + if (get_user(freq, (unsigned int __user *)newval)) return -EFAULT; cpufreq_set(freq, cpu); diff --git a/drivers/cpufreq/proc_intf.c b/drivers/cpufreq/proc_intf.c index 81d58c7b7..a0eaf6f1d 100644 --- a/drivers/cpufreq/proc_intf.c +++ b/drivers/cpufreq/proc_intf.c @@ -164,7 +164,7 @@ end: */ static int cpufreq_proc_write ( struct file *file, - const char *buffer, + const char __user *buffer, unsigned long count, void *data) { diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c index e5f41e017..1fbb219aa 100644 --- a/drivers/fc4/fc.c +++ b/drivers/fc4/fc.c @@ -38,7 +38,7 @@ #include #include #include "fcp_impl.h" -#include "../scsi/hosts.h" +#include /* #define FCDEBUG */ diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index 34792880c..40257f7ef 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c @@ -320,7 +320,7 @@ edd_show_info_flags(struct edd_device *edev, char *buf) } static ssize_t -edd_show_legacy_cylinders(struct edd_device *edev, char *buf) +edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -330,12 +330,12 @@ edd_show_legacy_cylinders(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_cylinders); + p += snprintf(p, left, "%u\n", info->legacy_max_cylinder); return (p - buf); } static ssize_t -edd_show_legacy_heads(struct edd_device *edev, char *buf) +edd_show_legacy_max_head(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -345,12 +345,12 @@ edd_show_legacy_heads(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_heads); + p += snprintf(p, left, "%u\n", info->legacy_max_head); return (p - buf); } static ssize_t -edd_show_legacy_sectors(struct edd_device *edev, char *buf) +edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf) { struct edd_info *info; char *p = buf; @@ -360,7 +360,7 @@ edd_show_legacy_sectors(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += snprintf(p, left, "0x%x\n", info->legacy_sectors); + p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track); return (p - buf); } @@ -375,7 +375,7 @@ edd_show_default_cylinders(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.num_default_cylinders); + p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders); return (p - buf); } @@ -390,7 +390,7 @@ edd_show_default_heads(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.num_default_heads); + p += scnprintf(p, left, "%u\n", info->params.num_default_heads); return (p - buf); } @@ -405,7 +405,7 @@ edd_show_default_sectors_per_track(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%x\n", info->params.sectors_per_track); + p += scnprintf(p, left, "%u\n", info->params.sectors_per_track); return (p - buf); } @@ -420,7 +420,7 @@ edd_show_sectors(struct edd_device *edev, char *buf) if (!info || !buf) return -EINVAL; - p += scnprintf(p, left, "0x%llx\n", info->params.number_of_sectors); + p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors); return (p - buf); } @@ -436,7 +436,7 @@ edd_show_sectors(struct edd_device *edev, char *buf) */ static int -edd_has_legacy_cylinders(struct edd_device *edev) +edd_has_legacy_max_cylinder(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -444,11 +444,11 @@ edd_has_legacy_cylinders(struct edd_device *edev) info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_cylinders > 0; + return info->legacy_max_cylinder > 0; } static int -edd_has_legacy_heads(struct edd_device *edev) +edd_has_legacy_max_head(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -456,11 +456,11 @@ edd_has_legacy_heads(struct edd_device *edev) info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_heads > 0; + return info->legacy_max_head > 0; } static int -edd_has_legacy_sectors(struct edd_device *edev) +edd_has_legacy_sectors_per_track(struct edd_device *edev) { struct edd_info *info; if (!edev) @@ -468,7 +468,7 @@ edd_has_legacy_sectors(struct edd_device *edev) info = edd_dev_get_info(edev); if (!info) return -EINVAL; - return info->legacy_sectors > 0; + return info->legacy_sectors_per_track > 0; } static int @@ -555,12 +555,14 @@ static EDD_DEVICE_ATTR(version, 0444, edd_show_version, NULL); static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, NULL); static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, NULL); static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, NULL); -static EDD_DEVICE_ATTR(legacy_cylinders, 0444, edd_show_legacy_cylinders, - edd_has_legacy_cylinders); -static EDD_DEVICE_ATTR(legacy_heads, 0444, edd_show_legacy_heads, - edd_has_legacy_heads); -static EDD_DEVICE_ATTR(legacy_sectors, 0444, edd_show_legacy_sectors, - edd_has_legacy_sectors); +static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444, + edd_show_legacy_max_cylinder, + edd_has_legacy_max_cylinder); +static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head, + edd_has_legacy_max_head); +static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444, + edd_show_legacy_sectors_per_track, + edd_has_legacy_sectors_per_track); static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders, edd_has_default_cylinders); static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads, @@ -587,9 +589,9 @@ static struct attribute * def_attrs[] = { /* These attributes are conditional and only added for some devices. */ static struct edd_attribute * edd_attrs[] = { - &edd_attr_legacy_cylinders, - &edd_attr_legacy_heads, - &edd_attr_legacy_sectors, + &edd_attr_legacy_max_cylinder, + &edd_attr_legacy_max_head, + &edd_attr_legacy_sectors_per_track, &edd_attr_default_cylinders, &edd_attr_default_heads, &edd_attr_default_sectors_per_track, diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 56225a516..2583ecaa9 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -126,7 +126,13 @@ int i2c_add_adapter(struct i2c_adapter *adap) goto out_unlock; } - id = idr_get_new(&i2c_adapter_idr, NULL); + res = idr_get_new(&i2c_adapter_idr, NULL, &id); + if (res < 0) { + if (res == -EAGAIN) + res = -ENOMEM; + goto out_unlock; + } + adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); @@ -162,7 +168,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) dev_dbg(&adap->dev, "registered as adapter #%d\n", adap->nr); - out_unlock: +out_unlock: up(&core_lists); return res; } diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index c43ac493d..ec58f197f 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -97,25 +97,7 @@ comment "Please see Documentation/ide.txt for help/info on IDE drives" config BLK_DEV_HD_IDE bool "Use old disk-only driver on primary interface" - depends on ((X86 && X86_PC9800!=y) || SH_MPC1211) - ---help--- - There are two drivers for MFM/RLL/IDE disks. Most people use just - the new enhanced driver by itself. This option however installs the - old hard disk driver to control the primary IDE/disk interface in - the system, leaving the new enhanced IDE driver to take care of only - the 2nd/3rd/4th IDE interfaces. Doing this will prevent you from - having an IDE/ATAPI CD-ROM or tape drive connected to the primary - IDE interface. Choosing this option may be useful for older systems - which have MFM/RLL/ESDI controller+drives at the primary port - address (0x1f0), along with IDE drives at the secondary/3rd/4th port - addresses. - - Normally, just say N here; you will then use the new driver for all - 4 interfaces. - -config BLK_DEV_HD_IDE98 - bool "Use old disk-only driver on primary interface" - depends on X86 && X86_PC9800 + depends on (X86 || SH_MPC1211) ---help--- There are two drivers for MFM/RLL/IDE disks. Most people use just the new enhanced driver by itself. This option however installs the @@ -157,20 +139,6 @@ config IDEDISK_MULTI_MODE If in doubt, say N. -config IDEDISK_STROKE - bool "Auto-Geometry Resizing support" - depends on BLK_DEV_IDEDISK - help - Should you have a system w/ an AWARD Bios and your drives are larger - than 32GB and it will not boot, one is required to perform a few OEM - operations first. The option is called "STROKE" because it allows - one to "soft clip" the drive to work around a barrier limit. For - Maxtor drives it is called "jumpon.exe". Please search Maxtor's - web-site for "JUMPON.EXE". IBM has a similar tool at: - . - - If you are unsure, say N here. - config BLK_DEV_IDECS tristate "PCMCIA IDE support" depends on PCMCIA @@ -438,48 +406,6 @@ config BLK_DEV_IDEDMA_PCI if BLK_DEV_IDEDMA_PCI -# TCQ is disabled for now -config BLK_DEV_IDE_TCQ - bool "ATA tagged command queueing (EXPERIMENTAL)" - depends on EXPERIMENTAL && n - help - Support for tagged command queueing on ATA disk drives. This enables - the IDE layer to have multiple in-flight requests on hardware that - supports it. For now this includes the IBM Deskstar series drives, - such as the 22GXP, 75GXP, 40GV, 60GXP, and 120GXP (ie any Deskstar made - in the last couple of years), and at least some of the Western - Digital drives in the Expert series (by nature of really being IBM - drives). - - If you have such a drive, say Y here. - -config BLK_DEV_IDE_TCQ_DEFAULT - bool "TCQ on by default" - depends on BLK_DEV_IDE_TCQ - ---help--- - Enable tagged command queueing unconditionally on drives that report - support for it. Regardless of the chosen value here, tagging can be - controlled at run time: - - echo "using_tcq:32" > /proc/ide/hdX/settings - - where any value between 1-32 selects chosen queue depth and enables - TCQ, and 0 disables it. hdparm version 4.7 an above also support - TCQ manipulations. - - Generally say Y here. - -config BLK_DEV_IDE_TCQ_DEPTH - int "Default queue depth" - depends on BLK_DEV_IDE_TCQ - default "8" - help - Maximum size of commands to enable per-drive. Any value between 1 - and 32 is valid, with 32 being the maxium that the hardware supports. - - You probably just want the default of 32 here. If you enter an invalid - number, the default value will be used. - config BLK_DEV_IDEDMA_FORCED bool "Force enable legacy 2.0.X HOSTS to use DMA" help diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 462976033..aeac73d8a 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile @@ -29,7 +29,6 @@ ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o ide-core-$(CONFIG_IDE_ARM) += arm/ide_arm.o # built-in only drivers from legacy/ -ide-core-$(CONFIG_BLK_DEV_IDE_PC9800) += legacy/pc9800.o ide-core-$(CONFIG_BLK_DEV_BUDDHA) += legacy/buddha.o ide-core-$(CONFIG_BLK_DEV_FALCON_IDE) += legacy/falconide.o ide-core-$(CONFIG_BLK_DEV_GAYLE) += legacy/gayle.o diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 1bb668b4f..0bb248239 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -535,9 +535,7 @@ static void cdrom_prepare_request(struct request *rq) rq->flags = REQ_PC; } -static void cdrom_queue_request_sense(ide_drive_t *drive, - struct completion *wait, - void *sense, +static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, struct request *failed_command) { struct cdrom_info *info = drive->driver_data; @@ -554,7 +552,6 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, rq->cmd[4] = rq->data_len = 18; rq->flags = REQ_SENSE; - rq->waiting = wait; /* NOTE! Save the failed command in "rq->buffer" */ rq->buffer = (void *) failed_command; @@ -574,7 +571,7 @@ ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat) if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL) return ide_stopped; /* retry only "normal" I/O: */ - if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) { + if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { rq->errors = 1; ide_end_drive_cmd(drive, stat, err); return ide_stopped; @@ -608,7 +605,7 @@ ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg) if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL) return ide_stopped; /* retry only "normal" I/O: */ - if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) { + if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { rq->errors = 1; ide_end_drive_cmd(drive, BUSY_STAT, 0); return ide_stopped; @@ -631,10 +628,21 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate) struct request *failed = (struct request *) rq->buffer; struct cdrom_info *info = drive->driver_data; void *sense = &info->sense_data; - - if (failed && failed->sense) { - sense = failed->sense; - failed->sense_len = rq->sense_len; + unsigned long flags; + + if (failed) { + if (failed->sense) { + sense = failed->sense; + failed->sense_len = rq->sense_len; + } + + /* + * now end failed request + */ + spin_lock_irqsave(&ide_lock, flags); + end_that_request_chunk(failed, 0, failed->data_len); + end_that_request_last(failed); + spin_unlock_irqrestore(&ide_lock, flags); } cdrom_analyze_sense_data(drive, failed, sense); @@ -642,6 +650,9 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate) if (!rq->current_nr_sectors && blk_fs_request(rq)) uptodate = 1; + /* make sure it's fully ended */ + if (blk_pc_request(rq)) + nsectors = (rq->data_len + 511) >> 9; if (!nsectors) nsectors = 1; @@ -684,7 +695,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) } else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) { /* All other functions, except for READ. */ - struct completion *wait = NULL; + unsigned long flags; /* * if we have an error, pass back CHECK_CONDITION as the @@ -706,30 +717,23 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) ide_dump_status(drive, "packet command error", stat); } - /* Set the error flag and complete the request. - Then, if we have a CHECK CONDITION status, - queue a request sense command. We must be careful, - though: we don't want the thread in - cdrom_queue_packet_command to wake up until - the request sense has completed. We do this - by transferring the semaphore from the packet - command request to the request sense request. */ - rq->flags |= REQ_FAILED; - if ((stat & ERR_STAT) != 0) { - wait = rq->waiting; - rq->waiting = NULL; - if ((rq->flags & REQ_BLOCK_PC) != 0) { - cdrom_queue_request_sense(drive, wait, - rq->sense, rq); - return 1; /* REQ_BLOCK_PC self-cares */ - } - } - cdrom_end_request(drive, 0); + /* + * instead of playing games with moving completions around, + * remove failed request completely and end it when the + * request sense has completed + */ + if (stat & ERR_STAT) { + spin_lock_irqsave(&ide_lock, flags); + blkdev_dequeue_request(rq); + HWGROUP(drive)->rq = NULL; + spin_unlock_irqrestore(&ide_lock, flags); + + cdrom_queue_request_sense(drive, rq->sense, rq); + } else + cdrom_end_request(drive, 0); - if ((stat & ERR_STAT) != 0) - cdrom_queue_request_sense(drive, wait, rq->sense, rq); } else if (blk_fs_request(rq)) { int do_end_request = 0; @@ -818,7 +822,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) /* If we got a CHECK_CONDITION status, queue a request sense command. */ if ((stat & ERR_STAT) != 0) - cdrom_queue_request_sense(drive, NULL, NULL, NULL); + cdrom_queue_request_sense(drive, NULL, NULL); } else { blk_dump_rq_flags(rq, "ide-cd: bad rq"); cdrom_end_request(drive, 0); @@ -1666,14 +1670,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) dma_error = HWIF(drive)->ide_dma_end(drive); } - if (cdrom_decode_status(drive, 0, &stat)) { - if ((stat & ERR_STAT) != 0) { - end_that_request_chunk(rq, 0, rq->data_len); - goto end_request; /* purge the whole thing... */ - } - end_that_request_chunk(rq, 1, rq->data_len); + if (cdrom_decode_status(drive, 0, &stat)) return ide_stopped; - } /* * using dma, transfer is complete now @@ -2818,7 +2816,6 @@ int ide_cdrom_open_real (struct cdrom_device_info *cdi, int purpose) return 0; } - /* * Close down the device. Invalidate all cached blocks. */ @@ -2892,12 +2889,6 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) devinfo->mask |= CDC_CLOSE_TRAY; if (!CDROM_CONFIG_FLAGS(drive)->mo_drive) devinfo->mask |= CDC_MO_DRIVE; - if (!CDROM_CONFIG_FLAGS(drive)->mrw) - devinfo->mask |= CDC_MRW; - if (!CDROM_CONFIG_FLAGS(drive)->mrw_w) - devinfo->mask |= CDC_MRW_W; - if (!CDROM_CONFIG_FLAGS(drive)->ram) - devinfo->mask |= CDC_RAM; devinfo->disk = drive->disk; return register_cdrom(devinfo); @@ -2934,7 +2925,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) struct cdrom_info *info = drive->driver_data; struct cdrom_device_info *cdi = &info->devinfo; struct atapi_capabilities_page cap; - int nslots = 1, mrw_write = 0, ram_write = 0; + int nslots = 1; if (drive->media == ide_optical) { CDROM_CONFIG_FLAGS(drive)->mo_drive = 1; @@ -2963,17 +2954,6 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) if (ide_cdrom_get_capabilities(drive, &cap)) return 0; - if (!cdrom_is_mrw(cdi, &mrw_write)) { - CDROM_CONFIG_FLAGS(drive)->mrw = 1; - if (mrw_write) { - CDROM_CONFIG_FLAGS(drive)->mrw_w = 1; - CDROM_CONFIG_FLAGS(drive)->ram = 1; - } - } - if (!cdrom_is_random_writable(cdi, &ram_write)) - if (ram_write) - CDROM_CONFIG_FLAGS(drive)->ram = 1; - if (cap.lock == 0) CDROM_CONFIG_FLAGS(drive)->no_doorlock = 1; if (cap.eject) @@ -3053,9 +3033,6 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) (CDROM_CONFIG_FLAGS(drive)->cd_r)? "-R" : "", (CDROM_CONFIG_FLAGS(drive)->cd_rw)? "/RW" : ""); - if (CDROM_CONFIG_FLAGS(drive)->mrw || CDROM_CONFIG_FLAGS(drive)->mrw_w) - printk(" CD-MR%s", CDROM_CONFIG_FLAGS(drive)->mrw_w ? "W" : ""); - if (CDROM_CONFIG_FLAGS(drive)->is_changer) printk(" changer w/%d slots", nslots); else diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 7a3bcd3c4..8305bcab8 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -79,8 +79,6 @@ struct ide_cd_config_flags { __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ - __u8 mrw : 1; /* drive can read mrw */ - __u8 mrw_w : 1; /* drive can write mrw */ __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contents diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 47761a0a5..9217f0ced 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -45,6 +45,8 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ +//#define DEBUG + #include #include #include @@ -118,20 +120,6 @@ static int lba_capacity_is_ok (struct hd_driveid *id) return 0; /* lba_capacity value may be bad */ } -static int idedisk_start_tag(ide_drive_t *drive, struct request *rq) -{ - unsigned long flags; - int ret = 1; - - spin_lock_irqsave(&ide_lock, flags); - - if (ata_pending_commands(drive) < drive->queue_depth) - ret = blk_queue_start_tag(drive->queue, rq); - - spin_unlock_irqrestore(&ide_lock, flags); - return ret; -} - #ifndef CONFIG_IDE_TASKFILE_IO /* @@ -365,18 +353,12 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector if (drive->addressing == 1) { task_ioreg_t tasklets[10]; - if (blk_rq_tagged(rq)) { - tasklets[0] = nsectors.b.low; - tasklets[1] = nsectors.b.high; - tasklets[2] = rq->tag << 3; - tasklets[3] = 0; - } else { - tasklets[0] = 0; - tasklets[1] = 0; - tasklets[2] = nsectors.b.low; - tasklets[3] = nsectors.b.high; - } + pr_debug("%s: LBA=0x%012llx\n", drive->name, block); + tasklets[0] = 0; + tasklets[1] = 0; + tasklets[2] = nsectors.b.low; + tasklets[3] = nsectors.b.high; tasklets[4] = (task_ioreg_t) block; tasklets[5] = (task_ioreg_t) (block>>8); tasklets[6] = (task_ioreg_t) (block>>16); @@ -389,14 +371,6 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector tasklets[9] = (task_ioreg_t)((u64)block >> 40); } #ifdef DEBUG - printk("%s: %sing: LBAsect=%lu, sectors=%ld, " - "buffer=0x%08lx, LBAsect=0x%012lx\n", - drive->name, - rq_data_dir(rq)==READ?"read":"writ", - block, - rq->nr_sectors, - (unsigned long) rq->buffer, - block); printk("%s: 0x%02x%02x 0x%02x%02x%02x%02x%02x%02x\n", drive->name, tasklets[3], tasklets[2], tasklets[9], tasklets[8], tasklets[7], @@ -415,22 +389,8 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector hwif->OUTB(tasklets[6], IDE_HCYL_REG); hwif->OUTB(0x00|drive->select.all,IDE_SELECT_REG); } else { -#ifdef DEBUG - printk("%s: %sing: LBAsect=%llu, sectors=%ld, " - "buffer=0x%08lx\n", - drive->name, - rq_data_dir(rq)==READ?"read":"writ", - (unsigned long long)block, rq->nr_sectors, - (unsigned long) rq->buffer); -#endif - if (blk_rq_tagged(rq)) { - hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG); - hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG); - } else { - hwif->OUTB(0x00, IDE_FEATURE_REG); - hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); - } - + hwif->OUTB(0x00, IDE_FEATURE_REG); + hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(block, IDE_SECTOR_REG); hwif->OUTB(block>>=8, IDE_LCYL_REG); hwif->OUTB(block>>=8, IDE_HCYL_REG); @@ -444,29 +404,16 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector head = track % drive->head; cyl = track / drive->head; - if (blk_rq_tagged(rq)) { - hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG); - hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG); - } else { - hwif->OUTB(0x00, IDE_FEATURE_REG); - hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); - } + pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); + hwif->OUTB(0x00, IDE_FEATURE_REG); + hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG); hwif->OUTB(cyl, IDE_LCYL_REG); hwif->OUTB(cyl>>8, IDE_HCYL_REG); hwif->OUTB(head|drive->select.all,IDE_SELECT_REG); -#ifdef DEBUG - printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n", - drive->name, rq_data_dir(rq)==READ?"read":"writ", cyl, - head, sect, rq->nr_sectors, (unsigned long) rq->buffer); -#endif } if (rq_data_dir(rq) == READ) { -#ifdef CONFIG_BLK_DEV_IDE_TCQ - if (blk_rq_tagged(rq)) - return __ide_dma_queued_read(drive); -#endif if (drive->using_dma && !hwif->ide_dma_read(drive)) return ide_started; @@ -477,10 +424,7 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector return ide_started; } else { ide_startstop_t startstop; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - if (blk_rq_tagged(rq)) - return __ide_dma_queued_write(drive); -#endif + if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive))) return ide_started; @@ -550,8 +494,6 @@ static u8 get_command(ide_drive_t *drive, int cmd, ide_task_t *task) if (cmd == READ) { task->command_type = IDE_DRIVE_TASK_IN; - if (drive->using_tcq) - return lba48 ? WIN_READDMA_QUEUED_EXT : WIN_READDMA_QUEUED; if (drive->using_dma) return lba48 ? WIN_READDMA_EXT : WIN_READDMA; if (drive->mult_count) { @@ -562,8 +504,6 @@ static u8 get_command(ide_drive_t *drive, int cmd, ide_task_t *task) return lba48 ? WIN_READ_EXT : WIN_READ; } else { task->command_type = IDE_DRIVE_TASK_RAW_WRITE; - if (drive->using_tcq) - return lba48 ? WIN_WRITEDMA_QUEUED_EXT : WIN_WRITEDMA_QUEUED; if (drive->using_dma) return lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA; if (drive->mult_count) { @@ -589,23 +529,13 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("CHS=%d/%d/%d, ", cyl, head, sect); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif + pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - } else - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_SECTOR_OFFSET] = sect; args.tfRegister[IDE_LCYL_OFFSET] = cyl; args.tfRegister[IDE_HCYL_OFFSET] = (cyl>>8); @@ -625,23 +555,11 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("LBAsect=%lld, ", block); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif - memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - } else - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; args.tfRegister[IDE_SECTOR_OFFSET] = block; args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); @@ -667,27 +585,12 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u nsectors.all = (u16) rq->nr_sectors; -#ifdef DEBUG - printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ"); - printk("LBAsect=%lld, ", block); - printk("sectors=%ld, ", rq->nr_sectors); - printk("buffer=0x%08lx\n", (unsigned long) rq->buffer); -#endif - memset(&args, 0, sizeof(ide_task_t)); sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors; - if (blk_rq_tagged(rq)) { - args.tfRegister[IDE_FEATURE_OFFSET] = sectors; - args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3; - args.hobRegister[IDE_FEATURE_OFFSET] = sectors >> 8; - args.hobRegister[IDE_NSECTOR_OFFSET] = 0; - } else { - args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; - args.hobRegister[IDE_NSECTOR_OFFSET] = sectors >> 8; - } - + args.tfRegister[IDE_NSECTOR_OFFSET] = sectors; + args.hobRegister[IDE_NSECTOR_OFFSET] = sectors >> 8; args.tfRegister[IDE_SECTOR_OFFSET] = block; /* low lba */ args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */ args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */ @@ -717,12 +620,9 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s return ide_stopped; } - if (drive->using_tcq && idedisk_start_tag(drive, rq)) { - if (!ata_pending_commands(drive)) - BUG(); - - return ide_started; - } + pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", + drive->name, rq_data_dir(rq) == READ ? "read" : "writ", + block, rq->nr_sectors, (unsigned long)rq->buffer); if (hwif->rw_disk) return hwif->rw_disk(drive, rq, block); @@ -811,7 +711,6 @@ ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat) ide_hwif_t *hwif; struct request *rq; u8 err; - int i = (drive->mult_count ? drive->mult_count : 1) * SECTOR_WORDS; err = idedisk_dump_status(drive, msg, stat); @@ -851,22 +750,8 @@ ide_startstop_t idedisk_error (ide_drive_t *drive, const char *msg, u8 stat) rq->errors |= ERROR_RECAL; } } - if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) { - /* - * try_to_flush_leftover_data() is invoked in response to - * a drive unexpectedly having its DRQ_STAT bit set. As - * an alternative to resetting the drive, this routine - * tries to clear the condition by read a sector's worth - * of data from the drive. Of course, this may not help - * if the drive is *waiting* for data from *us*. - */ - while (i > 0) { - u32 buffer[16]; - unsigned int wcount = (i > 16) ? 16 : i; - i -= wcount; - taskfile_input_data(drive, buffer, wcount); - } - } + if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) + try_to_flush_leftover_data(drive); if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) { /* force an abort */ hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); @@ -963,7 +848,6 @@ static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive return addr; } -#ifdef CONFIG_IDEDISK_STROKE /* * Sets maximum virtual LBA address of the drive. * Returns new maximum virtual LBA address (> 0) or 0 on failure. @@ -1032,8 +916,6 @@ static unsigned long long idedisk_set_max_address_ext(ide_drive_t *drive, unsign return addr_set; } -#endif /* CONFIG_IDEDISK_STROKE */ - static unsigned long long sectors_to_MB(unsigned long long n) { n <<= 9; /* make it bytes */ @@ -1080,7 +962,10 @@ static inline void idedisk_check_hpa(ide_drive_t *drive) drive->name, capacity, sectors_to_MB(capacity), set_max, sectors_to_MB(set_max)); -#ifdef CONFIG_IDEDISK_STROKE + + if (!drive->stroke) + return; + if (lba48) set_max = idedisk_set_max_address_ext(drive, set_max); else @@ -1090,7 +975,6 @@ static inline void idedisk_check_hpa(ide_drive_t *drive) printk(KERN_INFO "%s: Host Protected Area disabled.\n", drive->name); } -#endif } /* @@ -1403,34 +1287,6 @@ static int set_acoustic (ide_drive_t *drive, int arg) return 0; } -#ifdef CONFIG_BLK_DEV_IDE_TCQ -static int set_using_tcq(ide_drive_t *drive, int arg) -{ - int ret; - - if (!drive->driver) - return -EPERM; - if (arg == drive->queue_depth && drive->using_tcq) - return 0; - - /* - * set depth, but check also id for max supported depth - */ - drive->queue_depth = arg ? arg : 1; - if (drive->id) { - if (drive->queue_depth > drive->id->queue_depth + 1) - drive->queue_depth = drive->id->queue_depth + 1; - } - - if (arg) - ret = __ide_dma_queued_on(drive); - else - ret = __ide_dma_queued_off(drive); - - return ret ? -EIO : 0; -} -#endif - /* * drive->addressing: * 0: 28-bit @@ -1466,9 +1322,6 @@ static void idedisk_add_settings(ide_drive_t *drive) ide_add_setting(drive, "acoustic", SETTING_RW, HDIO_GET_ACOUSTIC, HDIO_SET_ACOUSTIC, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic); ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL); ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL); -#ifdef CONFIG_BLK_DEV_IDE_TCQ - ide_add_setting(drive, "using_tcq", SETTING_RW, HDIO_GET_QDMA, HDIO_SET_QDMA, TYPE_BYTE, 0, IDE_MAX_TAG, 1, 1, &drive->using_tcq, set_using_tcq); -#endif } /* @@ -1679,11 +1532,6 @@ static void idedisk_setup (ide_drive_t *drive) drive->wcache = 1; write_cache(drive, 1); - -#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT - if (drive->using_dma) - __ide_dma_queued_on(drive); -#endif } static void ide_cacheflush_p(ide_drive_t *drive) diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 4f44c2976..19ae46dc0 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -513,9 +513,7 @@ int __ide_dma_off_quietly (ide_drive_t *drive) if (HWIF(drive)->ide_dma_host_off(drive)) return 1; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - __ide_dma_queued_off(drive); -#endif + return 0; } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index ae2d5b912..56fec5ca1 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1482,7 +1482,7 @@ static int idefloppy_get_capacity (ide_drive_t *drive) ** */ -static int idefloppy_get_format_capacities(ide_drive_t *drive, int *arg) +static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg) { idefloppy_pc_t pc; idefloppy_capacity_header_t *header; @@ -1490,7 +1490,7 @@ static int idefloppy_get_format_capacities(ide_drive_t *drive, int *arg) int i, descriptors, blocks, length; int u_array_size; int u_index; - int *argp; + int __user *argp; if (get_user(u_array_size, arg)) return (-EFAULT); @@ -1558,7 +1558,7 @@ static int idefloppy_get_format_capacities(ide_drive_t *drive, int *arg) ** 0x01 - verify media after format. */ -static int idefloppy_begin_format(ide_drive_t *drive, int *arg) +static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg) { int blocks; int length; @@ -1591,7 +1591,7 @@ static int idefloppy_begin_format(ide_drive_t *drive, int *arg) ** the dsc bit, and return either 0 or 65536. */ -static int idefloppy_get_format_progress(ide_drive_t *drive, int *arg) +static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) { idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_pc_t pc; @@ -1945,6 +1945,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, struct block_device *bdev = inode->i_bdev; ide_drive_t *drive = bdev->bd_disk->private_data; idefloppy_floppy_t *floppy = drive->driver_data; + void __user *argp = (void __user *)arg; int err = generic_ide_ioctl(bdev, cmd, arg); int prevent = (arg) ? 1 : 0; idefloppy_pc_t pc; @@ -1972,7 +1973,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED: return 0; case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY: - return idefloppy_get_format_capacities(drive, (int *)arg); + return idefloppy_get_format_capacities(drive, argp); case IDEFLOPPY_IOCTL_FORMAT_START: if (!(file->f_mode & 2)) @@ -1988,7 +1989,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); - err = idefloppy_begin_format(drive, (int *)arg); + err = idefloppy_begin_format(drive, argp); if (err) clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); return err; @@ -1999,7 +2000,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, ** format progress reporting. */ case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: - return idefloppy_get_format_progress(drive, (int *)arg); + return idefloppy_get_format_progress(drive, argp); } return -EINVAL; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 37f95e14b..ff5b16a87 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -97,10 +97,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) if (!end_that_request_first(rq, uptodate, nr_sectors)) { add_disk_randomness(rq->rq_disk); - if (!blk_rq_tagged(rq)) - blkdev_dequeue_request(rq); - else - blk_queue_end_tag(drive->queue, rq); + blkdev_dequeue_request(rq); HWGROUP(drive)->rq = NULL; end_that_request_last(rq); ret = 0; @@ -855,18 +852,7 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) drive->sleep = 0; drive->service_start = jiffies; -queue_next: - if (!ata_can_queue(drive)) { - if (!ata_pending_commands(drive)) - hwgroup->busy = 0; - - break; - } - if (blk_queue_plugged(drive->queue)) { - if (drive->using_tcq) - break; - printk(KERN_ERR "ide: huh? queue was plugged!\n"); break; } @@ -877,7 +863,7 @@ queue_next: */ rq = elv_next_request(drive->queue); if (!rq) { - hwgroup->busy = !!ata_pending_commands(drive); + hwgroup->busy = 0; break; } @@ -900,9 +886,6 @@ queue_next: break; } - if (!rq->bio && ata_pending_commands(drive)) - break; - hwgroup->rq = rq; /* @@ -922,8 +905,6 @@ queue_next: spin_lock_irq(&ide_lock); if (hwif->irq != masked_irq) enable_irq(hwif->irq); - if (startstop == ide_released) - goto queue_next; if (startstop == ide_stopped) hwgroup->busy = 0; } diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 5b5db4781..6b9bcdb6c 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -16,25 +16,9 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include - #include - -#define GENERIC_HD_DATA 0 -#define GENERIC_HD_ERROR 1 -#define GENERIC_HD_NSECTOR 2 -#define GENERIC_HD_SECTOR 3 -#define GENERIC_HD_LCYL 4 -#define GENERIC_HD_HCYL 5 -#define GENERIC_HD_SELECT 6 -#define GENERIC_HD_STATUS 7 - -static int generic_ide_offsets[IDE_NR_PORTS] = { - GENERIC_HD_DATA, GENERIC_HD_ERROR, GENERIC_HD_NSECTOR, - GENERIC_HD_SECTOR, GENERIC_HD_LCYL, GENERIC_HD_HCYL, - GENERIC_HD_SELECT, GENERIC_HD_STATUS, -1, -1 -}; +#include /* Add your devices here :)) */ struct pnp_device_id idepnp_devices[] = { @@ -52,12 +36,11 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0))) return -1; - ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0), - generic_ide_offsets, - (unsigned long) pnp_port_start(dev, 1), - 0, NULL, -// generic_pnp_ide_iops, - pnp_irq(dev, 0)); + memset(&hw, 0, sizeof(hw)); + ide_std_init_ports(&hw, pnp_port_start(dev, 0), + pnp_port_start(dev, 1)); + hw.irq = pnp_irq(dev, 0); + hw.dma = NO_DMA; index = ide_register_hw(&hw, &hwif); @@ -86,11 +69,7 @@ static struct pnp_driver idepnp_driver = { .remove = idepnp_remove, }; - -void pnpide_init(int enable) +void __init pnpide_init(void) { - if(enable) - pnp_register_driver(&idepnp_driver); - else - pnp_unregister_driver(&idepnp_driver); + pnp_register_driver(&idepnp_driver); } diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ed26518c1..4ffaf9016 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -241,17 +241,6 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) drive->media = ide_disk; printk("%s DISK drive\n", (drive->is_flash) ? "CFA" : "ATA" ); QUIRK_LIST(drive); - - /* Initialize queue depth settings */ - drive->queue_depth = 1; -#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEPTH - drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH; -#else - drive->queue_depth = drive->id->queue_depth + 1; -#endif - if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG) - drive->queue_depth = IDE_MAX_TAG; - return; err_misc: @@ -646,8 +635,6 @@ static void hwif_register (ide_hwif_t *hwif) device_register(&hwif->gendev); } -//EXPORT_SYMBOL(hwif_register); - #ifdef CONFIG_PPC static int wait_hwif_ready(ide_hwif_t *hwif) { @@ -690,7 +677,7 @@ static int wait_hwif_ready(ide_hwif_t *hwif) * This routine only knows how to look for drive units 0 and 1 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. */ -void probe_hwif (ide_hwif_t *hwif) +static void probe_hwif(ide_hwif_t *hwif) { unsigned int unit; unsigned long flags; @@ -834,9 +821,7 @@ void probe_hwif (ide_hwif_t *hwif) } } -EXPORT_SYMBOL(probe_hwif); - -int hwif_init (ide_hwif_t *hwif); +static int hwif_init(ide_hwif_t *hwif); int probe_hwif_init (ide_hwif_t *hwif) { probe_hwif(hwif); @@ -871,7 +856,7 @@ EXPORT_SYMBOL(probe_hwif_init); * * This routine detects and reports such situations, but does not fix them. */ -void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) +static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) { ide_hwif_t *m = *match; @@ -884,7 +869,6 @@ void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ *match = new; } -EXPORT_SYMBOL(save_match); #endif /* MAX_HWIFS > 1 */ /* @@ -1231,9 +1215,7 @@ static void init_gendisk (ide_hwif_t *hwif) THIS_MODULE, ata_probe, ata_lock, hwif); } -EXPORT_SYMBOL(init_gendisk); - -int hwif_init (ide_hwif_t *hwif) +static int hwif_init(ide_hwif_t *hwif) { int old_irq, unit; @@ -1301,8 +1283,6 @@ out: return 0; } -EXPORT_SYMBOL(hwif_init); - int ideprobe_init (void) { unsigned int index; diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 4b799d01a..b7e5cb816 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -233,27 +233,6 @@ static int proc_ide_write_config(struct file *file, const char __user *buffer, } #endif /* CONFIG_BLK_DEV_IDEPCI */ } else { /* not pci */ -#if !defined(__mc68000__) && !defined(CONFIG_APUS) - -/* -* Geert Uytterhoeven -* -* unless you can explain me what it really does. -* On m68k, we don't have outw() and outl() yet, -* and I need a good reason to implement it. -* -* BTW, IMHO the main remaining portability problem with the IDE driver -* is that it mixes IO (ioport) and MMIO (iomem) access on different platforms. -* -* I think all accesses should be done using -* -* ide_in[bwl](ide_device_instance, offset) -* ide_out[bwl](ide_device_instance, value, offset) -* -* so the architecture specific code can #define ide_{in,out}[bwl] to the -* appropriate function. -* -*/ switch (r->size) { case 1: hwif->OUTB(val, reg); break; @@ -262,7 +241,6 @@ static int proc_ide_write_config(struct file *file, const char __user *buffer, case 4: hwif->OUTL(val, reg); break; } -#endif /* !__mc68000__ && !CONFIG_APUS */ } } spin_unlock_irqrestore(&ide_lock, flags); @@ -280,7 +258,7 @@ parse_error: goto out1; } -int proc_ide_read_config +static int proc_ide_read_config (char *page, char **start, off_t off, int count, int *eof, void *data) { char *out = page; @@ -317,8 +295,6 @@ int proc_ide_read_config PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_config); - static int proc_ide_read_imodel (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -345,16 +321,13 @@ static int proc_ide_read_imodel case ide_cy82c693: name = "cy82c693"; break; case ide_4drives: name = "4drives"; break; case ide_pmac: name = "mac-io"; break; - case ide_pc9800: name = "pc9800"; break; default: name = "(unknown)"; break; } len = sprintf(page, "%s\n", name); PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_imodel); - -int proc_ide_read_mate +static int proc_ide_read_mate (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_hwif_t *hwif = (ide_hwif_t *) data; @@ -367,9 +340,7 @@ int proc_ide_read_mate PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_mate); - -int proc_ide_read_channel +static int proc_ide_read_channel (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_hwif_t *hwif = (ide_hwif_t *) data; @@ -381,9 +352,7 @@ int proc_ide_read_channel PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_channel); - -int proc_ide_read_identify +static int proc_ide_read_identify (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *)data; @@ -425,9 +394,7 @@ int proc_ide_read_identify PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_identify); - -int proc_ide_read_settings +static int proc_ide_read_settings (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -459,12 +426,10 @@ int proc_ide_read_settings PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_settings); - #define MAX_LEN 30 -int proc_ide_write_settings(struct file *file, const char __user *buffer, - unsigned long count, void *data) +static int proc_ide_write_settings(struct file *file, const char __user *buffer, + unsigned long count, void *data) { ide_drive_t *drive = (ide_drive_t *) data; char name[MAX_LEN + 1]; @@ -555,8 +520,6 @@ parse_error: return -EINVAL; } -EXPORT_SYMBOL(proc_ide_write_settings); - int proc_ide_read_capacity (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -568,8 +531,6 @@ int proc_ide_read_capacity PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_capacity); - int proc_ide_read_geometry (char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -588,7 +549,7 @@ int proc_ide_read_geometry EXPORT_SYMBOL(proc_ide_read_geometry); -int proc_ide_read_dmodel +static int proc_ide_read_dmodel (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -600,9 +561,7 @@ int proc_ide_read_dmodel PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_dmodel); - -int proc_ide_read_driver +static int proc_ide_read_driver (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -614,9 +573,7 @@ int proc_ide_read_driver PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_driver); - -int proc_ide_write_driver +static int proc_ide_write_driver (struct file *file, const char __user *buffer, unsigned long count, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -634,9 +591,7 @@ int proc_ide_write_driver return count; } -EXPORT_SYMBOL(proc_ide_write_driver); - -int proc_ide_read_media +static int proc_ide_read_media (char *page, char **start, off_t off, int count, int *eof, void *data) { ide_drive_t *drive = (ide_drive_t *) data; @@ -660,8 +615,6 @@ int proc_ide_read_media PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } -EXPORT_SYMBOL(proc_ide_read_media); - static ide_proc_entry_t generic_drive_entries[] = { { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, @@ -688,8 +641,6 @@ void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void } } -EXPORT_SYMBOL(ide_add_proc_entries); - void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) { if (!dir || !p) @@ -700,9 +651,7 @@ void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p) } } -EXPORT_SYMBOL(ide_remove_proc_entries); - -void create_proc_ide_drives(ide_hwif_t *hwif) +static void create_proc_ide_drives(ide_hwif_t *hwif) { int d; struct proc_dir_entry *ent; @@ -726,9 +675,7 @@ void create_proc_ide_drives(ide_hwif_t *hwif) } } -EXPORT_SYMBOL(create_proc_ide_drives); - -void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) +static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) { ide_driver_t *driver = drive->driver; @@ -741,8 +688,6 @@ void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) } } -EXPORT_SYMBOL(destroy_proc_ide_device); - void destroy_proc_ide_drives(ide_hwif_t *hwif) { int d; @@ -754,8 +699,6 @@ void destroy_proc_ide_drives(ide_hwif_t *hwif) } } -EXPORT_SYMBOL(destroy_proc_ide_drives); - static ide_proc_entry_t hwif_entries[] = { { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, { "config", S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config, proc_ide_write_config }, @@ -843,13 +786,9 @@ void proc_ide_create(void) entry->proc_fops = &ide_drivers_operations; } -EXPORT_SYMBOL(proc_ide_create); - void proc_ide_destroy(void) { remove_proc_entry("ide/drivers", proc_ide_root); destroy_proc_ide_interfaces(); remove_proc_entry("ide", 0); } - -EXPORT_SYMBOL(proc_ide_destroy); diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 7603f6a56..480426f43 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -2674,7 +2674,7 @@ static idetape_stage_t *idetape_kmalloc_stage (idetape_tape_t *tape) return __idetape_kmalloc_stage(tape, 0, 0); } -static void idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t *stage, const char *buf, int n) +static void idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t *stage, const char __user *buf, int n) { struct idetape_bh *bh = tape->bh; int count; @@ -2701,7 +2701,7 @@ static void idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t tape->bh = bh; } -static void idetape_copy_stage_to_user (idetape_tape_t *tape, char *buf, idetape_stage_t *stage, int n) +static void idetape_copy_stage_to_user (idetape_tape_t *tape, char __user *buf, idetape_stage_t *stage, int n) { struct idetape_bh *bh = tape->bh; int count; @@ -3610,6 +3610,7 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned l { idetape_tape_t *tape = drive->driver_data; idetape_config_t config; + void __user *argp = (void __user *)arg; #if IDETAPE_DEBUG_LOG if (tape->debug_level >= 4) @@ -3617,7 +3618,7 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned l #endif /* IDETAPE_DEBUG_LOG */ switch (cmd) { case 0x0340: - if (copy_from_user ((char *) &config, (char *) arg, sizeof (idetape_config_t))) + if (copy_from_user(&config, argp, sizeof (idetape_config_t))) return -EFAULT; tape->best_dsc_rw_frequency = config.dsc_rw_frequency; tape->max_stages = config.nr_stages; @@ -3625,7 +3626,7 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned l case 0x0350: config.dsc_rw_frequency = (int) tape->best_dsc_rw_frequency; config.nr_stages = tape->max_stages; - if (copy_to_user((char *) arg, (char *) &config, sizeof (idetape_config_t))) + if (copy_to_user(argp, &config, sizeof (idetape_config_t))) return -EFAULT; break; default: @@ -3747,7 +3748,7 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c * will no longer hit performance. * This is not applicable to Onstream. */ -static ssize_t idetape_chrdev_read (struct file *file, char *buf, +static ssize_t idetape_chrdev_read (struct file *file, char __user *buf, size_t count, loff_t *ppos) { ide_drive_t *drive = file->private_data; @@ -3810,7 +3811,7 @@ finish: return actually_read; } -static ssize_t idetape_chrdev_write (struct file *file, const char *buf, +static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, size_t count, loff_t *ppos) { ide_drive_t *drive = file->private_data; @@ -4127,6 +4128,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne struct mtget mtget; struct mtpos mtpos; int block_offset = 0, position = tape->first_frame_position; + void __user *argp = (void __user *)arg; #if IDETAPE_DEBUG_LOG if (tape->debug_level >= 3) @@ -4146,7 +4148,7 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne } switch (cmd) { case MTIOCTOP: - if (copy_from_user((char *) &mtop, (char *) arg, sizeof (struct mtop))) + if (copy_from_user(&mtop, argp, sizeof (struct mtop))) return -EFAULT; return (idetape_mtioctop(drive,mtop.mt_op,mtop.mt_count)); case MTIOCGET: @@ -4157,12 +4159,12 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne if (tape->drv_write_prot) { mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); } - if (copy_to_user((char *) arg,(char *) &mtget, sizeof(struct mtget))) + if (copy_to_user(argp, &mtget, sizeof(struct mtget))) return -EFAULT; return 0; case MTIOCPOS: mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; - if (copy_to_user((char *) arg,(char *) &mtpos, sizeof(struct mtpos))) + if (copy_to_user(argp, &mtpos, sizeof(struct mtpos))) return -EFAULT; return 0; default: diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index c684ad5da..98f4f3e4d 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -201,14 +201,6 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) if (!hwif->ide_dma_read(drive)) return ide_started; break; -#ifdef CONFIG_BLK_DEV_IDE_TCQ - case WIN_READDMA_QUEUED: - case WIN_READDMA_QUEUED_EXT: - return __ide_dma_queued_read(drive); - case WIN_WRITEDMA_QUEUED: - case WIN_WRITEDMA_QUEUED_EXT: - return __ide_dma_queued_write(drive); -#endif default: if (task->handler == NULL) return ide_stopped; @@ -309,38 +301,18 @@ EXPORT_SYMBOL(task_no_data_intr); */ #ifndef CONFIG_IDE_TASKFILE_IO -#define task_map_rq(rq, flags) ide_map_buffer((rq), (flags)) -#define task_unmap_rq(rq, buf, flags) ide_unmap_buffer((rq), (buf), (flags)) - /* * Handler for command with PIO data-in phase, READ */ -/* - * FIXME before 2.4 enable ... - * DATA integrity issue upon error. - */ ide_startstop_t task_in_intr (ide_drive_t *drive) { struct request *rq = HWGROUP(drive)->rq; ide_hwif_t *hwif = HWIF(drive); char *pBuf = NULL; u8 stat; - unsigned long flags; if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),DATA_READY,BAD_R_STAT)) { if (stat & (ERR_STAT|DRQ_STAT)) { -#if 0 - DTF("%s: attempting to recover last " \ - "sector counter status=0x%02x\n", - drive->name, stat); - /* - * Expect a BUG BOMB if we attempt to rewind the - * offset in the BH aka PAGE in the current BLOCK - * segment. This is different than the HOST segment. - */ -#endif - if (!rq->bio) - rq->current_nr_sectors++; return DRIVER(drive)->error(drive, "task_in_intr", stat); } if (!(stat & BUSY_STAT)) { @@ -350,39 +322,13 @@ ide_startstop_t task_in_intr (ide_drive_t *drive) return ide_started; } } -#if 0 - /* - * Holding point for a brain dump of a thought :-/ - */ - - if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) { - DTF("%s: READ attempting to recover last " \ - "sector counter status=0x%02x\n", - drive->name, stat); - rq->current_nr_sectors++; - return DRIVER(drive)->error(drive, "task_in_intr", stat); - } - if (!rq->current_nr_sectors) - if (!DRIVER(drive)->end_request(drive, 1, 0)) - return ide_stopped; - - if (--rq->current_nr_sectors <= 0) - if (!DRIVER(drive)->end_request(drive, 1, 0)) - return ide_stopped; -#endif - - pBuf = task_map_rq(rq, &flags); + pBuf = rq->buffer + task_rq_offset(rq); DTF("Read: %p, rq->current_nr_sectors: %d, stat: %02x\n", pBuf, (int) rq->current_nr_sectors, stat); taskfile_input_data(drive, pBuf, SECTOR_WORDS); - task_unmap_rq(rq, pBuf, &flags); - /* - * FIXME :: We really can not legally get a new page/bh - * regardless, if this is the end of our segment. - * BH walking or segment can only be updated after we have a good - * hwif->INB(IDE_STATUS_REG); return. - */ + + /* FIXME: check drive status */ if (--rq->current_nr_sectors <= 0) if (!DRIVER(drive)->end_request(drive, 1, 0)) return ide_stopped; @@ -407,21 +353,10 @@ ide_startstop_t task_mulin_intr (ide_drive_t *drive) char *pBuf = NULL; unsigned int msect = drive->mult_count; unsigned int nsect; - unsigned long flags; u8 stat; if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),DATA_READY,BAD_R_STAT)) { if (stat & (ERR_STAT|DRQ_STAT)) { - if (!rq->bio) { - rq->current_nr_sectors += drive->mult_count; - /* - * NOTE: could rewind beyond beginning :-/ - */ - } else { - printk(KERN_ERR "%s: MULTI-READ assume all data " \ - "transfered is bad status=0x%02x\n", - drive->name, stat); - } return DRIVER(drive)->error(drive, "task_mulin_intr", stat); } /* no data yet, so wait for another interrupt */ @@ -434,21 +369,16 @@ ide_startstop_t task_mulin_intr (ide_drive_t *drive) nsect = rq->current_nr_sectors; if (nsect > msect) nsect = msect; - pBuf = task_map_rq(rq, &flags); + pBuf = rq->buffer + task_rq_offset(rq); DTF("Multiread: %p, nsect: %d, msect: %d, " \ " rq->current_nr_sectors: %d\n", pBuf, nsect, msect, rq->current_nr_sectors); taskfile_input_data(drive, pBuf, nsect * SECTOR_WORDS); - task_unmap_rq(rq, pBuf, &flags); rq->errors = 0; rq->current_nr_sectors -= nsect; msect -= nsect; - /* - * FIXME :: We really can not legally get a new page/bh - * regardless, if this is the end of our segment. - * BH walking or segment can only be updated after we have a - * good hwif->INB(IDE_STATUS_REG); return. - */ + + /* FIXME: check drive status */ if (!rq->current_nr_sectors) { if (!DRIVER(drive)->end_request(drive, 1, 0)) return ide_stopped; @@ -467,8 +397,6 @@ EXPORT_SYMBOL(task_mulin_intr); */ ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq) { - char *pBuf = NULL; - unsigned long flags; ide_startstop_t startstop; if (ide_wait_stat(&startstop, drive, DATA_READY, @@ -479,10 +407,8 @@ ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq) return startstop; } /* For Write_sectors we need to stuff the first sector */ - pBuf = task_map_rq(rq, &flags); - taskfile_output_data(drive, pBuf, SECTOR_WORDS); + taskfile_output_data(drive, rq->buffer + task_rq_offset(rq), SECTOR_WORDS); rq->current_nr_sectors--; - task_unmap_rq(rq, pBuf, &flags); return ide_started; } @@ -498,14 +424,9 @@ ide_startstop_t task_out_intr (ide_drive_t *drive) ide_hwif_t *hwif = HWIF(drive); struct request *rq = HWGROUP(drive)->rq; char *pBuf = NULL; - unsigned long flags; u8 stat; if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), DRIVE_READY, drive->bad_wstat)) { - DTF("%s: WRITE attempting to recover last " \ - "sector counter status=0x%02x\n", - drive->name, stat); - rq->current_nr_sectors++; return DRIVER(drive)->error(drive, "task_out_intr", stat); } /* @@ -517,11 +438,10 @@ ide_startstop_t task_out_intr (ide_drive_t *drive) return ide_stopped; if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) { rq = HWGROUP(drive)->rq; - pBuf = task_map_rq(rq, &flags); + pBuf = rq->buffer + task_rq_offset(rq); DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors); taskfile_output_data(drive, pBuf, SECTOR_WORDS); - task_unmap_rq(rq, pBuf, &flags); rq->errors = 0; rq->current_nr_sectors--; } @@ -532,28 +452,11 @@ ide_startstop_t task_out_intr (ide_drive_t *drive) EXPORT_SYMBOL(task_out_intr); -#undef ALTERNATE_STATE_DIAGRAM_MULTI_OUT - ide_startstop_t pre_task_mulout_intr (ide_drive_t *drive, struct request *rq) { -#ifdef ALTERNATE_STATE_DIAGRAM_MULTI_OUT - ide_hwif_t *hwif = HWIF(drive); - char *pBuf = NULL; - unsigned int nsect = 0, msect = drive->mult_count; - u8 stat; - unsigned long flags; -#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */ - ide_task_t *args = rq->special; ide_startstop_t startstop; -#if 0 - /* - * assign private copy for multi-write - */ - memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request)); -#endif - if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %s\n", @@ -561,31 +464,6 @@ ide_startstop_t pre_task_mulout_intr (ide_drive_t *drive, struct request *rq) drive->addressing ? "MULTWRITE_EXT" : "MULTWRITE"); return startstop; } -#ifdef ALTERNATE_STATE_DIAGRAM_MULTI_OUT - - do { - nsect = rq->current_nr_sectors; - if (nsect > msect) - nsect = msect; - pBuf = task_map_rq(rq, &flags); - DTF("Pre-Multiwrite: %p, nsect: %d, msect: %d, " \ - "rq->current_nr_sectors: %ld\n", - pBuf, nsect, msect, rq->current_nr_sectors); - msect -= nsect; - taskfile_output_data(drive, pBuf, nsect * SECTOR_WORDS); - task_unmap_rq(rq, pBuf, &flags); - rq->current_nr_sectors -= nsect; - if (!rq->current_nr_sectors) { - if (!DRIVER(drive)->end_request(drive, 1, 0)) - if (!rq->bio) { - stat = hwif->INB(IDE_STATUS_REG); - return ide_stopped; - } - } - } while (msect); - rq->errors = 0; - return ide_started; -#else /* ! ALTERNATE_STATE_DIAGRAM_MULTI_OUT */ if (!(drive_is_ready(drive))) { int i; for (i=0; i<100; i++) { @@ -599,14 +477,10 @@ ide_startstop_t pre_task_mulout_intr (ide_drive_t *drive, struct request *rq) * move the DATA-TRANSFER T-Bar as BSY != 0. */ return args->handler(drive); -#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */ } EXPORT_SYMBOL(pre_task_mulout_intr); -/* - * FIXME before enabling in 2.4 ... DATA integrity issue upon error. - */ /* * Handler for command write multiple * Called directly from execute_drive_cmd for the first bunch of sectors, @@ -618,49 +492,17 @@ ide_startstop_t task_mulout_intr (ide_drive_t *drive) u8 stat = hwif->INB(IDE_STATUS_REG); struct request *rq = HWGROUP(drive)->rq; char *pBuf = NULL; - ide_startstop_t startstop = ide_stopped; unsigned int msect = drive->mult_count; unsigned int nsect; - unsigned long flags; - /* - * (ks/hs): Handle last IRQ on multi-sector transfer, - * occurs after all data was sent in this chunk - */ - if (rq->current_nr_sectors == 0) { + if (!OK_STAT(stat, DATA_READY, BAD_R_STAT) || !rq->current_nr_sectors) { if (stat & (ERR_STAT|DRQ_STAT)) { - if (!rq->bio) { - rq->current_nr_sectors += drive->mult_count; - /* - * NOTE: could rewind beyond beginning :-/ - */ - } else { - printk(KERN_ERR "%s: MULTI-WRITE assume all data " \ - "transfered is bad status=0x%02x\n", - drive->name, stat); - } return DRIVER(drive)->error(drive, "task_mulout_intr", stat); } - if (!rq->bio) + /* Handle last IRQ, occurs after all data was sent. */ + if (!rq->current_nr_sectors) { DRIVER(drive)->end_request(drive, 1, 0); - return startstop; - } - /* - * DON'T be lazy code the above and below togather !!! - */ - if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) { - if (stat & (ERR_STAT|DRQ_STAT)) { - if (!rq->bio) { - rq->current_nr_sectors += drive->mult_count; - /* - * NOTE: could rewind beyond beginning :-/ - */ - } else { - printk("%s: MULTI-WRITE assume all data " \ - "transfered is bad status=0x%02x\n", - drive->name, stat); - } - return DRIVER(drive)->error(drive, "task_mulout_intr", stat); + return ide_stopped; } /* no data yet, so wait for another interrupt */ if (HWGROUP(drive)->handler == NULL) @@ -668,7 +510,6 @@ ide_startstop_t task_mulout_intr (ide_drive_t *drive) return ide_started; } -#ifndef ALTERNATE_STATE_DIAGRAM_MULTI_OUT if (HWGROUP(drive)->handler != NULL) { unsigned long lflags; spin_lock_irqsave(&ide_lock, lflags); @@ -676,26 +517,20 @@ ide_startstop_t task_mulout_intr (ide_drive_t *drive) del_timer(&HWGROUP(drive)->timer); spin_unlock_irqrestore(&ide_lock, lflags); } -#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */ do { nsect = rq->current_nr_sectors; if (nsect > msect) nsect = msect; - pBuf = task_map_rq(rq, &flags); + pBuf = rq->buffer + task_rq_offset(rq); DTF("Multiwrite: %p, nsect: %d, msect: %d, " \ "rq->current_nr_sectors: %ld\n", pBuf, nsect, msect, rq->current_nr_sectors); msect -= nsect; taskfile_output_data(drive, pBuf, nsect * SECTOR_WORDS); - task_unmap_rq(rq, pBuf, &flags); rq->current_nr_sectors -= nsect; - /* - * FIXME :: We really can not legally get a new page/bh - * regardless, if this is the end of our segment. - * BH walking or segment can only be updated after we - * have a good hwif->INB(IDE_STATUS_REG); return. - */ + + /* FIXME: check drive status */ if (!rq->current_nr_sectors) { if (!DRIVER(drive)->end_request(drive, 1, 0)) if (!rq->bio) @@ -1011,6 +846,12 @@ int ide_diag_taskfile (ide_drive_t *drive, ide_task_t *args, unsigned long data_ else rq.nr_sectors = data_size / SECTOR_SIZE; + if (!rq.nr_sectors) { + printk(KERN_ERR "%s: in/out command without data\n", + drive->name); + return -EFAULT; + } + rq.hard_nr_sectors = rq.nr_sectors; rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors; } @@ -1495,9 +1336,6 @@ ide_startstop_t flagged_task_in_intr (ide_drive_t *drive) char *pBuf = NULL; int retries = 5; - if (rq->current_nr_sectors == 0) - return DRIVER(drive)->error(drive, "flagged_task_in_intr (no data requested)", stat); - if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) { if (stat & ERR_STAT) { return DRIVER(drive)->error(drive, "flagged_task_in_intr", stat); @@ -1544,9 +1382,6 @@ ide_startstop_t flagged_task_mulin_intr (ide_drive_t *drive) int retries = 5; unsigned int msect, nsect; - if (rq->current_nr_sectors == 0) - return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (no data requested)", stat); - msect = drive->mult_count; if (msect == 0) return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (multimode not set)", stat); @@ -1598,14 +1433,8 @@ ide_startstop_t flagged_task_mulin_intr (ide_drive_t *drive) */ ide_startstop_t flagged_pre_task_out_intr (ide_drive_t *drive, struct request *rq) { - ide_hwif_t *hwif = HWIF(drive); - u8 stat = hwif->INB(IDE_STATUS_REG); ide_startstop_t startstop; - if (!rq->current_nr_sectors) { - return DRIVER(drive)->error(drive, "flagged_pre_task_out_intr (write data not specified)", stat); - } - if (ide_wait_stat(&startstop, drive, DATA_READY, BAD_W_STAT, WAIT_DRQ)) { printk(KERN_ERR "%s: No DRQ bit after issuing write command.\n", drive->name); @@ -1667,9 +1496,6 @@ ide_startstop_t flagged_pre_task_mulout_intr (ide_drive_t *drive, struct request ide_startstop_t startstop; unsigned int msect, nsect; - if (!rq->current_nr_sectors) - return DRIVER(drive)->error(drive, "flagged_pre_task_mulout_intr (write data not specified)", stat); - msect = drive->mult_count; if (msect == 0) return DRIVER(drive)->error(drive, "flagged_pre_task_mulout_intr (multimode not set)", stat); diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index bc60dfb78..2714aa1a3 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -188,7 +188,6 @@ int noautodma = 1; #endif EXPORT_SYMBOL(noautodma); -EXPORT_SYMBOL(ide_bus_type); /* * This is declared extern in ide.h, for access by other IDE modules: @@ -554,8 +553,6 @@ control_region_busy: return -EBUSY; } -EXPORT_SYMBOL(ide_hwif_request_regions); - /** * ide_hwif_release_regions - free IDE resources * @@ -584,8 +581,6 @@ void ide_hwif_release_regions(ide_hwif_t *hwif) release_region(hwif->io_ports[i], 1); } -EXPORT_SYMBOL(ide_hwif_release_regions); - /* restore hwif to a sane state */ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) { @@ -936,8 +931,6 @@ void ide_setup_ports ( hw_regs_t *hw, */ } -EXPORT_SYMBOL(ide_setup_ports); - /* * Register an IDE interface, specifying exactly the registers etc * Set init=1 iff calling before probes have taken place. @@ -998,7 +991,6 @@ EXPORT_SYMBOL(ide_register_hw); */ DECLARE_MUTEX(ide_setting_sem); -EXPORT_SYMBOL(ide_setting_sem); /** * ide_add_setting - add an ide setting option @@ -1091,26 +1083,6 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) kfree(setting); } -/** - * ide_remove_setting - remove an ide setting option - * @drive: drive to use - * @name: setting name - * - * Removes the setting named from the device if it is present. - * The function takes the settings_lock to protect against - * parallel changes. This function must not be called from IRQ - * context. - */ - -void ide_remove_setting (ide_drive_t *drive, char *name) -{ - down(&ide_setting_sem); - __ide_remove_setting(drive, name); - up(&ide_setting_sem); -} - -EXPORT_SYMBOL(ide_remove_setting); - /** * ide_find_setting_by_ioctl - find a drive specific ioctl * @drive: drive to scan @@ -1292,8 +1264,6 @@ int ide_write_setting (ide_drive_t *drive, ide_settings_t *setting, int val) return 0; } -EXPORT_SYMBOL(ide_write_setting); - static int set_io_32bit(ide_drive_t *drive, int arg) { drive->io_32bit = arg; @@ -1421,8 +1391,6 @@ abort: return 1; } -EXPORT_SYMBOL(ide_replace_subdriver); - int ata_attach(ide_drive_t *drive) { struct list_head *p; @@ -1447,8 +1415,6 @@ int ata_attach(ide_drive_t *drive) return 1; } -EXPORT_SYMBOL(ata_attach); - static int generic_ide_suspend(struct device *dev, u32 state) { ide_drive_t *drive = dev->driver_data; @@ -1806,7 +1772,7 @@ int __init ide_setup (char *s) if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) { const char *hd_words[] = { "none", "noprobe", "nowerr", "cdrom", "serialize", - "autotune", "noautotune", "minus8", "swapdata", "bswap", + "autotune", "noautotune", "stroke", "swapdata", "bswap", "minus11", "remap", "remap63", "scsi", NULL }; unit = s[2] - 'a'; hw = unit / MAX_DRIVES; @@ -1840,6 +1806,9 @@ int __init ide_setup (char *s) case -7: /* "noautotune" */ drive->autotune = IDE_TUNE_NOAUTO; goto done; + case -8: /* stroke */ + drive->stroke = 1; + goto done; case -9: /* "swapdata" */ case -10: /* "bswap" */ drive->bswap = 1; @@ -2034,6 +2003,7 @@ done: return 1; } +extern void pnpide_init(void); extern void h8300_ide_init(void); /* @@ -2100,12 +2070,9 @@ static void __init probe_for_hwifs (void) buddha_init(); } #endif /* CONFIG_BLK_DEV_BUDDHA */ -#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) - { - extern void pnpide_init(int enable); - pnpide_init(1); - } -#endif /* CONFIG_BLK_DEV_IDEPNP */ +#ifdef CONFIG_BLK_DEV_IDEPNP + pnpide_init(); +#endif #ifdef CONFIG_H8300 h8300_ide_init(); #endif @@ -2243,9 +2210,6 @@ int ide_unregister_subdriver (ide_drive_t *drive) up(&ide_setting_sem); return 1; } -#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE) - pnpide_init(0); -#endif /* CONFIG_BLK_DEV_IDEPNP */ #ifdef CONFIG_PROC_FS ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc); ide_remove_proc_entries(drive->proc, generic_subdriver_entries); diff --git a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c index 0addbae18..73e833d0f 100644 --- a/drivers/ide/legacy/pdc4030.c +++ b/drivers/ide/legacy/pdc4030.c @@ -756,12 +756,6 @@ static ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, BUG_ON(rq->nr_sectors > 127); -#ifdef DEBUG - printk(KERN_DEBUG "%s: %sing: LBAsect=%lu, sectors=%lu\n", - drive->name, rq_data_dir(rq) ? "writ" : "read", - block, rq->nr_sectors); -#endif - #ifndef CONFIG_IDE_TASKFILE_IO if (IDE_CONTROL_REG) hwif->OUTB(drive->ctl, IDE_CONTROL_REG); diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 0c3b227fe..b032d2459 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -409,7 +409,7 @@ static int aec62xx_irq_timeout (ide_drive_t *drive) return 0; } -static unsigned int __init init_chipset_aec62xx (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) { int bus_speed = system_bus_clock(); @@ -435,7 +435,7 @@ static unsigned int __init init_chipset_aec62xx (struct pci_dev *dev, const char return dev->irq; } -static void __init init_hwif_aec62xx (ide_hwif_t *hwif) +static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) { hwif->autodma = 0; hwif->tuneproc = &aec62xx_tune_drive; @@ -468,7 +468,7 @@ static void __init init_hwif_aec62xx (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } -static void __init init_dma_aec62xx (ide_hwif_t *hwif, unsigned long dmabase) +static void __devinit init_dma_aec62xx(ide_hwif_t *hwif, unsigned long dmabase) { struct pci_dev *dev = hwif->pci_dev; @@ -490,12 +490,12 @@ static void __init init_dma_aec62xx (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static void __init init_setup_aec62xx (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) { ide_setup_pci_device(dev, d); } -static void __init init_setup_aec6x80 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d) { unsigned long bar4reg = pci_resource_start(dev, 4); diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index eb51201ab..2a343679a 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -38,7 +38,7 @@ #include -#include "alim15x3.h" +#define DISPLAY_ALI_TIMINGS /* * ALi devices are not plug in. Otherwise these static values would @@ -853,6 +853,16 @@ static void __init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } +static ide_pci_device_t ali15x3_chipset __devinitdata = { + .name = "ALI15X3", + .init_chipset = init_chipset_ali15x3, + .init_hwif = init_hwif_ali15x3, + .init_dma = init_dma_ali15x3, + .channels = 2, + .autodma = AUTODMA, + .bootable = ON_BOARD, +}; + /** * alim15x3_init_one - set up an ALi15x3 IDE controller * @dev: PCI device to set up @@ -863,8 +873,8 @@ static void __init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &ali15x3_chipsets[id->driver_data]; - + ide_pci_device_t *d = &ali15x3_chipset; + if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL)) printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 1f4d08425..06b00a3c3 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -586,7 +586,7 @@ static int cmd646_1_ide_dma_end (ide_drive_t *drive) return (dma_stat & 7) != 4; } -static unsigned int __init init_chipset_cmd64x (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const char *name) { u32 class_rev = 0; u8 mrdmode = 0; @@ -674,7 +674,7 @@ static unsigned int __init init_chipset_cmd64x (struct pci_dev *dev, const char return 0; } -static unsigned int __init ata66_cmd64x (ide_hwif_t *hwif) +static unsigned int __devinit ata66_cmd64x(ide_hwif_t *hwif) { u8 ata66 = 0, mask = (hwif->channel) ? 0x02 : 0x01; @@ -689,7 +689,7 @@ static unsigned int __init ata66_cmd64x (ide_hwif_t *hwif) return (ata66 & mask) ? 1 : 0; } -static void __init init_hwif_cmd64x (ide_hwif_t *hwif) +static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; unsigned int class_rev; diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 588ac3a00..8ddd2cea5 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -51,7 +51,7 @@ #include #include -#include "cs5520.h" +#define DISPLAY_CS5520_TIMINGS #if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS) #include @@ -251,7 +251,24 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif) hwif->drives[0].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma; } - + +#define DECLARE_CS_DEV(name_str) \ + { \ + .name = name_str, \ + .init_chipset = init_chipset_cs5520, \ + .init_setup_dma = cs5520_init_setup_dma, \ + .init_hwif = init_hwif_cs5520, \ + .channels = 2, \ + .autodma = AUTODMA, \ + .bootable = ON_BOARD, \ + .flags = IDEPCI_FLAG_ISA_PORTS, \ + } + +static ide_pci_device_t cyrix_chipsets[] __devinitdata = { + /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), + /* 1 */ DECLARE_CS_DEV("Cyrix 5520") +}; + /* * The 5510/5520 are a bit weird. They don't quite set up the way * the PCI helper layer expects so we must do much of the set up diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 19c97e89a..b63e2d611 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -31,7 +31,7 @@ #include #include -#include "cs5530.h" +#define DISPLAY_CS5530_TIMINGS #if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS) #include @@ -404,9 +404,19 @@ static void __init init_hwif_cs5530 (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } +static ide_pci_device_t cs5530_chipset __devinitdata = { + .name = "CS5530", + .init_chipset = init_chipset_cs5530, + .init_hwif = init_hwif_cs5530, + .channels = 2, + .autodma = AUTODMA, + .bootable = ON_BOARD, + .flags = IDEPCI_FLAG_FORCE_MASTER, +}; + static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &cs5530_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &cs5530_chipset); return 0; } diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index c33cd8ee3..f9c9ab664 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -235,7 +235,7 @@ no_dma_set: */ #define HPT34X_PCI_INIT_REG 0x80 -static unsigned int __init init_chipset_hpt34x (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const char *name) { int i = 0; unsigned long hpt34xIoBase = pci_resource_start(dev, 4); @@ -289,7 +289,7 @@ static unsigned int __init init_chipset_hpt34x (struct pci_dev *dev, const char return dev->irq; } -static void __init init_hwif_hpt34x (ide_hwif_t *hwif) +static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) { u16 pcicmd = 0; diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 5ca4a581f..77bc20861 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -795,7 +795,7 @@ static int hpt370_busproc(ide_drive_t * drive, int state) return 0; } -static int __init init_hpt37x(struct pci_dev *dev) +static int __devinit init_hpt37x(struct pci_dev *dev) { int adjust, i; u16 freq; @@ -923,7 +923,7 @@ init_hpt37X_done: return 0; } -static int __init init_hpt366 (struct pci_dev *dev) +static int __devinit init_hpt366(struct pci_dev *dev) { u32 reg1 = 0; u8 drive_fast = 0; @@ -958,7 +958,7 @@ static int __init init_hpt366 (struct pci_dev *dev) return 0; } -static unsigned int __init init_chipset_hpt366 (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name) { int ret = 0; u8 test = 0; @@ -1004,7 +1004,7 @@ static unsigned int __init init_chipset_hpt366 (struct pci_dev *dev, const char return dev->irq; } -static void __init init_hwif_hpt366 (ide_hwif_t *hwif) +static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; u8 ata66 = 0, regmask = (hwif->channel) ? 0x01 : 0x02; @@ -1116,7 +1116,7 @@ static void __init init_hwif_hpt366 (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } -static void __init init_dma_hpt366 (ide_hwif_t *hwif, unsigned long dmabase) +static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) { u8 masterdma = 0, slavedma = 0; u8 dma_new = 0, dma_old = 0; @@ -1151,7 +1151,7 @@ static void __init init_dma_hpt366 (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static void __init init_setup_hpt374 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d) { struct pci_dev *findev = NULL; @@ -1176,12 +1176,12 @@ static void __init init_setup_hpt374 (struct pci_dev *dev, ide_pci_device_t *d) ide_setup_pci_device(dev, d); } -static void __init init_setup_hpt37x (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d) { ide_setup_pci_device(dev, d); } -static void __init init_setup_hpt366 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) { struct pci_dev *findev = NULL; u8 pin1 = 0, pin2 = 0; diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 1809edddb..a5b6e7e5c 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c @@ -25,8 +25,6 @@ #include -#include "ns87415.h" - static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; /* @@ -217,9 +215,17 @@ static void __init init_hwif_ns87415 (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } +static ide_pci_device_t ns87415_chipset __devinitdata = { + .name = "NS87415", + .init_hwif = init_hwif_ns87415, + .channels = 2, + .autodma = AUTODMA, + .bootable = ON_BOARD, +}; + static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &ns87415_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &ns87415_chipset); return 0; } diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index fbc0bd81e..f493b29ce 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -404,7 +404,7 @@ static void __devinit apple_kiwi_init(struct pci_dev *pdev) } #endif /* CONFIG_PPC_PMAC */ -static unsigned int __init init_chipset_pdcnew (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const char *name) { if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, @@ -429,7 +429,7 @@ static unsigned int __init init_chipset_pdcnew (struct pci_dev *dev, const char return dev->irq; } -static void __init init_hwif_pdc202new (ide_hwif_t *hwif) +static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) { hwif->autodma = 0; @@ -457,12 +457,12 @@ static void __init init_hwif_pdc202new (ide_hwif_t *hwif) #endif /* PDC202_DEBUG_CABLE */ } -static void __init init_setup_pdcnew (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) { ide_setup_pci_device(dev, d); } -static void __init init_setup_pdc20270 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d) { struct pci_dev *findev = NULL; @@ -488,7 +488,7 @@ static void __init init_setup_pdc20270 (struct pci_dev *dev, ide_pci_device_t *d ide_setup_pci_device(dev, d); } -static void __init init_setup_pdc20276 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d) { if ((dev->bus->self) && (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 99fbe04ec..cf6082ad7 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -670,7 +670,7 @@ static int pdc202xx_tristate (ide_drive_t * drive, int state) return 0; } -static unsigned int __init init_chipset_pdc202xx (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) { if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, @@ -715,7 +715,7 @@ static unsigned int __init init_chipset_pdc202xx (struct pci_dev *dev, const cha return dev->irq; } -static void __init init_hwif_pdc202xx (ide_hwif_t *hwif) +static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) { hwif->autodma = 0; hwif->tuneproc = &config_chipset_for_pio; @@ -755,7 +755,7 @@ static void __init init_hwif_pdc202xx (ide_hwif_t *hwif) #endif /* PDC202_DEBUG_CABLE */ } -static void __init init_dma_pdc202xx (ide_hwif_t *hwif, unsigned long dmabase) +static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase) { u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; @@ -807,7 +807,7 @@ static void __init init_dma_pdc202xx (ide_hwif_t *hwif, unsigned long dmabase) ide_setup_dma(hwif, dmabase, 8); } -static void __init init_setup_pdc202ata4 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d) { if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { u8 irq = 0, irq2 = 0; @@ -837,7 +837,7 @@ static void __init init_setup_pdc202ata4 (struct pci_dev *dev, ide_pci_device_t ide_setup_pci_device(dev, d); } -static void __init init_setup_pdc20265 (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t *d) { if ((dev->bus->self) && (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && @@ -866,7 +866,7 @@ static void __init init_setup_pdc20265 (struct pci_dev *dev, ide_pci_device_t *d ide_setup_pci_device(dev, d); } -static void __init init_setup_pdc202xx (struct pci_dev *dev, ide_pci_device_t *d) +static void __devinit init_setup_pdc202xx(struct pci_dev *dev, ide_pci_device_t *d) { ide_setup_pci_device(dev, d); } diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 3d21a5b5e..fec700bba 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -49,9 +49,9 @@ * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, ®40); * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, ®42); * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, ®44); - * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, ®48); + * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, ®48); * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, ®4a); - * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, ®54); + * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, ®54); * * Documentation * Publically available from Intel web site. Errata documentation @@ -432,15 +432,14 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) int w_flag = 0x10 << drive->dn; int u_speed = 0; int sitre; - u16 reg4042, reg44, reg48, reg4a, reg54; - u8 reg55; + u16 reg4042, reg4a; + u8 reg48, reg54, reg55; pci_read_config_word(dev, maslave, ®4042); sitre = (reg4042 & 0x4000) ? 1 : 0; - pci_read_config_word(dev, 0x44, ®44); - pci_read_config_word(dev, 0x48, ®48); + pci_read_config_byte(dev, 0x48, ®48); pci_read_config_word(dev, 0x4a, ®4a); - pci_read_config_word(dev, 0x54, ®54); + pci_read_config_byte(dev, 0x54, ®54); pci_read_config_byte(dev, 0x55, ®55); switch(speed) { @@ -462,30 +461,26 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) if (speed >= XFER_UDMA_0) { if (!(reg48 & u_flag)) - pci_write_config_word(dev, 0x48, reg48|u_flag); + pci_write_config_byte(dev, 0x48, reg48 | u_flag); if (speed == XFER_UDMA_5) { pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); } else { pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } - if (!(reg4a & u_speed)) { - pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); - pci_write_config_word(dev, 0x4a, reg4a|u_speed); - } + if ((reg4a & a_speed) != u_speed) + pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed); if (speed > XFER_UDMA_2) { - if (!(reg54 & v_flag)) { - pci_write_config_word(dev, 0x54, reg54|v_flag); - } - } else { - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); - } + if (!(reg54 & v_flag)) + pci_write_config_byte(dev, 0x54, reg54 | v_flag); + } else + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); } else { if (reg48 & u_flag) - pci_write_config_word(dev, 0x48, reg48 & ~u_flag); + pci_write_config_byte(dev, 0x48, reg48 & ~u_flag); if (reg4a & a_speed) pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); if (reg54 & v_flag) - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); if (reg55 & w_flag) pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } @@ -655,8 +650,8 @@ static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char * Set up the ide_hwif_t for the PIIX interface according to the * capabilities of the hardware. */ - -static void __init init_hwif_piix (ide_hwif_t *hwif) + +static void __devinit init_hwif_piix(ide_hwif_t *hwif) { u8 reg54h = 0, reg55h = 0, ata66 = 0; u8 mask = hwif->channel ? 0xc0 : 0x30; @@ -725,8 +720,8 @@ static void __init init_hwif_piix (ide_hwif_t *hwif) * Enable the xp fixup for the PIIX controller and then perform * a standard ide PCI setup */ - -static void __init init_setup_piix (struct pci_dev *dev, ide_pci_device_t *d) + +static void __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d) { ide_setup_pci_device(dev, d); } @@ -754,8 +749,8 @@ static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_ * Check for the present of 450NX errata #19 and errata #25. If * they are found, disable use of DMA IDE */ - -static void __init piix_check_450nx(void) + +static void __devinit piix_check_450nx(void) { struct pci_dev *pdev = NULL; u16 cfg; diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 78669068d..3405e6a1b 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c @@ -33,8 +33,6 @@ #include -#include "rz1000.h" - static void __init init_hwif_rz1000 (ide_hwif_t *hwif) { u16 reg; @@ -54,15 +52,23 @@ static void __init init_hwif_rz1000 (ide_hwif_t *hwif) } } +static ide_pci_device_t rz1000_chipset __devinitdata = { + .name = "RZ100x", + .init_hwif = init_hwif_rz1000, + .channels = 2, + .autodma = NODMA, + .bootable = ON_BOARD, +}; + static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &rz1000_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &rz1000_chipset); return 0; } static struct pci_device_id rz1000_pci_tbl[] = { { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl); diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 58d1e5874..902408d18 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -29,8 +29,6 @@ #include #include -#include "sc1200.h" - #define SC1200_REV_A 0x00 #define SC1200_REV_B1 0x01 #define SC1200_REV_B3 0x02 @@ -545,9 +543,18 @@ static void __init init_hwif_sc1200 (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } +static ide_pci_device_t sc1200_chipset __devinitdata = { + .name = "SC1200", + .init_chipset = init_chipset_sc1200, + .init_hwif = init_hwif_sc1200, + .channels = 2, + .autodma = AUTODMA, + .bootable = ON_BOARD, +}; + static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sc1200_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &sc1200_chipset); return 0; } diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 5b2ab769b..5a7483ef6 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -31,7 +31,8 @@ #include -#include "siimage.h" +#undef SIIMAGE_VIRTUAL_DMAPIO +#undef SIIMAGE_LARGE_DMA /** * pdev_is_sata - check if device is SATA @@ -812,7 +813,7 @@ static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name) * to 133MHz clocking if the system isn't already set up to do it. */ -static unsigned int __init init_chipset_siimage (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name) { u32 class_rev = 0; u8 tmpbyte = 0; @@ -877,8 +878,8 @@ static unsigned int __init init_chipset_siimage (struct pci_dev *dev, const char * The hardware supports buffered taskfiles and also some rather nice * extended PRD tables. Unfortunately right now we don't. */ - -static void __init init_mmio_iops_siimage (ide_hwif_t *hwif) + +static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; void *addr = pci_get_drvdata(dev); @@ -996,8 +997,8 @@ static int is_dev_seagate_sata(ide_drive_t *drive) * look in we get for setting up the hwif so that we * can get the iops right before using them. */ - -static void __init init_iops_siimage (ide_hwif_t *hwif) + +static void __devinit init_iops_siimage(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; u32 class_rev = 0; @@ -1023,8 +1024,8 @@ static void __init init_iops_siimage (ide_hwif_t *hwif) * Check for the presence of an ATA66 capable cable on the * interface. */ - -static unsigned int __init ata66_siimage (ide_hwif_t *hwif) + +static unsigned int __devinit ata66_siimage(ide_hwif_t *hwif) { unsigned long addr = siimage_selreg(hwif, 0); if (pci_get_drvdata(hwif->pci_dev) == NULL) { @@ -1044,8 +1045,8 @@ static unsigned int __init ata66_siimage (ide_hwif_t *hwif) * requires several custom handlers so we override the default * ide DMA handlers appropriately */ - -static void __init init_hwif_siimage (ide_hwif_t *hwif) + +static void __devinit init_hwif_siimage(ide_hwif_t *hwif) { hwif->autodma = 0; @@ -1092,6 +1093,23 @@ static void __init init_hwif_siimage (ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } +#define DECLARE_SII_DEV(name_str) \ + { \ + .name = name_str, \ + .init_chipset = init_chipset_siimage, \ + .init_iops = init_iops_siimage, \ + .init_hwif = init_hwif_siimage, \ + .channels = 2, \ + .autodma = AUTODMA, \ + .bootable = ON_BOARD, \ + } + +static ide_pci_device_t siimage_chipsets[] __devinitdata = { + /* 0 */ DECLARE_SII_DEV("SiI680"), + /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), + /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") +}; + /** * siimage_init_one - pci layer discovery entry * @dev: PCI device diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 6254eab6d..d06b1fd8c 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -63,7 +63,8 @@ #include #include "ide-timing.h" -#include "sis5513.h" + +#define DISPLAY_SIS_TIMINGS /* registers layout and init values are chipset family dependant */ @@ -944,9 +945,19 @@ static void __init init_hwif_sis5513 (ide_hwif_t *hwif) return; } +static ide_pci_device_t sis5513_chipset __devinitdata = { + .name = "SIS5513", + .init_chipset = init_chipset_sis5513, + .init_hwif = init_hwif_sis5513, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, + .bootable = ON_BOARD, +}; + static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sis5513_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &sis5513_chipset); return 0; } diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 4706ebfba..38bd8077b 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -29,8 +29,6 @@ #include #include -#include "sl82c105.h" - #undef DEBUG #ifdef DEBUG @@ -481,9 +479,20 @@ static void __init init_hwif_sl82c105(ide_hwif_t *hwif) #endif /* CONFIG_BLK_DEV_IDEDMA */ } +static ide_pci_device_t sl82c105_chipset __devinitdata = { + .name = "W82C105", + .init_chipset = init_chipset_sl82c105, + .init_hwif = init_hwif_sl82c105, + .init_dma = init_dma_sl82c105, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, + .bootable = ON_BOARD, +}; + static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &sl82c105_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &sl82c105_chipset); return 0; } diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 784224270..1a0183d1b 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -21,7 +21,7 @@ #include -#include "slc90e66.h" +#define DISPLAY_SLC90E66_TIMINGS #if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS) #include @@ -364,9 +364,19 @@ static void __init init_hwif_slc90e66 (ide_hwif_t *hwif) #endif /* !CONFIG_BLK_DEV_IDEDMA */ } +static ide_pci_device_t slc90e66_chipset __devinitdata = { + .name = "SLC90E66", + .init_chipset = init_chipset_slc90e66, + .init_hwif = init_hwif_slc90e66, + .channels = 2, + .autodma = AUTODMA, + .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, + .bootable = ON_BOARD, +}; + static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &slc90e66_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &slc90e66_chipset); return 0; } diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index fc6186531..52e088e25 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -41,8 +41,6 @@ #include #include -#include "triflex.h" - static struct pci_dev *triflex_dev; #ifdef CONFIG_PROC_FS @@ -217,15 +215,32 @@ static unsigned int __init init_chipset_triflex(struct pci_dev *dev, return 0; } +static ide_pci_device_t triflex_device __devinitdata = { + .name = "TRIFLEX", + .init_chipset = init_chipset_triflex, + .init_hwif = init_hwif_triflex, + .channels = 2, + .autodma = AUTODMA, + .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, + .bootable = ON_BOARD, +}; + static int __devinit triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &triflex_devices[id->driver_data]); + ide_setup_pci_device(dev, &triflex_device); triflex_dev = dev; return 0; } +static struct pci_device_id triflex_pci_tbl[] = { + { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, triflex_pci_tbl); + static struct pci_driver driver = { .name = "TRIFLEX IDE", .id_table = triflex_pci_tbl, diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index c07408908..d482d8310 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -140,8 +140,6 @@ #include -#include "trm290.h" - static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) { ide_hwif_t *hwif = HWIF(drive); @@ -302,7 +300,7 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) /* * Invoked from ide-dma.c at boot time. */ -void __init init_hwif_trm290 (ide_hwif_t *hwif) +void __devinit init_hwif_trm290(ide_hwif_t *hwif) { unsigned int cfgbase = 0; unsigned long flags; @@ -395,9 +393,17 @@ void __init init_hwif_trm290 (ide_hwif_t *hwif) #endif } +static ide_pci_device_t trm290_chipset __devinitdata = { + .name = "TRM290", + .init_hwif = init_hwif_trm290, + .channels = 2, + .autodma = NOAUTODMA, + .bootable = ON_BOARD, +}; + static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &trm290_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &trm290_chipset); return 0; } diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 47c241d26..9aa563300 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -37,7 +37,8 @@ #include #include "ide-timing.h" -#include "via82cxxx.h" + +#define DISPLAY_VIA_TIMINGS #define VIA_IDE_ENABLE 0x40 #define VIA_IDE_CONFIG 0x41 @@ -607,9 +608,19 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } +static ide_pci_device_t via82cxxx_chipset __devinitdata = { + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, + .bootable = ON_BOARD, +}; + static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); + ide_setup_pci_device(dev, &via82cxxx_chipset); return 0; } diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 301011c3c..931464b6c 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c @@ -1061,6 +1061,10 @@ void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache) } nkv = kv->next; + if (kv->prev) + kv->prev->next = NULL; + if (kv->next) + kv->next->prev = NULL; kv->prev = NULL; kv->next = NULL; } @@ -1134,7 +1138,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) /* Make sure the Extended ROM leaf is a multiple of * max_rom in size. */ leaf_size = (cache->len + (csr->max_rom - 1)) & - (csr->max_rom - 1); + ~(csr->max_rom - 1); /* Zero out the unused ROM region */ memset(cache->data + bytes_to_quads(cache->len), 0x00, diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h index e7f1d30c6..e6734263a 100644 --- a/drivers/ieee1394/csr1212.h +++ b/drivers/ieee1394/csr1212.h @@ -38,9 +38,11 @@ #include #include #include +#include +#include -#define CSR1212_MALLOC(size) kmalloc((size), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) -#define CSR1212_FREE(ptr) kfree(ptr) +#define CSR1212_MALLOC(size) vmalloc((size)) +#define CSR1212_FREE(ptr) vfree(ptr) #define CSR1212_BE16_TO_CPU(quad) be16_to_cpu(quad) #define CSR1212_CPU_TO_BE16(quad) cpu_to_be16(quad) #define CSR1212_BE32_TO_CPU(quad) be32_to_cpu(quad) diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index d99ac5dda..95ccc698e 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -89,7 +89,7 @@ #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) static char version[] __devinitdata = - "$Rev: 1198 $ Ben Collins "; + "$Rev: 1224 $ Ben Collins "; struct fragment_info { struct list_head list; @@ -191,7 +191,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev); static void ether1394_iso(struct hpsb_iso *iso); static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr); +static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr); static int ether1394_write(struct hpsb_host *host, int srcid, int destid, quadlet_t *data, u64 addr, size_t len, u16 flags); @@ -431,9 +431,12 @@ static int eth1394_update(struct unit_directory *ud) if (!node) return -ENOMEM; - node_info = kmalloc(sizeof(struct eth1394_node_info), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); + if (!node_info) { + kfree(node); + return -ENOMEM; + } spin_lock_init(&node_info->pdg.lock); INIT_LIST_HEAD(&node_info->pdg.list); @@ -1770,7 +1773,7 @@ static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd { switch(cmd) { case SIOCETHTOOL: - return ether1394_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return ether1394_ethtool_ioctl(dev, ifr->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ case SIOCGMIIREG: /* Read MII PHY register. */ @@ -1782,18 +1785,18 @@ static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd return 0; } -static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { case ETHTOOL_GDRVINFO: { struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO }; strcpy (info.driver, driver_name); - strcpy (info.version, "$Rev: 1198 $"); + strcpy (info.version, "$Rev: 1224 $"); /* FIXME XXX provide sane businfo */ strcpy (info.bus_info, "ieee1394"); if (copy_to_user (useraddr, &info, sizeof (info))) diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 67fc9f7b6..50c403c6c 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c @@ -383,7 +383,7 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, a2sa = a2->start & align_mask; a2ea = (a2->end + alignment -1) & align_mask; - if ((a2sa - a1ea >= size) && (a2sa - start >= size) && (end - a1ea >= size)) { + if ((a2sa - a1ea >= size) && (a2sa - start >= size) && (a2sa > start)) { as->start = max(start, a1ea); as->end = as->start + size; list_add(&as->host_list, entry); diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index 47a6141cb..c502c6e9c 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c @@ -30,7 +30,7 @@ #include "config_roms.h" -static void delayed_reset_bus(unsigned long __reset_info) +static void delayed_reset_bus(void * __reset_info) { struct hpsb_host *host = (struct hpsb_host*)__reset_info; int generation = host->csr.generation + 1; @@ -129,9 +129,6 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, skb_queue_head_init(&h->pending_packet_queue); INIT_LIST_HEAD(&h->addr_space); - init_timer(&h->delayed_reset); - h->delayed_reset.function = delayed_reset_bus; - h->delayed_reset.data = (unsigned long)h; for (i = 2; i < 16; i++) h->csr.gen_timestamp[i] = jiffies - 60 * HZ; @@ -140,6 +137,8 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, atomic_set(&h->generation, 0); + INIT_WORK(&h->delayed_reset, delayed_reset_bus, h); + init_timer(&h->timeout); h->timeout.data = (unsigned long) h; h->timeout.function = abort_timedouts; @@ -188,7 +187,8 @@ void hpsb_remove_host(struct hpsb_host *host) { host->is_shutdown = 1; - del_timer_sync(&host->delayed_reset); + cancel_delayed_work(&host->delayed_reset); + flush_scheduled_work(); host->driver = &dummy_driver; @@ -202,7 +202,7 @@ void hpsb_remove_host(struct hpsb_host *host) int hpsb_update_config_rom_image(struct hpsb_host *host) { - unsigned long reset_time; + unsigned long reset_delay; int next_gen = host->csr.generation + 1; if (!host->update_config_rom) @@ -213,21 +213,21 @@ int hpsb_update_config_rom_image(struct hpsb_host *host) /* Stop the delayed interrupt, we're about to change the config rom and * it would be a waste to do a bus reset twice. */ - del_timer_sync(&host->delayed_reset); + cancel_delayed_work(&host->delayed_reset); /* IEEE 1394a-2000 prohibits using the same generation number * twice in a 60 second period. */ if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ) /* Wait 60 seconds from the last time this generation number was * used. */ - reset_time = (60 * HZ) + host->csr.gen_timestamp[next_gen]; + reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies; else /* Wait 1 second in case some other code wants to change the * Config ROM in the near future. */ - reset_time = jiffies + HZ; + reset_delay = HZ; - /* This will add the timer as well as modify it */ - mod_timer(&host->delayed_reset, reset_time); + PREPARE_WORK(&host->delayed_reset, delayed_reset_bus, host); + schedule_delayed_work(&host->delayed_reset, reset_delay); return 0; } diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h index 000e44cab..739e76840 100644 --- a/drivers/ieee1394/hosts.h +++ b/drivers/ieee1394/hosts.h @@ -66,7 +66,7 @@ struct hpsb_host { struct class_device class_dev; int update_config_rom; - struct timer_list delayed_reset; + struct work_struct delayed_reset; unsigned int config_roms; diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index c6fa4c81c..9a3c58654 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -1033,6 +1034,11 @@ static int hpsbpkt_thread(void *__hi) if (khpsbpkt_kill) break; + if (current->flags & PF_FREEZE) { + refrigerator(0); + continue; + } + while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) { packet = (struct hpsb_packet *)skb->data; diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 9bfd293d1..c912be4b2 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "ieee1394_types.h" @@ -1474,11 +1475,20 @@ static int nodemgr_host_thread(void *__hi) /* Sit and wait for a signal to probe the nodes on the bus. This * happens when we get a bus reset. */ - while (!down_interruptible(&hi->reset_sem) && - !down_interruptible(&nodemgr_serialize)) { + while (1) { unsigned int generation = 0; int i; + if (down_interruptible(&hi->reset_sem) || + down_interruptible(&nodemgr_serialize)) { + if (current->flags & PF_FREEZE) { + refrigerator(0); + continue; + } + printk("NodeMgr: received unexpected signal?!\n" ); + break; + } + if (hi->kill_me) break; diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 88438b58b..afcf7f89e 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -162,7 +162,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) static char version[] __devinitdata = - "$Rev: 1203 $ Ben Collins "; + "$Rev: 1223 $ Ben Collins "; /* Module Parameters */ static int phys_dma = 1; @@ -516,6 +516,12 @@ static void ohci_initialize(struct ti_ohci *ohci) ohci->max_packet_size = 1<<(((reg_read(ohci, OHCI1394_BusOptions)>>12)&0xf)+1); + if (ohci->max_packet_size < 512) { + HPSB_ERR("warning: Invalid max packet size of %d, setting to 512", + ohci->max_packet_size); + ohci->max_packet_size = 512; + } + /* Don't accept phy packets into AR request context */ reg_write(ohci, OHCI1394_LinkControlClear, 0x00000400); diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 624cca549..47de79f21 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c @@ -65,7 +65,7 @@ #include #include "../scsi/scsi.h" -#include "../scsi/hosts.h" +#include #include "csr1212.h" #include "ieee1394.h" @@ -78,7 +78,7 @@ #include "sbp2.h" static char version[] __devinitdata = - "$Rev: 1205 $ Ben Collins "; + "$Rev: 1219 $ Ben Collins "; /* * Module load parameter definitions diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index a9b92c1ed..7a757fc43 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -864,6 +864,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file, return -EFAULT; d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel); + if (d == NULL) return -EFAULT; if ((v.buffer<0) || (v.buffer>d->num_desc)) { PRINT(KERN_ERR, ohci->host->id, @@ -926,6 +927,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file, return -EFAULT; d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel); + if (d == NULL) return -EFAULT; if ((v.buffer<0) || (v.buffer>d->num_desc)) { PRINT(KERN_ERR, ohci->host->id, @@ -1009,6 +1011,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file, return -EFAULT; d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel); + if (d == NULL) return -EFAULT; if ((v.buffer<0) || (v.buffer>d->num_desc)) { PRINT(KERN_ERR, ohci->host->id, @@ -1112,6 +1115,7 @@ static int video1394_ioctl(struct inode *inode, struct file *file, return -EFAULT; d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel); + if (d == NULL) return -EFAULT; if ((v.buffer<0) || (v.buffer>d->num_desc)) { PRINT(KERN_ERR, ohci->host->id, diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index b7862843c..94dece474 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -44,6 +44,13 @@ config INPUT_MOUSEDEV_PSAUX bool "Provide legacy /dev/psaux device" default y depends on INPUT_MOUSEDEV + ---help--- + Say Y here if you want your mouse also be accessible as char device + 10:1 - /dev/psaux. The data available through /dev/psaux is exactly + the same as the data from /dev/input/mice. + + If unsure, say Y. + config INPUT_MOUSEDEV_SCREEN_X int "Horizontal screen resolution" diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c index c31f5abcb..7eabb5f4e 100644 --- a/drivers/input/evbug.c +++ b/drivers/input/evbug.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -35,7 +35,7 @@ #include MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Input driver event debug module"); +MODULE_DESCRIPTION("Input driver event debug module"); MODULE_LICENSE("GPL"); static char evbug_name[] = "evbug"; @@ -67,7 +67,7 @@ static struct input_handle *evbug_connect(struct input_handler *handler, struct static void evbug_disconnect(struct input_handle *handle) { printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); - + input_close_device(handle); kfree(handle); @@ -79,7 +79,7 @@ static struct input_device_id evbug_ids[] = { }; MODULE_DEVICE_TABLE(input, evbug_ids); - + static struct input_handler evbug_handler = { .event = evbug_event, .connect = evbug_connect, diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 4f784c877..3737e5abc 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -126,7 +126,7 @@ static int evdev_open(struct inode * inode, struct file * file) int i = iminor(inode) - EVDEV_MINOR_BASE; int accept_err; - if (i >= EVDEV_MINORS || !evdev_table[i]) + if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) return -ENODEV; if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) @@ -175,7 +175,7 @@ static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count return -EAGAIN; retval = wait_event_interruptible(list->evdev->wait, - list->head != list->tail && list->evdev->exist); + list->head != list->tail || (!list->evdev->exist)); if (retval) return retval; @@ -222,7 +222,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case EVIOCGID: return copy_to_user(p, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0; - + case EVIOCGKEYCODE: if (get_user(t, ip)) return -EFAULT; if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL; @@ -430,7 +430,7 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), dev->dev, "event%d", minor); diff --git a/drivers/input/gameport/cs461x.c b/drivers/input/gameport/cs461x.c index 0ec91ea49..71fcad10c 100644 --- a/drivers/input/gameport/cs461x.c +++ b/drivers/input/gameport/cs461x.c @@ -1,8 +1,8 @@ /* - The all defines and part of code (such as cs461x_*) are - contributed from ALSA 0.5.8 sources. + The all defines and part of code (such as cs461x_*) are + contributed from ALSA 0.5.8 sources. See http://www.alsa-project.org/ for sources - + Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS4610 */ @@ -89,8 +89,8 @@ MODULE_LICENSE("GPL"); #define JSIO_BXOE 0x00000040 #define JSIO_BYOE 0x00000080 -/* - The card initialization code is obfuscated; the module cs461x +/* + The card initialization code is obfuscated; the module cs461x need to be loaded after ALSA modules initialized and something played on the CS 4610 chip (see sources for details of CS4610 initialization code from ALSA) @@ -112,7 +112,7 @@ MODULE_LICENSE("GPL"); #define BA1_DWORD_SIZE (13 * 1024 + 512) #define BA1_MEMORY_COUNT 3 -/* +/* Only one CS461x card is still suppoted; the code requires redesign to avoid this limitatuion. */ @@ -163,7 +163,7 @@ static int cs461x_free(struct pci_dev *pdev) if(port){ gameport_unregister_port(port); kfree(port); - } + } if (ba0) iounmap(ba0); #ifdef CS461X_FULL_MAP if (ba1.name.data0) iounmap(ba1.name.data0); @@ -187,13 +187,13 @@ static unsigned char cs461x_gameport_read(struct gameport *gameport) static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) { unsigned js1, js2, jst; - + js1 = cs461x_peekBA0(BA0_JSC1); js2 = cs461x_peekBA0(BA0_JSC2); jst = cs461x_peekBA0(BA0_JSPT); - - *buttons = (~jst >> 4) & 0x0F; - + + *buttons = (~jst >> 4) & 0x0F; + axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF; axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF; axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF; @@ -228,7 +228,7 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev { int rc; struct gameport* port; - + rc = pci_enable_device(pdev); if (rc) { printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n", @@ -240,7 +240,7 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev #ifdef CS461X_FULL_MAP ba1_addr = pci_resource_start(pdev, 1); #endif - if (ba0_addr == 0 || ba0_addr == ~0 + if (ba0_addr == 0 || ba0_addr == ~0 #ifdef CS461X_FULL_MAP || ba1_addr == 0 || ba1_addr == ~0 #endif @@ -281,7 +281,7 @@ static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_dev memset(port, 0, sizeof(struct gameport)); pci_set_drvdata(pdev, port); - + port->open = cs461x_gameport_open; port->trigger = cs461x_gameport_trigger; port->read = cs461x_gameport_read; @@ -310,7 +310,7 @@ static void __devexit cs461x_pci_remove(struct pci_dev *pdev) { cs461x_free(pdev); } - + static struct pci_driver cs461x_pci_driver = { .name = "CS461x Gameport", .id_table = cs461x_pci_tbl, diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index ec18fb32b..89d469378 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -48,7 +48,7 @@ struct emu { int size; char phys[32]; }; - + static struct pci_device_id emu_tbl[] = { { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ @@ -61,7 +61,7 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id { int ioport, iolen; struct emu *emu; - + if (pci_enable_device(pdev)) return -EBUSY; diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 7cd7deb9c..ff3b620b8 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c @@ -111,7 +111,7 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device pci_set_drvdata(pci, gp); - outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */ + outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */ gameport_register_port(&gp->gameport); diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 431883c5f..b2a68ab2a 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c @@ -168,7 +168,7 @@ int gameport_open(struct gameport *gameport, struct gameport_dev *dev, int mode) return -1; gameport->dev = dev; - + return 0; } diff --git a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c index 8a8adb558..7d1d3832c 100644 --- a/drivers/input/gameport/lightning.c +++ b/drivers/input/gameport/lightning.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -106,7 +106,7 @@ static int l4_cooked_read(struct gameport *gameport, int *axes, int *buttons) result = 0; -fail: outb(L4_SELECT_ANALOG, L4_PORT); +fail: outb(L4_SELECT_ANALOG, L4_PORT); return result; } @@ -126,7 +126,7 @@ static int l4_open(struct gameport *gameport, int mode) static int l4_getcal(int port, int *cal) { int i, result = -1; - + outb(L4_SELECT_ANALOG, L4_PORT); outb(L4_SELECT_DIGITAL + (port >> 2), L4_PORT); @@ -208,7 +208,7 @@ static int l4_calibrate(struct gameport *gameport, int *axes, int *max) return 0; } - + static int __init l4_init(void) { int cal[4] = {255,255,255,255}; @@ -266,7 +266,7 @@ static int __init l4_init(void) if (rev > 0x28) /* on 2.9+ the setcal command works correctly */ l4_setcal(l4->port, cal); - + gameport_register_port(gameport); } diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index 352878953..f31ce0bad 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c @@ -12,18 +12,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -59,7 +59,7 @@ struct ns558 { char phys[32]; char name[32]; }; - + static LIST_HEAD(ns558_list); /* @@ -116,7 +116,7 @@ static void ns558_isa_probe(int io) i = 0; goto out; } -/* +/* * And now find the number of mirrors of the port. */ @@ -292,7 +292,7 @@ void __exit ns558_exit(void) release_region(port->gameport.io & ~(port->size - 1), port->size); kfree(port); break; - + default: break; } diff --git a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c index fa20a3376..02c31b779 100644 --- a/drivers/input/gameport/vortex.c +++ b/drivers/input/gameport/vortex.c @@ -83,7 +83,7 @@ static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32)); if (axes[i] == 0x1fff) axes[i] = -1; } - + return 0; } @@ -122,7 +122,7 @@ static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_i vortex->gameport.driver = vortex; vortex->gameport.fuzz = 64; - + vortex->gameport.read = vortex_read; vortex->gameport.trigger = vortex_trigger; vortex->gameport.cooked_read = vortex_cooked_read; @@ -145,7 +145,7 @@ static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_i vortex->io = vortex->base + id->driver_data; gameport_register_port(&vortex->gameport); - + printk(KERN_INFO "gameport at pci%s speed %d kHz\n", pci_name(dev), vortex->gameport.speed); diff --git a/drivers/input/input.c b/drivers/input/input.c index 41bb52187..73b17418a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -106,7 +106,7 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in } break; - + case EV_ABS: if (code > ABS_MAX || !test_bit(code, dev->absbit)) @@ -144,27 +144,27 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in if (code > MSC_MAX || !test_bit(code, dev->mscbit)) return; - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_LED: - + if (code > LED_MAX || !test_bit(code, dev->ledbit) || !!test_bit(code, dev->led) == value) return; change_bit(code, dev->led); - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_SND: - + if (code > SND_MAX || !test_bit(code, dev->sndbit)) return; - if (dev->event) dev->event(dev, type, code, value); - + if (dev->event) dev->event(dev, type, code, value); + break; case EV_REP: @@ -181,7 +181,7 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in break; } - if (type != EV_SYN) + if (type != EV_SYN) dev->sync = 0; if (dev->grab) @@ -282,11 +282,11 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) if (id->id.vendor != dev->id.vendor) continue; - + if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) if (id->id.product != dev->id.product) continue; - + if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) if (id->id.version != dev->id.version) continue; @@ -351,11 +351,11 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) } if (in_interrupt()) { printk(KERN_ERR "input.c: calling hotplug from interrupt\n"); - return; + return; } if (!current->fs->root) { printk(KERN_WARNING "input.c: calling hotplug without valid filesystem\n"); - return; + return; } if (!(envp = (char **) kmalloc(20 * sizeof(char *), GFP_KERNEL))) { printk(KERN_ERR "input.c: not enough memory allocating hotplug environment\n"); @@ -381,17 +381,17 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) envp[i++] = scratch; scratch += sprintf(scratch, "PRODUCT=%x/%x/%x/%x", - dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; - + dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; + if (dev->name) { envp[i++] = scratch; - scratch += sprintf(scratch, "NAME=%s", dev->name) + 1; + scratch += sprintf(scratch, "NAME=%s", dev->name) + 1; } if (dev->phys) { envp[i++] = scratch; - scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1; - } + scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1; + } SPRINTF_BIT_A(evbit, "EV=", EV_MAX); SPRINTF_BIT_A2(keybit, "KEY=", KEY_MAX, EV_KEY); @@ -506,7 +506,7 @@ void input_register_handler(struct input_handler *handler) input_table[handler->minor >> 5] = handler; list_add_tail(&handler->node, &input_handler_list); - + list_for_each_entry(dev, &input_dev_list, node) if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) if ((id = input_match_device(handler->id_table, dev))) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index abc2e107e..5eb884656 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -1,12 +1,12 @@ /* * Joystick device driver for the input driver suite. * - * Copyright (c) 1999-2002 Vojtech Pavlik - * Copyright (c) 1999 Colin Van Dyke + * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 1999 Colin Van Dyke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ @@ -34,7 +34,7 @@ MODULE_SUPPORTED_DEVICE("input/js"); MODULE_LICENSE("GPL"); #define JOYDEV_MINOR_BASE 0 -#define JOYDEV_MINORS 16 +#define JOYDEV_MINORS 16 #define JOYDEV_BUFFER_SIZE 64 #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) @@ -115,7 +115,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne default: return; - } + } event.time = MSECS(jiffies); @@ -191,12 +191,12 @@ static int joydev_open(struct inode *inode, struct file *file) return 0; } -static ssize_t joydev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos) +static ssize_t joydev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) { return -EINVAL; } -static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *ppos) +static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct joydev_list *list = file->private_data; struct joydev *joydev = list->joydev; @@ -291,6 +291,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd struct joydev_list *list = file->private_data; struct joydev *joydev = list->joydev; struct input_dev *dev = joydev->handle.dev; + void __user *argp = (void __user *)arg; int i, j; if (!joydev->exist) return -ENODEV; @@ -298,34 +299,34 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case JS_SET_CAL: - return copy_from_user(&joydev->glue.JS_CORR, (struct JS_DATA_TYPE *) arg, + return copy_from_user(&joydev->glue.JS_CORR, argp, sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0; case JS_GET_CAL: - return copy_to_user((struct JS_DATA_TYPE *) arg, &joydev->glue.JS_CORR, + return copy_to_user(argp, &joydev->glue.JS_CORR, sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0; case JS_SET_TIMEOUT: - return get_user(joydev->glue.JS_TIMEOUT, (int *) arg); + return get_user(joydev->glue.JS_TIMEOUT, (int __user *) arg); case JS_GET_TIMEOUT: - return put_user(joydev->glue.JS_TIMEOUT, (int *) arg); + return put_user(joydev->glue.JS_TIMEOUT, (int __user *) arg); case JS_SET_TIMELIMIT: - return get_user(joydev->glue.JS_TIMELIMIT, (long *) arg); + return get_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); case JS_GET_TIMELIMIT: - return put_user(joydev->glue.JS_TIMELIMIT, (long *) arg); + return put_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); case JS_SET_ALL: - return copy_from_user(&joydev->glue, (struct JS_DATA_SAVE_TYPE *) arg, + return copy_from_user(&joydev->glue, argp, sizeof(struct JS_DATA_SAVE_TYPE)) ? -EFAULT : 0; case JS_GET_ALL: - return copy_to_user((struct JS_DATA_SAVE_TYPE *) arg, &joydev->glue, + return copy_to_user(argp, &joydev->glue, sizeof(struct JS_DATA_SAVE_TYPE)) ? -EFAULT : 0; case JSIOCGVERSION: - return put_user(JS_VERSION, (__u32 *) arg); + return put_user(JS_VERSION, (__u32 __user *) arg); case JSIOCGAXES: - return put_user(joydev->nabs, (__u8 *) arg); + return put_user(joydev->nabs, (__u8 __user *) arg); case JSIOCGBUTTONS: - return put_user(joydev->nkey, (__u8 *) arg); + return put_user(joydev->nkey, (__u8 __user *) arg); case JSIOCSCORR: - if (copy_from_user(joydev->corr, (struct js_corr *)arg, + if (copy_from_user(joydev->corr, argp, sizeof(struct js_corr) * joydev->nabs)) return -EFAULT; for (i = 0; i < joydev->nabs; i++) { @@ -334,10 +335,10 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd } return 0; case JSIOCGCORR: - return copy_to_user((struct js_corr *) arg, joydev->corr, + return copy_to_user(argp, joydev->corr, sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0; case JSIOCSAXMAP: - if (copy_from_user(joydev->abspam, (__u8 *) arg, sizeof(__u8) * ABS_MAX)) + if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * ABS_MAX)) return -EFAULT; for (i = 0; i < joydev->nabs; i++) { if (joydev->abspam[i] > ABS_MAX) return -EINVAL; @@ -345,10 +346,10 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd } return 0; case JSIOCGAXMAP: - return copy_to_user((__u8 *) arg, joydev->abspam, + return copy_to_user(argp, joydev->abspam, sizeof(__u8) * ABS_MAX) ? -EFAULT : 0; case JSIOCSBTNMAP: - if (copy_from_user(joydev->keypam, (__u16 *) arg, sizeof(__u16) * (KEY_MAX - BTN_MISC))) + if (copy_from_user(joydev->keypam, argp, sizeof(__u16) * (KEY_MAX - BTN_MISC))) return -EFAULT; for (i = 0; i < joydev->nkey; i++) { if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; @@ -356,7 +357,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd } return 0; case JSIOCGBTNMAP: - return copy_to_user((__u16 *) arg, joydev->keypam, + return copy_to_user(argp, joydev->keypam, sizeof(__u16) * (KEY_MAX - BTN_MISC)) ? -EFAULT : 0; default: if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) { @@ -364,7 +365,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (!dev->name) return 0; len = strlen(dev->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); - if (copy_to_user((char *) arg, dev->name, len)) return -EFAULT; + if (copy_to_user(argp, dev->name, len)) return -EFAULT; return len; } } @@ -449,10 +450,10 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct } joydev_table[minor] = joydev; - + devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), dev->dev, "js%d", minor); @@ -466,7 +467,7 @@ static void joydev_disconnect(struct input_handle *handle) joydev->exist = 0; if (joydev->open) - input_close_device(handle); + input_close_device(handle); else joydev_free(joydev); } diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig index 1ae033888..7d506f1f7 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig @@ -22,7 +22,7 @@ config JOYSTICK_ANALOG supports many extensions, including joysticks with throttle control, with rudders, additional hats and buttons compatible with CH Flightstick Pro, ThrustMaster FCS, 6 and 8 button gamepads, or - Saitek Cyborg joysticks. + Saitek Cyborg joysticks. Please read the file which contains more information. @@ -35,7 +35,7 @@ config JOYSTICK_A3D depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have an FPGaming or MadCatz controller using the - A3D protocol over the PC gameport. + A3D protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called a3d. @@ -45,7 +45,7 @@ config JOYSTICK_ADI depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Logitech controller using the ADI - protocol over the PC gameport. + protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called adi. @@ -74,7 +74,7 @@ config JOYSTICK_GRIP depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Gravis controller using the GrIP protocol - over the PC gameport. + over the PC gameport. To compile this driver as a module, choose M here: the module will be called grip. @@ -94,7 +94,7 @@ config JOYSTICK_GUILLEMOT depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a Guillemot joystick using a digital - protocol over the PC gameport. + protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called guillemot. @@ -124,7 +124,7 @@ config JOYSTICK_TMDC depends on INPUT && INPUT_JOYSTICK && GAMEPORT help Say Y here if you have a ThrustMaster controller using the - DirectConnect (BSP) protocol over the PC gameport. + DirectConnect (BSP) protocol over the PC gameport. To compile this driver as a module, choose M here: the module will be called tmdc. @@ -137,7 +137,7 @@ config JOYSTICK_WARRIOR select SERIO help Say Y here if you have a Logitech WingMan Warrior joystick connected - to your computer's serial port. + to your computer's serial port. To compile this driver as a module, choose M here: the module will be called warrior. @@ -253,7 +253,7 @@ config INPUT_JOYDUMP help Say Y here if you want to dump data from your joystick into the system log for debugging purposes. Say N if you are making a production - configuration or aren't sure. + configuration or aren't sure. To compile this driver as a module, choose M here: the module will be called joydump. diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index 9d66a654e..b3eb64fdc 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c @@ -39,8 +39,8 @@ MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver"); MODULE_LICENSE("GPL"); -#define A3D_MAX_START 400 /* 400 us */ -#define A3D_MAX_STROBE 60 /* 40 us */ +#define A3D_MAX_START 400 /* 400 us */ +#define A3D_MAX_STROBE 60 /* 40 us */ #define A3D_DELAY_READ 3 /* 3 ms */ #define A3D_MAX_LENGTH 40 /* 40*3 bits */ #define A3D_REFRESH_TIME HZ/50 /* 20 ms */ @@ -125,7 +125,7 @@ static void a3d_read(struct a3d *a3d, unsigned char *data) input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7)); input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7)); - + input_report_key(dev, BTN_RIGHT, data[2] & 1); input_report_key(dev, BTN_LEFT, data[3] & 2); input_report_key(dev, BTN_MIDDLE, data[3] & 4); @@ -201,7 +201,7 @@ int a3d_adc_cooked_read(struct gameport *gameport, int *axes, int *buttons) int i; for (i = 0; i < 4; i++) axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1; - *buttons = a3d->buttons; + *buttons = a3d->buttons; return 0; } @@ -216,7 +216,7 @@ int a3d_adc_open(struct gameport *gameport, int mode) if (mode != GAMEPORT_MODE_COOKED) return -1; if (!a3d->used++) - mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); + mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); return 0; } @@ -239,7 +239,7 @@ static int a3d_open(struct input_dev *dev) { struct a3d *a3d = dev->private; if (!a3d->used++) - mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); + mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME); return 0; } @@ -340,7 +340,7 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev) a3d->adc.open = a3d_adc_open; a3d->adc.close = a3d_adc_close; a3d->adc.cooked_read = a3d_adc_cooked_read; - a3d->adc.fuzz = 1; + a3d->adc.fuzz = 1; a3d->adc.name = a3d_names[a3d->mode]; a3d->adc.phys = a3d->adcphys; diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c index 10ef222a1..da70b5dea 100644 --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -72,8 +72,8 @@ MODULE_LICENSE("GPL"); */ static char *adi_names[] = { "WingMan Extreme Digital", "ThunderPad Digital", "SideCar", "CyberMan 2", - "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", - "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", + "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", + "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", "WingMan GamePad USB", "Unknown Device %#x" }; static char adi_wmgpe_abs[] = { ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y }; @@ -178,7 +178,7 @@ static void adi_read_packet(struct adi_port *port) /* * adi_move_bits() detects a possible 2-stream mode, and moves - * the bits accordingly. + * the bits accordingly. */ static void adi_move_bits(struct adi_port *port, int length) @@ -208,7 +208,7 @@ static inline int adi_get_bits(struct adi *adi, int count) int i; if ((adi->idx += count) > adi->ret) return 0; for (i = 0; i < count; i++) - bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i; + bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i; return bits; } @@ -224,12 +224,12 @@ static int adi_decode(struct adi *adi) int i, t; if (adi->ret < adi->length || adi->id != (adi_get_bits(adi, 4) | (adi_get_bits(adi, 4) << 4))) - return -1; + return -1; - for (i = 0; i < adi->axes10; i++) + for (i = 0; i < adi->axes10; i++) input_report_abs(dev, *abs++, adi_get_bits(adi, 10)); - for (i = 0; i < adi->axes8; i++) + for (i = 0; i < adi->axes8; i++) input_report_abs(dev, *abs++, adi_get_bits(adi, 8)); for (i = 0; i < adi->buttons && i < 63; i++) { @@ -249,7 +249,7 @@ static int adi_decode(struct adi *adi) for (i = 63; i < adi->buttons; i++) input_report_key(dev, *key++, adi_get_bits(adi, 1)); - + input_sync(dev); return 0; @@ -294,7 +294,7 @@ static int adi_open(struct input_dev *dev) { struct adi_port *port = dev->private; if (!port->used++) - mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME); + mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME); return 0; } @@ -334,7 +334,7 @@ static void adi_id_decode(struct adi *adi, struct adi_port *port) return; if (adi->ret < (t = adi_get_bits(adi, 10))) { - printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret); + printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret); return; } @@ -498,7 +498,7 @@ static void adi_connect(struct gameport *gameport, struct gameport_dev *dev) adi_init_digital(gameport); adi_read_packet(port); - + if (port->adi[0].ret >= ADI_MIN_LEN_LENGTH) adi_move_bits(port, adi_get_bits(port->adi, 10)); diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c index df57287cc..8b5fc358d 100644 --- a/drivers/input/joystick/amijoy.c +++ b/drivers/input/joystick/amijoy.c @@ -46,7 +46,7 @@ MODULE_DESCRIPTION("Driver for Amiga joysticks"); MODULE_LICENSE("GPL"); static int amijoy[2] = { 0, 1 }; -static int amijoy_nargs; +static int amijoy_nargs; module_param_array_named(map, amijoy, uint, amijoy_nargs, 0); MODULE_PARM_DESC(map, "Map of attached joysticks in form of , (default is 0,1)"); diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 5d10a6475..3e83968a9 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -237,7 +237,7 @@ static int analog_cooked_read(struct analog_port *port) loopout = (ANALOG_LOOP_TIME * port->loop) / 1000; timeout = ANALOG_MAX_TIME * port->speed; - + local_irq_save(flags); gameport_trigger(gameport); GET_TIME(now); @@ -284,7 +284,7 @@ static int analog_button_read(struct analog_port *port, char saitek, char chf) u = gameport_read(port->gameport); - if (!chf) { + if (!chf) { port->buttons = (~u >> 4) & 0xf; return 0; } @@ -333,7 +333,7 @@ static void analog_timer(unsigned long data) } } - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) if (port->analog[i].mask) analog_decode(port->analog + i, port->axes, port->initial, port->buttons); @@ -348,7 +348,7 @@ static int analog_open(struct input_dev *dev) { struct analog_port *port = dev->private; if (!port->used++) - mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME); + mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME); return 0; } @@ -408,7 +408,7 @@ static void analog_calibrate_timer(struct analog_port *port) static void analog_name(struct analog *analog) { - sprintf(analog->name, "Analog %d-axis %d-button", + sprintf(analog->name, "Analog %d-axis %d-button", hweight8(analog->mask & ANALOG_AXES_STD), hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); @@ -450,10 +450,10 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, analog->dev.close = analog_close; analog->dev.private = port; analog->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - + for (i = j = 0; i < 4; i++) if (analog->mask & (1 << i)) { - + t = analog_axes[j]; x = port->axes[i]; y = (port->axes[0] + port->axes[1]) >> 1; @@ -481,8 +481,8 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, j++; } - for (i = j = 0; i < 3; i++) - if (analog->mask & analog_exts[i]) + for (i = j = 0; i < 3; i++) + if (analog->mask & analog_exts[i]) for (x = 0; x < 2; x++) { t = analog_hats[j++]; set_bit(t, analog->dev.absbit); @@ -517,7 +517,7 @@ static void analog_init_device(struct analog_port *port, struct analog *analog, else printk(" [%s timer, %d %sHz clock, %d ns res]\n", TIME_NAME, port->speed > 10000 ? (port->speed + 800) / 1000 : port->speed, - port->speed > 10000 ? "M" : "k", + port->speed > 10000 ? "M" : "k", port->speed > 10000 ? (port->loop * 1000) / (port->speed / 1000) : (port->loop * 1000000) / port->speed); } @@ -580,11 +580,11 @@ static int analog_init_masks(struct analog_port *port) gameport_calibrate(port->gameport, port->axes, max); } - - for (i = 0; i < 4; i++) + + for (i = 0; i < 4; i++) port->initial[i] = port->axes[i]; - return -!(analog[0].mask || analog[1].mask); + return -!(analog[0].mask || analog[1].mask); } static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, struct analog_port *port) @@ -606,7 +606,7 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, msleep(ANALOG_MAX_TIME); port->mask = (gameport_read(gameport) ^ t) & t & 0xf; port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS; - + for (i = 0; i < ANALOG_INIT_RETRIES; i++) { if (!analog_cooked_read(port)) break; msleep(ANALOG_MAX_TIME); @@ -617,11 +617,11 @@ static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, msleep(ANALOG_MAX_TIME); t = gameport_time(gameport, ANALOG_MAX_TIME * 1000); gameport_trigger(gameport); - while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; + while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; udelay(ANALOG_SAITEK_DELAY); t = gameport_time(gameport, ANALOG_SAITEK_TIME); gameport_trigger(gameport); - while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; + while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; if (v < (u >> 1)) { /* FIXME - more than one port */ analog_options[0] |= /* FIXME - more than one port */ @@ -721,7 +721,7 @@ static void analog_parse_options(void) if (!strcmp(analog_types[j].name, js[i])) { analog_options[i] = analog_types[j].value; break; - } + } if (analog_types[j].name) continue; analog_options[i] = simple_strtoul(js[i], &end, 0); diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c index 9ca36edd1..fc29ad79b 100644 --- a/drivers/input/joystick/cobra.c +++ b/drivers/input/joystick/cobra.c @@ -72,7 +72,7 @@ static unsigned char cobra_read_packet(struct gameport *gameport, unsigned int * r[i] = buf[i] = 0; t[i] = COBRA_MAX_STROBE; } - + local_irq_save(flags); u = gameport_read(gameport); @@ -140,14 +140,14 @@ static void cobra_timer(unsigned long private) } - mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); + mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); } static int cobra_open(struct input_dev *dev) { struct cobra *cobra = dev->private; if (!cobra->used++) - mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); + mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME); return 0; } @@ -180,7 +180,7 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) cobra->exists = cobra_read_packet(gameport, data); - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) if ((cobra->exists >> i) & data[i] & 1) { printk(KERN_WARNING "cobra.c: Device %d on %s has the Ext bit set. ID is: %d" " Contact vojtech@ucw.cz\n", i, gameport->phys, (data[i] >> 2) & 7); @@ -205,7 +205,7 @@ static void cobra_connect(struct gameport *gameport, struct gameport_dev *dev) cobra->dev[i].id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; cobra->dev[i].id.product = 0x0008; cobra->dev[i].id.version = 0x0100; - + cobra->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); cobra->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index f7d3eebd7..5ad612751 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c @@ -14,14 +14,14 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -95,7 +95,7 @@ __obsolete_setup("db9_3="); struct db9 { struct input_dev dev[DB9_MAX_DEVICES]; struct timer_list timer; - struct pardevice *pd; + struct pardevice *pd; int mode; int used; char phys[2][32]; @@ -188,7 +188,7 @@ static unsigned char db9_saturn_read_analog(struct parport *port, int type, int } /* - * db9_saturn_read_packet() reads whole saturn packet at connector + * db9_saturn_read_packet() reads whole saturn packet at connector * and returns device identifier code. */ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char *data, int type, int powered) @@ -481,16 +481,16 @@ static void db9_timer(unsigned long private) input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1)); input_report_abs(dev, ABS_Y, (data & DB9_DOWN ? 0 : 1) - (data & DB9_UP ? 0 : 1)); - parport_write_control(port, 0x0a); + parport_write_control(port, 0x0a); - for (i = 0; i < 7; i++) { + for (i = 0; i < 7; i++) { data = parport_read_data(port); - parport_write_control(port, 0x02); - parport_write_control(port, 0x0a); + parport_write_control(port, 0x02); + parport_write_control(port, 0x0a); input_report_key(dev, db9_cd32_btn[i], ~data & DB9_FIRE2); } - parport_write_control(port, 0x00); + parport_write_control(port, 0x00); break; } @@ -600,7 +600,7 @@ static struct db9 __init *db9_probe(int *config, int nargs) db9->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (j = 0; j < db9_buttons[db9->mode]; j++) - set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit); + set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit); for (j = 0; j < db9_num_axis[db9->mode]; j++) { set_bit(db9_abs[j], db9->dev[i].absbit); if (j < 2) { @@ -635,7 +635,7 @@ void __exit db9_exit(void) { int i, j; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (db9_base[i]) { for (j = 0; j < min(db9_max_pads[db9_base[i]->mode], DB9_MAX_DEVICES); j++) input_unregister_device(db9_base[i]->dev + j); diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 02ee05a98..555fb362b 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c @@ -15,14 +15,14 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -70,13 +70,13 @@ __obsolete_setup("gc_3="); #define GC_NES4 3 #define GC_MULTI 4 #define GC_MULTI2 5 -#define GC_N64 6 +#define GC_N64 6 #define GC_PSX 7 #define GC_MAX 7 #define GC_REFRESH_TIME HZ/100 - + struct gc { struct pardevice *pd; struct input_dev dev[5]; @@ -104,7 +104,7 @@ static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, #define GC_N64_DELAY 133 /* delay between transmit request, and response ready (us) */ #define GC_N64_REQUEST 0x1dd1111111ULL /* the request data command (encoded for 000000011) */ #define GC_N64_DWS 3 /* delay between write segments (required for sound playback because of ISA DMA) */ - /* GC_N64_DWS > 24 is known to fail */ + /* GC_N64_DWS > 24 is known to fail */ #define GC_N64_POWER_W 0xe2 /* power during write (transmit request) */ #define GC_N64_POWER_R 0xfd /* power during read */ #define GC_N64_OUT 0x1d /* output bits to the 4 pads */ @@ -113,8 +113,8 @@ static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, /* than 123 us */ #define GC_N64_CLOCK 0x02 /* clock bits for read */ -/* - * gc_n64_read_packet() reads an N64 packet. +/* + * gc_n64_read_packet() reads an N64 packet. * Each pad uses one bit per byte. So all pads connected to this port are read in parallel. */ @@ -224,7 +224,7 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data) * http://www.dim.com/~mackys/psxmemcard/ps-eng2.txt * http://www.gamesx.com/controldata/psxcont/psxcont.htm * ftp://milano.usal.es/pablo/ - * + * */ #define GC_PSX_DELAY 25 /* 25 usec */ @@ -331,13 +331,13 @@ static void gc_timer(unsigned long private) s = gc_status_bit[i]; if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) { - + signed char axes[2]; axes[0] = axes[1] = 0; for (j = 0; j < 8; j++) { - if (data[23 - j] & s) axes[0] |= 1 << j; - if (data[31 - j] & s) axes[1] |= 1 << j; + if (data[23 - j] & s) axes[0] |= 1 << j; + if (data[31 - j] & s) axes[1] |= 1 << j; } input_report_abs(dev + i, ABS_X, axes[0]); @@ -588,7 +588,7 @@ static struct gc __init *gc_probe(int *config, int nargs) break; case GC_PSX: - + psx = gc_psx_read_packet(gc, data); switch(psx) { @@ -629,7 +629,7 @@ static struct gc __init *gc_probe(int *config, int nargs) } sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); - + gc->dev[i].name = gc_names[config[i + 1]]; gc->dev[i].phys = gc->phys[i]; gc->dev[i].id.bustype = BUS_PARPORT; @@ -646,7 +646,7 @@ static struct gc __init *gc_probe(int *config, int nargs) return NULL; } - for (i = 0; i < 5; i++) + for (i = 0; i < 5; i++) if (gc->pads[0] & gc_status_bit[i]) { input_register_device(gc->dev + i); printk(KERN_INFO "input: %s on %s\n", gc->dev[i].name, gc->pd->port->name); @@ -675,7 +675,7 @@ void __exit gc_exit(void) if (gc_base[i]) { for (j = 0; j < 5; j++) if (gc_base[i]->pads[0] & gc_status_bit[j]) - input_unregister_device(gc_base[i]->dev + j); + input_unregister_device(gc_base[i]->dev + j); parport_unregister_device(gc_base[i]->pd); } } diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c index 7cec946d4..10cc6ca9c 100644 --- a/drivers/input/joystick/gf2k.c +++ b/drivers/input/joystick/gf2k.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -223,7 +223,7 @@ static int gf2k_open(struct input_dev *dev) { struct gf2k *gf2k = dev->private; if (!gf2k->used++) - mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH); + mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH); return 0; } @@ -324,7 +324,7 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev) for (i = 0; i < gf2k_axes[gf2k->id]; i++) { gf2k->dev.absmax[gf2k_abs[i]] = (i < 2) ? gf2k->dev.abs[gf2k_abs[i]] * 2 - 32 : - gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; + gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; gf2k->dev.absmin[gf2k_abs[i]] = 32; gf2k->dev.absfuzz[gf2k_abs[i]] = 8; gf2k->dev.absflat[gf2k_abs[i]] = (i < 2) ? 24 : 0; diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c index 9acf65af4..3b1b07e2d 100644 --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c @@ -48,8 +48,8 @@ MODULE_LICENSE("GPL"); #define GRIP_STROBE_GPP 200 /* 200 us */ #define GRIP_LENGTH_XT 4 #define GRIP_STROBE_XT 64 /* 64 us */ -#define GRIP_MAX_CHUNKS_XT 10 -#define GRIP_MAX_BITS_XT 30 +#define GRIP_MAX_CHUNKS_XT 10 +#define GRIP_MAX_BITS_XT 30 #define GRIP_REFRESH_TIME HZ/50 /* 20 ms */ @@ -153,7 +153,7 @@ static int grip_xt_read_packet(struct gameport *gameport, int shift, unsigned in buf = (buf << 1) | (u >> 1); t = strobe; i++; - } else + } else if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) { if (i == 20) { diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c index d7623485f..995caa3e4 100644 --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c @@ -69,7 +69,7 @@ struct grip_mp { #define IO_MODE_FAST 0x0200 /* Used 3 data bits per gameport read */ #define IO_SLOT_CHANGE 0x0800 /* Multiport physical slot status changed */ #define IO_DONE 0x1000 /* Multiport is done sending packets */ -#define IO_RETRY 0x4000 /* Try again later to get packet */ +#define IO_RETRY 0x4000 /* Try again later to get packet */ #define IO_RESET 0x8000 /* Force multiport to resend all packets */ /* @@ -144,8 +144,8 @@ static inline int poll_until(u8 onbits, u8 offbits, int u_sec, struct gameport* /* * Gets a 28-bit packet from the multiport. * - * After getting a packet successfully, commands encoded by sendcode may - * be sent to the multiport. + * After getting a packet successfully, commands encoded by sendcode may + * be sent to the multiport. * * The multiport clock value is reflected in gameport bit B4. * @@ -169,7 +169,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa *packet = 0; raw_data = gameport_read(gameport); - if (raw_data & 1) + if (raw_data & 1) return IO_RETRY; for (i = 0; i < 64; i++) { @@ -183,11 +183,11 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa if (raw_data & 0x31) return IO_RESET; - gameport_trigger(gameport); + gameport_trigger(gameport); if (!poll_until(0x10, 0, 308, gameport, &raw_data)) return IO_RESET; - } else + } else return IO_RETRY; /* Determine packet transfer mode and prepare for packet construction. */ @@ -195,7 +195,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa if (raw_data & 0x20) { /* 3 data bits/read */ portvals |= raw_data >> 4; /* Compare B4-B7 before & after trigger */ - if (portvals != 0xb) + if (portvals != 0xb) return 0; data_mask = 7; bits_per_read = 3; @@ -221,7 +221,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa return IO_RESET; } - if (raw_data) + if (raw_data) return IO_RESET; /* If 3 bits/read used, drop from 30 bits to 28. */ @@ -231,7 +231,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa pkt = (pkt >> 2) | 0xf0000000; } - if (bit_parity(pkt) == 1) + if (bit_parity(pkt) == 1) return IO_RESET; /* Acknowledge packet receipt */ @@ -251,10 +251,10 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa /* Return if we just wanted the packet or multiport wants to send more */ - *packet = pkt; + *packet = pkt; if ((sendflags == 0) || ((sendflags & IO_RETRY) && !(pkt & PACKET_MP_DONE))) return IO_GOT_PACKET; - + if (pkt & PACKET_MP_MORE) return IO_GOT_PACKET | IO_RETRY; @@ -277,7 +277,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa if (!poll_until(0x30, 0, 193, gameport, &raw_data)) return IO_GOT_PACKET | IO_RESET; - if (raw_data & 1) + if (raw_data & 1) return IO_GOT_PACKET | IO_RESET; if (sendcode & 1) @@ -429,19 +429,19 @@ static int get_and_decode_packet(struct grip_mp *grip, int flags) strange_code = joytype; } } - return flags; + return flags; } /* * Returns true if all multiport slot states appear valid. */ - + static int slots_valid(struct grip_mp *grip) { int flags, slot, invalid = 0, active = 0; flags = get_and_decode_packet(grip, 0); - if (!(flags & IO_GOT_PACKET)) + if (!(flags & IO_GOT_PACKET)) return 0; for (slot = 0; slot < 4; slot++) { @@ -463,7 +463,7 @@ static int slots_valid(struct grip_mp *grip) * Returns whether the multiport was placed into digital mode and * able to communicate its state successfully. */ - + static int multiport_init(struct grip_mp *grip) { int dig_mode, initialized = 0, tries = 0; @@ -481,7 +481,7 @@ static int multiport_init(struct grip_mp *grip) dbg("multiport_init(): unable to achieve digital mode.\n"); return 0; } - + /* Get packets, store multiport state, and check state's validity */ for (tries = 0; tries < 4096; tries++) { if ( slots_valid(grip) ) { @@ -520,9 +520,9 @@ static void report_slot(struct grip_mp *grip, int slot) } /* - * Get the multiport state. + * Get the multiport state. */ - + static void get_and_report_mp_state(struct grip_mp *grip) { int i, npkts, flags; @@ -538,7 +538,7 @@ static void get_and_report_mp_state(struct grip_mp *grip) break; } - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) if (grip->dirty[i]) report_slot(grip, i); } @@ -546,7 +546,7 @@ static void get_and_report_mp_state(struct grip_mp *grip) /* * Called when a joystick device file is opened */ - + static int grip_open(struct input_dev *dev) { struct grip_mp *grip = dev->private; @@ -607,7 +607,7 @@ static void register_slot(int slot, struct grip_mp *grip) /* * Repeatedly polls the multiport and generates events. */ - + static void grip_timer(unsigned long private) { struct grip_mp *grip = (void*) private; diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c index 456e19983..cfe8c6be1 100644 --- a/drivers/input/joystick/guillemot.c +++ b/drivers/input/joystick/guillemot.c @@ -45,7 +45,7 @@ MODULE_LICENSE("GPL"); #define GUILLEMOT_MAX_LENGTH 17 /* 17 bytes */ #define GUILLEMOT_REFRESH_TIME HZ/50 /* 20 ms */ -static short guillemot_abs_pad[] = +static short guillemot_abs_pad[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 }; static short guillemot_btn_pad[] = @@ -160,7 +160,7 @@ static int guillemot_open(struct input_dev *dev) { struct guillemot *guillemot = dev->private; if (!guillemot->used++) - mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME); + mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME); return 0; } @@ -211,7 +211,7 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de if (!guillemot_type[i].name) { printk(KERN_WARNING "guillemot.c: Unknown joystick on %s. [ %02x%02x:%04x, ver %d.%02d ]\n", gameport->phys, data[12], data[13], data[11], data[14], data[15]); - goto fail2; + goto fail2; } sprintf(guillemot->phys, "%s/input0", gameport->phys); @@ -237,7 +237,7 @@ static void guillemot_connect(struct gameport *gameport, struct gameport_dev *de guillemot->dev.absmax[t] = 255; } - if (guillemot->type->hat) + if (guillemot->type->hat) for (i = 0; i < 2; i++) { t = ABS_HAT0X + i; set_bit(t, guillemot->dev.absbit); diff --git a/drivers/input/joystick/iforce/Kconfig b/drivers/input/joystick/iforce/Kconfig index 8b0195748..2e964e5f5 100644 --- a/drivers/input/joystick/iforce/Kconfig +++ b/drivers/input/joystick/iforce/Kconfig @@ -17,7 +17,7 @@ config JOYSTICK_IFORCE_USB depends on JOYSTICK_IFORCE && (JOYSTICK_IFORCE=m || USB=y) && USB help Say Y here if you have an I-Force joystick or steering wheel - connected to your USB port. + connected to your USB port. config JOYSTICK_IFORCE_232 bool "I-Force Serial joysticks and wheels" diff --git a/drivers/input/joystick/iforce/Makefile b/drivers/input/joystick/iforce/Makefile index 96a077172..17ae42bf9 100644 --- a/drivers/input/joystick/iforce/Makefile +++ b/drivers/input/joystick/iforce/Makefile @@ -7,14 +7,14 @@ # Goal definition iforce-objs := iforce-ff.o iforce-main.o iforce-packets.o -obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o +obj-$(CONFIG_JOYSTICK_IFORCE) += iforce.o ifeq ($(CONFIG_JOYSTICK_IFORCE_232),y) - iforce-objs += iforce-serio.o + iforce-objs += iforce-serio.o endif ifeq ($(CONFIG_JOYSTICK_IFORCE_USB),y) - iforce-objs += iforce-usb.o + iforce-objs += iforce-usb.o endif EXTRA_CFLAGS = -Werror-implicit-function-declaration diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c index 267f92f0a..4678b6dab 100644 --- a/drivers/input/joystick/iforce/iforce-ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c @@ -195,7 +195,7 @@ static unsigned char find_button(struct iforce *iforce, signed short button) } /* - * Analyse the changes in an effect, and tell if we need to send an condition + * Analyse the changes in an effect, and tell if we need to send an condition * parameter packet */ static int need_condition_modifier(struct iforce* iforce, struct ff_effect* new) @@ -372,7 +372,7 @@ int iforce_upload_periodic(struct iforce* iforce, struct ff_effect* effect, int int core_err = 0; if (!is_update || need_period_modifier(iforce, effect)) { - param1_err = make_period_modifier(iforce, mod1_chunk, + param1_err = make_period_modifier(iforce, mod1_chunk, is_update, effect->u.periodic.magnitude, effect->u.periodic.offset, effect->u.periodic.period, effect->u.periodic.phase); diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index c53e61acb..71cb7db75 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -166,7 +166,7 @@ static int iforce_upload_effect(struct input_dev *dev, struct ff_effect *effect) else { /* We want to update an effect */ if (!CHECK_OWNERSHIP(effect->id, iforce)) return -EACCES; - + /* Parameter type cannot be updated */ if (effect->type != iforce->core_effects[effect->id].effect.type) return -EINVAL; @@ -273,7 +273,7 @@ static int iforce_flush(struct input_dev *dev, struct file *file) if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) && current->pid == iforce->core_effects[i].owner) { - + /* Stop effect */ input_report_ff(dev, i, 0); diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 0c37044ef..58728ebaa 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -56,7 +56,7 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) int empty; int head, tail; unsigned long flags; - + /* * Update head and tail of xmit buffer */ @@ -108,7 +108,7 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) break; #endif #ifdef CONFIG_JOYSTICK_IFORCE_USB - case IFORCE_USB: + case IFORCE_USB: if (iforce->usbdev && empty && !test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) { diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c index e17c2e8a5..0665b5460 100644 --- a/drivers/input/joystick/iforce/iforce-serio.c +++ b/drivers/input/joystick/iforce/iforce-serio.c @@ -62,7 +62,7 @@ again: cs ^= iforce->xmit.buf[iforce->xmit.tail]; XMIT_INC(iforce->xmit.tail, 1); } - + serio_write(iforce->serio, cs); if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags)) diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index 5b902522e..a8586abf5 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -141,7 +141,7 @@ struct iforce { struct circ_buf xmit; unsigned char xmit_data[XMIT_SIZE]; long xmit_flags[1]; - + /* Force Feedback */ wait_queue_head_t wait; struct resource device_memory; diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c index adc20ac50..b2d7cad81 100644 --- a/drivers/input/joystick/interact.c +++ b/drivers/input/joystick/interact.c @@ -63,7 +63,7 @@ struct interact { char phys[32]; }; -static short interact_abs_hhfx[] = +static short interact_abs_hhfx[] = { ABS_RX, ABS_RY, ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y, -1 }; static short interact_abs_pp8d[] = { ABS_X, ABS_Y, -1 }; @@ -166,7 +166,7 @@ static void interact_timer(unsigned long private) case INTERACT_TYPE_PP8D: for (i = 0; i < 2; i++) - input_report_abs(dev, interact_abs_pp8d[i], + input_report_abs(dev, interact_abs_pp8d[i], ((data[0] >> ((i << 1) + 20)) & 1) - ((data[0] >> ((i << 1) + 21)) & 1)); for (i = 0; i < 8; i++) @@ -190,7 +190,7 @@ static int interact_open(struct input_dev *dev) { struct interact *interact = dev->private; if (!interact->used++) - mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME); + mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME); return 0; } @@ -242,7 +242,7 @@ static void interact_connect(struct gameport *gameport, struct gameport_dev *dev if (!interact_type[i].length) { printk(KERN_WARNING "interact.c: Unknown joystick on %s. [len %d d0 %08x d1 %08x i2 %08x]\n", gameport->phys, i, data[0], data[1], data[2]); - goto fail2; + goto fail2; } sprintf(interact->phys, "%s/input0", gameport->phys); diff --git a/drivers/input/joystick/joydump.c b/drivers/input/joystick/joydump.c index 9f3bed21b..15962a684 100644 --- a/drivers/input/joystick/joydump.c +++ b/drivers/input/joystick/joydump.c @@ -12,18 +12,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -63,7 +63,7 @@ static void __devinit joydump_connect(struct gameport *gameport, struct gameport printk(KERN_INFO "joydump: | Raw mode not available - trying cooked. |\n"); if (gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) { - + printk(KERN_INFO "joydump: | Cooked not available either. Failing. |\n"); printk(KERN_INFO "joydump: `-------------------- END -------------------'\n"); return; diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c index 992511d83..f326299b4 100644 --- a/drivers/input/joystick/magellan.c +++ b/drivers/input/joystick/magellan.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -159,7 +159,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) memset(magellan, 0, sizeof(struct magellan)); - magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < 9; i++) set_bit(magellan_buttons[i], magellan->dev.keybit); @@ -181,7 +181,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev) magellan->dev.id.vendor = SERIO_MAGELLAN; magellan->dev.id.product = 0x0001; magellan->dev.id.version = 0x0100; - + serio->private = magellan; if (serio_open(serio, dev)) { diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index af8263e02..084643d58 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -176,19 +176,19 @@ static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int len buf[i] = v >> 5; /* Store it */ i++; /* Advance index */ bitout = strobe; /* Extend timeout for next bit */ - } + } if (kick && (~v & u & 0x01)) { /* Falling edge on axis 0 */ sched = kick; /* Schedule second trigger */ kick = 0; /* Don't schedule next time on falling edge */ pending = 1; /* Mark schedule */ - } + } if (pending && sched < 0 && (i > -SW_END)) { /* Second trigger time */ gameport_trigger(gameport); /* Trigger */ bitout = start; /* Long bit timeout */ pending = 0; /* Unmark schedule */ - timeout = 0; /* Switch from global to bit timeouts */ + timeout = 0; /* Switch from global to bit timeouts */ } } @@ -482,14 +482,14 @@ static int sw_read(struct sw *sw) sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */ sw->fail = SW_FAIL; - + return -1; } static void sw_timer(unsigned long private) { struct sw *sw = (void *) private; - + sw->reads++; if (sw_read(sw)) sw->bads++; mod_timer(&sw->timer, jiffies + SW_REFRESH); @@ -653,7 +653,7 @@ static void sw_connect(struct gameport *gameport, struct gameport_dev *dev) case 60: sw->number++; case 45: /* Ambiguous packet length */ - if (j <= 40) { /* ID length less or eq 40 -> FSP */ + if (j <= 40) { /* ID length less or eq 40 -> FSP */ case 43: sw->type = SW_ID_FSP; break; diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c index 4e288b58c..eb5b6f76c 100644 --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c @@ -15,18 +15,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -59,8 +59,8 @@ MODULE_LICENSE("GPL"); static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY }; static char *spaceball_names[] = { - "?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B", - "SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController", + "?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B", + "SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController", "SpaceTec SpaceBall 3003C", "SpaceTec SpaceBall 4000FLX", "SpaceTec SpaceBall 4000FLX Lefty" }; /* @@ -96,7 +96,7 @@ static void spaceball_process_packet(struct spaceball* spaceball, struct pt_regs case 'D': /* Ball data */ if (spaceball->idx != 15) return; for (i = 0; i < 6; i++) - input_report_abs(dev, spaceball_axes[i], + input_report_abs(dev, spaceball_axes[i], (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); break; @@ -216,7 +216,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) return; memset(spaceball, 0, sizeof(struct spaceball)); - spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); switch (id) { case SPACEBALL_4000FLX: @@ -224,7 +224,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_9); spaceball->dev.keybit[LONG(BTN_A)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_MODE); default: - spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) + spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7) | BIT(BTN_8); case SPACEBALL_3003C: spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_1) | BIT(BTN_8); @@ -251,7 +251,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev) spaceball->dev.id.vendor = SERIO_SPACEBALL; spaceball->dev.id.product = id; spaceball->dev.id.version = 0x0100; - + serio->private = spaceball; if (serio_open(serio, dev)) { diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c index 593dcac96..00da66c4b 100644 --- a/drivers/input/joystick/spaceorb.c +++ b/drivers/input/joystick/spaceorb.c @@ -2,7 +2,7 @@ * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $ * * Copyright (c) 1999-2001 Vojtech Pavlik - * + * * Based on the work of: * David Thompson */ @@ -14,18 +14,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -67,7 +67,7 @@ struct spaceorb { static unsigned char spaceorb_xor[] = "SpaceWare"; static unsigned char *spaceorb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout", - "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; + "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; /* * spaceorb_process_packet() decodes packets the driver receives from the @@ -99,7 +99,7 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb, struct pt_regs *r case 'D': /* Ball + button data */ if (spaceorb->idx != 12) return; - for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; + for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; axes[0] = ( data[2] << 3) | (data[ 3] >> 4); axes[1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1); axes[2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5); @@ -174,7 +174,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) return; memset(spaceorb, 0, sizeof(struct spaceorb)); - spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (i = 0; i < 6; i++) set_bit(spaceorb_buttons[i], spaceorb->dev.keybit); @@ -198,7 +198,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev) spaceorb->dev.id.vendor = SERIO_SPACEORB; spaceorb->dev.id.product = 0x0001; spaceorb->dev.id.version = 0x0100; - + serio->private = spaceorb; if (serio_open(serio, dev)) { diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c index f68d3add2..ce9be4563 100644 --- a/drivers/input/joystick/stinger.c +++ b/drivers/input/joystick/stinger.c @@ -147,7 +147,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev) memset(stinger, 0, sizeof(struct stinger)); - stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); stinger->dev.keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | \ BIT(BTN_Y) | BIT(BTN_Z) | BIT(BTN_TL) | BIT(BTN_TR) | \ BIT(BTN_START) | BIT(BTN_SELECT); @@ -164,8 +164,8 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev) stinger->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { - stinger->dev.absmax[ABS_X+i] = 64; - stinger->dev.absmin[ABS_X+i] = -64; + stinger->dev.absmax[ABS_X+i] = 64; + stinger->dev.absmin[ABS_X+i] = -64; stinger->dev.absflat[ABS_X+i] = 4; } diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c index 93efe7520..6ed46ec46 100644 --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c @@ -4,7 +4,7 @@ * Copyright (c) 1998-2001 Vojtech Pavlik * * Based on the work of: - * Trystan Larey-Williams + * Trystan Larey-Williams */ /* @@ -14,18 +14,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -58,7 +58,7 @@ MODULE_LICENSE("GPL"); #define TMDC_BYTE_REV 11 #define TMDC_BYTE_DEF 12 -#define TMDC_ABS 7 +#define TMDC_ABS 7 #define TMDC_ABS_HAT 4 #define TMDC_BTN 16 @@ -104,7 +104,7 @@ struct tmdc { unsigned char btno[2][4]; int used; int reads; - int bads; + int bads; unsigned char exists; }; @@ -127,7 +127,7 @@ static int tmdc_read_packet(struct gameport *gameport, unsigned char data[2][TMD local_irq_save(flags); gameport_trigger(gameport); - + w = gameport_read(gameport) >> 4; do { @@ -148,7 +148,7 @@ static int tmdc_read_packet(struct gameport *gameport, unsigned char data[2][TMD } data[k][i[k]] |= (~v & 1) << (j[k]++ - 1); /* Data bit */ } - t[k]--; + t[k]--; } } while (t[0] > 0 || t[1] > 0); @@ -175,7 +175,7 @@ static void tmdc_timer(unsigned long private) bad = 1; else - for (j = 0; j < 2; j++) + for (j = 0; j < 2; j++) if (r & (1 << j) & tmdc->exists) { if (data[j][TMDC_BYTE_ID] != tmdc->mode[j]) { @@ -227,7 +227,7 @@ static int tmdc_open(struct input_dev *dev) { struct tmdc *tmdc = dev->private; if (!tmdc->used++) - mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME); + mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME); return 0; } @@ -356,7 +356,7 @@ static void tmdc_disconnect(struct gameport *gameport) struct tmdc *tmdc = gameport->private; int i; for (i = 0; i < 2; i++) - if (tmdc->exists & (1 << i)) + if (tmdc->exists & (1 << i)) input_unregister_device(tmdc->dev + i); gameport_close(gameport); kfree(tmdc); diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index 8cf86aa83..123ff5f9d 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c @@ -14,18 +14,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -65,7 +65,7 @@ __obsolete_setup("tgfx_3="); #define TGFX_TRIGGER 0x08 #define TGFX_UP 0x10 -#define TGFX_DOWN 0x20 +#define TGFX_DOWN 0x20 #define TGFX_LEFT 0x40 #define TGFX_RIGHT 0x80 @@ -126,7 +126,7 @@ static int tgfx_open(struct input_dev *dev) if (!tgfx->used++) { parport_claim(tgfx->pd); parport_write_control(tgfx->pd->port, 0x04); - mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); + mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); } return 0; } @@ -173,7 +173,7 @@ static struct tgfx __init *tgfx_probe(int *config, int nargs) memset(tgfx, 0, sizeof(struct tgfx)); tgfx->pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); - + parport_put_port(pp); if (!tgfx->pd) { @@ -210,7 +210,7 @@ static struct tgfx __init *tgfx_probe(int *config, int nargs) tgfx->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y); for (j = 0; j < config[i+1]; j++) - set_bit(tgfx_buttons[j], tgfx->dev[i].keybit); + set_bit(tgfx_buttons[j], tgfx->dev[i].keybit); tgfx->dev[i].absmin[ABS_X] = -1; tgfx->dev[i].absmax[ABS_X] = 1; tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1; @@ -225,7 +225,7 @@ static struct tgfx __init *tgfx_probe(int *config, int nargs) kfree(tgfx); return NULL; } - + return tgfx; } @@ -245,7 +245,7 @@ void __exit tgfx_exit(void) { int i, j; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (tgfx_base[i]) { for (j = 0; j < 7; j++) if (tgfx_base[i]->sticks & (1 << j)) diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c index 8a98be150..eb5c935a6 100644 --- a/drivers/input/joystick/twidjoy.c +++ b/drivers/input/joystick/twidjoy.c @@ -58,6 +58,9 @@ #include #include +MODULE_DESCRIPTION("Handykey Twiddler keyboard as a joystick driver"); +MODULE_LICENSE("GPL"); + /* * Constants. */ @@ -142,7 +145,7 @@ static void twidjoy_process_packet(struct twidjoy *twidjoy, struct pt_regs *regs * packet processing routine. */ -static void twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struc pt_regs *regs) +static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { struct twidjoy *twidjoy = serio->private; @@ -153,7 +156,7 @@ static void twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned if ((data & 0x80) == 0) twidjoy->idx = 0; /* this byte starts a new packet */ else if (twidjoy->idx == 0) - return; /* wrong MSB -- ignore this byte */ + return IRQ_HANDLED; /* wrong MSB -- ignore this byte */ if (twidjoy->idx < TWIDJOY_MAX_LENGTH) twidjoy->data[twidjoy->idx++] = data; @@ -163,7 +166,7 @@ static void twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned twidjoy->idx = 0; } - return; + return IRQ_HANDLED; } /* @@ -208,7 +211,7 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev) twidjoy->dev.id.product = 0x0001; twidjoy->dev.id.version = 0x0100; - twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); for (bp = twidjoy_buttons; bp->bitmask; bp++) { for (i = 0; i < bp->bitmask; i++) @@ -218,8 +221,8 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev) twidjoy->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); for (i = 0; i < 2; i++) { - twidjoy->dev.absmax[ABS_X+i] = 50; - twidjoy->dev.absmin[ABS_X+i] = -50; + twidjoy->dev.absmax[ABS_X+i] = 50; + twidjoy->dev.absmin[ABS_X+i] = -50; /* TODO: arndt 20010708: Are these values appropriate? */ twidjoy->dev.absfuzz[ABS_X+i] = 4; diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c index 426ce2d5e..32ec90e81 100644 --- a/drivers/input/joystick/warrior.c +++ b/drivers/input/joystick/warrior.c @@ -11,18 +11,18 @@ /* * This program is free warftware; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -44,7 +44,7 @@ MODULE_LICENSE("GPL"); */ #define WARRIOR_MAX_LENGTH 16 -static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; +static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; static char *warrior_name = "Logitech WingMan Warrior"; /* @@ -114,7 +114,7 @@ static irqreturn_t warrior_interrupt(struct serio *serio, warrior->data[warrior->idx++] = data; if (warrior->idx == warrior->len) { - if (warrior->idx) warrior_process_packet(warrior, regs); + if (warrior->idx) warrior_process_packet(warrior, regs); warrior->idx = 0; warrior->len = 0; } @@ -152,7 +152,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev) memset(warrior, 0, sizeof(struct warrior)); - warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); + warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); warrior->dev.keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2); warrior->dev.relbit[0] = BIT(REL_DIAL); warrior->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y); @@ -168,24 +168,24 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev) warrior->dev.id.version = 0x0100; for (i = 0; i < 2; i++) { - warrior->dev.absmax[ABS_X+i] = -64; - warrior->dev.absmin[ABS_X+i] = 64; - warrior->dev.absflat[ABS_X+i] = 8; + warrior->dev.absmax[ABS_X+i] = -64; + warrior->dev.absmin[ABS_X+i] = 64; + warrior->dev.absflat[ABS_X+i] = 8; } - warrior->dev.absmax[ABS_THROTTLE] = -112; - warrior->dev.absmin[ABS_THROTTLE] = 112; + warrior->dev.absmax[ABS_THROTTLE] = -112; + warrior->dev.absmin[ABS_THROTTLE] = 112; for (i = 0; i < 2; i++) { - warrior->dev.absmax[ABS_HAT0X+i] = -1; - warrior->dev.absmin[ABS_HAT0X+i] = 1; + warrior->dev.absmax[ABS_HAT0X+i] = -1; + warrior->dev.absmin[ABS_HAT0X+i] = 1; } warrior->dev.private = warrior; - + serio->private = warrior; - if (serio_open(serio, dev)) { + if (serio_open(serio, dev)) { kfree(warrior); return; } diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 36d32820d..b724190b2 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -62,7 +62,7 @@ config KEYBOARD_XTKBD Say Y here if you want to use the old IBM PC/XT keyboard (or compatible) on your system. This is only possible with a parallel port keyboard adapter, you cannot connect it to the - keyboard port on a PC that runs Linux. + keyboard port on a PC that runs Linux. To compile this driver as a module, choose M here: the module will be called xtkbd. @@ -92,19 +92,7 @@ config KEYBOARD_AMIGA depends on AMIGA && INPUT && INPUT_KEYBOARD help Say Y here if you are running Linux on any AMIGA and have a keyboard - attached. + attached. To compile this driver as a module, choose M here: the module will be called amikbd. - -config KEYBOARD_98KBD - tristate "NEC PC-9800 Keyboard support" - depends on X86_PC9800 && INPUT && INPUT_KEYBOARD - select SERIO - help - Say Y here if you want to use the NEC PC-9801/PC-9821 keyboard (or - compatible) on your system. - - To compile this driver as a module, choose M here: the - module will be called 98kbd. - diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 871440418..00ec1f86a 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -26,7 +26,6 @@ #include #include #include -#include MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); @@ -173,22 +172,24 @@ struct atkbd { unsigned char keycode[512]; struct input_dev dev; struct serio *serio; - struct timer_list timer; + char name[64]; char phys[32]; + unsigned short id; + unsigned char set; + unsigned int translated:1; + unsigned int extra:1; + unsigned int write:1; + unsigned char cmdbuf[4]; unsigned char cmdcnt; - unsigned char set; - unsigned char extra; - unsigned char release; - int lastkey; volatile signed char ack; unsigned char emul; - unsigned short id; - unsigned char write; - unsigned char translated; - unsigned char resend; - unsigned char bat_xl; + unsigned int resend:1; + unsigned int release:1; + unsigned int bat_xl:1; + unsigned int enabled:1; + unsigned int last; unsigned long time; }; @@ -248,6 +249,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, goto out; } + if (!atkbd->enabled) + goto out; + if (atkbd->translated) { if (atkbd->emul || @@ -284,7 +288,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, atkbd_report_key(&atkbd->dev, regs, KEY_HANJA, 3); goto out; case ATKBD_RET_ERR: - printk(KERN_WARNING "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); + printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); goto out; } @@ -300,15 +304,20 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, case ATKBD_KEY_NULL: break; case ATKBD_KEY_UNKNOWN: - printk(KERN_WARNING "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n", - atkbd->release ? "released" : "pressed", - atkbd->translated ? "translated" : "raw", - atkbd->set, code, serio->phys); - if (atkbd->translated && atkbd->set == 2 && code == 0x7a) - printk(KERN_WARNING "atkbd.c: This is an XFree86 bug. It shouldn't access" - " hardware directly.\n"); - else - printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x ' to make it known.\n", code & 0x80 ? "e0" : "", code & 0x7f); + if (data == ATKBD_RET_ACK || data == ATKBD_RET_NAK) { + printk(KERN_WARNING "atkbd.c: Spurious %s on %s. Some program, " + "like XFree86, might be trying access hardware directly.\n", + data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); + } else { + printk(KERN_WARNING "atkbd.c: Unknown key %s " + "(%s set %d, code %#x on %s).\n", + atkbd->release ? "released" : "pressed", + atkbd->translated ? "translated" : "raw", + atkbd->set, code, serio->phys); + printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x ' " + "to make it known.\n", + code & 0x80 ? "e0" : "", code & 0x7f); + } break; case ATKBD_SCR_1: scroll = 1 - atkbd->release * 2; @@ -745,6 +754,8 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev) atkbd->id = 0xab00; } + atkbd->enabled = 1; + if (atkbd->extra) { atkbd->dev.ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC); sprintf(atkbd->name, "AT Set 2 Extra keyboard"); @@ -809,12 +820,12 @@ static int atkbd_reconnect(struct serio *serio) param[0] = (test_bit(LED_SCROLLL, atkbd->dev.led) ? 1 : 0) | (test_bit(LED_NUML, atkbd->dev.led) ? 2 : 0) | (test_bit(LED_CAPSL, atkbd->dev.led) ? 4 : 0); - + if (atkbd_probe(atkbd)) return -1; if (atkbd->set != atkbd_set_3(atkbd)) return -1; - + atkbd_enable(atkbd); if (atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS)) diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c index eb5fe4d83..859ed771e 100644 --- a/drivers/input/keyboard/maple_keyb.c +++ b/drivers/input/keyboard/maple_keyb.c @@ -139,7 +139,7 @@ static int dc_kbd_connect(struct maple_device *dev) kbd->dev.name = dev->product_name; kbd->dev.id.bustype = BUS_MAPLE; - + input_register_device(&kbd->dev); maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD); diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c index d2f70364a..1bb8a57e2 100644 --- a/drivers/input/keyboard/sunkbd.c +++ b/drivers/input/keyboard/sunkbd.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -148,7 +148,7 @@ static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int c case EV_LED: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, + sunkbd->serio->write(sunkbd->serio, (!!test_bit(LED_CAPSL, dev->led) << 3) | (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_COMPOSE, dev->led) << 1) | !!test_bit(LED_NUML, dev->led)); return 0; @@ -160,7 +160,7 @@ static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int c case SND_CLICK: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value); return 0; - + case SND_BELL: sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value); return 0; @@ -210,7 +210,7 @@ static void sunkbd_reinit(void *data) wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ); sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED); - sunkbd->serio->write(sunkbd->serio, + sunkbd->serio->write(sunkbd->serio, (!!test_bit(LED_CAPSL, sunkbd->dev.led) << 3) | (!!test_bit(LED_SCROLLL, sunkbd->dev.led) << 2) | (!!test_bit(LED_COMPOSE, sunkbd->dev.led) << 1) | !!test_bit(LED_NUML, sunkbd->dev.led)); sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - !!test_bit(SND_CLICK, sunkbd->dev.snd)); @@ -231,7 +231,7 @@ static void sunkbd_connect(struct serio *serio, struct serio_dev *dev) if ((serio->type & SERIO_PROTO) && (serio->type & SERIO_PROTO) != SERIO_SUNKBD) return; - + if (!(sunkbd = kmalloc(sizeof(struct sunkbd), GFP_KERNEL))) return; diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c index 78847c60f..56adfa1cc 100644 --- a/drivers/input/keyboard/xtkbd.c +++ b/drivers/input/keyboard/xtkbd.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -43,7 +43,7 @@ MODULE_LICENSE("GPL"); #define XTKBD_KEY 0x7f #define XTKBD_RELEASE 0x80 -static unsigned char xtkbd_keycode[256] = { +static unsigned char xtkbd_keycode[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -98,7 +98,7 @@ void xtkbd_connect(struct serio *serio, struct serio_dev *dev) return; memset(xtkbd, 0, sizeof(struct xtkbd)); - + xtkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); xtkbd->serio = serio; diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index d31aaffa5..d3e5d841e 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -40,10 +40,6 @@ config INPUT_M68K_BEEP tristate "M68k Beeper support" depends on M68K && INPUT && INPUT_MISC -config INPUT_98SPKR - tristate "PC-9800 Speaker support" - depends on X86_PC9800 && INPUT && INPUT_MISC - config INPUT_UINPUT tristate "User level driver support" depends on INPUT && INPUT_MISC diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c index f06600fc3..830d1c37c 100644 --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c @@ -41,11 +41,11 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = PIT_TICK_RATE / value; - + spin_lock_irqsave(&i8253_beep_lock, flags); if (count) { diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 6c5c08ded..6d793addf 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -53,11 +53,11 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = 1193182 / value; - + spin_lock_irqsave(&beep_lock, flags); /* EBUS speaker only has on/off state, the frequency does not @@ -108,11 +108,11 @@ static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int case SND_BELL: if (value) value = 1000; case SND_TONE: break; default: return -1; - } + } if (value > 20 && value < 32767) count = 1193182 / value; - + spin_lock_irqsave(&beep_lock, flags); if (count) { diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index cc8c05b59..b86acf04d 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Aristeu Sergio Rozanski Filho - * + * * Changes/Revisions: * 0.1 20/06/2002 * - first public version @@ -68,7 +68,7 @@ static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *eff static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) { return 0; -} +} static int uinput_create_device(struct uinput_device *udev) { @@ -123,7 +123,7 @@ static int uinput_open(struct inode *inode, struct file *file) memset(newinput, 0, sizeof(struct input_dev)); newdev->dev = newinput; - + file->private_data = newdev; return 0; @@ -137,16 +137,16 @@ static int uinput_validate_absbits(struct input_dev *dev) { unsigned int cnt; int retval = 0; - + for (cnt = 0; cnt < ABS_MAX; cnt++) { - if (!test_bit(cnt, dev->absbit)) + if (!test_bit(cnt, dev->absbit)) continue; - + if (/*!dev->absmin[cnt] || !dev->absmax[cnt] || */ (dev->absmax[cnt] <= dev->absmin[cnt])) { - printk(KERN_DEBUG + printk(KERN_DEBUG "%s: invalid abs[%02x] min:%d max:%d\n", - UINPUT_NAME, cnt, + UINPUT_NAME, cnt, dev->absmin[cnt], dev->absmax[cnt]); retval = -EINVAL; break; @@ -154,7 +154,7 @@ static int uinput_validate_absbits(struct input_dev *dev) if ((dev->absflat[cnt] < dev->absmin[cnt]) || (dev->absflat[cnt] > dev->absmax[cnt])) { - printk(KERN_DEBUG + printk(KERN_DEBUG "%s: absflat[%02x] out of range: %d " "(min:%d/max:%d)\n", UINPUT_NAME, cnt, dev->absflat[cnt], @@ -166,7 +166,7 @@ static int uinput_validate_absbits(struct input_dev *dev) return retval; } -static int uinput_alloc_device(struct file *file, const char *buffer, size_t count) +static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) { struct uinput_user_dev *user_dev; struct input_dev *dev; @@ -190,7 +190,7 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou goto exit; } - if (NULL != dev->name) + if (NULL != dev->name) kfree(dev->name); size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; @@ -226,10 +226,10 @@ exit: return retval; } -static ssize_t uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct uinput_device *udev = file->private_data; - + if (test_bit(UIST_CREATED, &(udev->state))) { struct input_event ev; @@ -243,11 +243,11 @@ static ssize_t uinput_write(struct file *file, const char *buffer, size_t count, return count; } -static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct uinput_device *udev = file->private_data; int retval = 0; - + if (!test_bit(UIST_CREATED, &(udev->state))) return -ENODEV; @@ -255,16 +255,16 @@ static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t return -EAGAIN; retval = wait_event_interruptible(udev->waitq, - (udev->head != udev->tail) || + (udev->head != udev->tail) || !test_bit(UIST_CREATED, &(udev->state))); - + if (retval) return retval; if (!test_bit(UIST_CREATED, &(udev->state))) return -ENODEV; - while ((udev->head != udev->tail) && + while ((udev->head != udev->tail) && (retval + sizeof(struct input_event) <= count)) { if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), sizeof(struct input_event))) return -EFAULT; @@ -284,7 +284,7 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) if (udev->head != udev->tail) return POLLIN | POLLRDNORM; - return 0; + return 0; } static int uinput_burn_device(struct uinput_device *udev) @@ -318,7 +318,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd case UI_DEV_CREATE: retval = uinput_create_device(udev); break; - + case UI_DEV_DESTROY: retval = uinput_destroy_device(udev); break; @@ -330,7 +330,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->evbit); break; - + case UI_SET_KEYBIT: if (arg > KEY_MAX) { retval = -EINVAL; @@ -338,7 +338,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->keybit); break; - + case UI_SET_RELBIT: if (arg > REL_MAX) { retval = -EINVAL; @@ -346,7 +346,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->relbit); break; - + case UI_SET_ABSBIT: if (arg > ABS_MAX) { retval = -EINVAL; @@ -354,7 +354,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->absbit); break; - + case UI_SET_MSCBIT: if (arg > MSC_MAX) { retval = -EINVAL; @@ -362,7 +362,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->mscbit); break; - + case UI_SET_LEDBIT: if (arg > LED_MAX) { retval = -EINVAL; @@ -370,7 +370,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->ledbit); break; - + case UI_SET_SNDBIT: if (arg > SND_MAX) { retval = -EINVAL; @@ -378,7 +378,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->sndbit); break; - + case UI_SET_FFBIT: if (arg > FF_MAX) { retval = -EINVAL; @@ -386,7 +386,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd } set_bit(arg, udev->dev->ffbit); break; - + default: retval = -EFAULT; } diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 17db090dc..1274cb68b 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig @@ -130,14 +130,3 @@ config MOUSE_VSXXXAA described in the source file). This driver should, in theory, also work with the digitizer DEC produced, but it isn't tested with that (I don't have the hardware yet). - -config MOUSE_PC9800 - tristate "NEC PC-9800 busmouse" - depends on X86_PC9800 && INPUT && INPUT_MOUSE && ISA - help - Say Y here if you have NEC PC-9801/PC-9821 computer and want its - native mouse supported. - - To compile this driver as a module, choose M here: the - module will be called 98busmouse. - diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 57987f3e2..c030c08b1 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile @@ -10,7 +10,6 @@ obj-$(CONFIG_MOUSE_INPORT) += inport.o obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o obj-$(CONFIG_MOUSE_MAPLE) += maplemouse.o obj-$(CONFIG_MOUSE_PC110PAD) += pc110pad.o -obj-$(CONFIG_MOUSE_PC9800) += 98busmouse.o obj-$(CONFIG_MOUSE_PS2) += psmouse.o obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 846b5e880..0063af037 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c @@ -14,6 +14,25 @@ #include "psmouse.h" #include "logips2pp.h" +/* Logitech mouse types */ +#define PS2PP_KIND_WHEEL 1 +#define PS2PP_KIND_MX 2 +#define PS2PP_KIND_TP3 3 + +/* Logitech mouse features */ +#define PS2PP_WHEEL 0x01 +#define PS2PP_HWHEEL 0x02 +#define PS2PP_SIDE_BTN 0x04 +#define PS2PP_EXTRA_BTN 0x08 +#define PS2PP_TASK_BTN 0x10 +#define PS2PP_NAV_BTN 0x20 + +struct ps2pp_info { + const int model; + unsigned const int kind; + unsigned const int features; +}; + /* * Process a PS2++ or PS2T++ packet. */ @@ -63,7 +82,6 @@ void ps2pp_process_packet(struct psmouse *psmouse) packet[0] &= 0x0f; packet[1] = 0; packet[2] = 0; - } } @@ -76,18 +94,9 @@ void ps2pp_process_packet(struct psmouse *psmouse) static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned char command) { - unsigned char d; - int i; - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) + if (psmouse_sliced_command(psmouse, command)) return -1; - for (i = 6; i >= 0; i -= 2) { - d = (command >> i) & 3; - if(psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - if (psmouse_command(psmouse, param, PSMOUSE_CMD_POLL)) return -1; @@ -99,7 +108,7 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha * enabled if we do nothing to it. Of course I put this in because I want it * disabled :P * 1 - enabled (if previously disabled, also default) - * 0/2 - disabled + * 0/2 - disabled */ static void ps2pp_set_smartscroll(struct psmouse *psmouse) @@ -113,14 +122,11 @@ static void ps2pp_set_smartscroll(struct psmouse *psmouse) psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - if (psmouse_smartscroll == 1) - param[0] = 1; - else - if (psmouse_smartscroll > 2) - return; - - /* else leave param[0] == 0 to disable */ - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + if (psmouse_smartscroll < 2) { + /* 0 - disabled, 1 - enabled */ + param[0] = psmouse_smartscroll; + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + } } /* @@ -138,133 +144,167 @@ void ps2pp_set_800dpi(struct psmouse *psmouse) psmouse_command(psmouse, ¶m, PSMOUSE_CMD_SETRES); } +static struct ps2pp_info *get_model_info(unsigned char model) +{ + static struct ps2pp_info ps2pp_list[] = { + { 12, 0, PS2PP_SIDE_BTN}, + { 13, 0, 0 }, + { 40, 0, PS2PP_SIDE_BTN }, + { 41, 0, PS2PP_SIDE_BTN }, + { 42, 0, PS2PP_SIDE_BTN }, + { 43, 0, PS2PP_SIDE_BTN }, + { 50, 0, 0 }, + { 51, 0, 0 }, + { 52, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, + { 53, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 61, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX700 */ + { 73, 0, PS2PP_SIDE_BTN }, + { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, + { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, + { 96, 0, 0 }, + { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, + { 100, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX510 */ + { 112, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | + PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, /* MX500 */ + { 114, PS2PP_KIND_MX, + PS2PP_WHEEL | PS2PP_SIDE_BTN | + PS2PP_TASK_BTN | PS2PP_EXTRA_BTN }, /* M310 */ + { } + }; + int i; + + for (i = 0; ps2pp_list[i].model; i++) + if (model == ps2pp_list[i].model) + return &ps2pp_list[i]; + return NULL; +} + /* - * Detect the exact model and features of a PS2++ or PS2T++ Logitech mouse or - * touchpad. + * Set up input device's properties based on the detected mouse model. */ -static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param) +static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_info *model_info) { - int i; - static struct _logips2_list { - const int model; - unsigned const int features; - } logips2pp_list [] = { - { 12, PS2PP_4BTN}, - { 13, 0 }, - { 40, PS2PP_4BTN }, - { 41, PS2PP_4BTN }, - { 42, PS2PP_4BTN }, - { 43, PS2PP_4BTN }, - { 50, 0 }, - { 51, 0 }, - { 52, PS2PP_4BTN | PS2PP_WHEEL }, - { 53, PS2PP_WHEEL }, - { 61, PS2PP_WHEEL | PS2PP_MX }, /* MX700 */ - { 73, PS2PP_4BTN }, - { 75, PS2PP_WHEEL }, - { 76, PS2PP_WHEEL }, - { 80, PS2PP_4BTN | PS2PP_WHEEL }, - { 81, PS2PP_WHEEL }, - { 83, PS2PP_WHEEL }, - { 88, PS2PP_WHEEL }, - { 96, 0 }, - { 97, 0 }, - { 100 , PS2PP_WHEEL | PS2PP_MX }, /* MX510 */ - { 112 , PS2PP_WHEEL | PS2PP_MX }, /* MX500 */ - { 114 , PS2PP_WHEEL | PS2PP_MX | PS2PP_MX310 }, /* MX310 */ - { } - }; + if (model_info->features & PS2PP_SIDE_BTN) + set_bit(BTN_SIDE, psmouse->dev.keybit); + + if (model_info->features & PS2PP_EXTRA_BTN) + set_bit(BTN_EXTRA, psmouse->dev.keybit); - psmouse->vendor = "Logitech"; - psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); + if (model_info->features & PS2PP_TASK_BTN) + set_bit(BTN_TASK, psmouse->dev.keybit); - if (param[1] < 3) - clear_bit(BTN_MIDDLE, psmouse->dev.keybit); - if (param[1] < 2) - clear_bit(BTN_RIGHT, psmouse->dev.keybit); + if (model_info->features & PS2PP_NAV_BTN) { + set_bit(BTN_FORWARD, psmouse->dev.keybit); + set_bit(BTN_BACK, psmouse->dev.keybit); + } - psmouse->type = PSMOUSE_PS2; + if (model_info->features & PS2PP_WHEEL) + set_bit(REL_WHEEL, psmouse->dev.relbit); - for (i = 0; logips2pp_list[i].model; i++){ - if (logips2pp_list[i].model == psmouse->model){ - psmouse->type = PSMOUSE_PS2PP; - if (logips2pp_list[i].features & PS2PP_4BTN) - set_bit(BTN_SIDE, psmouse->dev.keybit); + if (model_info->features & PS2PP_HWHEEL) + set_bit(REL_HWHEEL, psmouse->dev.relbit); - if (logips2pp_list[i].features & PS2PP_WHEEL){ - set_bit(REL_WHEEL, psmouse->dev.relbit); - psmouse->name = "Wheel Mouse"; - } - if (logips2pp_list[i].features & PS2PP_MX) { - set_bit(BTN_SIDE, psmouse->dev.keybit); - set_bit(BTN_EXTRA, psmouse->dev.keybit); - set_bit(BTN_TASK, psmouse->dev.keybit); - if (!(logips2pp_list[i].features & PS2PP_MX310)){ - set_bit(BTN_BACK, psmouse->dev.keybit); - set_bit(BTN_FORWARD, psmouse->dev.keybit); - } - psmouse->name = "MX Mouse"; - } + switch (model_info->kind) { + case PS2PP_KIND_WHEEL: + psmouse->name = "Wheel Mouse"; + break; + + case PS2PP_KIND_MX: + psmouse->name = "MX Mouse"; + break; + + case PS2PP_KIND_TP3: + psmouse->name = "TouchPad 3"; break; - } } +} + + /* - * Do Logitech PS2++ / PS2T++ magic init. + * Logitech magic init. Detect whether the mouse is a Logitech one + * and its exact model and try turning on extended protocol for ones + * that support it. */ - if (psmouse->type == PSMOUSE_PS2PP) { - if (psmouse->model == 97) { /* TouchPad 3 */ +int ps2pp_init(struct psmouse *psmouse, int set_properties) +{ + unsigned char param[4]; + unsigned char protocol = PSMOUSE_PS2; + unsigned char model, buttons; + struct ps2pp_info *model_info; + + param[0] = 0; + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); + param[1] = 0; + psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + + if (param[1] != 0) { + model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); + buttons = param[1]; + model_info = get_model_info(model); - set_bit(REL_WHEEL, psmouse->dev.relbit); - set_bit(REL_HWHEEL, psmouse->dev.relbit); +/* + * Do Logitech PS2++ / PS2T++ magic init. + */ + if (model == 97) { /* Touch Pad 3 */ - param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ + /* Unprotect RAM */ + param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ + /* Enable features */ + param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ + /* Enable PS2++ */ + param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; psmouse_command(psmouse, param, 0x30d1); param[0] = 0; if (!psmouse_command(psmouse, param, 0x13d1) && - param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { - psmouse->name = "TouchPad 3"; - return PSMOUSE_PS2TPP; + param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { + protocol = PSMOUSE_PS2TPP; } - } else { + } else if (get_model_info(model) != NULL) { param[0] = param[1] = param[2] = 0; ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ ps2pp_cmd(psmouse, param, 0xDB); - if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && - (param[2] & 3) == ((param[1] >> 2) & 3)) { - ps2pp_set_smartscroll(psmouse); - return PSMOUSE_PS2PP; + if ((param[0] & 0x78) == 0x48 && + (param[1] & 0xf3) == 0xc2 && + (param[2] & 0x03) == ((param[1] >> 2) & 3)) { + ps2pp_set_smartscroll(psmouse); + protocol = PSMOUSE_PS2PP; } } - } - return 0; -} + if (set_properties) { + psmouse->vendor = "Logitech"; + psmouse->model = model; -/* - * Logitech magic init. - */ -int ps2pp_detect(struct psmouse *psmouse) -{ - unsigned char param[4]; + if (buttons < 3) + clear_bit(BTN_MIDDLE, psmouse->dev.keybit); + if (buttons < 2) + clear_bit(BTN_RIGHT, psmouse->dev.keybit); - param[0] = 0; - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11); - param[1] = 0; - psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + if (model_info) + ps2pp_set_model_properties(psmouse, model_info); + } + } - return param[1] != 0 ? ps2pp_detect_model(psmouse, param) : 0; + return protocol; } diff --git a/drivers/input/mouse/logips2pp.h b/drivers/input/mouse/logips2pp.h index d5e05defe..959743a9e 100644 --- a/drivers/input/mouse/logips2pp.h +++ b/drivers/input/mouse/logips2pp.h @@ -11,13 +11,8 @@ #ifndef _LOGIPS2PP_H #define _LOGIPS2PP_H -#define PS2PP_4BTN 0x01 -#define PS2PP_WHEEL 0x02 -#define PS2PP_MX 0x04 -#define PS2PP_MX310 0x08 - -struct psmouse; void ps2pp_process_packet(struct psmouse *psmouse); void ps2pp_set_800dpi(struct psmouse *psmouse); -int ps2pp_detect(struct psmouse *psmouse); +int ps2pp_init(struct psmouse *psmouse, int set_properties); + #endif diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 3d4a30060..0b3826724 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -43,9 +43,9 @@ int psmouse_smartscroll = 1; module_param_named(smartscroll, psmouse_smartscroll, bool, 0); MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); -unsigned int psmouse_resetafter; +static unsigned int psmouse_resetafter; module_param_named(resetafter, psmouse_resetafter, uint, 0); -MODULE_PARM_DESC(resetafter, "Reset Synaptics Touchpad after so many bad packets (0 = never)."); +MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never)."); __obsolete_setup("psmouse_noext"); __obsolete_setup("psmouse_resolution="); @@ -56,15 +56,22 @@ __obsolete_setup("psmouse_rate="); static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"}; /* - * psmouse_process_packet() analyzes the PS/2 mouse packet contents and - * reports relevant events to the input module. + * psmouse_process_byte() analyzes the PS/2 data stream and reports + * relevant events to the input module once full packet has arrived. */ -static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs) +static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse, struct pt_regs *regs) { struct input_dev *dev = &psmouse->dev; unsigned char *packet = psmouse->packet; + if (psmouse->pktcnt < 3 + (psmouse->type >= PSMOUSE_GENPS)) + return PSMOUSE_GOOD_DATA; + +/* + * Full packet accumulated, process it + */ + input_regs(dev, regs); /* @@ -112,6 +119,8 @@ static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0); input_sync(dev); + + return PSMOUSE_FULL_PACKET; } /* @@ -123,6 +132,7 @@ static irqreturn_t psmouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { struct psmouse *psmouse = serio->private; + psmouse_ret_t rc; if (psmouse->state == PSMOUSE_IGNORE) goto out; @@ -180,7 +190,7 @@ static irqreturn_t psmouse_interrupt(struct serio *serio, if (psmouse->pktcnt == 2) { if (psmouse->packet[1] == PSMOUSE_RET_ID) { psmouse->state = PSMOUSE_IGNORE; - serio_rescan(serio); + serio_reconnect(serio); goto out; } if (psmouse->type == PSMOUSE_SYNAPTICS) { @@ -193,19 +203,32 @@ static irqreturn_t psmouse_interrupt(struct serio *serio, } } - if (psmouse->type == PSMOUSE_SYNAPTICS) { - /* - * The synaptics driver has its own resync logic, - * so it needs to receive all bytes one at a time. - */ - synaptics_process_byte(psmouse, regs); - goto out; - } + rc = psmouse->protocol_handler(psmouse, regs); - if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) { - psmouse_process_packet(psmouse, regs); - psmouse->pktcnt = 0; - goto out; + switch (rc) { + case PSMOUSE_BAD_DATA: + printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", + psmouse->name, psmouse->phys, psmouse->pktcnt); + psmouse->pktcnt = 0; + + if (++psmouse->out_of_sync == psmouse_resetafter) { + psmouse->state = PSMOUSE_IGNORE; + printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); + serio_reconnect(psmouse->serio); + } + break; + + case PSMOUSE_FULL_PACKET: + psmouse->pktcnt = 0; + if (psmouse->out_of_sync) { + psmouse->out_of_sync = 0; + printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n", + psmouse->name, psmouse->phys); + } + break; + + case PSMOUSE_GOOD_DATA: + break; } out: return IRQ_HANDLED; @@ -288,6 +311,30 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) } +/* + * psmouse_sliced_command() sends an extended PS/2 command to the mouse + * using sliced syntax, understood by advanced devices, such as Logitech + * or Synaptics touchpads. The command is encoded as: + * 0xE6 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu + * is the command. + */ +int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command) +{ + int i; + + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) + return -1; + + for (i = 6; i >= 0; i -= 2) { + unsigned char d = (command >> i) & 3; + if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) + return -1; + } + + return 0; +} + + /* * psmouse_reset() resets the mouse into power-on state. */ @@ -363,31 +410,31 @@ static int im_explorer_detect(struct psmouse *psmouse) * the mouse may have. */ -static int psmouse_extensions(struct psmouse *psmouse) +static int psmouse_extensions(struct psmouse *psmouse, + unsigned int max_proto, int set_properties) { int synaptics_hardware = 0; - psmouse->vendor = "Generic"; - psmouse->name = "Mouse"; - psmouse->model = 0; - /* * Try Synaptics TouchPad */ - if (psmouse_max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) { + if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) { synaptics_hardware = 1; - psmouse->vendor = "Synaptics"; - psmouse->name = "TouchPad"; - if (psmouse_max_proto > PSMOUSE_IMEX) { - if (synaptics_init(psmouse) == 0) + if (set_properties) { + psmouse->vendor = "Synaptics"; + psmouse->name = "TouchPad"; + } + + if (max_proto > PSMOUSE_IMEX) { + if (!set_properties || synaptics_init(psmouse) == 0) return PSMOUSE_SYNAPTICS; /* * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). * Unfortunately Logitech/Genius probes confuse some firmware versions so * we'll have to skip them. */ - psmouse_max_proto = PSMOUSE_IMEX; + max_proto = PSMOUSE_IMEX; } /* * Make sure that touchpad is in relative mode, gestures (taps) are enabled @@ -395,35 +442,46 @@ static int psmouse_extensions(struct psmouse *psmouse) synaptics_reset(psmouse); } - if (psmouse_max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { - set_bit(BTN_EXTRA, psmouse->dev.keybit); - set_bit(BTN_SIDE, psmouse->dev.keybit); - set_bit(REL_WHEEL, psmouse->dev.relbit); + if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { + + if (set_properties) { + set_bit(BTN_EXTRA, psmouse->dev.keybit); + set_bit(BTN_SIDE, psmouse->dev.keybit); + set_bit(REL_WHEEL, psmouse->dev.relbit); + psmouse->vendor = "Genius"; + psmouse->name = "Wheel Mouse"; + } - psmouse->vendor = "Genius"; - psmouse->name = "Wheel Mouse"; return PSMOUSE_GENPS; } - if (psmouse_max_proto > PSMOUSE_IMEX) { - int type = ps2pp_detect(psmouse); - if (type) + if (max_proto > PSMOUSE_IMEX) { + int type = ps2pp_init(psmouse, set_properties); + if (type > PSMOUSE_PS2) return type; } - if (psmouse_max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) { - set_bit(REL_WHEEL, psmouse->dev.relbit); + if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse)) { - if (psmouse_max_proto >= PSMOUSE_IMEX && - im_explorer_detect(psmouse)) { + if (set_properties) { + set_bit(REL_WHEEL, psmouse->dev.relbit); set_bit(BTN_SIDE, psmouse->dev.keybit); set_bit(BTN_EXTRA, psmouse->dev.keybit); + if (!psmouse->name) + psmouse->name = "Explorer Mouse"; + } + + return PSMOUSE_IMEX; + } + + if (max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) { - psmouse->name = "Explorer Mouse"; - return PSMOUSE_IMEX; + if (set_properties) { + set_bit(REL_WHEEL, psmouse->dev.relbit); + if (!psmouse->name) + psmouse->name = "Wheel Mouse"; } - psmouse->name = "Wheel Mouse"; return PSMOUSE_IMPS; } @@ -473,12 +531,7 @@ static int psmouse_probe(struct psmouse *psmouse) if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS)) printk(KERN_WARNING "psmouse.c: Failed to reset mouse on %s\n", psmouse->serio->phys); -/* - * And here we try to determine if it has any extensions over the - * basic PS/2 3-button mouse. - */ - - return psmouse->type = psmouse_extensions(psmouse); + return 0; } /* @@ -616,7 +669,6 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev) psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); - psmouse->state = PSMOUSE_CMD_MODE; psmouse->serio = serio; psmouse->dev.private = psmouse; @@ -628,13 +680,21 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev) return; } - if (psmouse_probe(psmouse) <= 0) { + if (psmouse_probe(psmouse) < 0) { serio_close(serio); kfree(psmouse); serio->private = NULL; return; } + psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); + if (!psmouse->vendor) + psmouse->vendor = "Generic"; + if (!psmouse->name) + psmouse->name = "Mouse"; + if (!psmouse->protocol_handler) + psmouse->protocol_handler = psmouse_process_byte; + sprintf(psmouse->devname, "%s %s %s", psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name); sprintf(psmouse->phys, "%s/input0", @@ -668,27 +728,24 @@ static int psmouse_reconnect(struct serio *serio) { struct psmouse *psmouse = serio->private; struct serio_dev *dev = serio->dev; - int old_type; if (!dev || !psmouse) { printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); return -1; } - old_type = psmouse->type; - psmouse->state = PSMOUSE_CMD_MODE; - psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0; + psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = psmouse->out_of_sync = 0; if (psmouse->reconnect) { if (psmouse->reconnect(psmouse)) return -1; - } else if (psmouse_probe(psmouse) != old_type) + } else if (psmouse_probe(psmouse) < 0 || + psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) return -1; /* ok, the device type (and capabilities) match the old one, * we can continue using it, complete intialization */ - psmouse->type = old_type; psmouse_initialize(psmouse); if (psmouse->ptport) { diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index e54841ad1..47fbc48f6 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -22,6 +22,13 @@ #define PSMOUSE_ACTIVATED 1 #define PSMOUSE_IGNORE 2 +/* psmouse protocol handler return codes */ +typedef enum { + PSMOUSE_BAD_DATA, + PSMOUSE_GOOD_DATA, + PSMOUSE_FULL_PACKET +} psmouse_ret_t; + struct psmouse; struct psmouse_ptport { @@ -45,6 +52,7 @@ struct psmouse { unsigned char type; unsigned char model; unsigned long last; + unsigned long out_of_sync; unsigned char state; char acking; volatile char ack; @@ -52,6 +60,7 @@ struct psmouse { char devname[64]; char phys[32]; + psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); int (*reconnect)(struct psmouse *psmouse); void (*disconnect)(struct psmouse *psmouse); }; @@ -65,10 +74,10 @@ struct psmouse { #define PSMOUSE_SYNAPTICS 7 int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command); +int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command); int psmouse_reset(struct psmouse *psmouse); extern int psmouse_smartscroll; extern unsigned int psmouse_rate; -extern unsigned int psmouse_resetafter; #endif /* _PSMOUSE_H */ diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index a182ce7f4..2bd152fe0 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -43,34 +43,12 @@ * Synaptics communications functions ****************************************************************************/ -/* - * Use the Synaptics extended ps/2 syntax to write a special command byte. - * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu - * is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd - * and synaptics_mode_cmd) - */ -static int synaptics_special_cmd(struct psmouse *psmouse, unsigned char command) -{ - int i; - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) - return -1; - - for (i = 6; i >= 0; i -= 2) { - unsigned char d = (command >> i) & 3; - if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES)) - return -1; - } - - return 0; -} - /* * Send a command to the synpatics touchpad by special commands */ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) { - if (synaptics_special_cmd(psmouse, c)) + if (psmouse_sliced_command(psmouse, c)) return -1; if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO)) return -1; @@ -84,7 +62,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) { unsigned char param[1]; - if (synaptics_special_cmd(psmouse, mode)) + if (psmouse_sliced_command(psmouse, mode)) return -1; param[0] = SYN_PS_SET_MODE2; if (psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE)) @@ -118,17 +96,31 @@ static int synaptics_capability(struct psmouse *psmouse) if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) return -1; - priv->capabilities = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; priv->ext_cap = 0; if (!SYN_CAP_VALID(priv->capabilities)) return -1; - if (SYN_EXT_CAP_REQUESTS(priv->capabilities)) { + /* + * Unless capExtended is set the rest of the flags should be ignored + */ + if (!SYN_CAP_EXTENDED(priv->capabilities)) + priv->capabilities = 0; + + if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { printk(KERN_ERR "Synaptics claims to have extended capabilities," " but I'm not able to read them."); - } else - priv->ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + } else { + priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; + + /* + * if nExtBtn is greater than 8 it should be considered + * invalid and treated as 0 + */ + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 8) + priv->ext_cap &= 0xff0fff; + } } return 0; } @@ -167,11 +159,12 @@ static void print_ident(struct synaptics_data *priv) if (SYN_CAP_EXTENDED(priv->capabilities)) { printk(KERN_INFO " Touchpad has extended capability bits\n"); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && - SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) <= 8) + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); - else if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + printk(KERN_INFO " -> middle button\n"); + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) printk(KERN_INFO " -> four buttons\n"); if (SYN_CAP_MULTIFINGER(priv->capabilities)) printk(KERN_INFO " -> multifinger detection\n"); @@ -219,21 +212,12 @@ static int synaptics_set_mode(struct psmouse *psmouse, int mode) /***************************************************************************** * Synaptics pass-through PS/2 port support ****************************************************************************/ -static int synaptics_pt_open(struct serio *port) -{ - return 0; -} - -static void synaptics_pt_close(struct serio *port) -{ -} - static int synaptics_pt_write(struct serio *port, unsigned char c) { struct psmouse *parent = port->driver; char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ - if (synaptics_special_cmd(parent, c)) + if (psmouse_sliced_command(parent, c)) return -1; if (psmouse_command(parent, &rate_param, PSMOUSE_CMD_SETRATE)) return -1; @@ -289,165 +273,11 @@ static void synaptics_pt_create(struct psmouse *psmouse) port->serio.name = "Synaptics pass-through"; port->serio.phys = "synaptics-pt/serio0"; port->serio.write = synaptics_pt_write; - port->serio.open = synaptics_pt_open; - port->serio.close = synaptics_pt_close; port->serio.driver = psmouse; port->activate = synaptics_pt_activate; } -/***************************************************************************** - * Driver initialization/cleanup functions - ****************************************************************************/ - -static inline void set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) -{ - dev->absmin[axis] = min; - dev->absmax[axis] = max; - dev->absfuzz[axis] = fuzz; - dev->absflat[axis] = flat; - - set_bit(axis, dev->absbit); -} - -static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) -{ - set_bit(EV_ABS, dev->evbit); - set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); - set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); - set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); - set_bit(ABS_TOOL_WIDTH, dev->absbit); - - set_bit(EV_KEY, dev->evbit); - set_bit(BTN_TOUCH, dev->keybit); - set_bit(BTN_TOOL_FINGER, dev->keybit); - set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); - set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); - - set_bit(BTN_LEFT, dev->keybit); - set_bit(BTN_RIGHT, dev->keybit); - set_bit(BTN_FORWARD, dev->keybit); - set_bit(BTN_BACK, dev->keybit); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) { - switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { - default: - /* - * if nExtBtn is greater than 8 it should be considered - * invalid and treated as 0 - */ - break; - case 8: - set_bit(BTN_7, dev->keybit); - set_bit(BTN_6, dev->keybit); - case 6: - set_bit(BTN_5, dev->keybit); - set_bit(BTN_4, dev->keybit); - case 4: - set_bit(BTN_3, dev->keybit); - set_bit(BTN_2, dev->keybit); - case 2: - set_bit(BTN_1, dev->keybit); - set_bit(BTN_0, dev->keybit); - break; - } - } - - clear_bit(EV_REL, dev->evbit); - clear_bit(REL_X, dev->relbit); - clear_bit(REL_Y, dev->relbit); -} - -void synaptics_reset(struct psmouse *psmouse) -{ - /* reset touchpad back to relative mode, gestures enabled */ - synaptics_mode_cmd(psmouse, 0); -} - -static void synaptics_disconnect(struct psmouse *psmouse) -{ - synaptics_reset(psmouse); - kfree(psmouse->private); -} - -static int synaptics_reconnect(struct psmouse *psmouse) -{ - struct synaptics_data *priv = psmouse->private; - struct synaptics_data old_priv = *priv; - - if (!synaptics_detect(psmouse)) - return -1; - - if (synaptics_query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query Synaptics hardware.\n"); - return -1; - } - - if (old_priv.identity != priv->identity || - old_priv.model_id != priv->model_id || - old_priv.capabilities != priv->capabilities || - old_priv.ext_cap != priv->ext_cap) - return -1; - - if (synaptics_set_mode(psmouse, 0)) { - printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); - return -1; - } - - return 0; -} - -int synaptics_detect(struct psmouse *psmouse) -{ - unsigned char param[4]; - - param[0] = 0; - - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); - psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); - - return param[1] == 0x47; -} - -int synaptics_init(struct psmouse *psmouse) -{ - struct synaptics_data *priv; - - psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); - if (!priv) - return -1; - memset(priv, 0, sizeof(struct synaptics_data)); - - if (synaptics_query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query Synaptics hardware.\n"); - goto init_fail; - } - - if (synaptics_set_mode(psmouse, 0)) { - printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); - goto init_fail; - } - - priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; - - if (SYN_CAP_EXTENDED(priv->capabilities) && SYN_CAP_PASS_THROUGH(priv->capabilities)) - synaptics_pt_create(psmouse); - - print_ident(priv); - set_input_params(&psmouse->dev, priv); - - psmouse->disconnect = synaptics_disconnect; - psmouse->reconnect = synaptics_reconnect; - - return 0; - - init_fail: - kfree(priv); - return -1; -} - /***************************************************************************** * Functions to interpret the absolute mode packets ****************************************************************************/ @@ -471,17 +301,17 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data hw->left = (buf[0] & 0x01) ? 1 : 0; hw->right = (buf[0] & 0x02) ? 1 : 0; - if (SYN_CAP_EXTENDED(priv->capabilities) && - (SYN_CAP_FOUR_BUTTON(priv->capabilities))) { - hw->up = ((buf[3] & 0x01)) ? 1 : 0; - if (hw->left) - hw->up = !hw->up; - hw->down = ((buf[3] & 0x02)) ? 1 : 0; - if (hw->right) - hw->down = !hw->down; + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; + hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; } + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && - ((buf[3] & 2) ? !hw->right : hw->right)) { + ((buf[0] ^ buf[3]) & 0x02)) { switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: /* @@ -490,17 +320,17 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data */ break; case 8: - hw->b7 = ((buf[5] & 0x08)) ? 1 : 0; - hw->b6 = ((buf[4] & 0x08)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0; + hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0; case 6: - hw->b5 = ((buf[5] & 0x04)) ? 1 : 0; - hw->b4 = ((buf[4] & 0x04)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0; + hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0; case 4: - hw->b3 = ((buf[5] & 0x02)) ? 1 : 0; - hw->b2 = ((buf[4] & 0x02)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0; + hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0; case 2: - hw->b1 = ((buf[5] & 0x01)) ? 1 : 0; - hw->b0 = ((buf[4] & 0x01)) ? 1 : 0; + hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0; + hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0; } } } else { @@ -525,6 +355,7 @@ static void synaptics_process_packet(struct psmouse *psmouse) struct synaptics_hw_state hw; int num_fingers; int finger_width; + int i; synaptics_parse_hw_state(psmouse->packet, priv, &hw); @@ -570,32 +401,20 @@ static void synaptics_process_packet(struct psmouse *psmouse) input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); - input_report_key(dev, BTN_LEFT, hw.left); - input_report_key(dev, BTN_RIGHT, hw.right); - input_report_key(dev, BTN_FORWARD, hw.up); - input_report_key(dev, BTN_BACK, hw.down); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) - switch(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { - default: - /* - * if nExtBtn is greater than 8 it should be considered - * invalid and treated as 0 - */ - break; - case 8: - input_report_key(dev, BTN_7, hw.b7); - input_report_key(dev, BTN_6, hw.b6); - case 6: - input_report_key(dev, BTN_5, hw.b5); - input_report_key(dev, BTN_4, hw.b4); - case 4: - input_report_key(dev, BTN_3, hw.b3); - input_report_key(dev, BTN_2, hw.b2); - case 2: - input_report_key(dev, BTN_1, hw.b1); - input_report_key(dev, BTN_0, hw.b0); - break; - } + input_report_key(dev, BTN_LEFT, hw.left); + input_report_key(dev, BTN_RIGHT, hw.right); + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + input_report_key(dev, BTN_MIDDLE, hw.middle); + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + input_report_key(dev, BTN_FORWARD, hw.up); + input_report_key(dev, BTN_BACK, hw.down); + } + + for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) + input_report_key(dev, BTN_0 + i, hw.ext_buttons & (1 << i)); + input_sync(dev); } @@ -607,6 +426,9 @@ static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned cha static unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; static unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; + if (idx < 0 || idx > 4) + return 0; + switch (pkt_type) { case SYN_NEWABS: case SYN_NEWABS_RELAXED: @@ -637,7 +459,7 @@ static unsigned char synaptics_detect_pkt_type(struct psmouse *psmouse) return SYN_NEWABS_STRICT; } -void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) +static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) { struct input_dev *dev = &psmouse->dev; struct synaptics_data *priv = psmouse->private; @@ -645,11 +467,6 @@ void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) input_regs(dev, regs); if (psmouse->pktcnt >= 6) { /* Full packet received */ - if (priv->out_of_sync) { - priv->out_of_sync = 0; - printk(KERN_NOTICE "Synaptics driver resynced.\n"); - } - if (unlikely(priv->pkt_type == SYN_NEWABS)) priv->pkt_type = synaptics_detect_pkt_type(psmouse); @@ -657,16 +474,142 @@ void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs) synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet); else synaptics_process_packet(psmouse); - psmouse->pktcnt = 0; - - } else if (psmouse->pktcnt && - !synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type)) { - printk(KERN_WARNING "Synaptics driver lost sync at byte %d\n", psmouse->pktcnt); - psmouse->pktcnt = 0; - if (++priv->out_of_sync == psmouse_resetafter) { - psmouse->state = PSMOUSE_IGNORE; - printk(KERN_NOTICE "synaptics: issuing reconnect request\n"); - serio_reconnect(psmouse->serio); - } + + return PSMOUSE_FULL_PACKET; + } + + return synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type) ? + PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA; +} + +/***************************************************************************** + * Driver initialization/cleanup functions + ****************************************************************************/ +static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) +{ + int i; + + set_bit(EV_ABS, dev->evbit); + input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); + input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); + input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); + set_bit(ABS_TOOL_WIDTH, dev->absbit); + + set_bit(EV_KEY, dev->evbit); + set_bit(BTN_TOUCH, dev->keybit); + set_bit(BTN_TOOL_FINGER, dev->keybit); + set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); + set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); + + set_bit(BTN_LEFT, dev->keybit); + set_bit(BTN_RIGHT, dev->keybit); + + if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) + set_bit(BTN_MIDDLE, dev->keybit); + + if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { + set_bit(BTN_FORWARD, dev->keybit); + set_bit(BTN_BACK, dev->keybit); + } + + for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) + set_bit(BTN_0 + i, dev->keybit); + + clear_bit(EV_REL, dev->evbit); + clear_bit(REL_X, dev->relbit); + clear_bit(REL_Y, dev->relbit); +} + +void synaptics_reset(struct psmouse *psmouse) +{ + /* reset touchpad back to relative mode, gestures enabled */ + synaptics_mode_cmd(psmouse, 0); +} + +static void synaptics_disconnect(struct psmouse *psmouse) +{ + synaptics_reset(psmouse); + kfree(psmouse->private); +} + +static int synaptics_reconnect(struct psmouse *psmouse) +{ + struct synaptics_data *priv = psmouse->private; + struct synaptics_data old_priv = *priv; + + if (!synaptics_detect(psmouse)) + return -1; + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + return -1; + } + + if (old_priv.identity != priv->identity || + old_priv.model_id != priv->model_id || + old_priv.capabilities != priv->capabilities || + old_priv.ext_cap != priv->ext_cap) + return -1; + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); + return -1; + } + + return 0; +} + +int synaptics_detect(struct psmouse *psmouse) +{ + unsigned char param[4]; + + param[0] = 0; + + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + + return param[1] == 0x47; +} + +int synaptics_init(struct psmouse *psmouse) +{ + struct synaptics_data *priv; + + psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); + if (!priv) + return -1; + memset(priv, 0, sizeof(struct synaptics_data)); + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + goto init_fail; + } + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); + goto init_fail; } + + priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; + + if (SYN_CAP_PASS_THROUGH(priv->capabilities)) + synaptics_pt_create(psmouse); + + print_ident(priv); + set_input_params(&psmouse->dev, priv); + + psmouse->protocol_handler = synaptics_process_byte; + psmouse->disconnect = synaptics_disconnect; + psmouse->reconnect = synaptics_reconnect; + + return 0; + + init_fail: + kfree(priv); + return -1; } + + diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 69764deb6..eb64431a7 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -9,7 +9,6 @@ #ifndef _SYNAPTICS_H #define _SYNAPTICS_H -extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); extern int synaptics_detect(struct psmouse *psmouse); extern int synaptics_init(struct psmouse *psmouse); extern void synaptics_reset(struct psmouse *psmouse); @@ -44,13 +43,14 @@ extern void synaptics_reset(struct psmouse *psmouse); /* synaptics capability bits */ #define SYN_CAP_EXTENDED(c) ((c) & (1 << 23)) +#define SYN_CAP_MIDDLE_BUTTON(c) ((c) & (1 << 18)) #define SYN_CAP_PASS_THROUGH(c) ((c) & (1 << 7)) #define SYN_CAP_SLEEP(c) ((c) & (1 << 4)) #define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) #define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1)) #define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0)) #define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) -#define SYN_EXT_CAP_REQUESTS(c) ((((c) & 0x700000) >> 20) == 1) +#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) /* synaptics modes query bits */ @@ -86,18 +86,12 @@ struct synaptics_hw_state { int y; int z; int w; - int left; - int right; - int up; - int down; - int b0; - int b1; - int b2; - int b3; - int b4; - int b5; - int b6; - int b7; + unsigned int left:1; + unsigned int right:1; + unsigned int middle:1; + unsigned int up:1; + unsigned int down:1; + unsigned char ext_buttons; }; struct synaptics_data { @@ -108,7 +102,6 @@ struct synaptics_data { unsigned long int identity; /* Identification */ /* Data for normal processing */ - unsigned int out_of_sync; /* # of packets out of sync */ int old_w; /* Previous w value */ unsigned char pkt_type; /* packet type - old, new, etc */ }; diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 5482e86de..f266b7ef5 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -2,6 +2,7 @@ * Input driver to ExplorerPS/2 device driver module. * * Copyright (c) 1999-2002 Vojtech Pavlik + * Copyright (c) 2004 Dmitry Torokhov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published by @@ -47,15 +48,24 @@ static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y; module_param(yres, uint, 0); MODULE_PARM_DESC(yres, "Vertical screen resolution"); +struct mousedev_motion { + int dx, dy, dz; +}; + struct mousedev { int exist; int open; int minor; - int misc; char name[16]; wait_queue_head_t wait; struct list_head list; struct input_handle handle; + + struct mousedev_motion packet; + unsigned long buttons; + unsigned int pkt_count; + int old_x[4], old_y[4]; + unsigned int touch; }; struct mousedev_list { @@ -63,13 +73,10 @@ struct mousedev_list { struct mousedev *mousedev; struct list_head node; int dx, dy, dz; - int old_x[4], old_y[4]; unsigned long buttons; signed char ps2[6]; unsigned char ready, buffer, bufsiz; unsigned char mode, imexseq, impsseq; - unsigned int pkt_count; - unsigned char touch; }; #define MOUSEDEV_SEQ_LEN 6 @@ -82,135 +89,157 @@ static struct input_handler mousedev_handler; static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; static struct mousedev mousedev_mix; -#define fx(i) (list->old_x[(list->pkt_count - (i)) & 03]) -#define fy(i) (list->old_y[(list->pkt_count - (i)) & 03]) +#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) +#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) -static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list *list, unsigned int code, int value) +static void mousedev_touchpad_event(struct mousedev *mousedev, unsigned int code, int value) { - int size; - int touchpad; + if (mousedev->touch) { + switch (code) { + case ABS_X: + fx(0) = value; + if (mousedev->pkt_count >= 2) + mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8; + break; - /* Ignore joysticks */ - if (test_bit(BTN_TRIGGER, handle->dev->keybit)) - return; + case ABS_Y: + fy(0) = value; + if (mousedev->pkt_count >= 2) + mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8; + break; + } + } +} - touchpad = test_bit(BTN_TOOL_FINGER, handle->dev->keybit); +static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value) +{ + int size; switch (code) { case ABS_X: - if (touchpad) { - if (list->touch) { - fx(0) = value; - if (list->pkt_count >= 2) - list->dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8; - } - } else { - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size == 0) size = xres; - list->dx += (value * xres - list->old_x[0]) / size; - list->old_x[0] += list->dx * size; - } + size = dev->absmax[ABS_X] - dev->absmin[ABS_X]; + if (size == 0) size = xres; + mousedev->packet.dx = (value * xres - mousedev->old_x[0]) / size; + mousedev->old_x[0] = mousedev->packet.dx * size; break; + case ABS_Y: - if (touchpad) { - if (list->touch) { - fy(0) = value; - if (list->pkt_count >= 2) - list->dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8; - } - } else { - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size == 0) size = yres; - list->dy -= (value * yres - list->old_y[0]) / size; - list->old_y[0] -= list->dy * size; - } + size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y]; + if (size == 0) size = yres; + mousedev->packet.dy = (value * yres - mousedev->old_y[0]) / size; + mousedev->old_y[0] = mousedev->packet.dy * size; break; } } -static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) +static void mousedev_rel_event(struct mousedev *mousedev, unsigned int code, int value) +{ + switch (code) { + case REL_X: mousedev->packet.dx += value; break; + case REL_Y: mousedev->packet.dy -= value; break; + case REL_WHEEL: mousedev->packet.dz -= value; break; + } +} + +static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int value) +{ + int index; + + switch (code) { + case BTN_TOUCH: + case BTN_0: + case BTN_FORWARD: + case BTN_LEFT: index = 0; break; + case BTN_STYLUS: + case BTN_1: + case BTN_RIGHT: index = 1; break; + case BTN_2: + case BTN_STYLUS2: + case BTN_MIDDLE: index = 2; break; + case BTN_3: + case BTN_BACK: + case BTN_SIDE: index = 3; break; + case BTN_4: + case BTN_EXTRA: index = 4; break; + default: return; + } + + if (value) { + set_bit(index, &mousedev->buttons); + set_bit(index, &mousedev_mix.buttons); + } else { + clear_bit(index, &mousedev->buttons); + clear_bit(index, &mousedev_mix.buttons); + } +} + +static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_motion *packet) { - struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL }; - struct mousedev **mousedev = mousedevs; struct mousedev_list *list; - int index, wake; - - while (*mousedev) { - - wake = 0; - - list_for_each_entry(list, &(*mousedev)->list, node) - switch (type) { - case EV_ABS: - mousedev_abs_event(handle, list, code, value); - break; - - case EV_REL: - switch (code) { - case REL_X: list->dx += value; break; - case REL_Y: list->dy -= value; break; - case REL_WHEEL: if (list->mode) list->dz -= value; break; - } - break; - - case EV_KEY: - if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { - /* Handle touchpad data */ - list->touch = value; - if (!list->touch) - list->pkt_count = 0; - break; - } - - switch (code) { - case BTN_TOUCH: - case BTN_0: - case BTN_FORWARD: - case BTN_LEFT: index = 0; break; - case BTN_4: - case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } - case BTN_STYLUS: - case BTN_1: - case BTN_RIGHT: index = 1; break; - case BTN_3: - case BTN_BACK: - case BTN_SIDE: if (list->mode == 2) { index = 3; break; } - case BTN_2: - case BTN_STYLUS2: - case BTN_MIDDLE: index = 2; break; - default: return; - } - switch (value) { - case 0: clear_bit(index, &list->buttons); break; - case 1: set_bit(index, &list->buttons); break; - case 2: return; - } - break; - - case EV_SYN: - switch (code) { - case SYN_REPORT: - if (list->touch) { - list->pkt_count++; - /* Input system eats duplicate events, - * but we need all of them to do correct - * averaging so apply present one forward - */ - fx(0) = fx(1); - fy(0) = fy(1); - } - - list->ready = 1; - kill_fasync(&list->fasync, SIGIO, POLL_IN); - wake = 1; - break; - } + + list_for_each_entry(list, &mousedev->list, node) { + list->dx += packet->dx; + list->dy += packet->dy; + list->dz += packet->dz; + list->buttons = mousedev->buttons; + list->ready = 1; + kill_fasync(&list->fasync, SIGIO, POLL_IN); + } + + wake_up_interruptible(&mousedev->wait); +} + +static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) +{ + struct mousedev *mousedev = handle->private; + + switch (type) { + case EV_ABS: + /* Ignore joysticks */ + if (test_bit(BTN_TRIGGER, handle->dev->keybit)) + return; + + if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) + mousedev_touchpad_event(mousedev, code, value); + else + mousedev_abs_event(handle->dev, mousedev, code, value); + + break; + + case EV_REL: + mousedev_rel_event(mousedev, code, value); + break; + + case EV_KEY: + if (value != 2) { + if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { + /* Handle touchpad data */ + mousedev->touch = value; + if (!mousedev->touch) + mousedev->pkt_count = 0; + } + else + mousedev_key_event(mousedev, code, value); } + break; + + case EV_SYN: + if (code == SYN_REPORT) { + if (mousedev->touch) { + mousedev->pkt_count++; + /* Input system eats duplicate events, but we need all of them + * to do correct averaging so apply present one forward + */ + fx(0) = fx(1); + fy(0) = fy(1); + } - if (wake) - wake_up_interruptible(&((*mousedev)->wait)); + mousedev_notify_readers(mousedev, &mousedev->packet); + mousedev_notify_readers(&mousedev_mix, &mousedev->packet); - mousedev++; + memset(&mousedev->packet, 0, sizeof(struct mousedev_motion)); + } + break; } } @@ -267,7 +296,7 @@ static int mousedev_release(struct inode * inode, struct file * file) mousedev_free(list->mousedev); } } - + kfree(list); return 0; } @@ -301,11 +330,11 @@ static int mousedev_open(struct inode * inode, struct file * file) if (list->mousedev->minor == MOUSEDEV_MIX) { list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { mousedev = handle->private; - if (!mousedev->open && mousedev->exist) + if (!mousedev->open && mousedev->exist) input_open_device(handle); } - } else - if (!mousedev_mix.open && list->mousedev->exist) + } else + if (!mousedev_mix.open && list->mousedev->exist) input_open_device(&list->mousedev->handle); } @@ -326,8 +355,10 @@ static void mousedev_packet(struct mousedev_list *list, unsigned char off) list->dz -= list->ps2[off + 3]; list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1); list->bufsiz++; + } else { + list->ps2[off] |= ((list->buttons & 0x10) >> 3) | ((list->buttons & 0x08) >> 1); } - + if (list->mode == 1) { list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); list->dz -= list->ps2[off + 3]; @@ -391,9 +422,9 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si list->impsseq = 0; list->imexseq = 0; list->mode = 0; - list->ps2[0] = 0xaa; - list->ps2[1] = 0x00; - list->bufsiz = 2; + list->ps2[1] = 0xaa; + list->ps2[2] = 0x00; + list->bufsiz = 3; break; } @@ -403,7 +434,7 @@ static ssize_t mousedev_write(struct file * file, const char __user * buffer, si kill_fasync(&list->fasync, SIGIO, POLL_IN); wake_up_interruptible(&list->mousedev->wait); - + return count; } @@ -431,7 +462,7 @@ static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t co if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count)) return -EFAULT; - return count; + return count; } /* No kernel lock - fine */ @@ -487,7 +518,7 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); - class_simple_device_add(input_class, + class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), dev->dev, "mouse%d", minor); @@ -538,7 +569,7 @@ static struct input_device_id mousedev_ids[] = { }; MODULE_DEVICE_TABLE(input, mousedev_ids); - + static struct input_handler mousedev_handler = { .event = mousedev_event, .connect = mousedev_connect, @@ -553,6 +584,7 @@ static struct input_handler mousedev_handler = { static struct miscdevice psaux_mouse = { PSMOUSE_MINOR, "psaux", &mousedev_fops }; +static int psaux_registered; #endif static int __init mousedev_init(void) @@ -572,7 +604,7 @@ static int __init mousedev_init(void) NULL, "mice"); #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX - if (!(mousedev_mix.misc = !misc_register(&psaux_mouse))) + if (!(psaux_registered = !misc_register(&psaux_mouse))) printk(KERN_WARNING "mice: could not misc_register the device\n"); #endif @@ -584,7 +616,7 @@ static int __init mousedev_init(void) static void __exit mousedev_exit(void) { #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX - if (mousedev_mix.misc) + if (psaux_registered) misc_deregister(&psaux_mouse); #endif devfs_remove("input/mice"); diff --git a/drivers/input/power.c b/drivers/input/power.c index 552dcd870..f7469b55e 100644 --- a/drivers/input/power.c +++ b/drivers/input/power.c @@ -1,7 +1,7 @@ /* * $Id: power.c,v 1.10 2001/09/25 09:17:15 vojtech Exp $ * - * Copyright (c) 2001 "Crazy" James Simmons + * Copyright (c) 2001 "Crazy" James Simmons * * Input driver Power Management. * @@ -51,7 +51,7 @@ static void suspend_button_task_handler(void *data) static DECLARE_WORK(suspend_button_task, suspend_button_task_handler, NULL); -static void power_event(struct input_handle *handle, unsigned int type, +static void power_event(struct input_handle *handle, unsigned int type, unsigned int code, int down) { struct input_dev *dev = handle->dev; @@ -73,7 +73,7 @@ static void power_event(struct input_handle *handle, unsigned int type, case KEY_POWER: /* Hum power down the machine. */ break; - default: + default: return; } } else { @@ -83,9 +83,9 @@ static void power_event(struct input_handle *handle, unsigned int type, /* This is risky. See pm.h for details. */ if (dev->state != PM_RESUME) dev->state = PM_RESUME; - else - dev->state = PM_SUSPEND; - pm_send(dev->pm_dev, dev->state, dev); + else + dev->state = PM_SUSPEND; + pm_send(dev->pm_dev, dev->state, dev); break; case KEY_POWER: /* Turn the input device off completely ? */ @@ -97,14 +97,14 @@ static void power_event(struct input_handle *handle, unsigned int type, return; } -static struct input_handle *power_connect(struct input_handler *handler, - struct input_dev *dev, +static struct input_handle *power_connect(struct input_handler *handler, + struct input_dev *dev, struct input_device_id *id) { struct input_handle *handle; if (!test_bit(EV_KEY, dev->evbit) || !test_bit(EV_PWR, dev->evbit)) - return NULL; + return NULL; if (!test_bit(KEY_SUSPEND, dev->keybit) || (!test_bit(KEY_POWER, dev->keybit))) return NULL; @@ -133,21 +133,21 @@ static struct input_device_id power_ids[] = { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(KEY_SUSPEND)] = BIT(KEY_SUSPEND) } - }, + }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT(EV_KEY) }, .keybit = { [LONG(KEY_POWER)] = BIT(KEY_POWER) } - }, + }, { .flags = INPUT_DEVICE_ID_MATCH_EVBIT, .evbit = { BIT(EV_PWR) }, - }, + }, { }, /* Terminating entry */ }; MODULE_DEVICE_TABLE(input, power_ids); - + static struct input_handler power_handler = { .event = power_event, .connect = power_connect, @@ -172,3 +172,4 @@ module_exit(power_exit); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Input Power Management driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index fb810fa6a..cd74954bd 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig @@ -97,16 +97,6 @@ config SERIO_SA1111 tristate "Intel SA1111 keyboard controller" depends on SA1111 && SERIO -config SERIO_98KBD - tristate "NEC PC-9800 keyboard controller" - depends on X86_PC9800 && SERIO - help - Say Y here if you have the NEC PC-9801/PC-9821 and want to use its - standard keyboard connected to its keyboard controller. - - To compile this driver as a module, choose M here: the - module will be called 98kbd-io. - config SERIO_GSCPS2 tristate "HP GSC PS/2 keyboard and PS/2 mouse controller" depends on GSC && SERIO diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index df6183954..6a780c10f 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c @@ -18,17 +18,19 @@ #include #include #include +#include #include #include #include #include +#include #define KMI_BASE (kmi->base) struct amba_kmi_port { struct serio io; - struct amba_kmi_port *next; + struct clk *clk; unsigned char *base; unsigned int irq; unsigned int divisor; @@ -67,21 +69,38 @@ static int amba_kmi_write(struct serio *io, unsigned char val) static int amba_kmi_open(struct serio *io) { struct amba_kmi_port *kmi = io->driver; + unsigned int divisor; int ret; - writeb(kmi->divisor, KMICLKDIV); + ret = clk_use(kmi->clk); + if (ret) + goto out; + + ret = clk_enable(kmi->clk); + if (ret) + goto clk_unuse; + + divisor = clk_get_rate(kmi->clk) / 8000000 - 1; + writeb(divisor, KMICLKDIV); writeb(KMICR_EN, KMICR); ret = request_irq(kmi->irq, amba_kmi_int, 0, "kmi-pl050", kmi); if (ret) { printk(KERN_ERR "kmi: failed to claim IRQ%d\n", kmi->irq); writeb(0, KMICR); - return ret; + goto clk_disable; } writeb(KMICR_EN | KMICR_RXINTREN, KMICR); return 0; + + clk_disable: + clk_disable(kmi->clk); + clk_unuse: + clk_unuse(kmi->clk); + out: + return ret; } static void amba_kmi_close(struct serio *io) @@ -91,6 +110,8 @@ static void amba_kmi_close(struct serio *io) writeb(0, KMICR); free_irq(kmi->irq, kmi); + clk_disable(kmi->clk); + clk_unuse(kmi->clk); } static int amba_kmi_probe(struct amba_device *dev, void *id) @@ -124,14 +145,20 @@ static int amba_kmi_probe(struct amba_device *dev, void *id) goto out; } - kmi->irq = dev->irq[0]; - kmi->divisor = 24 / 8 - 1; + kmi->clk = clk_get(&dev->dev, "KMIREFCLK"); + if (IS_ERR(kmi->clk)) { + ret = PTR_ERR(kmi->clk); + goto unmap; + } + kmi->irq = dev->irq[0]; amba_set_drvdata(dev, kmi); serio_register_port(&kmi->io); return 0; + unmap: + iounmap(kmi->base); out: kfree(kmi); amba_release_regions(dev); @@ -145,6 +172,7 @@ static int amba_kmi_remove(struct amba_device *dev) amba_set_drvdata(dev, NULL); serio_unregister_port(&kmi->io); + clk_put(kmi->clk); iounmap(kmi->base); kfree(kmi); amba_release_regions(dev); diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index b7fc99e5b..2234ff39d 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index 6f6bf4296..48a0ad587 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -16,7 +16,7 @@ * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. - * + * * TODO: * - Dino testing (did HP ever shipped a machine on which this port * was usable/enabled ?) @@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(parisc, gscps2_device_tbl); #define PFX "gscps2.c: " -/* +/* * Driver constants */ @@ -222,7 +222,7 @@ static LIST_HEAD(ps2port_list); /** * gscps2_interrupt() - Interruption service routine * - * This function reads received PS/2 bytes and processes them on + * This function reads received PS/2 bytes and processes them on * all interfaces. * The problematic part here is, that the keyboard and mouse PS/2 port * share the same interrupt and it's not possible to send data if any @@ -240,9 +240,9 @@ static irqreturn_t gscps2_interrupt(int irq, void *dev, struct pt_regs *regs) unsigned long flags; spin_lock_irqsave(&ps2port->lock, flags); - while ( (ps2port->buffer[ps2port->append].str = + while ( (ps2port->buffer[ps2port->append].str = gscps2_readb_status(ps2port->addr)) & GSC_STAT_RBNE ) { - ps2port->buffer[ps2port->append].data = + ps2port->buffer[ps2port->append].data = gscps2_readb_input(ps2port->addr); ps2port->append = ((ps2port->append+1) & BUFFER_SIZE); } @@ -349,7 +349,7 @@ static int __init gscps2_probe(struct parisc_device *dev) if (!dev->irq) return -ENODEV; - + /* Offset for DINO PS/2. Works with LASI even */ if (dev->id.sversion == 0x96) hpa += GSC_DINO_OFFSET; @@ -368,7 +368,7 @@ static int __init gscps2_probe(struct parisc_device *dev) gscps2_reset(ps2port); ps2port->id = readb(ps2port->addr+GSC_ID) & 0x0f; snprintf(ps2port->name, sizeof(ps2port->name)-1, "%s %s", - gscps2_serio_port.name, + gscps2_serio_port.name, (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse" ); memcpy(&ps2port->port, &gscps2_serio_port, sizeof(gscps2_serio_port)); @@ -401,9 +401,9 @@ static int __init gscps2_probe(struct parisc_device *dev) ps2port->port.phys); serio_register_port(&ps2port->port); - + return 0; - + fail: free_irq(dev->irq, ps2port); @@ -430,7 +430,7 @@ static int __devexit gscps2_remove(struct parisc_device *dev) list_del(&ps2port->node); iounmap(ps2port->addr); #if 0 - release_mem_region(dev->hpa, GSC_STATUS + 4); + release_mem_region(dev->hpa, GSC_STATUS + 4); #endif dev_set_drvdata(&dev->dev, NULL); kfree(ps2port); @@ -441,7 +441,7 @@ static int __devexit gscps2_remove(struct parisc_device *dev) static struct parisc_device_id gscps2_device_tbl[] = { { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */ #ifdef DINO_TESTED - { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ + { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ #endif { 0, } /* 0 terminated list */ }; diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index efe3c289b..e9d8dabd1 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -150,7 +150,7 @@ static int i8042_flush(void) */ static int i8042_command(unsigned char *param, int command) -{ +{ unsigned long flags; int retval = 0, i = 0; @@ -161,7 +161,7 @@ static int i8042_command(unsigned char *param, int command) dbg("%02x -> i8042 (command)", command & 0xff); i8042_write_command(command & 0xff); } - + if (!retval) for (i = 0; i < ((command >> 12) & 0xf); i++) { if ((retval = i8042_wait_write())) break; @@ -172,7 +172,7 @@ static int i8042_command(unsigned char *param, int command) if (!retval) for (i = 0; i < ((command >> 8) & 0xf); i++) { if ((retval = i8042_wait_read())) break; - if (i8042_read_status() & I8042_STR_AUXDATA) + if (i8042_read_status() & I8042_STR_AUXDATA) param[i] = ~i8042_read_data(); else param[i] = i8042_read_data(); @@ -415,17 +415,17 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) } else dfl = 0; dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)", - data, (str >> 6), irq, + data, (str >> 6), irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl, regs); - + goto irq_ret; } dbg("%02x <- i8042 (interrupt, %s, %d%s%s)", - data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, + data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); @@ -474,8 +474,17 @@ static int i8042_enable_mux_mode(struct i8042_values *values, unsigned char *mux if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa9) return -1; param = 0xa4; - if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) + if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == 0x5b) { + +/* + * Do another loop test with the 0x5a value. Doing anything else upsets + * Profusion/ServerWorks OSB4 chipsets. + */ + + param = 0x5a; + i8042_command(¶m, I8042_CMD_AUX_LOOP); return -1; + } if (mux_version) *mux_version = ~param; @@ -530,10 +539,10 @@ static int __init i8042_check_mux(struct i8042_values *values) if (i8042_enable_mux_mode(values, &mux_version)) return -1; - + /* Workaround for broken chips which seem to support MUX, but in reality don't. */ - /* They all report version 12.10 */ - if (mux_version == 0xCA) + /* They all report version 10.12 */ + if (mux_version == 0xAC) return -1; printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n", @@ -598,7 +607,7 @@ static int __init i8042_check_aux(struct i8042_values *values) /* * Bit assignment test - filters out PS/2 i8042's in AT mode */ - + if (i8042_command(¶m, I8042_CMD_AUX_DISABLE)) return -1; if (i8042_command(¶m, I8042_CMD_CTL_RCTR) || (~param & I8042_CTR_AUXDIS)) { @@ -609,7 +618,7 @@ static int __init i8042_check_aux(struct i8042_values *values) if (i8042_command(¶m, I8042_CMD_AUX_ENABLE)) return -1; if (i8042_command(¶m, I8042_CMD_CTL_RCTR) || (param & I8042_CTR_AUXDIS)) - return -1; + return -1; /* * Disable the interface. @@ -639,7 +648,7 @@ static int __init i8042_port_register(struct i8042_values *values, struct serio if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { printk(KERN_WARNING "i8042.c: Can't write CTR while registering.\n"); values->exists = 0; - return -1; + return -1; } printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n", @@ -868,7 +877,7 @@ static int i8042_controller_resume(void) static int i8042_notify_sys(struct notifier_block *this, unsigned long code, void *unused) { - if (code==SYS_DOWN || code==SYS_HALT) + if (code == SYS_DOWN || code == SYS_HALT) i8042_controller_cleanup(); return NOTIFY_DONE; } @@ -997,19 +1006,18 @@ void __exit i8042_exit(void) sysdev_class_unregister(&kbc_sysclass); } - del_timer_sync(&i8042_timer); - i8042_controller_cleanup(); - + if (i8042_kbd_values.exists) serio_unregister_port(&i8042_kbd_port); if (i8042_aux_values.exists) serio_unregister_port(&i8042_aux_port); - + for (i = 0; i < 4; i++) if (i8042_mux_values[i].exists) serio_unregister_port(i8042_mux_port + i); + del_timer_sync(&i8042_timer); i8042_platform_exit(); } diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c index 1df2dd1d2..5f25b21be 100644 --- a/drivers/input/serio/parkbd.c +++ b/drivers/input/serio/parkbd.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -86,20 +86,9 @@ static int parkbd_write(struct serio *port, unsigned char c) return 0; } -static int parkbd_open(struct serio *port) -{ - return 0; -} - -static void parkbd_close(struct serio *port) -{ -} - static struct serio parkbd_port = { .write = parkbd_write, - .open = parkbd_open, - .close = parkbd_close, .name = parkbd_name, .phys = parkbd_phys, }; @@ -115,7 +104,7 @@ static void parkbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) parkbd_writing = 0; parkbd_writelines(3); return; - } + } parkbd_writelines(((parkbd_buffer >> parkbd_counter++) & 1) | 2); @@ -131,7 +120,7 @@ static void parkbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) if ((parkbd_counter == parkbd_mode + 10) || time_after(jiffies, parkbd_last + HZ/100)) { parkbd_counter = 0; parkbd_buffer = 0; - } + } parkbd_buffer |= (parkbd_readlines() >> 1) << parkbd_counter++; diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c index 021763a3e..7f4a26287 100644 --- a/drivers/input/serio/q40kbd.c +++ b/drivers/input/serio/q40kbd.c @@ -4,7 +4,7 @@ * Copyright (c) 2000-2001 Vojtech Pavlik * * Based on the work of: - * Richard Zidlicky + * Richard Zidlicky */ /* @@ -47,23 +47,12 @@ MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver"); MODULE_LICENSE("GPL"); - -static int q40kbd_open(struct serio *port) -{ - return 0; -} -static void q40kbd_close(struct serio *port) -{ -} - static struct serio q40kbd_port = { .type = SERIO_8042, .name = "Q40 kbd port", .phys = "Q40", .write = NULL, - .open = q40kbd_open, - .close = q40kbd_close, }; static irqreturn_t q40kbd_interrupt(int irq, void *dev_id, diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index bcd1aa89a..a2e4be7ae 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c @@ -98,7 +98,7 @@ static int rpckbd_open(struct serio *port) static void rpckbd_close(struct serio *port) { free_irq(IRQ_KEYBOARDRX, port); - free_irq(IRQ_KEYBOARDTX, port); + free_irq(IRQ_KEYBOARDTX, port); } static struct serio rpckbd_port = diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 13d21bf45..6f003197b 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -108,7 +108,7 @@ void serio_handle_events(void) struct serio_event *event; list_for_each_safe(node, next, &serio_event_list) { - event = container_of(node, struct serio_event, node); + event = container_of(node, struct serio_event, node); down(&serio_sem); if (event->serio == NULL) @@ -152,7 +152,7 @@ static int serio_thread(void *nothing) do { serio_handle_events(); - wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); + wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); if (current->flags & PF_FREEZE) refrigerator(PF_FREEZE); } while (!signal_pending(current)); @@ -293,7 +293,7 @@ void serio_unregister_device(struct serio_dev *dev) int serio_open(struct serio *serio, struct serio_dev *dev) { serio->dev = dev; - if (serio->open(serio)) { + if (serio->open && serio->open(serio)) { serio->dev = NULL; return -1; } @@ -303,7 +303,8 @@ int serio_open(struct serio *serio, struct serio_dev *dev) /* called from serio_dev->connect/disconnect methods under serio_sem */ void serio_close(struct serio *serio) { - serio->close(serio); + if (serio->close) + serio->close(serio); serio->dev = NULL; } diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 716fe7d14..19e269249 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c @@ -48,11 +48,6 @@ static int serport_serio_write(struct serio *serio, unsigned char data) return -(serport->tty->driver->write(serport->tty, 0, &data, 1) != 1); } -static int serport_serio_open(struct serio *serio) -{ - return 0; -} - static void serport_serio_close(struct serio *serio) { struct serport *serport = serio->driver; @@ -87,7 +82,6 @@ static int serport_ldisc_open(struct tty_struct *tty) serport->serio.type = SERIO_RS232; serport->serio.write = serport_serio_write; - serport->serio.open = serport_serio_open; serport->serio.close = serport_serio_close; serport->serio.driver = serport; @@ -135,7 +129,7 @@ static int serport_ldisc_room(struct tty_struct *tty) } /* - * serport_ldisc_read() just waits indefinitely if everything goes well. + * serport_ldisc_read() just waits indefinitely if everything goes well. * However, when the serio driver closes the serio port, it finishes, * returning 0 characters. */ @@ -165,7 +159,7 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) { struct serport *serport = (struct serport*) tty->disc_data; - + if (cmd == SPIOCSTYPE) return get_user(serport->serio.type, (unsigned long __user *) arg); diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index 9aec2e1d1..775914980 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c @@ -124,12 +124,10 @@ static void gunze_connect(struct serio *serio, struct serio_dev *dev) memset(gunze, 0, sizeof(struct gunze)); init_input_dev(&gunze->dev); - gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - gunze->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); + gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - - gunze->dev.absmin[ABS_X] = 96; gunze->dev.absmin[ABS_Y] = 72; - gunze->dev.absmax[ABS_X] = 4000; gunze->dev.absmax[ABS_Y] = 3000; + input_set_abs_params(&gunze->dev, ABS_X, 96, 4000, 0, 0); + input_set_abs_params(&gunze->dev, ABS_Y, 72, 3000, 0, 0); gunze->serio = serio; serio->private = gunze; diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index 2f2855a5c..7b4c16d6f 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c @@ -1,11 +1,11 @@ /* * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $ * - * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com + * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com * - * Sponsored by Transvirtual Technology. - * - * Derived from the code in h3600_ts.[ch] by Charles Flynn + * Sponsored by Transvirtual Technology. + * + * Derived from the code in h3600_ts.[ch] by Charles Flynn */ /* @@ -45,6 +45,10 @@ #include #include +MODULE_AUTHOR("James Simmons "); +MODULE_DESCRIPTION("H3600 touchscreen driver"); +MODULE_LICENSE("GPL"); + /* * Definitions & global arrays. */ @@ -75,7 +79,7 @@ #define MAX_ID 14 #define H3600_MAX_LENGTH 16 -#define H3600_KEY 0xf +#define H3600_KEY 0xf #define H3600_SCANCODE_RECORD 1 /* 1 -> record button */ #define H3600_SCANCODE_CALENDAR 2 /* 2 -> calendar */ @@ -103,7 +107,7 @@ struct h3600_dev { char phys[32]; }; -static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs) { int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; @@ -111,21 +115,25 @@ static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs) input_regs(dev, regs); input_report_key(dev, KEY_ENTER, down); input_sync(dev); + + return IRQ_HANDLED; } -static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) { int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; - /* - * This interrupt is only called when we release the key. So we have + /* + * This interrupt is only called when we release the key. So we have * to fake a key press. - */ + */ input_regs(dev, regs); input_report_key(dev, KEY_SUSPEND, 1); - input_report_key(dev, KEY_SUSPEND, down); + input_report_key(dev, KEY_SUSPEND, down); input_sync(dev); + + return IRQ_HANDLED; } #ifdef CONFIG_PM @@ -141,21 +149,21 @@ enum flite_pwr { * h3600_flite_power: enables or disables power to frontlight, using last bright */ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) { - unsigned char brightness = ((pwr==FLITE_PWR_OFF) ? 0:flite_brightness); + unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness; struct h3600_dev *ts = dev->private; - /* Must be in this order */ + /* Must be in this order */ ts->serio->write(ts->serio, 1); ts->serio->write(ts->serio, pwr); - ts->serio->write(ts->serio, brightness); + ts->serio->write(ts->serio, brightness); return 0; } static int suspended = 0; -static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, +static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data) { - struct input_dev *dev = (struct input_dev *) data; + struct input_dev *dev = (struct input_dev *) data; switch (req) { case PM_SUSPEND: /* enter D1-D3 */ @@ -183,7 +191,7 @@ static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, /* * This function translates the native event packets to linux input event * packets. Some packets coming from serial are not touchscreen related. In - * this case we send them off to be processed elsewhere. + * this case we send them off to be processed elsewhere. */ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) { @@ -206,7 +214,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) Note: This is true for non interrupt generated key events. */ case KEYBD_ID: - down = (ts->buf[0] & 0x80) ? 0 : 1; + down = (ts->buf[0] & 0x80) ? 0 : 1; switch (ts->buf[0] & 0x7f) { case H3600_SCANCODE_RECORD: @@ -218,7 +226,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) case H3600_SCANCODE_CONTACTS: key = KEY_PROG2; break; - case H3600_SCANCODE_Q: + case H3600_SCANCODE_Q: key = KEY_Q; break; case H3600_SCANCODE_START: @@ -237,9 +245,9 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) key = KEY_DOWN; break; default: - key = 0; - } - if (key) + key = 0; + } + if (key) input_report_key(dev, key, down); break; /* @@ -251,13 +259,13 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) * byte 0 1 2 3 */ case TOUCHS_ID: - if (!touched) { + if (!touched) { input_report_key(dev, BTN_TOUCH, 1); touched = 1; - } + } if (ts->len) { - unsigned short x, y; + unsigned short x, y; x = ts->buf[0]; x <<= 8; x += ts->buf[1]; y = ts->buf[2]; y <<= 8; y += ts->buf[3]; @@ -267,7 +275,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) } else { input_report_key(dev, BTN_TOUCH, 0); touched = 0; - } + } break; default: /* Send a non input event elsewhere */ @@ -280,7 +288,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) /* * h3600ts_event() handles events from the input module. */ -static int h3600ts_event(struct input_dev *dev, unsigned int type, +static int h3600ts_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { struct h3600_dev *ts = dev->private; @@ -290,7 +298,7 @@ static int h3600ts_event(struct input_dev *dev, unsigned int type, // ts->serio->write(ts->serio, SOME_CMD); return 0; } - } + } return -1; } @@ -317,19 +325,19 @@ static int state; #define STATE_DATA 2 /* state where we decode data */ #define STATE_EOF 3 /* state where we decode checksum or EOF */ -static void h3600ts_interrupt(struct serio *serio, unsigned char data, - unsigned int flags) +static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, + unsigned int flags, struct pt_regs *regs) { struct h3600_dev *ts = serio->private; /* - * We have a new frame coming in. + * We have a new frame coming in. */ switch (state) { case STATE_SOF: if (data == CHAR_SOF) - state = STATE_ID; - return; + state = STATE_ID; + break; case STATE_ID: ts->event = (data & 0xf0) >> 4; ts->len = (data & 0xf); @@ -339,23 +347,25 @@ static void h3600ts_interrupt(struct serio *serio, unsigned char data, break; } ts->chksum = data; - state=(ts->len > 0 ) ? STATE_DATA : STATE_EOF; + state = (ts->len > 0) ? STATE_DATA : STATE_EOF; break; case STATE_DATA: ts->chksum += data; ts->buf[ts->idx]= data; - if(++ts->idx == ts->len) + if(++ts->idx == ts->len) state = STATE_EOF; break; case STATE_EOF: state = STATE_SOF; - if (data == CHAR_EOF || data == ts->chksum ) - h3600ts_process_packet(ts); + if (data == CHAR_EOF || data == ts->chksum) + h3600ts_process_packet(ts, regs); break; default: printk("Error3\n"); break; } + + return IRQ_HANDLED; } /* @@ -378,11 +388,11 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) init_input_dev(&ts->dev); /* Device specific stuff */ - set_GPIO_IRQ_edge( GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES ); - set_GPIO_IRQ_edge( GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE ); + set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); + set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, - SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, + SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); kfree(ts); @@ -390,24 +400,19 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, - SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, + SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", &ts->dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); kfree(ts); return; } + /* Now we have things going we setup our input device */ ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); - ts->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); - ts->dev.ledbit[0] = BIT(LED_SLEEP); - - ts->dev.absmin[ABS_X] = 60; ts->dev.absmin[ABS_Y] = 35; - ts->dev.absmax[ABS_X] = 985; ts->dev.absmax[ABS_Y] = 1024; - ts->dev.absfuzz[ABS_X] = 0; ts->dev.absfuzz[ABS_Y] = 0; - - ts->serio = serio; - serio->private = ts; + ts->dev.ledbit[0] = BIT(LED_SLEEP); + input_set_abs_params(&ts->dev, ABS_X, 60, 985, 0, 0); + input_set_abs_params(&ts->dev, ABS_Y, 35, 1024, 0, 0); set_bit(KEY_RECORD, ts->dev.keybit); set_bit(KEY_Q, ts->dev.keybit); @@ -422,6 +427,9 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND); + ts->serio = serio; + serio->private = ts; + sprintf(ts->phys, "%s/input0", serio->phys); ts->dev.event = h3600ts_event; @@ -442,7 +450,7 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) //h3600_flite_control(1, 25); /* default brightness */ #ifdef CONFIG_PM - ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, + ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, h3600ts_pm_callback); printk("registered pm callback\n"); #endif @@ -458,7 +466,7 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev) static void h3600ts_disconnect(struct serio *serio) { struct h3600_dev *ts = serio->private; - + free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev); input_unregister_device(&ts->dev); diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index 7958ae857..ac072d37c 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c @@ -151,7 +151,7 @@ static int tsdev_release(struct inode *inode, struct file *file) return 0; } -static ssize_t tsdev_read(struct file *file, char *buffer, size_t count, +static ssize_t tsdev_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct tsdev_list *list = file->private_data; diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c index 5fd47f618..8b5822c42 100644 --- a/drivers/isdn/hisax/nj_s.c +++ b/drivers/isdn/hisax/nj_s.c @@ -104,9 +104,12 @@ reset_netjet_s(struct IsdnCardState *cs) cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); mdelay(10); - cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ /* now edge triggered for TJ320 GE 13/07/00 */ /* see comment in IRQ function */ + if (cs->subtyp) /* TJ320 */ + cs->hw.njet.ctrl_reg = 0x40; /* Reset Off and status read clear */ + else + cs->hw.njet.ctrl_reg = 0x00; /* Reset Off and status read clear */ byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); mdelay(10); cs->hw.njet.auxd = 0; @@ -151,7 +154,7 @@ static struct pci_dev *dev_netjet __initdata = NULL; int __init setup_netjet_s(struct IsdnCard *card) { - int bytecnt; + int bytecnt,cfg; struct IsdnCardState *cs = card->cs; char tmp[64]; @@ -183,6 +186,15 @@ setup_netjet_s(struct IsdnCard *card) printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n"); return(0); } + /* the TJ300 and TJ320 must be detected, the IRQ handling is different + * unfortunatly the chips use the same device ID, but the TJ320 has + * the bit20 in status PCI cfg register set + */ + pci_read_config_dword(dev_netjet, 0x04, &cfg); + if (cfg & 0x00100000) + cs->subtyp = 1; /* TJ320 */ + else + cs->subtyp = 0; /* TJ300 */ /* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */ if ((dev_netjet->subsystem_vendor == 0x55) && (dev_netjet->subsystem_device == 0x02)) { @@ -240,8 +252,8 @@ setup_netjet_s(struct IsdnCard *card) bytecnt = 256; printk(KERN_INFO - "NETjet-S: PCI card configured at %#lx IRQ %d\n", - cs->hw.njet.base, cs->irq); + "NETjet-S: %s card configured at %#lx IRQ %d\n", + cs->subtyp ? "TJ320" : "TJ300", cs->hw.njet.base, cs->irq); if (!request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn")) { printk(KERN_WARNING "HiSax: %s config port %#lx-%#lx already in use\n", diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index daec60351..1b95f6005 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c @@ -386,7 +386,7 @@ isdn_all_eaz(int di, int ch) * Begin of a CAPI like LL<->HL interface, currently used only for * supplementary service (CAPI 2.0 part III) */ -#include +#include int isdn_capi_rec_hl_msg(capi_msg *cm) { diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index b9ae866f0..87261d37f 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -180,5 +180,25 @@ config DM_CRYPT If unsure, say N. +config DM_SNAPSHOT + tristate "Snapshot target (EXPERIMENTAL)" + depends on BLK_DEV_DM && EXPERIMENTAL + ---help--- + Allow volume managers to take writeable snapshots of a device. + +config DM_MIRROR + tristate "Mirror target (EXPERIMENTAL)" + depends on BLK_DEV_DM && EXPERIMENTAL + ---help--- + Allow volume managers to mirror logical volumes, also + needed for live data migration tools such as 'pvmove'. + +config DM_ZERO + tristate "Zero target (EXPERIMENTAL)" + depends on BLK_DEV_DM && EXPERIMENTAL + ---help--- + A target that discards writes, and returns all zeroes for + reads. Useful in some recovery situations. + endmenu diff --git a/drivers/md/Makefile b/drivers/md/Makefile index 7b04d6349..0a87c9e40 100644 --- a/drivers/md/Makefile +++ b/drivers/md/Makefile @@ -3,13 +3,17 @@ # dm-mod-objs := dm.o dm-table.o dm-target.o dm-linear.o dm-stripe.o \ - dm-ioctl.o + dm-ioctl.o dm-io.o kcopyd.o +dm-snapshot-objs := dm-snap.o dm-exception-store.o +dm-mirror-objs := dm-log.o dm-raid1.o raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \ raid6int1.o raid6int2.o raid6int4.o \ raid6int8.o raid6int16.o raid6int32.o \ raid6mmx.o raid6sse1.o raid6sse2.o host-progs := mktables +CFLAGS_raid6int8.o += -O2 + # Note: link order is important. All raid personalities # and xor.o must come before md.o, as they each initialise # themselves, and md.o may use the personalities when it @@ -24,6 +28,9 @@ obj-$(CONFIG_MD_MULTIPATH) += multipath.o obj-$(CONFIG_BLK_DEV_MD) += md.o obj-$(CONFIG_BLK_DEV_DM) += dm-mod.o obj-$(CONFIG_DM_CRYPT) += dm-crypt.o +obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o +obj-$(CONFIG_DM_MIRROR) += dm-mirror.o +obj-$(CONFIG_DM_ZERO) += dm-zero.o quiet_cmd_unroll = UNROLL $@ cmd_unroll = $(PERL) $(srctree)/$(src)/unroll.pl $(UNROLL) \ diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 0d508c016..e1703f77c 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -417,9 +417,9 @@ static int list_devices(struct dm_ioctl *param, size_t param_size) return 0; } -static void list_version_get_needed(struct target_type *tt, void *param) +static void list_version_get_needed(struct target_type *tt, void *needed_param) { - int *needed = param; + size_t *needed = needed_param; *needed += strlen(tt->name); *needed += sizeof(tt->version); @@ -1133,7 +1133,7 @@ static ioctl_fn lookup_ioctl(unsigned int cmd) * As well as checking the version compatibility this always * copies the kernel interface version out. */ -static int check_version(unsigned int cmd, struct dm_ioctl *user) +static int check_version(unsigned int cmd, struct dm_ioctl __user *user) { uint32_t version[3]; int r = 0; @@ -1168,7 +1168,7 @@ static void free_params(struct dm_ioctl *param) vfree(param); } -static int copy_params(struct dm_ioctl *user, struct dm_ioctl **param) +static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) { struct dm_ioctl tmp, *dmi; @@ -1225,7 +1225,7 @@ static int ctl_ioctl(struct inode *inode, struct file *file, int r = 0; unsigned int cmd; struct dm_ioctl *param; - struct dm_ioctl *user = (struct dm_ioctl *) u; + struct dm_ioctl __user *user = (struct dm_ioctl __user *) u; ioctl_fn fn = NULL; size_t param_size; diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 14cabe53f..d189f8549 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -400,7 +400,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode) struct dm_dev dd_copy; dev_t dev = dd->bdev->bd_dev; - memcpy(&dd_copy, dd, sizeof(dd_copy)); + dd_copy = *dd; dd->mode |= new_mode; dd->bdev = NULL; @@ -408,7 +408,7 @@ static int upgrade_mode(struct dm_dev *dd, int new_mode) if (!r) close_dev(&dd_copy); else - memcpy(dd, &dd_copy, sizeof(dd_copy)); + *dd = dd_copy; return r; } diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 03381e003..80a1901c4 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -394,7 +394,7 @@ static struct bio *split_bvec(struct bio *bio, sector_t sector, struct bio_vec *bv = bio->bi_io_vec + idx; clone = bio_alloc(GFP_NOIO, 1); - memcpy(clone->bi_io_vec, bv, sizeof(*bv)); + *clone->bi_io_vec = *bv; clone->bi_sector = sector; clone->bi_bdev = bio->bi_bdev; diff --git a/drivers/md/md.c b/drivers/md/md.c index 7992b2106..77cd6e9f3 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1934,7 +1934,7 @@ static int autostart_array(dev_t startdev) } -static int get_version(void * arg) +static int get_version(void __user * arg) { mdu_version_t ver; @@ -1948,7 +1948,7 @@ static int get_version(void * arg) return 0; } -static int get_array_info(mddev_t * mddev, void * arg) +static int get_array_info(mddev_t * mddev, void __user * arg) { mdu_array_info_t info; int nr,working,active,failed,spare; @@ -1998,7 +1998,7 @@ static int get_array_info(mddev_t * mddev, void * arg) return 0; } -static int get_disk_info(mddev_t * mddev, void * arg) +static int get_disk_info(mddev_t * mddev, void __user * arg) { mdu_disk_info_t info; unsigned int nr; @@ -2251,7 +2251,12 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev) return -EINVAL; } - rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + if (mddev->persistent) + rdev->sb_offset = calc_dev_sboffset(rdev->bdev); + else + rdev->sb_offset = + rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS; + size = calc_dev_size(rdev, mddev->chunk_size); rdev->size = size; @@ -2372,6 +2377,103 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) return 0; } +/* + * update_array_info is used to change the configuration of an + * on-line array. + * The version, ctime,level,size,raid_disks,not_persistent, layout,chunk_size + * fields in the info are checked against the array. + * Any differences that cannot be handled will cause an error. + * Normally, only one change can be managed at a time. + */ +static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) +{ + int rv = 0; + int cnt = 0; + + if (mddev->major_version != info->major_version || + mddev->minor_version != info->minor_version || +/* mddev->patch_version != info->patch_version || */ + mddev->ctime != info->ctime || + mddev->level != info->level || + mddev->layout != info->layout || + !mddev->persistent != info->not_persistent|| + mddev->chunk_size != info->chunk_size ) + return -EINVAL; + /* Check there is only one change */ + if (mddev->size != info->size) cnt++; + if (mddev->raid_disks != info->raid_disks) cnt++; + if (cnt == 0) return 0; + if (cnt > 1) return -EINVAL; + + if (mddev->size != info->size) { + mdk_rdev_t * rdev; + struct list_head *tmp; + if (mddev->pers->resize == NULL) + return -EINVAL; + /* The "size" is the amount of each device that is used. + * This can only make sense for arrays with redundancy. + * linear and raid0 always use whatever space is available + * We can only consider changing the size of no resync + * or reconstruction is happening, and if the new size + * is acceptable. It must fit before the sb_offset or, + * if that is sync_thread) + return -EBUSY; + ITERATE_RDEV(mddev,rdev,tmp) { + sector_t avail; + int fit = (info->size == 0); + if (rdev->sb_offset > rdev->data_offset) + avail = (rdev->sb_offset*2) - rdev->data_offset; + else + avail = get_capacity(rdev->bdev->bd_disk) + - rdev->data_offset; + if (fit && (info->size == 0 || info->size > avail/2)) + info->size = avail/2; + if (avail < ((sector_t)info->size << 1)) + return -ENOSPC; + } + rv = mddev->pers->resize(mddev, (sector_t)info->size *2); + if (!rv) { + struct block_device *bdev; + + bdev = bdget_disk(mddev->gendisk, 0); + if (bdev) { + down(&bdev->bd_inode->i_sem); + i_size_write(bdev->bd_inode, mddev->array_size << 10); + up(&bdev->bd_inode->i_sem); + bdput(bdev); + } + } + } + if (mddev->raid_disks != info->raid_disks) { + /* change the number of raid disks */ + if (mddev->pers->reshape == NULL) + return -EINVAL; + if (info->raid_disks <= 0 || + info->raid_disks >= mddev->max_disks) + return -EINVAL; + if (mddev->sync_thread) + return -EBUSY; + rv = mddev->pers->reshape(mddev, info->raid_disks); + if (!rv) { + struct block_device *bdev; + + bdev = bdget_disk(mddev->gendisk, 0); + if (bdev) { + down(&bdev->bd_inode->i_sem); + i_size_write(bdev->bd_inode, mddev->array_size << 10); + up(&bdev->bd_inode->i_sem); + bdput(bdev); + } + } + } + md_update_sb(mddev); + return rv; +} + static int set_disk_faulty(mddev_t *mddev, dev_t dev) { mdk_rdev_t *rdev; @@ -2389,7 +2491,8 @@ static int md_ioctl(struct inode *inode, struct file *file, { char b[BDEVNAME_SIZE]; int err = 0; - struct hd_geometry *loc = (struct hd_geometry *) arg; + void __user *argp = (void __user *)arg; + struct hd_geometry __user *loc = argp; mddev_t *mddev = NULL; if (!capable(CAP_SYS_ADMIN)) @@ -2402,7 +2505,7 @@ static int md_ioctl(struct inode *inode, struct file *file, switch (cmd) { case RAID_VERSION: - err = get_version((void *)arg); + err = get_version(argp); goto done; case PRINT_RAID_DEBUG: @@ -2463,33 +2566,41 @@ static int md_ioctl(struct inode *inode, struct file *file, switch (cmd) { case SET_ARRAY_INFO: - - if (!list_empty(&mddev->disks)) { - printk(KERN_WARNING - "md: array %s already has disks!\n", - mdname(mddev)); - err = -EBUSY; - goto abort_unlock; - } - if (mddev->raid_disks) { - printk(KERN_WARNING - "md: array %s already initialised!\n", - mdname(mddev)); - err = -EBUSY; - goto abort_unlock; - } { mdu_array_info_t info; if (!arg) memset(&info, 0, sizeof(info)); - else if (copy_from_user(&info, (void*)arg, sizeof(info))) { + else if (copy_from_user(&info, argp, sizeof(info))) { err = -EFAULT; goto abort_unlock; } + if (mddev->pers) { + err = update_array_info(mddev, &info); + if (err) { + printk(KERN_WARNING "md: couldn't update" + " array info. %d\n", err); + goto abort_unlock; + } + goto done_unlock; + } + if (!list_empty(&mddev->disks)) { + printk(KERN_WARNING + "md: array %s already has disks!\n", + mdname(mddev)); + err = -EBUSY; + goto abort_unlock; + } + if (mddev->raid_disks) { + printk(KERN_WARNING + "md: array %s already initialised!\n", + mdname(mddev)); + err = -EBUSY; + goto abort_unlock; + } err = set_array_info(mddev, &info); if (err) { printk(KERN_WARNING "md: couldn't set" - " array info. %d\n", err); + " array info. %d\n", err); goto abort_unlock; } } @@ -2513,11 +2624,11 @@ static int md_ioctl(struct inode *inode, struct file *file, switch (cmd) { case GET_ARRAY_INFO: - err = get_array_info(mddev, (void *)arg); + err = get_array_info(mddev, argp); goto done_unlock; case GET_DISK_INFO: - err = get_disk_info(mddev, (void *)arg); + err = get_disk_info(mddev, argp); goto done_unlock; case RESTART_ARRAY_RW: @@ -2543,18 +2654,18 @@ static int md_ioctl(struct inode *inode, struct file *file, err = -EINVAL; goto abort_unlock; } - err = put_user (2, (char *) &loc->heads); + err = put_user (2, (char __user *) &loc->heads); if (err) goto abort_unlock; - err = put_user (4, (char *) &loc->sectors); + err = put_user (4, (char __user *) &loc->sectors); if (err) goto abort_unlock; err = put_user(get_capacity(mddev->gendisk)/8, - (short *) &loc->cylinders); + (short __user *) &loc->cylinders); if (err) goto abort_unlock; err = put_user (get_start_sect(inode->i_bdev), - (long *) &loc->start); + (long __user *) &loc->start); goto done_unlock; } @@ -2573,7 +2684,7 @@ static int md_ioctl(struct inode *inode, struct file *file, case ADD_NEW_DISK: { mdu_disk_info_t info; - if (copy_from_user(&info, (void*)arg, sizeof(info))) + if (copy_from_user(&info, argp, sizeof(info))) err = -EFAULT; else err = add_new_disk(mddev, &info); @@ -3278,7 +3389,7 @@ static void md_do_sync(mddev_t *mddev) j += sectors; if (j>1) mddev->curr_resync = j; - if (last_check + window > j) + if (last_check + window > j || j == max_sectors) continue; last_check = j; @@ -3444,8 +3555,8 @@ void md_check_recovery(mddev_t *mddev) if (rdev->raid_disk >= 0 && rdev->faulty && atomic_read(&rdev->nr_pending)==0) { - mddev->pers->hot_remove_disk(mddev, rdev->raid_disk); - rdev->raid_disk = -1; + if (mddev->pers->hot_remove_disk(mddev, rdev->raid_disk)==0) + rdev->raid_disk = -1; } if (!rdev->faulty && rdev->raid_disk >= 0 && !rdev->in_sync) spares++; diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 8f675d17f..3d8790135 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -54,9 +54,8 @@ static void mp_pool_free(void *mpb, void *data) kfree(mpb); } -static int multipath_map (mddev_t *mddev, mdk_rdev_t **rdevp) +static int multipath_map (multipath_conf_t *conf) { - multipath_conf_t *conf = mddev_to_conf(mddev); int i, disks = conf->raid_disks; /* @@ -68,10 +67,9 @@ static int multipath_map (mddev_t *mddev, mdk_rdev_t **rdevp) for (i = 0; i < disks; i++) { mdk_rdev_t *rdev = conf->multipaths[i].rdev; if (rdev && rdev->in_sync) { - *rdevp = rdev; atomic_inc(&rdev->nr_pending); spin_unlock_irq(&conf->device_lock); - return 0; + return i; } } spin_unlock_irq(&conf->device_lock); @@ -133,25 +131,7 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error) (unsigned long long)bio->bi_sector); multipath_reschedule_retry(mp_bh); } - atomic_dec(&rdev->nr_pending); - return 0; -} - -/* - * This routine returns the disk from which the requested read should - * be done. - */ - -static int multipath_read_balance (multipath_conf_t *conf) -{ - int disk; - - for (disk = 0; disk < conf->raid_disks; disk++) { - mdk_rdev_t *rdev = conf->multipaths[disk].rdev; - if (rdev && rdev->in_sync) - return disk; - } - BUG(); + rdev_dec_pending(rdev, conf->mddev); return 0; } @@ -204,14 +184,14 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio) disk_stat_inc(mddev->gendisk, reads); disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio)); } - /* - * read balancing logic: - */ - spin_lock_irq(&conf->device_lock); - mp_bh->path = multipath_read_balance(conf); + + mp_bh->path = multipath_map(conf); + if (mp_bh->path < 0) { + bio_endio(bio, bio->bi_size, -EIO); + mempool_free(mp_bh, conf->pool); + return 0; + } multipath = conf->multipaths + mp_bh->path; - atomic_inc(&multipath->rdev->nr_pending); - spin_unlock_irq(&conf->device_lock); mp_bh->bio = *bio; mp_bh->bio.bi_bdev = multipath->rdev->bdev; @@ -375,7 +355,7 @@ static void multipathd (mddev_t *mddev) struct multipath_bh *mp_bh; struct bio *bio; unsigned long flags; - mdk_rdev_t *rdev; + multipath_conf_t *conf = mddev_to_conf(mddev); md_check_recovery(mddev); for (;;) { @@ -391,8 +371,7 @@ static void multipathd (mddev_t *mddev) bio = &mp_bh->bio; bio->bi_sector = mp_bh->master_bio->bi_sector; - rdev = NULL; - if (multipath_map (mddev, &rdev)<0) { + if ((mp_bh->path = multipath_map (conf))<0) { printk(KERN_ALERT "multipath: %s: unrecoverable IO read" " error for block %llu\n", bdevname(bio->bi_bdev,b), @@ -403,7 +382,7 @@ static void multipathd (mddev_t *mddev) " to another IO path\n", bdevname(bio->bi_bdev,b), (unsigned long long)bio->bi_sector); - bio->bi_bdev = rdev->bdev; + bio->bi_bdev = conf->multipaths[mp_bh->path].rdev->bdev; generic_make_request(bio); } } diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c600b1b2d..d271b8eef 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -42,16 +42,17 @@ static void unplug_slaves(mddev_t *mddev); static void * r1bio_pool_alloc(int gfp_flags, void *data) { - mddev_t *mddev = data; + struct pool_info *pi = data; r1bio_t *r1_bio; /* allocate a r1bio with room for raid_disks entries in the bios array */ - r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*mddev->raid_disks, + r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*pi->raid_disks, gfp_flags); if (r1_bio) - memset(r1_bio, 0, sizeof(*r1_bio) + sizeof(struct bio*)*mddev->raid_disks); + memset(r1_bio, 0, sizeof(*r1_bio) + + sizeof(struct bio*) * pi->raid_disks); else - unplug_slaves(mddev); + unplug_slaves(pi->mddev); return r1_bio; } @@ -69,22 +70,22 @@ static void r1bio_pool_free(void *r1_bio, void *data) static void * r1buf_pool_alloc(int gfp_flags, void *data) { - conf_t *conf = data; + struct pool_info *pi = data; struct page *page; r1bio_t *r1_bio; struct bio *bio; int i, j; - r1_bio = r1bio_pool_alloc(gfp_flags, conf->mddev); + r1_bio = r1bio_pool_alloc(gfp_flags, pi); if (!r1_bio) { - unplug_slaves(conf->mddev); + unplug_slaves(pi->mddev); return NULL; } /* * Allocate bios : 1 for reading, n-1 for writing */ - for (j = conf->raid_disks ; j-- ; ) { + for (j = pi->raid_disks ; j-- ; ) { bio = bio_alloc(gfp_flags, RESYNC_PAGES); if (!bio) goto out_free_bio; @@ -111,16 +112,16 @@ out_free_pages: for ( ; i > 0 ; i--) __free_page(bio->bi_io_vec[i-1].bv_page); out_free_bio: - while ( ++j < conf->raid_disks ) + while ( ++j < pi->raid_disks ) bio_put(r1_bio->bios[j]); - r1bio_pool_free(r1_bio, conf->mddev); + r1bio_pool_free(r1_bio, data); return NULL; } static void r1buf_pool_free(void *__r1_bio, void *data) { + struct pool_info *pi = data; int i; - conf_t *conf = data; r1bio_t *r1bio = __r1_bio; struct bio *bio = r1bio->bios[0]; @@ -128,10 +129,10 @@ static void r1buf_pool_free(void *__r1_bio, void *data) __free_page(bio->bi_io_vec[i].bv_page); bio->bi_io_vec[i].bv_page = NULL; } - for (i=0 ; i < conf->raid_disks; i++) + for (i=0 ; i < pi->raid_disks; i++) bio_put(r1bio->bios[i]); - r1bio_pool_free(r1bio, conf->mddev); + r1bio_pool_free(r1bio, data); } static void put_all_bios(conf_t *conf, r1bio_t *r1_bio) @@ -296,7 +297,7 @@ static int raid1_end_read_request(struct bio *bio, unsigned int bytes_done, int reschedule_retry(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); return 0; } @@ -343,7 +344,7 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int raid_end_bio_io(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); return 0; } @@ -375,7 +376,8 @@ static int read_balance(conf_t *conf, struct bio *bio, r1bio_t *r1_bio) * device if no resync is going on, or below the resync window. * We take the first readable disk when above the resync window. */ - if (!conf->mddev->in_sync && (this_sector + sectors >= conf->next_resync)) { + if (conf->mddev->recovery_cp < MaxSector && + (this_sector + sectors >= conf->next_resync)) { /* make sure that disk is operational */ new_disk = 0; @@ -510,7 +512,7 @@ static int make_request(request_queue_t *q, struct bio * bio) mirror_info_t *mirror; r1bio_t *r1_bio; struct bio *read_bio; - int i, disks = conf->raid_disks; + int i, disks; /* * Register the new request and wait if the reconstruction @@ -570,6 +572,7 @@ static int make_request(request_queue_t *q, struct bio * bio) * inc refcount on their rdev. Record them by setting * bios[x] to bio */ + disks = conf->raid_disks; spin_lock_irq(&conf->device_lock); for (i = 0; i < disks; i++) { if (conf->mirrors[i].rdev && @@ -805,7 +808,7 @@ static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error) conf->mirrors[r1_bio->read_disk].rdev); else set_bit(R1BIO_Uptodate, &r1_bio->state); - atomic_dec(&conf->mirrors[r1_bio->read_disk].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev); reschedule_retry(r1_bio); return 0; } @@ -835,7 +838,7 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) md_done_sync(mddev, r1_bio->sectors, uptodate); put_buf(r1_bio); } - atomic_dec(&conf->mirrors[mirror].rdev->nr_pending); + rdev_dec_pending(conf->mirrors[mirror].rdev, mddev); return 0; } @@ -953,7 +956,8 @@ static int init_resync(conf_t *conf) buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE; if (conf->r1buf_pool) BUG(); - conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, conf); + conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, + conf->poolinfo); if (!conf->r1buf_pool) return -ENOMEM; conf->next_resync = 0; @@ -979,6 +983,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) sector_t max_sector, nr_sectors; int disk; int i; + int write_targets = 0; if (!conf->r1buf_pool) if (init_resync(conf)) @@ -1055,12 +1060,24 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) sector_nr + RESYNC_SECTORS > mddev->recovery_cp)) { bio->bi_rw = WRITE; bio->bi_end_io = end_sync_write; + write_targets ++; } else continue; bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset; bio->bi_bdev = conf->mirrors[i].rdev->bdev; bio->bi_private = r1_bio; } + if (write_targets == 0) { + /* There is nowhere to write, so all non-sync + * drives must be failed - so we are finished + */ + int rv = max_sector - sector_nr; + md_done_sync(mddev, rv, 1); + put_buf(r1_bio); + atomic_dec(&conf->mirrors[disk].rdev->nr_pending); + return rv; + } + nr_sectors = 0; do { struct page *page; @@ -1123,28 +1140,28 @@ static int run(mddev_t *mddev) */ conf = kmalloc(sizeof(conf_t), GFP_KERNEL); mddev->private = conf; - if (!conf) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out; - } + if (!conf) + goto out_no_mem; + memset(conf, 0, sizeof(*conf)); conf->mirrors = kmalloc(sizeof(struct mirror_info)*mddev->raid_disks, GFP_KERNEL); - if (!conf->mirrors) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out_free_conf; - } + if (!conf->mirrors) + goto out_no_mem; + memset(conf->mirrors, 0, sizeof(struct mirror_info)*mddev->raid_disks); + conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL); + if (!conf->poolinfo) + goto out_no_mem; + conf->poolinfo->mddev = mddev; + conf->poolinfo->raid_disks = mddev->raid_disks; conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, - r1bio_pool_free, mddev); - if (!conf->r1bio_pool) { - printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", - mdname(mddev)); - goto out_free_conf; - } + r1bio_pool_free, + conf->poolinfo); + if (!conf->r1bio_pool) + goto out_no_mem; + mddev->queue->unplug_fn = raid1_unplug; @@ -1230,13 +1247,21 @@ static int run(mddev_t *mddev) return 0; +out_no_mem: + printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", + mdname(mddev)); + out_free_conf: - if (conf->r1bio_pool) - mempool_destroy(conf->r1bio_pool); - if (conf->mirrors) - kfree(conf->mirrors); - kfree(conf); - mddev->private = NULL; + if (conf) { + if (conf->r1bio_pool) + mempool_destroy(conf->r1bio_pool); + if (conf->mirrors) + kfree(conf->mirrors); + if (conf->poolinfo) + kfree(conf->poolinfo); + kfree(conf); + mddev->private = NULL; + } out: return -EIO; } @@ -1251,11 +1276,108 @@ static int stop(mddev_t *mddev) mempool_destroy(conf->r1bio_pool); if (conf->mirrors) kfree(conf->mirrors); + if (conf->poolinfo) + kfree(conf->poolinfo); kfree(conf); mddev->private = NULL; return 0; } +static int raid1_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + mddev->array_size = sectors>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = mddev->array_size; + return 0; +} + +static int raid1_reshape(mddev_t *mddev, int raid_disks) +{ + /* We need to: + * 1/ resize the r1bio_pool + * 2/ resize conf->mirrors + * + * We allocate a new r1bio_pool if we can. + * Then raise a device barrier and wait until all IO stops. + * Then resize conf->mirrors and swap in the new r1bio pool. + */ + mempool_t *newpool, *oldpool; + struct pool_info *newpoolinfo; + mirror_info_t *newmirrors; + conf_t *conf = mddev_to_conf(mddev); + + int d; + + for (d= raid_disks; d < conf->raid_disks; d++) + if (conf->mirrors[d].rdev) + return -EBUSY; + + newpoolinfo = kmalloc(sizeof(newpoolinfo), GFP_KERNEL); + if (!newpoolinfo) + return -ENOMEM; + newpoolinfo->mddev = mddev; + newpoolinfo->raid_disks = raid_disks; + + newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc, + r1bio_pool_free, newpoolinfo); + if (!newpool) { + kfree(newpoolinfo); + return -ENOMEM; + } + newmirrors = kmalloc(sizeof(struct mirror_info) * raid_disks, GFP_KERNEL); + if (!newmirrors) { + kfree(newpoolinfo); + mempool_destroy(newpool); + return -ENOMEM; + } + memset(newmirrors, 0, sizeof(struct mirror_info)*raid_disks); + + spin_lock_irq(&conf->resync_lock); + conf->barrier++; + wait_event_lock_irq(conf->wait_idle, !conf->nr_pending, + conf->resync_lock, unplug_slaves(mddev)); + spin_unlock_irq(&conf->resync_lock); + + /* ok, everything is stopped */ + oldpool = conf->r1bio_pool; + conf->r1bio_pool = newpool; + for (d=0; d < raid_disks && d < conf->raid_disks; d++) + newmirrors[d] = conf->mirrors[d]; + kfree(conf->mirrors); + conf->mirrors = newmirrors; + kfree(conf->poolinfo); + conf->poolinfo = newpoolinfo; + + mddev->degraded += (raid_disks - conf->raid_disks); + conf->raid_disks = mddev->raid_disks = raid_disks; + + spin_lock_irq(&conf->resync_lock); + conf->barrier--; + spin_unlock_irq(&conf->resync_lock); + wake_up(&conf->wait_resume); + wake_up(&conf->wait_idle); + + + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + md_wakeup_thread(mddev->thread); + + mempool_destroy(oldpool); + return 0; +} + + static mdk_personality_t raid1_personality = { .name = "raid1", @@ -1269,6 +1391,8 @@ static mdk_personality_t raid1_personality = .hot_remove_disk= raid1_remove_disk, .spare_active = raid1_spare_active, .sync_request = sync_request, + .resize = raid1_resize, + .reshape = raid1_reshape, }; static int __init raid_init(void) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 402edd5e3..773f9bfe7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -395,7 +395,7 @@ static int raid5_end_read_request (struct bio * bi, unsigned int bytes_done, md_error(conf->mddev, conf->disks[i].rdev); clear_bit(R5_UPTODATE, &sh->dev[i].flags); } - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); #if 0 /* must restore b_page before unlocking buffer... */ if (sh->bh_page[i] != bh->b_page) { @@ -438,7 +438,7 @@ static int raid5_end_write_request (struct bio *bi, unsigned int bytes_done, if (!uptodate) md_error(conf->mddev, conf->disks[i].rdev); - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); clear_bit(R5_LOCKED, &sh->dev[i].flags); set_bit(STRIPE_HANDLE, &sh->state); @@ -1037,7 +1037,7 @@ static void handle_stripe(struct stripe_head *sh) * parity, or to satisfy requests * or to load a block that is being partially written. */ - if (to_read || non_overwrite || (syncing && (uptodate+failed < disks))) { + if (to_read || non_overwrite || (syncing && (uptodate < disks))) { for (i=disks; i--;) { dev = &sh->dev[i]; if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) && @@ -1577,6 +1577,9 @@ static int run (mddev_t *mddev) conf->algorithm = mddev->layout; conf->max_nr_stripes = NR_STRIPES; + /* device size must be a multiple of chunk size */ + mddev->size &= ~(mddev->chunk_size/1024 -1); + if (!conf->chunk_size || conf->chunk_size % 4) { printk(KERN_ERR "raid5: invalid chunk size %d for %s\n", conf->chunk_size, mdname(mddev)); @@ -1828,6 +1831,27 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) return found; } +static int raid5_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + sectors &= ~((sector_t)mddev->chunk_size/512 - 1); + mddev->array_size = (sectors * (mddev->raid_disks-1))>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = sectors /2; + return 0; +} + static mdk_personality_t raid5_personality= { .name = "raid5", @@ -1841,6 +1865,7 @@ static mdk_personality_t raid5_personality= .hot_remove_disk= raid5_remove_disk, .spare_active = raid5_spare_active, .sync_request = sync_request, + .resize = raid5_resize, }; static int __init raid5_init (void) diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index ceaec272e..714dfb2e1 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c @@ -414,7 +414,7 @@ static int raid6_end_read_request (struct bio * bi, unsigned int bytes_done, md_error(conf->mddev, conf->disks[i].rdev); clear_bit(R5_UPTODATE, &sh->dev[i].flags); } - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); #if 0 /* must restore b_page before unlocking buffer... */ if (sh->bh_page[i] != bh->b_page) { @@ -457,7 +457,7 @@ static int raid6_end_write_request (struct bio *bi, unsigned int bytes_done, if (!uptodate) md_error(conf->mddev, conf->disks[i].rdev); - atomic_dec(&conf->disks[i].rdev->nr_pending); + rdev_dec_pending(conf->disks[i].rdev, conf->mddev); clear_bit(R5_LOCKED, &sh->dev[i].flags); set_bit(STRIPE_HANDLE, &sh->state); @@ -1157,7 +1157,7 @@ static void handle_stripe(struct stripe_head *sh) * parity, or to satisfy requests * or to load a block that is being partially written. */ - if (to_read || non_overwrite || (syncing && (uptodate+failed < disks))) { + if (to_read || non_overwrite || (syncing && (uptodate < disks))) { for (i=disks; i--;) { dev = &sh->dev[i]; if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) && @@ -1741,6 +1741,9 @@ static int run (mddev_t *mddev) conf->algorithm = mddev->layout; conf->max_nr_stripes = NR_STRIPES; + /* device size must be a multiple of chunk size */ + mddev->size &= ~(mddev->chunk_size/1024 -1); + if (conf->raid_disks < 4) { printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n", mdname(mddev), conf->raid_disks); @@ -1997,6 +2000,27 @@ static int raid6_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) return found; } +static int raid6_resize(mddev_t *mddev, sector_t sectors) +{ + /* no resync is happening, and there is enough space + * on all devices, so we can resize. + * We need to make sure resync covers any new space. + * If the array is shrinking we should possibly wait until + * any io in the removed space completes, but it hardly seems + * worth it. + */ + sectors &= ~((sector_t)mddev->chunk_size/512 - 1); + mddev->array_size = (sectors * (mddev->raid_disks-2))>>1; + set_capacity(mddev->gendisk, mddev->array_size << 1); + mddev->changed = 1; + if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { + mddev->recovery_cp = mddev->size << 1; + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); + } + mddev->size = sectors /2; + return 0; +} + static mdk_personality_t raid6_personality= { .name = "raid6", @@ -2010,6 +2034,7 @@ static mdk_personality_t raid6_personality= .hot_remove_disk= raid6_remove_disk, .spare_active = raid6_spare_active, .sync_request = sync_request, + .resize = raid6_resize, }; static int __init raid6_init (void) diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 26995e2d5..a61e91ac7 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -396,7 +396,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) return 0; } -static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos) +static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) { struct saa7146_fh *fh = file->private_data; diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 02dc94dca..20d86a8c4 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c @@ -190,6 +190,7 @@ static int tda10045h_fwinfo_count = sizeof(tda10045h_fwinfo) / sizeof(struct fwi static struct fwinfo tda10046h_fwinfo[] = { {.file_size = 286720,.fw_offset = 0x3c4f9,.fw_size = 24479} }; static int tda10046h_fwinfo_count = sizeof(tda10046h_fwinfo) / sizeof(struct fwinfo); +static int errno; static int tda1004x_write_byte(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda_state, int reg, int data) diff --git a/drivers/message/fusion/isense.c b/drivers/message/fusion/isense.c index 5933adff1..53b5a0f22 100644 --- a/drivers/message/fusion/isense.c +++ b/drivers/message/fusion/isense.c @@ -56,14 +56,6 @@ #include #include #include -#if defined (__sparc__) -#include -#endif - -/* Hmmm, avoid undefined spinlock_t on lk-2.2.14-5.0 */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -#include -#endif #define MODULEAUTHOR "Steven J. Ralston" #define COPYRIGHT "Copyright (c) 2001-2004 " MODULEAUTHOR diff --git a/drivers/message/fusion/linux_compat.h b/drivers/message/fusion/linux_compat.h index 37b761862..d9a4d9fec 100644 --- a/drivers/message/fusion/linux_compat.h +++ b/drivers/message/fusion/linux_compat.h @@ -2,196 +2,7 @@ #ifndef FUSION_LINUX_COMPAT_H #define FUSION_LINUX_COMPAT_H -/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include -#include -#include -#include - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -#ifndef rwlock_init -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) -#endif - -#define SET_NICE(current,x) do {(current)->nice = (x);} while (0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) - typedef unsigned int dma_addr_t; -# endif -#else -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42) - typedef unsigned int dma_addr_t; -# endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) -/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -/* This block snipped from lk-2.2.18/include/linux/init.h { */ -/* - * Used for initialization calls.. - */ -typedef int (*initcall_t)(void); -typedef void (*exitcall_t)(void); - -#define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) -#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit"))) - -extern initcall_t __initcall_start, __initcall_end; - -#define __initcall(fn) \ - static initcall_t __initcall_##fn __init_call = fn -#define __exitcall(fn) \ - static exitcall_t __exitcall_##fn __exit_call = fn - -#ifdef MODULE -/* These macros create a dummy inline: gcc 2.9x does not count alias - as usage, hence the `unused function' warning when __init functions - are declared static. We use the dummy __*_module_inline functions - both to kill the warning and check the type of the init/cleanup - function. */ -typedef int (*__init_module_func_t)(void); -typedef void (*__cleanup_module_func_t)(void); -#define module_init(x) \ - int init_module(void) __attribute__((alias(#x))); \ - static inline __init_module_func_t __init_module_inline(void) \ - { return x; } -#define module_exit(x) \ - void cleanup_module(void) __attribute__((alias(#x))); \ - static inline __cleanup_module_func_t __cleanup_module_inline(void) \ - { return x; } - -#else -#define module_init(x) __initcall(x); -#define module_exit(x) __exitcall(x); -#endif -/* } block snipped from lk-2.2.18/include/linux/init.h */ - -/* This block snipped from lk-2.2.18/include/linux/sched.h { */ -/* - * Used prior to schedule_timeout calls.. - */ -#define __set_current_state(state_value) do { current->state = state_value; } while (0) -#ifdef CONFIG_SMP -#define set_current_state(state_value) do { __set_current_state(state_value); mb(); } while (0) -#else -#define set_current_state(state_value) __set_current_state(state_value) -#endif -/* } block snipped from lk-2.2.18/include/linux/sched.h */ - -/* procfs compat stuff... */ -#define proc_mkdir(x,y) create_proc_entry(x, S_IFDIR, y) - -/* MUTEX compat stuff... */ -#define DECLARE_MUTEX(name) struct semaphore name=MUTEX -#define DECLARE_MUTEX_LOCKED(name) struct semaphore name=MUTEX_LOCKED -#define init_MUTEX(x) *(x)=MUTEX -#define init_MUTEX_LOCKED(x) *(x)=MUTEX_LOCKED - -/* Wait queues. */ -#define DECLARE_WAIT_QUEUE_HEAD(name) \ - struct wait_queue * (name) = NULL -#define DECLARE_WAITQUEUE(name, task) \ - struct wait_queue (name) = { (task), NULL } - -#if defined(__sparc__) && defined(__sparc_v9__) -/* The sparc64 ioremap implementation is wrong in 2.2.x, - * but fixing it would break all of the drivers which - * workaround it. Fixed in 2.3.x onward. -DaveM - */ -#define ARCH_IOREMAP(base) ((unsigned long) (base)) -#else -#define ARCH_IOREMAP(base) ioremap(base) -#endif - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#else /* LINUX_VERSION_CODE must be >= KERNEL_VERSION(2,2,18) */ - -/* No ioremap bugs in >2.3.x kernels. */ -#define ARCH_IOREMAP(base) ioremap(base) - -/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) */ - - -/* - * Inclined to use: - * #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) - * here, but MODULE_LICENSE defined in 2.4.9-6 and 2.4.9-13 - * breaks the rule:-( - */ -#ifndef MODULE_LICENSE -#define MODULE_LICENSE(license) -#endif - - -/* PCI/driver subsystem { */ -#define PCI_BASEADDR_FLAGS(idx) resource[idx].flags -#define PCI_BASEADDR_START(idx) resource[idx].start -#define PCI_BASEADDR_SIZE(dev,idx) (dev)->resource[idx].end - (dev)->resource[idx].start + 1 - -/* Compatability for the 2.3.x PCI DMA API. */ -#ifndef PCI_DMA_BIDIRECTIONAL -/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -#define PCI_DMA_BIDIRECTIONAL 0 -#define PCI_DMA_TODEVICE 1 -#define PCI_DMA_FROMDEVICE 2 -#define PCI_DMA_NONE 3 - -#ifdef __KERNEL__ -#include -/* Pure 2^n version of get_order */ -static __inline__ int __get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} -#endif - -#define pci_alloc_consistent(hwdev, size, dma_handle) \ -({ void *__ret = (void *)__get_free_pages(GFP_ATOMIC, __get_order(size)); \ - if (__ret != NULL) { \ - memset(__ret, 0, size); \ - *(dma_handle) = virt_to_bus(__ret); \ - } \ - __ret; \ -}) - -#define pci_free_consistent(hwdev, size, vaddr, dma_handle) \ - free_pages((unsigned long)vaddr, __get_order(size)) - -#define pci_map_single(hwdev, ptr, size, direction) \ - virt_to_bus(ptr); - -#define pci_unmap_single(hwdev, dma_addr, size, direction) \ - do { /* Nothing to do */ } while (0) - -#define pci_map_sg(hwdev, sg, nents, direction) (nents) -#define pci_unmap_sg(hwdev, sg, nents, direction) \ - do { /* Nothing to do */ } while(0) - -#define sg_dma_address(sg) (virt_to_bus((sg)->address)) -#define sg_dma_len(sg) ((sg)->length) - -/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#endif /* PCI_DMA_BIDIRECTIONAL */ - - -#define mpt_work_struct work_struct -#define MPT_INIT_WORK(_task, _func, _data) INIT_WORK(_task, _func, _data) -#define mpt_sync_irq(_irq) synchronize_irq(_irq) /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ #endif /* _LINUX_COMPAT_H */ - diff --git a/drivers/message/fusion/lsi/mpi_type.h b/drivers/message/fusion/lsi/mpi_type.h index 755732c47..239328a76 100644 --- a/drivers/message/fusion/lsi/mpi_type.h +++ b/drivers/message/fusion/lsi/mpi_type.h @@ -47,18 +47,13 @@ typedef signed short S16; typedef unsigned short U16; -#if defined(unix) || defined(__arm) || defined(ALPHA) - - typedef signed int S32; - typedef unsigned int U32; - -#else - - typedef signed long S32; - typedef unsigned long U32; - -#endif +typedef int32_t S32; +typedef u_int32_t U32; +/* + * The only way crap below could work on big-endian boxen would be if it + * wasn't used at all. + */ typedef struct _S64 { diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index fba96eb6d..b2d7333dc 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -1311,14 +1311,14 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) mem_phys = msize = 0; port = psize = 0; for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { - if (pdev->PCI_BASEADDR_FLAGS(ii) & PCI_BASE_ADDRESS_SPACE_IO) { + if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { /* Get I/O space! */ - port = pdev->PCI_BASEADDR_START(ii); - psize = PCI_BASEADDR_SIZE(pdev,ii); + port = pci_resource_start(pdev, ii); + psize = pci_resource_len(pdev,ii); } else { /* Get memmap */ - mem_phys = pdev->PCI_BASEADDR_START(ii); - msize = PCI_BASEADDR_SIZE(pdev,ii); + mem_phys = pci_resource_start(pdev, ii); + msize = pci_resource_len(pdev,ii); break; } } @@ -1524,7 +1524,7 @@ mptbase_remove(struct pci_dev *pdev) CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF); ioc->active = 0; - mpt_sync_irq(pdev->irq); + synchronize_irq(pdev->irq); /* Clear any lingering interrupt */ CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); @@ -3799,7 +3799,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) /* Prime reply FIFO... */ dprintk((KERN_INFO MYNAM ": %s.reply_alloc @ %p[%p], sz=%d bytes\n", - ioc->name, mem, (void *)(ulong)ioc->reply_alloc_dma, reply_buffer_sz)); + ioc->name, ioc->reply_alloc, + (void *)(ulong)ioc->reply_alloc_dma, reply_buffer_sz)); b = (unsigned long) ioc->reply_alloc; b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */ @@ -3812,7 +3813,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) /* Request FIFO - WE manage this! */ dprintk((KERN_INFO MYNAM ": %s.req_alloc @ %p[%p], sz=%d bytes\n", - ioc->name, mem, (void *)(ulong)ioc->req_alloc_dma, request_buffer_sz)); + ioc->name, ioc->req_alloc, + (void *)(ulong)ioc->req_alloc_dma, request_buffer_sz)); b = (unsigned long) ioc->req_alloc; b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */ diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 8b4484404..d0235cbf5 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -55,7 +55,11 @@ #define MPTBASE_H_INCLUDED /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include "linux_compat.h" /* linux-2.2.x (vs. -2.4.x) tweaks */ +#include +#include +#include +#include + #include "scsi3.h" /* SCSI defines */ #include "lsi/mpi_type.h" @@ -81,8 +85,8 @@ #define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR #endif -#define MPT_LINUX_VERSION_COMMON "3.01.06" -#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.06" +#define MPT_LINUX_VERSION_COMMON "3.01.07" +#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.07" #define WHAT_MAGIC_STRING "@" "(" "#" ")" #define show_mptmod_ver(s,ver) \ diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 434ceb1ca..a0e9b1929 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -86,11 +86,12 @@ #include #include +#include #include /* needed for access to Scsi_Host struct */ #include #include "../../scsi/scsi.h" -#include "../../scsi/hosts.h" +#include #define COPYRIGHT "Copyright (c) 1999-2004 LSI Logic Corporation" #define MODULEAUTHOR "Steven J. Ralston, Noah Romer, Pamela Delaney" @@ -102,9 +103,6 @@ #define my_VERSION MPT_LINUX_VERSION_COMMON #define MYNAM "mptctl" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62) -EXPORT_NO_SYMBOLS; -#endif MODULE_AUTHOR(MODULEAUTHOR); MODULE_DESCRIPTION(my_NAME); MODULE_LICENSE("GPL"); @@ -144,8 +142,8 @@ static int mptctl_hp_targetinfo(unsigned long arg); /* * Private function calls. */ -static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local); -static int mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen); +static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr); +static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); static MptSge_t *kbuf_alloc_2_sgl( int bytes, u32 dir, int sge_offset, int *frags, struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); static void kfree_sgl( MptSge_t *sgl, dma_addr_t sgl_dma, @@ -545,38 +543,6 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) return 1; } -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -/* - * struct file_operations functionality. - * Members: - * llseek, write, read, ioctl, open, release - */ -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9) -static loff_t -mptctl_llseek(struct file *file, loff_t offset, int origin) -{ - return -ESPIPE; -} -#define no_llseek mptctl_llseek -#endif - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static ssize_t -mptctl_write(struct file *file, const char *buf, size_t count, loff_t *ppos) -{ - printk(KERN_ERR MYNAM ": ioctl WRITE not yet supported\n"); - return 0; -} - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static ssize_t -mptctl_read(struct file *file, char *buf, size_t count, loff_t *ptr) -{ - printk(KERN_ERR MYNAM ": ioctl READ not yet supported\n"); - return 0; -} - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* * MPT ioctl handler @@ -586,7 +552,7 @@ mptctl_read(struct file *file, char *buf, size_t count, loff_t *ptr) static int mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - mpt_ioctl_header *uhdr = (mpt_ioctl_header *) arg; + mpt_ioctl_header __user *uhdr = (void __user *) arg; mpt_ioctl_header khdr; int iocnum; unsigned iocnumX; @@ -599,7 +565,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned if (copy_from_user(&khdr, uhdr, sizeof(khdr))) { printk(KERN_ERR "%s::mptctl_ioctl() @%d - " "Unable to copy mpt_ioctl_header data @ %p\n", - __FILE__, __LINE__, (void*)uhdr); + __FILE__, __LINE__, uhdr); return -EFAULT; } ret = -ENXIO; /* (-6) No such device or address */ @@ -671,7 +637,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned static int mptctl_do_reset(unsigned long arg) { - struct mpt_ioctl_diag_reset *urinfo = (struct mpt_ioctl_diag_reset *) arg; + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; struct mpt_ioctl_diag_reset krinfo; MPT_ADAPTER *iocp; @@ -680,7 +646,7 @@ static int mptctl_do_reset(unsigned long arg) if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { printk(KERN_ERR "%s@%d::mptctl_do_reset - " "Unable to copy mpt_ioctl_diag_reset struct @ %p\n", - __FILE__, __LINE__, (void*)urinfo); + __FILE__, __LINE__, urinfo); return -EFAULT; } @@ -699,21 +665,6 @@ static int mptctl_do_reset(unsigned long arg) return 0; } -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static int mptctl_open(struct inode *inode, struct file *file) -{ - /* - * Should support multiple management users - */ - return 0; -} - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -static int mptctl_release(struct inode *inode, struct file *file) -{ - return 0; -} - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* * MPT FW download function. Cast the arg into the mpt_fw_xfer structure. @@ -734,14 +685,14 @@ static int mptctl_release(struct inode *inode, struct file *file) static int mptctl_fw_download(unsigned long arg) { - struct mpt_fw_xfer *ufwdl = (struct mpt_fw_xfer *) arg; + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; struct mpt_fw_xfer kfwdl; dctlprintk((KERN_INFO "mptctl_fwdl called. mptctl_id = %xh\n", mptctl_id)); //tc if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) { printk(KERN_ERR "%s@%d::_ioctl_fwdl - " "Unable to copy mpt_fw_xfer struct @ %p\n", - __FILE__, __LINE__, (void*)ufwdl); + __FILE__, __LINE__, ufwdl); return -EFAULT; } @@ -763,7 +714,7 @@ mptctl_fw_download(unsigned long arg) * -ENOMSG if FW upload returned bad status */ static int -mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen) +mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) { FWDownload_t *dlmsg; MPT_FRAME_HDR *mf; @@ -892,7 +843,7 @@ mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen) if (copy_from_user(bl->kptr, ufwbuf+fw_bytes_copied, bl->len)) { printk(KERN_ERR "%s@%d::_ioctl_fwdl - " "Unable to copy f/w buffer hunk#%d @ %p\n", - __FILE__, __LINE__, n, (void*)ufwbuf); + __FILE__, __LINE__, n, ufwbuf); goto fwdl_out; } fw_bytes_copied += bl->len; @@ -1198,7 +1149,7 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE static int mptctl_getiocinfo (unsigned long arg, unsigned int data_size) { - struct mpt_ioctl_iocinfo *uarg = (struct mpt_ioctl_iocinfo *) arg; + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; struct mpt_ioctl_iocinfo *karg; MPT_ADAPTER *ioc; struct pci_dev *pdev; @@ -1238,7 +1189,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) if (copy_from_user(karg, uarg, data_size)) { printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " "Unable to read in mpt_ioctl_iocinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); kfree(karg); return -EFAULT; } @@ -1278,10 +1229,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) karg->pciId = pdev->device; pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); karg->hwRev = revision; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) karg->subSystemDevice = pdev->subsystem_device; karg->subSystemVendor = pdev->subsystem_vendor; -#endif if (cim_rev == 1) { /* Get the PCI bus, device, and function numbers for the IOC @@ -1335,10 +1284,10 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) /* Copy the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, karg, data_size)) { + if (copy_to_user((char __user *)arg, karg, data_size)) { printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " "Unable to write out mpt_ioctl_iocinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); kfree(karg); return -EFAULT; } @@ -1360,7 +1309,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) static int mptctl_gettargetinfo (unsigned long arg) { - struct mpt_ioctl_targetinfo *uarg = (struct mpt_ioctl_targetinfo *) arg; + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; struct mpt_ioctl_targetinfo karg; MPT_ADAPTER *ioc; struct Scsi_Host *sh; @@ -1382,7 +1331,7 @@ mptctl_gettargetinfo (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) { printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " "Unable to read in mpt_ioctl_targetinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1500,21 +1449,21 @@ data_space_full: /* Copy part of the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, &karg, + if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_targetinfo))) { printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); kfree(pmem); return -EFAULT; } /* Copy the remaining data from kernel memory to user memory */ - if (copy_to_user((char *) uarg->targetInfo, pmem, numBytes)) { + if (copy_to_user(uarg->targetInfo, pmem, numBytes)) { printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", - __FILE__, __LINE__, (void*)pdata); + __FILE__, __LINE__, pdata); kfree(pmem); return -EFAULT; } @@ -1535,7 +1484,7 @@ data_space_full: static int mptctl_readtest (unsigned long arg) { - struct mpt_ioctl_test *uarg = (struct mpt_ioctl_test *) arg; + struct mpt_ioctl_test __user *uarg = (void __user *) arg; struct mpt_ioctl_test karg; MPT_ADAPTER *ioc; int iocnum; @@ -1544,7 +1493,7 @@ mptctl_readtest (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { printk(KERN_ERR "%s@%d::mptctl_readtest - " "Unable to read in mpt_ioctl_test struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1571,10 +1520,10 @@ mptctl_readtest (unsigned long arg) /* Copy the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, &karg, sizeof(struct mpt_ioctl_test))) { + if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) { printk(KERN_ERR "%s@%d::mptctl_readtest - " "Unable to write out mpt_ioctl_test struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1595,7 +1544,7 @@ mptctl_readtest (unsigned long arg) static int mptctl_eventquery (unsigned long arg) { - struct mpt_ioctl_eventquery *uarg = (struct mpt_ioctl_eventquery *) arg; + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; struct mpt_ioctl_eventquery karg; MPT_ADAPTER *ioc; int iocnum; @@ -1604,7 +1553,7 @@ mptctl_eventquery (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { printk(KERN_ERR "%s@%d::mptctl_eventquery - " "Unable to read in mpt_ioctl_eventquery struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1620,10 +1569,10 @@ mptctl_eventquery (unsigned long arg) /* Copy the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) { + if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) { printk(KERN_ERR "%s@%d::mptctl_eventquery - " "Unable to write out mpt_ioctl_eventquery struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } return 0; @@ -1633,7 +1582,7 @@ mptctl_eventquery (unsigned long arg) static int mptctl_eventenable (unsigned long arg) { - struct mpt_ioctl_eventenable *uarg = (struct mpt_ioctl_eventenable *) arg; + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; struct mpt_ioctl_eventenable karg; MPT_ADAPTER *ioc; int iocnum; @@ -1642,7 +1591,7 @@ mptctl_eventenable (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { printk(KERN_ERR "%s@%d::mptctl_eventenable - " "Unable to read in mpt_ioctl_eventenable struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1680,7 +1629,7 @@ mptctl_eventenable (unsigned long arg) static int mptctl_eventreport (unsigned long arg) { - struct mpt_ioctl_eventreport *uarg = (struct mpt_ioctl_eventreport *) arg; + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; struct mpt_ioctl_eventreport karg; MPT_ADAPTER *ioc; int iocnum; @@ -1690,7 +1639,7 @@ mptctl_eventreport (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { printk(KERN_ERR "%s@%d::mptctl_eventreport - " "Unable to read in mpt_ioctl_eventreport struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1716,10 +1665,10 @@ mptctl_eventreport (unsigned long arg) /* Copy the data from kernel memory to user memory */ numBytes = max * sizeof(MPT_IOCTL_EVENTS); - if (copy_to_user((char *) uarg->eventData, ioc->events, numBytes)) { + if (copy_to_user(uarg->eventData, ioc->events, numBytes)) { printk(KERN_ERR "%s@%d::mptctl_eventreport - " "Unable to write out mpt_ioctl_eventreport struct @ %p\n", - __FILE__, __LINE__, (void*)ioc->events); + __FILE__, __LINE__, ioc->events); return -EFAULT; } @@ -1730,7 +1679,7 @@ mptctl_eventreport (unsigned long arg) static int mptctl_replace_fw (unsigned long arg) { - struct mpt_ioctl_replace_fw *uarg = (struct mpt_ioctl_replace_fw *) arg; + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; struct mpt_ioctl_replace_fw karg; MPT_ADAPTER *ioc; fw_image_t **fwmem = NULL; @@ -1744,7 +1693,7 @@ mptctl_replace_fw (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { printk(KERN_ERR "%s@%d::mptctl_replace_fw - " "Unable to read in mpt_ioctl_replace_fw struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1774,7 +1723,7 @@ mptctl_replace_fw (unsigned long arg) if (copy_from_user(fwmem[ii]->fw, uarg->newImage + offset, fwmem[ii]->size)) { printk(KERN_ERR "%s@%d::mptctl_replace_fw - " "Unable to read in mpt_ioctl_replace_fw image @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); mpt_free_fw_memory(ioc, fwmem); return -EFAULT; @@ -1819,7 +1768,7 @@ mptctl_replace_fw (unsigned long arg) static int mptctl_mpt_command (unsigned long arg) { - struct mpt_ioctl_command *uarg = (struct mpt_ioctl_command *) arg; + struct mpt_ioctl_command __user *uarg = (void __user *) arg; struct mpt_ioctl_command karg; MPT_ADAPTER *ioc; int iocnum; @@ -1830,7 +1779,7 @@ mptctl_mpt_command (unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) { printk(KERN_ERR "%s@%d::mptctl_mpt_command - " "Unable to read in mpt_ioctl_command struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -1841,7 +1790,7 @@ mptctl_mpt_command (unsigned long arg) return -ENODEV; } - rc = mptctl_do_mpt_command (karg, (char *) &uarg->MF, 0); + rc = mptctl_do_mpt_command (karg, &uarg->MF); return rc; } @@ -1859,7 +1808,7 @@ mptctl_mpt_command (unsigned long arg) * -EPERM if SCSI I/O and target is untagged */ static int -mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) +mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) { MPT_ADAPTER *ioc; MPT_FRAME_HDR *mf = NULL; @@ -1923,23 +1872,15 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) /* Copy the request frame * Reset the saved message context. + * Request frame in user space */ - if (local) { - /* Request frame in kernel space - */ - memcpy((char *)mf, (char *) mfPtr, karg.dataSgeOffset * 4); - } else { - /* Request frame in user space - */ - if (copy_from_user((char *)mf, (char *) mfPtr, - karg.dataSgeOffset * 4)){ - printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " - "Unable to read MF from mpt_ioctl_command struct @ %p\n", - __FILE__, __LINE__, (void*)mfPtr); - rc = -EFAULT; - goto done_free_mem; - } - } + if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) { + printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " + "Unable to read MF from mpt_ioctl_command struct @ %p\n", + __FILE__, __LINE__, mfPtr); + rc = -EFAULT; + goto done_free_mem; + } hdr->MsgContext = cpu_to_le32(msgContext); @@ -2220,7 +2161,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) "%s@%d::mptctl_do_mpt_command - Unable " "to read user data " "struct @ %p\n", - __FILE__, __LINE__,(void*)karg.dataOutBufPtr); + __FILE__, __LINE__,karg.dataOutBufPtr); rc = -EFAULT; goto done_free_mem; } @@ -2321,12 +2262,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) } if (sz > 0) { - if (copy_to_user((char *)karg.replyFrameBufPtr, + if (copy_to_user(karg.replyFrameBufPtr, &ioc->ioctl->ReplyFrame, sz)){ printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " "Unable to write out reply frame %p\n", - __FILE__, __LINE__, (void*)karg.replyFrameBufPtr); + __FILE__, __LINE__, karg.replyFrameBufPtr); rc = -ENODATA; goto done_free_mem; } @@ -2338,11 +2279,11 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) if (ioc->ioctl->status & MPT_IOCTL_STATUS_SENSE_VALID) { sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE); if (sz > 0) { - if (copy_to_user((char *)karg.senseDataPtr, ioc->ioctl->sense, sz)) { + if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) { printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " "Unable to write sense data to user %p\n", __FILE__, __LINE__, - (void*)karg.senseDataPtr); + karg.senseDataPtr); rc = -ENODATA; goto done_free_mem; } @@ -2355,12 +2296,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local) if ((ioc->ioctl->status & MPT_IOCTL_STATUS_COMMAND_GOOD) && (karg.dataInSize > 0) && (bufIn.kptr)) { - if (copy_to_user((char *)karg.dataInBufPtr, + if (copy_to_user(karg.dataInBufPtr, bufIn.kptr, karg.dataInSize)) { printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - " "Unable to write data to user %p\n", __FILE__, __LINE__, - (void*)karg.dataInBufPtr); + karg.dataInBufPtr); rc = -ENODATA; } } @@ -2413,7 +2354,7 @@ done_free_mem: static int mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) { - hp_host_info_t *uarg = (hp_host_info_t *) arg; + hp_host_info_t __user *uarg = (void __user *) arg; MPT_ADAPTER *ioc; struct pci_dev *pdev; char *pbuf; @@ -2437,7 +2378,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) { printk(KERN_ERR "%s@%d::mptctl_hp_host_info - " "Unable to read in hp_host_info struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -2455,10 +2396,8 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) karg.vendor = pdev->vendor; karg.device = pdev->device; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) karg.subsystem_id = pdev->subsystem_device; karg.subsystem_vendor = pdev->subsystem_vendor; -#endif karg.devfn = pdev->devfn; karg.bus = pdev->bus->number; @@ -2540,7 +2479,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) break; } - karg.base_io_addr = pdev->PCI_BASEADDR_START(0); + karg.base_io_addr = pci_resource_start(pdev, 0); if ((int)ioc->chip_type <= (int) FC929) karg.bus_phys_width = HP_BUS_WIDTH_UNK; @@ -2576,11 +2515,10 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) /* Copy the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, &karg, - sizeof(hp_host_info_t))) { + if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) { printk(KERN_ERR "%s@%d::mptctl_hpgethostinfo - " "Unable to write out hp_host_info @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -2602,7 +2540,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) static int mptctl_hp_targetinfo(unsigned long arg) { - hp_target_info_t *uarg = (hp_target_info_t *) arg; + hp_target_info_t __user *uarg = (void __user *) arg; SCSIDevicePage0_t *pg0_alloc; SCSIDevicePage3_t *pg3_alloc; MPT_ADAPTER *ioc; @@ -2619,7 +2557,7 @@ mptctl_hp_targetinfo(unsigned long arg) if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) { printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - " "Unable to read in hp_host_targetinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -2727,10 +2665,10 @@ mptctl_hp_targetinfo(unsigned long arg) /* Copy the data from kernel memory to user memory */ - if (copy_to_user((char *)arg, &karg, sizeof(hp_target_info_t))) { + if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) { printk(KERN_ERR "%s@%d::mptctl_hp_target_info - " "Unable to write out mpt_ioctl_targetinfo struct @ %p\n", - __FILE__, __LINE__, (void*)uarg); + __FILE__, __LINE__, uarg); return -EFAULT; } @@ -2739,20 +2677,10 @@ mptctl_hp_targetinfo(unsigned long arg) /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,51) -#define owner_THIS_MODULE .owner = THIS_MODULE, -#else -#define owner_THIS_MODULE -#endif - static struct file_operations mptctl_fops = { - owner_THIS_MODULE + .owner = THIS_MODULE, .llseek = no_llseek, - .read = mptctl_read, - .write = mptctl_write, .ioctl = mptctl_ioctl, - .open = mptctl_open, - .release = mptctl_release, }; static struct miscdevice mptctl_miscdev = { @@ -2800,7 +2728,7 @@ compat_mptfwxfer_ioctl(unsigned int fd, unsigned int cmd, dctlprintk((KERN_INFO MYNAM "::compat_mptfwxfer_ioctl() called\n")); - if (copy_from_user(&kfw32, (char *)arg, sizeof(kfw32))) + if (copy_from_user(&kfw32, (char __user *)arg, sizeof(kfw32))) return -EFAULT; /* Verify intended MPT adapter */ @@ -2817,7 +2745,7 @@ compat_mptfwxfer_ioctl(unsigned int fd, unsigned int cmd, kfw.iocnum = iocnum; kfw.fwlen = kfw32.fwlen; - kfw.bufp = (void *)(unsigned long)kfw32.bufp; + kfw.bufp = compat_ptr(kfw32.bufp); ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); @@ -2831,7 +2759,7 @@ compat_mpt_command(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *filp) { struct mpt_ioctl_command32 karg32; - struct mpt_ioctl_command32 *uarg = (struct mpt_ioctl_command32 *) arg; + struct mpt_ioctl_command32 __user *uarg = (struct mpt_ioctl_command32 __user *) arg; struct mpt_ioctl_command karg; MPT_ADAPTER *iocp = NULL; int iocnum, iocnumX; @@ -2840,7 +2768,7 @@ compat_mpt_command(unsigned int fd, unsigned int cmd, dctlprintk((KERN_INFO MYNAM "::compat_mpt_command() called\n")); - if (copy_from_user(&karg32, (char *)arg, sizeof(karg32))) + if (copy_from_user(&karg32, (char __user *)arg, sizeof(karg32))) return -EFAULT; /* Verify intended MPT adapter */ @@ -2866,14 +2794,14 @@ compat_mpt_command(unsigned int fd, unsigned int cmd, karg.maxSenseBytes = karg32.maxSenseBytes; karg.dataSgeOffset = karg32.dataSgeOffset; - karg.replyFrameBufPtr = (char *)(unsigned long)karg32.replyFrameBufPtr; - karg.dataInBufPtr = (char *)(unsigned long)karg32.dataInBufPtr; - karg.dataOutBufPtr = (char *)(unsigned long)karg32.dataOutBufPtr; - karg.senseDataPtr = (char *)(unsigned long)karg32.senseDataPtr; + karg.replyFrameBufPtr = (char __user *)(unsigned long)karg32.replyFrameBufPtr; + karg.dataInBufPtr = (char __user *)(unsigned long)karg32.dataInBufPtr; + karg.dataOutBufPtr = (char __user *)(unsigned long)karg32.dataOutBufPtr; + karg.senseDataPtr = (char __user *)(unsigned long)karg32.senseDataPtr; /* Pass new structure to do_mpt_command */ - ret = mptctl_do_mpt_command (karg, (char *) &uarg->MF, 0); + ret = mptctl_do_mpt_command (karg, &uarg->MF); up(&mptctl_syscall_sem_ioc[iocp->id]); diff --git a/drivers/message/fusion/mptctl.h b/drivers/message/fusion/mptctl.h index 47ffd977d..cc4ecf038 100644 --- a/drivers/message/fusion/mptctl.h +++ b/drivers/message/fusion/mptctl.h @@ -115,7 +115,7 @@ struct mpt_fw_xfer { unsigned int iocnum; /* IOC unit number */ unsigned int fwlen; - void *bufp; /* Pointer to firmware buffer */ + void __user *bufp; /* Pointer to firmware buffer */ }; #if defined(__KERNEL__) && defined(CONFIG_COMPAT) @@ -332,10 +332,10 @@ typedef struct mpt_ioctl_replace_fw { struct mpt_ioctl_command { mpt_ioctl_header hdr; int timeout; /* optional (seconds) */ - char *replyFrameBufPtr; - char *dataInBufPtr; - char *dataOutBufPtr; - char *senseDataPtr; + char __user *replyFrameBufPtr; + char __user *dataInBufPtr; + char __user *dataOutBufPtr; + char __user *senseDataPtr; int maxReplyBytes; int dataInSize; int dataOutSize; diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index ae94f4376..442f043ef 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c @@ -133,7 +133,7 @@ struct mpt_lan_priv { u32 total_received; struct net_device_stats stats; /* Per device statistics */ - struct mpt_work_struct post_buckets_task; + struct work_struct post_buckets_task; unsigned long post_buckets_active; }; @@ -880,18 +880,9 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) if (test_and_set_bit(0, &priv->post_buckets_active) == 0) { if (priority) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41) schedule_work(&priv->post_buckets_task); -#else - queue_task(&priv->post_buckets_task, &tq_immediate); - mark_bh(IMMEDIATE_BH); -#endif } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41) schedule_delayed_work(&priv->post_buckets_task, 1); -#else - queue_task(&priv->post_buckets_task, &tq_timer); -#endif dioprintk((KERN_INFO MYNAM ": post_buckets queued on " "timer.\n")); } @@ -1391,8 +1382,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) priv->mpt_dev = mpt_dev; priv->pnum = pnum; - memset(&priv->post_buckets_task, 0, sizeof(struct mpt_work_struct)); - MPT_INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev); + memset(&priv->post_buckets_task, 0, sizeof(struct work_struct)); + INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev); priv->post_buckets_active = 0; dlprintk((KERN_INFO MYNAM "@%d: bucketlen = %d\n", @@ -1566,10 +1557,6 @@ static void __exit mpt_lan_exit(void) } /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59) -MODULE_PARM(tx_max_out_p, "i"); -MODULE_PARM(max_buckets_out, "i"); // Debug stuff. FIXME! -#endif module_init(mpt_lan_init); module_exit(mpt_lan_exit); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index ce66f4176..dce5ba1c7 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -74,6 +74,8 @@ #include /* for mdelay */ #include /* needed for in_interrupt() proto */ #include /* notifier code */ +#include +#include #include "../../scsi/scsi.h" #include @@ -185,7 +187,7 @@ static void mptscsih_schedule_reset(void *hd); static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum); -static struct mpt_work_struct mptscsih_rstTask; +static struct work_struct mptscsih_rstTask; #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); @@ -231,7 +233,7 @@ static int ScsiScanDvCtx = -1; /* Used only for bus scan and dv */ static spinlock_t dvtaskQ_lock = SPIN_LOCK_UNLOCKED; static int dvtaskQ_active = 0; static int dvtaskQ_release = 0; -static struct mpt_work_struct mptscsih_dvTask; +static struct work_struct mptscsih_dvTask; #endif /* @@ -249,31 +251,7 @@ static struct mptscsih_driver_setup static Scsi_Cmnd *foo_to[8]; #endif -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -/* see mptscsih.h */ - -static struct scsi_host_template driver_template = { - .proc_name = "mptscsih", - .proc_info = x_scsi_proc_info, - .name = "MPT SCSI Host", - .info = x_scsi_info, - .queuecommand = x_scsi_queuecommand, - .slave_alloc = x_scsi_slave_alloc, - .slave_configure = x_scsi_slave_configure, - .slave_destroy = x_scsi_slave_destroy, - .eh_abort_handler = x_scsi_abort, - .eh_device_reset_handler = x_scsi_dev_reset, - .eh_bus_reset_handler = x_scsi_bus_reset, - .eh_host_reset_handler = x_scsi_host_reset, - .bios_param = x_scsi_bios_param, - .can_queue = MPT_SCSI_CAN_QUEUE, - .this_id = -1, - .sg_tablesize = MPT_SCSI_SG_DEPTH, - .max_sectors = MPT_SCSI_MAX_SECTORS, - .cmd_per_lun = MPT_SCSI_CMD_PER_LUN, - .use_clustering = ENABLE_CLUSTERING, -}; +static struct scsi_host_template driver_template; /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* @@ -1459,7 +1437,6 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) } sh->max_lun = MPT_LAST_LUN + 1; - sh->max_sectors = MPT_SCSI_MAX_SECTORS; sh->max_channel = 0; sh->this_id = ioc->pfacts[0].PortSCSIID; @@ -1800,8 +1777,8 @@ mptscsih_remove(struct pci_dev *pdev) } dprintk((MYIOC_s_INFO_FMT - "Free'd ScsiLookup (%d), chain (%d) and Target (%d+%d) memory\n", - hd->ioc->name, sz1, szchain, sz3, sztarget)); + "Free'd ScsiLookup (%d) Target (%d+%d) memory\n", + hd->ioc->name, sz1, sz3, sztarget)); dprintk(("Free'd done and free Q (%d) memory\n", szQ)); /* NULL the Scsi_Host pointer @@ -1879,9 +1856,9 @@ mptscsih_resume(struct pci_dev *pdev) if (!dvtaskQ_active) { dvtaskQ_active = 1; spin_unlock_irqrestore(&dvtaskQ_lock, lflags); - MPT_INIT_WORK(&mptscsih_dvTask, + INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); - SCHEDULE_TASK(&mptscsih_dvTask); + schedule_work(&mptscsih_dvTask); } else { spin_unlock_irqrestore(&dvtaskQ_lock, lflags); } @@ -1902,7 +1879,6 @@ static struct mpt_pci_driver mptscsih_driver = { #endif }; - /* SCSI host fops start here... */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** @@ -2434,9 +2410,9 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) if (!dvtaskQ_active) { dvtaskQ_active = 1; spin_unlock_irqrestore(&dvtaskQ_lock, lflags); - MPT_INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); + INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); - SCHEDULE_TASK(&mptscsih_dvTask); + schedule_work(&mptscsih_dvTask); } else { spin_unlock_irqrestore(&dvtaskQ_lock, lflags); } @@ -3905,6 +3881,29 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) return 1; /* currently means nothing really */ } +static struct scsi_host_template driver_template = { + .proc_name = "mptscsih", + .proc_info = mptscsih_proc_info, + .name = "MPT SCSI Host", + .info = mptscsih_info, + .queuecommand = mptscsih_qcmd, + .slave_alloc = mptscsih_slave_alloc, + .slave_configure = mptscsih_slave_configure, + .slave_destroy = mptscsih_slave_destroy, + .eh_abort_handler = mptscsih_abort, + .eh_device_reset_handler = mptscsih_dev_reset, + .eh_bus_reset_handler = mptscsih_bus_reset, + .eh_host_reset_handler = mptscsih_host_reset, + .bios_param = mptscsih_bios_param, + .can_queue = MPT_SCSI_CAN_QUEUE, + .this_id = -1, + .sg_tablesize = MPT_SCSI_SG_DEPTH, + .max_sectors = 8192, + .cmd_per_lun = 7, + .use_clustering = ENABLE_CLUSTERING, +}; + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /* * Private data... @@ -4950,8 +4949,8 @@ static void mptscsih_taskmgmt_timeout(unsigned long data) /* Call the reset handler. Already had a TM request * timeout - so issue a diagnostic reset */ - MPT_INIT_WORK(&mptscsih_rstTask, mptscsih_schedule_reset, (void *)hd); - SCHEDULE_TASK(&mptscsih_rstTask); + INIT_WORK(&mptscsih_rstTask, mptscsih_schedule_reset, (void *)hd); + schedule_work(&mptscsih_rstTask); return; } diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index 5ab0726e8..2c002b537 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h @@ -108,75 +108,4 @@ struct mptscsih_driver_setup MPTSCSIH_SAF_TE, \ } - - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -/* - * Various bits and pieces broke within the lk-2.4.0-testN series:-( - * So here are various HACKS to work around them. - */ - -/* - * tq_scheduler disappeared @ lk-2.4.0-test12 - * (right when newly defined TQ_ACTIVE) - * tq_struct reworked in 2.5.41. Include workqueue.h. - */ -# include -# include -#define SCHEDULE_TASK(x) \ - if (schedule_work(x) == 0) { \ - /*MOD_DEC_USE_COUNT*/; \ - } - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -#define x_scsi_info mptscsih_info -#define x_scsi_queuecommand mptscsih_qcmd -#define x_scsi_abort mptscsih_abort -#define x_scsi_bus_reset mptscsih_bus_reset -#define x_scsi_dev_reset mptscsih_dev_reset -#define x_scsi_host_reset mptscsih_host_reset -#define x_scsi_bios_param mptscsih_bios_param - -#define x_scsi_slave_alloc mptscsih_slave_alloc -#define x_scsi_slave_configure mptscsih_slave_configure -#define x_scsi_slave_destroy mptscsih_slave_destroy -#define x_scsi_proc_info mptscsih_proc_info - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -/* - * MPT SCSI Host / Initiator decls... - */ -extern const char *x_scsi_info(struct Scsi_Host *); -extern int x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); -extern int x_scsi_abort(Scsi_Cmnd *); -extern int x_scsi_bus_reset(Scsi_Cmnd *); -extern int x_scsi_dev_reset(Scsi_Cmnd *); -extern int x_scsi_host_reset(Scsi_Cmnd *); -extern int x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev, - sector_t capacity, int geom[]); -extern int x_scsi_slave_alloc(Scsi_Device *); -extern int x_scsi_slave_configure(Scsi_Device *); -extern void x_scsi_slave_destroy(Scsi_Device *); -extern int x_scsi_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -/* include/scsi/scsi.h may not be quite complete... */ -#ifndef RESERVE_10 -#define RESERVE_10 0x56 -#endif -#ifndef RELEASE_10 -#define RELEASE_10 0x57 -#endif -#ifndef PERSISTENT_RESERVE_IN -#define PERSISTENT_RESERVE_IN 0x5e #endif -#ifndef PERSISTENT_RESERVE_OUT -#define PERSISTENT_RESERVE_OUT 0x5f -#endif - -/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - -#endif - diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 76de2d7ae..63e67b3b1 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c @@ -280,8 +280,8 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq, { struct i2o_controller *c = dev->controller; int tid = dev->tid; - unsigned long msg; - unsigned long mptr; + void *msg; + void *mptr; u64 offset; struct request *req = ireq->req; int count = req->nr_sectors<<9; @@ -291,7 +291,7 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq, // printk(KERN_INFO "i2ob_send called\n"); /* Map the message to a virtual address */ - msg = c->mem_offset + m; + msg = c->msg_virt + m; sgnum = i2ob_build_sglist(dev, ireq); @@ -479,7 +479,7 @@ static void i2o_block_reply(struct i2o_handler *h, struct i2o_controller *c, str /* Now flush the message by making it a NOP */ m[0]&=0x00FFFFFF; m[0]|=(I2O_CMD_UTIL_NOP)<<24; - i2o_post_message(c, ((unsigned long)m) - c->mem_offset); + i2o_post_message(c, (unsigned long) m - (unsigned long) c->msg_virt); return; } diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index f417bac42..0c77a2bc9 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c @@ -97,7 +97,7 @@ static void i2o_cfg_reply(struct i2o_handler *h, struct i2o_controller *c, struc u32 *msg = (u32 *)m; if (msg[0] & MSG_FAIL) { - u32 *preserved_msg = (u32*)(c->mem_offset + msg[7]); + u32 *preserved_msg = (u32*)(c->msg_virt + msg[7]); printk(KERN_ERR "i2o_config: IOP failed to process the msg.\n"); diff --git a/drivers/message/i2o/i2o_core.c b/drivers/message/i2o/i2o_core.c index e5afe8dc2..b631a62bd 100644 --- a/drivers/message/i2o/i2o_core.c +++ b/drivers/message/i2o/i2o_core.c @@ -354,7 +354,7 @@ static void i2o_core_reply(struct i2o_handler *h, struct i2o_controller *c, if (msg[0] & MSG_FAIL) // Fail bit is set { - u32 *preserved_msg = (u32*)(c->mem_offset + msg[7]); + u32 *preserved_msg = (u32*)(c->msg_virt + msg[7]); i2o_report_status(KERN_INFO, "i2o_core", msg); i2o_dump_message(preserved_msg); @@ -1794,7 +1794,7 @@ static int i2o_reset_controller(struct i2o_controller *c) m=i2o_wait_message(c, "AdapterReset"); if(m==0xFFFFFFFF) return -ETIMEDOUT; - msg=(u32 *)(c->mem_offset+m); + msg=(u32 *)(c->msg_virt+m); status = pci_alloc_consistent(c->pdev, 4, &status_phys); if(status == NULL) { @@ -1923,7 +1923,7 @@ int i2o_status_get(struct i2o_controller *c) m=i2o_wait_message(c, "StatusGet"); if(m==0xFFFFFFFF) return -ETIMEDOUT; - msg=(u32 *)(c->mem_offset+m); + msg=(u32 *)(c->msg_virt+m); msg[0]=NINE_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1]=I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID; @@ -2344,7 +2344,7 @@ int i2o_init_outbound_q(struct i2o_controller *c) m=i2o_wait_message(c, "OutboundInit"); if(m==0xFFFFFFFF) return -ETIMEDOUT; - msg=(u32 *)(c->mem_offset+m); + msg=(u32 *)(c->msg_virt+m); status = pci_alloc_consistent(c->pdev, 4, &status_phys); if (status==NULL) { @@ -2618,7 +2618,7 @@ static int i2o_build_sys_table(void) sys_tbl->iops[count].last_changed = sys_tbl_ind - 1; // ?? sys_tbl->iops[count].iop_capabilities = iop->status_block->iop_capabilities; - sys_tbl->iops[count].inbound_low = iop->post_port; + sys_tbl->iops[count].inbound_low = (u32)iop->post_port; sys_tbl->iops[count].inbound_high = 0; // FIXME: 64-bit support count++; @@ -2666,7 +2666,7 @@ int i2o_post_this(struct i2o_controller *c, u32 *data, int len) c->name); return -ETIMEDOUT; } - msg = (u32 *)(c->mem_offset + m); + msg = (u32 *)(c->msg_virt + m); memcpy_toio(msg, data, len); i2o_post_message(c,m); return 0; @@ -3592,7 +3592,9 @@ static void i2o_pci_dispose(struct i2o_controller *c) I2O_IRQ_WRITE32(c,0xFFFFFFFF); if(c->irq > 0) free_irq(c->irq, c); - iounmap(((u8 *)c->post_port)-0x40); + iounmap(c->base_virt); + if(c->raptor) + iounmap(c->msg_virt); #ifdef CONFIG_MTRR if(c->mtrr_reg0 > 0) @@ -3633,9 +3635,12 @@ int __init i2o_pci_install(struct pci_dev *dev) { struct i2o_controller *c=kmalloc(sizeof(struct i2o_controller), GFP_KERNEL); - unsigned long mem; - u32 memptr = 0; - u32 size; + void *bar0_virt; + void *bar1_virt; + unsigned long bar0_phys = 0; + unsigned long bar1_phys = 0; + unsigned long bar0_size = 0; + unsigned long bar1_size = 0; int i; @@ -3646,37 +3651,9 @@ int __init i2o_pci_install(struct pci_dev *dev) } memset(c, 0, sizeof(*c)); - for(i=0; i<6; i++) - { - /* Skip I/O spaces */ - if(!(pci_resource_flags(dev, i) & IORESOURCE_IO)) - { - memptr = pci_resource_start(dev, i); - break; - } - } - - if(i==6) - { - printk(KERN_ERR "i2o: I2O controller has no memory regions defined.\n"); - kfree(c); - return -EINVAL; - } - - size = dev->resource[i].end-dev->resource[i].start+1; - /* Map the I2O controller */ - - printk(KERN_INFO "i2o: PCI I2O controller at 0x%08X size=%d\n", memptr, size); - mem = (unsigned long)ioremap(memptr, size); - if(mem==0) - { - printk(KERN_ERR "i2o: Unable to map controller.\n"); - kfree(c); - return -EINVAL; - } - c->irq = -1; c->dpt = 0; + c->raptor = 0; c->short_req = 0; c->pdev = dev; @@ -3684,13 +3661,6 @@ int __init i2o_pci_install(struct pci_dev *dev) c->context_list_lock = SPIN_LOCK_UNLOCKED; #endif - c->irq_mask = mem+0x34; - c->post_port = mem+0x40; - c->reply_port = mem+0x44; - - c->mem_phys = memptr; - c->mem_offset = mem; - /* * Cards that fall apart if you hit them with large I/O * loads... @@ -3701,6 +3671,7 @@ int __init i2o_pci_install(struct pci_dev *dev) c->short_req = 1; printk(KERN_INFO "I2O: Symbios FC920 workarounds activated.\n"); } + if(dev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) { c->promise = 1; @@ -3712,15 +3683,85 @@ int __init i2o_pci_install(struct pci_dev *dev) * them */ - if(dev->vendor == PCI_VENDOR_ID_DPT) + if(dev->vendor == PCI_VENDOR_ID_DPT) { c->dpt=1; + if(dev->device == 0xA511) + c->raptor=1; + } + + for(i=0; i<6; i++) + { + /* Skip I/O spaces */ + if(!(pci_resource_flags(dev, i) & IORESOURCE_IO)) + { + if(!bar0_phys) + { + bar0_phys = pci_resource_start(dev, i); + bar0_size = pci_resource_len(dev, i); + if(!c->raptor) + break; + } + else + { + bar1_phys = pci_resource_start(dev, i); + bar1_size = pci_resource_len(dev, i); + break; + } + } + } + + if(i==6) + { + printk(KERN_ERR "i2o: I2O controller has no memory regions defined.\n"); + kfree(c); + return -EINVAL; + } + + + /* Map the I2O controller */ + if(!c->raptor) + printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n", bar0_phys, bar0_size); + else + printk(KERN_INFO "i2o: PCI I2O controller\n BAR0 at 0x%08lX size=%ld\n BAR1 at 0x%08lX size=%ld\n", bar0_phys, bar0_size, bar1_phys, bar1_size); + + bar0_virt = ioremap(bar0_phys, bar0_size); + if(bar0_virt==0) + { + printk(KERN_ERR "i2o: Unable to map controller.\n"); + kfree(c); + return -EINVAL; + } + + if(c->raptor) + { + bar1_virt = ioremap(bar1_phys, bar1_size); + if(bar1_virt==0) + { + printk(KERN_ERR "i2o: Unable to map controller.\n"); + kfree(c); + iounmap(bar0_virt); + return -EINVAL; + } + } else { + bar1_virt = bar0_virt; + bar1_phys = bar0_phys; + bar1_size = bar0_size; + } + + c->irq_mask = bar0_virt+0x34; + c->post_port = bar0_virt+0x40; + c->reply_port = bar0_virt+0x44; + + c->base_phys = bar0_phys; + c->base_virt = bar0_virt; + c->msg_phys = bar1_phys; + c->msg_virt = bar1_virt; /* * Enable Write Combining MTRR for IOP's memory region */ #ifdef CONFIG_MTRR - c->mtrr_reg0 = - mtrr_add(c->mem_phys, size, MTRR_TYPE_WRCOMB, 1); + c->mtrr_reg0 = mtrr_add(c->base_phys, bar0_size, MTRR_TYPE_WRCOMB, 1); /* * If it is an INTEL i960 I/O processor then set the first 64K to * Uncacheable since the region contains the Messaging unit which @@ -3730,14 +3771,16 @@ int __init i2o_pci_install(struct pci_dev *dev) if(dev->vendor == PCI_VENDOR_ID_INTEL || dev->vendor == PCI_VENDOR_ID_DPT) { printk(KERN_INFO "I2O: MTRR workaround for Intel i960 processor\n"); - c->mtrr_reg1 = mtrr_add(c->mem_phys, 65536, MTRR_TYPE_UNCACHABLE, 1); + c->mtrr_reg1 = mtrr_add(c->base_phys, 65536, MTRR_TYPE_UNCACHABLE, 1); if(c->mtrr_reg1< 0) { printk(KERN_INFO "i2o_pci: Error in setting MTRR_TYPE_UNCACHABLE\n"); - mtrr_del(c->mtrr_reg0, c->mem_phys, size); + mtrr_del(c->mtrr_reg0, c->msg_phys, bar1_size); c->mtrr_reg0 = -1; } } + if(c->raptor) + c->mtrr_reg1 = mtrr_add(c->msg_phys, bar1_size, MTRR_TYPE_WRCOMB, 1); #endif @@ -3749,7 +3792,9 @@ int __init i2o_pci_install(struct pci_dev *dev) { printk(KERN_ERR "i2o: Unable to install controller.\n"); kfree(c); - iounmap((void *)mem); + iounmap(bar0_virt); + if(c->raptor) + iounmap(bar1_virt); return i; } @@ -3764,7 +3809,9 @@ int __init i2o_pci_install(struct pci_dev *dev) c->name, dev->irq); c->irq = -1; i2o_delete_controller(c); - iounmap((void *)mem); + iounmap(bar0_virt); + if(c->raptor) + iounmap(bar1_virt); return -EBUSY; } } @@ -3797,10 +3844,12 @@ int __init i2o_pci_scan(void) while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { - if((dev->class>>8)!=PCI_CLASS_INTELLIGENT_I2O) + if((dev->class>>8)!=PCI_CLASS_INTELLIGENT_I2O && + (dev->vendor!=PCI_VENDOR_ID_DPT || dev->device!=0xA511)) continue; - if((dev->class&0xFF)>1) + if((dev->class>>8)==PCI_CLASS_INTELLIGENT_I2O && + (dev->class&0xFF)>1) { printk(KERN_INFO "i2o: I2O Controller found but does not support I2O 1.5 (skipping).\n"); continue; diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index a0f99f6e8..ba121fc85 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c @@ -59,9 +59,11 @@ #include #include #include -#include "../../scsi/scsi.h" -#include "../../scsi/hosts.h" +#include +#include +#include +#include #define VERSION_STRING "Version 0.1.2" @@ -186,7 +188,7 @@ static void flush_pending(void) static void i2o_scsi_reply(struct i2o_handler *h, struct i2o_controller *c, struct i2o_message *msg) { - Scsi_Cmnd *current_command; + struct scsi_cmnd *current_command; spinlock_t *lock; u32 *m = (u32 *)msg; u8 as,ds,st; @@ -230,7 +232,7 @@ static void i2o_scsi_reply(struct i2o_handler *h, struct i2o_controller *c, stru { spin_unlock_irqrestore(&retry_lock, flags); /* Create a scsi error for this */ - current_command = (Scsi_Cmnd *)i2o_context_list_get(m[3], c); + current_command = (struct scsi_cmnd *)i2o_context_list_get(m[3], c); if(!current_command) return; @@ -277,7 +279,7 @@ static void i2o_scsi_reply(struct i2o_handler *h, struct i2o_controller *c, stru return; } - current_command = (Scsi_Cmnd *)i2o_context_list_get(m[3], c); + current_command = (struct scsi_cmnd *)i2o_context_list_get(m[3], c); /* * Is this a control request coming back - eg an abort ? @@ -330,10 +332,17 @@ static void i2o_scsi_reply(struct i2o_handler *h, struct i2o_controller *c, stru */ current_command->result = DID_OK << 16 | ds; - if (current_command->use_sg) - pci_unmap_sg(c->pdev, (struct scatterlist *)current_command->buffer, current_command->use_sg, scsi_to_pci_dma_dir(current_command->sc_data_direction)); - else if (current_command->request_bufflen) - pci_unmap_single(c->pdev, (dma_addr_t)((long)current_command->SCp.ptr), current_command->request_bufflen, scsi_to_pci_dma_dir(current_command->sc_data_direction)); + if (current_command->use_sg) { + pci_unmap_sg(c->pdev, + (struct scatterlist *)current_command->buffer, + current_command->use_sg, + current_command->sc_data_direction); + } else if (current_command->request_bufflen) { + pci_unmap_single(c->pdev, + (dma_addr_t)((long)current_command->SCp.ptr), + current_command->request_bufflen, + current_command->sc_data_direction); + } lock = current_command->device->host->host_lock; spin_lock_irqsave(lock, flags); @@ -461,7 +470,7 @@ static void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct * scsi controller and then let the enumeration fake up the rest */ -static int i2o_scsi_detect(Scsi_Host_Template * tpnt) +static int i2o_scsi_detect(struct scsi_host_template * tpnt) { struct Scsi_Host *shpnt = NULL; int i; @@ -592,12 +601,13 @@ static const char *i2o_scsi_info(struct Scsi_Host *SChost) * Locks: takes the controller lock on error path only */ -static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) +static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, + void (*done) (struct scsi_cmnd *)) { int i; int tid; struct i2o_controller *c; - Scsi_Cmnd *current_command; + struct scsi_cmnd *current_command; struct Scsi_Host *host; struct i2o_scsi_host *hostdata; u32 *msg, *mptr; @@ -659,7 +669,7 @@ static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) if(m==0xFFFFFFFF) return 1; - msg = (u32 *)(c->mem_offset + m); + msg = (u32 *)(c->msg_virt + m); /* * Put together a scsi execscb message @@ -668,19 +678,14 @@ static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) len = SCpnt->request_bufflen; direction = 0x00000000; // SGL IN (osm<--iop) - if(SCpnt->sc_data_direction == SCSI_DATA_NONE) + if (SCpnt->sc_data_direction == DMA_NONE) { scsidir = 0x00000000; // DATA NO XFER - else if(SCpnt->sc_data_direction == SCSI_DATA_WRITE) - { - direction=0x04000000; // SGL OUT (osm-->iop) - scsidir =0x80000000; // DATA OUT (iop-->dev) - } - else if(SCpnt->sc_data_direction == SCSI_DATA_READ) - { - scsidir =0x40000000; // DATA IN (iop<--dev) - } - else - { + } else if (SCpnt->sc_data_direction == DMA_TO_DEVICE) { + direction = 0x04000000; // SGL OUT (osm-->iop) + scsidir = 0x80000000; // DATA OUT (iop-->dev) + } else if(SCpnt->sc_data_direction == DMA_FROM_DEVICE) { + scsidir = 0x40000000; // DATA IN (iop<--dev) + } else { /* Unknown - kill the command */ SCpnt->result = DID_NO_CONNECT << 16; @@ -768,7 +773,7 @@ static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) len = 0; sg_count = pci_map_sg(c->pdev, sg, SCpnt->use_sg, - scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); /* FIXME: handle fail */ if(!sg_count) @@ -840,7 +845,7 @@ static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) dma_addr = pci_map_single(c->pdev, SCpnt->request_buffer, SCpnt->request_bufflen, - scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); if(dma_addr == 0) BUG(); /* How to handle ?? */ SCpnt->SCp.ptr = (char *)(unsigned long) dma_addr; @@ -883,7 +888,7 @@ static int i2o_scsi_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) * Locks: no locks are held or needed */ -int i2o_scsi_abort(Scsi_Cmnd * SCpnt) +static int i2o_scsi_abort(struct scsi_cmnd * SCpnt) { struct i2o_controller *c; struct Scsi_Host *host; @@ -929,14 +934,14 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt) * Locks: called with no lock held, requires no locks. */ -static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) +static int i2o_scsi_bus_reset(struct scsi_cmnd * SCpnt) { int tid; struct i2o_controller *c; struct Scsi_Host *host; struct i2o_scsi_host *hostdata; u32 m; - unsigned long msg; + void *msg; unsigned long timeout; @@ -974,7 +979,7 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) while(time_before(jiffies, timeout)); - msg = c->mem_offset + m; + msg = c->msg_virt + m; i2o_raw_writel(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0, msg); i2o_raw_writel(I2O_CMD_SCSI_BUSRESET<<24|HOST_TID<<12|tid, msg+4); i2o_raw_writel(scsi_context|0x80000000, msg+8); @@ -991,32 +996,6 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) return SUCCESS; } -/** - * i2o_scsi_host_reset - host reset callback - * @SCpnt: command causing the reset - * - * An I2O controller can be many things at once. While we can - * reset a controller the potential mess from doing so is vast, and - * it's better to simply hold on and pray - */ - -static int i2o_scsi_host_reset(Scsi_Cmnd * SCpnt) -{ - return FAILED; -} - -/** - * i2o_scsi_device_reset - device reset callback - * @SCpnt: command causing the reset - * - * I2O does not (AFAIK) support doing a device reset - */ - -static int i2o_scsi_device_reset(Scsi_Cmnd * SCpnt) -{ - return FAILED; -} - /** * i2o_scsi_bios_param - Invent disk geometry * @sdev: scsi device @@ -1048,7 +1027,7 @@ MODULE_AUTHOR("Red Hat Software"); MODULE_LICENSE("GPL"); -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name = "i2o_scsi", .name = "I2O SCSI Layer", .detect = i2o_scsi_detect, @@ -1057,8 +1036,6 @@ static Scsi_Host_Template driver_template = { .queuecommand = i2o_scsi_queuecommand, .eh_abort_handler = i2o_scsi_abort, .eh_bus_reset_handler = i2o_scsi_bus_reset, - .eh_device_reset_handler= i2o_scsi_device_reset, - .eh_host_reset_handler = i2o_scsi_host_reset, .bios_param = i2o_scsi_bios_param, .can_queue = I2O_SCSI_CAN_QUEUE, .this_id = 15, diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index a01fe0859..e604925df 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c @@ -224,12 +224,12 @@ static struct dentry *ibmasmfs_create_dir (struct super_block *sb, return dentry; } -int ibmasmfs_register() +int ibmasmfs_register(void) { return register_filesystem(&ibmasmfs_type); } -void ibmasmfs_unregister() +void ibmasmfs_unregister(void) { unregister_filesystem(&ibmasmfs_type); } @@ -287,7 +287,7 @@ static int command_file_close(struct inode *inode, struct file *file) return 0; } -static ssize_t command_file_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t command_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { struct ibmasmfs_command_data *command_data = file->private_data; struct command *cmd; @@ -324,7 +324,7 @@ static ssize_t command_file_read(struct file *file, char *buf, size_t count, lof return len; } -static ssize_t command_file_write(struct file *file, const char *ubuff, size_t count, loff_t *offset) +static ssize_t command_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset) { struct ibmasmfs_command_data *command_data = file->private_data; struct command *cmd; @@ -345,7 +345,7 @@ static ssize_t command_file_write(struct file *file, const char *ubuff, size_t c if (!cmd) return -ENOMEM; - if (copy_from_user((void *)cmd->buffer, (void *)ubuff, count)) { + if (copy_from_user(cmd->buffer, ubuff, count)) { command_put(cmd); return -EFAULT; } @@ -395,7 +395,7 @@ static int event_file_close(struct inode *inode, struct file *file) return 0; } -static ssize_t event_file_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { struct ibmasmfs_event_data *event_data = file->private_data; struct event_reader *reader = &event_data->reader; @@ -421,7 +421,7 @@ static ssize_t event_file_read(struct file *file, char *buf, size_t count, loff_ return reader->data_size; } -static ssize_t event_file_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t event_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { struct ibmasmfs_event_data *event_data = file->private_data; @@ -462,7 +462,7 @@ static int r_heartbeat_file_close(struct inode *inode, struct file *file) return 0; } -static ssize_t r_heartbeat_file_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t r_heartbeat_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { struct ibmasmfs_heartbeat_data *rhbeat = file->private_data; unsigned long flags; @@ -490,7 +490,7 @@ static ssize_t r_heartbeat_file_read(struct file *file, char *buf, size_t count, return result; } -static ssize_t r_heartbeat_file_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t r_heartbeat_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { struct ibmasmfs_heartbeat_data *rhbeat = file->private_data; @@ -518,7 +518,7 @@ static int remote_settings_file_close(struct inode *inode, struct file *file) return 0; } -static ssize_t remote_settings_file_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t remote_settings_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { unsigned long address = (unsigned long)file->private_data; unsigned char *page; @@ -552,7 +552,7 @@ exit: return retval; } -static ssize_t remote_settings_file_write(struct file *file, const char *ubuff, size_t count, loff_t *offset) +static ssize_t remote_settings_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset) { unsigned long address = (unsigned long)file->private_data; char *buff; @@ -571,7 +571,7 @@ static ssize_t remote_settings_file_write(struct file *file, const char *ubuff, memset(buff, 0x0, count + 1); - if (copy_from_user((void *)buff, (void *)ubuff, count)) { + if (copy_from_user(buff, ubuff, count)) { kfree(buff); return -EFAULT; } @@ -618,7 +618,7 @@ static int remote_event_file_close(struct inode *inode, struct file *file) return 0; } -static ssize_t remote_event_file_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t remote_event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { struct service_processor *sp = file->private_data; struct remote_queue *q = &sp->remote_queue; @@ -663,7 +663,7 @@ static struct file_operations event_fops = { .open = event_file_open, .release = event_file_close, .read = event_file_read, - .write event_file_write, + .write = event_file_write, }; static struct file_operations r_heartbeat_fops = { diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index ce539ba17..159ccc0b6 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c @@ -108,6 +108,9 @@ #define M29W160DT 0x22C4 #define M29W160DB 0x2249 #define M29W040B 0x00E3 +#define M50FW040 0x002C +#define M50FW080 0x002D +#define M50FW016 0x002E /* SST */ #define SST29EE512 0x005d @@ -1233,6 +1236,45 @@ static const struct amd_flash_info jedec_table[] = { .regions = { ERASEINFO(0x10000,8), } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW040, + .name = "ST M50FW040", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_512KiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,8), + } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW080, + .name = "ST M50FW080", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_1MiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,16), + } + }, { + .mfr_id = MANUFACTURER_ST, + .dev_id = M50FW016, + .name = "ST M50FW016", + .uaddr = { + [0] = MTD_UADDR_UNNECESSARY, /* x8 */ + }, + .DevSize = SIZE_2MiB, + .CmdSet = P_ID_INTEL_EXT, + .NumEraseRegions= 1, + .regions = { + ERASEINFO(0x10000,32), + } }, { .mfr_id = MANUFACTURER_TOSHIBA, .dev_id = TC58FVT160, diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index e0b957b9e..03d39d703 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -489,5 +489,13 @@ config MTD_UCLINUX help Map driver to support image based filesystems for uClinux. +config MTD_WRSBC8260 + tristate "Map driver for WindRiver PowerQUICC II MPC82xx board" + depends on MTD_PARTITIONS && SBC82xx + help + Map driver for WindRiver PowerQUICC II MPC82xx board. Drives + all three flash regions on CS0, CS1 and CS6 if they are configured + correctly by the boot loader. + endmenu diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 230c88c30..929d66861 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile @@ -56,3 +56,4 @@ obj-$(CONFIG_MTD_BEECH) += beech-mtd.o obj-$(CONFIG_MTD_ARCTIC) += arctic-mtd.o obj-$(CONFIG_MTD_H720X) += h720x-flash.o obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o +obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c index c7e25466c..5f7bdd883 100644 --- a/drivers/mtd/maps/lubbock-flash.c +++ b/drivers/mtd/maps/lubbock-flash.c @@ -15,11 +15,12 @@ #include #include #include -#include #include #include #include +#include #include +#include #define ROM_ADDR 0x00000000 diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 965c5954d..fd096eaea 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -275,7 +275,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) /* OK, it's not open. Create cache info for it */ mtdblk = kmalloc(sizeof(struct mtdblk_dev), GFP_KERNEL); - if (!mtdblks) + if (!mtdblk) return -ENOMEM; memset(mtdblk, 0, sizeof(*mtdblk)); diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 3c731e15c..0c9911563 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c @@ -225,7 +225,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) * Reserve I/O resource for exclusive use by this driver */ - if (!request_region(ioaddr, EL1_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, EL1_IO_EXTENT, DRV_NAME)) return -ENODEV; /* diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index 66644b0eb..c4524decb 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c @@ -147,6 +147,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, EL2_IO_EXTENT); } +#ifndef MODULE struct net_device * __init el2_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -171,6 +172,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif /* Probe for the Etherlink II card at I/O port base IOADDR, returning non-zero on success. If found, set the station @@ -182,10 +184,10 @@ el2_probe1(struct net_device *dev, int ioaddr) static unsigned version_printed; unsigned long vendor_id; - if (!request_region(ioaddr, EL2_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, EL2_IO_EXTENT, DRV_NAME)) return -EBUSY; - if (!request_region(ioaddr + 0x400, 8, dev->name)) { + if (!request_region(ioaddr + 0x400, 8, DRV_NAME)) { retval = -EBUSY; goto out; } diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 9c81e7ba8..3aa8409fe 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -1614,6 +1614,7 @@ out: return err; } +#ifndef MODULE struct net_device * __init elplus_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(elp_device)); @@ -1632,7 +1633,7 @@ struct net_device * __init elplus_probe(int unit) return dev; } -#ifdef MODULE +#else static struct net_device *dev_3c505[ELP_MAX_CARDS]; static int io[ELP_MAX_CARDS]; static int irq[ELP_MAX_CARDS]; diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index bfd4ad080..ca0d71d63 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c @@ -373,7 +373,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) init_ID_done = 1; } - if (!request_region(ioaddr, EL16_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, EL16_IO_EXTENT, DRV_NAME)) return -ENODEV; if ((inb(ioaddr) != '*') || (inb(ioaddr + 1) != '3') || @@ -392,7 +392,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr) irq = inb(ioaddr + IRQ_CONFIG) & 0x0f; - irqval = request_irq(irq, &el16_interrupt, 0, dev->name, dev); + irqval = request_irq(irq, &el16_interrupt, 0, DRV_NAME, dev); if (irqval) { printk ("unable to get IRQ %d (irqval=%d).\n", irq, irqval); retval = -EAGAIN; diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 707da8106..388929551 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c @@ -56,10 +56,6 @@ v1.19b 08Nov2002 Marc Zyngier - Introduce driver model for EISA cards. */ -/* - FIXES for PC-9800: - Shu Iwanaga: 3c569B(PC-9801 C-bus) support -*/ #define DRV_NAME "3c509" #define DRV_VERSION "1.19b" @@ -265,7 +261,7 @@ static struct mca_driver el3_mca_driver = { }; #endif /* CONFIG_MCA */ -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) static struct isapnp_device_id el3_isapnp_adapters[] __initdata = { { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090), @@ -362,7 +358,7 @@ static void el3_common_remove (struct net_device *dev) if (lp->pmdev) pm_unregister(lp->pmdev); #endif -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) if (lp->type == EL3_PNP) pnp_device_detach(to_pnp_dev(lp->dev)); #endif @@ -381,7 +377,7 @@ static int __init el3_probe(int card_idx) u16 phys_addr[3]; static int current_tag; int err = -ENODEV; -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) static int pnp_cards; struct pnp_dev *idev = NULL; @@ -436,9 +432,6 @@ __again: no_pnp: #endif /* __ISAPNP__ */ -#ifdef CONFIG_X86_PC9800 - id_port = 0x71d0; -#else /* Select an open I/O location at 0x1*0 to do contention select. */ for ( ; id_port < 0x200; id_port += 0x10) { if (!request_region(id_port, 1, "3c509")) @@ -456,7 +449,7 @@ no_pnp: printk(" WARNING: No I/O port available for 3c509 activation.\n"); return -ENODEV; } -#endif /* CONFIG_X86_PC9800 */ + /* Next check for all ISA bus boards by sending the ID sequence to the ID_PORT. We find cards past the first by setting the 'current_tag' on cards as they are found. Cards with their tag set will not @@ -487,7 +480,7 @@ no_pnp: phys_addr[i] = htons(id_read_eeprom(i)); } -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) if (nopnp == 0) { /* The ISA PnP 3c509 cards respond to the ID sequence. This check is needed in order not to register them twice. */ @@ -512,19 +505,9 @@ no_pnp: { unsigned int iobase = id_read_eeprom(8); if_port = iobase >> 14; -#ifdef CONFIG_X86_PC9800 - ioaddr = 0x40d0 + ((iobase & 0x1f) << 8); -#else ioaddr = 0x200 + ((iobase & 0x1f) << 4); -#endif } irq = id_read_eeprom(9) >> 12; -#ifdef CONFIG_X86_PC9800 - if (irq == 7) - irq = 6; - else if (irq == 15) - irq = 13; -#endif dev = alloc_etherdev(sizeof (struct el3_private)); if (!dev) @@ -555,11 +538,7 @@ no_pnp: outb(0xd0 + ++current_tag, id_port); /* Activate the adaptor at the EEPROM location. */ -#ifdef CONFIG_X86_PC9800 - outb((ioaddr >> 8) | 0xe0, id_port); -#else outb((ioaddr >> 4) | 0xe0, id_port); -#endif EL3WINDOW(0); if (inw(ioaddr) != 0x6d50) @@ -568,7 +547,7 @@ no_pnp: /* Free the interrupt so that some other card can use it. */ outw(0x0f00, ioaddr + WN0_IRQ); -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) found: /* PNP jumps here... */ #endif /* __ISAPNP__ */ @@ -577,7 +556,7 @@ no_pnp: dev->irq = irq; dev->if_port = if_port; lp = netdev_priv(dev); -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) lp->dev = &idev->dev; #endif err = el3_common_init(dev); @@ -601,7 +580,7 @@ no_pnp: return 0; out1: -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) if (idev) pnp_device_detach(idev); #endif @@ -1315,7 +1294,7 @@ el3_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) */ static int -netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) +netdev_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct el3_private *lp = netdev_priv(dev); @@ -1323,7 +1302,7 @@ netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) /* dev_ioctl() in ../../net/core/dev.c has already checked capable(CAP_NET_ADMIN), so don't bother with that here. */ - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -1412,7 +1391,7 @@ netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) switch (cmd) { case SIOCETHTOOL: - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); break; default: @@ -1461,12 +1440,6 @@ el3_up(struct net_device *dev) outw(0x0001, ioaddr + 4); /* Set the IRQ line. */ -#ifdef CONFIG_X86_PC9800 - if (dev->irq == 6) - dev->irq = 7; - else if (dev->irq == 13) - dev->irq = 15; -#endif outw((dev->irq << 12) | 0x0f00, ioaddr + WN0_IRQ); /* Set the station address in window 2 each time opened. */ @@ -1629,7 +1602,7 @@ MODULE_PARM_DESC(debug, "debug level (0-6)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(xcvr,"transceiver(s) (0=internal, 1=external)"); MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt"); -#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800) +#if defined(__ISAPNP__) MODULE_PARM(nopnp, "i"); MODULE_PARM_DESC(nopnp, "disable ISA PnP support (0-1)"); MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters); diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index d47922321..1902f7921 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c @@ -445,7 +445,7 @@ static int __init do_elmc_probe(struct net_device *dev) slot = mca_find_adapter(ELMC_MCA_ID, slot + 1); continue; } - if (!request_region(dev->base_addr, ELMC_IO_EXTENT, dev->name)) { + if (!request_region(dev->base_addr, ELMC_IO_EXTENT, DRV_NAME)) { slot = mca_find_adapter(ELMC_MCA_ID, slot + 1); continue; } @@ -585,6 +585,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, ELMC_IO_EXTENT); } +#ifndef MODULE struct net_device * __init elmc_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct priv)); @@ -609,6 +610,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif /********************************************** * init the chip (elmc-interrupt should be disabled?!) diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index df3240c3c..c6f1995e0 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c @@ -287,6 +287,7 @@ struct net_device *__init mc32_probe(int unit) } } + free_netdev(dev); return ERR_PTR(-ENODEV); } @@ -434,10 +435,10 @@ static int __init mc32_probe1(struct net_device *dev, int slot) * Grab the IRQ */ - err = request_irq(dev->irq, &mc32_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); + err = request_irq(dev->irq, &mc32_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, DRV_NAME, dev); if (err) { release_region(dev->base_addr, MC32_IO_EXTENT); - printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq); + printk(KERN_ERR "%s: unable to get IRQ %d.\n", DRV_NAME, dev->irq); goto err_exit_ports; } diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 9d436ae8d..255cc9ffe 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -446,6 +446,7 @@ enum vortex_chips { CH_3C905B_2, CH_3C905B_FX, CH_3C905C, + CH_3C9202, CH_3C980, CH_3C9805, @@ -520,12 +521,14 @@ static struct vortex_chip_info { {"3c905B-FX Cyclone 100baseFx", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, }, {"3c905C Tornado", - PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, }, + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, + {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)", + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, }, {"3c980 Cyclone", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, }, + {"3c980C Python-T", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, }, - {"3cSOHO100-TX Hurricane", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, }, {"3c555 Laptop Hurricane", @@ -536,9 +539,9 @@ static struct vortex_chip_info { {"3c556B Laptop Hurricane", PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR| WNO_XCVR_PWR|HAS_HWCKSM, 128, }, + {"3c575 [Megahertz] 10/100 LAN CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, }, - {"3c575 Boomerang CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, }, {"3CCFE575BT Cyclone CardBus", @@ -550,10 +553,10 @@ static struct vortex_chip_info { {"3CCFE656 Cyclone CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR| INVERT_LED_PWR|HAS_HWCKSM, 128, }, + {"3CCFEM656B Cyclone+Winmodem CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR| INVERT_LED_PWR|HAS_HWCKSM, 128, }, - {"3CXFEM656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */ PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR| MAX_COLLISION_RESET|HAS_HWCKSM, 128, }, @@ -563,9 +566,9 @@ static struct vortex_chip_info { PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, }, {"3c982 Hydra Dual Port A", PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, }, + {"3c982 Hydra Dual Port B", PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, }, - {"3c905B-T4", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, {"3c920B-EMB-WNM Tornado", @@ -597,6 +600,7 @@ static struct pci_device_id vortex_pci_tbl[] = { { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, { 0x10B7, 0x905A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_FX }, { 0x10B7, 0x9200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905C }, + { 0x10B7, 0x9202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C9202 }, { 0x10B7, 0x9800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C980 }, { 0x10B7, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C9805 }, @@ -1789,7 +1793,7 @@ vortex_timer(unsigned long data) struct net_device *dev = (struct net_device *)data; struct vortex_private *vp = netdev_priv(dev); long ioaddr = dev->base_addr; - int next_tick = 60*HZ; + int next_tick = 10*HZ; int ok = 0; int media_status, mii_status, old_window; @@ -2874,7 +2878,7 @@ static int vortex_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct vortex_private *vp = netdev_priv(dev); long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int phy = vp->phys[0] & 0x1f; int retval; @@ -2913,18 +2917,18 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) int err; struct vortex_private *vp = netdev_priv(dev); int state = 0; - + if(VORTEX_PCI(vp)) state = VORTEX_PCI(vp)->current_state; /* The kernel core really should have pci_get_power_state() */ if(state != 0) - pci_set_power_state(VORTEX_PCI(vp), 0); + pci_set_power_state(VORTEX_PCI(vp), 0); err = vortex_do_ioctl(dev, rq, cmd); if(state != 0) - pci_set_power_state(VORTEX_PCI(vp), state); - + pci_set_power_state(VORTEX_PCI(vp), state); + return err; } diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index da9836612..62dd13951 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -1546,7 +1546,6 @@ static struct ethtool_ops cp_ethtool_ops = { static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { struct cp_private *cp = netdev_priv(dev); - struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &rq->ifr_data; int rc; unsigned long flags; @@ -1554,7 +1553,7 @@ static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) return -EINVAL; spin_lock_irqsave(&cp->lock, flags); - rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL); + rc = generic_mii_ioctl(&cp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irqrestore(&cp->lock, flags); return rc; } diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 511c2c814..6cc14fde4 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c @@ -87,8 +87,6 @@ "rtl8139-diag -mmmaaavvveefN" output enable RTL8139_DEBUG below, and look at 'dmesg' or kernel log - See 8139too.txt for more details. - */ #define DRV_NAME "8139too" @@ -2458,14 +2456,13 @@ static struct ethtool_ops rtl8139_ethtool_ops = { static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct rtl8139_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); return rc; diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 92cf5e0d7..51e04dba2 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c @@ -58,11 +58,12 @@ #include #include #include -#include static char version[] __initdata = "82596.c $Revision: 1.5 $\n"; +#define DRV_NAME "82596" + /* DEBUG flags */ @@ -1191,7 +1192,7 @@ struct net_device * __init i82596_probe(int unit) /* this is easy the ethernet interface can only be at 0x300 */ /* first check nothing is already registered here */ - if (!request_region(ioaddr, I596_TOTAL_SIZE, dev->name)) { + if (!request_region(ioaddr, I596_TOTAL_SIZE, DRV_NAME)) { printk(KERN_ERR "82596: IO address 0x%04x in use\n", ioaddr); err = -EBUSY; goto out; diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 346f595b6..a156a3928 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -922,7 +922,7 @@ config HP100 config NET_ISA bool "Other ISA cards" - depends on NET_ETHERNET && ISA && !X86_PC9800 + depends on NET_ETHERNET && ISA ---help--- If your network (Ethernet) card hasn't been mentioned yet and its bus system (that's the way the cards talks to the other components @@ -1104,56 +1104,6 @@ config SK_G16 the Ethernet-HOWTO, available from . -config NET_CBUS - bool "NEC PC-9800 C-bus cards" - depends on NET_ETHERNET && ISA && X86_PC9800 - ---help--- - If your network (Ethernet) card hasn't been mentioned yet and its - bus system (that's the way the cards talks to the other components - of your computer) is NEC PC-9800 C-Bus, say Y. - -config NE2K_CBUS - tristate "Most NE2000-based Ethernet support" - depends on NET_CBUS - select CRC32 - -config NE2K_CBUS_EGY98 - bool "Melco EGY-98 support" - depends on NE2K_CBUS - -config NE2K_CBUS_LGY98 - bool "Melco LGY-98 support" - depends on NE2K_CBUS - -config NE2K_CBUS_ICM - bool "ICM IF-27xxET support" - depends on NE2K_CBUS - -config NE2K_CBUS_IOLA98 - bool "I-O DATA LA-98 support" - depends on NE2K_CBUS - -config NE2K_CBUS_CNET98EL - bool "Contec C-NET(98)E/L support" - depends on NE2K_CBUS - -config NE2K_CBUS_CNET98EL_IO_BASE - hex "C-NET(98)E/L I/O base address (0xaaed or 0x55ed)" - depends on NE2K_CBUS_CNET98EL - default "0xaaed" - -config NE2K_CBUS_ATLA98 - bool "Allied Telesis LA-98 Support" - depends on NE2K_CBUS - -config NE2K_CBUS_BDN - bool "ELECOM Laneed LD-BDN[123]A Support" - depends on NE2K_CBUS - -config NE2K_CBUS_NEC108 - bool "NEC PC-9801-108 Support" - depends on NE2K_CBUS - config SKMC tristate "SKnet MCA support" depends on NET_ETHERNET && MCA && BROKEN @@ -1286,6 +1236,19 @@ config AMD8111_ETH config AMD8111E_NAPI bool "Enable NAPI support" depends on AMD8111_ETH + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. + + If in doubt, say N. config ADAPTEC_STARFIRE tristate "Adaptec Starfire/DuraLAN support" @@ -1313,6 +1276,11 @@ config ADAPTEC_STARFIRE_NAPI deployed on potentially unfriendly networks (e.g. in a firewall), then say Y here. + See for more + information. + + If in doubt, say N. + config AC3200 tristate "Ansel Communications EISA 3200 support (EXPERIMENTAL)" depends on NET_PCI && (ISA || EISA) && EXPERIMENTAL @@ -1500,6 +1468,19 @@ config E100 config E100_NAPI bool "Use Rx Polling (NAPI)" depends on E100 + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. + + If in doubt, say N. config LNE390 tristate "Mylex EISA LNE390A/B support (EXPERIMENTAL)" @@ -1604,9 +1585,7 @@ config 8139TOO ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL8139 chips. If you have one of those, say Y and read - as well as the - Ethernet-HOWTO, available from - . + the Ethernet-HOWTO . To compile this driver as a module, choose M here: the module will be called 8139too. This is recommended. @@ -1744,6 +1723,17 @@ config VIA_RHINE_MMIO If unsure, say Y. +config VIA_VELOCITY + tristate "VIA Velocity support" + depends on NET_PCI && PCI + select CRC32 + select MII + help + If you have a VIA "Velocity" based network card say Y here. + + To compile this driver as a module, choose M here. The module + will be called via-rhine. + config LAN_SAA9730 bool "Philips SAA9730 Ethernet support (EXPERIMENTAL)" depends on NET_PCI && EXPERIMENTAL && MIPS @@ -1962,6 +1952,19 @@ config E1000 config E1000_NAPI bool "Use Rx Polling (NAPI)" depends on E1000 + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. + + If in doubt, say N. config MYRI_SBUS tristate "MyriCOM Gigabit Ethernet support" @@ -2147,6 +2150,19 @@ config IXGB config IXGB_NAPI bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" depends on IXGB && EXPERIMENTAL + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. + + If in doubt, say N. config S2IO tristate "S2IO 10Gbe XFrame NIC" @@ -2159,6 +2175,19 @@ config S2IO config S2IO_NAPI bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" depends on S2IO && EXPERIMENTAL + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. + + If in doubt, say N. endmenu diff --git a/drivers/net/Makefile b/drivers/net/Makefile index d8d8d90c0..b6ae311ee 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_TC35815) += tc35815.o obj-$(CONFIG_SK98LIN) += sk98lin/ obj-$(CONFIG_SKFP) += skfp/ obj-$(CONFIG_VIA_RHINE) += via-rhine.o +obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o # @@ -79,7 +80,6 @@ obj-$(CONFIG_ARM_ETHERH) += 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o obj-$(CONFIG_EL2) += 3c503.o 8390.o obj-$(CONFIG_NE2000) += ne.o 8390.o -obj-$(CONFIG_NE2K_CBUS) += ne2k_cbus.o 8390.o obj-$(CONFIG_NE2_MCA) += ne2.o 8390.o obj-$(CONFIG_HPLAN) += hp.o 8390.o obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390.o diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 7df6debfd..797e93da6 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -191,8 +191,8 @@ static struct devprobe2 isa_probes[] __initdata = { #ifdef CONFIG_E2100 /* Cabletron E21xx series. */ {e2100_probe, 0}, #endif -#if defined(CONFIG_NE2000) || defined(CONFIG_NE2K_CBUS) || \ - defined(CONFIG_NE_H8300) /* ISA & PC-9800 CBUS (use ne2k-pci for PCI cards) */ +#if defined(CONFIG_NE2000) || \ + defined(CONFIG_NE_H8300) /* ISA (use ne2k-pci for PCI cards) */ {ne_probe, 0}, #endif #ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */ diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 22e1856d6..6f2e92f09 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c @@ -39,6 +39,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "ac3200" + /* Offsets from the base address. */ #define AC_NIC_BASE 0x00 #define AC_SA_PROM 0x16 /* The station address PROM. */ @@ -130,6 +132,7 @@ static void cleanup_card(struct net_device *dev) iounmap((void *)dev->mem_start); } +#ifndef MODULE struct net_device * __init ac3200_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -154,12 +157,13 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init ac_probe1(int ioaddr, struct net_device *dev) { int i, retval; - if (!request_region(ioaddr, AC_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, AC_IO_EXTENT, DRV_NAME)) return -EBUSY; if (inb_p(ioaddr + AC_ID_PORT) == 0xff) { @@ -203,7 +207,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev) printk(", assigning"); } - retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev); + retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (retval) { printk (" nothing! Unable to get IRQ %d.\n", dev->irq); goto out1; diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index d2c237035..6f04ee7a4 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c @@ -85,6 +85,8 @@ #include +#define DRV_NAME "acenic" + #undef INDEX_DEBUG #ifdef CONFIG_ACENIC_OMIT_TIGON_I @@ -443,6 +445,16 @@ static char version[] = "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" " http://home.cern.ch/~jes/gige/acenic.html\n"; +static int ace_get_settings(struct net_device *, struct ethtool_cmd *); +static int ace_set_settings(struct net_device *, struct ethtool_cmd *); +static void ace_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); + +static struct ethtool_ops ace_ethtool_ops = { + .get_settings = ace_get_settings, + .set_settings = ace_set_settings, + .get_drvinfo = ace_get_drvinfo, +}; + static int __devinit acenic_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -480,7 +492,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev, dev->hard_start_xmit = &ace_start_xmit; dev->get_stats = &ace_get_stats; dev->set_multicast_list = &ace_set_multicast_list; - dev->do_ioctl = &ace_ioctl; + SET_ETHTOOL_OPS(dev, &ace_ethtool_ops); dev->set_mac_address = &ace_set_mac_addr; dev->change_mtu = &ace_change_mtu; @@ -1195,10 +1207,10 @@ static int __init ace_init(struct net_device *dev) } ecode = request_irq(pdev->irq, ace_interrupt, SA_SHIRQ, - dev->name, dev); + DRV_NAME, dev); if (ecode) { printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", - dev->name, pdev->irq); + DRV_NAME, pdev->irq); goto init_error; } else dev->irq = pdev->irq; @@ -2688,146 +2700,136 @@ static int ace_change_mtu(struct net_device *dev, int new_mtu) return 0; } - -static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) { struct ace_private *ap = dev->priv; struct ace_regs *regs = ap->regs; -#ifdef SIOCETHTOOL - struct ethtool_cmd ecmd; - u32 link, speed; + u32 link; - if (cmd != SIOCETHTOOL) - return -EOPNOTSUPP; - if (copy_from_user(&ecmd, ifr->ifr_data, sizeof(ecmd))) - return -EFAULT; - switch (ecmd.cmd) { - case ETHTOOL_GSET: - ecmd.supported = - (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | - SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | - SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full | - SUPPORTED_Autoneg | SUPPORTED_FIBRE); - - ecmd.port = PORT_FIBRE; - ecmd.transceiver = XCVR_INTERNAL; - ecmd.phy_address = 0; - - link = readl(®s->GigLnkState); - if (link & LNK_1000MB) - ecmd.speed = SPEED_1000; - else { - link = readl(®s->FastLnkState); - if (link & LNK_100MB) - ecmd.speed = SPEED_100; - else if (link & LNK_100MB) - ecmd.speed = SPEED_10; - else - ecmd.speed = 0; - } - if (link & LNK_FULL_DUPLEX) - ecmd.duplex = DUPLEX_FULL; - else - ecmd.duplex = DUPLEX_HALF; + memset(ecmd, 0, sizeof(struct ethtool_cmd)); + ecmd->supported = + (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | + SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | + SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full | + SUPPORTED_Autoneg | SUPPORTED_FIBRE); + + ecmd->port = PORT_FIBRE; + ecmd->transceiver = XCVR_INTERNAL; - if (link & LNK_NEGOTIATE) - ecmd.autoneg = AUTONEG_ENABLE; + link = readl(®s->GigLnkState); + if (link & LNK_1000MB) + ecmd->speed = SPEED_1000; + else { + link = readl(®s->FastLnkState); + if (link & LNK_100MB) + ecmd->speed = SPEED_100; + else if (link & LNK_10MB) + ecmd->speed = SPEED_10; else - ecmd.autoneg = AUTONEG_DISABLE; + ecmd->speed = 0; + } + if (link & LNK_FULL_DUPLEX) + ecmd->duplex = DUPLEX_FULL; + else + ecmd->duplex = DUPLEX_HALF; + + if (link & LNK_NEGOTIATE) + ecmd->autoneg = AUTONEG_ENABLE; + else + ecmd->autoneg = AUTONEG_DISABLE; #if 0 - /* - * Current struct ethtool_cmd is insufficient - */ - ecmd.trace = readl(®s->TuneTrace); + /* + * Current struct ethtool_cmd is insufficient + */ + ecmd->trace = readl(®s->TuneTrace); - ecmd.txcoal = readl(®s->TuneTxCoalTicks); - ecmd.rxcoal = readl(®s->TuneRxCoalTicks); + ecmd->txcoal = readl(®s->TuneTxCoalTicks); + ecmd->rxcoal = readl(®s->TuneRxCoalTicks); #endif - ecmd.maxtxpkt = readl(®s->TuneMaxTxDesc); - ecmd.maxrxpkt = readl(®s->TuneMaxRxDesc); + ecmd->maxtxpkt = readl(®s->TuneMaxTxDesc); + ecmd->maxrxpkt = readl(®s->TuneMaxRxDesc); - if(copy_to_user(ifr->ifr_data, &ecmd, sizeof(ecmd))) - return -EFAULT; - return 0; + return 0; +} - case ETHTOOL_SSET: - link = readl(®s->GigLnkState); - if (link & LNK_1000MB) - speed = SPEED_1000; - else { - link = readl(®s->FastLnkState); - if (link & LNK_100MB) - speed = SPEED_100; - else if (link & LNK_100MB) - speed = SPEED_10; - else - speed = SPEED_100; - } +static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) +{ + struct ace_private *ap = dev->priv; + struct ace_regs *regs = ap->regs; + u32 link, speed; - link = LNK_ENABLE | LNK_1000MB | LNK_100MB | LNK_10MB | - LNK_RX_FLOW_CTL_Y | LNK_NEG_FCTL; - if (!ACE_IS_TIGON_I(ap)) - link |= LNK_TX_FLOW_CTL_Y; - if (ecmd.autoneg == AUTONEG_ENABLE) - link |= LNK_NEGOTIATE; - if (ecmd.speed != speed) { - link &= ~(LNK_1000MB | LNK_100MB | LNK_10MB); - switch (speed) { - case SPEED_1000: - link |= LNK_1000MB; - break; - case SPEED_100: - link |= LNK_100MB; - break; - case SPEED_10: - link |= LNK_10MB; - break; - } + link = readl(®s->GigLnkState); + if (link & LNK_1000MB) + speed = SPEED_1000; + else { + link = readl(®s->FastLnkState); + if (link & LNK_100MB) + speed = SPEED_100; + else if (link & LNK_10MB) + speed = SPEED_10; + else + speed = SPEED_100; + } + + link = LNK_ENABLE | LNK_1000MB | LNK_100MB | LNK_10MB | + LNK_RX_FLOW_CTL_Y | LNK_NEG_FCTL; + if (!ACE_IS_TIGON_I(ap)) + link |= LNK_TX_FLOW_CTL_Y; + if (ecmd->autoneg == AUTONEG_ENABLE) + link |= LNK_NEGOTIATE; + if (ecmd->speed != speed) { + link &= ~(LNK_1000MB | LNK_100MB | LNK_10MB); + switch (speed) { + case SPEED_1000: + link |= LNK_1000MB; + break; + case SPEED_100: + link |= LNK_100MB; + break; + case SPEED_10: + link |= LNK_10MB; + break; } - if (ecmd.duplex == DUPLEX_FULL) - link |= LNK_FULL_DUPLEX; + } - if (link != ap->link) { - struct cmd cmd; - printk(KERN_INFO "%s: Renegotiating link state\n", - dev->name); + if (ecmd->duplex == DUPLEX_FULL) + link |= LNK_FULL_DUPLEX; - ap->link = link; - writel(link, ®s->TuneLink); - if (!ACE_IS_TIGON_I(ap)) - writel(link, ®s->TuneFastLink); - wmb(); + if (link != ap->link) { + struct cmd cmd; + printk(KERN_INFO "%s: Renegotiating link state\n", + dev->name); - cmd.evt = C_LNK_NEGOTIATION; - cmd.code = 0; - cmd.idx = 0; - ace_issue_cmd(regs, &cmd); - } - return 0; - - case ETHTOOL_GDRVINFO: { - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; - strncpy(info.driver, "acenic", sizeof(info.driver) - 1); - sprintf(info.fw_version, "%i.%i.%i", - tigonFwReleaseMajor, tigonFwReleaseMinor, - tigonFwReleaseFix); - strncpy(info.version, version, sizeof(info.version) - 1); - if (ap && ap->pdev) - strcpy(info.bus_info, pci_name(ap->pdev)); - if (copy_to_user(ifr->ifr_data, &info, sizeof(info))) - return -EFAULT; - return 0; - } - default: - break; - } - -#endif + ap->link = link; + writel(link, ®s->TuneLink); + if (!ACE_IS_TIGON_I(ap)) + writel(link, ®s->TuneFastLink); + wmb(); - return -EOPNOTSUPP; + cmd.evt = C_LNK_NEGOTIATION; + cmd.code = 0; + cmd.idx = 0; + ace_issue_cmd(regs, &cmd); + } + return 0; } +static void ace_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + struct ace_private *ap = dev->priv; + + strlcpy(info->driver, "acenic", sizeof(info->driver)); + snprintf(info->version, sizeof(info->version), "%i.%i.%i", + tigonFwReleaseMajor, tigonFwReleaseMinor, + tigonFwReleaseFix); + + if (ap->pdev) + strlcpy(info->bus_info, pci_name(ap->pdev), + sizeof(info->bus_info)); + +} /* * Set the hardware MAC address. diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h index eb516e155..c4624b85d 100644 --- a/drivers/net/acenic.h +++ b/drivers/net/acenic.h @@ -790,7 +790,6 @@ static void ace_tasklet(unsigned long dev); static void ace_dump_trace(struct ace_private *ap); static void ace_set_multicast_list(struct net_device *dev); static int ace_change_mtu(struct net_device *dev, int new_mtu); -static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); static int ace_set_mac_addr(struct net_device *dev, void *p); static void ace_set_rxtx_parms(struct net_device *dev, int jumbo); static int ace_allocate_descriptors(struct net_device *dev); diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index c4491dab9..7b96c017d 100755 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -1571,7 +1571,7 @@ static void amd8111e_set_multicast_list(struct net_device *dev) This function handles all the ethtool ioctls. It gives driver info, gets/sets driver speed, gets memory mapped register values, forces auto negotiation, sets/gets WOL options for ethtool application. */ -static int amd8111e_ethtool_ioctl(struct net_device* dev, void* useraddr) +static int amd8111e_ethtool_ioctl(struct net_device* dev, void __user *useraddr) { struct amd8111e_priv *lp = netdev_priv(dev); struct pci_dev *pci_dev = lp->pci_dev; @@ -1694,7 +1694,7 @@ static int amd8111e_ethtool_ioctl(struct net_device* dev, void* useraddr) } static int amd8111e_ioctl(struct net_device * dev , struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct amd8111e_priv *lp = netdev_priv(dev); int err; u32 mii_regval; @@ -1704,7 +1704,7 @@ static int amd8111e_ioctl(struct net_device * dev , struct ifreq *ifr, int cmd) switch(cmd) { case SIOCETHTOOL: - return amd8111e_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return amd8111e_ethtool_ioctl(dev, ifr->ifr_data); case SIOCGMIIPHY: data->phy_id = PHY_ID; diff --git a/drivers/net/apne.c b/drivers/net/apne.c index 1b49b8526..a94216b87 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c @@ -49,6 +49,8 @@ /* ---- No user-serviceable parts below ---- */ +#define DRV_NAME "apne" + #define NE_BASE (dev->base_addr) #define NE_CMD 0x00 #define NE_DATAPORT 0x10 /* NatSemi-defined port window offset. */ @@ -168,7 +170,7 @@ struct net_device * __init apne_probe(int unit) return ERR_PTR(-ENODEV); } - if (!request_region(IOBASE, 0x20, dev->name)) { + if (!request_region(IOBASE, 0x20, DRV_NAME)) { free_netdev(dev); return ERR_PTR(-EBUSY); } @@ -310,7 +312,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) dev->base_addr = ioaddr; /* Install the Interrupt handler */ - i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, DRV_NAME, dev); if (i) return i; for(i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index db21e0c41..925dd0477 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c @@ -524,7 +524,7 @@ static void cops_reset(struct net_device *dev, int sleep) static void cops_load (struct net_device *dev) { struct ifreq ifr; - struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_data; + struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_ifru; struct cops_local *lp = netdev_priv(dev); int ioaddr=dev->base_addr; int length, i = 0; diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index 8c0a962d5..8bf0bba62 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c @@ -259,7 +259,7 @@ static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt) static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct ipddp_route *rt = (struct ipddp_route *)ifr->ifr_data; + struct ipddp_route __user *rt = ifr->ifr_data; struct ipddp_route rcp; if(!capable(CAP_NET_ADMIN)) diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index 06c134606..1ba12ab47 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig @@ -45,3 +45,20 @@ config ARM_ETHER00 number (MTD support is required for this). Otherwise you will need to set a suitable hw address using ifconfig. +config SMC91X + tristate "SMC 91C9x/91C1xxx support" + select CRC32 + select MII + depends on ARM + help + This is a driver for SMC's 91x series of Ethernet chipsets, + including the SMC91C94 and the SMC91C111. Say Y if you want it + compiled into the kernel, and read the file + and the Ethernet-HOWTO, + available from . + + This driver is also available as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called smc91x. If you want to compile it as a + module, say M here and read as well + as . diff --git a/drivers/net/arm/Makefile b/drivers/net/arm/Makefile index b0d706834..d6d87c03e 100644 --- a/drivers/net/arm/Makefile +++ b/drivers/net/arm/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_ARM_ETHER00) += ether00.o obj-$(CONFIG_ARM_ETHERH) += etherh.o obj-$(CONFIG_ARM_ETHER3) += ether3.o obj-$(CONFIG_ARM_ETHER1) += ether1.o +obj-$(CONFIG_SMC91X) += smc91x.o diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 8bd25b970..6b28a3d9b 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c @@ -53,25 +53,31 @@ static const char version[] = #ifdef __arm__ static void write_rreg(u_long base, u_int reg, u_int val) { - __asm__("str%?h %1, [%2] @ NET_RAP - str%?h %0, [%2, #-4] @ NET_RDP - " : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464)); + __asm__( + "str%?h %1, [%2] @ NET_RAP\n\t" + "str%?h %0, [%2, #-4] @ NET_RDP" + : + : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464)); } static inline unsigned short read_rreg(u_long base_addr, u_int reg) { unsigned short v; - __asm__("str%?h %1, [%2] @ NET_RAP - ldr%?h %0, [%2, #-4] @ NET_RDP - " : "=r" (v): "r" (reg), "r" (ISAIO_BASE + 0x0464)); + __asm__( + "str%?h %1, [%2] @ NET_RAP\n\t" + "ldr%?h %0, [%2, #-4] @ NET_RDP" + : "=r" (v) + : "r" (reg), "r" (ISAIO_BASE + 0x0464)); return v; } static inline void write_ireg(u_long base, u_int reg, u_int val) { - __asm__("str%?h %1, [%2] @ NET_RAP - str%?h %0, [%2, #8] @ NET_IDP - " : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464)); + __asm__( + "str%?h %1, [%2] @ NET_RAP\n\t" + "str%?h %0, [%2, #8] @ NET_IDP" + : + : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464)); } static inline unsigned short read_ireg(u_long base_addr, u_int reg) @@ -101,16 +107,16 @@ am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigne } while (length > 8) { unsigned int tmp, tmp2; - __asm__ __volatile__(" - ldm%?ia %1!, {%2, %3} - str%?h %2, [%0], #4 - mov%? %2, %2, lsr #16 - str%?h %2, [%0], #4 - str%?h %3, [%0], #4 - mov%? %3, %3, lsr #16 - str%?h %3, [%0], #4 - " : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2) - : "0" (offset), "1" (buf)); + __asm__ __volatile__( + "ldm%?ia %1!, {%2, %3}\n\t" + "str%?h %2, [%0], #4\n\t" + "mov%? %2, %2, lsr #16\n\t" + "str%?h %2, [%0], #4\n\t" + "str%?h %3, [%0], #4\n\t" + "mov%? %3, %3, lsr #16\n\t" + "str%?h %3, [%0], #4" + : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2) + : "0" (offset), "1" (buf)); length -= 8; } while (length > 0) { @@ -128,36 +134,36 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned length = (length + 1) & ~1; if ((int)buf & 2) { unsigned int tmp; - __asm__ __volatile__(" - ldr%?h %2, [%0], #4 - str%?b %2, [%1], #1 - mov%? %2, %2, lsr #8 - str%?b %2, [%1], #1 - " : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf)); + __asm__ __volatile__( + "ldr%?h %2, [%0], #4\n\t" + "str%?b %2, [%1], #1\n\t" + "mov%? %2, %2, lsr #8\n\t" + "str%?b %2, [%1], #1" + : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf)); length -= 2; } while (length > 8) { unsigned int tmp, tmp2, tmp3; - __asm__ __volatile__(" - ldr%?h %2, [%0], #4 - ldr%?h %3, [%0], #4 - orr%? %2, %2, %3, lsl #16 - ldr%?h %3, [%0], #4 - ldr%?h %4, [%0], #4 - orr%? %3, %3, %4, lsl #16 - stm%?ia %1!, {%2, %3} - " : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3) - : "0" (offset), "1" (buf)); + __asm__ __volatile__( + "ldr%?h %2, [%0], #4\n\t" + "ldr%?h %3, [%0], #4\n\t" + "orr%? %2, %2, %3, lsl #16\n\t" + "ldr%?h %3, [%0], #4\n\t" + "ldr%?h %4, [%0], #4\n\t" + "orr%? %3, %3, %4, lsl #16\n\t" + "stm%?ia %1!, {%2, %3}" + : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3) + : "0" (offset), "1" (buf)); length -= 8; } while (length > 0) { unsigned int tmp; - __asm__ __volatile__(" - ldr%?h %2, [%0], #4 - str%?b %2, [%1], #1 - mov%? %2, %2, lsr #8 - str%?b %2, [%1], #1 - " : "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf)); + __asm__ __volatile__( + "ldr%?h %2, [%0], #4\n\t" + "str%?b %2, [%1], #1\n\t" + "mov%? %2, %2, lsr #8\n\t" + "str%?b %2, [%1], #1" + : "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf)); length -= 2; } } @@ -618,6 +624,7 @@ am79c961_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (status & CSR0_CERR) { handled = 1; mod_timer(&priv->timer, jiffies); + } } while (--n && status & (CSR0_RINT | CSR0_TINT)); return IRQ_RETVAL(handled); diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 7543bfbac..872537481 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -65,6 +65,8 @@ static char version[] __initdata = "at1700.c:v1.15 4/7/98 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; +#define DRV_NAME "at1700" + /* Tunable parameters. */ /* When to switch from the 64-entry multicast filter to Rx-all-multicast. */ @@ -80,17 +82,10 @@ static int fmv18x_probe_list[] __initdata = { * ISA */ -#ifndef CONFIG_X86_PC9800 static unsigned at1700_probe_list[] __initdata = { 0x260, 0x280, 0x2a0, 0x240, 0x340, 0x320, 0x380, 0x300, 0 }; -#else /* CONFIG_X86_PC9800 */ -static unsigned at1700_probe_list[] __initdata = { - 0x1d6, 0x1d8, 0x1da, 0x1d4, 0xd4, 0xd2, 0xd8, 0xd0, 0 -}; - -#endif /* CONFIG_X86_PC9800 */ /* * MCA */ @@ -133,7 +128,6 @@ struct net_local { /* Offsets from the base address. */ -#ifndef CONFIG_X86_PC9800 #define STATUS 0 #define TX_STATUS 0 #define RX_STATUS 1 @@ -161,34 +155,6 @@ struct net_local { #define RESET 31 /* Write to reset some parts of the chip. */ #define AT1700_IO_EXTENT 32 #define PORT_OFFSET(o) (o) -#else /* CONFIG_X86_PC9800 */ -#define STATUS (0x0000) -#define TX_STATUS (0x0000) -#define RX_STATUS (0x0001) -#define TX_INTR (0x0200)/* Bit-mapped interrupt enable registers. */ -#define RX_INTR (0x0201) -#define TX_MODE (0x0400) -#define RX_MODE (0x0401) -#define CONFIG_0 (0x0600)/* Misc. configuration settings. */ -#define CONFIG_1 (0x0601) -/* Run-time register bank 2 definitions. */ -#define DATAPORT (0x0800)/* Word-wide DMA or programmed-I/O dataport. */ -#define TX_START (0x0a00) -#define COL16CNTL (0x0a01)/* Controll Reg for 16 collisions */ -#define MODE13 (0x0c01) -#define RX_CTRL (0x0e00) -/* Configuration registers only on the '865A/B chips. */ -#define EEPROM_Ctrl (0x1000) -#define EEPROM_Data (0x1200) -#define CARDSTATUS 16 /* FMV-18x Card Status */ -#define CARDSTATUS1 17 /* FMV-18x Card Status */ -#define IOCONFIG (0x1400)/* Either read the jumper, or move the I/O. */ -#define IOCONFIG1 (0x1600) -#define SAPROM 20 /* The station address PROM, if no EEPROM. */ -#define MODE24 (0x1800)/* The station address PROM, if no EEPROM. */ -#define RESET (0x1e01)/* Write to reset some parts of the chip. */ -#define PORT_OFFSET(o) ({ int _o_ = (o); (_o_ & ~1) * 0x100 + (_o_ & 1); }) -#endif /* CONFIG_X86_PC9800 */ #define TX_TIMEOUT 10 @@ -230,11 +196,7 @@ static struct at1720_mca_adapters_struct at1720_mca_adapters[] __initdata = { (detachable devices only). */ -#ifndef CONFIG_X86_PC9800 static int io = 0x260; -#else -static int io = 0xd0; -#endif static int irq; @@ -242,19 +204,11 @@ static void cleanup_card(struct net_device *dev) { #ifdef CONFIG_MCA struct net_local *lp = netdev_priv(dev); - if (lp->mca_slot) + if (lp->mca_slot >= 0) mca_mark_as_unused(lp->mca_slot); #endif free_irq(dev->irq, NULL); -#ifndef CONFIG_X86_PC9800 release_region(dev->base_addr, AT1700_IO_EXTENT); -#else - { - int i; - for (i = 0; i < 0x2000; i += 0x200) - release_region(dev->base_addr + i, 2); - } -#endif } struct net_device * __init at1700_probe(int unit) @@ -321,20 +275,8 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) int slot, ret = -ENODEV; struct net_local *lp = netdev_priv(dev); -#ifndef CONFIG_X86_PC9800 - if (!request_region(ioaddr, AT1700_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, AT1700_IO_EXTENT, DRV_NAME)) return -EBUSY; -#else - for (i = 0; i < 0x2000; i += 0x0200) { - if (!request_region(ioaddr + i, 2, dev->name)) { - while (i > 0) { - i -= 0x0200; - release_region(ioaddr + i, 2); - } - return -EBUSY; - } - } -#endif /* Resetting the chip doesn't reset the ISA interface, so don't bother. That means we have to be careful with the register values we probe @@ -425,15 +367,8 @@ found: outb(0, ioaddr + RESET); if (is_at1700) { -#ifndef CONFIG_X86_PC9800 irq = at1700_irqmap[(read_eeprom(ioaddr, 12)&0x04) | (read_eeprom(ioaddr, 0)>>14)]; -#else - { - char re1000plus_irqmap[4] = {3, 5, 6, 12}; - irq = re1000plus_irqmap[inb(ioaddr + IOCONFIG1) >> 6]; - } -#endif } else { /* Check PnP mode for FMV-183/184/183A/184A. */ /* This PnP routine is very poor. IO and IRQ should be known. */ @@ -444,11 +379,11 @@ found: break; } if (i == 8) { - goto err_out; + goto err_mca; } } else { if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr) - goto err_out; + goto err_mca; irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03]; } } @@ -517,11 +452,7 @@ found: /* Switch to bank 2 */ /* Lock our I/O address, and set manual processing mode for 16 collisions. */ outb(0x08, ioaddr + CONFIG_1); -#ifndef CONFIG_X86_PC9800 outb(dev->if_port, ioaddr + MODE13); -#else - outb(0, ioaddr + MODE13); -#endif outb(0x00, ioaddr + COL16CNTL); if (net_debug) @@ -542,22 +473,22 @@ found: lp->jumpered = is_fmv18x; lp->mca_slot = slot; /* Snarf the interrupt vector now. */ - ret = request_irq(irq, &net_interrupt, 0, dev->name, dev); + ret = request_irq(irq, &net_interrupt, 0, DRV_NAME, dev); if (ret) { printk (" AT1700 at %#3x is unusable due to a conflict on" "IRQ %d.\n", ioaddr, irq); - goto err_out; + goto err_mca; } return 0; +err_mca: +#ifdef CONFIG_MCA + if (slot >= 0) + mca_mark_as_unused(slot); +#endif err_out: -#ifndef CONFIG_X86_PC9800 release_region(ioaddr, AT1700_IO_EXTENT); -#else - for (i = 0; i < 0x2000; i += 0x0200) - release_region(ioaddr + i, 2); -#endif return ret; } @@ -568,13 +499,6 @@ err_out: #define EE_DATA_WRITE 0x80 /* EEPROM chip data in, in reg. 17. */ #define EE_DATA_READ 0x80 /* EEPROM chip data out, in reg. 17. */ -/* Delay between EEPROM clock transitions. */ -#ifndef CONFIG_X86_PC9800 -#define eeprom_delay() do { } while (0) -#else -#define eeprom_delay() __asm__ ("out%B0 %%al,%0" :: "N"(0x5f)) -#endif - /* The EEPROM commands include the alway-set leading bit. */ #define EE_WRITE_CMD (5 << 6) #define EE_READ_CMD (6 << 6) @@ -593,22 +517,17 @@ static int __init read_eeprom(long ioaddr, int location) short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; outb(EE_CS, ee_addr); outb(dataval, ee_daddr); - eeprom_delay(); outb(EE_CS | EE_SHIFT_CLK, ee_addr); /* EEPROM clock tick. */ - eeprom_delay(); } outb(EE_DATA_WRITE, ee_daddr); for (i = 16; i > 0; i--) { outb(EE_CS, ee_addr); - eeprom_delay(); outb(EE_CS | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); retval = (retval << 1) | ((inb(ee_daddr) & EE_DATA_READ) ? 1 : 0); } /* Terminate the EEPROM access. */ outb(EE_CS, ee_addr); - eeprom_delay(); outb(EE_SHIFT_CLK, ee_addr); outb(0, ee_addr); return retval; diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 2bd0ac959..afcdcffc7 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -1269,7 +1269,7 @@ static void set_rx_mode(struct net_device *dev) static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; /* fixme */ switch(cmd) { diff --git a/drivers/net/b44.c b/drivers/net/b44.c index d7f2142f8..ba1d4fc9a 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1633,7 +1633,7 @@ static struct ethtool_ops b44_ethtool_ops = { static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data __user *data = (struct mii_ioctl_data __user *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct b44 *bp = netdev_priv(dev); int err; diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 778fd0754..6e57c1434 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1103,7 +1103,7 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de /* Yes, the mii is overlaid on the ifreq.ifr_ifru */ strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); - mii = (struct mii_ioctl_data *)&ifr.ifr_data; + mii = if_mii(&ifr); if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { mii->reg_num = MII_BMSR; if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) { @@ -2357,10 +2357,10 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi static int bond_ethtool_ioctl(struct net_device *bond_dev, struct ifreq *ifr) { struct ethtool_drvinfo info; - void *addr = ifr->ifr_data; + void __user *addr = ifr->ifr_data; uint32_t cmd; - if (get_user(cmd, (uint32_t *)addr)) { + if (get_user(cmd, (uint32_t __user *)addr)) { return -EFAULT; } @@ -3667,8 +3667,10 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) { struct net_device *slave_dev = NULL; - struct ifbond *u_binfo = NULL, k_binfo; - struct ifslave *u_sinfo = NULL, k_sinfo; + struct ifbond k_binfo; + struct ifbond __user *u_binfo = NULL; + struct ifslave k_sinfo; + struct ifslave __user *u_sinfo = NULL; struct mii_ioctl_data *mii = NULL; int prev_abi_ver = orig_app_abi_ver; int res = 0; @@ -3680,7 +3682,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd case SIOCETHTOOL: return bond_ethtool_ioctl(bond_dev, ifr); case SIOCGMIIPHY: - mii = (struct mii_ioctl_data *)&ifr->ifr_data; + mii = if_mii(ifr); if (!mii) { return -EINVAL; } @@ -3691,7 +3693,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd * We do this again just in case we were called by SIOCGMIIREG * instead of SIOCGMIIPHY. */ - mii = (struct mii_ioctl_data *)&ifr->ifr_data; + mii = if_mii(ifr); if (!mii) { return -EINVAL; } @@ -3711,7 +3713,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return 0; case BOND_INFO_QUERY_OLD: case SIOCBONDINFOQUERY: - u_binfo = (struct ifbond *)ifr->ifr_data; + u_binfo = (struct ifbond __user *)ifr->ifr_data; if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) { return -EFAULT; @@ -3727,7 +3729,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return res; case BOND_SLAVE_INFO_QUERY_OLD: case SIOCBONDSLAVEINFOQUERY: - u_sinfo = (struct ifslave *)ifr->ifr_data; + u_sinfo = (struct ifslave __user *)ifr->ifr_data; if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) { return -EFAULT; diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 9745bf6a9..7e616f7aa 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -141,6 +141,8 @@ static char version[] __initdata = "cs89x0.c: v2.4.3-pre1 Russell Nelson , Andrew Morton \n"; +#define DRV_NAME "cs89x0" + /* First, a few definitions that the brave might change. A zero-terminated list of I/O addresses to be probed. Some special flags.. Addr & 1 = Read back the address port, look for signature and reset @@ -261,7 +263,6 @@ static int __init media_fn(char *str) } __setup("cs89x0_media=", media_fn); -#endif /* Check for a network adaptor of this type, and return '0' iff one exists. @@ -318,6 +319,7 @@ out: printk(KERN_WARNING "cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP\n"); return ERR_PTR(err); } +#endif static int readreg(struct net_device *dev, int portno) @@ -425,9 +427,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) /* Grab the region so we can find another board if autoIRQ fails. */ /* WTF is going on here? */ - if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, dev->name)) { + if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", - dev->name, ioaddr, NETCARD_IO_EXTENT); + DRV_NAME, ioaddr, NETCARD_IO_EXTENT); retval = -EBUSY; goto out1; } diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index cada0c669..9ef9f3944 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c @@ -219,6 +219,8 @@ static char version[] __devinitdata = "defxx.c:v1.06 2003/08/04 Lawrence V. Stefani and others\n"; +#define DRV_NAME "defxx" + #define DYNAMIC_BUFFERS 1 #define SKBUFF_RX_COPYBREAK 200 @@ -435,9 +437,9 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) bp = dev->priv; - if (!request_region (ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN, dev->name)) { + if (!request_region (ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN, DRV_NAME)) { printk (KERN_ERR "%s: Cannot reserve I/O resource 0x%x @ 0x%lx, aborting\n", - dev->name, PFI_K_CSR_IO_LEN, ioaddr); + DRV_NAME, PFI_K_CSR_IO_LEN, ioaddr); err = -EBUSY; goto err_out; } diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 80e8617dc..5d62a032b 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c @@ -1937,7 +1937,7 @@ static void depca_dbg_open(struct net_device *dev) static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct depca_private *lp = (struct depca_private *) dev->priv; - struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_data; + struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru; int i, status = 0; u_long ioaddr = dev->base_addr; union { diff --git a/drivers/net/depca.h b/drivers/net/depca.h index 2fa155843..11785275a 100644 --- a/drivers/net/depca.h +++ b/drivers/net/depca.h @@ -162,7 +162,7 @@ struct depca_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 4673bd829..39cabaf80 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c @@ -107,7 +107,7 @@ static int change_mtu (struct net_device *dev, int new_mtu); static void set_multicast (struct net_device *dev); static struct net_device_stats *get_stats (struct net_device *dev); static int clear_stats (struct net_device *dev); -static int rio_ethtool_ioctl (struct net_device *dev, void *useraddr); +static int rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr); static int rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); static int rio_close (struct net_device *dev); static int find_miiphy (struct net_device *dev); @@ -1195,7 +1195,7 @@ set_multicast (struct net_device *dev) } static int -rio_ethtool_ioctl (struct net_device *dev, void *useraddr) +rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 ethcmd; @@ -1325,7 +1325,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { int phy_addr; struct netdev_private *np = dev->priv; - struct mii_data *miidata = (struct mii_data *) &rq->ifr_data; + struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; struct netdev_desc *desc; int i; @@ -1333,7 +1333,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) phy_addr = np->phy_addr; switch (cmd) { case SIOCETHTOOL: - return rio_ethtool_ioctl (dev, (void *) rq->ifr_data); + return rio_ethtool_ioctl(dev, rq->ifr_data); case SIOCDEVPRIVATE: break; diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 4b9558068..8855b20e3 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -827,8 +827,8 @@ static inline int e100_exec_cb(struct nic *nic, struct sk_buff *skb, cb->prev->command &= cpu_to_le16(~cb_s); while(nic->cb_to_send != nic->cb_to_use) { - if(unlikely((err = e100_exec_cmd(nic, nic->cuc_cmd, - nic->cb_to_send->dma_addr)))) { + if(unlikely(e100_exec_cmd(nic, nic->cuc_cmd, + nic->cb_to_send->dma_addr))) { /* Ok, here's where things get sticky. It's * possible that we can't schedule the command * because the controller is too busy, so @@ -1323,7 +1323,7 @@ static inline int e100_tx_clean(struct nic *nic) static void e100_clean_cbs(struct nic *nic) { if(nic->cbs) { - while(nic->cb_to_clean != nic->cb_to_use) { + while(nic->cbs_avail != nic->params.cbs.count) { struct cb *cb = nic->cb_to_clean; if(cb->skb) { pci_unmap_single(nic->pdev, @@ -1333,8 +1333,8 @@ static void e100_clean_cbs(struct nic *nic) dev_kfree_skb(cb->skb); } nic->cb_to_clean = nic->cb_to_clean->next; + nic->cbs_avail++; } - nic->cbs_avail = nic->params.cbs.count; pci_free_consistent(nic->pdev, sizeof(struct cb) * nic->params.cbs.count, nic->cbs, nic->cbs_dma_addr); @@ -1659,17 +1659,16 @@ static int e100_up(struct nic *nic) goto err_clean_cbs; e100_set_multicast_list(nic->netdev); e100_start_receiver(nic); - netif_start_queue(nic->netdev); mod_timer(&nic->watchdog, jiffies); if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, nic->netdev->name, nic->netdev))) goto err_no_irq; e100_enable_irq(nic); + netif_wake_queue(nic->netdev); return 0; err_no_irq: del_timer_sync(&nic->watchdog); - netif_stop_queue(nic->netdev); err_clean_cbs: e100_clean_cbs(nic); err_rx_clean_list: @@ -2075,9 +2074,8 @@ static struct ethtool_ops e100_ethtool_ops = { static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct nic *nic = netdev_priv(netdev); - struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr->ifr_data; - return generic_mii_ioctl(&nic->mii, mii, cmd, NULL); + return generic_mii_ioctl(&nic->mii, if_mii(ifr), cmd, NULL); } static int e100_alloc(struct nic *nic) diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 0394fd28c..9ca716eab 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -1004,11 +1004,12 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); struct sk_buff *skb; - if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + 2, GFP_KERNEL))) { + if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, + GFP_KERNEL))) { ret_val = 6; goto err_nomem; } - skb_reserve(skb, 2); + skb_reserve(skb, NET_IP_ALIGN); rxdr->buffer_info[i].skb = skb; rxdr->buffer_info[i].length = E1000_RXBUFFER_2048; rxdr->buffer_info[i].dma = diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 8a8173c6a..b57526852 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -52,7 +52,7 @@ char e1000_driver_name[] = "e1000"; char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; -char e1000_driver_version[] = "5.2.52-k2"; +char e1000_driver_version[] = "5.2.52-k4"; char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; /* e1000_pci_tbl - PCI Device ID Table @@ -2143,6 +2143,7 @@ e1000_clean(struct net_device *netdev, int *budget) if(work_done < work_to_do || !netif_running(netdev)) { netif_rx_complete(netdev); e1000_irq_enable(adapter); + return 0; } return (work_done >= work_to_do); @@ -2366,7 +2367,6 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) struct e1000_rx_desc *rx_desc; struct e1000_buffer *buffer_info; struct sk_buff *skb; - int reserve_len = 2; unsigned int i; i = rx_ring->next_to_use; @@ -2375,7 +2375,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) while(!buffer_info->skb) { rx_desc = E1000_RX_DESC(*rx_ring, i); - skb = dev_alloc_skb(adapter->rx_buffer_len + reserve_len); + skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN); if(!skb) { /* Better luck next round */ @@ -2386,7 +2386,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) * this will result in a 16 byte aligned IP header after * the 14 byte MAC header is removed */ - skb_reserve(skb, reserve_len); + skb_reserve(skb, NET_IP_ALIGN); skb->dev = netdev; @@ -2503,7 +2503,7 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct e1000_adapter *adapter = netdev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); int retval; uint16_t mii_reg; uint16_t spddplx; diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index 71c632b17..7fc98601c 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c @@ -51,6 +51,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "e2100" + static int e21_probe_list[] = {0x300, 0x280, 0x380, 0x220, 0}; /* Offsets from the base_addr. @@ -144,6 +146,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, E21_IO_EXTENT); } +#ifndef MODULE struct net_device * __init e2100_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -168,6 +171,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init e21_probe1(struct net_device *dev, int ioaddr) { @@ -175,7 +179,7 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr) unsigned char *station_addr = dev->dev_addr; static unsigned version_printed; - if (!request_region(ioaddr, E21_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, E21_IO_EXTENT, DRV_NAME)) return -EBUSY; /* First check the station address for the Ctron prefix. */ diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 785daf68d..9f5ea6075 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c @@ -151,6 +151,8 @@ static const char version[] = #include #include +#define DRV_NAME "eepro" + #define compat_dev_kfree_skb( skb, mode ) dev_kfree_skb( (skb) ) /* I had reports of looong delays with SLOW_DOWN defined as udelay(2) */ #define SLOW_DOWN inb(0x80) @@ -577,6 +579,7 @@ static int __init do_eepro_probe(struct net_device *dev) return -ENODEV; } +#ifndef MODULE struct net_device * __init eepro_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct eepro_local)); @@ -603,6 +606,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static void __init printEEPROMInfo(short ioaddr, struct net_device *dev) { @@ -745,7 +749,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) int ioaddr = dev->base_addr; /* Grab the region so we can find another board if autoIRQ fails. */ - if (!request_region(ioaddr, EEPRO_IO_EXTENT, dev->name)) { + if (!request_region(ioaddr, EEPRO_IO_EXTENT, DRV_NAME)) { if (!autoprobe) printk(KERN_WARNING "EEPRO: io-port 0x%04x in use \n", ioaddr); diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index f460db444..56fc87881 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -2017,7 +2017,7 @@ speedo_get_stats(struct net_device *dev) return &sp->stats; } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct speedo_private *sp = netdev_priv(dev); @@ -2096,7 +2096,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct speedo_private *sp = netdev_priv(dev); - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int phy = sp->phy[0] & 0x1f; int saved_acpi; int t; @@ -2129,7 +2129,7 @@ static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) pci_set_power_state(sp->pdev, saved_acpi); return 0; case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; } diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 24663cb1c..a379c0a38 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c @@ -423,6 +423,7 @@ static int __init do_express_probe(struct net_device *dev) return -ENODEV; } +#ifndef MODULE struct net_device * __init express_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); @@ -443,6 +444,7 @@ struct net_device * __init express_probe(int unit) free_netdev(dev); return ERR_PTR(err); } +#endif /* * open and initialize the adapter, ready for use diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index cf7ae0569..e81e0afda 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c @@ -66,12 +66,15 @@ LK1.1.14 (Kryzsztof Halasa): * fix spurious bad initializations * pound phy a la SMSC's app note on the subject + + AC1.1.14ac + * fix power up/down for ethtool that broke in 1.11 */ #define DRV_NAME "epic100" -#define DRV_VERSION "1.11+LK1.1.14" -#define DRV_RELDATE "Aug 4, 2002" +#define DRV_VERSION "1.11+LK1.1.14+AC1.1.14" +#define DRV_RELDATE "June 2, 2004" /* The user-configurable values. These may be modified when a driver module is loaded.*/ @@ -1215,13 +1218,8 @@ static int epic_rx(struct net_device *dev) ep->rx_ring[entry].bufaddr, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); -#if 1 /* HAS_IP_COPYSUM */ eth_copy_and_sum(skb, ep->rx_skbuff[entry]->tail, pkt_len, 0); skb_put(skb, pkt_len); -#else - memcpy(skb_put(skb, pkt_len), ep->rx_skbuff[entry]->tail, - pkt_len); -#endif pci_dma_sync_single_for_device(ep->pci_dev, ep->rx_ring[entry].bufaddr, ep->rx_buf_sz, @@ -1424,6 +1422,27 @@ static void netdev_set_msglevel(struct net_device *dev, u32 value) debug = value; } +static int ethtool_begin(struct net_device *dev) +{ + unsigned long ioaddr = dev->base_addr; + /* power-up, if interface is down */ + if (! netif_running(dev)) { + outl(0x0200, ioaddr + GENCTL); + outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); + } + return 0; +} + +static void ethtool_complete(struct net_device *dev) +{ + unsigned long ioaddr = dev->base_addr; + /* power-down, if interface is down */ + if (! netif_running(dev)) { + outl(0x0008, ioaddr + GENCTL); + outl((inl(ioaddr + NVCTL) & ~0x483C) | 0x0000, ioaddr + NVCTL); + } +} + static struct ethtool_ops netdev_ethtool_ops = { .get_drvinfo = netdev_get_drvinfo, .get_settings = netdev_get_settings, @@ -1434,13 +1453,15 @@ static struct ethtool_ops netdev_ethtool_ops = { .set_msglevel = netdev_set_msglevel, .get_sg = ethtool_op_get_sg, .get_tx_csum = ethtool_op_get_tx_csum, + .begin = ethtool_begin, + .complete = ethtool_complete }; static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct epic_private *np = dev->priv; long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int rc; /* power-up, if interface is down */ diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 0ee18be4a..9ab72741d 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -255,14 +255,14 @@ static int eql_close(struct net_device *dev) return 0; } -static int eql_enslave(struct net_device *dev, slaving_request_t *srq); -static int eql_emancipate(struct net_device *dev, slaving_request_t *srq); +static int eql_enslave(struct net_device *dev, slaving_request_t __user *srq); +static int eql_emancipate(struct net_device *dev, slaving_request_t __user *srq); -static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *sc); -static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *sc); +static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *sc); +static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *sc); -static int eql_g_master_cfg(struct net_device *dev, master_config_t *mc); -static int eql_s_master_cfg(struct net_device *dev, master_config_t *mc); +static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mc); +static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mc); static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { @@ -272,23 +272,17 @@ static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) switch (cmd) { case EQL_ENSLAVE: - return eql_enslave(dev, - (slaving_request_t *) ifr->ifr_data); + return eql_enslave(dev, ifr->ifr_data); case EQL_EMANCIPATE: - return eql_emancipate(dev, - (slaving_request_t *) ifr->ifr_data); + return eql_emancipate(dev, ifr->ifr_data); case EQL_GETSLAVECFG: - return eql_g_slave_cfg(dev, - (slave_config_t *) ifr->ifr_data); + return eql_g_slave_cfg(dev, ifr->ifr_data); case EQL_SETSLAVECFG: - return eql_s_slave_cfg(dev, - (slave_config_t *) ifr->ifr_data); + return eql_s_slave_cfg(dev, ifr->ifr_data); case EQL_GETMASTRCFG: - return eql_g_master_cfg(dev, - (master_config_t *) ifr->ifr_data); + return eql_g_master_cfg(dev, ifr->ifr_data); case EQL_SETMASTRCFG: - return eql_s_master_cfg(dev, - (master_config_t *) ifr->ifr_data); + return eql_s_master_cfg(dev, ifr->ifr_data); default: return -EOPNOTSUPP; }; @@ -411,7 +405,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave) return -ENOSPC; } -static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp) +static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *srqp) { struct net_device *slave_dev; slaving_request_t srq; @@ -457,7 +451,7 @@ static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp) return -EINVAL; } -static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp) +static int eql_emancipate(struct net_device *master_dev, slaving_request_t __user *srqp) { equalizer_t *eql = master_dev->priv; struct net_device *slave_dev; @@ -489,7 +483,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp return ret; } -static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp) +static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp) { equalizer_t *eql = dev->priv; slave_t *slave; @@ -501,6 +495,8 @@ static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp) return -EFAULT; slave_dev = dev_get_by_name(sc.slave_name); + if (!slave_dev) + return -ENODEV; ret = -EINVAL; @@ -522,7 +518,7 @@ static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp) return ret; } -static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp) +static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp) { slave_t *slave; equalizer_t *eql; @@ -533,11 +529,13 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp) if (copy_from_user(&sc, scp, sizeof (slave_config_t))) return -EFAULT; - eql = dev->priv; slave_dev = dev_get_by_name(sc.slave_name); + if (!slave_dev) + return -ENODEV; ret = -EINVAL; + eql = dev->priv; spin_lock_bh(&eql->queue.lock); if (eql_is_slave(slave_dev)) { slave = __eql_find_slave_dev(&eql->queue, slave_dev); @@ -553,7 +551,7 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp) return ret; } -static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp) +static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp) { equalizer_t *eql; master_config_t mc; @@ -569,7 +567,7 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp) return -EINVAL; } -static int eql_s_master_cfg(struct net_device *dev, master_config_t *mcp) +static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mcp) { equalizer_t *eql; master_config_t mc; diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c index ca21905b6..50d8aadbb 100644 --- a/drivers/net/es3210.c +++ b/drivers/net/es3210.c @@ -161,6 +161,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, ES_IO_EXTENT); } +#ifndef MODULE struct net_device * __init es_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -185,6 +186,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init es_probe1(struct net_device *dev, int ioaddr) { diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index 88b441f85..5a9ae260f 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c @@ -458,6 +458,7 @@ static int __init do_eth16i_probe(struct net_device *dev) return -ENODEV; } +#ifndef MODULE struct net_device * __init eth16i_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct eth16i_local)); @@ -483,6 +484,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init eth16i_probe1(struct net_device *dev, int ioaddr) { @@ -491,7 +493,7 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr) int retval; /* Let's grab the region */ - if (!request_region(ioaddr, ETH16I_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, ETH16I_IO_EXTENT, cardname)) return -EBUSY; /* @@ -538,9 +540,9 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr) /* Try to obtain interrupt vector */ - if ((retval = request_irq(dev->irq, (void *)ð16i_interrupt, 0, dev->name, dev))) { - printk(KERN_WARNING "%s: %s at %#3x, but is unusable due conflicting IRQ %d.\n", - dev->name, cardname, ioaddr, dev->irq); + if ((retval = request_irq(dev->irq, (void *)ð16i_interrupt, 0, cardname, dev))) { + printk(KERN_WARNING "%s at %#3x, but is unusable due to conflicting IRQ %d.\n", + cardname, ioaddr, dev->irq); goto out; } diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index 3bf22730e..d896baa2e 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c @@ -341,6 +341,7 @@ static int num_ewrks3s; mdelay(1);\ } +#ifndef MODULE struct net_device * __init ewrk3_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct ewrk3_private)); @@ -364,6 +365,7 @@ out: return ERR_PTR(err); } +#endif static int __init ewrk3_probe1(struct net_device *dev, u_long iobase, int irq) { @@ -1269,7 +1271,7 @@ static int __init isa_probe(struct net_device *dev, u_long ioaddr) for (; (i < maxSlots) && (dev != NULL); iobase += EWRK3_IOP_INC, i++) { - if (request_region(iobase, EWRK3_TOTAL_SIZE, dev->name)) { + if (request_region(iobase, EWRK3_TOTAL_SIZE, DRV_NAME)) { if (DevicePresent(iobase) == 0) { int irq = dev->irq; ret = ewrk3_hw_init(dev, iobase); @@ -1310,7 +1312,7 @@ static int __init eisa_probe(struct net_device *dev, u_long ioaddr) for (i = 1; (i < maxSlots) && (dev != NULL); i++, iobase += EISA_SLOT_INC) { if (EISA_signature(name, EISA_ID) == 0) { - if (request_region(iobase, EWRK3_TOTAL_SIZE, dev->name) && + if (request_region(iobase, EWRK3_TOTAL_SIZE, DRV_NAME) && DevicePresent(iobase) == 0) { int irq = dev->irq; ret = ewrk3_hw_init(dev, iobase); @@ -1518,13 +1520,13 @@ static int __init EISA_signature(char *name, s32 eisa_id) return status; /* return the device name string */ } -static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int ewrk3_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; u_long iobase = dev->base_addr; u32 ethcmd; - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -1707,7 +1709,7 @@ static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr) static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv; - struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_data; + struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_ifru; u_long iobase = dev->base_addr; int i, j, status = 0; u_char csr; @@ -1721,7 +1723,7 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) /* ethtool IOCTLs are handled elsewhere */ if (cmd == SIOCETHTOOL) - return ewrk3_ethtool_ioctl(dev, (void *)rq->ifr_data); + return ewrk3_ethtool_ioctl(dev, rq->ifr_data); /* Other than ethtool, all we handle are private IOCTLs */ if (cmd != EWRK3IOCTL) diff --git a/drivers/net/ewrk3.h b/drivers/net/ewrk3.h index 46ec00996..fb74bd053 100644 --- a/drivers/net/ewrk3.h +++ b/drivers/net/ewrk3.h @@ -296,7 +296,7 @@ struct ewrk3_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff --git a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c index ec3fff4e6..a5e12b2af 100644 --- a/drivers/net/fc/iph5526.c +++ b/drivers/net/fc/iph5526.c @@ -52,7 +52,7 @@ static const char *version = others + includes if_fcdevice.h */ #include "../../scsi/scsi.h" -#include "../../scsi/hosts.h" +#include #include "../../fc4/fcp.h" #include diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index b81777d75..9112ca037 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c @@ -858,12 +858,17 @@ static int netdev_open(struct net_device *dev) { struct netdev_private *np = dev->priv; long ioaddr = dev->base_addr; + int i; writel(0x00000001, ioaddr + BCR); /* Reset */ if (request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev)) return -EAGAIN; + for (i = 0; i < 3; i++) + writew(((unsigned short*)dev->dev_addr)[i], + ioaddr + PAR0 + i*2); + init_ring(dev); writel(np->rx_ring_dma, ioaddr + RXLBA); @@ -1923,14 +1928,13 @@ static struct ethtool_ops netdev_ethtool_ops = { static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); return rc; diff --git a/drivers/net/fmv18x.c b/drivers/net/fmv18x.c index 8bfb50fff..f0b6f9c9d 100644 --- a/drivers/net/fmv18x.c +++ b/drivers/net/fmv18x.c @@ -57,6 +57,8 @@ static const char version[] = #include #include +#define DRV_NAME "fmv18x" + static unsigned fmv18x_probe_list[] __initdata = { 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x300, 0x340, 0 }; @@ -192,7 +194,7 @@ static int __init fmv18x_probe1(struct net_device *dev, short ioaddr) That means we have to be careful with the register values we probe for. */ - if (!request_region(ioaddr, FMV18X_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, FMV18X_IO_EXTENT, DRV_NAME)) return -EBUSY; dev->irq = irq; @@ -224,7 +226,7 @@ static int __init fmv18x_probe1(struct net_device *dev, short ioaddr) } /* Snarf the interrupt vector now. */ - retval = request_irq(dev->irq, &net_interrupt, 0, dev->name, dev); + retval = request_irq(dev->irq, &net_interrupt, 0, DRV_NAME, dev); if (retval) { printk ("FMV-18x found at %#3x, but it's unusable due to a conflict on" "IRQ %d.\n", ioaddr, dev->irq); diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 73dcb6883..a3518e28b 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c @@ -81,6 +81,7 @@ * superfluous timer interrupts from the nic. */ #define FORCEDETH_VERSION "0.25" +#define DRV_NAME "forcedeth" #include #include @@ -556,7 +557,7 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev) return &np->stats; } -static int nv_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int nv_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct fe_priv *np = get_nvpriv(dev); u8 *base = get_hwbase(dev); @@ -634,7 +635,7 @@ static int nv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { switch(cmd) { case SIOCETHTOOL: - return nv_ethtool_ioctl(dev, (void *) rq->ifr_data); + return nv_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; @@ -1424,7 +1425,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i pci_set_master(pci_dev); - err = pci_request_regions(pci_dev, dev->name); + err = pci_request_regions(pci_dev, DRV_NAME); if (err < 0) goto out_disable; diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 2089b1a1e..f1ec80665 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c @@ -1869,7 +1869,7 @@ static void set_rx_mode(struct net_device *dev) } } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct hamachi_private *np = dev->priv; u32 ethcmd; @@ -1937,17 +1937,17 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct hamachi_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); int rc; if (!netif_running(dev)) return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else if (cmd == (SIOCDEVPRIVATE+3)) { /* set rx,tx intr params */ - u32 *d = (u32 *)&rq->ifr_data; + u32 *d = (u32 *)&rq->ifr_ifru; /* Should add this check here or an ordinary user can do nasty * things. -KDU * diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index d5b7fd96f..d5b7db1bd 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -1166,8 +1166,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) bc = netdev_priv(dev); if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd, (int *)ifr->ifr_data)) - return -EFAULT; if (copy_from_user(&hi, ifr->ifr_data, sizeof(hi))) return -EFAULT; diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c index 28e9da3db..4bd7c0965 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c @@ -414,7 +414,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -425,8 +424,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 2dc64f049..5c6257ee5 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c @@ -529,7 +529,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -540,8 +539,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index f288c9241..4aef97039 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c @@ -569,7 +569,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, { struct baycom_state *bc; struct baycom_ioctl bi; - int cmd2; if (!dev || !dev->priv || ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) { @@ -580,8 +579,6 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, if (cmd != SIOCDEVPRIVATE) return -ENOIOCTLCMD; - if (get_user(cmd2, (int *)ifr->ifr_data)) - return -EFAULT; switch (hi->cmd) { default: break; diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index fda187222..6b85ab3c9 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c @@ -331,7 +331,7 @@ static int bpq_set_mac_address(struct net_device *dev, void *addr) */ static int bpq_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct bpq_ethaddr *ethaddr = (struct bpq_ethaddr *)ifr->ifr_data; + struct bpq_ethaddr __user *ethaddr = ifr->ifr_data; struct bpqdev *bpq = dev->priv; struct bpq_req req; diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 0e6844fc3..f7fc3b9c0 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -1714,13 +1714,11 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) struct scc_mem_config memcfg; struct scc_hw_config hwcfg; struct scc_calibrate cal; - struct scc_channel *scc; + struct scc_channel *scc = (struct scc_channel *) dev->priv; int chan; unsigned char device_name[IFNAMSIZ]; - void *arg; + void __user *arg = ifr->ifr_data; - scc = (struct scc_channel *) dev->priv; - arg = (void *) ifr->ifr_data; if (!Driver_Initialized) { diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 0e60de808..70b58d2b6 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c @@ -37,6 +37,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "hp-plus" + /* A zero-terminated list of I/O addresses to be probed. */ static unsigned int hpplus_portlist[] __initdata = {0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340, 0}; @@ -142,6 +144,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); } +#ifndef MODULE struct net_device * __init hp_plus_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -166,6 +169,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif /* Do the interesting part of the probe at a single address. */ static int __init hpp_probe1(struct net_device *dev, int ioaddr) @@ -176,7 +180,7 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr) int mem_start; static unsigned version_printed; - if (!request_region(ioaddr, HP_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, HP_IO_EXTENT, DRV_NAME)) return -EBUSY; /* Check for the HP+ signature, 50 48 0x 53. */ diff --git a/drivers/net/hp.c b/drivers/net/hp.c index 2f48a7fc0..00358a927 100644 --- a/drivers/net/hp.c +++ b/drivers/net/hp.c @@ -37,6 +37,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "hp" + /* A zero-terminated list of I/O addresses to be probed. */ static unsigned int hppclan_portlist[] __initdata = { 0x300, 0x320, 0x340, 0x280, 0x2C0, 0x200, 0x240, 0}; @@ -106,6 +108,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT); } +#ifndef MODULE struct net_device * __init hp_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -130,6 +133,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init hp_probe1(struct net_device *dev, int ioaddr) { @@ -137,7 +141,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr) const char *name; static unsigned version_printed; - if (!request_region(ioaddr, HP_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, HP_IO_EXTENT, DRV_NAME)) return -EBUSY; /* Check for the HP physical address, 08 00 09 xx xx xx. */ @@ -182,7 +186,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr) outb_p(irqmap[irq] | HP_RUN, ioaddr + HP_CONFIGURE); outb_p( 0x00 | HP_RUN, ioaddr + HP_CONFIGURE); if (irq == probe_irq_off(cookie) /* It's a good IRQ line! */ - && request_irq (irq, ei_interrupt, 0, dev->name, dev) == 0) { + && request_irq (irq, ei_interrupt, 0, DRV_NAME, dev) == 0) { printk(" selecting IRQ %d.\n", irq); dev->irq = *irqp; break; @@ -197,7 +201,7 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr) } else { if (dev->irq == 2) dev->irq = 9; - if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { + if ((retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev))) { printk (" unable to get IRQ %d.\n", dev->irq); goto out; } diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index a845c1171..78ae4b2ac 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -386,6 +386,7 @@ static int __init hp100_isa_probe(struct net_device *dev, int addr) } +#ifndef MODULE struct net_device * __init hp100_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); @@ -420,6 +421,7 @@ struct net_device * __init hp100_probe(int unit) free_netdev(dev); return ERR_PTR(err); } +#endif static int __init hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev) diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 0bc7f8242..2ca3de076 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c @@ -1556,7 +1556,7 @@ static struct ethtool_ops emac_ethtool_ops = { static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct ocp_enet_private *fep = dev->priv; - uint *data = (uint *) & rq->ifr_data; + uint *data = (uint *) & rq->ifr_ifru; switch (cmd) { case SIOCGMIIPHY: diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index a0eaa80aa..0aa0a8261 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c @@ -98,6 +98,8 @@ History: #undef DEBUG +#define DRV_NAME "ibmlana" + /* ------------------------------------------------------------------------ * global static data - not more since we can handle multiple boards and * have to pack all state info into the device struct! @@ -952,8 +954,8 @@ static int ibmlana_probe(struct net_device *dev) printk(KERN_INFO "%s: IBM LAN Adapter/A found in slot %d\n", dev->name, slot + 1); /* try to obtain I/O range */ - if (!request_region(iobase, IBM_LANA_IORANGE, dev->name)) { - printk(KERN_ERR "%s: cannot allocate I/O range at %#x!\n", dev->name, iobase); + if (!request_region(iobase, IBM_LANA_IORANGE, DRV_NAME)) { + printk(KERN_ERR "%s: cannot allocate I/O range at %#x!\n", DRV_NAME, iobase); startslot = slot + 1; return -EBUSY; } diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 4e4e87678..5fa162f6c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c @@ -901,7 +901,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ adapter = netdev->priv; memset(adapter, 0, sizeof(adapter)); - dev->driver_data = netdev; + dev->dev.driver_data = netdev; adapter->vdev = dev; adapter->netdev = netdev; @@ -971,7 +971,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ static int __devexit ibmveth_remove(struct vio_dev *dev) { - struct net_device *netdev = dev->driver_data; + struct net_device *netdev = dev->dev.driver_data; struct ibmveth_adapter *adapter = netdev->priv; unregister_netdev(netdev); diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 654fd6907..a93cda669 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -1529,12 +1529,11 @@ static struct ethtool_ops ioc3_ethtool_ops = { static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; struct ioc3_private *ip = netdev_priv(dev); int rc; spin_lock_irq(&ip->ioc3_lock); - rc = generic_mii_ioctl(&ip->mii, data, cmd, NULL); + rc = generic_mii_ioctl(&ip->mii, if_mii(rq), cmd, NULL); spin_unlock_irq(&ip->ioc3_lock); return rc; diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index ad4ab63b4..6a10d9643 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -304,16 +305,18 @@ static int ali_ircc_open(int i, chipio_t *info) self->tx_buff.truesize = 14384; /* Allocate memory if needed */ - self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, - GFP_KERNEL |GFP_DMA); + self->rx_buff.head = + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; goto err_out2; } memset(self->rx_buff.head, 0, self->rx_buff.truesize); - self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->tx_buff.head = + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; goto err_out3; @@ -362,9 +365,11 @@ static int ali_ircc_open(int i, chipio_t *info) return 0; err_out4: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); err_out3: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); err_out2: release_region(self->io.fir_base, self->io.fir_ext); err_out1: @@ -398,10 +403,12 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self) release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; free_netdev(self->netdev); @@ -1572,7 +1579,8 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self) self->io.direction = IO_XMIT; irda_setup_dma(self->io.dma, - self->tx_fifo.queue[self->tx_fifo.ptr].start, + ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start - + self->tx_buff.head) + self->tx_buff_dma, self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); @@ -1724,8 +1732,8 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self) self->st_fifo.len = self->st_fifo.pending_bytes = 0; self->st_fifo.tail = self->st_fifo.head = 0; - irda_setup_dma(self->io.dma, self->rx_buff.data, - self->rx_buff.truesize, DMA_RX_MODE); + irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, + DMA_RX_MODE); /* Set Receive Mode,Brick Wall */ //switch_bank(iobase, BANK0); diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h index dc5edd12b..e489c6661 100644 --- a/drivers/net/irda/ali-ircc.h +++ b/drivers/net/irda/ali-ircc.h @@ -26,6 +26,7 @@ #include #include +#include #include /* SIR Register */ @@ -198,6 +199,8 @@ struct ali_ircc_cb { chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ + dma_addr_t tx_buff_dma; + dma_addr_t rx_buff_dma; __u8 ier; /* Interrupt enable register */ diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 035da952e..b924ff1c0 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c @@ -438,7 +438,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c struct irtty_info { char name[6]; } info; struct sir_dev *dev; struct sirtty_cb *priv = tty->disc_data; - int size = _IOC_SIZE(cmd); int err = 0; ASSERT(priv != NULL, return -ENODEV;); @@ -449,13 +448,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c dev = priv->dev; ASSERT(dev != NULL, return -1;); - if (_IOC_DIR(cmd) & _IOC_READ) - err = verify_area(VERIFY_WRITE, (void *) arg, size); - else if (_IOC_DIR(cmd) & _IOC_WRITE) - err = verify_area(VERIFY_READ, (void *) arg, size); - if (err) - return err; - switch (cmd) { case TCGETS: case TCGETA: @@ -473,7 +465,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c memset(&info, 0, sizeof(info)); strncpy(info.name, dev->netdev->name, sizeof(info.name)-1); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) err = -EFAULT; break; default: diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index 2248e661f..c1e79f516 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -307,8 +308,9 @@ static int __init nsc_ircc_open(int i, chipio_t *info) self->tx_buff.truesize = 14384; /* Allocate memory if needed */ - self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->rx_buff.head = + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; goto out2; @@ -316,8 +318,9 @@ static int __init nsc_ircc_open(int i, chipio_t *info) } memset(self->rx_buff.head, 0, self->rx_buff.truesize); - self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->tx_buff.head = + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; goto out3; @@ -368,9 +371,11 @@ static int __init nsc_ircc_open(int i, chipio_t *info) return 0; out4: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); out3: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); out2: release_region(self->io.fir_base, self->io.fir_ext); out1: @@ -404,10 +409,12 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self) release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; free_netdev(self->netdev); @@ -1409,7 +1416,8 @@ static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase) outb(ECR1_DMASWP|ECR1_DMANF|ECR1_EXT_SL, iobase+ECR1); irda_setup_dma(self->io.dma, - self->tx_fifo.queue[self->tx_fifo.ptr].start, + ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start - + self->tx_buff.head) + self->tx_buff_dma, self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); @@ -1566,8 +1574,8 @@ static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self) self->st_fifo.len = self->st_fifo.pending_bytes = 0; self->st_fifo.tail = self->st_fifo.head = 0; - irda_setup_dma(self->io.dma, self->rx_buff.data, - self->rx_buff.truesize, DMA_RX_MODE); + irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, + DMA_RX_MODE); /* Enable DMA */ switch_bank(iobase, BANK0); diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h index 0f541aa71..6edf7e514 100644 --- a/drivers/net/irda/nsc-ircc.h +++ b/drivers/net/irda/nsc-ircc.h @@ -32,6 +32,7 @@ #include #include +#include #include /* DMA modes needed */ @@ -255,6 +256,8 @@ struct nsc_ircc_cb { chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ + dma_addr_t tx_buff_dma; + dma_addr_t rx_buff_dma; __u8 ier; /* Interrupt enable register */ diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index e360323c2..fc3580ae1 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -112,6 +113,8 @@ struct smsc_ircc_cb { chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ + dma_addr_t tx_buff_dma; + dma_addr_t rx_buff_dma; struct qos_info qos; /* QoS capabilities for this device */ @@ -413,16 +416,18 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u self->rx_buff.truesize = SMSC_IRCC2_RX_BUFF_TRUESIZE; self->tx_buff.truesize = SMSC_IRCC2_TX_BUFF_TRUESIZE; - self->rx_buff.head = (u8 *) kmalloc(self->rx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->rx_buff.head = + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { ERROR("%s, Can't allocate memory for receive buffer!\n", driver_name); goto err_out2; } - self->tx_buff.head = (u8 *) kmalloc(self->tx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->tx_buff.head = + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { ERROR("%s, Can't allocate memory for transmit buffer!\n", driver_name); @@ -464,9 +469,11 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u return 0; err_out4: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); err_out3: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); err_out2: free_netdev(self->netdev); dev_self[--dev_count] = NULL; @@ -1159,7 +1166,7 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs) IRCC_CFGB_DMA_BURST, iobase+IRCC_SCE_CFGB); /* Setup DMA controller (must be done after enabling chip DMA) */ - irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, + irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len, DMA_TX_MODE); /* Enable interrupt */ @@ -1249,8 +1256,8 @@ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase) outb(2050 & 0xff, iobase+IRCC_RX_SIZE_LO); /* Setup DMA controller */ - irda_setup_dma(self->io.dma, self->rx_buff.data, - self->rx_buff.truesize, DMA_RX_MODE); + irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, + DMA_RX_MODE); /* Enable burst mode chip Rx DMA */ register_bank(iobase, 1); @@ -1717,10 +1724,12 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) release_region(self->io.sir_base, self->io.sir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); free_netdev(self->netdev); diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 95b9c3251..4d1000efe 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c @@ -39,6 +39,7 @@ F02 Oct/28/02: Add SB device ID for 3147 and 3177. #include #include #include +#include #include #include @@ -383,7 +384,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) /* Allocate memory if needed */ self->rx_buff.head = - (__u8 *) kmalloc(self->rx_buff.truesize, GFP_KERNEL | GFP_DMA); + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; goto err_out2; @@ -391,7 +393,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) memset(self->rx_buff.head, 0, self->rx_buff.truesize); self->tx_buff.head = - (__u8 *) kmalloc(self->tx_buff.truesize, GFP_KERNEL | GFP_DMA); + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; goto err_out3; @@ -432,9 +435,11 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) return 0; err_out4: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); err_out3: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); err_out2: release_region(self->io.fir_base, self->io.fir_ext); err_out1: @@ -468,9 +473,11 @@ static int __exit via_ircc_close(struct via_ircc_cb *self) __FUNCTION__, self->io.fir_base); release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); dev_self[self->index] = NULL; free_netdev(self->netdev); @@ -816,7 +823,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb, EnTXDMA(iobase, ON); EnRXDMA(iobase, OFF); - irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, + irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len, DMA_TX_MODE); SetSendByte(iobase, self->tx_buff.len); @@ -897,7 +904,8 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase) EnTXDMA(iobase, ON); EnRXDMA(iobase, OFF); irda_setup_dma(self->io.dma, - self->tx_fifo.queue[self->tx_fifo.ptr].start, + ((u8 *)self->tx_fifo.queue[self->tx_fifo.ptr].start - + self->tx_buff.head) + self->tx_buff_dma, self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); #ifdef DBGMSG DBG(printk @@ -1022,8 +1030,8 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self) EnAllInt(iobase, ON); EnTXDMA(iobase, OFF); EnRXDMA(iobase, ON); - irda_setup_dma(self->io.dma2, self->rx_buff.data, - self->rx_buff.truesize, DMA_RX_MODE); + irda_setup_dma(self->io.dma2, self->rx_buff_dma, + self->rx_buff.truesize, DMA_RX_MODE); TXStart(iobase, OFF); RXStart(iobase, ON); diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h index c3568b6c2..dcb5c3d33 100644 --- a/drivers/net/irda/via-ircc.h +++ b/drivers/net/irda/via-ircc.h @@ -33,6 +33,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include #define MAX_TX_WINDOW 7 @@ -102,6 +103,8 @@ struct via_ircc_cb { chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ + dma_addr_t tx_buff_dma; + dma_addr_t rx_buff_dma; __u8 ier; /* Interrupt enable register */ diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 1d4382b3f..64d8d3fc9 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -207,8 +208,9 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, self->tx_buff.truesize = 4000; /* Allocate memory if needed */ - self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->rx_buff.head = + dma_alloc_coherent(NULL, self->rx_buff.truesize, + &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) { err = -ENOMEM; goto err_out1; @@ -216,8 +218,9 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, memset(self->rx_buff.head, 0, self->rx_buff.truesize); - self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, - GFP_KERNEL|GFP_DMA); + self->tx_buff.head = + dma_alloc_coherent(NULL, self->tx_buff.truesize, + &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) { err = -ENOMEM; goto err_out2; @@ -252,9 +255,11 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, return 0; err_out3: - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); err_out2: - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); err_out1: free_netdev(dev); err_out: @@ -297,10 +302,12 @@ static int w83977af_close(struct w83977af_ir *self) release_region(self->io.fir_base, self->io.fir_ext); if (self->tx_buff.head) - kfree(self->tx_buff.head); + dma_free_coherent(NULL, self->tx_buff.truesize, + self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) - kfree(self->rx_buff.head); + dma_free_coherent(NULL, self->rx_buff.truesize, + self->rx_buff.head, self->rx_buff_dma); free_netdev(self->netdev); @@ -606,10 +613,10 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase) disable_dma(self->io.dma); clear_dma_ff(self->io.dma); set_dma_mode(self->io.dma, DMA_MODE_READ); - set_dma_addr(self->io.dma, isa_virt_to_bus(self->tx_buff.data)); + set_dma_addr(self->io.dma, self->tx_buff_dma); set_dma_count(self->io.dma, self->tx_buff.len); #else - irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, + irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len, DMA_MODE_WRITE); #endif self->io.direction = IO_XMIT; @@ -763,10 +770,10 @@ int w83977af_dma_receive(struct w83977af_ir *self) disable_dma(self->io.dma); clear_dma_ff(self->io.dma); set_dma_mode(self->io.dma, DMA_MODE_READ); - set_dma_addr(self->io.dma, isa_virt_to_bus(self->rx_buff.data)); + set_dma_addr(self->io.dma, self->rx_buff_dma); set_dma_count(self->io.dma, self->rx_buff.truesize); #else - irda_setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, + irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, DMA_MODE_READ); #endif /* diff --git a/drivers/net/irda/w83977af_ir.h b/drivers/net/irda/w83977af_ir.h index c578ddc1a..0b7661dea 100644 --- a/drivers/net/irda/w83977af_ir.h +++ b/drivers/net/irda/w83977af_ir.h @@ -26,6 +26,7 @@ #define W83977AF_IR_H #include +#include /* Flags for configuration register CRF0 */ #define ENBNKSEL 0x01 @@ -179,6 +180,8 @@ struct w83977af_ir { chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ + dma_addr_t tx_buff_dma; + dma_addr_t rx_buff_dma; /* Note : currently locking is *very* incomplete, but this * will get you started. Check in nsc-ircc.c for a proper diff --git a/drivers/net/isa-skeleton.c b/drivers/net/isa-skeleton.c index 8df84e9bb..650943395 100644 --- a/drivers/net/isa-skeleton.c +++ b/drivers/net/isa-skeleton.c @@ -161,6 +161,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, NETCARD_IO_EXTENT); } +#ifndef MODULE struct net_device * __init netcard_probe(int unit) { struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); @@ -185,6 +186,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif /* * This is the real probe routine. Linux has a history of friendly device diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c index 7bd6fe2ce..605a6873e 100644 --- a/drivers/net/ixgb/ixgb_ethtool.c +++ b/drivers/net/ixgb/ixgb_ethtool.c @@ -362,7 +362,7 @@ ixgb_ethtool_geeprom(struct ixgb_adapter *adapter, static int ixgb_ethtool_seeprom(struct ixgb_adapter *adapter, - struct ethtool_eeprom *eeprom, void *user_data) + struct ethtool_eeprom *eeprom, void __user *user_data) { struct ixgb_hw *hw = &adapter->hw; uint16_t eeprom_buff[256]; @@ -457,10 +457,10 @@ ixgb_ethtool_led_blink(struct ixgb_adapter *adapter, struct ethtool_value *id) int ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) { struct ixgb_adapter *adapter = netdev->priv; - void *addr = ifr->ifr_data; + void __user *addr = ifr->ifr_data; uint32_t cmd; - if (get_user(cmd, (uint32_t *) addr)) + if (get_user(cmd, (uint32_t __user *) addr)) return -EFAULT; switch (cmd) { diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 0bd434898..f28ab3346 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -1876,7 +1876,6 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) struct ixgb_rx_desc *rx_desc; struct ixgb_buffer *buffer_info; struct sk_buff *skb; - int reserve_len = 2; unsigned int i; int num_group_tail_writes; long cleancount; @@ -1895,7 +1894,7 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) while (--cleancount > 0) { rx_desc = IXGB_RX_DESC(*rx_ring, i); - skb = dev_alloc_skb(adapter->rx_buffer_len + reserve_len); + skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN); if (unlikely(!skb)) { /* Better luck next round */ @@ -1906,7 +1905,7 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) * this will result in a 16 byte aligned IP header after * the 14 byte MAC header is removed */ - skb_reserve(skb, reserve_len); + skb_reserve(skb, NET_IP_ALIGN); skb->dev = netdev; diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 20f757c46..8624bfc49 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c @@ -37,6 +37,8 @@ #include #include +#define DRV_NAME "jazzsonic" + #define SREGS_PAD(n) u16 n; #include "sonic.h" @@ -151,7 +153,7 @@ static int __init sonic_probe1(struct net_device *dev, unsigned int base_addr, int err = -ENODEV; int i; - if (!request_region(base_addr, 0x100, dev->name)) + if (!request_region(base_addr, 0x100, DRV_NAME)) return -EBUSY; /* * get the Silicon Revision ID. If this is one of the known diff --git a/drivers/net/lance.c b/drivers/net/lance.c index a39f7a7fc..25c7aa442 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c @@ -432,6 +432,7 @@ static int __init do_lance_probe(struct net_device *dev) return -ENODEV; } +#ifndef MODULE struct net_device * __init lance_probe(int unit) { struct net_device *dev = alloc_etherdev(0); @@ -456,6 +457,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int options) { diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index 46483262f..9e83a01cf 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c @@ -87,7 +87,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 4a21b1cd3..0aa574b10 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c @@ -49,6 +49,8 @@ static const char *version = #include "8390.h" +#define DRV_NAME "lne390" + static int lne390_probe1(struct net_device *dev, int ioaddr); static int lne390_open(struct net_device *dev); @@ -112,7 +114,7 @@ static int __init do_lne390_probe(struct net_device *dev) SET_MODULE_OWNER(dev); if (ioaddr > 0x1ff) { /* Check a single specified location. */ - if (!request_region(ioaddr, LNE390_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, LNE390_IO_EXTENT, DRV_NAME)) return -EBUSY; ret = lne390_probe1(dev, ioaddr); if (ret) @@ -131,7 +133,7 @@ static int __init do_lne390_probe(struct net_device *dev) /* EISA spec allows for up to 16 slots, but 8 is typical. */ for (ioaddr = 0x1000; ioaddr < 0x9000; ioaddr += 0x1000) { - if (!request_region(ioaddr, LNE390_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, LNE390_IO_EXTENT, DRV_NAME)) continue; if (lne390_probe1(dev, ioaddr) == 0) return 0; @@ -151,6 +153,7 @@ static void cleanup_card(struct net_device *dev) iounmap((void *)dev->mem_start); } +#ifndef MODULE struct net_device * __init lne390_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -175,6 +178,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init lne390_probe1(struct net_device *dev, int ioaddr) { @@ -228,7 +232,7 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr) } printk(" IRQ %d,", dev->irq); - if ((ret = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { + if ((ret = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev))) { printk (" unable to get IRQ %d.\n", dev->irq); return ret; } diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index 7dda5dd05..38281f546 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c @@ -75,6 +75,8 @@ All other communication is through memory! #include #include +#define DRV_NAME "lp486e" + /* debug print flags */ #define LOG_SRCDST 0x80000000 #define LOG_STATINT 0x40000000 @@ -970,7 +972,7 @@ int __init lp486e_probe(struct net_device *dev) { return -ENODEV; probed++; - if (!request_region(IOADDR, LP486E_TOTAL_SIZE, dev->name)) { + if (!request_region(IOADDR, LP486E_TOTAL_SIZE, DRV_NAME)) { printk(KERN_ERR "lp486e: IO address 0x%x in use\n", IOADDR); return -EBUSY; } diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 73b1bbe38..f597572be 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c @@ -53,7 +53,6 @@ #include #include #include -#include #define SREGS_PAD(n) u16 n; diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 9bae8d9ab..e81ac44e7 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -766,7 +766,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); - i = pci_request_regions(pdev, dev->name); + i = pci_request_regions(pdev, DRV_NAME); if (i) goto err_pci_request_regions; @@ -1798,14 +1798,9 @@ static void netdev_rx(struct net_device *dev) np->rx_dma[entry], buflen, PCI_DMA_FROMDEVICE); -#if HAS_IP_COPYSUM eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); skb_put(skb, pkt_len); -#else - memcpy(skb_put(skb, pkt_len), - np->rx_skbuff[entry]->tail, pkt_len); -#endif pci_dma_sync_single_for_device(np->pci_dev, np->rx_dma[entry], buflen, @@ -1961,12 +1956,12 @@ static void set_rx_mode(struct net_device *dev) spin_unlock_irq(&np->lock); } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 cmd; - if (get_user(cmd, (u32 *)useraddr)) + if (get_user(cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -2417,11 +2412,11 @@ static int netdev_get_eeprom(struct net_device *dev, u8 *buf) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ case SIOCDEVPRIVATE: /* for binary compat, remove in 2.5 */ data->phy_id = 1; diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c index 86f34b5ec..84e291e24 100644 --- a/drivers/net/ne-h8300.c +++ b/drivers/net/ne-h8300.c @@ -34,6 +34,8 @@ static const char version1[] = #include "8390.h" +#define DRV_NAME "ne-h8300" + /* Some defines that people can play with if so inclined. */ /* Do we perform extra sanity checks on stuff ? */ @@ -156,6 +158,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, NE_IO_EXTENT); } +#ifndef MODULE struct net_device * __init ne_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -187,6 +190,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init ne_probe1(struct net_device *dev, int ioaddr) { @@ -200,7 +204,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); unsigned char bus_width; - if (!request_region(ioaddr, NE_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, NE_IO_EXTENT, DRV_NAME)) return -EBUSY; reg0 = inb_p(ioaddr); diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 9de5cccf5..ee9d4dd89 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c @@ -55,6 +55,8 @@ static const char version2[] = #include "8390.h" +#define DRV_NAME "ne" + /* Some defines that people can play with if so inclined. */ /* Do we support clones that don't adhere to 14,15 of the SAprom ? */ @@ -203,6 +205,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, NE_IO_EXTENT); } +#ifndef MODULE struct net_device * __init ne_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -227,6 +230,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init ne_probe_isapnp(struct net_device *dev) { @@ -284,7 +288,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) int reg0, ret; static unsigned version_printed; - if (!request_region(ioaddr, NE_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, NE_IO_EXTENT, DRV_NAME)) return -EBUSY; reg0 = inb_p(ioaddr); diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index 739f92ab1..311471ab6 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c @@ -82,6 +82,8 @@ static const char *version = "ne2.c:v0.91 Nov 16 1998 Wim Dumon base_addr, NE_IO_EXTENT); } +#ifndef MODULE struct net_device * __init ne2_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -308,6 +311,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int ne2_procinfo(char *buf, int slot, struct net_device *dev) { @@ -368,7 +372,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) irq = irqs[(POS & 0x60)>>5]; } - if (!request_region(base_addr, NE_IO_EXTENT, dev->name)) + if (!request_region(base_addr, NE_IO_EXTENT, DRV_NAME)) return -EBUSY; #ifdef DEBUG @@ -470,7 +474,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) /* Snarf the interrupt now. There's no point in waiting since we cannot share and the board will usually be enabled. */ - retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev); + retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (retval) { printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq, retval); diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c index ec77fcad2..7228ba29a 100644 --- a/drivers/net/ne3210.c +++ b/drivers/net/ne3210.c @@ -45,6 +45,8 @@ static const char *version = #include "8390.h" +#define DRV_NAME "ne3210" + static int ne3210_open(struct net_device *dev); static int ne3210_close(struct net_device *dev); @@ -111,13 +113,13 @@ static int __init ne3210_eisa_probe (struct device *device) device->driver_data = dev; ioaddr = edev->base_addr; - if (!request_region(ioaddr, NE3210_IO_EXTENT, dev->name)) { + if (!request_region(ioaddr, NE3210_IO_EXTENT, DRV_NAME)) { retval = -EBUSY; goto out; } if (!request_region(ioaddr + NE3210_CFG1, - NE3210_CFG_EXTENT, dev->name)) { + NE3210_CFG_EXTENT, DRV_NAME)) { retval = -EBUSY; goto out1; } @@ -140,7 +142,7 @@ static int __init ne3210_eisa_probe (struct device *device) dev->irq = irq_map[(inb(ioaddr + NE3210_CFG2) >> 3) & 0x07]; printk(".\nne3210.c: using IRQ %d, ", dev->irq); - retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev); + retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (retval) { printk (" unable to get IRQ %d.\n", dev->irq); goto out2; @@ -163,7 +165,7 @@ static int __init ne3210_eisa_probe (struct device *device) } } - if (!request_mem_region (phys_mem, NE3210_STOP_PG*0x100, dev->name)) { + if (!request_mem_region (phys_mem, NE3210_STOP_PG*0x100, DRV_NAME)) { printk ("ne3210.c: Unable to request shared memory at physical address %#lx\n", phys_mem); goto out3; diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index 714d9705b..234709ded 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c @@ -124,6 +124,8 @@ static int fifo=0x8; /* don't change */ #include "ni52.h" +#define DRV_NAME "ni52" + #define DEBUG /* debug on */ #define SYSBUSVAL 1 /* 8 Bit */ @@ -424,7 +426,7 @@ static int __init ni52_probe1(struct net_device *dev,int ioaddr) dev->mem_start = memstart; dev->mem_end = memend; - if (!request_region(ioaddr, NI52_TOTAL_SIZE, dev->name)) + if (!request_region(ioaddr, NI52_TOTAL_SIZE, DRV_NAME)) return -EBUSY; if( !(inb(ioaddr+NI52_MAGIC1) == NI52_MAGICVAL1) || diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 41fc5f9df..1ee8c495a 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -113,6 +113,8 @@ #include #include +#define DRV_NAME "ns83820" + /* Global parameters. See MODULE_PARM near the bottom. */ static int ihr = 2; static int reset_phy = 0; @@ -1190,7 +1192,7 @@ static struct net_device_stats *ns83820_get_stats(struct net_device *ndev) return &dev->stats; } -static int ns83820_ethtool_ioctl (struct ns83820 *dev, void *useraddr) +static int ns83820_ethtool_ioctl (struct ns83820 *dev, void __user *useraddr) { u32 ethcmd; @@ -1236,7 +1238,7 @@ static int ns83820_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) switch(cmd) { case SIOCETHTOOL: - return ns83820_ethtool_ioctl(dev, (void *) rq->ifr_data); + return ns83820_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; @@ -1851,7 +1853,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ 0); err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, - ndev->name, ndev); + DRV_NAME, ndev); if (err) { printk(KERN_INFO "ns83820: unable to register irq %d\n", pci_dev->irq); diff --git a/drivers/net/oaknet.c b/drivers/net/oaknet.c index c241b7a3c..62167a29d 100644 --- a/drivers/net/oaknet.c +++ b/drivers/net/oaknet.c @@ -164,7 +164,7 @@ static int __init oaknet_init(void) ret = -EAGAIN; if (request_irq(dev->irq, ei_interrupt, 0, name, dev)) { printk("%s: unable to request interrupt %d.\n", - dev->name, dev->irq); + name, dev->irq); goto out_region; } diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 28d8b5342..238538660 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c @@ -1778,7 +1778,7 @@ static int netdrv_close (struct net_device *dev) static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { struct netdrv_private *tp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); unsigned long flags; int rc = 0; diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 47a102fd6..59d80ebbe 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -1196,7 +1196,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct el3_private *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; int phy = lp->phys & 0x1f; DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 9a46c5626..ea5a88cf7 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -778,7 +778,7 @@ static struct ethtool_ops netdev_ethtool_ops = { static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { axnet_dev_t *info = PRIV(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP; switch (cmd) { case SIOCGMIIPHY: diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index d073093dd..b53f5fcf5 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -1281,7 +1281,7 @@ static struct ethtool_ops netdev_ethtool_ops = { static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { pcnet_dev_t *info = PRIV(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO; switch (cmd) { case SIOCGMIIPHY: diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 13ed04f1b..7c1bd346e 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -2119,12 +2119,12 @@ static int smc_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) return 0; } -static int smc_ethtool_ioctl (struct net_device *dev, void *useraddr) +static int smc_ethtool_ioctl (struct net_device *dev, void __user *useraddr) { u32 ethcmd; struct smc_private *smc = netdev_priv(dev); - if (get_user(ethcmd, (u32 *)useraddr)) + if (get_user(ethcmd, (u32 __user *)useraddr)) return -EFAULT; switch (ethcmd) { @@ -2221,7 +2221,7 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) u_short saved_bank; ioaddr_t ioaddr = dev->base_addr; - mii = (struct mii_ioctl_data *) &rq->ifr_data; + mii = if_mii(rq); if (!netif_running(dev)) return -EINVAL; @@ -2229,7 +2229,7 @@ static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) case SIOCETHTOOL: saved_bank = inw(ioaddr + BANK_SELECT); SMC_SELECT_BANK(3); - rc = smc_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = smc_ethtool_ioctl(dev, rq->ifr_data); SMC_SELECT_BANK(saved_bank); break; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 5671f1234..d4cc26902 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -1681,7 +1681,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", dev->name, rq->ifr_ifrn.ifrn_name, cmd, diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 511bc109b..bdf90d4e6 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -2170,14 +2170,13 @@ static void mdio_write(struct net_device *dev, int phy_id, int reg_num, int val) static int pcnet32_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct pcnet32_private *lp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; int rc; unsigned long flags; /* SIOC[GS]MIIxxx ioctls */ if (lp->mii) { spin_lock_irqsave(&lp->lock, flags); - rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&lp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irqrestore(&lp->lock, flags); } else { rc = -EOPNOTSUPP; diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 31bbff4f0..43f923c96 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c @@ -1217,7 +1217,7 @@ static int plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct net_local *nl = netdev_priv(dev); - struct plipconf *pc = (struct plipconf *) &rq->ifr_data; + struct plipconf *pc = (struct plipconf *) &rq->ifr_ifru; if (cmd != SIOCDEVPLIP) return -EOPNOTSUPP; diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 0e270770c..e686cb440 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -716,7 +716,7 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, goto err_out_disable; } - rc = pci_request_regions(pdev, dev->name); + rc = pci_request_regions(pdev, MODULENAME); if (rc) { printk(KERN_ERR PFX "%s: Could not request regions.\n", pdev->slot_name); goto err_out_disable; diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index a6d09dd83..d77314518 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c @@ -1715,7 +1715,7 @@ static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return error; case SIOCRRID: - return put_user(0x52523032, (int *)(&rq->ifr_data[0])); + return put_user(0x52523032, (int __user *)rq->ifr_data); default: return error; } diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 83a53bc83..c4bd1793f 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -99,45 +99,45 @@ static char s2io_gstrings[][ETH_GSTRING_LEN] = { }; static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { - {"tmac_frms"}, - {"tmac_data_octets"}, - {"tmac_drop_frms"}, - {"tmac_mcst_frms"}, - {"tmac_bcst_frms"}, - {"tmac_pause_ctrl_frms"}, - {"tmac_any_err_frms"}, - {"tmac_vld_ip_octets"}, - {"tmac_vld_ip"}, - {"tmac_drop_ip"}, - {"tmac_icmp"}, - {"tmac_rst_tcp"}, - {"tmac_tcp"}, - {"tmac_udp"}, - {"rmac_vld_frms"}, - {"rmac_data_octets"}, - {"rmac_fcs_err_frms"}, - {"rmac_drop_frms"}, - {"rmac_vld_mcst_frms"}, - {"rmac_vld_bcst_frms"}, - {"rmac_in_rng_len_err_frms"}, - {"rmac_long_frms"}, - {"rmac_pause_ctrl_frms"}, - {"rmac_discarded_frms"}, - {"rmac_usized_frms"}, - {"rmac_osized_frms"}, - {"rmac_frag_frms"}, - {"rmac_jabber_frms"}, - {"rmac_ip"}, - {"rmac_ip_octets"}, - {"rmac_hdr_err_ip"}, - {"rmac_drop_ip"}, - {"rmac_icmp"}, - {"rmac_tcp"}, - {"rmac_udp"}, - {"rmac_err_drp_udp"}, - {"rmac_pause_cnt"}, - {"rmac_accepted_ip"}, - {"rmac_err_tcp"}, + "tmac_frms", + "tmac_data_octets", + "tmac_drop_frms", + "tmac_mcst_frms", + "tmac_bcst_frms", + "tmac_pause_ctrl_frms", + "tmac_any_err_frms", + "tmac_vld_ip_octets", + "tmac_vld_ip", + "tmac_drop_ip", + "tmac_icmp", + "tmac_rst_tcp", + "tmac_tcp", + "tmac_udp", + "rmac_vld_frms", + "rmac_data_octets", + "rmac_fcs_err_frms", + "rmac_drop_frms", + "rmac_vld_mcst_frms", + "rmac_vld_bcst_frms", + "rmac_in_rng_len_err_frms", + "rmac_long_frms", + "rmac_pause_ctrl_frms", + "rmac_discarded_frms", + "rmac_usized_frms", + "rmac_osized_frms", + "rmac_frag_frms", + "rmac_jabber_frms", + "rmac_ip", + "rmac_ip_octets", + "rmac_hdr_err_ip", + "rmac_drop_ip", + "rmac_icmp", + "rmac_tcp", + "rmac_udp", + "rmac_err_drp_udp", + "rmac_pause_cnt", + "rmac_accepted_ip", + "rmac_err_tcp", }; #define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN @@ -1425,13 +1425,13 @@ int fill_rx_buffers(struct s2io_nic *nic, int ring_no) goto end; } - skb = dev_alloc_skb(size + HEADER_ALIGN_LAYER_3); + skb = dev_alloc_skb(size + NET_IP_ALIGN); if (!skb) { DBG_PRINT(ERR_DBG, "%s: Out of ", dev->name); DBG_PRINT(ERR_DBG, "memory to allocate SKBs\n"); return -ENOMEM; } - skb_reserve(skb, HEADER_ALIGN_LAYER_3); + skb_reserve(skb, NET_IP_ALIGN); memset(rxdp, 0, sizeof(RxD_t)); rxdp->Buffer0_ptr = pci_map_single (nic->pdev, skb->data, size, PCI_DMA_FROMDEVICE); diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 41cb60f55..e9a166450 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h @@ -411,7 +411,6 @@ struct config_param { #define HEADER_802_2_SIZE 3 #define HEADER_SNAP_SIZE 5 #define HEADER_VLAN_SIZE 4 -#define HEADER_ALIGN_LAYER_3 2 #define MIN_MTU 46 #define MAX_PYLD 1500 diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c index ea2d89155..8ac2d8109 100644 --- a/drivers/net/sb1000.c +++ b/drivers/net/sb1000.c @@ -1031,14 +1031,14 @@ static int sb1000_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) case SIOCGCMFREQUENCY: /* get frequency */ if ((status = sb1000_get_frequency(ioaddr, name, &frequency))) return status; - if(put_user(frequency, (int*) ifr->ifr_data)) + if(put_user(frequency, (int __user *) ifr->ifr_data)) return -EFAULT; break; case SIOCSCMFREQUENCY: /* set frequency */ if (!capable(CAP_NET_ADMIN)) return -EPERM; - if(get_user(frequency, (int*) ifr->ifr_data)) + if(get_user(frequency, (int __user *) ifr->ifr_data)) return -EFAULT; if ((status = sb1000_set_frequency(ioaddr, name, frequency))) return status; diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 0b15d6513..7914167ac 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c @@ -2721,7 +2721,7 @@ static void sbmac_set_rx_mode(struct net_device *dev) static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct sbmac_softc *sc = netdev_priv(dev); - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; unsigned long flags; int retval; diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index 9352fc63c..2351e186a 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c @@ -579,7 +579,7 @@ static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net static int shaper_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_data; + struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru; struct shaper *sh=dev->priv; if(ss->ss_cmd == SHAPER_SET_DEV || ss->ss_cmd == SHAPER_SET_SPEED) diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 05479dd80..aa045b62c 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c @@ -1893,7 +1893,7 @@ static struct ethtool_ops sis900_ethtool_ops = { static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) { struct sis900_private *sis_priv = net_dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff --git a/drivers/net/slip.c b/drivers/net/slip.c index e783ac0fa..a8967112f 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -1138,6 +1138,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm { struct slip *sl = (struct slip *) tty->disc_data; unsigned int tmp; + int __user *p = (int __user *)arg; /* First make sure we're connected. */ if (!sl || sl->magic != SLIP_MAGIC) { @@ -1147,17 +1148,17 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm switch(cmd) { case SIOCGIFNAME: tmp = strlen(sl->dev->name) + 1; - if (copy_to_user((void *)arg, sl->dev->name, tmp)) + if (copy_to_user((void __user *)arg, sl->dev->name, tmp)) return -EFAULT; return 0; case SIOCGIFENCAP: - if (put_user(sl->mode, (int *)arg)) + if (put_user(sl->mode, p)) return -EFAULT; return 0; case SIOCSIFENCAP: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; #ifndef SL_INCLUDE_CSLIP if (tmp & (SL_MODE_CSLIP|SL_MODE_ADAPTIVE)) { @@ -1185,7 +1186,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm #ifdef CONFIG_SLIP_SMART /* VSV changes start here */ case SIOCSKEEPALIVE: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; if (tmp > 255) /* max for unchar */ return -EINVAL; @@ -1205,12 +1206,12 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm return 0; case SIOCGKEEPALIVE: - if (put_user(sl->keepalive, (int *)arg)) + if (put_user(sl->keepalive, p)) return -EFAULT; return 0; case SIOCSOUTFILL: - if (get_user(tmp,(int *)arg)) + if (get_user(tmp, p)) return -EFAULT; if (tmp > 255) /* max for unchar */ return -EINVAL; @@ -1229,7 +1230,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm return 0; case SIOCGOUTFILL: - if (put_user(sl->outfill, (int *)arg)) + if (put_user(sl->outfill, p)) return -EFAULT; return 0; /* VSV changes end */ @@ -1254,6 +1255,7 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) { struct slip *sl = (struct slip*)(dev->priv); + unsigned long *p = (unsigned long *)&rq->ifr_ifru; if (sl == NULL) /* Allocation failed ?? */ return -ENODEV; @@ -1268,11 +1270,11 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) switch(cmd){ case SIOCSKEEPALIVE: /* max for unchar */ - if (((unsigned int)((unsigned long)rq->ifr_data)) > 255) { + if ((unsigned)*p > 255) { spin_unlock_bh(&sl->lock); return -EINVAL; } - sl->keepalive = (unchar) ((unsigned long)rq->ifr_data); + sl->keepalive = (unchar) *p; if (sl->keepalive != 0) { sl->keepalive_timer.expires=jiffies+sl->keepalive*HZ; mod_timer(&sl->keepalive_timer, jiffies+sl->keepalive*HZ); @@ -1283,15 +1285,15 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) break; case SIOCGKEEPALIVE: - rq->ifr_data=(caddr_t)((unsigned long)sl->keepalive); + *p = sl->keepalive; break; case SIOCSOUTFILL: - if (((unsigned)((unsigned long)rq->ifr_data)) > 255) { /* max for unchar */ + if ((unsigned)*p > 255) { /* max for unchar */ spin_unlock_bh(&sl->lock); return -EINVAL; } - if ((sl->outfill = (unchar)((unsigned long) rq->ifr_data)) != 0){ + if ((sl->outfill = (unchar)*p) != 0){ mod_timer(&sl->outfill_timer, jiffies+sl->outfill*HZ); set_bit(SLF_OUTWAIT, &sl->flags); } else { @@ -1300,7 +1302,7 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) break; case SIOCGOUTFILL: - rq->ifr_data=(caddr_t)((unsigned long)sl->outfill); + *p = sl->outfill; break; case SIOCSLEASE: @@ -1312,12 +1314,12 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd) return -EPERM; } sl->leased = 0; - if ((unsigned long)rq->ifr_data) + if (*p) sl->leased = 1; break; case SIOCGLEASE: - rq->ifr_data=(caddr_t)((unsigned long)sl->leased); + *p = sl->leased; }; spin_unlock_bh(&sl->lock); return 0; diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c index b67fcc029..c176df6c2 100644 --- a/drivers/net/smc-mca.c +++ b/drivers/net/smc-mca.c @@ -51,6 +51,8 @@ #include "8390.h" #include "smc-mca.h" +#define DRV_NAME "smc-mca" + static int ultramca_open(struct net_device *dev); static void ultramca_reset_8390(struct net_device *dev); static void ultramca_get_8390_hdr(struct net_device *dev, @@ -265,7 +267,7 @@ int __init ultramca_probe(struct device *gen_dev) goto err_unclaim; } - if (!request_region(ioaddr, ULTRA_IO_EXTENT, dev->name)) { + if (!request_region(ioaddr, ULTRA_IO_EXTENT, DRV_NAME)) { rc = -ENODEV; goto err_unclaim; } diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index 5d71ed2e6..ce4628f62 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c @@ -72,6 +72,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "smc-ultra" + /* A zero-terminated list of I/O addresses to be probed. */ static unsigned int ultra_portlist[] __initdata = {0x200, 0x220, 0x240, 0x280, 0x300, 0x340, 0x380, 0}; @@ -178,6 +180,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT); } +#ifndef MODULE struct net_device * __init ultra_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -202,6 +205,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init ultra_probe1(struct net_device *dev, int ioaddr) { @@ -215,7 +219,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) unsigned char idreg = inb(ioaddr + 7); unsigned char reg4 = inb(ioaddr + 4) & 0x7f; - if (!request_region(ioaddr, ULTRA_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, ULTRA_IO_EXTENT, DRV_NAME)) return -EBUSY; /* Check the ID nibble. */ diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c index b26e0f887..8080a3767 100644 --- a/drivers/net/smc-ultra32.c +++ b/drivers/net/smc-ultra32.c @@ -61,6 +61,8 @@ static const char *version = "smc-ultra32.c: 06/97 v1.00\n"; #include "8390.h" +#define DRV_NAME "smc-ultra32" + static int ultra32_probe1(struct net_device *dev, int ioaddr); static int ultra32_open(struct net_device *dev); static void ultra32_reset_8390(struct net_device *dev); @@ -163,7 +165,7 @@ static int __init ultra32_probe1(struct net_device *dev, int ioaddr) unsigned char reg4; const char *ifmap[] = {"UTP No Link", "", "UTP/AUI", "UTP/BNC"}; - if (!request_region(ioaddr, ULTRA32_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, ULTRA32_IO_EXTENT, DRV_NAME)) return -EBUSY; if (inb(ioaddr + ULTRA32_IDPORT) == 0xff || diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index d2a2fe9bd..a82734927 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c @@ -78,6 +78,8 @@ static const char version[] = #include "smc9194.h" +#define DRV_NAME "smc9194" + /*------------------------------------------------------------------------ . . Configuration options, for the experienced user to change. @@ -843,7 +845,7 @@ static int __init smc_probe(struct net_device *dev, int ioaddr) word memory_cfg_register; /* Grab the region so that no one else tries to probe our ioports. */ - if (!request_region(ioaddr, SMC_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, SMC_IO_EXTENT, DRV_NAME)) return -EBUSY; dev->irq = irq; @@ -1001,9 +1003,9 @@ static int __init smc_probe(struct net_device *dev, int ioaddr) memset(dev->priv, 0, sizeof(struct smc_local)); /* Grab the IRQ */ - retval = request_irq(dev->irq, &smc_interrupt, 0, dev->name, dev); + retval = request_irq(dev->irq, &smc_interrupt, 0, DRV_NAME, dev); if (retval) { - printk("%s: unable to get IRQ %d (irqval=%d).\n", dev->name, + printk("%s: unable to get IRQ %d (irqval=%d).\n", DRV_NAME, dev->irq, retval); goto err_out; } diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 9b47edbd9..793201d3f 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c @@ -880,7 +880,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev, irq = pdev->irq; - if (pci_request_regions (pdev, dev->name)) { + if (pci_request_regions (pdev, DRV_NAME)) { printk(KERN_ERR DRV_NAME " %d: cannot reserve PCI resources, aborting\n", card_idx); goto err_out_free_netdev; } @@ -1997,7 +1997,7 @@ static void set_rx_mode(struct net_device *dev) } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd ecmd; struct netdev_private *np = dev->priv; @@ -2079,16 +2079,16 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else { + struct mii_ioctl_data *data = if_mii(rq); spin_lock_irq(&np->lock); rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); spin_unlock_irq(&np->lock); diff --git a/drivers/net/stnic.c b/drivers/net/stnic.c index 8346de427..b6dfdf8f4 100644 --- a/drivers/net/stnic.c +++ b/drivers/net/stnic.c @@ -28,6 +28,8 @@ #include "8390.h" +#define DRV_NAME "stnic" + #define byte unsigned char #define half unsigned short #define word unsigned int @@ -130,7 +132,7 @@ static int __init stnic_probe(void) /* Snarf the interrupt now. There's no point in waiting since we cannot share and the board will usually be enabled. */ - err = request_irq (dev->irq, ei_interrupt, 0, dev->name, dev); + err = request_irq (dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (err) { printk (KERN_EMERG " unable to get IRQ %d.\n", dev->irq); free_netdev(dev); diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c index 669a02fb7..053fcaf1c 100644 --- a/drivers/net/sun3_82586.c +++ b/drivers/net/sun3_82586.c @@ -53,6 +53,8 @@ static int fifo=0x8; /* don't change */ #include "sun3_82586.h" +#define DRV_NAME "sun3_82586" + #define DEBUG /* debug on */ #define SYSBUSVAL 0 /* 16 Bit */ #define SUN3_82586_TOTAL_SIZE PAGE_SIZE @@ -336,7 +338,7 @@ static int __init sun3_82586_probe1(struct net_device *dev,int ioaddr) { int i, size, retval; - if (!request_region(ioaddr, SUN3_82586_TOTAL_SIZE, dev->name)) + if (!request_region(ioaddr, SUN3_82586_TOTAL_SIZE, DRV_NAME)) return -EBUSY; /* copy in the ethernet address from the prom */ diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index f0512a498..6faef842d 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c @@ -42,7 +42,6 @@ static char *version = "sun3lance.c: v1.2 1/12/2001 Sam Creasey (sammy@sammy.ne #include #include #include -#include #include #include #include diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 838c9c50a..e5069fca1 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -1576,7 +1576,7 @@ static int __set_mac_addr(struct net_device *dev) } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct netdev_private *np = dev->priv; u32 ethcmd; @@ -1659,7 +1659,6 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct netdev_private *np = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; int i; long ioaddr = dev->base_addr; @@ -1668,11 +1667,11 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return -EINVAL; if (cmd == SIOCETHTOOL) - rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + rc = netdev_ethtool_ioctl(dev, rq->ifr_data); else { spin_lock_irq(&np->lock); - rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&np->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irq(&np->lock); } switch (cmd) { diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 36ddb6d84..b831eef1b 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -2510,7 +2510,7 @@ static struct ethtool_ops gem_ethtool_ops = { static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct gem *gp = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); int rc = -EOPNOTSUPP; /* Hold the PM semaphore while doing ioctl's or we may collide @@ -2717,7 +2717,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, gp = dev->priv; - err = pci_request_regions(pdev, dev->name); + err = pci_request_regions(pdev, DRV_NAME); if (err) { printk(KERN_ERR PFX "Cannot obtain PCI resources, " "aborting.\n"); diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 5c2917c6d..c56a4baaf 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c @@ -68,6 +68,8 @@ static char version[] = #include "sunhme.h" +#define DRV_NAME "sunhme" + static int macaddr[6]; /* accept MAC address of the form macaddr=0x08,0x00,0x20,0x30,0x40,0x50 */ @@ -3085,7 +3087,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev) printk(KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n"); goto err_out_clear_quattro; } - if (pci_request_regions(pdev, dev->name)) { + if (pci_request_regions(pdev, DRV_NAME)) { printk(KERN_ERR "happymeal(PCI): Cannot obtain PCI resources, " "aborting.\n"); goto err_out_clear_quattro; diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 20ba895dc..6b2a16825 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -56,8 +56,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.5" -#define DRV_MODULE_RELDATE "May 25, 2004" +#define DRV_MODULE_VERSION "3.6" +#define DRV_MODULE_RELDATE "June 12, 2004" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -177,6 +177,8 @@ static struct pci_device_id tg3_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5789, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901_2, @@ -195,6 +197,10 @@ static struct pci_device_id tg3_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751M, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751F, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX, @@ -6678,7 +6684,7 @@ static void tg3_get_ethtool_stats (struct net_device *dev, static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; + struct mii_ioctl_data *data = if_mii(ifr); struct tg3 *tp = netdev_priv(dev); int err; @@ -7536,6 +7542,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) udelay(50); tg3_nvram_init(tp); + /* Always use host TXDs, it performs better in particular + * with multi-frag packets. The tests below are kept here + * as documentation should we change this decision again + * in the future. + */ + tp->tg3_flags |= TG3_FLAG_HOST_TXDS; + +#if 0 /* Determine if TX descriptors will reside in * main memory or in the chip SRAM. */ @@ -7543,6 +7557,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) tp->tg3_flags |= TG3_FLAG_HOST_TXDS; +#endif grc_misc_cfg = tr32(GRC_MISC_CFG); grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; @@ -7565,7 +7580,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901 || tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901_2 || - tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F))) + tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || + (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && + tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F)) tp->tg3_flags |= TG3_FLAG_10_100_ONLY; err = tg3_phy_probe(tp); @@ -8446,6 +8463,8 @@ static int tg3_resume(struct pci_dev *pdev) if (!netif_running(dev)) return 0; + pci_restore_state(tp->pdev, tp->pci_cfg_state); + err = tg3_set_power_state(tp, 0); if (err) return err; diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 3c10d2a98..4c57ab290 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -984,7 +984,7 @@ static int TLan_Open( struct net_device *dev ) static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { TLanPrivateInfo *priv = dev->priv; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); u32 phy = priv->phy[priv->phyNum]; if (!priv->phyOnline) diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig index 02bc6d39b..6182cf4e3 100644 --- a/drivers/net/tulip/Kconfig +++ b/drivers/net/tulip/Kconfig @@ -71,10 +71,17 @@ config TULIP_MMIO config TULIP_NAPI bool "Use NAPI RX polling " depends on TULIP - ---help--- - This is of useful for servers and routers dealing with high network loads. - - See . + help + NAPI is a new driver API designed to reduce CPU and interrupt load + when the driver is receiving lots of packets from the card. It is + still somewhat experimental and thus not yet enabled by default. + + If your estimated Rx load is 10kpps or more, or if the card will be + deployed on potentially unfriendly networks (e.g. in a firewall), + then say Y here. + + See for more + information. If in doubt, say N. diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 3fb06e5cb..d59d46ecd 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c @@ -5535,7 +5535,7 @@ static int de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct de4x5_private *lp = netdev_priv(dev); - struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_data; + struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_ifru; u_long iobase = dev->base_addr; int i, j, status = 0; s32 omr; diff --git a/drivers/net/tulip/de4x5.h b/drivers/net/tulip/de4x5.h index 7f02aacd3..ad37a4074 100644 --- a/drivers/net/tulip/de4x5.h +++ b/drivers/net/tulip/de4x5.h @@ -1005,7 +1005,7 @@ struct de4x5_ioctl { unsigned short cmd; /* Command to run */ unsigned short len; /* Length of the data buffer */ - unsigned char *data; /* Pointer to the data buffer */ + unsigned char __user *data; /* Pointer to the data buffer */ }; /* diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index cb0e30486..f86170e9b 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c @@ -133,6 +133,10 @@ int tulip_poll(struct net_device *dev, int *budget) tp->rx_ring[entry].status); do { + if (inl(dev->base_addr + CSR5) == 0xffffffff) { + printk(KERN_DEBUG " In tulip_poll(), hardware disappeared.\n"); + break; + } /* Acknowledge current RX interrupt sources. */ outl((RxIntr | RxNoBuf), dev->base_addr + CSR5); diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 0fc00edc8..498f612cf 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -830,7 +830,7 @@ static struct net_device_stats *tulip_get_stats(struct net_device *dev) } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct tulip_private *np = netdev_priv(dev); u32 ethcmd; @@ -859,14 +859,14 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { struct tulip_private *tp = netdev_priv(dev); long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); const unsigned int phy_idx = 0; int phy = tp->phys[phy_idx] & 0x1f; unsigned int regnum = data->reg_num; switch (cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ if (tp->mii_cnt) diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 74d42535c..6246e443f 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c @@ -1292,14 +1292,8 @@ static int netdev_rx(struct net_device *dev) pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], np->rx_skbuff[entry]->len, PCI_DMA_FROMDEVICE); - /* Call copy + cksum if available. */ -#if HAS_IP_COPYSUM eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); skb_put(skb, pkt_len); -#else - memcpy(skb_put(skb, pkt_len), np->rx_skbuff[entry]->tail, - pkt_len); -#endif pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry], np->rx_skbuff[entry]->len, PCI_DMA_FROMDEVICE); @@ -1526,8 +1520,8 @@ static struct ethtool_ops netdev_ethtool_ops = { static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; - struct netdev_private *np = dev->priv; + struct mii_ioctl_data *data = if_mii(rq); + struct netdev_private *np = netdev_priv(dev); switch(cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index 5f6cea1b2..a01cc1b09 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c @@ -1369,7 +1369,7 @@ static struct net_device_stats *xircom_get_stats(struct net_device *dev) } -static int xircom_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int xircom_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct ethtool_cmd ecmd; struct xircom_private *tp = dev->priv; @@ -1471,13 +1471,13 @@ static int xircom_ethtool_ioctl(struct net_device *dev, void *useraddr) static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct xircom_private *tp = dev->priv; - u16 *data = (u16 *)&rq->ifr_data; + u16 *data = (u16 *)&rq->ifr_ifru; int phy = tp->phys[0] & 0x1f; unsigned long flags; switch(cmd) { case SIOCETHTOOL: - return xircom_ethtool_ioctl(dev, (void *) rq->ifr_data); + return xircom_ethtool_ioctl(dev, rq->ifr_data); /* Legacy mii-diag interface */ case SIOCGMIIPHY: /* Get address of MII PHY in use. */ diff --git a/drivers/net/tun.c b/drivers/net/tun.c index e6df23fea..d0fe0f656 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -129,8 +129,8 @@ static void tun_net_init(struct net_device *dev) dev->addr_len = 0; dev->mtu = 1500; - /* Type PPP seems most suitable */ - dev->type = ARPHRD_PPP; + /* Zero header length */ + dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; dev->tx_queue_len = 10; break; @@ -241,10 +241,10 @@ static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv, } /* Write */ -static ssize_t tun_chr_write(struct file * file, const char * buf, +static ssize_t tun_chr_write(struct file * file, const char __user * buf, size_t count, loff_t *pos) { - struct iovec iv = { (void *) buf, count }; + struct iovec iv = { (void __user *) buf, count }; return tun_chr_writev(file, &iv, 1, pos); } @@ -333,7 +333,7 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv, } /* Read */ -static ssize_t tun_chr_read(struct file * file, char * buf, +static ssize_t tun_chr_read(struct file * file, char __user * buf, size_t count, loff_t *pos) { struct iovec iv = { buf, count }; @@ -462,7 +462,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, struct ifreq ifr; int err; - if (copy_from_user(&ifr, (void *)arg, sizeof(ifr))) + if (copy_from_user(&ifr, (void __user *)arg, sizeof(ifr))) return -EFAULT; ifr.ifr_name[IFNAMSIZ-1] = '\0'; @@ -473,7 +473,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, if (err) return err; - if (copy_to_user((void *)arg, &ifr, sizeof(ifr))) + if (copy_to_user((void __user *)arg, &ifr, sizeof(ifr))) return -EFAULT; return 0; } diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 39949dbb1..45ab1999d 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c @@ -1162,7 +1162,7 @@ typhoon_ethtool_sset(struct typhoon *tp, struct ethtool_cmd *cmd) } static inline int -typhoon_ethtool_ioctl(struct net_device *dev, void *useraddr) +typhoon_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct typhoon *tp = (struct typhoon *) dev->priv; u32 ethcmd; @@ -1237,7 +1237,7 @@ typhoon_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { switch (cmd) { case SIOCETHTOOL: - return typhoon_ethtool_ioctl(dev, (void *) ifr->ifr_data); + return typhoon_ethtool_ioctl(dev, ifr->ifr_data); default: break; } diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index d399b347d..47443254c 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -354,59 +354,46 @@ The chip does not pad to minimum transmit length. second only the 1234 card. */ -enum pci_flags_bit { - PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, - PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3, +enum rhine_revs { + VT86C100A = 0x00, + VT6102 = 0x40, + VT8231 = 0x50, /* Integrated MAC */ + VT8233 = 0x60, /* Integrated MAC */ + VT8235 = 0x74, /* Integrated MAC */ + VT8237 = 0x78, /* Integrated MAC */ + VTunknown0 = 0x7C, + VT6105 = 0x80, + VT6105_B0 = 0x83, + VT6105L = 0x8A, + VT6107 = 0x8C, + VTunknown1 = 0x8E, + VT6105M = 0x90, }; -enum rhine_chips { - VT86C100A = 0, - VT6102, - VT6105, - VT6105M -}; - -struct rhine_chip_info { - const char *name; - u16 pci_flags; - int io_size; - int drv_flags; -}; - - -enum chip_capability_flags { - CanHaveMII=1, HasESIPhy=2, HasDavicomPhy=4, - ReqTxAlign=0x10, HasWOL=0x20, +enum rhine_quirks { + rqWOL = 0x0001, /* Wake-On-LAN support */ + rqForceReset = 0x0002, + rqDavicomPhy = 0x0020, + rq6patterns = 0x0040, /* 6 instead of 4 patterns for WOL */ + rqStatusWBRace = 0x0080, /* Tx Status Writeback Error possible */ + rqRhineI = 0x0100, /* See comment below */ }; +/* + * rqRhineI: VT86C100A (aka Rhine-I) uses different bits to enable + * MMIO as well as for the collision counter and the Tx FIFO underflow + * indicator. In addition, Tx and Rx buffers need to 4 byte aligned. + */ -#ifdef USE_MMIO -#define RHINE_IOTYPE (PCI_USES_MEM | PCI_USES_MASTER | PCI_ADDR1) -#else -#define RHINE_IOTYPE (PCI_USES_IO | PCI_USES_MASTER | PCI_ADDR0) -#endif /* Beware of PCI posted writes */ #define IOSYNC do { readb(dev->base_addr + StationAddr); } while (0) -/* directly indexed by enum rhine_chips, above */ -static struct rhine_chip_info rhine_chip_info[] __devinitdata = -{ - { "VIA VT86C100A Rhine", RHINE_IOTYPE, 128, - CanHaveMII | ReqTxAlign | HasDavicomPhy }, - { "VIA VT6102 Rhine-II", RHINE_IOTYPE, 256, - CanHaveMII | HasWOL }, - { "VIA VT6105 Rhine-III", RHINE_IOTYPE, 256, - CanHaveMII | HasWOL }, - { "VIA VT6105M Rhine-III", RHINE_IOTYPE, 256, - CanHaveMII | HasWOL }, -}; - static struct pci_device_id rhine_pci_tbl[] = { - {0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT86C100A}, - {0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6102}, - {0x1106, 0x3106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6105}, /* 6105{,L,LOM} */ - {0x1106, 0x3053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6105M}, - {0,} /* terminate list */ + {0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT86C100A */ + {0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT6102 */ + {0x1106, 0x3106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* 6105{,L,LOM} */ + {0x1106, 0x3053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT6105M */ + { } /* terminate list */ }; MODULE_DEVICE_TABLE(pci, rhine_pci_tbl); @@ -421,8 +408,10 @@ enum register_offsets { MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, MACRegEEcsr=0x74, ConfigA=0x78, ConfigB=0x79, ConfigC=0x7A, ConfigD=0x7B, RxMissed=0x7C, RxCRCErrs=0x7E, MiscCmd=0x81, - StickyHW=0x83, IntrStatus2=0x84, WOLcrClr=0xA4, WOLcgClr=0xA7, - PwrcsrClr=0xAC, + StickyHW=0x83, IntrStatus2=0x84, + WOLcrSet=0xA0, WOLcrClr=0xA4, WOLcrClr1=0xA6, + WOLcgClr=0xA7, + PwrcsrSet=0xA8, PwrcsrSet1=0xA9, PwrcsrClr=0xAC, PwrcsrClr1=0xAD, }; /* Bits in ConfigD */ @@ -514,7 +503,7 @@ struct rhine_private { spinlock_t lock; /* Frequently used values: keep some adjacent for cache effect. */ - int chip_id, drv_flags; + u32 quirks; struct rx_desc *rx_head_desc; unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ unsigned int cur_tx, dirty_tx; @@ -522,7 +511,6 @@ struct rhine_private { u16 chip_cmd; /* Current setting for ChipCmd */ /* These values are keep track of the transceiver/media in use. */ - unsigned int default_port:4; /* Last dev->if_port value. */ u8 tx_thresh, rx_thresh; /* MII transceiver section. */ @@ -557,12 +545,41 @@ static inline u32 get_intr_status(struct net_device *dev) intr_status = readw(ioaddr + IntrStatus); /* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */ - if (rp->chip_id == VT6102) + if (rp->quirks & rqStatusWBRace) intr_status |= readb(ioaddr + IntrStatus2) << 16; return intr_status; } -static void wait_for_reset(struct net_device *dev, int chip_id, char *name) +/* + * Get power related registers into sane state. + * Returns content of power-event (WOL) registers. + */ +static void rhine_power_init(struct net_device *dev) +{ + long ioaddr = dev->base_addr; + struct rhine_private *rp = netdev_priv(dev); + + if (rp->quirks & rqWOL) { + /* Make sure chip is in power state D0 */ + writeb(readb(ioaddr + StickyHW) & 0xFC, ioaddr + StickyHW); + + /* Disable "force PME-enable" */ + writeb(0x80, ioaddr + WOLcgClr); + + /* Clear power-event config bits (WOL) */ + writeb(0xFF, ioaddr + WOLcrClr); + /* More recent cards can manage two additional patterns */ + if (rp->quirks & rq6patterns) + writeb(0x03, ioaddr + WOLcrClr1); + + /* Clear power-event status bits */ + writeb(0xFF, ioaddr + PwrcsrClr); + if (rp->quirks & rq6patterns) + writeb(0x03, ioaddr + PwrcsrClr1); + } +} + +static void wait_for_reset(struct net_device *dev, u32 quirks, char *name) { long ioaddr = dev->base_addr; int boguscnt = 20; @@ -574,7 +591,7 @@ static void wait_for_reset(struct net_device *dev, int chip_id, char *name) "Trying harder.\n", name); /* Rhine-II needs to be forced sometimes */ - if (chip_id == VT6102) + if (quirks & rqForceReset) writeb(0x40, ioaddr + MiscCmd); /* VT86C100A may need long delay after reset (dlink) */ @@ -590,10 +607,10 @@ static void wait_for_reset(struct net_device *dev, int chip_id, char *name) } #ifdef USE_MMIO -static void __devinit enable_mmio(long ioaddr, int chip_id) +static void __devinit enable_mmio(long ioaddr, u32 quirks) { int n; - if (chip_id == VT86C100A) { + if (quirks & rqRhineI) { /* More recent docs say that this bit is reserved ... */ n = inb(ioaddr + ConfigA) | 0x20; outb(n, ioaddr + ConfigA); @@ -628,16 +645,18 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, { struct net_device *dev; struct rhine_private *rp; - int i, option; - int chip_id = (int) ent->driver_data; + int i, option, rc; + u8 pci_rev; + u32 quirks; static int card_idx = -1; long ioaddr; long memaddr; int io_size; - int pci_flags; + int phy, phy_idx = 0; #ifdef USE_MMIO long ioaddr0; #endif + const char *name; /* when built into the kernel, we only print version if device is found */ #ifndef MODULE @@ -648,14 +667,34 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, card_idx++; option = card_idx < MAX_UNITS ? options[card_idx] : 0; - io_size = rhine_chip_info[chip_id].io_size; - pci_flags = rhine_chip_info[chip_id].pci_flags; + pci_read_config_byte(pdev, PCI_REVISION_ID, &pci_rev); - if (pci_enable_device(pdev)) + io_size = 256; + if (pci_rev < VT6102) { + quirks = rqRhineI | rqDavicomPhy; + io_size = 128; + name = "VT86C100A Rhine"; + } + else { + quirks = rqWOL | rqForceReset; + if (pci_rev < VT6105) { + name = "Rhine II"; + quirks |= rqStatusWBRace; /* Rhine-II exclusive */ + } + else { + name = "Rhine III"; + if (pci_rev >= VT6105_B0) + quirks |= rq6patterns; + } + } + + rc = pci_enable_device(pdev); + if (rc) goto err_out; /* this should always be supported */ - if (pci_set_dma_mask(pdev, 0xffffffff)) { + rc = pci_set_dma_mask(pdev, 0xffffffff); + if (rc) { printk(KERN_ERR "32-bit PCI DMA addresses not supported by " "the card!?\n"); goto err_out; @@ -664,6 +703,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, /* sanity check */ if ((pci_resource_len(pdev, 0) < io_size) || (pci_resource_len(pdev, 1) < io_size)) { + rc = -EIO; printk(KERN_ERR "Insufficient PCI resources, aborting\n"); goto err_out; } @@ -671,11 +711,11 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, ioaddr = pci_resource_start(pdev, 0); memaddr = pci_resource_start(pdev, 1); - if (pci_flags & PCI_USES_MASTER) - pci_set_master(pdev); + pci_set_master(pdev); dev = alloc_etherdev(sizeof(*rp)); if (dev == NULL) { + rc = -ENOMEM; printk(KERN_ERR "init_ethernet failed for card #%d\n", card_idx); goto err_out; @@ -683,15 +723,17 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); - if (pci_request_regions(pdev, shortname)) + rc = pci_request_regions(pdev, shortname); + if (rc) goto err_out_free_netdev; #ifdef USE_MMIO ioaddr0 = ioaddr; - enable_mmio(ioaddr0, chip_id); + enable_mmio(ioaddr0, quirks); ioaddr = (long) ioremap(memaddr, io_size); if (!ioaddr) { + rc = -EIO; printk(KERN_ERR "ioremap failed for device %s, region 0x%X " "@ 0x%lX\n", pci_name(pdev), io_size, memaddr); goto err_out_free_res; @@ -704,36 +746,21 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, unsigned char a = inb(ioaddr0+reg); unsigned char b = readb(ioaddr+reg); if (a != b) { + rc = -EIO; printk(KERN_ERR "MMIO do not match PIO [%02x] " "(%02x != %02x)\n", reg, a, b); goto err_out_unmap; } } #endif /* USE_MMIO */ + dev->base_addr = ioaddr; - /* D-Link provided reset code (with comment additions) */ - if (rhine_chip_info[chip_id].drv_flags & HasWOL) { - unsigned char byOrgValue; - - /* clear sticky bit before reset & read ethernet address */ - byOrgValue = readb(ioaddr + StickyHW); - byOrgValue = byOrgValue & 0xFC; - writeb(byOrgValue, ioaddr + StickyHW); - - /* (bits written are cleared?) */ - /* disable force PME-enable */ - writeb(0x80, ioaddr + WOLcgClr); - /* disable power-event config bit */ - writeb(0xFF, ioaddr + WOLcrClr); - /* clear power status (undocumented in vt6102 docs?) */ - writeb(0xFF, ioaddr + PwrcsrClr); - } + rhine_power_init(dev); /* Reset the chip to erase previous misconfiguration. */ writew(CmdReset, ioaddr + ChipCmd); - dev->base_addr = ioaddr; - wait_for_reset(dev, chip_id, shortname); + wait_for_reset(dev, quirks, shortname); /* Reload the station address from the EEPROM. */ #ifdef USE_MMIO @@ -741,7 +768,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, /* Reloading from eeprom overwrites cfgA-D, so we must re-enable MMIO. If reload_eeprom() was done first this could be avoided, but it is not known if that still works with the "win98-reboot" problem. */ - enable_mmio(ioaddr0, chip_id); + enable_mmio(ioaddr0, quirks); #else reload_eeprom(ioaddr); #endif @@ -750,11 +777,12 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, dev->dev_addr[i] = readb(ioaddr + StationAddr + i); if (!is_valid_ether_addr(dev->dev_addr)) { + rc = -EIO; printk(KERN_ERR "Invalid MAC address for card #%d\n", card_idx); goto err_out_unmap; } - if (chip_id == VT6102) { + if (quirks & rqWOL) { /* * for 3065D, EEPROM reloaded will cause bit 0 in MAC_REG_CFGA * turned on. it makes MAC receive magic packet @@ -772,9 +800,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, rp = netdev_priv(dev); spin_lock_init(&rp->lock); - rp->chip_id = chip_id; - rp->drv_flags = rhine_chip_info[chip_id].drv_flags; rp->pdev = pdev; + rp->quirks = quirks; rp->mii_if.dev = dev; rp->mii_if.mdio_read = mdio_read; rp->mii_if.mdio_write = mdio_write; @@ -797,19 +824,18 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, #ifdef CONFIG_NET_POLL_CONTROLLER dev->poll_controller = rhine_poll; #endif - if (rp->drv_flags & ReqTxAlign) + if (rp->quirks & rqRhineI) dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; /* dev->name not defined before register_netdev()! */ - i = register_netdev(dev); - if (i) + rc = register_netdev(dev); + if (rc) goto err_out_unmap; /* The lower four bits are the media type. */ if (option > 0) { if (option & 0x220) rp->mii_if.full_duplex = 1; - rp->default_port = option & 15; } if (card_idx < MAX_UNITS && full_duplex[card_idx] > 0) rp->mii_if.full_duplex = 1; @@ -820,9 +846,14 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, rp->mii_if.force_media = 1; } - printk(KERN_INFO "%s: %s at 0x%lx, ", - dev->name, rhine_chip_info[chip_id].name, - (pci_flags & PCI_USES_IO) ? ioaddr : memaddr); + printk(KERN_INFO "%s: VIA %s at 0x%lx, ", + dev->name, name, +#ifdef USE_MMIO + memaddr +#else + ioaddr +#endif + ); for (i = 0; i < 5; i++) printk("%2.2x:", dev->dev_addr[i]); @@ -830,41 +861,35 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, pci_set_drvdata(pdev, dev); - if (rp->drv_flags & CanHaveMII) { - int phy, phy_idx = 0; - rp->phys[0] = 1; /* Standard for this chip. */ - for (phy = 1; phy < 32 && phy_idx < MAX_MII_CNT; phy++) { - int mii_status = mdio_read(dev, phy, 1); - if (mii_status != 0xffff && mii_status != 0x0000) { - rp->phys[phy_idx++] = phy; - rp->mii_if.advertising = mdio_read(dev, phy, 4); - printk(KERN_INFO "%s: MII PHY found at address " - "%d, status 0x%4.4x advertising %4.4x " - "Link %4.4x.\n", dev->name, phy, - mii_status, rp->mii_if.advertising, - mdio_read(dev, phy, 5)); - - /* set IFF_RUNNING */ - if (mii_status & BMSR_LSTATUS) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - - break; - } + rp->phys[0] = 1; /* Standard for this chip. */ + for (phy = 1; phy < 32 && phy_idx < MAX_MII_CNT; phy++) { + int mii_status = mdio_read(dev, phy, 1); + if (mii_status != 0xffff && mii_status != 0x0000) { + rp->phys[phy_idx++] = phy; + rp->mii_if.advertising = mdio_read(dev, phy, 4); + printk(KERN_INFO "%s: MII PHY found at address " + "%d, status 0x%4.4x advertising %4.4x " + "Link %4.4x.\n", dev->name, phy, + mii_status, rp->mii_if.advertising, + mdio_read(dev, phy, 5)); + + /* set IFF_RUNNING */ + if (mii_status & BMSR_LSTATUS) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + + break; } - rp->mii_cnt = phy_idx; - rp->mii_if.phy_id = rp->phys[0]; } + rp->mii_cnt = phy_idx; + rp->mii_if.phy_id = rp->phys[0]; /* Allow forcing the media type. */ if (option > 0) { if (option & 0x220) rp->mii_if.full_duplex = 1; - rp->default_port = option & 0x3ff; if (option & 0x330) { - /* FIXME: shouldn't someone check this variable? */ - /* rp->medialock = 1; */ printk(KERN_INFO " Forcing %dMbs %s-duplex " "operation.\n", (option & 0x300 ? 100 : 10), @@ -887,7 +912,7 @@ err_out_free_res: err_out_free_netdev: free_netdev(dev); err_out: - return -ENODEV; + return rc; } static int alloc_ring(struct net_device* dev) @@ -904,7 +929,7 @@ static int alloc_ring(struct net_device* dev) printk(KERN_ERR "Could not allocate DMA memory.\n"); return -ENOMEM; } - if (rp->drv_flags & ReqTxAlign) { + if (rp->quirks & rqRhineI) { rp->tx_bufs = pci_alloc_consistent(rp->pdev, PKT_BUF_SZ * TX_RING_SIZE, &rp->tx_bufs_dma); @@ -1063,9 +1088,6 @@ static void init_registers(struct net_device *dev) rp->rx_thresh = 0x60; /* Written in rhine_set_rx_mode(). */ rp->mii_if.full_duplex = 0; - if (dev->if_port == 0) - dev->if_port = rp->default_port; - writel(rp->rx_ring_dma, ioaddr + RxRingPtr); writel(rp->tx_ring_dma, ioaddr + TxRingPtr); @@ -1087,9 +1109,8 @@ static void init_registers(struct net_device *dev) /* The LED outputs of various MII xcvrs should be configured. */ /* For NS or Mison phys, turn on bit 1 in register 0x17 */ - /* For ESI phys, turn on bit 7 in register 0x17. */ mdio_write(dev, rp->phys[0], 0x17, mdio_read(dev, rp->phys[0], 0x17) | - (rp->drv_flags & HasESIPhy) ? 0x0080 : 0x0001); + 0x0001); } /* Read and write over the MII Management Data I/O (MDIO) interface. */ @@ -1166,7 +1187,7 @@ static int rhine_open(struct net_device *dev) return i; alloc_rbufs(dev); alloc_tbufs(dev); - wait_for_reset(dev, rp->chip_id, dev->name); + wait_for_reset(dev, rp->quirks, dev->name); init_registers(dev); if (debug > 2) printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x " @@ -1257,8 +1278,6 @@ static void rhine_tx_timeout(struct net_device *dev) dev->name, readw(ioaddr + IntrStatus), mdio_read(dev, rp->phys[0], MII_BMSR)); - dev->if_port = 0; - /* protect against concurrent rx interrupts */ disable_irq(rp->pdev->irq); @@ -1274,7 +1293,7 @@ static void rhine_tx_timeout(struct net_device *dev) alloc_rbufs(dev); /* Reinitialize the hardware. */ - wait_for_reset(dev, rp->chip_id, dev->name); + wait_for_reset(dev, rp->quirks, dev->name); init_registers(dev); spin_unlock(&rp->lock); @@ -1305,7 +1324,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) rp->tx_skbuff[entry] = skb; - if ((rp->drv_flags & ReqTxAlign) && + if ((rp->quirks & rqRhineI) && (((long)skb->data & 3) || skb_shinfo(skb)->nr_frags != 0 || skb->ip_summed == CHECKSUM_HW)) { /* Must use alignment buffer. */ if (skb->len > PKT_BUF_SZ) { @@ -1454,7 +1473,7 @@ static void rhine_tx(struct net_device *dev) if (txstatus & 0x0200) rp->stats.tx_window_errors++; if (txstatus & 0x0100) rp->stats.tx_aborted_errors++; if (txstatus & 0x0080) rp->stats.tx_heartbeat_errors++; - if (((rp->chip_id == VT86C100A) && txstatus & 0x0002) || + if (((rp->quirks & rqRhineI) && txstatus & 0x0002) || (txstatus & 0x0800) || (txstatus & 0x1000)) { rp->stats.tx_fifo_errors++; rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); @@ -1462,7 +1481,7 @@ static void rhine_tx(struct net_device *dev) } /* Transmitter restarted in 'abnormal' handler. */ } else { - if (rp->chip_id == VT86C100A) + if (rp->quirks & rqRhineI) rp->stats.collisions += (txstatus >> 3) & 0x0F; else rp->stats.collisions += txstatus & 0x0F; @@ -1563,15 +1582,10 @@ static void rhine_rx(struct net_device *dev) eth_copy_and_sum is memcpy for all archs so this is kind of pointless right now ... or? */ -#if HAS_IP_COPYSUM /* Call copy + cksum if available. */ eth_copy_and_sum(skb, rp->rx_skbuff[entry]->tail, pkt_len, 0); skb_put(skb, pkt_len); -#else - memcpy(skb_put(skb, pkt_len), - rp->rx_skbuff[entry]->tail, pkt_len); -#endif pci_dma_sync_single_for_device(rp->pdev, rp->rx_skbuff_dma[entry], rp->rx_buf_sz, @@ -1679,7 +1693,7 @@ static void rhine_error(struct net_device *dev, int intr_status) if (intr_status & (IntrLinkChange)) { if (readb(ioaddr + MIIStatus) & 0x02) { /* Link failed, restart autonegotiation. */ - if (rp->drv_flags & HasDavicomPhy) + if (rp->quirks & rqRhineI) mdio_write(dev, rp->phys[0], MII_BMCR, 0x3300); } else rhine_check_duplex(dev); @@ -1805,9 +1819,6 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) struct rhine_private *rp = netdev_priv(dev); int rc; - if (!(rp->drv_flags & CanHaveMII)) - return -EINVAL; - spin_lock_irq(&rp->lock); rc = mii_ethtool_gset(&rp->mii_if, cmd); spin_unlock_irq(&rp->lock); @@ -1820,9 +1831,6 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) struct rhine_private *rp = netdev_priv(dev); int rc; - if (!(rp->drv_flags & CanHaveMII)) - return -EINVAL; - spin_lock_irq(&rp->lock); rc = mii_ethtool_sset(&rp->mii_if, cmd); spin_unlock_irq(&rp->lock); @@ -1834,9 +1842,6 @@ static int netdev_nway_reset(struct net_device *dev) { struct rhine_private *rp = netdev_priv(dev); - if (!(rp->drv_flags & CanHaveMII)) - return -EINVAL; - return mii_nway_restart(&rp->mii_if); } @@ -1844,9 +1849,6 @@ static u32 netdev_get_link(struct net_device *dev) { struct rhine_private *rp = netdev_priv(dev); - if (!(rp->drv_flags & CanHaveMII)) - return 0; /* -EINVAL */ - return mii_link_ok(&rp->mii_if); } @@ -1875,14 +1877,13 @@ static struct ethtool_ops netdev_ethtool_ops = { static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct rhine_private *rp = netdev_priv(dev); - struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data; int rc; if (!netif_running(dev)) return -EINVAL; spin_lock_irq(&rp->lock); - rc = generic_mii_ioctl(&rp->mii_if, data, cmd, NULL); + rc = generic_mii_ioctl(&rp->mii_if, if_mii(rq), cmd, NULL); spin_unlock_irq(&rp->lock); return rc; diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 82798fd0e..bad0d4185 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c @@ -229,7 +229,7 @@ static int dlci_transmit(struct sk_buff *skb, struct net_device *dev) return(ret); } -static int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get) +static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get) { struct dlci_conf config; struct dlci_local *dlp; @@ -286,7 +286,7 @@ static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) if (!*(short *)(dev->dev_addr)) return(-EINVAL); - return(dlci_config(dev, (struct dlci_conf *) ifr->ifr_data, cmd == DLCI_GET_CONF)); + return(dlci_config(dev, ifr->ifr_data, cmd == DLCI_GET_CONF)); break; default: @@ -454,7 +454,7 @@ static int dlci_del(struct dlci_add *dlci) return(err); } -static int dlci_ioctl(unsigned int cmd, void *arg) +static int dlci_ioctl(unsigned int cmd, void __user *arg) { struct dlci_add add; int err; diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 05aa310d3..29b82687b 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c @@ -2542,7 +2542,7 @@ int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) pc300conf_t conf_aux; pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; int ch = chan->channel; - void *arg = (void *) ifr->ifr_data; + void __user *arg = ifr->ifr_data; struct if_settings *settings = &ifr->ifr_settings; uclong scabase = card->hw.scabase; diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index e61774aef..311ac346f 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -1342,7 +1342,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) return -EPERM; spin_lock( &nl->lock ); - flags = *(struct sbni_flags*) &ifr->ifr_data; + flags = *(struct sbni_flags*) &ifr->ifr_ifru; if( flags.fixed_rxl ) nl->delta_rxl = 0, nl->cur_rxl_index = flags.rxl; diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 0abba0f12..12598181a 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -1095,7 +1095,7 @@ static int sdla_open(struct net_device *dev) return(0); } -static int sdla_config(struct net_device *dev, struct frad_conf *conf, int get) +static int sdla_config(struct net_device *dev, struct frad_conf __user *conf, int get) { struct frad_local *flp; struct conf_data data; @@ -1193,7 +1193,7 @@ static int sdla_config(struct net_device *dev, struct frad_conf *conf, int get) return(0); } -static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int read) +static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int read) { struct sdla_mem mem; char *temp; @@ -1271,7 +1271,7 @@ static int sdla_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { case FRAD_GET_CONF: case FRAD_SET_CONF: - return(sdla_config(dev, (struct frad_conf *)ifr->ifr_data, cmd == FRAD_GET_CONF)); + return(sdla_config(dev, ifr->ifr_data, cmd == FRAD_GET_CONF)); case SDLA_IDENTIFY: ifr->ifr_flags = flp->type; @@ -1306,7 +1306,7 @@ NOTE: This is rather a useless action right now, as the case SDLA_WRITEMEM: case SDLA_READMEM: - return(sdla_xfer(dev, (struct sdla_mem *)ifr->ifr_data, cmd == SDLA_READMEM)); + return(sdla_xfer(dev, ifr->ifr_data, cmd == SDLA_READMEM)); case SDLA_START: sdla_start(dev); diff --git a/drivers/net/wd.c b/drivers/net/wd.c index e3fe0a70d..1f7a27c38 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c @@ -43,6 +43,8 @@ static const char version[] = #include "8390.h" +#define DRV_NAME "wd" + /* A zero-terminated list of I/O addresses to be probed. */ static unsigned int wd_portlist[] __initdata = {0x300, 0x280, 0x380, 0x240, 0}; @@ -131,6 +133,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT); } +#ifndef MODULE struct net_device * __init wd_probe(int unit) { struct net_device *dev = alloc_ei_netdev(); @@ -155,6 +158,7 @@ out: free_netdev(dev); return ERR_PTR(err); } +#endif static int __init wd_probe1(struct net_device *dev, int ioaddr) { @@ -300,7 +304,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) /* Snarf the interrupt now. There's no point in waiting since we cannot share and the board will usually be enabled. */ - i = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev); + i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (i) { printk (" unable to get IRQ %d.\n", dev->irq); return i; diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index c9f0e0cb3..40231b6c4 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -861,9 +861,7 @@ typedef struct { #define AIROGMICRID 11 #define AIROGMICSTATS 12 #define AIROGFLAGS 13 -#define AIROGID 14 #define AIRORRID 15 -#define AIRORSWVERSION 17 /* Leave gap of 40 commands after AIROGSTATSD32 for future */ @@ -894,13 +892,10 @@ typedef struct { #define AUXMEMSIZE (256 * 1024) typedef struct aironet_ioctl { - unsigned short command; // What to do + unsigned short command; // What to do unsigned short len; // Len of data - unsigned short ridnum; // rid number unsigned char *data; // d-data } aironet_ioctl; - -static char *swversion = "2.1"; #endif /* CISCO_EXT */ #define NUM_MODULES 2 @@ -1102,7 +1097,6 @@ static int transmit_802_11_packet(struct airo_info*, int len, char *pPacket); static int mpi_send_packet (struct net_device *dev); static void mpi_unmap_card(struct pci_dev *pci); static void mpi_receive_802_3(struct airo_info *ai); -static void mpi_receive_802_11(struct airo_info *ai); static int waitbusy (struct airo_info *ai); static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs @@ -2457,19 +2451,17 @@ static int mpi_init_descriptors (struct airo_info *ai) cmd.parm0 = FID_TX; cmd.parm1 = (ai->txfids[0].card_ram_off - ai->pciaux); cmd.parm2 = MPI_MAX_FIDS; + rc=issuecommand(ai, &cmd, &rsp); + if (rc != SUCCESS) { + printk(KERN_ERR "airo: Couldn't allocate TX FID\n"); + return rc; + } for (i=0; itxfids[i].tx_desc.valid = 1; memcpy((char *)ai->txfids[i].card_ram_off, &ai->txfids[i].tx_desc, sizeof(TxFid)); } - ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */ - - rc=issuecommand(ai, &cmd, &rsp); - if (rc != SUCCESS) { - printk(KERN_ERR "airo: Couldn't allocate TX FID\n"); - return rc; - } /* Alloc card Rid descriptor */ memset(&rsp,0,sizeof(rsp)); @@ -2661,7 +2653,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, return dev; } -int reset_card( struct net_device *dev , int lock) { +int reset_mpi_card( struct net_device *dev , int lock) { struct airo_info *ai = dev->priv; if (lock && down_interruptible(&ai->sem)) @@ -2745,6 +2737,9 @@ struct net_device *_init_airo_card( unsigned short irq, int port, SET_NETDEV_DEV(dev, &pci->dev); } + if (test_bit(FLAG_MPI,&ai->flags)) + reset_mpi_card (dev, 1); + rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); if (rc) { printk(KERN_ERR "airo: register interrupt %d failed, rc %d\n", irq, rc ); @@ -2781,7 +2776,8 @@ struct net_device *_init_airo_card( unsigned short irq, int port, printk(KERN_ERR "airo: Couldn't register_netdev\n"); goto err_out_map; } - ai->wifidev = init_wifidev(ai, dev); + if (!test_bit(FLAG_MPI,&ai->flags)) + ai->wifidev = init_wifidev(ai, dev); set_bit(FLAG_REGISTERED,&ai->flags); printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n", @@ -2844,7 +2840,7 @@ int reset_airo_card( struct net_device *dev ) int i; struct airo_info *ai = dev->priv; - if (reset_card (dev, 1)) + if (reset_mpi_card (dev, 1)) return -1; if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) { @@ -3105,10 +3101,7 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) u16 *buffer; if (test_bit(FLAG_MPI,&apriv->flags)) { - if (test_bit(FLAG_802_11, &apriv->flags)) - mpi_receive_802_11(apriv); - else - mpi_receive_802_3(apriv); + mpi_receive_802_3(apriv); OUT4500(apriv, EVACK, EV_RX); goto exitrx; } @@ -3490,112 +3483,6 @@ badrx: } } -void mpi_receive_802_11 (struct airo_info *ai) -{ - RxFid rxd; - struct sk_buff *skb = NULL; - u16 fc, len, hdrlen = 0; -#pragma pack(1) - struct { - u16 status, len; - u8 rssi[2]; - u8 rate; - u8 freq; - u16 tmp[4]; - } hdr; -#pragma pack() - u16 gap; - u16 *buffer; - char *ptr = ai->rxfids[0].virtual_host_addr+4; - - memcpy ((char *)&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); - memcpy ((char *)&hdr, ptr, sizeof(hdr)); - ptr += sizeof(hdr); - /* Bad CRC. Ignore packet */ - if (le16_to_cpu(hdr.status) & 2) - hdr.len = 0; - if (ai->wifidev == NULL) - hdr.len = 0; - len = le16_to_cpu(hdr.len); - if (len > 2312) { - printk( KERN_ERR "airo: Bad size %d\n", len ); - goto badrx; - } - if (len == 0) - goto badrx; - - memcpy ((char *)&fc, ptr, sizeof(fc)); - fc = le16_to_cpu(fc); - switch (fc & 0xc) { - case 4: - if ((fc & 0xe0) == 0xc0) - hdrlen = 10; - else - hdrlen = 16; - break; - case 8: - if ((fc&0x300)==0x300){ - hdrlen = 30; - break; - } - default: - hdrlen = 24; - } - - skb = dev_alloc_skb( len + hdrlen + 2 ); - if ( !skb ) { - ai->stats.rx_dropped++; - goto badrx; - } - buffer = (u16*)skb_put (skb, len + hdrlen); - memcpy ((char *)buffer, ptr, hdrlen); - ptr += hdrlen; - if (hdrlen == 24) - ptr += 6; - memcpy ((char *)&gap, ptr, sizeof(gap)); - ptr += sizeof(gap); - gap = le16_to_cpu(gap); - if (gap) { - if (gap <= 8) - ptr += gap; - else - printk(KERN_ERR - "airo: gaplen too big. Problems will follow...\n"); - } - memcpy ((char *)buffer + hdrlen, ptr, len); - ptr += len; -#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ - if (ai->spy_data.spy_number > 0) { - char *sa; - struct iw_quality wstats; - /* Prepare spy data : addr + qual */ - sa = (char*)buffer + 10; - wstats.qual = hdr.rssi[0]; - if (ai->rssi) - wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; - else - wstats.level = (hdr.rssi[1] + 321) / 2; - wstats.updated = 3; - /* Update spy records */ - wireless_spy_update(ai->dev, sa, &wstats); - } -#endif /* IW_WIRELESS_SPY */ - skb->mac.raw = skb->data; - skb->pkt_type = PACKET_OTHERHOST; - skb->dev = ai->wifidev; - skb->protocol = htons(ETH_P_802_2); - skb->dev->last_rx = jiffies; - skb->ip_summed = CHECKSUM_NONE; - netif_rx( skb ); -badrx: - if (rxd.valid == 0) { - rxd.valid = 1; - rxd.rdy = 0; - rxd.len = PKTSIZE; - memcpy (ai->rxfids[0].card_ram_off, (char *)&rxd, sizeof(rxd)); - } -} - static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) { Cmd cmd; @@ -3663,16 +3550,10 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) status = readCapabilityRid(ai, &cap_rid, lock); if ( status != SUCCESS ) return ERROR; - /* - * This driver supports MPI350 firmwares up to, and - * including 5.30.17 - */ if (test_bit(FLAG_MPI, &ai->flags) && - strncmp (cap_rid.prodVer, "5.00.", 5) && - strncmp (cap_rid.prodVer, "5b00.", 5) && - strncmp (cap_rid.prodVer, "5.02.", 5) && - strncmp (cap_rid.prodVer, "5.20.", 5) && - strncmp (cap_rid.prodVer, "5.30.", 5)) + strcmp (cap_rid.prodVer, "5.00.01") && + strcmp (cap_rid.prodVer, "5.00.03") && + strcmp (cap_rid.prodVer, "5b00.08")) printk(KERN_ERR "airo: Firmware version %s is not supported. Use it at your own risk!\n", cap_rid.prodVer); status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock); @@ -4053,7 +3934,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, memset(&rsp, 0, sizeof(rsp)); ai->config_desc.rid_desc.valid = 1; - ai->config_desc.rid_desc.len = *((u16 *)pBuf); + ai->config_desc.rid_desc.len = RIDSIZE; ai->config_desc.rid_desc.rid = 0; cmd.cmd = CMD_WRITERID; @@ -5497,6 +5378,7 @@ static int airo_pci_resume(struct pci_dev *pdev) struct net_device *dev = pci_get_drvdata(pdev); struct airo_info *ai = dev->priv; Resp rsp; + int err; printk(KERN_DEBUG "%s: airo_mpi waking up\n", dev->name); @@ -5504,6 +5386,13 @@ static int airo_pci_resume(struct pci_dev *pdev) return 0; if (ai->power > 1) { + err = reset_mpi_card(dev, 0); + if (err) { + printk(KERN_ERR "%s: Error %d resetting on %s()\n", + dev->name, err, __FUNCTION__); + return err; + } + schedule_timeout (HZ/2); mpi_init_descriptors(ai); setup_card(ai, dev->dev_addr, 0); clear_bit(FLAG_RADIO_OFF, &ai->flags); @@ -6897,10 +6786,7 @@ static int airo_config_commit(struct net_device *dev, readAPListRid(local, &APList_rid); readSsidRid(local, &SSID_rid); - if (test_bit(FLAG_MPI,&local->flags)) - setup_card(local, dev->dev_addr, 1 ); - else - reset_airo_card(dev); + reset_airo_card(dev); disable_MAC(local, 1); writeSsidRid(local, &SSID_rid, 1); writeAPListRid(local, &APList_rid, 1); @@ -7060,15 +6946,9 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) /* Separate R/W functions bracket legality here */ - if ( com.command == AIRORSWVERSION ) { - if (copy_to_user(com.data, swversion, sizeof(swversion))) - rc = -EFAULT; - else - rc = 0; - } - else if ( com.command <= AIRORRID) + if ( com.command <= AIRORRID ) rc = readrids(dev,&com); - else if ( com.command >= AIROPCAP && com.command <= (AIROPLEAPUSR+2) ) + else if ( com.command >= AIROPCAP && com.command <= AIROPLEAPUSR ) rc = writerids(dev,&com); else if ( com.command >= AIROFLSHRST && com.command <= AIRORESTART ) rc = flashcard(dev,&com); @@ -7198,7 +7078,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { return -EFAULT; return 0; #endif - case AIRORRID: ridcode = comp->ridnum; break; + case AIRORRID: ridcode = comp->len; break; default: return -EINVAL; break; @@ -7212,7 +7092,10 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { * then return it to the user * 9/22/2000 Honor user given length */ - len = comp->len; + if (comp->command == AIRORRID) + len = le16_to_cpu(*(unsigned short *)iobuf); /* Yuck! */ + else + len = comp->len; if (copy_to_user(comp->data, iobuf, min(len, (int)RIDSIZE))) { kfree (iobuf); @@ -7258,8 +7141,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { case AIROPLEAPPWD: ridcode = RID_LEAPPASSWORD; break; case AIROPWEPKEY: ridcode = RID_WEP_TEMP; writer = PC4500_writerid; break; - case AIROPLEAPUSR+1: ridcode = 0xFF2A; break; - case AIROPLEAPUSR+2: ridcode = 0xFF2B; break; /* this is not really a rid but a command given to the card * same with MAC off diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index 2e669a643..dd5066037 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -25,17 +25,11 @@ #include #include -#include "isl_38xx.h" -#include - #include #include -#include -#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE) -#error No Firmware Loading configured in the kernel ! -#endif - +#include "prismcompat.h" +#include "isl_38xx.h" #include "islpci_dev.h" #include "islpci_mgt.h" @@ -235,130 +229,6 @@ isl38xx_enable_common_interrupts(void *device_base) { udelay(ISL38XX_WRITEIO_DELAY); } -int -isl38xx_upload_firmware(char *fw_id, _REQ_FW_DEV_T dev, void *device_base, - dma_addr_t host_address) -{ - u32 reg, rc; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_ERROR_MESSAGES, "isl38xx_upload_firmware(0x%lx, 0x%lx)\n", - (long) device_base, (long) host_address); -#endif - - /* clear the RAMBoot and the Reset bit */ - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - reg &= ~ISL38XX_CTRL_STAT_RESET; - reg &= ~ISL38XX_CTRL_STAT_RAMBOOT; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* set the Reset bit without reading the register ! */ - reg |= ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* clear the Reset bit */ - reg &= ~ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - - /* wait a while for the device to reboot */ - mdelay(50); - - { - const struct firmware *fw_entry = 0; - long fw_len; - const u32 *fw_ptr; - - rc = request_firmware(&fw_entry, fw_id, dev); - if (rc) { - printk(KERN_ERR - "%s: request_firmware() failed for '%s'\n", - "prism54", fw_id); - return rc; - } - /* prepare the Direct Memory Base register */ - reg = ISL38XX_DEV_FIRMWARE_ADDRES; - - fw_ptr = (u32 *) fw_entry->data; - fw_len = fw_entry->size; - - if (fw_len % 4) { - printk(KERN_ERR - "%s: firmware '%s' size is not multiple of 32bit, aborting!\n", - "prism54", fw_id); - release_firmware(fw_entry); - return EILSEQ; /* Illegal byte sequence */; - } - - while (fw_len > 0) { - long _fw_len = - (fw_len > - ISL38XX_MEMORY_WINDOW_SIZE) ? - ISL38XX_MEMORY_WINDOW_SIZE : fw_len; - u32 *dev_fw_ptr = device_base + ISL38XX_DIRECT_MEM_WIN; - - /* set the cards base address for writting the data */ - isl38xx_w32_flush(device_base, reg, - ISL38XX_DIR_MEM_BASE_REG); - wmb(); /* be paranoid */ - - /* increment the write address for next iteration */ - reg += _fw_len; - fw_len -= _fw_len; - - /* write the data to the Direct Memory Window 32bit-wise */ - /* memcpy_toio() doesn't guarantee 32bit writes :-| */ - while (_fw_len > 0) { - /* use non-swapping writel() */ - __raw_writel(*fw_ptr, dev_fw_ptr); - fw_ptr++, dev_fw_ptr++; - _fw_len -= 4; - } - - /* flush PCI posting */ - (void) readl(device_base + ISL38XX_PCI_POSTING_FLUSH); - wmb(); /* be paranoid again */ - - BUG_ON(_fw_len != 0); - } - - BUG_ON(fw_len != 0); - - release_firmware(fw_entry); - } - - /* now reset the device - * clear the Reset & ClkRun bit, set the RAMBoot bit */ - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - reg &= ~ISL38XX_CTRL_STAT_CLKRUN; - reg &= ~ISL38XX_CTRL_STAT_RESET; - reg |= ISL38XX_CTRL_STAT_RAMBOOT; - isl38xx_w32_flush(device_base, reg, ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* set the reset bit latches the host override and RAMBoot bits - * into the device for operation when the reset bit is reset */ - reg |= ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - /* don't do flush PCI posting here! */ - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* clear the reset bit should start the whole circus */ - reg &= ~ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - /* don't do flush PCI posting here! */ - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - return 0; -} - int isl38xx_in_queue(isl38xx_control_block *cb, int queue) { diff --git a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h index 5f644836f..0bd5ff6ad 100644 --- a/drivers/net/wireless/prism54/isl_38xx.h +++ b/drivers/net/wireless/prism54/isl_38xx.h @@ -22,14 +22,6 @@ #include #include - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,75)) -#include -# define _REQ_FW_DEV_T struct device * -#else -# define _REQ_FW_DEV_T char * -#endif - #include #define ISL38XX_CB_RX_QSIZE 8 @@ -174,6 +166,4 @@ void isl38xx_handle_wakeup(isl38xx_control_block *, int *, void *); void isl38xx_trigger_device(int, void *); void isl38xx_interface_reset(void *, dma_addr_t); -int isl38xx_upload_firmware(char *, _REQ_FW_DEV_T, void *, dma_addr_t); - #endif /* _ISL_38XX_H */ diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 426fc2e3e..dc84928d9 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c @@ -25,10 +25,10 @@ #include #include #include -#include #include +#include "prismcompat.h" #include "isl_ioctl.h" #include "islpci_mgt.h" #include "isl_oid.h" /* additional types and defs for isl38xx fw */ @@ -166,21 +166,13 @@ prism54_mib_init(islpci_private *priv) * for it save old values */ if (init_mode > IW_MODE_MONITOR || init_mode < IW_MODE_AUTO) { printk(KERN_DEBUG "%s(): You passed a non-valid init_mode. " - "Using default mode\n", __FUNCTION__); + "Using default mode\n", __FUNCTION__); init_mode = CARD_DEFAULT_IW_MODE; } /* This sets all of the mode-dependent values */ prism54_mib_mode_helper(priv, init_mode); } -void -prism54_mib_init_work(islpci_private *priv) -{ - down_write(&priv->mib_sem); - mgt_commit(priv); - up_write(&priv->mib_sem); -} - /* this will be executed outside of atomic context thanks to * schedule_work(), thus we can as well use sleeping semaphore * locking */ @@ -195,16 +187,9 @@ prism54_update_stats(islpci_private *priv) if (down_interruptible(&priv->stats_sem)) return; -/* missing stats are : - * iwstatistics.qual.updated - * iwstatistics.discard.nwid - * iwstatistics.discard.fragment - * iwstatistics.discard.misc - * iwstatistics.miss.beacon */ - /* Noise floor. * I'm not sure if the unit is dBm. - * Note : If we are not connected, this value seems to be irrevelant. */ + * Note : If we are not connected, this value seems to be irrelevant. */ mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r); priv->local_iwstatistics.qual.noise = r.u; @@ -216,8 +201,7 @@ prism54_update_stats(islpci_private *priv) data = r.ptr; /* copy this MAC to the bss */ - for (j = 0; j < 6; j++) - bss.address[j] = data[j]; + memcpy(bss.address, data, 6); kfree(data); /* now ask for the corresponding bss */ @@ -426,7 +410,6 @@ prism54_set_sens(struct net_device *ndev, struct iw_request_info *info, /* by default the card sets this to 20. */ sens = vwrq->disabled ? 20 : vwrq->value; - /* set the ed threshold. */ return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens); } @@ -505,7 +488,7 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, return 0; /* Request the device for the supported frequencies - * not really revelant since some devices will report the 5 GHz band + * not really relevant since some devices will report the 5 GHz band * frequencies even if they don't support them. */ rvalue = @@ -515,21 +498,12 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, range->num_channels = freq->nr; range->num_frequency = freq->nr; - /* Frequencies are not listed in the right order. The reordering is probably - * firmware dependant and thus should work for everyone. - */ m = min(IW_MAX_FREQUENCIES, (int) freq->nr); - for (i = 0; i < m - 12; i++) { - range->freq[i].m = freq->mhz[12 + i]; + for (i = 0; i < m; i++) { + range->freq[i].m = freq->mhz[i]; range->freq[i].e = 6; - range->freq[i].i = i + 1; + range->freq[i].i = channel_of_freq(freq->mhz[i]); } - for (i = m - 12; i < m; i++) { - range->freq[i].m = freq->mhz[i - m + 12]; - range->freq[i].e = 6; - range->freq[i].i = i + 23; - } - kfree(freq); rvalue |= mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r); @@ -544,9 +518,7 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, i++; data++; } - range->num_bitrates = i; - kfree(r.ptr); return rvalue; @@ -585,7 +557,6 @@ prism54_get_wap(struct net_device *ndev, struct iw_request_info *info, int rvalue; rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r); - memcpy(awrq->sa_data, r.ptr, 6); awrq->sa_family = ARPHRD_ETHER; kfree(r.ptr); @@ -658,8 +629,8 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL); /* Add frequency. (short) bss->channel is the frequency in MHz */ - iwe.u.freq.m = bss->channel; - iwe.u.freq.e = 6; + iwe.u.freq.m = channel_of_freq(bss->channel); + iwe.u.freq.e = 0; iwe.cmd = SIOCGIWFREQ; current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); @@ -695,7 +666,6 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, kfree(buf); } } - return current_ev; } @@ -722,7 +692,7 @@ prism54_get_scan(struct net_device *ndev, struct iw_request_info *info, /* Ask the device for a list of known bss. We can report at most * IW_MAX_AP=64 to the range struct. But the device won't repport anything - * if you change the value of MAXBSS=24. Anyway 24 AP It is probably enough. + * if you change the value of IWMAX_BSS=24. */ rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); bsslist = r.ptr; @@ -757,7 +727,7 @@ prism54_set_essid(struct net_device *ndev, struct iw_request_info *info, memcpy(essid.octets, extra, dwrq->length); } else essid.length = 0; - + if (priv->iw_mode != IW_MODE_MONITOR) return mgt_set_request(priv, DOT11_OID_SSID, 0, &essid); @@ -843,21 +813,21 @@ prism54_set_rate(struct net_device *ndev, char *data; int ret, i; union oid_res_t r; - + if (vwrq->value == -1) { /* auto mode. No limit. */ profile = 1; return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); } - + if ((ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r))) return ret; - + rate = (u32) (vwrq->value / 500000); data = r.ptr; i = 0; - + while (data[i]) { if (rate && (data[i] == rate)) { break; @@ -868,14 +838,14 @@ prism54_set_rate(struct net_device *ndev, data[i] |= 0x80; i++; } - + if (!data[i]) { return -EINVAL; } - + data[i] |= 0x80; data[i + 1] = 0; - + /* Now, check if we want a fixed or auto value */ if (vwrq->fixed) { data[0] = data[i]; @@ -890,14 +860,14 @@ prism54_set_rate(struct net_device *ndev, i++; } printk("0\n"); -*/ +*/ profile = -1; ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data); ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data); - + kfree(r.ptr); - + return ret; } @@ -923,7 +893,7 @@ prism54_get_rate(struct net_device *ndev, data = r.ptr; vwrq->fixed = (data[0] != 0) && (data[1] == 0); kfree(r.ptr); - + return 0; } @@ -979,8 +949,6 @@ prism54_get_frag(struct net_device *ndev, struct iw_request_info *info, * small frame <=> smaller than the rts threshold * This is not really the behavior expected by the wireless tool but it seems * to be a common behavior in other drivers. - * - * It seems that playing with this tends to hang the card -> DISABLED */ static int @@ -1012,18 +980,16 @@ prism54_set_retry(struct net_device *ndev, struct iw_request_info *info, lifetime = vwrq->value / 1024; /* now set what is requested */ - - if (slimit != 0) + if (slimit) rvalue = mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit); - if (llimit != 0) + if (llimit) rvalue |= mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit); - if (lifetime != 0) + if (lifetime) rvalue |= mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0, &lifetime); - return rvalue; } @@ -1119,8 +1085,7 @@ prism54_set_encode(struct net_device *ndev, struct iw_request_info *info, } } } - - /* now read the flags */ + /* now read the flags */ if (dwrq->flags & IW_ENCODE_DISABLED) { /* Encoding disabled, * authen = DOT11_AUTH_OS; @@ -1269,13 +1234,8 @@ prism54_get_oid(struct net_device *ndev, struct iw_request_info *info, static int prism54_set_u32(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) + __u32 * uwrq, char *extra) { - /* - u32 *i = (int *) extra; - int param = *i; - int u = *(i + 1); - */ u32 oid = uwrq[0], u = uwrq[1]; return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u); @@ -1846,9 +1806,7 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, 0); break; - /* Note : the following should never happen since we don't run the card in - * extended mode. - * Note : "mlme" is actually a "struct obj_mlmeex *" here, but this + /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this * is backward compatible layout-wise with "struct obj_mlme". */ @@ -1893,7 +1851,8 @@ prism54_process_trap(void *data) struct net_device *ndev = frame->ndev; enum oid_num_t n = mgt_oidtonum(frame->header->oid); - prism54_process_trap_helper(netdev_priv(ndev), n, frame->data); + if (n != OID_NUM_LAST) + prism54_process_trap_helper(netdev_priv(ndev), n, frame->data); islpci_mgt_release(frame); } @@ -1965,66 +1924,12 @@ prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info, return 0; } -int -prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 max_burst; - - max_burst = (*uwrq) ? *uwrq : CARD_DEFAULT_MAXFRAMEBURST; - mgt_set_request(priv, DOT11_OID_MAXFRAMEBURST, 0, &max_burst); - - return -EINPROGRESS; /* Call commit handler */ -} - -int -prism54_get_maxframeburst(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_MAXFRAMEBURST, 0, NULL, &r); - *uwrq = r.u; - - return rvalue; -} - -int -prism54_set_profile(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 profile; - - profile = (*uwrq) ? *uwrq : CARD_DEFAULT_PROFILE; - mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); - - return -EINPROGRESS; /* Call commit handler */ -} - -int -prism54_get_profile(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_PROFILES, 0, NULL, &r); - *uwrq = r.u; - - return rvalue; -} - int prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info, __u32 * uwrq, char *extra) { islpci_private *priv = netdev_priv(ndev); - + priv->priv_oid = *uwrq; printk("%s: oid 0x%08X\n", ndev->name, *uwrq); @@ -2033,15 +1938,15 @@ prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info, int prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_point *data, char *extra) { islpci_private *priv = netdev_priv(ndev); struct islpci_mgmtframe *response = NULL; int ret = -EIO, response_op = PIMFOR_OP_ERROR; - + printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid); data->length = 0; - + if (islpci_get_state(priv) >= PRV_STATE_INIT) { ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, @@ -2065,21 +1970,21 @@ prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info, printk("%s: len: %i\n", ndev->name, data->length); } } - + return ret; } int prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_point *data, char *extra) { islpci_private *priv = netdev_priv(ndev); struct islpci_mgmtframe *response = NULL; int ret = 0, response_op = PIMFOR_OP_ERROR; - + printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, data->length); - + if (islpci_get_state(priv) >= PRV_STATE_INIT) { ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, @@ -2094,11 +1999,11 @@ prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info, } if (ret || response_op == PIMFOR_OP_ERROR) { printk("%s: EIO\n", ndev->name); - ret = -EIO; + ret = -EIO; } } - - return ret; + + return (ret ? ret : -EINPROGRESS); } static int @@ -2196,7 +2101,7 @@ static const iw_handler prism54_handler[] = { #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16 -#define PRISM54_GET_OID SIOCIWFIRSTPRIV+17 +#define PRISM54_GET_OID SIOCIWFIRSTPRIV+17 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22 @@ -2204,16 +2109,16 @@ static const iw_handler prism54_handler[] = { #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24 -#define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } -#define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } -#define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x } -#define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "get_"x } +#define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } +#define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } +#define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } +#define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x } #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x) #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x) #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x) -/* Note : limited to 128 private ioctls */ +/* Note : limited to 128 private ioctls (wireless tools 26) */ static const struct iw_priv_args prism54_private_args[] = { /*{ cmd, set_args, get_args, name } */ @@ -2241,7 +2146,7 @@ static const struct iw_priv_args prism54_private_args[] = { {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dbg_oid"}, {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"}, - {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"}, + {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"}, /* --- sub-ioctls handlers --- */ {PRISM54_GET_OID, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""}, @@ -2268,7 +2173,7 @@ static const struct iw_priv_args prism54_private_args[] = { IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"), IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"), IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"), - + IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"), IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"), @@ -2351,5 +2256,6 @@ const struct iw_handler_def prism54_handler_def = { int prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) { + return -EOPNOTSUPP; } diff --git a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h index d5170c478..3320338e2 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.h +++ b/drivers/net/wireless/prism54/isl_ioctl.h @@ -30,7 +30,6 @@ #define SUPPORTED_WIRELESS_EXT 16 void prism54_mib_init(islpci_private *); -void prism54_mib_init_work(islpci_private *); struct iw_statistics *prism54_get_wireless_stats(struct net_device *); void prism54_update_stats(islpci_private *); diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 157193918..b980edccf 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c @@ -30,6 +30,7 @@ #include +#include "prismcompat.h" #include "isl_38xx.h" #include "isl_ioctl.h" #include "islpci_dev.h" @@ -37,12 +38,6 @@ #include "islpci_eth.h" #include "oid_mgt.h" -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0) -#define prism54_synchronize_irq(irq) synchronize_irq() -#else -#define prism54_synchronize_irq(irq) synchronize_irq(irq) -#endif - #define ISL3877_IMAGE_FILE "isl3877" #define ISL3890_IMAGE_FILE "isl3890" @@ -55,6 +50,125 @@ * ndev->set_mac_address. Jean II */ const unsigned char dummy_mac[6] = { 0x00, 0x30, 0xB4, 0x00, 0x00, 0x00 }; +static int +isl_upload_firmware(islpci_private *priv) +{ + u32 reg, rc; + void *device_base = priv->device_base; + + /* clear the RAMBoot and the Reset bit */ + reg = readl(device_base + ISL38XX_CTRL_STAT_REG); + reg &= ~ISL38XX_CTRL_STAT_RESET; + reg &= ~ISL38XX_CTRL_STAT_RAMBOOT; + writel(reg, device_base + ISL38XX_CTRL_STAT_REG); + wmb(); + udelay(ISL38XX_WRITEIO_DELAY); + + /* set the Reset bit without reading the register ! */ + reg |= ISL38XX_CTRL_STAT_RESET; + writel(reg, device_base + ISL38XX_CTRL_STAT_REG); + wmb(); + udelay(ISL38XX_WRITEIO_DELAY); + + /* clear the Reset bit */ + reg &= ~ISL38XX_CTRL_STAT_RESET; + writel(reg, device_base + ISL38XX_CTRL_STAT_REG); + wmb(); + + /* wait a while for the device to reboot */ + mdelay(50); + + { + const struct firmware *fw_entry = 0; + long fw_len; + const u32 *fw_ptr; + + rc = request_firmware(&fw_entry, priv->firmware, PRISM_FW_PDEV); + if (rc) { + printk(KERN_ERR + "%s: request_firmware() failed for '%s'\n", + "prism54", priv->firmware); + return rc; + } + /* prepare the Direct Memory Base register */ + reg = ISL38XX_DEV_FIRMWARE_ADDRES; + + fw_ptr = (u32 *) fw_entry->data; + fw_len = fw_entry->size; + + if (fw_len % 4) { + printk(KERN_ERR + "%s: firmware '%s' size is not multiple of 32bit, aborting!\n", + "prism54", priv->firmware); + release_firmware(fw_entry); + return EILSEQ; /* Illegal byte sequence */; + } + + while (fw_len > 0) { + long _fw_len = + (fw_len > + ISL38XX_MEMORY_WINDOW_SIZE) ? + ISL38XX_MEMORY_WINDOW_SIZE : fw_len; + u32 *dev_fw_ptr = device_base + ISL38XX_DIRECT_MEM_WIN; + + /* set the cards base address for writting the data */ + isl38xx_w32_flush(device_base, reg, + ISL38XX_DIR_MEM_BASE_REG); + wmb(); /* be paranoid */ + + /* increment the write address for next iteration */ + reg += _fw_len; + fw_len -= _fw_len; + + /* write the data to the Direct Memory Window 32bit-wise */ + /* memcpy_toio() doesn't guarantee 32bit writes :-| */ + while (_fw_len > 0) { + /* use non-swapping writel() */ + __raw_writel(*fw_ptr, dev_fw_ptr); + fw_ptr++, dev_fw_ptr++; + _fw_len -= 4; + } + + /* flush PCI posting */ + (void) readl(device_base + ISL38XX_PCI_POSTING_FLUSH); + wmb(); /* be paranoid again */ + + BUG_ON(_fw_len != 0); + } + + BUG_ON(fw_len != 0); + + release_firmware(fw_entry); + } + + /* now reset the device + * clear the Reset & ClkRun bit, set the RAMBoot bit */ + reg = readl(device_base + ISL38XX_CTRL_STAT_REG); + reg &= ~ISL38XX_CTRL_STAT_CLKRUN; + reg &= ~ISL38XX_CTRL_STAT_RESET; + reg |= ISL38XX_CTRL_STAT_RAMBOOT; + isl38xx_w32_flush(device_base, reg, ISL38XX_CTRL_STAT_REG); + wmb(); + udelay(ISL38XX_WRITEIO_DELAY); + + /* set the reset bit latches the host override and RAMBoot bits + * into the device for operation when the reset bit is reset */ + reg |= ISL38XX_CTRL_STAT_RESET; + writel(reg, device_base + ISL38XX_CTRL_STAT_REG); + /* don't do flush PCI posting here! */ + wmb(); + udelay(ISL38XX_WRITEIO_DELAY); + + /* clear the reset bit should start the whole circus */ + reg &= ~ISL38XX_CTRL_STAT_RESET; + writel(reg, device_base + ISL38XX_CTRL_STAT_REG); + /* don't do flush PCI posting here! */ + wmb(); + udelay(ISL38XX_WRITEIO_DELAY); + + return 0; +} + /****************************************************************************** Device Interrupt Handler ******************************************************************************/ @@ -74,7 +188,9 @@ islpci_interrupt(int irq, void *config, struct pt_regs *regs) if (reg & ISL38XX_CTRL_STAT_SLEEPMODE) /* device is in sleep mode, IRQ was generated by someone else */ { - printk(KERN_DEBUG "Assuming someone else called the IRQ\n"); +#if VERBOSE > SHOW_ERROR_MESSAGES + DEBUG(SHOW_TRACING, "Assuming someone else called the IRQ\n"); +#endif return IRQ_NONE; } @@ -324,14 +440,7 @@ islpci_upload_fw(islpci_private *priv) printk(KERN_DEBUG "%s: uploading firmware...\n", priv->ndev->name); - rc = isl38xx_upload_firmware(priv->firmware, -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,75)) - &priv->pdev->dev, -#else - pci_name(priv->pdev), -#endif - priv->device_base, - priv->device_host_address); + rc = isl_upload_firmware(priv); if (rc) { /* error uploading the firmware */ printk(KERN_ERR "%s: could not upload firmware ('%s')\n", @@ -357,15 +466,8 @@ islpci_reset_if(islpci_private *priv) int result = -ETIME; int count; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - /* This is 2.6 specific, nicer, shorter, but not in 2.4 yet */ DEFINE_WAIT(wait); prepare_to_wait(&priv->reset_done, &wait, TASK_UNINTERRUPTIBLE); -#else - DECLARE_WAITQUEUE(wait, current); - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&priv->reset_done, &wait); -#endif /* now the last step is to reset the interface */ isl38xx_interface_reset(priv->device_base, priv->device_host_address); @@ -390,13 +492,7 @@ islpci_reset_if(islpci_private *priv) } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - /* 2.6 specific too */ finish_wait(&priv->reset_done, &wait); -#else - remove_wait_queue(&priv->reset_done, &wait); - set_current_state(TASK_RUNNING); -#endif if(result) return result; @@ -410,7 +506,9 @@ islpci_reset_if(islpci_private *priv) * the IRQ line until we know for sure the reset went through */ isl38xx_enable_common_interrupts(priv->device_base); - prism54_mib_init_work(priv); + down_write(&priv->mib_sem); + mgt_commit(priv); + up_write(&priv->mib_sem); islpci_set_state(priv, PRV_STATE_READY); @@ -448,9 +546,9 @@ islpci_reset(islpci_private *priv, int reload_firmware) /* reset the mgmt receive queue */ for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) { isl38xx_fragment *frag = &cb->rx_data_mgmt[counter]; - frag->size = MGMT_FRAME_SIZE; + frag->size = cpu_to_le16(MGMT_FRAME_SIZE); frag->flags = 0; - frag->address = priv->mgmt_rx[counter].pci_addr; + frag->address = cpu_to_le32(priv->mgmt_rx[counter].pci_addr); } for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) { @@ -580,6 +678,7 @@ islpci_alloc_memory(islpci_private *priv) skb = NULL; goto out_free; } + skb_reserve(skb, (4 - (long) skb->data) & 0x03); /* add the new allocated sk_buff to the buffer array */ priv->data_low_rx[counter] = skb; diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index de92b4ea6..19fbd6bfd 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h @@ -29,20 +29,6 @@ #include #include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) -# include -#else -# include -# define work_struct tq_struct -# define INIT_WORK INIT_TQUEUE -# define schedule_work schedule_task -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) -#define free_netdev(x) kfree(x) -#define pci_name(x) x->slot_name -#endif - #include "isl_38xx.h" #include "isl_oid.h" #include "islpci_mgt.h" @@ -187,7 +173,7 @@ typedef struct { islpci_state_t state; int state_off; /* enumeration of off-state, if 0 then * we're not in any off-state */ - + /* WPA stuff */ int wpa; /* WPA mode enabled */ struct list_head bss_wpa_list; @@ -210,12 +196,6 @@ islpci_state_t islpci_set_state(islpci_private *priv, islpci_state_t new_state); #define ISLPCI_TX_TIMEOUT (2*HZ) -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,75)) -# define irqreturn_t void -# define IRQ_HANDLED -# define IRQ_NONE -#endif - irqreturn_t islpci_interrupt(int, void *, struct pt_regs *); int prism54_post_setup(islpci_private *, int); diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index c18c42d0c..4f82bfa1e 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c @@ -26,6 +26,7 @@ #include #include +#include "prismcompat.h" #include "isl_38xx.h" #include "islpci_eth.h" #include "islpci_mgt.h" @@ -104,7 +105,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) /* check whether the destination queue has enough fragments for the frame */ curr_frag = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ]); - if (curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE) { + if (unlikely(curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE)) { printk(KERN_ERR "%s: transmit device queue full when awake\n", ndev->name); netif_stop_queue(ndev); @@ -120,7 +121,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) /* Check alignment and WDS frame formatting. The start of the packet should * be aligned on a 4-byte boundary. If WDS is enabled add another 6 bytes * and add WDS address information */ - if (((long) skb->data & 0x03) | init_wds) { + if (unlikely(((long) skb->data & 0x03) | init_wds)) { /* get the number of bytes to add and re-allign */ offset = (4 - (long) skb->data) & 0x03; offset += init_wds ? 6 : 0; @@ -191,7 +192,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) pci_map_address = pci_map_single(priv->pdev, (void *) skb->data, skb->len, PCI_DMA_TODEVICE); - if (pci_map_address == 0) { + if (unlikely(pci_map_address == 0)) { printk(KERN_WARNING "%s: cannot map buffer to PCI\n", ndev->name); @@ -207,7 +208,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) priv->data_low_tx[index] = skb; /* set the proper fragment start address and size information */ fragment->size = cpu_to_le16(frame_size); - fragment->flags = cpu_to_le16(0); /* set to 1 if more fragments */ + fragment->flags = cpu_to_le16(0); /* set to 1 if more fragments */ fragment->address = cpu_to_le32(pci_map_address); curr_frag++; @@ -217,7 +218,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ] = cpu_to_le32(curr_frag); if (curr_frag - priv->free_data_tx + ISL38XX_MIN_QTHRESHOLD - > ISL38XX_CB_TX_QSIZE) { + > ISL38XX_CB_TX_QSIZE) { /* stop sends from upper layers */ netif_stop_queue(ndev); @@ -238,7 +239,7 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) return 0; - drop_free: + drop_free: /* free the skbuf structure before aborting */ dev_kfree_skb(skb); skb = NULL; @@ -261,9 +262,9 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) { struct avs_80211_1_header *avs; /* extract the relevant data from the header */ - u32 clock = hdr->clock; + u32 clock = le32_to_cpu(hdr->clock); u8 rate = hdr->rate; - u16 freq = be16_to_cpu(hdr->freq); + u16 freq = le16_to_cpu(hdr->freq); u8 rssi = hdr->rssi; skb_pull(*skb, sizeof (struct rfmon_header)); @@ -274,7 +275,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) avs_80211_1_header), 0, GFP_ATOMIC); if (newskb) { - kfree_skb(*skb); + dev_kfree_skb_irq(*skb); *skb = newskb; } else return -1; @@ -286,21 +287,21 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) (struct avs_80211_1_header *) skb_push(*skb, sizeof (struct avs_80211_1_header)); - - avs->version = htonl(P80211CAPTURE_VERSION); - avs->length = htonl(sizeof (struct avs_80211_1_header)); - avs->mactime = __cpu_to_be64(clock); - avs->hosttime = __cpu_to_be64(jiffies); - avs->phytype = htonl(6); /*OFDM: 6 for (g), 8 for (a) */ - avs->channel = htonl(channel_of_freq(freq)); - avs->datarate = htonl(rate * 5); - avs->antenna = htonl(0); /*unknown */ - avs->priority = htonl(0); /*unknown */ - avs->ssi_type = htonl(2); /*2: dBm, 3: raw RSSI */ - avs->ssi_signal = htonl(rssi); - avs->ssi_noise = htonl(priv->local_iwstatistics.qual.noise); /*better than 'undefined', I assume */ - avs->preamble = htonl(0); /*unknown */ - avs->encoding = htonl(0); /*unknown */ + + avs->version = cpu_to_be32(P80211CAPTURE_VERSION); + avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); + avs->mactime = cpu_to_be64(le64_to_cpu(clock)); + avs->hosttime = cpu_to_be64(jiffies); + avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */ + avs->channel = cpu_to_be32(channel_of_freq(freq)); + avs->datarate = cpu_to_be32(rate * 5); + avs->antenna = cpu_to_be32(0); /*unknown */ + avs->priority = cpu_to_be32(0); /*unknown */ + avs->ssi_type = cpu_to_be32(3); /*2: dBm, 3: raw RSSI */ + avs->ssi_signal = cpu_to_be32(rssi & 0x7f); + avs->ssi_noise = cpu_to_be32(priv->local_iwstatistics.qual.noise); /*better than 'undefined', I assume */ + avs->preamble = cpu_to_be32(0); /*unknown */ + avs->encoding = cpu_to_be32(0); /*unknown */ } else skb_pull(*skb, sizeof (struct rfmon_header)); @@ -381,10 +382,10 @@ islpci_eth_receive(islpci_private *priv) skb->dev = ndev; /* take care of monitor mode and spy monitoring. */ - if (priv->iw_mode == IW_MODE_MONITOR) + if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) discard = islpci_monitor_rx(priv, &skb); else { - if (skb->data[2 * ETH_ALEN] == 0) { + if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { /* The packet has a rx_annex. Read it for spy monitoring, Then * remove it, while keeping the 2 leading MAC addr. */ @@ -417,8 +418,8 @@ islpci_eth_receive(islpci_private *priv) skb->data[0], skb->data[1], skb->data[2], skb->data[3], skb->data[4], skb->data[5]); #endif - if (discard) { - dev_kfree_skb(skb); + if (unlikely(discard)) { + dev_kfree_skb_irq(skb); skb = NULL; } else netif_rx(skb); @@ -433,11 +434,13 @@ islpci_eth_receive(islpci_private *priv) index - priv->free_data_rx < ISL38XX_CB_RX_QSIZE) { /* allocate an sk_buff for received data frames storage * include any required allignment operations */ - if (skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2), skb == NULL) { + skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2); + if (unlikely(skb == NULL)) { /* error allocating an sk_buff structure elements */ DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb \n"); break; } + skb_reserve(skb, (4 - (long) skb->data) & 0x03); /* store the new skb structure pointer */ index = index % ISL38XX_CB_RX_QSIZE; priv->data_low_rx[index] = skb; @@ -453,13 +456,13 @@ islpci_eth_receive(islpci_private *priv) pci_map_single(priv->pdev, (void *) skb->data, MAX_FRAGMENT_SIZE_RX + 2, PCI_DMA_FROMDEVICE); - if (priv->pci_map_rx_address[index] == (dma_addr_t) NULL) { + if (unlikely(priv->pci_map_rx_address[index] == (dma_addr_t) NULL)) { /* error mapping the buffer to device accessable memory address */ DEBUG(SHOW_ERROR_MESSAGES, "Error mapping DMA address\n"); /* free the skbuf structure before aborting */ - dev_kfree_skb((struct sk_buff *) skb); + dev_kfree_skb_irq((struct sk_buff *) skb); skb = NULL; break; } @@ -484,10 +487,10 @@ islpci_eth_receive(islpci_private *priv) void islpci_do_reset_and_wake(void *data) { - islpci_private *priv = (islpci_private *) data; - islpci_reset(priv, 1); - netif_wake_queue(priv->ndev); - priv->reset_task_pending = 0; + islpci_private *priv = (islpci_private *) data; + islpci_reset(priv, 1); + netif_wake_queue(priv->ndev); + priv->reset_task_pending = 0; } void diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index 34b3b59fe..3fe59fb8f 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c @@ -24,12 +24,13 @@ #include #include /* For __init, __exit */ +#include "prismcompat.h" #include "islpci_dev.h" #include "islpci_mgt.h" /* for pc_debug */ #include "isl_oid.h" #define DRV_NAME "prism54" -#define DRV_VERSION "1.1" +#define DRV_VERSION "1.2" MODULE_AUTHOR("[Intersil] R.Bastings and W.Termorshuizen, The prism54.org Development Team "); MODULE_DESCRIPTION("The Prism54 802.11 Wireless LAN adapter"); diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c index bdf77d6c5..58cd35864 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ b/drivers/net/wireless/prism54/islpci_mgt.c @@ -22,12 +22,12 @@ #include #include #include -#include #include #include #include +#include "prismcompat.h" #include "isl_38xx.h" #include "islpci_mgt.h" #include "isl_oid.h" /* additional types and defs for isl38xx fw */ @@ -63,7 +63,6 @@ display_buffer(char *buffer, int length) Queue handling for management frames ******************************************************************************/ - /* * Helper function to create a PIMFOR management frame header. */ @@ -86,8 +85,8 @@ pimfor_decode_header(void *data, int len) { pimfor_header_t *h = data; - while ((void *) h < data + len) { - if(h->flags & PIMFOR_FLAG_LITTLE_ENDIAN) { + while ((void *) h < data + len) { + if (h->flags & PIMFOR_FLAG_LITTLE_ENDIAN) { le32_to_cpus(&h->oid); le32_to_cpus(&h->length); } else { @@ -108,8 +107,8 @@ int islpci_mgmt_rx_fill(struct net_device *ndev) { islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = /* volatile not needed */ - (isl38xx_control_block *) priv->control_block; + isl38xx_control_block *cb = /* volatile not needed */ + (isl38xx_control_block *) priv->control_block; u32 curr = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_RX_MGMTQ]); #if VERBOSE > SHOW_ERROR_MESSAGES @@ -124,7 +123,8 @@ islpci_mgmt_rx_fill(struct net_device *ndev) if (buf->mem == NULL) { buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC); if (!buf->mem) { - printk(KERN_WARNING "Error allocating management frame.\n"); + printk(KERN_WARNING + "Error allocating management frame.\n"); return -ENOMEM; } buf->size = MGMT_FRAME_SIZE; @@ -133,24 +133,24 @@ islpci_mgmt_rx_fill(struct net_device *ndev) buf->pci_addr = pci_map_single(priv->pdev, buf->mem, MGMT_FRAME_SIZE, PCI_DMA_FROMDEVICE); - if(!buf->pci_addr) { - printk(KERN_WARNING "Failed to make memory DMA'able\n."); + if (!buf->pci_addr) { + printk(KERN_WARNING + "Failed to make memory DMA'able\n."); return -ENOMEM; } } - /* be safe: always reset control block information */ + /* be safe: always reset control block information */ frag->size = cpu_to_le16(MGMT_FRAME_SIZE); frag->flags = 0; frag->address = cpu_to_le32(buf->pci_addr); curr++; - /* The fragment address in the control block must have - * been written before announcing the frame buffer to - * device */ + /* The fragment address in the control block must have + * been written before announcing the frame buffer to + * device */ wmb(); - cb->driver_curr_frag[ISL38XX_CB_RX_MGMTQ] = - cpu_to_le32(curr); + cb->driver_curr_frag[ISL38XX_CB_RX_MGMTQ] = cpu_to_le32(curr); } return 0; } @@ -168,7 +168,7 @@ islpci_mgt_transmit(struct net_device *ndev, int operation, unsigned long oid, { islpci_private *priv = netdev_priv(ndev); isl38xx_control_block *cb = - (isl38xx_control_block *) priv->control_block; + (isl38xx_control_block *) priv->control_block; void *p; int err = -EINVAL; unsigned long flags; @@ -242,25 +242,25 @@ islpci_mgt_transmit(struct net_device *ndev, int operation, unsigned long oid, priv->mgmt_tx[index] = buf; frag = &cb->tx_data_mgmt[index]; frag->size = cpu_to_le16(frag_len); - frag->flags = 0; /* for any other than the last fragment, set to 1 */ + frag->flags = 0; /* for any other than the last fragment, set to 1 */ frag->address = cpu_to_le32(buf.pci_addr); /* The fragment address in the control block must have * been written before announcing the frame buffer to * device */ wmb(); - cb->driver_curr_frag[ISL38XX_CB_TX_MGMTQ] = cpu_to_le32(curr_frag+1); + cb->driver_curr_frag[ISL38XX_CB_TX_MGMTQ] = cpu_to_le32(curr_frag + 1); spin_unlock_irqrestore(&priv->slock, flags); /* trigger the device */ islpci_trigger(priv); return 0; - error_unlock: + error_unlock: spin_unlock_irqrestore(&priv->slock, flags); - error_free: + error_free: kfree(buf.mem); - error: + error: return err; } @@ -274,50 +274,49 @@ islpci_mgt_receive(struct net_device *ndev) { islpci_private *priv = netdev_priv(ndev); isl38xx_control_block *cb = - (isl38xx_control_block *) priv->control_block; + (isl38xx_control_block *) priv->control_block; u32 curr_frag; #if VERBOSE > SHOW_ERROR_MESSAGES DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_receive \n"); #endif - - /* Only once per interrupt, determine fragment range to - * process. This avoids an endless loop (i.e. lockup) if - * frames come in faster than we can process them. */ + /* Only once per interrupt, determine fragment range to + * process. This avoids an endless loop (i.e. lockup) if + * frames come in faster than we can process them. */ curr_frag = le32_to_cpu(cb->device_curr_frag[ISL38XX_CB_RX_MGMTQ]); barrier(); - for ( ; priv->index_mgmt_rx < curr_frag; priv->index_mgmt_rx++) { + for (; priv->index_mgmt_rx < curr_frag; priv->index_mgmt_rx++) { pimfor_header_t *header; u32 index = priv->index_mgmt_rx % ISL38XX_CB_MGMT_QSIZE; struct islpci_membuf *buf = &priv->mgmt_rx[index]; u16 frag_len; int size; struct islpci_mgmtframe *frame; - - /* I have no idea (and no documentation) if flags != 0 - * is possible. Drop the frame, reuse the buffer. */ - if(le16_to_cpu(cb->rx_data_mgmt[index].flags) != 0) { - printk(KERN_WARNING "%s: unknown flags 0x%04x\n", - ndev->name, - le16_to_cpu(cb->rx_data_mgmt[index].flags)); - continue; - } + + /* I have no idea (and no documentation) if flags != 0 + * is possible. Drop the frame, reuse the buffer. */ + if (le16_to_cpu(cb->rx_data_mgmt[index].flags) != 0) { + printk(KERN_WARNING "%s: unknown flags 0x%04x\n", + ndev->name, + le16_to_cpu(cb->rx_data_mgmt[index].flags)); + continue; + } /* The device only returns the size of the header(s) here. */ frag_len = le16_to_cpu(cb->rx_data_mgmt[index].size); /* - * We appear to have no way to tell the device the - * size of a receive buffer. Thus, if this check - * triggers, we likely have kernel heap corruption. */ - if (frag_len > MGMT_FRAME_SIZE) { - printk(KERN_WARNING "%s: Bogus packet size of %d (%#x).\ -n", - ndev->name, frag_len, frag_len); - frag_len = MGMT_FRAME_SIZE; - } + * We appear to have no way to tell the device the + * size of a receive buffer. Thus, if this check + * triggers, we likely have kernel heap corruption. */ + if (frag_len > MGMT_FRAME_SIZE) { + printk(KERN_WARNING + "%s: Bogus packet size of %d (%#x).\n", + ndev->name, frag_len, frag_len); + frag_len = MGMT_FRAME_SIZE; + } /* Ensure the results of device DMA are visible to the CPU. */ pci_dma_sync_single(priv->pdev, buf->pci_addr, @@ -339,30 +338,32 @@ n", #if VERBOSE > SHOW_ERROR_MESSAGES DEBUG(SHOW_PIMFOR_FRAMES, "PIMFOR: op %i, oid 0x%08x, device %i, flags 0x%x length 0x%x \n", - header->operation, header->oid, header->device_id, + header->operation, header->oid, header->device_id, header->flags, header->length); /* display the buffer contents for debugging */ display_buffer((char *) header, PIMFOR_HEADER_SIZE); - display_buffer((char *) header + PIMFOR_HEADER_SIZE, header->length); + display_buffer((char *) header + PIMFOR_HEADER_SIZE, + header->length); #endif /* nobody sends these */ if (header->flags & PIMFOR_FLAG_APPLIC_ORIGIN) { - printk(KERN_DEBUG "%s: errant PIMFOR application frame\n", + printk(KERN_DEBUG + "%s: errant PIMFOR application frame\n", ndev->name); continue; } /* Determine frame size, skipping OID_INL_TUNNEL headers. */ size = PIMFOR_HEADER_SIZE + header->length; - frame = kmalloc(sizeof(struct islpci_mgmtframe) + size, + frame = kmalloc(sizeof (struct islpci_mgmtframe) + size, GFP_ATOMIC); if (!frame) { - printk(KERN_WARNING "%s: Out of memory, cannot handle oid 0x%08x\n", - + printk(KERN_WARNING + "%s: Out of memory, cannot handle oid 0x%08x\n", ndev->name, header->oid); - continue; + continue; } frame->ndev = ndev; memcpy(&frame->buf, header, size); @@ -382,7 +383,7 @@ n", header->oid, header->device_id, header->flags, header->length); #endif - + /* Create work to handle trap out of interrupt * context. */ INIT_WORK(&frame->ws, prism54_process_trap, frame); @@ -392,14 +393,13 @@ n", /* Signal the one waiting process that a response * has been received. */ if ((frame = xchg(&priv->mgmt_received, frame)) != NULL) { - printk(KERN_WARNING "%s: mgmt response not collected\n", + printk(KERN_WARNING + "%s: mgmt response not collected\n", ndev->name); kfree(frame); } - #if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "Wake up Mgmt Queue\n"); + DEBUG(SHOW_TRACING, "Wake up Mgmt Queue\n"); #endif wake_up(&priv->mgmt_wqueue); } @@ -416,22 +416,22 @@ void islpci_mgt_cleanup_transmit(struct net_device *ndev) { islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = /* volatile not needed */ - (isl38xx_control_block *) priv->control_block; + isl38xx_control_block *cb = /* volatile not needed */ + (isl38xx_control_block *) priv->control_block; u32 curr_frag; #if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_cleanup_transmit\n"); + DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_cleanup_transmit\n"); #endif /* Only once per cleanup, determine fragment range to * process. This avoids an endless loop (i.e. lockup) if * the device became confused, incrementing device_curr_frag * rapidly. */ - curr_frag = le32_to_cpu(cb->device_curr_frag[ISL38XX_CB_TX_MGMTQ]); + curr_frag = le32_to_cpu(cb->device_curr_frag[ISL38XX_CB_TX_MGMTQ]); barrier(); - for ( ; priv->index_mgmt_tx < curr_frag; priv->index_mgmt_tx++) { + for (; priv->index_mgmt_tx < curr_frag; priv->index_mgmt_tx++) { int index = priv->index_mgmt_tx % ISL38XX_CB_MGMT_QSIZE; struct islpci_membuf *buf = &priv->mgmt_tx[index]; pci_unmap_single(priv->pdev, buf->pci_addr, buf->size, @@ -456,23 +456,14 @@ islpci_mgt_transaction(struct net_device *ndev, const long wait_cycle_jiffies = (ISL38XX_WAIT_CYCLE * 10 * HZ) / 1000; long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies; int err; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) DEFINE_WAIT(wait); -#else - DECLARE_WAITQUEUE(wait, current); -#endif if (down_interruptible(&priv->mgmt_sem)) return -ERESTARTSYS; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) prepare_to_wait(&priv->mgmt_wqueue, &wait, TASK_UNINTERRUPTIBLE); -#else - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&priv->mgmt_wqueue, &wait); -#endif err = islpci_mgt_transmit(ndev, operation, oid, senddata, sendlen); - if(err) + if (err) goto out; err = -ETIMEDOUT; @@ -483,13 +474,24 @@ islpci_mgt_transaction(struct net_device *ndev, timeleft = schedule_timeout(wait_cycle_jiffies); frame = xchg(&priv->mgmt_received, NULL); if (frame) { - *recvframe = frame; - err = 0; - goto out; + if (frame->header->oid == oid) { + *recvframe = frame; + err = 0; + goto out; + } else { + printk(KERN_DEBUG + "%s: expecting oid 0x%x, received 0x%x.\n", + ndev->name, (unsigned int) oid, + frame->header->oid); + kfree(frame); + frame = NULL; + } } - if(timeleft == 0) { - printk(KERN_DEBUG "%s: timeout waiting for mgmt response %lu, trigging device\n", - ndev->name, timeout_left); + if (timeleft == 0) { + printk(KERN_DEBUG + "%s: timeout waiting for mgmt response %lu, " + "triggering device\n", + ndev->name, timeout_left); islpci_trigger(priv); } timeout_left += timeleft - wait_cycle_jiffies; @@ -499,12 +501,7 @@ islpci_mgt_transaction(struct net_device *ndev, /* TODO: we should reset the device here */ out: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) finish_wait(&priv->mgmt_wqueue, &wait); -#else - remove_wait_queue(&priv->mgmt_wqueue, &wait); - set_current_state(TASK_RUNNING); -#endif up(&priv->mgmt_sem); return err; } diff --git a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h index 80337f926..72cb87a96 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.h +++ b/drivers/net/wireless/prism54/islpci_mgt.h @@ -24,15 +24,6 @@ #include #include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) -# include -#else -# include -# define work_struct tq_struct -# define INIT_WORK INIT_TQUEUE -# define schedule_work schedule_task -#endif - /* * Function definitions */ @@ -43,7 +34,7 @@ #define TRACE(devname) K_DEBUG(SHOW_TRACING, VERBOSE, "%s: -> " __FUNCTION__ "()\n", devname) extern int pc_debug; -static const int init_wds = 0; /* help compiler optimize away dead code */ +#define init_wds 0 /* help compiler optimize away dead code */ /* General driver definitions */ diff --git a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c index cfa541ca2..470466d13 100644 --- a/drivers/net/wireless/prism54/oid_mgt.c +++ b/drivers/net/wireless/prism54/oid_mgt.c @@ -16,6 +16,7 @@ * */ +#include "prismcompat.h" #include "islpci_dev.h" #include "islpci_mgt.h" #include "isl_oid.h" @@ -39,17 +40,13 @@ channel_of_freq(int f) if ((f >= 2412) && (f <= 2484)) { while ((c < 14) && (f != frequency_list_bg[c])) c++; - if (c >= 14) - return 0; + return (c >= 14) ? 0 : ++c; } else if ((f >= (int) 5170) && (f <= (int) 5320)) { while ((c < 12) && (f != frequency_list_a[c])) c++; - if (c >= 12) - return 0; + return (c >= 12) ? 0 : (c + 37); } else return 0; - - return ++c; } #define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t} @@ -449,7 +446,7 @@ mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data) if (cache) down_write(&priv->mib_sem); - if (islpci_get_state(priv) >= PRV_STATE_INIT) { + if (islpci_get_state(priv) >= PRV_STATE_READY) { ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, oid, _data, dlen, &response); if (!ret) { @@ -457,7 +454,7 @@ mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data) islpci_mgt_release(response); } if (ret || response_op == PIMFOR_OP_ERROR) - ret = -EIO; + ret = -EIO; } else if (!cache) ret = -EIO; @@ -482,7 +479,7 @@ mgt_get_request(islpci_private *priv, enum oid_num_t n, int extra, void *data, int ret = -EIO; int reslen = 0; struct islpci_mgmtframe *response = NULL; - + int dlen; void *cache, *_res = NULL; u32 oid; @@ -503,11 +500,11 @@ mgt_get_request(islpci_private *priv, enum oid_num_t n, int extra, void *data, if (cache) down_read(&priv->mib_sem); - if (islpci_get_state(priv) >= PRV_STATE_INIT) { + if (islpci_get_state(priv) >= PRV_STATE_READY) { ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, oid, data, dlen, &response); if (ret || !response || - response->header->operation == PIMFOR_OP_ERROR) { + response->header->operation == PIMFOR_OP_ERROR) { if (response) islpci_mgt_release(response); ret = -EIO; @@ -542,9 +539,9 @@ mgt_get_request(islpci_private *priv, enum oid_num_t n, int extra, void *data, if (reslen > isl_oid[n].size) printk(KERN_DEBUG "mgt_get_request(0x%x): received data length was bigger " - "than expected (%d > %d). Memory is probably corrupted... ", + "than expected (%d > %d). Memory is probably corrupted...", oid, reslen, isl_oid[n].size); - + return ret; } @@ -564,11 +561,11 @@ mgt_commit_list(islpci_private *priv, enum oid_num_t *l, int n) while (j <= t->range) { response = NULL; ret |= islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, - oid, data, t->size, + oid, data, t->size, &response); if (response) { ret |= (response->header->operation == - PIMFOR_OP_ERROR); + PIMFOR_OP_ERROR); islpci_mgt_release(response); } j++; @@ -625,12 +622,32 @@ static enum oid_num_t commit_part2[] = { OID_INL_OUTPUTPOWER, }; +/* update the MAC addr. */ +static int +mgt_update_addr(islpci_private *priv) +{ + struct islpci_mgmtframe *res; + int ret; + + ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, + isl_oid[GEN_OID_MACADDRESS].oid, NULL, + isl_oid[GEN_OID_MACADDRESS].size, &res); + + if ((ret == 0) && res && (res->header->operation != PIMFOR_OP_ERROR)) + memcpy(priv->ndev->dev_addr, res->data, 6); + else + ret = -EIO; + if (res) + islpci_mgt_release(res); + + return ret; +} + void mgt_commit(islpci_private *priv) { int rvalue; u32 u; - union oid_res_t r; if (islpci_get_state(priv) < PRV_STATE_INIT) return; @@ -646,21 +663,14 @@ mgt_commit(islpci_private *priv) u = OID_INL_MODE; rvalue |= mgt_commit_list(priv, &u, 1); + rvalue |= mgt_update_addr(priv); if (rvalue) { /* some request have failed. The device might be in an incoherent state. We should reset it ! */ printk(KERN_DEBUG "%s: mgt_commit has failed. Restart the " - "device \n", priv->ndev->name); + "device \n", priv->ndev->name); } - - /* update the MAC addr. As it's not cached, no lock will be acquired by - * the mgt_get_request - */ - mgt_get_request(priv, GEN_OID_MACADDRESS, 0, NULL, &r); - memcpy(priv->ndev->dev_addr, r.ptr, 6); - kfree(r.ptr); - } /* This will tell you if you are allowed to answer a mlme(ex) request .*/ @@ -687,13 +697,13 @@ mgt_oidtonum(u32 oid) { int i; - for (i = 0; i < OID_NUM_LAST - 1; i++) + for (i = 0; i < OID_NUM_LAST; i++) if (isl_oid[i].oid == oid) return i; printk(KERN_DEBUG "looking for an unknown oid 0x%x", oid); - return 0; + return OID_NUM_LAST; } int @@ -713,8 +723,11 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str) case OID_TYPE_BSS:{ struct obj_bss *bss = r->ptr; return snprintf(str, PRIV_STR_SIZE, - "age=%u\nchannel=%u\n\ - capinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", bss->age, bss->channel, bss->capinfo, bss->rates, bss->basic_rates); + "age=%u\nchannel=%u\n" + "capinfo=0x%X\nrates=0x%X\n" + "basic_rates=0x%X\n", bss->age, + bss->channel, bss->capinfo, + bss->rates, bss->basic_rates); } break; case OID_TYPE_BSSLIST:{ @@ -723,7 +736,9 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str) k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr); for (i = 0; i < list->nr; i++) k += snprintf(str + k, PRIV_STR_SIZE - k, - "bss[%u] : \nage=%u\nchannel=%u\ncapinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", + "bss[%u] : \nage=%u\nchannel=%u\n" + "capinfo=0x%X\nrates=0x%X\n" + "basic_rates=0x%X\n", i, list->bsslist[i].age, list->bsslist[i].channel, list->bsslist[i].capinfo, @@ -745,16 +760,17 @@ mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str) break; case OID_TYPE_MLME:{ struct obj_mlme *mlme = r->ptr; - return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\ - code=0x%X\n", mlme->id, mlme->state, - mlme->code); + return snprintf(str, PRIV_STR_SIZE, + "id=0x%X\nstate=0x%X\ncode=0x%X\n", + mlme->id, mlme->state, mlme->code); } break; case OID_TYPE_MLMEEX:{ struct obj_mlmeex *mlme = r->ptr; - return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\ - code=0x%X\nsize=0x%X\n", mlme->id, mlme->state, - mlme->code, mlme->size); + return snprintf(str, PRIV_STR_SIZE, + "id=0x%X\nstate=0x%X\n" + "code=0x%X\nsize=0x%X\n", mlme->id, + mlme->state, mlme->code, mlme->size); } break; case OID_TYPE_SSID:{ diff --git a/drivers/net/wireless/prism54/oid_mgt.h b/drivers/net/wireless/prism54/oid_mgt.h index cd8167e29..caf5eb3d5 100644 --- a/drivers/net/wireless/prism54/oid_mgt.h +++ b/drivers/net/wireless/prism54/oid_mgt.h @@ -38,7 +38,7 @@ void mgt_le_to_cpu(int, void *); int mgt_set_request(islpci_private *, enum oid_num_t, int, void *); int mgt_get_request(islpci_private *, enum oid_num_t, int, void *, - union oid_res_t *); + union oid_res_t *); int mgt_commit_list(islpci_private *, enum oid_num_t *, int); diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index ee328d5c2..5eb32a9ca 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c @@ -1841,7 +1841,7 @@ wl_his_gather(struct net_device * dev, #endif /* HISTOGRAM */ static inline int -wl_netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +wl_netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { u32 ethcmd; @@ -2764,7 +2764,7 @@ wavelan_ioctl(struct net_device * dev, /* Device on wich the ioctl apply */ switch(cmd) { case SIOCETHTOOL: - ret = wl_netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + ret = wl_netdev_ethtool_ioctl(dev, rq->ifr_data); break; /* ------------------- OTHER IOCTL ------------------- */ diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index ed4acc13a..4e62fa630 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1487,7 +1487,7 @@ struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) return wstats; } -static inline int wl3501_ethtool_ioctl(struct net_device *dev, void *uaddr) +static inline int wl3501_ethtool_ioctl(struct net_device *dev, void __user *uaddr) { u32 ethcmd; int rc = -EFAULT; @@ -1532,7 +1532,7 @@ static int wl3501_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (netif_device_present(dev)) { rc = -EOPNOTSUPP; if (cmd == SIOCETHTOOL) - rc = wl3501_ethtool_ioctl(dev, (void *)rq->ifr_data); + rc = wl3501_ethtool_ioctl(dev, rq->ifr_data); } return rc; } diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 9994de2d9..ef0c797fd 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c @@ -448,7 +448,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev, np = dev->priv; - if (pci_request_regions(pdev, dev->name)) + if (pci_request_regions(pdev, DRV_NAME)) goto err_out_free_netdev; pci_set_master (pdev); @@ -1201,13 +1201,8 @@ static int yellowfin_rx(struct net_device *dev) break; skb->dev = dev; skb_reserve(skb, 2); /* 16 byte align the IP header */ -#if HAS_IP_COPYSUM eth_copy_and_sum(skb, rx_skb->tail, pkt_len, 0); skb_put(skb, pkt_len); -#else - memcpy(skb_put(skb, pkt_len), - rx_skb->tail, pkt_len); -#endif pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, yp->rx_buf_sz, PCI_DMA_FROMDEVICE); @@ -1405,7 +1400,7 @@ static void set_rx_mode(struct net_device *dev) outw(cfg_value | 0x1000, ioaddr + Cnfg); } -static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) +static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) { struct yellowfin_private *np = dev->priv; u32 ethcmd; @@ -1433,11 +1428,11 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct yellowfin_private *np = dev->priv; long ioaddr = dev->base_addr; - struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data; + struct mii_ioctl_data *data = if_mii(rq); switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); case SIOCGMIIPHY: /* Get address of MII PHY in use. */ data->phy_id = np->phys[0] & 0x1f; /* Fall Through */ diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index d721fc6f4..8ab6e1215 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c @@ -36,6 +36,8 @@ #include "8390.h" +#define DRV_NAME "zorro8390" + #define NE_BASE (dev->base_addr) #define NE_CMD (0x00*2) #define NE_DATAPORT (0x10*2) /* NatSemi-defined port window offset. */ @@ -115,7 +117,7 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z, if (!dev) return -ENOMEM; SET_MODULE_OWNER(dev); - if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, dev->name)) { + if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) { free_netdev(dev); return -EBUSY; } @@ -198,7 +200,7 @@ static int __devinit zorro8390_init(struct net_device *dev, dev->irq = IRQ_AMIGA_PORTS; /* Install the Interrupt handler */ - i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, DRV_NAME, dev); if (i) return i; for(i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index c4f348241..e853f342a 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -44,7 +44,6 @@ #include #include /* for L1_CACHE_BYTES */ #include -#include #include #include #include diff --git a/drivers/parisc/ccio-rm-dma.c b/drivers/parisc/ccio-rm-dma.c index bd21c5f4a..57e638597 100644 --- a/drivers/parisc/ccio-rm-dma.c +++ b/drivers/parisc/ccio-rm-dma.c @@ -40,7 +40,6 @@ #include #include -#include #include #include diff --git a/drivers/pci/pci.ids b/drivers/pci/pci.ids index b3f33a1bb..6e4965e66 100644 --- a/drivers/pci/pci.ids +++ b/drivers/pci/pci.ids @@ -6248,10 +6248,13 @@ 1676 NetXtreme BCM5750 Gigabit Ethernet 1677 NetXtreme BCM5751 Gigabit Ethernet 167c NetXtreme BCM5750M Gigabit Ethernet + 167d NetXtreme BCM5751M Gigabit Ethernet + 167e NetXtreme BCM5751F Gigabit Ethernet 1696 NetXtreme BCM5782 Gigabit Ethernet 103c 12bc HP d530 CMT (DG746A) 14e4 000d NetXtreme BCM5782 1000Base-T 169c NetXtreme BCM5788 Gigabit Ethernet + 169d NetXtreme BCM5789 Gigabit Ethernet 16a6 NetXtreme BCM5702X Gigabit Ethernet 0e11 00bb NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T) 1028 0126 BCM5702 1000Base-T diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7e93bfccb..d5d487e79 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -797,7 +797,7 @@ out: /*====================================================================*/ -static ssize_t ds_read(struct file *file, char *buf, +static ssize_t ds_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct pcmcia_bus_socket *s; @@ -819,14 +819,14 @@ static ssize_t ds_read(struct file *file, char *buf, ret = wait_event_interruptible(s->queue, !queue_empty(user)); if (ret == 0) - ret = put_user(get_queued_event(user), (int *)buf) ? -EFAULT : 4; + ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; return ret; } /* ds_read */ /*====================================================================*/ -static ssize_t ds_write(struct file *file, const char *buf, +static ssize_t ds_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct pcmcia_bus_socket *s; @@ -849,7 +849,7 @@ static ssize_t ds_write(struct file *file, const char *buf, if (s->req_pending) { s->req_pending--; - get_user(s->req_result, (int *)buf); + get_user(s->req_result, (int __user *)buf); if ((s->req_result != 0) || (s->req_pending == 0)) wake_up_interruptible(&s->request); } else @@ -888,6 +888,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, u_int cmd, u_long arg) { struct pcmcia_bus_socket *s; + void __user *uarg = (char __user *)arg; u_int size; int ret, err; ds_ioctl_arg_t buf; @@ -911,14 +912,14 @@ static int ds_ioctl(struct inode * inode, struct file * file, return -EPERM; if (cmd & IOC_IN) { - err = verify_area(VERIFY_READ, (char *)arg, size); + err = verify_area(VERIFY_READ, uarg, size); if (err) { ds_dbg(3, "ds_ioctl(): verify_read = %d\n", err); return err; } } if (cmd & IOC_OUT) { - err = verify_area(VERIFY_WRITE, (char *)arg, size); + err = verify_area(VERIFY_WRITE, uarg, size); if (err) { ds_dbg(3, "ds_ioctl(): verify_write = %d\n", err); return err; @@ -927,7 +928,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, err = ret = 0; - if (cmd & IOC_IN) __copy_from_user((char *)&buf, (char *)arg, size); + if (cmd & IOC_IN) __copy_from_user((char *)&buf, uarg, size); switch (cmd) { case DS_ADJUST_RESOURCE_INFO: @@ -1042,7 +1043,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, } } - if (cmd & IOC_OUT) __copy_to_user((char *)arg, (char *)&buf, size); + if (cmd & IOC_OUT) __copy_to_user(uarg, (char *)&buf, size); return err; } /* ds_ioctl */ diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index e98adb10c..120569b1f 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -1372,8 +1372,15 @@ static int __init init_i82365(void) { int i, ret; - if (driver_register(&i82365_driver)) - return -1; + ret = driver_register(&i82365_driver); + if (ret) + return ret; + + ret = platform_device_register(&i82365_device); + if (ret) { + driver_unregister(&i82365_driver); + return ret; + } printk(KERN_INFO "Intel ISA PCIC probe: "); sockets = 0; @@ -1382,12 +1389,11 @@ static int __init init_i82365(void) if (sockets == 0) { printk("not found.\n"); + platform_device_unregister(&i82365_device); driver_unregister(&i82365_driver); return -ENODEV; } - platform_device_register(&i82365_device); - /* Set up interrupt handler(s) */ if (grab_irq != 0) request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index ef574afa0..491d11bc8 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -133,6 +132,39 @@ static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt) return pxa2xx_pcmcia_set_mcxx(skt, clk); } +#ifdef CONFIG_CPU_FREQ + +static int +pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, + unsigned long val, + struct cpufreq_freqs *freqs) +{ +#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock" + switch (val) { + case CPUFREQ_PRECHANGE: + if (freqs->new > freqs->old) { + debug(skt, 2, "new frequency %u.%uMHz > %u.%uMHz, " + "pre-updating\n", + freqs->new / 1000, (freqs->new / 100) % 10, + freqs->old / 1000, (freqs->old / 100) % 10); + pxa2xx_pcmcia_set_mcxx(skt, freqs->new); + } + break; + + case CPUFREQ_POSTCHANGE: + if (freqs->new < freqs->old) { + debug(skt, 2, "new frequency %u.%uMHz < %u.%uMHz, " + "post-updating\n", + freqs->new / 1000, (freqs->new / 100) % 10, + freqs->old / 1000, (freqs->old / 100) % 10); + pxa2xx_pcmcia_set_mcxx(skt, freqs->new); + } + break; + } + return 0; +} +#endif + int pxa2xx_drv_pcmcia_probe(struct device *dev) { int ret; @@ -181,6 +213,9 @@ int pxa2xx_drv_pcmcia_probe(struct device *dev) /* Provide our PXA2xx specific timing routines. */ ops->set_timing = pxa2xx_pcmcia_set_timing; +#ifdef CONFIG_CPU_FREQ + ops->frequency_change = pxa2xx_pcmcia_frequency_change; +#endif ret = soc_common_drv_pcmcia_probe(dev, ops, first, nr); @@ -227,101 +262,13 @@ static struct device_driver pxa2xx_pcmcia_driver = { .bus = &platform_bus_type, }; -#ifdef CONFIG_CPU_FREQ - -/* - * When pxa2xx_pcmcia_notifier() decides that a MC{IO,MEM,ATT} adjustment (due - * to a core clock frequency change) is needed, this routine establishes - * new values consistent with the clock speed `clock'. - */ -static void pxa2xx_pcmcia_update_mcxx(unsigned int clock) -{ - struct soc_pcmcia_socket *skt; - - down(&soc_sockets_lock); - list_for_each_entry(skt, &soc_sockets, node) { - pxa2xx_pcmcia_set_mcxx(skt, clock); - } - up(&soc_sockets_lock); -} - -/* - * When changing the processor L clock frequency, it is necessary - * to adjust the MCXX timings accordingly. We've recorded the timings - * requested by Card Services, so this is just a matter of finding - * out what our current speed is, and then recomputing the new MCXX - * values. - * - * Returns: 0 on success, -1 on error - */ -static int -pxa2xx_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) -{ - struct cpufreq_freqs *freqs = data; - -#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock" - switch (val) { - case CPUFREQ_PRECHANGE: - if (freqs->new > freqs->old) { - debug( 2, "new frequency %u.%uMHz > %u.%uMHz, " - "pre-updating\n", - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); - pxa2xx_pcmcia_update_mcxx(freqs->new); - } - break; - - case CPUFREQ_POSTCHANGE: - if (freqs->new < freqs->old) { - debug( 2, "new frequency %u.%uMHz < %u.%uMHz, " - "post-updating\n", - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); - pxa2xx_pcmcia_update_mcxx(freqs->new); - } - break; - } - - return 0; -} - -static struct notifier_block pxa2xx_pcmcia_notifier_block = { - .notifier_call = pxa2xx_pcmcia_notifier -}; - -static int __init pxa2xx_pcmcia_cpufreq_init(void) -{ - int ret; - - ret = cpufreq_register_notifier(&pxa2xx_pcmcia_notifier_block, - CPUFREQ_TRANSITION_NOTIFIER); - if (ret < 0) - printk(KERN_ERR "Unable to register CPU frequency change " - "notifier for PCMCIA (%d)\n", ret); - return ret; -} - -static void __exit pxa2xx_pcmcia_cpufreq_exit(void) -{ - cpufreq_unregister_notifier(&pxa2xx_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); -} - -#else -#define pxa2xx_pcmcia_cpufreq_init() -#define pxa2xx_pcmcia_cpufreq_exit() -#endif - static int __init pxa2xx_pcmcia_init(void) { - int ret = driver_register(&pxa2xx_pcmcia_driver); - if (ret == 0) - pxa2xx_pcmcia_cpufreq_init(); - return ret; + return driver_register(&pxa2xx_pcmcia_driver); } static void __exit pxa2xx_pcmcia_exit(void) { - pxa2xx_pcmcia_cpufreq_exit(); driver_unregister(&pxa2xx_pcmcia_driver); } diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index c18f28605..e22a57a4a 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "sa1111_generic.h" diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index af85842ee..fe62a597d 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c @@ -24,6 +24,8 @@ #include #include +#include + #include "soc_common.h" diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index fb634ab5d..db04ffb6f 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -111,6 +110,32 @@ sa1100_pcmcia_set_mecr(struct soc_pcmcia_socket *skt, unsigned int cpu_clock) return 0; } +#ifdef CONFIG_CPU_FREQ +static int +sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, + unsigned long val, + struct cpufreq_freqs *freqs) +{ + switch (val) { + case CPUFREQ_PRECHANGE: + if (freqs->new > freqs->old) + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + + case CPUFREQ_POSTCHANGE: + if (freqs->new < freqs->old) + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + case CPUFREQ_RESUMECHANGE: + sa1100_pcmcia_set_mecr(skt, freqs->new); + break; + } + + return 0; +} + +#endif + static int sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt) { @@ -152,90 +177,23 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, /* Provide our SA11x0 specific timing routines. */ ops->set_timing = sa1100_pcmcia_set_timing; ops->show_timing = sa1100_pcmcia_show_timing; +#ifdef CONFIG_CPU_FREQ + ops->frequency_change = sa1100_pcmcia_frequency_change; +#endif return soc_common_drv_pcmcia_probe(dev, ops, first, nr); } EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); -#ifdef CONFIG_CPU_FREQ - -/* sa1100_pcmcia_update_mecr() - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * When sa1100_pcmcia_notifier() decides that a MECR adjustment (due - * to a core clock frequency change) is needed, this routine establishes - * new BS_xx values consistent with the clock speed `clock'. - */ -static void sa1100_pcmcia_update_mecr(unsigned int clock) -{ - struct soc_pcmcia_socket *skt; - - down(&soc_pcmcia_sockets_lock); - list_for_each_entry(skt, &soc_pcmcia_sockets, node) - sa1100_pcmcia_set_mecr(skt, clock); - up(&soc_pcmcia_sockets_lock); -} - -/* sa1100_pcmcia_notifier() - * ^^^^^^^^^^^^^^^^^^^^^^^^ - * When changing the processor core clock frequency, it is necessary - * to adjust the MECR timings accordingly. We've recorded the timings - * requested by Card Services, so this is just a matter of finding - * out what our current speed is, and then recomputing the new MECR - * values. - * - * Returns: 0 on success, -1 on error - */ -static int -sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val, - void *data) -{ - struct cpufreq_freqs *freqs = data; - - switch (val) { - case CPUFREQ_PRECHANGE: - if (freqs->new > freqs->old) - sa1100_pcmcia_update_mecr(freqs->new); - break; - - case CPUFREQ_POSTCHANGE: - if (freqs->new < freqs->old) - sa1100_pcmcia_update_mecr(freqs->new); - break; - case CPUFREQ_RESUMECHANGE: - sa1100_pcmcia_update_mecr(freqs->new); - break; - } - - return 0; -} - -static struct notifier_block sa1100_pcmcia_notifier_block = { - .notifier_call = sa1100_pcmcia_notifier -}; - static int __init sa11xx_pcmcia_init(void) { - int ret; - - printk(KERN_INFO "SA11xx PCMCIA\n"); - - ret = cpufreq_register_notifier(&sa1100_pcmcia_notifier_block, - CPUFREQ_TRANSITION_NOTIFIER); - if (ret < 0) - printk(KERN_ERR "Unable to register CPU frequency change " - "notifier (%d)\n", ret); - - return ret; + return 0; } module_init(sa11xx_pcmcia_init); -static void __exit sa11xx_pcmcia_exit(void) -{ - cpufreq_unregister_notifier(&sa1100_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); -} +static void __exit sa11xx_pcmcia_exit(void) {} module_exit(sa11xx_pcmcia_exit); -#endif MODULE_AUTHOR("John Dorsey "); MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver"); diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index ff8b52124..6d393e739 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -31,6 +31,7 @@ ======================================================================*/ +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #include #include @@ -614,6 +616,49 @@ struct skt_dev_info { #define SKT_DEV_INFO_SIZE(n) \ (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) +#ifdef CONFIG_CPU_FREQ +static int +soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) +{ + struct soc_pcmcia_socket *skt; + struct cpufreq_freqs *freqs = data; + int ret = 0; + + down(&soc_pcmcia_sockets_lock); + list_for_each_entry(skt, &soc_pcmcia_sockets, node) + if ( skt->ops->frequency_change ) + ret += skt->ops->frequency_change(skt, val, freqs); + up(&soc_pcmcia_sockets_lock); + + return ret; +} + +static struct notifier_block soc_pcmcia_notifier_block = { + .notifier_call = soc_pcmcia_notifier +}; + +static int soc_pcmcia_cpufreq_register(void) +{ + int ret; + + ret = cpufreq_register_notifier(&soc_pcmcia_notifier_block, + CPUFREQ_TRANSITION_NOTIFIER); + if (ret < 0) + printk(KERN_ERR "Unable to register CPU frequency change " + "notifier for PCMCIA (%d)\n", ret); + return ret; +} + +static void soc_pcmcia_cpufreq_unregister(void) +{ + cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER); +} + +#else +#define soc_pcmcia_cpufreq_register() +#define soc_pcmcia_cpufreq_unregister() +#endif + int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) { struct skt_dev_info *sinfo; @@ -692,6 +737,9 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops goto out_err_5; } + if ( list_empty(&soc_pcmcia_sockets) ) + soc_pcmcia_cpufreq_register(); + list_add(&skt->node, &soc_pcmcia_sockets); /* @@ -789,6 +837,9 @@ int soc_common_drv_pcmcia_remove(struct device *dev) release_resource(&skt->res_io); release_resource(&skt->res_skt); } + if ( list_empty(&soc_pcmcia_sockets) ) + soc_pcmcia_cpufreq_unregister(); + up(&soc_pcmcia_sockets_lock); kfree(sinfo); diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 60e30197b..f77923ced 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h @@ -10,6 +10,7 @@ #define _ASM_ARCH_PCMCIA /* include the world */ +#include #include #include #include @@ -103,6 +104,13 @@ struct pcmcia_low_level { unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int); int (*set_timing)(struct soc_pcmcia_socket *); int (*show_timing)(struct soc_pcmcia_socket *, char *); + +#ifdef CONFIG_CPU_FREQ + /* + * CPUFREQ support. + */ + int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *); +#endif }; diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index b0d716ef0..767b2c1a2 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -1078,6 +1078,7 @@ static struct pci_device_id yenta_table [] = { CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1451A, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1510, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, TI12XX), + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1620, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4410, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4450, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4451, TI12XX), diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 5adaac670..ee6d1ed50 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c @@ -68,13 +68,8 @@ MODULE_PARM(isapnp_verbose, "i"); MODULE_PARM_DESC(isapnp_verbose, "ISA Plug & Play verbose mode"); MODULE_LICENSE("GPL"); -#ifdef CONFIG_X86_PC9800 -#define _PIDXR 0x259 -#define _PNPWRP 0xa59 -#else #define _PIDXR 0x279 #define _PNPWRP 0xa79 -#endif /* short tags */ #define _STAG_PNPVERNO 0x01 diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 0a94ee9db..cf54b0a36 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c @@ -55,7 +55,7 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) return (file->f_pos = new); } -static ssize_t isapnp_proc_bus_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) +static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { struct inode *ino = file->f_dentry->d_inode; struct proc_dir_entry *dp = PDE(ino); diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 063ae5ecf..88fcd1668 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c @@ -176,7 +176,7 @@ static int proc_read_node(char *buf, char **start, off_t pos, return len; } -static int proc_write_node(struct file *file, const char *buf, +static int proc_write_node(struct file *file, const char __user *buf, unsigned long count, void *data) { struct pnp_bios_node *node; diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 9d30ebf0b..6997d61dc 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -7,7 +7,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001 * - * $Revision: 1.141 $ + * $Revision: 1.142 $ */ #include @@ -37,6 +37,7 @@ * SECTION: exported variables of dasd.c */ debug_info_t *dasd_debug_area; +struct dasd_discipline *dasd_diag_discipline_pointer; MODULE_AUTHOR("Holger Smolinski "); MODULE_DESCRIPTION("Linux on S/390 DASD device driver," @@ -1990,6 +1991,8 @@ dasd_init(void) DBF_EVENT(DBF_EMERG, "%s", "debug area created"); + dasd_diag_discipline_pointer = NULL; + rc = devfs_mk_dir("dasd"); if (rc) goto failed; @@ -2022,6 +2025,7 @@ module_init(dasd_init); module_exit(dasd_exit); EXPORT_SYMBOL(dasd_debug_area); +EXPORT_SYMBOL(dasd_diag_discipline_pointer); EXPORT_SYMBOL(dasd_add_request_head); EXPORT_SYMBOL(dasd_add_request_tail); diff --git a/drivers/s390/block/dasd_cmb.c b/drivers/s390/block/dasd_cmb.c index 8139ffddc..ed1ab474c 100644 --- a/drivers/s390/block/dasd_cmb.c +++ b/drivers/s390/block/dasd_cmb.c @@ -58,7 +58,7 @@ static int dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args) { struct dasd_device *device; - struct cmbdata * __user udata; + struct cmbdata __user *udata; struct cmbdata data; size_t size; int ret; @@ -66,7 +66,7 @@ dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args) device = bdev->bd_disk->private_data; if (!device) return -EINVAL; - udata = (void *) args; + udata = (void __user *) args; size = _IOC_SIZE(no); if (!access_ok(VERIFY_WRITE, udata, size)) diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 67a896cd4..888aeb399 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c @@ -6,7 +6,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * - * $Revision: 1.34 $ + * $Revision: 1.36 $ */ #include @@ -35,6 +35,8 @@ MODULE_LICENSE("GPL"); +struct dasd_discipline dasd_diag_discipline; + struct dasd_diag_private { struct dasd_diag_characteristics rdc_data; struct dasd_diag_rw_io iob; @@ -292,7 +294,7 @@ dasd_diag_check_device(struct dasd_device *device) mdsk_term_io(device); } if (bsize <= PAGE_SIZE && label[3] == bsize && - label[0] == 0xc3d4e2f1 && label[13] != 0) { + label[0] == 0xc3d4e2f1) { device->blocks = label[7]; device->bp_block = bsize; device->s2b_shift = 0; /* bits to shift 512 to get a block */ @@ -489,6 +491,7 @@ dasd_diag_init(void) ctl_set_bit(0, 9); register_external_interrupt(0x2603, dasd_ext_handler); + dasd_diag_discipline_pointer = &dasd_diag_discipline; return 0; } @@ -503,6 +506,7 @@ dasd_diag_cleanup(void) } unregister_external_interrupt(0x2603, dasd_ext_handler); ctl_clear_bit(0, 9); + dasd_diag_discipline_pointer = NULL; } module_init(dasd_diag_init); diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 08532025b..9b667cd5a 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -1289,7 +1289,7 @@ dasd_eckd_performance(struct block_device *bdev, int no, long args) /* Prepare for Read Subsystem Data */ prssdp = (struct dasd_psf_prssd_data *) cqr->data; stats = (struct dasd_rssd_perf_stats_t *) (prssdp + 1); - rc = copy_to_user((long *) args, (long *) stats, + rc = copy_to_user((long __user *) args, (long *) stats, sizeof(struct dasd_rssd_perf_stats_t)); } dasd_sfree_request(cqr, cqr->device); @@ -1319,10 +1319,10 @@ dasd_eckd_get_attrib (struct block_device *bdev, int no, long args) private = (struct dasd_eckd_private *) device->private; attrib = private->attrib; - - rc = copy_to_user((long *) args, (long *) &attrib, + + rc = copy_to_user((long __user *) args, (long *) &attrib, sizeof (struct attrib_data_t)); - + return rc; } @@ -1346,7 +1346,7 @@ dasd_eckd_set_attrib(struct block_device *bdev, int no, long args) if (device == NULL) return -ENODEV; - if (copy_from_user(&attrib, (void *) args, + if (copy_from_user(&attrib, (void __user *) args, sizeof (struct attrib_data_t))) { return -EFAULT; } diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 9967c082c..b222f9503 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -6,7 +6,7 @@ * Bugreports.to..: * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * - * $Revision: 1.57 $ + * $Revision: 1.58 $ */ #ifndef DASD_INT_H @@ -260,12 +260,7 @@ struct dasd_discipline { int (*fill_info) (struct dasd_device *, struct dasd_information2_t *); }; -extern struct dasd_discipline dasd_diag_discipline; -#ifdef CONFIG_DASD_DIAG -#define dasd_diag_discipline_pointer (&dasd_diag_discipline) -#else -#define dasd_diag_discipline_pointer (0) -#endif +extern struct dasd_discipline *dasd_diag_discipline_pointer; struct dasd_device { /* Block device stuff. */ diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 3efdcad25..8cbddce1f 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -120,7 +120,7 @@ static int dasd_ioctl_api_version(struct block_device *bdev, int no, long args) { int ver = DASD_API_VERSION; - return put_user(ver, (int *) args); + return put_user(ver, (int __user *) args); } /* @@ -305,7 +305,7 @@ dasd_ioctl_format(struct block_device *bdev, int no, long args) return -ENODEV; if (test_bit(DASD_FLAG_RO, &device->flags)) return -EROFS; - if (copy_from_user(&fdata, (void *) args, + if (copy_from_user(&fdata, (void __user *) args, sizeof (struct format_data_t))) return -EFAULT; if (bdev != bdev->bd_contains) { @@ -348,7 +348,7 @@ dasd_ioctl_read_profile(struct block_device *bdev, int no, long args) if (device == NULL) return -ENODEV; - if (copy_to_user((long *) args, (long *) &device->profile, + if (copy_to_user((long __user *) args, (long *) &device->profile, sizeof (struct dasd_profile_info_t))) return -EFAULT; return 0; @@ -441,9 +441,9 @@ dasd_ioctl_information(struct block_device *bdev, int no, long args) spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); } - + rc = 0; - if (copy_to_user((long *) args, (long *) dasd_info, + if (copy_to_user((long __user *) args, (long *) dasd_info, ((no == (unsigned int) BIODASDINFO2) ? sizeof (struct dasd_information2_t) : sizeof (struct dasd_information_t)))) @@ -466,7 +466,7 @@ dasd_ioctl_set_ro(struct block_device *bdev, int no, long args) if (bdev != bdev->bd_contains) // ro setting is not allowed for partitions return -EINVAL; - if (get_user(intval, (int *) args)) + if (get_user(intval, (int __user *) args)) return -EFAULT; device = bdev->bd_disk->private_data; if (device == NULL) @@ -499,7 +499,7 @@ dasd_ioctl_getgeo(struct block_device *bdev, int no, long args) geo = (struct hd_geometry) {}; device->discipline->fill_geometry(device, &geo); geo.start = get_start_sect(bdev) >> device->s2b_shift; - if (copy_to_user((struct hd_geometry *) args, &geo, + if (copy_to_user((struct hd_geometry __user *) args, &geo, sizeof (struct hd_geometry))) return -EFAULT; diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index 70d6136d7..7cbc854cf 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c @@ -30,7 +30,7 @@ static struct proc_dir_entry *dasd_devices_entry = NULL; static struct proc_dir_entry *dasd_statistics_entry = NULL; static inline char * -dasd_get_user_string(const char *user_buf, size_t user_len) +dasd_get_user_string(const char __user *user_buf, size_t user_len) { char *buffer; @@ -239,7 +239,7 @@ dasd_statistics_read(char *page, char **start, off_t off, } static int -dasd_statistics_write(struct file *file, const char *user_buf, +dasd_statistics_write(struct file *file, const char __user *user_buf, unsigned long user_len, void *data) { #ifdef CONFIG_DASD_PROFILE diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 8a30b5250..ca83f9b0a 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -76,8 +76,7 @@ struct dcssblk_dev_info { }; static struct list_head dcssblk_devices = LIST_HEAD_INIT(dcssblk_devices); -static rwlock_t dcssblk_devices_lock = RW_LOCK_UNLOCKED; - +static struct rw_semaphore dcssblk_devices_sem; /* * release function for segment device. @@ -92,8 +91,8 @@ dcssblk_release_segment(struct device *dev) /* * get a minor number. needs to be called with - * write_lock(&dcssblk_devices_lock) and the - * device needs to be enqueued before the lock is + * down_write(&dcssblk_devices_sem) and the + * device needs to be enqueued before the semaphore is * freed. */ static inline int @@ -121,7 +120,7 @@ dcssblk_assign_free_minor(struct dcssblk_dev_info *dev_info) /* * get the struct dcssblk_dev_info from dcssblk_devices * for the given name. - * read_lock(&dcssblk_devices_lock) must be held. + * down_read(&dcssblk_devices_sem) must be held. */ static struct dcssblk_dev_info * dcssblk_get_device_by_name(char *name) @@ -136,31 +135,6 @@ dcssblk_get_device_by_name(char *name) return NULL; } -/* - * register the device that represents a segment in sysfs, - * also add the attributes for the device - */ -static inline int -dcssblk_register_segment_device(struct device *dev) -{ - int rc; - - rc = device_register(dev); - if (rc) - return rc; - rc = device_create_file(dev, &dev_attr_shared); - if (rc) - goto unregister_dev; - rc = device_create_file(dev, &dev_attr_save); - if (rc) - goto unregister_dev; - return rc; - -unregister_dev: - device_unregister(dev); - return rc; -} - /* * device attribute for switching shared/nonshared (exclusive) * operation (show + store) @@ -184,24 +158,24 @@ dcssblk_shared_store(struct device *dev, const char *inbuf, size_t count) PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); dev_info = container_of(dev, struct dcssblk_dev_info, dev); if (atomic_read(&dev_info->use_count)) { PRINT_ERR("share: segment %s is busy!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return -EBUSY; } if ((inbuf[0] == '1') && (dev_info->is_shared == 1)) { PRINT_WARN("Segment %s already loaded in shared mode!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } if ((inbuf[0] == '0') && (dev_info->is_shared == 0)) { PRINT_WARN("Segment %s already loaded in exclusive mode!\n", dev_info->segment_name); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } if (inbuf[0] == '1') { @@ -231,7 +205,7 @@ dcssblk_shared_store(struct device *dev, const char *inbuf, size_t count) PRINT_INFO("Segment %s reloaded, exclusive (read-write) mode.\n", dev_info->segment_name); } else { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } @@ -262,14 +236,13 @@ dcssblk_shared_store(struct device *dev, const char *inbuf, size_t count) dev_info->segment_name); rc = -EPERM; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); goto out; removeseg: PRINT_ERR("Could not reload segment %s, removing it now!\n", dev_info->segment_name); list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); del_gendisk(dev_info->gd); blk_put_queue(dev_info->dcssblk_queue); @@ -277,6 +250,7 @@ removeseg: put_disk(dev_info->gd); device_unregister(dev); put_device(dev); + up_write(&dcssblk_devices_sem); out: return rc; } @@ -308,7 +282,7 @@ dcssblk_save_store(struct device *dev, const char *inbuf, size_t count) } dev_info = container_of(dev, struct dcssblk_dev_info, dev); - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); if (inbuf[0] == '1') { if (atomic_read(&dev_info->use_count) == 0) { // device is idle => we save immediately @@ -332,11 +306,11 @@ dcssblk_save_store(struct device *dev, const char *inbuf, size_t count) dev_info->segment_name); } } else { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Invalid value, must be 0 or 1\n"); return -EINVAL; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); return count; } @@ -375,9 +349,9 @@ dcssblk_add_store(struct device *dev, const char *buf, size_t count) /* * already loaded? */ - read_lock(&dcssblk_devices_lock); + down_read(&dcssblk_devices_sem); dev_info = dcssblk_get_device_by_name(local_buf); - read_unlock(&dcssblk_devices_lock); + up_read(&dcssblk_devices_sem); if (dev_info != NULL) { PRINT_WARN("Segment %s already loaded!\n", local_buf); rc = -EEXIST; @@ -433,10 +407,10 @@ dcssblk_add_store(struct device *dev, const char *buf, size_t count) /* * get minor, add to list */ - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); rc = dcssblk_assign_free_minor(dev_info); if (rc) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_ERR("No free minor number available! " "Unloading segment...\n"); goto unload_seg; @@ -444,22 +418,29 @@ dcssblk_add_store(struct device *dev, const char *buf, size_t count) sprintf(dev_info->gd->disk_name, "dcssblk%d", dev_info->gd->first_minor); list_add_tail(&dev_info->lh, &dcssblk_devices); + + if (!try_module_get(THIS_MODULE)) { + rc = -ENODEV; + goto list_del; + } /* * register the device */ - rc = dcssblk_register_segment_device(&dev_info->dev); + rc = device_register(&dev_info->dev); if (rc) { PRINT_ERR("Segment %s could not be registered RC=%d\n", local_buf, rc); + module_put(THIS_MODULE); goto list_del; } - - if (!try_module_get(THIS_MODULE)) { - rc = -ENODEV; - goto list_del; - } - get_device(&dev_info->dev); + rc = device_create_file(&dev_info->dev, &dev_attr_shared); + if (rc) + goto unregister_dev; + rc = device_create_file(&dev_info->dev, &dev_attr_save); + if (rc) + goto unregister_dev; + add_disk(dev_info->gd); blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request); @@ -476,13 +457,24 @@ dcssblk_add_store(struct device *dev, const char *buf, size_t count) break; } PRINT_DEBUG("Segment %s loaded successfully\n", local_buf); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); rc = count; goto out; +unregister_dev: + PRINT_ERR("device_create_file() failed!\n"); + list_del(&dev_info->lh); + blk_put_queue(dev_info->dcssblk_queue); + dev_info->gd->queue = NULL; + put_disk(dev_info->gd); + device_unregister(&dev_info->dev); + segment_unload(dev_info->segment_name); + put_device(&dev_info->dev); + up_write(&dcssblk_devices_sem); + goto out; list_del: list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); unload_seg: segment_unload(local_buf); dealloc_gendisk: @@ -526,22 +518,21 @@ dcssblk_remove_store(struct device *dev, const char *buf, size_t count) goto out_buf; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); dev_info = dcssblk_get_device_by_name(local_buf); if (dev_info == NULL) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Segment %s is not loaded!\n", local_buf); rc = -ENODEV; goto out_buf; } if (atomic_read(&dev_info->use_count) != 0) { - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); PRINT_WARN("Segment %s is in use!\n", local_buf); rc = -EBUSY; goto out_buf; } list_del(&dev_info->lh); - write_unlock(&dcssblk_devices_lock); del_gendisk(dev_info->gd); blk_put_queue(dev_info->dcssblk_queue); @@ -552,6 +543,8 @@ dcssblk_remove_store(struct device *dev, const char *buf, size_t count) PRINT_DEBUG("Segment %s unloaded successfully\n", dev_info->segment_name); put_device(&dev_info->dev); + up_write(&dcssblk_devices_sem); + rc = count; out_buf: kfree(local_buf); @@ -587,7 +580,7 @@ dcssblk_release(struct inode *inode, struct file *filp) rc = -ENODEV; goto out; } - write_lock(&dcssblk_devices_lock); + down_write(&dcssblk_devices_sem); if (atomic_dec_and_test(&dev_info->use_count) && (dev_info->save_pending)) { PRINT_INFO("Segment %s became idle and is being saved now\n", @@ -595,7 +588,7 @@ dcssblk_release(struct inode *inode, struct file *filp) segment_replace(dev_info->segment_name); dev_info->save_pending = 0; } - write_unlock(&dcssblk_devices_lock); + up_write(&dcssblk_devices_sem); rc = 0; out: return rc; @@ -616,7 +609,7 @@ dcssblk_make_request(request_queue_t *q, struct bio *bio) dev_info = bio->bi_bdev->bd_disk->private_data; if (dev_info == NULL) goto fail; - if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0) + if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0) /* Request is not page-aligned. */ goto fail; if (((bio->bi_size >> 9) + bio->bi_sector) @@ -695,6 +688,7 @@ dcssblk_init(void) return rc; } dcssblk_major = rc; + init_rwsem(&dcssblk_devices_sem); PRINT_DEBUG("...finished!\n"); return 0; } diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 00885b09f..312057e93 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c @@ -155,7 +155,7 @@ static int xpram_page_in (unsigned long page_addr, unsigned int xpage_index) { int cc; - __asm__ __volatile( + __asm__ __volatile__ ( " lhi %0,2\n" /* return unused cc 2 if pgin traps */ " .insn rre,0xb22e0000,%1,%2\n" /* pgin %1,%2 */ "0: ipm %0\n" @@ -203,7 +203,7 @@ static long xpram_page_out (unsigned long page_addr, unsigned int xpage_index) { int cc; - __asm__ __volatile( + __asm__ __volatile__ ( " lhi %0,2\n" /* return unused cc 2 if pgout traps */ " .insn rre,0xb22f0000,%1,%2\n" /* pgout %1,%2 */ "0: ipm %0\n" @@ -290,7 +290,7 @@ static int xpram_make_request(request_queue_t *q, struct bio *bio) unsigned long bytes; int i; - if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0) + if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0) /* Request is not page-aligned. */ goto fail; if ((bio->bi_size >> 12) > xdev->size) @@ -332,16 +332,16 @@ fail: static int xpram_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct hd_geometry *geo; + struct hd_geometry __user *geo; unsigned long size; - if (cmd != HDIO_GETGEO) + if (cmd != HDIO_GETGEO) return -EINVAL; /* * get geometry: we have to fake one... trim the size to a * multiple of 64 (32k): tell we have 16 sectors, 4 heads, * whatever cylinders. Tell also that data starts at sector. 4. */ - geo = (struct hd_geometry *) arg; + geo = (struct hd_geometry __user *) arg; size = (xpram_pages * 8) & ~0x3f; put_user(size >> 6, &geo->cylinders); put_user(4, &geo->heads); @@ -423,7 +423,7 @@ static int __init xpram_setup_sizes(unsigned long pages) return 0; } -static struct request_queue xpram_queue; +static struct request_queue *xpram_queue; static int __init xpram_setup_blkdev(void) { @@ -450,8 +450,13 @@ static int __init xpram_setup_blkdev(void) * Assign the other needed values: make request function, sizes and * hardsect size. All the minor devices feature the same value. */ - blk_queue_make_request(&xpram_queue, xpram_make_request); - blk_queue_hardsect_size(&xpram_queue, 4096); + xpram_queue = blk_alloc_queue(GFP_KERNEL); + if (!xpram_queue) { + rc = -ENOMEM; + goto out_unreg; + } + blk_queue_make_request(xpram_queue, xpram_make_request); + blk_queue_hardsect_size(xpram_queue, 4096); /* * Setup device structures. @@ -467,7 +472,7 @@ static int __init xpram_setup_blkdev(void) disk->first_minor = i; disk->fops = &xpram_devops; disk->private_data = &xpram_devices[i]; - disk->queue = &xpram_queue; + disk->queue = xpram_queue; sprintf(disk->disk_name, "slram%d", i); sprintf(disk->devfs_name, "slram/%d", i); set_capacity(disk, xpram_sizes[i] << 1); @@ -475,6 +480,9 @@ static int __init xpram_setup_blkdev(void) } return 0; +out_unreg: + devfs_remove("slram"); + unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); out: while (i--) put_disk(xpram_disks[i]); @@ -493,6 +501,7 @@ static void __exit xpram_exit(void) } unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); devfs_remove("slram"); + blk_cleanup_queue(xpram_queue); sysdev_unregister(&xpram_sys_device); sysdev_class_unregister(&xpram_sysclass); } diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 0e724c813..e92bb9473 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -1002,7 +1002,8 @@ tty3215_write(struct tty_struct * tty, int from_user, ret = 0; while (count > 0) { length = count < 80 ? count : 80; - length -= copy_from_user(raw->ubuffer, buf, length); + length -= copy_from_user(raw->ubuffer, + (const unsigned char __user *)buf, length); if (length == 0) { if (!ret) ret = -EFAULT; diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index b124ebb7f..5e35728db 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c @@ -338,7 +338,7 @@ kbd_keycode(struct kbd_data *kbd, unsigned int keycode) * Ioctl stuff. */ static int -do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry *user_kbe, +do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry __user *user_kbe, int cmd, int perm) { struct kbentry tmp; @@ -410,7 +410,7 @@ do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry *user_kbe, } static int -do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry *u_kbs, +do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs, int cmd, int perm) { unsigned char kb_func; @@ -464,9 +464,12 @@ int kbd_ioctl(struct kbd_data *kbd, struct file *file, unsigned int cmd, unsigned long arg) { - struct kbdiacrs *a; + struct kbdiacrs __user *a; + void __user *argp; int ct, perm; + argp = (void __user *)arg; + /* * To have permissions to do most of the vt ioctls, we either have * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. @@ -474,15 +477,15 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, perm = current->signal->tty == kbd->tty || capable(CAP_SYS_TTY_CONFIG); switch (cmd) { case KDGKBTYPE: - return put_user(KB_101, (char*) arg); + return put_user(KB_101, (char __user *)argp); case KDGKBENT: case KDSKBENT: - return do_kdsk_ioctl(kbd, (struct kbentry *)arg, cmd, perm); + return do_kdsk_ioctl(kbd, argp, cmd, perm); case KDGKBSENT: case KDSKBSENT: - return do_kdgkb_ioctl(kbd, (struct kbsentry *)arg, cmd, perm); + return do_kdgkb_ioctl(kbd, argp, cmd, perm); case KDGKBDIACR: - a = (struct kbdiacrs *) arg; + a = argp; if (put_user(kbd->accent_table_size, &a->kb_cnt)) return -EFAULT; @@ -492,7 +495,7 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, return -EFAULT; return 0; case KDSKBDIACR: - a = (struct kbdiacrs *) arg; + a = argp; if (!perm) return -EPERM; if (get_user(ct, &a->kb_cnt)) diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 1035707f8..a1ad37580 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -112,46 +112,46 @@ sclp_tty_ioctl(struct tty_struct *tty, struct file * file, switch (cmd) { case TIOCSCLPSHTAB: /* set width of horizontal tab */ - if (get_user(sclp_ioctls.htab, (unsigned short *) arg)) + if (get_user(sclp_ioctls.htab, (unsigned short __user *) arg)) rc = -EFAULT; else check = 1; break; case TIOCSCLPGHTAB: /* get width of horizontal tab */ - if (put_user(sclp_ioctls.htab, (unsigned short *) arg)) + if (put_user(sclp_ioctls.htab, (unsigned short __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSECHO: /* enable/disable echo of input */ - if (get_user(sclp_ioctls.echo, (unsigned char *) arg)) + if (get_user(sclp_ioctls.echo, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPGECHO: /* Is echo of input enabled ? */ - if (put_user(sclp_ioctls.echo, (unsigned char *) arg)) + if (put_user(sclp_ioctls.echo, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSCOLS: /* set number of columns for output */ - if (get_user(sclp_ioctls.columns, (unsigned short *) arg)) + if (get_user(sclp_ioctls.columns, (unsigned short __user *) arg)) rc = -EFAULT; else check = 1; break; case TIOCSCLPGCOLS: /* get number of columns for output */ - if (put_user(sclp_ioctls.columns, (unsigned short *) arg)) + if (put_user(sclp_ioctls.columns, (unsigned short __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSNL: /* enable/disable writing without final new line character */ - if (get_user(sclp_ioctls.final_nl, (signed char *) arg)) + if (get_user(sclp_ioctls.final_nl, (signed char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPGNL: /* Is writing without final new line character enabled ? */ - if (put_user(sclp_ioctls.final_nl, (signed char *) arg)) + if (put_user(sclp_ioctls.final_nl, (signed char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSOBUF: @@ -160,7 +160,7 @@ sclp_tty_ioctl(struct tty_struct *tty, struct file * file, * up to next 4kB boundary and stored as number of SCCBs * (4kB Buffers) limitation: 256 x 4kB */ - if (get_user(obuf, (unsigned int *) arg) == 0) { + if (get_user(obuf, (unsigned int __user *) arg) == 0) { if (obuf & 0xFFF) sclp_ioctls.max_sccb = (obuf >> 12) + 1; else @@ -171,22 +171,22 @@ sclp_tty_ioctl(struct tty_struct *tty, struct file * file, case TIOCSCLPGOBUF: /* get the maximum buffers size for output */ obuf = sclp_ioctls.max_sccb << 12; - if (put_user(obuf, (unsigned int *) arg)) + if (put_user(obuf, (unsigned int __user *) arg)) rc = -EFAULT; break; case TIOCSCLPGKBUF: /* get the number of buffers got from kernel at startup */ - if (put_user(sclp_ioctls.kmem_sccb, (unsigned short *) arg)) + if (put_user(sclp_ioctls.kmem_sccb, (unsigned short __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSCASE: /* enable/disable conversion from upper to lower case */ - if (get_user(sclp_ioctls.tolower, (unsigned char *) arg)) + if (get_user(sclp_ioctls.tolower, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPGCASE: /* Is conversion from upper to lower case of input enabled? */ - if (put_user(sclp_ioctls.tolower, (unsigned char *) arg)) + if (put_user(sclp_ioctls.tolower, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSDELIM: @@ -194,7 +194,7 @@ sclp_tty_ioctl(struct tty_struct *tty, struct file * file, * set special character used for separating upper and * lower case, 0x00 disables this feature */ - if (get_user(sclp_ioctls.delim, (unsigned char *) arg)) + if (get_user(sclp_ioctls.delim, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPGDELIM: @@ -202,7 +202,7 @@ sclp_tty_ioctl(struct tty_struct *tty, struct file * file, * get special character used for separating upper and * lower case, 0x00 disables this feature */ - if (put_user(sclp_ioctls.delim, (unsigned char *) arg)) + if (put_user(sclp_ioctls.delim, (unsigned char __user *) arg)) rc = -EFAULT; break; case TIOCSCLPSINIT: @@ -415,7 +415,8 @@ sclp_tty_write(struct tty_struct *tty, int from_user, while (count > 0) { length = count < SCLP_TTY_BUF_SIZE ? count : SCLP_TTY_BUF_SIZE; - length -= copy_from_user(sclp_tty_chars, buf, length); + length -= copy_from_user(sclp_tty_chars, + (const unsigned char __user *)buf, length); if (length == 0) { if (!ret) ret = -EFAULT; diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 32d439726..22760a120 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -490,7 +490,8 @@ sclp_vt220_write(struct tty_struct *tty, int from_user, while (count > 0) { length = count < SCLP_VT220_BUF_SIZE ? count : SCLP_VT220_BUF_SIZE; - length -= copy_from_user(tty->driver_data, buf, length); + length -= copy_from_user(tty->driver_data, + (const unsigned char __user *)buf, length); if (length == 0) { if (!ret) return -EFAULT; diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index 272bd1c75..d04e6c2c3 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h @@ -32,7 +32,7 @@ struct gendisk; #ifdef DBF_LIKE_HELL #define DBF_LH(level, str, ...) \ do { \ - debug_sprintf_event(tape_dbf_area, level, str, ## __VA_ARGS__); \ + debug_sprintf_event(TAPE_DBF_AREA, level, str, ## __VA_ARGS__); \ } while (0) #else #define DBF_LH(level, str, ...) do {} while(0) @@ -43,12 +43,12 @@ do { \ */ #define DBF_EVENT(d_level, d_str...) \ do { \ - debug_sprintf_event(tape_dbf_area, d_level, d_str); \ + debug_sprintf_event(TAPE_DBF_AREA, d_level, d_str); \ } while (0) #define DBF_EXCEPTION(d_level, d_str...) \ do { \ - debug_sprintf_exception(tape_dbf_area, d_level, d_str); \ + debug_sprintf_exception(TAPE_DBF_AREA, d_level, d_str); \ } while (0) #define TAPE_VERSION_MAJOR 2 @@ -313,7 +313,7 @@ extern void tape_dump_sense_dbf(struct tape_device *, struct tape_request *, extern void tape_med_state_set(struct tape_device *, enum tape_medium_state); /* The debug area */ -extern debug_info_t *tape_dbf_area; +extern debug_info_t *TAPE_DBF_AREA; /* functions for building ccws */ static inline struct ccw1 * diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index e738c4d37..480ec8797 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c @@ -15,11 +15,19 @@ #include #include +#define TAPE_DBF_AREA tape_34xx_dbf + #include "tape.h" #include "tape_std.h" #define PRINTK_HEADER "TAPE_34XX: " +/* + * Pointer to debug area. + */ +debug_info_t *TAPE_DBF_AREA = NULL; +EXPORT_SYMBOL(TAPE_DBF_AREA); + enum tape_34xx_type { tape_3480, tape_3490, @@ -885,7 +893,7 @@ tape_34xx_ioctl(struct tape_device *device, unsigned int cmd, unsigned long arg) if (cmd == TAPE390_DISPLAY) { struct display_struct disp; - if (copy_from_user(&disp, (char *) arg, sizeof(disp)) != 0) + if (copy_from_user(&disp, (char __user *) arg, sizeof(disp)) != 0) return -EFAULT; return tape_std_display(device, &disp); @@ -1343,7 +1351,13 @@ tape_34xx_init (void) { int rc; - DBF_EVENT(3, "34xx init: $Revision: 1.20 $\n"); + TAPE_DBF_AREA = debug_register ( "tape_34xx", 1, 2, 4*sizeof(long)); + debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view); +#ifdef DBF_LIKE_HELL + debug_set_level(TAPE_DBF_AREA, 6); +#endif + + DBF_EVENT(3, "34xx init: $Revision: 1.21 $\n"); /* Register driver for 3480/3490 tapes. */ rc = ccw_driver_register(&tape_34xx_driver); if (rc) @@ -1357,12 +1371,14 @@ static void tape_34xx_exit(void) { ccw_driver_unregister(&tape_34xx_driver); + + debug_unregister(TAPE_DBF_AREA); } MODULE_DEVICE_TABLE(ccw, tape_34xx_ids); MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH"); MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape " - "device driver ($Revision: 1.20 $)"); + "device driver ($Revision: 1.21 $)"); MODULE_LICENSE("GPL"); module_init(tape_34xx_init); diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 7f4ab64c1..b7f4e7b8b 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c @@ -19,6 +19,8 @@ #include +#define TAPE_DBF_AREA tape_core_dbf + #include "tape.h" #define PRINTK_HEADER "TAPE_BLOCK: " diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index ccbe214d7..0d0343b87 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -18,6 +18,8 @@ #include +#define TAPE_DBF_AREA tape_core_dbf + #include "tape.h" #include "tape_std.h" #include "tape_class.h" @@ -29,8 +31,8 @@ /* * file operation structure for tape character frontend */ -static ssize_t tapechar_read(struct file *, char *, size_t, loff_t *); -static ssize_t tapechar_write(struct file *, const char *, size_t, loff_t *); +static ssize_t tapechar_read(struct file *, char __user *, size_t, loff_t *); +static ssize_t tapechar_write(struct file *, const char __user *, size_t, loff_t *); static int tapechar_open(struct inode *,struct file *); static int tapechar_release(struct inode *,struct file *); static int tapechar_ioctl(struct inode *, struct file *, unsigned int, @@ -134,7 +136,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size) * Tape device read function */ ssize_t -tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos) +tapechar_read(struct file *filp, char __user *data, size_t count, loff_t *ppos) { struct tape_device *device; struct tape_request *request; @@ -208,7 +210,7 @@ tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos) * Tape device write function */ ssize_t -tapechar_write(struct file *filp, const char *data, size_t count, loff_t *ppos) +tapechar_write(struct file *filp, const char __user *data, size_t count, loff_t *ppos) { struct tape_device *device; struct tape_request *request; @@ -389,7 +391,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp, if (no == MTIOCTOP) { struct mtop op; - if (copy_from_user(&op, (char *) data, sizeof(op)) != 0) + if (copy_from_user(&op, (char __user *) data, sizeof(op)) != 0) return -EFAULT; if (op.mt_count < 0) return -EINVAL; @@ -436,7 +438,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp, if (rc < 0) return rc; pos.mt_blkno = rc; - if (copy_to_user((char *) data, &pos, sizeof(pos)) != 0) + if (copy_to_user((char __user *) data, &pos, sizeof(pos)) != 0) return -EFAULT; return 0; } @@ -466,7 +468,7 @@ tapechar_ioctl(struct inode *inp, struct file *filp, get.mt_blkno = rc; } - if (copy_to_user((char *) data, &get, sizeof(get)) != 0) + if (copy_to_user((char __user *) data, &get, sizeof(get)) != 0) return -EFAULT; return 0; diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 6d7c5c0f2..668fe3f11 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c @@ -20,6 +20,8 @@ #include // for variable types +#define TAPE_DBF_AREA tape_core_dbf + #include "tape.h" #include "tape_std.h" @@ -39,7 +41,8 @@ static rwlock_t tape_device_lock = RW_LOCK_UNLOCKED; /* * Pointer to debug area. */ -debug_info_t *tape_dbf_area = NULL; +debug_info_t *TAPE_DBF_AREA = NULL; +EXPORT_SYMBOL(TAPE_DBF_AREA); /* * Printable strings for tape enumerations. @@ -1176,12 +1179,12 @@ tape_mtop(struct tape_device *device, int mt_op, int mt_count) static int tape_init (void) { - tape_dbf_area = debug_register ( "tape", 1, 2, 4*sizeof(long)); - debug_register_view(tape_dbf_area, &debug_sprintf_view); + TAPE_DBF_AREA = debug_register ( "tape", 1, 2, 4*sizeof(long)); + debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view); #ifdef DBF_LIKE_HELL - debug_set_level(tape_dbf_area, 6); + debug_set_level(TAPE_DBF_AREA, 6); #endif - DBF_EVENT(3, "tape init: ($Revision: 1.49 $)\n"); + DBF_EVENT(3, "tape init: ($Revision: 1.50 $)\n"); tape_proc_init(); tapechar_init (); tapeblock_init (); @@ -1200,19 +1203,18 @@ tape_exit(void) tapechar_exit(); tapeblock_exit(); tape_proc_cleanup(); - debug_unregister (tape_dbf_area); + debug_unregister (TAPE_DBF_AREA); } MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and " "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)"); MODULE_DESCRIPTION("Linux on zSeries channel attached " - "tape device driver ($Revision: 1.49 $)"); + "tape device driver ($Revision: 1.50 $)"); MODULE_LICENSE("GPL"); module_init(tape_init); module_exit(tape_exit); -EXPORT_SYMBOL(tape_dbf_area); EXPORT_SYMBOL(tape_generic_remove); EXPORT_SYMBOL(tape_generic_probe); EXPORT_SYMBOL(tape_generic_online); diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c index 11d56de8d..801d17cca 100644 --- a/drivers/s390/char/tape_proc.c +++ b/drivers/s390/char/tape_proc.c @@ -16,6 +16,8 @@ #include #include +#define TAPE_DBF_AREA tape_core_dbf + #include "tape.h" #define PRINTK_HEADER "TAPE_PROC: " diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index afa014fe8..2f9fe3098 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c @@ -22,6 +22,8 @@ #include #include +#define TAPE_DBF_AREA tape_core_dbf + #include "tape.h" #include "tape_std.h" diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c index 71c03c87e..3720e77b4 100644 --- a/drivers/s390/cio/airq.c +++ b/drivers/s390/cio/airq.c @@ -2,7 +2,7 @@ * drivers/s390/cio/airq.c * S/390 common I/O routines -- support for adapter interruptions * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -14,11 +14,11 @@ #include #include #include +#include #include "cio_debug.h" #include "airq.h" -static spinlock_t adapter_lock = SPIN_LOCK_UNLOCKED; static adapter_int_handler_t adapter_handler; /* @@ -40,23 +40,17 @@ s390_register_adapter_interrupt (adapter_int_handler_t handler) CIO_TRACE_EVENT (4, "rgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (adapter_handler) - ret = -EBUSY; - else { - adapter_handler = handler; - ret = 0; - } - - spin_unlock (&adapter_lock); + else + ret = (cmpxchg(&adapter_handler, NULL, handler) ? -EBUSY : 0); + if (!ret) + synchronize_kernel(); sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } int @@ -67,38 +61,26 @@ s390_unregister_adapter_interrupt (adapter_int_handler_t handler) CIO_TRACE_EVENT (4, "urgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (handler != adapter_handler) - ret = -EINVAL; else { adapter_handler = NULL; + synchronize_kernel(); ret = 0; } - - spin_unlock (&adapter_lock); - sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } void do_adapter_IO (void) { - CIO_TRACE_EVENT (4, "doaio"); - - spin_lock (&adapter_lock); + CIO_TRACE_EVENT (6, "doaio"); if (adapter_handler) (*adapter_handler) (); - - spin_unlock (&adapter_lock); - - return; } EXPORT_SYMBOL (s390_register_adapter_interrupt); diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 0589933b9..29000d5e7 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c @@ -308,7 +308,7 @@ static int cio_ignore_read (char *page, char **start, off_t off, return len; } -static int cio_ignore_write (struct file *file, const char *user_buf, +static int cio_ignore_write(struct file *file, const char __user *user_buf, unsigned long user_len, void *data) { char *buf; diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 6d0179f6a..9b86522fb 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/ccwgroup.c * bus driver for ccwgroup - * $Revision: 1.27 $ + * $Revision: 1.28 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -179,12 +179,12 @@ ccwgroup_create(struct device *root, || gdev->cdev[i]->id.driver_info != gdev->cdev[0]->id.driver_info) { rc = -EINVAL; - goto error; + goto free_dev; } /* Don't allow a device to belong to more than one group. */ if (gdev->cdev[i]->dev.driver_data) { rc = -EINVAL; - goto error; + goto free_dev; } } for (i = 0; i < argc; i++) @@ -207,8 +207,8 @@ ccwgroup_create(struct device *root, rc = device_register(&gdev->dev); if (rc) - goto error; - + goto free_dev; + get_device(&gdev->dev); rc = device_create_file(&gdev->dev, &dev_attr_ungroup); if (rc) { @@ -217,12 +217,21 @@ ccwgroup_create(struct device *root, } rc = __ccwgroup_create_symlinks(gdev); - if (!rc) + if (!rc) { + put_device(&gdev->dev); return 0; - + } device_remove_file(&gdev->dev, &dev_attr_ungroup); device_unregister(&gdev->dev); error: + for (i = 0; i < argc; i++) + if (gdev->cdev[i]) { + put_device(&gdev->cdev[i]->dev); + gdev->cdev[i]->dev.driver_data = NULL; + } + put_device(&gdev->dev); + return rc; +free_dev: for (i = 0; i < argc; i++) if (gdev->cdev[i]) { put_device(&gdev->cdev[i]->dev); @@ -230,7 +239,6 @@ error: gdev->cdev[i]->dev.driver_data = NULL; } kfree(gdev); - return rc; } diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 4a26cf1b1..4c8d6df06 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/chsc.c * S/390 common I/O routines -- channel subsystem call - * $Revision: 1.110 $ + * $Revision: 1.112 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -24,7 +24,6 @@ #include "ioasm.h" #include "chsc.h" -#define CHPID_LONGS (256 / (8 * sizeof(long))) /* 256 chpids */ static struct channel_path *chps[NR_CHPIDS]; static void *sei_page; @@ -62,11 +61,11 @@ chpid_is_actually_online(int chp) int state; state = get_chp_status(chp); - if (state < 0) - new_channel_path(chp); - else + if (state < 0) { + need_rescan = 1; + queue_work(slow_path_wq, &slow_path_work); + } else WARN_ON(!state); - /* FIXME: should notify other subchannels here */ } /* FIXME: this is _always_ called for every subchannel. shouldn't we @@ -285,8 +284,10 @@ out_unlock: out_unreg: spin_unlock(&sch->lock); sch->lpm = 0; - /* We can't block here. */ - device_call_nopath_notify(sch); + if (css_enqueue_subchannel_slow(sch->irq)) { + css_clear_subchannel_slow_list(); + need_rescan = 1; + } return 0; } @@ -303,6 +304,9 @@ s390_set_chpid_offline( __u8 chpid) bus_for_each_dev(&css_bus_type, NULL, &chpid, s390_subchannel_remove_chpid); + + if (need_rescan || css_slow_subchannels_exist()) + queue_work(slow_path_wq, &slow_path_work); } static int @@ -737,10 +741,12 @@ __s390_subchannel_vary_chpid(struct subchannel *sch, __u8 chpid, int on) * can successfully terminate, even using the * just varied off path. Then kill it. */ - if (!__check_for_io_and_kill(sch, chp) && !sch->lpm) - /* Get over with it now. */ - device_call_nopath_notify(sch); - else if (sch->driver && sch->driver->verify) + if (!__check_for_io_and_kill(sch, chp) && !sch->lpm) { + if (css_enqueue_subchannel_slow(sch->irq)) { + css_clear_subchannel_slow_list(); + need_rescan = 1; + } + } else if (sch->driver && sch->driver->verify) sch->driver->verify(&sch->dev); } break; @@ -773,11 +779,6 @@ s390_subchannel_vary_chpid_on(struct device *dev, void *data) return 0; } -extern void css_trigger_slow_path(void); -typedef void (*workfunc)(void *); -static DECLARE_WORK(varyonoff_work, (workfunc)css_trigger_slow_path, - NULL); - /* * Function: s390_vary_chpid * Varies the specified chpid online or offline @@ -813,7 +814,7 @@ s390_vary_chpid( __u8 chpid, int on) s390_subchannel_vary_chpid_on : s390_subchannel_vary_chpid_off); if (!on) - return 0; + goto out; /* Scan for new devices on varied on path. */ for (irq = 0; irq < __MAX_SUBCHANNELS; irq++) { struct schib schib; @@ -835,8 +836,9 @@ s390_vary_chpid( __u8 chpid, int on) need_rescan = 1; } } +out: if (need_rescan || css_slow_subchannels_exist()) - schedule_work(&varyonoff_work); + queue_work(slow_path_wq, &slow_path_work); return 0; } diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index 6f02ac0c9..90f5a9e73 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h @@ -23,5 +23,4 @@ extern struct channel_path *chps[]; extern void s390_process_css( void ); extern void chsc_validate_chpids(struct subchannel *); extern void chpid_is_actually_online(int); -extern int is_chpid_online(int); #endif diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 3c786706b..a16f061fd 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/cio.c * S/390 common I/O routines -- low level i/o calls - * $Revision: 1.121 $ + * $Revision: 1.123 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -67,17 +67,17 @@ cio_debug_init (void) if (!cio_debug_msg_id) goto out_unregister; debug_register_view (cio_debug_msg_id, &debug_sprintf_view); - debug_set_level (cio_debug_msg_id, 6); + debug_set_level (cio_debug_msg_id, 2); cio_debug_trace_id = debug_register ("cio_trace", 4, 4, 8); if (!cio_debug_trace_id) goto out_unregister; debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view); - debug_set_level (cio_debug_trace_id, 6); + debug_set_level (cio_debug_trace_id, 2); cio_debug_crw_id = debug_register ("cio_crw", 2, 4, 16*sizeof (long)); if (!cio_debug_crw_id) goto out_unregister; debug_register_view (cio_debug_crw_id, &debug_sprintf_view); - debug_set_level (cio_debug_crw_id, 6); + debug_set_level (cio_debug_crw_id, 2); pr_debug("debugging initialized\n"); return 0; diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index ed8507e79..f99652855 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/css.c * driver for channel subsystem - * $Revision: 1.74 $ + * $Revision: 1.77 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -166,10 +166,12 @@ css_get_subchannel_status(struct subchannel *sch, int schid) if (sch && sch->schib.pmcw.dnv && (schib.pmcw.dev != sch->schib.pmcw.dev)) return CIO_REVALIDATE; + if (sch && !sch->lpm) + return CIO_NO_PATH; return CIO_OPER; } -static inline int +static int css_evaluate_subchannel(int irq, int slow) { int event, ret, disc; @@ -188,7 +190,11 @@ css_evaluate_subchannel(int irq, int slow) return -EAGAIN; /* Will be done on the slow path. */ } event = css_get_subchannel_status(sch, irq); + CIO_MSG_EVENT(4, "Evaluating schid %04x, event %d, %s, %s path.\n", + irq, event, sch?(disc?"disconnected":"normal"):"unknown", + slow?"slow":"fast"); switch (event) { + case CIO_NO_PATH: case CIO_GONE: if (!sch) { /* Never used this subchannel. Ignore. */ @@ -196,7 +202,8 @@ css_evaluate_subchannel(int irq, int slow) break; } if (sch->driver && sch->driver->notify && - sch->driver->notify(&sch->dev, CIO_GONE)) { + sch->driver->notify(&sch->dev, event)) { + cio_disable_subchannel(sch); device_set_disconnected(sch); ret = 0; break; @@ -205,6 +212,7 @@ css_evaluate_subchannel(int irq, int slow) * Unregister subchannel. * The device will be killed automatically. */ + cio_disable_subchannel(sch); device_unregister(&sch->dev); /* Reset intparm to zeroes. */ sch->schib.pmcw.intparm = 0; @@ -266,23 +274,44 @@ css_rescan_devices(void) } } -static void -css_evaluate_slow_subchannel(unsigned long schid) -{ - css_evaluate_subchannel(schid, 1); -} +struct slow_subchannel { + struct list_head slow_list; + unsigned long schid; +}; -void +static LIST_HEAD(slow_subchannels_head); +static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED; + +static void css_trigger_slow_path(void) { + CIO_TRACE_EVENT(4, "slowpath"); + if (need_rescan) { need_rescan = 0; css_rescan_devices(); return; } - css_walk_subchannel_slow_list(css_evaluate_slow_subchannel); + + spin_lock_irq(&slow_subchannel_lock); + while (!list_empty(&slow_subchannels_head)) { + struct slow_subchannel *slow_sch = + list_entry(slow_subchannels_head.next, + struct slow_subchannel, slow_list); + + list_del_init(slow_subchannels_head.next); + spin_unlock_irq(&slow_subchannel_lock); + css_evaluate_subchannel(slow_sch->schid, 1); + spin_lock_irq(&slow_subchannel_lock); + kfree(slow_sch); + } + spin_unlock_irq(&slow_subchannel_lock); } +typedef void (*workfunc)(void *); +DECLARE_WORK(slow_path_work, (workfunc)css_trigger_slow_path, NULL); +struct workqueue_struct *slow_path_wq; + /* * Rescan for new devices. FIXME: This is slow. * This function is called when we have lost CRWs due to overflows and we have @@ -443,14 +472,6 @@ s390_root_dev_unregister(struct device *dev) device_unregister(dev); } -struct slow_subchannel { - struct list_head slow_list; - unsigned long schid; -}; - -static LIST_HEAD(slow_subchannels_head); -static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED; - int css_enqueue_subchannel_slow(unsigned long schid) { @@ -484,25 +505,7 @@ css_clear_subchannel_slow_list(void) spin_unlock_irqrestore(&slow_subchannel_lock, flags); } -void -css_walk_subchannel_slow_list(void (*fn)(unsigned long)) -{ - unsigned long flags; - spin_lock_irqsave(&slow_subchannel_lock, flags); - while (!list_empty(&slow_subchannels_head)) { - struct slow_subchannel *slow_sch = - list_entry(slow_subchannels_head.next, - struct slow_subchannel, slow_list); - - list_del_init(slow_subchannels_head.next); - spin_unlock_irqrestore(&slow_subchannel_lock, flags); - fn(slow_sch->schid); - spin_lock_irqsave(&slow_subchannel_lock, flags); - kfree(slow_sch); - } - spin_unlock_irqrestore(&slow_subchannel_lock, flags); -} int css_slow_subchannels_exist(void) diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 54beb1340..b834e6a72 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h @@ -136,7 +136,6 @@ void device_trigger_reprobe(struct subchannel *); /* Helper functions for vary on/off. */ void device_set_waiting(struct subchannel *); -void device_call_nopath_notify(struct subchannel *); /* Helper functions to build lists for the slow path. */ int css_enqueue_subchannel_slow(unsigned long schid); @@ -144,4 +143,7 @@ void css_walk_subchannel_slow_list(void (*fn)(unsigned long)); void css_clear_subchannel_slow_list(void); int css_slow_subchannels_exist(void); extern int need_rescan; + +extern struct workqueue_struct *slow_path_wq; +extern struct work_struct slow_path_work; #endif diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 1b7a39b68..a921b1fea 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/device.c * bus driver for ccw devices - * $Revision: 1.117 $ + * $Revision: 1.120 $ * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -159,6 +159,11 @@ init_ccw_bus_type (void) ret = -ENOMEM; /* FIXME: better errno ? */ goto out_err; } + slow_path_wq = create_singlethread_workqueue("kslowcrw"); + if (!slow_path_wq) { + ret = -ENOMEM; /* FIXME: better errno ? */ + goto out_err; + } if ((ret = bus_register (&ccw_bus_type))) goto out_err; @@ -174,6 +179,8 @@ out_err: destroy_workqueue(ccw_device_work); if (ccw_device_notify_work) destroy_workqueue(ccw_device_notify_work); + if (slow_path_wq) + destroy_workqueue(slow_path_wq); return ret; } @@ -519,7 +526,8 @@ get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) cdev = to_ccwdev(dev); if ((cdev->private->state == DEV_STATE_DISCONNECTED) && (cdev->private->devno == devno) && - (!strncmp(cdev->dev.bus_id, sibling->dev.bus_id, 4))) { + (!strncmp(cdev->dev.bus_id, sibling->dev.bus_id, + BUS_ID_SIZE))) { cdev->private->state = DEV_STATE_NOT_OPER; break; } @@ -646,9 +654,7 @@ ccw_device_call_sch_unregister(void *data) struct subchannel *sch; sch = to_subchannel(cdev->dev.parent); - /* Check if device is registered. */ - if (!list_empty(&sch->dev.node)) - device_unregister(&sch->dev); + device_unregister(&sch->dev); /* Reset intparm to zeroes. */ sch->schib.pmcw.intparm = 0; cio_modify(sch); @@ -677,7 +683,7 @@ io_subchannel_recog_done(struct ccw_device *cdev) sch = to_subchannel(cdev->dev.parent); INIT_WORK(&cdev->private->kick_work, ccw_device_call_sch_unregister, (void *) cdev); - queue_work(ccw_device_work, &cdev->private->kick_work); + queue_work(slow_path_wq, &cdev->private->kick_work); break; case DEV_STATE_BOXED: /* Device did not respond in time. */ diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index c131f13d3..508f1a7fb 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c @@ -458,20 +458,6 @@ ccw_device_nopath_notify(void *data) } } -void -device_call_nopath_notify(struct subchannel *sch) -{ - struct ccw_device *cdev; - - if (!sch->dev.driver_data) - return; - cdev = sch->dev.driver_data; - PREPARE_WORK(&cdev->private->kick_work, - ccw_device_nopath_notify, (void *)cdev); - queue_work(ccw_device_notify_work, &cdev->private->kick_work); -} - - void ccw_device_verify_done(struct ccw_device *cdev, int err) { @@ -1085,103 +1071,103 @@ ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event) * device statemachine */ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = { - [DEV_STATE_NOT_OPER] { - [DEV_EVENT_NOTOPER] ccw_device_nop, - [DEV_EVENT_INTERRUPT] ccw_device_bug, - [DEV_EVENT_TIMEOUT] ccw_device_nop, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_NOT_OPER] = { + [DEV_EVENT_NOTOPER] = ccw_device_nop, + [DEV_EVENT_INTERRUPT] = ccw_device_bug, + [DEV_EVENT_TIMEOUT] = ccw_device_nop, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_SENSE_PGID] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_sense_pgid_irq, - [DEV_EVENT_TIMEOUT] ccw_device_onoff_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_SENSE_PGID] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_sense_pgid_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_SENSE_ID] { - [DEV_EVENT_NOTOPER] ccw_device_recog_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_sense_id_irq, - [DEV_EVENT_TIMEOUT] ccw_device_recog_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_SENSE_ID] = { + [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_OFFLINE] { - [DEV_EVENT_NOTOPER] ccw_device_offline_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_offline_irq, - [DEV_EVENT_TIMEOUT] ccw_device_nop, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_OFFLINE] = { + [DEV_EVENT_NOTOPER] = ccw_device_offline_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_offline_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_nop, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_VERIFY] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_verify_irq, - [DEV_EVENT_TIMEOUT] ccw_device_onoff_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_VERIFY] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_verify_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_ONLINE] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_irq, - [DEV_EVENT_TIMEOUT] ccw_device_online_timeout, - [DEV_EVENT_VERIFY] ccw_device_online_verify, + [DEV_STATE_ONLINE] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_online_timeout, + [DEV_EVENT_VERIFY] = ccw_device_online_verify, }, - [DEV_STATE_W4SENSE] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_w4sense, - [DEV_EVENT_TIMEOUT] ccw_device_nop, - [DEV_EVENT_VERIFY] ccw_device_online_verify, + [DEV_STATE_W4SENSE] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_w4sense, + [DEV_EVENT_TIMEOUT] = ccw_device_nop, + [DEV_EVENT_VERIFY] = ccw_device_online_verify, }, - [DEV_STATE_DISBAND_PGID] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_disband_irq, - [DEV_EVENT_TIMEOUT] ccw_device_onoff_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_DISBAND_PGID] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_disband_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_BOXED] { - [DEV_EVENT_NOTOPER] ccw_device_offline_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_stlck_done, - [DEV_EVENT_TIMEOUT] ccw_device_stlck_done, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_BOXED] = { + [DEV_EVENT_NOTOPER] = ccw_device_offline_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_stlck_done, + [DEV_EVENT_TIMEOUT] = ccw_device_stlck_done, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, /* states to wait for i/o completion before doing something */ - [DEV_STATE_CLEAR_VERIFY] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_clear_verify, - [DEV_EVENT_TIMEOUT] ccw_device_nop, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_CLEAR_VERIFY] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_clear_verify, + [DEV_EVENT_TIMEOUT] = ccw_device_nop, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_TIMEOUT_KILL] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_killing_irq, - [DEV_EVENT_TIMEOUT] ccw_device_killing_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, //FIXME + [DEV_STATE_TIMEOUT_KILL] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_killing_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_killing_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, //FIXME }, - [DEV_STATE_WAIT4IO] { - [DEV_EVENT_NOTOPER] ccw_device_online_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_wait4io_irq, - [DEV_EVENT_TIMEOUT] ccw_device_wait4io_timeout, - [DEV_EVENT_VERIFY] ccw_device_wait4io_verify, + [DEV_STATE_WAIT4IO] = { + [DEV_EVENT_NOTOPER] = ccw_device_online_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_wait4io_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_wait4io_timeout, + [DEV_EVENT_VERIFY] = ccw_device_wait4io_verify, }, - [DEV_STATE_QUIESCE] { - [DEV_EVENT_NOTOPER] ccw_device_quiesce_done, - [DEV_EVENT_INTERRUPT] ccw_device_quiesce_done, - [DEV_EVENT_TIMEOUT] ccw_device_quiesce_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_QUIESCE] = { + [DEV_EVENT_NOTOPER] = ccw_device_quiesce_done, + [DEV_EVENT_INTERRUPT] = ccw_device_quiesce_done, + [DEV_EVENT_TIMEOUT] = ccw_device_quiesce_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, /* special states for devices gone not operational */ - [DEV_STATE_DISCONNECTED] { - [DEV_EVENT_NOTOPER] ccw_device_nop, - [DEV_EVENT_INTERRUPT] ccw_device_start_id, - [DEV_EVENT_TIMEOUT] ccw_device_bug, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_DISCONNECTED] = { + [DEV_EVENT_NOTOPER] = ccw_device_nop, + [DEV_EVENT_INTERRUPT] = ccw_device_start_id, + [DEV_EVENT_TIMEOUT] = ccw_device_bug, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_DISCONNECTED_SENSE_ID] { - [DEV_EVENT_NOTOPER] ccw_device_recog_notoper, - [DEV_EVENT_INTERRUPT] ccw_device_sense_id_irq, - [DEV_EVENT_TIMEOUT] ccw_device_recog_timeout, - [DEV_EVENT_VERIFY] ccw_device_nop, + [DEV_STATE_DISCONNECTED_SENSE_ID] = { + [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper, + [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq, + [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout, + [DEV_EVENT_VERIFY] = ccw_device_nop, }, - [DEV_STATE_CMFCHANGE] { - [DEV_EVENT_NOTOPER] ccw_device_change_cmfstate, - [DEV_EVENT_INTERRUPT] ccw_device_change_cmfstate, - [DEV_EVENT_TIMEOUT] ccw_device_change_cmfstate, - [DEV_EVENT_VERIFY] ccw_device_change_cmfstate, + [DEV_STATE_CMFCHANGE] = { + [DEV_EVENT_NOTOPER] = ccw_device_change_cmfstate, + [DEV_EVENT_INTERRUPT] = ccw_device_change_cmfstate, + [DEV_EVENT_TIMEOUT] = ccw_device_change_cmfstate, + [DEV_EVENT_VERIFY] = ccw_device_change_cmfstate, }, }; diff --git a/drivers/s390/cio/requestirq.c b/drivers/s390/cio/requestirq.c index acc5217be..0ce71a219 100644 --- a/drivers/s390/cio/requestirq.c +++ b/drivers/s390/cio/requestirq.c @@ -1,7 +1,7 @@ /* * drivers/s390/cio/requestirq.c * S/390 common I/O routines -- enabling and disabling of devices - * $Revision: 1.45 $ + * $Revision: 1.46 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -18,21 +18,6 @@ #include "css.h" -/* for compatiblity only... */ -int -request_irq (unsigned int irq, - void (*handler) (int, void *, struct pt_regs *), - unsigned long irqflags, const char *devname, void *dev_id) -{ - return -EINVAL; -} - -/* for compatiblity only... */ -void -free_irq (unsigned int irq, void *dev_id) -{ -} - struct pgid global_pgid; EXPORT_SYMBOL_GPL(global_pgid); diff --git a/drivers/s390/crypto/z90crypt.h b/drivers/s390/crypto/z90crypt.h index 4ec1eaadf..dbc5dd0a5 100644 --- a/drivers/s390/crypto/z90crypt.h +++ b/drivers/s390/crypto/z90crypt.h @@ -46,12 +46,12 @@ * - length(n_modulus) = inputdatalength */ struct ica_rsa_modexpo { - char * inputdata; + char __user * inputdata; unsigned int inputdatalength; - char * outputdata; + char __user * outputdata; unsigned int outputdatalength; - char * b_key; - char * n_modulus; + char __user * b_key; + char __user * n_modulus; }; /** @@ -69,15 +69,15 @@ struct ica_rsa_modexpo { * - length(u_mult_inv) = inputdatalength/2 + 8 */ struct ica_rsa_modexpo_crt { - char * inputdata; + char __user * inputdata; unsigned int inputdatalength; - char * outputdata; + char __user * outputdata; unsigned int outputdatalength; - char * bp_key; - char * bq_key; - char * np_prime; - char * nq_prime; - char * u_mult_inv; + char __user * bp_key; + char __user * bq_key; + char __user * np_prime; + char __user * nq_prime; + char __user * u_mult_inv; }; #define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c index 0190e2756..8ac1e9b75 100644 --- a/drivers/s390/crypto/z90main.c +++ b/drivers/s390/crypto/z90main.c @@ -361,7 +361,7 @@ struct work_element { int buff_size; // size of the buffer for the request char resp_buff[RESPBUFFSIZE]; int resp_buff_size; - char * resp_addr; // address of response in user space + char __user * resp_addr; // address of response in user space unsigned int funccode; // function code of request wait_queue_head_t waitq; unsigned long requestsent; // time at which the request was sent @@ -378,8 +378,9 @@ struct work_element { */ static int z90crypt_open(struct inode *, struct file *); static int z90crypt_release(struct inode *, struct file *); -static ssize_t z90crypt_read(struct file *, char *, size_t, loff_t *); -static ssize_t z90crypt_write(struct file *, const char *, size_t, loff_t *); +static ssize_t z90crypt_read(struct file *, char __user *, size_t, loff_t *); +static ssize_t z90crypt_write(struct file *, const char __user *, + size_t, loff_t *); static int z90crypt_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -389,7 +390,7 @@ static void z90crypt_config_task(unsigned long); static void z90crypt_cleanup_task(unsigned long); static int z90crypt_status(char *, char **, off_t, int, int *, void *); -static int z90crypt_status_write(struct file *, const char *, +static int z90crypt_status_write(struct file *, const char __user *, unsigned long, void *); /** @@ -473,9 +474,9 @@ static int trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) { - struct ica_rsa_modexpo_32 *mex32u = compat_ptr(arg); + struct ica_rsa_modexpo_32 __user *mex32u = compat_ptr(arg); struct ica_rsa_modexpo_32 mex32k; - struct ica_rsa_modexpo *mex64; + struct ica_rsa_modexpo __user *mex64; int ret = 0; unsigned int i; @@ -517,9 +518,9 @@ static int trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) { - struct ica_rsa_modexpo_crt_32 *crt32u = compat_ptr(arg); + struct ica_rsa_modexpo_crt_32 __user *crt32u = compat_ptr(arg); struct ica_rsa_modexpo_crt_32 crt32k; - struct ica_rsa_modexpo_crt *crt64; + struct ica_rsa_modexpo_crt __user *crt64; int ret = 0; unsigned int i; @@ -841,7 +842,7 @@ z90crypt_release(struct inode *inode, struct file *filp) * z90crypt_read will not be supported beyond z90crypt 1.3.1 */ static ssize_t -z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) +z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { PDEBUG("filp %p (PID %d)\n", filp, PID()); return -EPERM; @@ -854,7 +855,7 @@ z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) */ #include static ssize_t -z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) +z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { unsigned char *temp_buff; @@ -892,7 +893,7 @@ z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) * Write is is not allowed */ static ssize_t -z90crypt_write(struct file *filp, const char *buf, size_t count, loff_t *f_pos) +z90crypt_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { PDEBUG("filp %p (PID %d)\n", filp, PID()); return -EPERM; @@ -1258,7 +1259,7 @@ z90crypt_send(struct work_element *we_p, const char *buf) * process_results copies the user's work from kernel space. */ static inline int -z90crypt_process_results(struct work_element *we_p, char *buf) +z90crypt_process_results(struct work_element *we_p, char __user *buf) { int rv; @@ -1556,7 +1557,7 @@ get_crypto_request_buffer(struct work_element *we_p) static inline int z90crypt_prepare(struct work_element *we_p, unsigned int funccode, - const char *buffer) + const char __user *buffer) { int rv; @@ -1641,7 +1642,7 @@ z90crypt_rsa(struct priv_data *private_data_p, pid_t pid, PDEBUG("PID %d: allocate_work_element returned ENOMEM\n", pid); return rv; } - if ((rv = z90crypt_prepare(we_p, cmd, (const char *)arg))) + if ((rv = z90crypt_prepare(we_p, cmd, (const char __user *)arg))) PDEBUG("PID %d: rv = %d from z90crypt_prepare\n", pid, rv); if (!rv) if ((rv = z90crypt_send(we_p, (const char *)arg))) @@ -1653,7 +1654,7 @@ z90crypt_rsa(struct priv_data *private_data_p, pid_t pid, rv = we_p->retcode; } if (!rv) - rv = z90crypt_process_results(we_p, (char *)arg); + rv = z90crypt_process_results(we_p, (char __user *)arg); if ((we_p->status[0] & STAT_FAILED)) { switch (rv) { @@ -1748,49 +1749,49 @@ z90crypt_ioctl(struct inode *inode, struct file *filp, case Z90STAT_TOTALCOUNT: tempstat = get_status_totalcount(); - if (copy_to_user((int *)arg, &tempstat,sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat,sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_PCICACOUNT: tempstat = get_status_PCICAcount(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_PCICCCOUNT: tempstat = get_status_PCICCcount(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_PCIXCCCOUNT: tempstat = get_status_PCIXCCcount(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_REQUESTQ_COUNT: tempstat = get_status_requestq_count(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_PENDINGQ_COUNT: tempstat = get_status_pendingq_count(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_TOTALOPEN_COUNT: tempstat = get_status_totalopen_count(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; case Z90STAT_DOMAIN_INDEX: tempstat = get_status_domain_index(); - if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0) + if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0) ret = -EFAULT; break; @@ -1802,7 +1803,8 @@ z90crypt_ioctl(struct inode *inode, struct file *filp, break; } get_status_status_mask(status); - if (copy_to_user((char *) arg, status, Z90CRYPT_NUM_APS) != 0) + if (copy_to_user((char __user *) arg, status, Z90CRYPT_NUM_APS) + != 0) ret = -EFAULT; kfree(status); break; @@ -1815,7 +1817,7 @@ z90crypt_ioctl(struct inode *inode, struct file *filp, break; } get_status_qdepth_mask(qdepth); - if (copy_to_user((char *) arg, qdepth, Z90CRYPT_NUM_APS) != 0) + if (copy_to_user((char __user *) arg, qdepth, Z90CRYPT_NUM_APS) != 0) ret = -EFAULT; kfree(qdepth); break; @@ -1828,7 +1830,7 @@ z90crypt_ioctl(struct inode *inode, struct file *filp, break; } get_status_perdevice_reqcnt(reqcnt); - if (copy_to_user((char *) arg, reqcnt, + if (copy_to_user((char __user *) arg, reqcnt, Z90CRYPT_NUM_APS * sizeof(int)) != 0) ret = -EFAULT; kfree(reqcnt); @@ -1861,7 +1863,7 @@ z90crypt_ioctl(struct inode *inode, struct file *filp, get_status_status_mask(pstat->status); get_status_qdepth_mask(pstat->qdepth); - if (copy_to_user((struct ica_z90_status *) arg, pstat, + if (copy_to_user((struct ica_z90_status __user *) arg, pstat, sizeof(struct ica_z90_status)) != 0) ret = -EFAULT; kfree(pstat); @@ -2104,7 +2106,7 @@ scan_string(unsigned char *bf, unsigned int len, } static int -z90crypt_status_write(struct file *file, const char *buffer, +z90crypt_status_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { int i, j, len, offs, found, eof; @@ -2209,7 +2211,7 @@ z90crypt_status_write(struct file *file, const char *buffer, */ static inline int receive_from_crypto_device(int index, unsigned char *psmid, int *buff_len_p, - unsigned char *buff, unsigned char **dest_p_p) + unsigned char *buff, unsigned char __user **dest_p_p) { int dv, rv; struct device *dev_ptr; @@ -2397,7 +2399,7 @@ helper_send_work(int index) static inline void helper_handle_work_element(int index, unsigned char psmid[8], int rc, int buff_len, unsigned char *buff, - unsigned char *resp_addr) + unsigned char __user *resp_addr) { struct work_element *pq_p; struct list_head *lptr, *tptr; @@ -2502,7 +2504,8 @@ static void z90crypt_reader_task(unsigned long ptr) { int workavail, remaining, index, rc, buff_len; - unsigned char psmid[8], *resp_addr; + unsigned char psmid[8]; + unsigned char __user *resp_addr; static unsigned char buff[1024]; PDEBUG("jiffies %ld\n", jiffies); diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c index 1120f79cb..3755f9947 100644 --- a/drivers/s390/net/ctctty.c +++ b/drivers/s390/net/ctctty.c @@ -515,7 +515,8 @@ ctc_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int cou } skb_reserve(skb, skb_res); if (from_user) - copy_from_user(skb_put(skb, c), buf, c); + copy_from_user(skb_put(skb, c), + (const u_char __user *)buf, c); else memcpy(skb_put(skb, c), buf, c); skb_queue_tail(&info->tx_queue, skb); @@ -640,7 +641,7 @@ ctc_tty_unthrottle(struct tty_struct *tty) * allows RS485 driver to be written in user space. */ static int -ctc_tty_get_lsr_info(ctc_tty_info * info, uint * value) +ctc_tty_get_lsr_info(ctc_tty_info * info, uint __user *value) { u_char status; uint result; @@ -650,7 +651,7 @@ ctc_tty_get_lsr_info(ctc_tty_info * info, uint * value) status = info->lsr; spin_unlock_irqrestore(&ctc_tty_lock, flags); result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); - put_user(result, (uint *) value); + put_user(result, value); return 0; } @@ -743,14 +744,14 @@ ctc_tty_ioctl(struct tty_struct *tty, struct file *file, printk(KERN_DEBUG "%s%d ioctl TIOCGSOFTCAR\n", CTC_TTY_NAME, info->line); #endif - error = put_user(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg); + error = put_user(C_CLOCAL(tty) ? 1 : 0, (ulong __user *) arg); return error; case TIOCSSOFTCAR: #ifdef CTC_DEBUG_MODEM_IOCTL printk(KERN_DEBUG "%s%d ioctl TIOCSSOFTCAR\n", CTC_TTY_NAME, info->line); #endif - error = get_user(arg, (ulong *) arg); + error = get_user(arg, (ulong __user *) arg); if (error) return error; tty->termios->c_cflag = @@ -762,11 +763,11 @@ ctc_tty_ioctl(struct tty_struct *tty, struct file *file, printk(KERN_DEBUG "%s%d ioctl TIOCSERGETLSR\n", CTC_TTY_NAME, info->line); #endif - error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint)); + error = verify_area(VERIFY_WRITE, (void __user *) arg, sizeof(uint)); if (error) return error; else - return ctc_tty_get_lsr_info(info, (uint *) arg); + return ctc_tty_get_lsr_info(info, (uint __user *) arg); default: #ifdef CTC_DEBUG_MODEM_IOCTL printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on %s%d\n", cmd, diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 8dd8becea..36790af32 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c @@ -1,5 +1,5 @@ /* - * $Id: iucv.c,v 1.32 2004/05/18 09:28:43 braunu Exp $ + * $Id: iucv.c,v 1.33 2004/05/24 10:19:18 braunu Exp $ * * IUCV network driver * @@ -29,7 +29,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.32 $ + * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.33 $ * */ @@ -352,7 +352,7 @@ do { \ static void iucv_banner(void) { - char vbuf[] = "$Revision: 1.32 $"; + char vbuf[] = "$Revision: 1.33 $"; char *version = vbuf; if ((version = strchr(version, ':'))) { @@ -2368,7 +2368,8 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) iucv_debug(2, "found a matching handler"); break; - } + } else + h = NULL; } spin_unlock_irqrestore (&iucv_lock, flags); if (h) { diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 2b3753d55..570a93b67 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -1,5 +1,5 @@ /* - * $Id: netiucv.c,v 1.53 2004/05/07 14:29:37 mschwide Exp $ + * $Id: netiucv.c,v 1.54 2004/05/28 08:04:14 braunu Exp $ * * IUCV network driver * @@ -30,7 +30,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * RELEASE-TAG: IUCV network driver $Revision: 1.53 $ + * RELEASE-TAG: IUCV network driver $Revision: 1.54 $ * */ @@ -60,7 +60,6 @@ #include #include #include -#include #include "iucv.h" #include "fsm.h" @@ -167,10 +166,10 @@ static __inline__ int netiucv_test_and_set_busy(struct net_device *dev) } static __u8 iucv_host[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -//static __u8 iucvMagic[16] = { -// 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, -// 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 -//}; +static __u8 iucvMagic[16] = { + 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 +}; /** * This mask means the 16-byte IUCV "magic" and the origin userid must @@ -769,18 +768,10 @@ conn_action_start(fsm_instance *fi, int event, void *arg) struct iucv_event *ev = (struct iucv_event *)arg; struct iucv_connection *conn = ev->conn; __u16 msglimit; - int rc, len; - __u8 iucvMagic[16] = { - 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 - }; + int rc; pr_debug("%s() called\n", __FUNCTION__); - len = (IFNAMSIZ < sizeof(conn->netdev->name)) ? - IFNAMSIZ : sizeof(conn->netdev->name); - memcpy(iucvMagic, conn->netdev->name, len); - ASCEBC (iucvMagic, len); if (conn->handle == 0) { conn->handle = iucv_register_program(iucvMagic, conn->userid, mask, @@ -1958,7 +1949,7 @@ static struct device_driver netiucv_driver = { static void netiucv_banner(void) { - char vbuf[] = "$Revision: 1.53 $"; + char vbuf[] = "$Revision: 1.54 $"; char *version = vbuf; if ((version = strchr(version, ':'))) { diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index a299fa1db..96c4243a2 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h @@ -23,7 +23,7 @@ #include "qeth_mpc.h" -#define VERSION_QETH_H "$Revision: 1.108 $" +#define VERSION_QETH_H "$Revision: 1.110 $" #ifdef CONFIG_QETH_IPV6 #define QETH_VERSION_IPV6 ":IPv6" @@ -91,10 +91,14 @@ debug_event(qeth_dbf_##name,level,(void*)(addr),len); \ } while (0) -#define QETH_DBF_TEXT_(name,level,text...) \ - do { \ - sprintf(qeth_dbf_text_buf, text); \ - debug_text_event(qeth_dbf_##name,level,qeth_dbf_text_buf);\ +extern DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf); + +#define QETH_DBF_TEXT_(name,level,text...) \ + do { \ + char* dbf_txt_buf = get_cpu_var(qeth_dbf_txt_buf); \ + sprintf(dbf_txt_buf, text); \ + debug_text_event(qeth_dbf_##name,level,dbf_txt_buf); \ + put_cpu_var(qeth_dbf_txt_buf); \ } while (0) #define QETH_DBF_SPRINTF(name,level,text...) \ @@ -376,11 +380,6 @@ enum qeth_qdio_buffer_states { * outbound: filled by driver; owned by hardware in order to be sent */ QETH_QDIO_BUF_PRIMED, - /* - * inbound only: an error condition has been detected for a buffer - * the buffer will be discarded (not read out) - */ - QETH_QDIO_BUF_ERROR, }; enum qeth_qdio_info_states { @@ -419,7 +418,7 @@ struct qeth_qdio_q { struct qeth_qdio_out_buffer { struct qdio_buffer *buffer; - volatile enum qeth_qdio_buffer_states state; + atomic_t state; volatile int next_element_to_fill; struct sk_buff_head skb_list; }; diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ceab62acf..8aefa28c2 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.112 $) + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.121 $) * * Linux on zSeries OSA Express and HiperSockets support * @@ -12,7 +12,7 @@ * Frank Pavlic (pavlic@de.ibm.com) and * Thomas Spatzier * - * $Revision: 1.112 $ $Date: 2004/05/19 09:28:21 $ + * $Revision: 1.121 $ $Date: 2004/06/11 16:32:15 $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,7 +78,7 @@ qeth_eyecatcher(void) #include "qeth_mpc.h" #include "qeth_fs.h" -#define VERSION_QETH_C "$Revision: 1.112 $" +#define VERSION_QETH_C "$Revision: 1.121 $" static const char *version = "qeth S/390 OSA-Express driver"; /** @@ -91,7 +91,8 @@ static debug_info_t *qeth_dbf_control = NULL; static debug_info_t *qeth_dbf_trace = NULL; static debug_info_t *qeth_dbf_sense = NULL; static debug_info_t *qeth_dbf_qerr = NULL; -static char qeth_dbf_text_buf[255]; + +DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf); /** * some more definitions and declarations @@ -2344,13 +2345,17 @@ qeth_init_input_buffer(struct qeth_card *card, struct qeth_qdio_buffer *buf) } static inline void -qeth_clear_output_buffer(struct qeth_card *card, +qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, struct qeth_qdio_out_buffer *buf) { int i; struct sk_buff *skb; - for(i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i){ + /* is PCI flag set on buffer? */ + if (buf->buffer->element[0].flags & 0x40) + atomic_dec(&queue->set_pci_flags_count); + + for(i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i){ buf->buffer->element[i].length = 0; buf->buffer->element[i].addr = NULL; buf->buffer->element[i].flags = 0; @@ -2360,7 +2365,7 @@ qeth_clear_output_buffer(struct qeth_card *card, } } buf->next_element_to_fill = 0; - buf->state = QETH_QDIO_BUF_EMPTY; + atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY); } static inline void @@ -2577,8 +2582,17 @@ qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int, QETH_DBF_TEXT(trace, 2, "flushbuf"); QETH_DBF_TEXT_(trace, 2, " err%d", rc); queue->card->stats.tx_errors += count; + /* ok, since do_QDIO went wrong the buffers have not been given + * to the hardware. they still belong to us, so we can clear + * them and reuse then, i.e. set back next_buf_to_fill*/ + for (i = index; i < index + count; ++i) { + buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; + qeth_clear_output_buffer(queue, buf); + } + queue->next_buf_to_fill = index; return; } + atomic_add(count, &queue->used_buffers); #ifdef CONFIG_QETH_PERF_STATS queue->card->perf_stats.bufs_sent += count; #endif @@ -2616,11 +2630,11 @@ qeth_switch_packing_state(struct qeth_qdio_out_q *queue) queue->do_pack = 0; /* flush packing buffers */ buffer = &queue->bufs[queue->next_buf_to_fill]; - BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED); - if (buffer->next_element_to_fill > 0) { - buffer->state = QETH_QDIO_BUF_PRIMED; + if ((atomic_read(&buffer->state) == + QETH_QDIO_BUF_EMPTY) && + (buffer->next_element_to_fill > 0)) { + atomic_set(&buffer->state,QETH_QDIO_BUF_PRIMED); flush_count++; - atomic_inc(&queue->used_buffers); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; @@ -2634,17 +2648,17 @@ static inline void qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue, int under_int) { struct qeth_qdio_out_buffer *buffer; + int index; - buffer = &queue->bufs[queue->next_buf_to_fill]; - BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED); - if (buffer->next_element_to_fill > 0){ + index = queue->next_buf_to_fill; + buffer = &queue->bufs[index]; + if((atomic_read(&buffer->state) == QETH_QDIO_BUF_EMPTY) && + (buffer->next_element_to_fill > 0)){ /* it's a packing buffer */ - buffer->state = QETH_QDIO_BUF_PRIMED; - atomic_inc(&queue->used_buffers); - qeth_flush_buffers(queue, under_int, queue->next_buf_to_fill, - 1); + atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; + qeth_flush_buffers(queue, under_int, index, 1); } } @@ -2687,13 +2701,9 @@ qeth_qdio_output_handler(struct ccw_device * ccwdev, unsigned int status, qeth_schedule_recovery(card); return; } - /* is PCI flag set on buffer? */ - if (buffer->buffer->element[0].flags & 0x40) - atomic_dec(&queue->set_pci_flags_count); - - qeth_clear_output_buffer(card, buffer); - atomic_dec(&queue->used_buffers); + qeth_clear_output_buffer(queue, buffer); } + atomic_sub(count, &queue->used_buffers); netif_wake_queue(card->dev); #ifdef CONFIG_QETH_PERF_STATS @@ -2886,8 +2896,8 @@ qeth_free_qdio_buffers(struct qeth_card *card) /* free outbound qdio_qs */ for (i = 0; i < card->qdio.no_out_queues; ++i){ for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) - qeth_clear_output_buffer(card, &card->qdio. - out_qs[i]->bufs[j]); + qeth_clear_output_buffer(card->qdio.out_qs[i], + &card->qdio.out_qs[i]->bufs[j]); kfree(card->qdio.out_qs[i]); } kfree(card->qdio.out_qs); @@ -2904,8 +2914,8 @@ qeth_clear_qdio_buffers(struct qeth_card *card) for (i = 0; i < card->qdio.no_out_queues; ++i) if (card->qdio.out_qs[i]){ for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) - qeth_clear_output_buffer(card, &card->qdio. - out_qs[i]->bufs[j]); + qeth_clear_output_buffer(card->qdio.out_qs[i], + &card->qdio.out_qs[i]->bufs[j]); } } @@ -2957,8 +2967,8 @@ qeth_init_qdio_queues(struct qeth_card *card) memset(card->qdio.out_qs[i]->qdio_bufs, 0, QDIO_MAX_BUFFERS_PER_Q * sizeof(struct qdio_buffer)); for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j){ - qeth_clear_output_buffer(card, &card->qdio. - out_qs[i]->bufs[j]); + qeth_clear_output_buffer(card->qdio.out_qs[i], + &card->qdio.out_qs[i]->bufs[j]); } card->qdio.out_qs[i]->card = card; card->qdio.out_qs[i]->next_buf_to_fill = 0; @@ -3670,7 +3680,7 @@ qeth_fill_buffer(struct qeth_qdio_out_q *queue, struct qeth_qdio_out_buffer *buf if (!queue->do_pack) { QETH_DBF_TEXT(trace, 6, "fillbfnp"); /* set state to PRIMED -> will be flushed */ - buf->state = QETH_QDIO_BUF_PRIMED; + atomic_set(&buf->state, QETH_QDIO_BUF_PRIMED); } else { QETH_DBF_TEXT(trace, 6, "fillbfpa"); #ifdef CONFIG_QETH_PERF_STATS @@ -3682,7 +3692,7 @@ qeth_fill_buffer(struct qeth_qdio_out_q *queue, struct qeth_qdio_out_buffer *buf * packed buffer if full -> set state PRIMED * -> will be flushed */ - buf->state = QETH_QDIO_BUF_PRIMED; + atomic_set(&buf->state, QETH_QDIO_BUF_PRIMED); } } return 0; @@ -3695,32 +3705,27 @@ qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue, { struct qeth_qdio_out_buffer *buffer; int index; - int rc = 0; QETH_DBF_TEXT(trace, 6, "dosndpfa"); spin_lock(&queue->lock); - /* do we have empty buffers? */ - if (atomic_read(&queue->used_buffers) >= (QDIO_MAX_BUFFERS_PER_Q - 1)){ + index = queue->next_buf_to_fill; + buffer = &queue->bufs[queue->next_buf_to_fill]; + /* + * check if buffer is empty to make sure that we do not 'overtake' + * ourselves and try to fill a buffer that is already primed + */ + if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY) { card->stats.tx_dropped++; - rc = -EBUSY; spin_unlock(&queue->lock); - goto out; + return -EBUSY; } - index = queue->next_buf_to_fill; - buffer = &queue->bufs[queue->next_buf_to_fill]; - BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; - atomic_inc(&queue->used_buffers); - spin_unlock(&queue->lock); - - /* go on sending ... */ - netif_wake_queue(skb->dev); qeth_fill_buffer(queue, buffer, (char *)hdr, skb); qeth_flush_buffers(queue, 0, index, 1); -out: - return rc; + spin_unlock(&queue->lock); + return 0; } static inline int @@ -3736,35 +3741,43 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, QETH_DBF_TEXT(trace, 6, "dosndpkt"); spin_lock(&queue->lock); - /* do we have empty buffers? */ - if (atomic_read(&queue->used_buffers) >= (QDIO_MAX_BUFFERS_PER_Q - 2)){ - card->stats.tx_dropped++; - rc = -EBUSY; - goto out; - } start_index = queue->next_buf_to_fill; buffer = &queue->bufs[queue->next_buf_to_fill]; - BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED); + /* + * check if buffer is empty to make sure that we do not 'overtake' + * ourselves and try to fill a buffer that is already primed + */ + if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){ + card->stats.tx_dropped++; + spin_unlock(&queue->lock); + return -EBUSY; + } if (queue->do_pack){ /* does packet fit in current buffer? */ - if((QETH_MAX_BUFFER_ELEMENTS(card) - buffer->next_element_to_fill) - < elements_needed){ + if((QETH_MAX_BUFFER_ELEMENTS(card) - + buffer->next_element_to_fill) < elements_needed){ /* ... no -> set state PRIMED */ - buffer->state = QETH_QDIO_BUF_PRIMED; + atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED); flush_count++; - atomic_inc(&queue->used_buffers); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; buffer = &queue->bufs[queue->next_buf_to_fill]; + /* we did a step forward, so check buffer state again */ + if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){ + card->stats.tx_dropped++; + qeth_flush_buffers(queue, 0, start_index, 1); + spin_unlock(&queue->lock); + /* return EBUSY because we sent old packet, not + * the current one */ + return -EBUSY; + } } } - qeth_fill_buffer(queue, buffer, (char *)hdr, skb); - if (buffer->state == QETH_QDIO_BUF_PRIMED){ + if (atomic_read(&buffer->state) == QETH_QDIO_BUF_PRIMED){ /* next time fill the next buffer */ flush_count++; - atomic_inc(&queue->used_buffers); queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q; } @@ -3776,9 +3789,8 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, if (!atomic_read(&queue->set_pci_flags_count)) qeth_flush_buffers_on_no_pci(queue, 0); -out: - spin_unlock(&queue->lock); + spin_unlock(&queue->lock); return rc; } @@ -4078,21 +4090,43 @@ out_error: static int qeth_send_ipa_arp_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, - int len, int (*reply_cb) - (struct qeth_card *, - struct qeth_reply*, unsigned long), + int len, int (*reply_cb)(struct qeth_card *, + struct qeth_reply *, + unsigned long), void *reply_param) { - int rc; - QETH_DBF_TEXT(trace,4,"sendarp"); memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE); memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data), &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); - rc = qeth_send_control_data(card, IPA_PDU_HEADER_SIZE + len, iob, - reply_cb, reply_param); - return rc; + return qeth_send_control_data(card, IPA_PDU_HEADER_SIZE + len, iob, + reply_cb, reply_param); +} + +static int +qeth_send_ipa_snmp_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, + int len, int (*reply_cb)(struct qeth_card *, + struct qeth_reply *, + unsigned long), + void *reply_param) +{ + u16 s1, s2; + + QETH_DBF_TEXT(trace,4,"sendsnmp"); + + memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE); + memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data), + &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); + /* adjust PDU length fields in IPA_PDU_HEADER */ + s1 = (u32) IPA_PDU_HEADER_SIZE + len; + s2 = (u32) len; + memcpy(QETH_IPA_PDU_LEN_TOTAL(iob->data), &s1, 2); + memcpy(QETH_IPA_PDU_LEN_PDU1(iob->data), &s2, 2); + memcpy(QETH_IPA_PDU_LEN_PDU2(iob->data), &s2, 2); + memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); + return qeth_send_control_data(card, IPA_PDU_HEADER_SIZE + len, iob, + reply_cb, reply_param); } static struct qeth_cmd_buffer * @@ -4135,8 +4169,7 @@ qeth_arp_query(struct qeth_card *card, char *udata) rc = qeth_send_ipa_arp_cmd(card, iob, QETH_SETASS_BASE_LEN+QETH_ARP_CMD_LEN, - qeth_arp_query_cb, - (void *)&qinfo); + qeth_arp_query_cb, (void *)&qinfo); if (rc) { tmp = rc; PRINT_WARN("Error while querying ARP cache on %s: %s " @@ -4182,9 +4215,10 @@ qeth_snmp_command_cb(struct qeth_card *card, struct qeth_reply *reply, } data_len = *((__u16*)QETH_IPA_PDU_LEN_PDU1(data)); if (cmd->data.setadapterparms.hdr.seq_no == 1) - data_len -= (__u16)((char*)&snmp->request - (char *)cmd); - else data_len -= (__u16)((char *)&snmp->data - (char *)cmd); + else + data_len -= (__u16)((char*)&snmp->request - (char *)cmd); + /* check if there is enough room in userspace */ if ((qinfo->udata_len - qinfo->udata_offset) < data_len) { QETH_DBF_TEXT_(trace, 4, "scer3%i", -ENOMEM); @@ -4193,15 +4227,17 @@ qeth_snmp_command_cb(struct qeth_card *card, struct qeth_reply *reply, } QETH_DBF_TEXT_(trace, 4, "snore%i", cmd->data.setadapterparms.hdr.used_total); - QETH_DBF_TEXT_(trace, 4, "sseqn%i", cmd->data.setassparms.hdr.seq_no); + QETH_DBF_TEXT_(trace, 4, "sseqn%i", cmd->data.setadapterparms.hdr.seq_no); /*copy entries to user buffer*/ if (cmd->data.setadapterparms.hdr.seq_no == 1) { memcpy(qinfo->udata + qinfo->udata_offset, - (char *)snmp,offsetof(struct qeth_snmp_cmd,data)); + (char *)snmp, + data_len + offsetof(struct qeth_snmp_cmd,data)); qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data); + } else { + memcpy(qinfo->udata + qinfo->udata_offset, + (char *)&snmp->request, data_len); } - memcpy(qinfo->udata + qinfo->udata_offset, - (char *)&snmp->data, data_len); qinfo->udata_offset += data_len; /* check if all replies received ... */ QETH_DBF_TEXT_(trace, 4, "srtot%i", @@ -4212,7 +4248,6 @@ qeth_snmp_command_cb(struct qeth_card *card, struct qeth_reply *reply, cmd->data.setadapterparms.hdr.used_total) return 1; return 0; - } static struct qeth_cmd_buffer * @@ -4244,7 +4279,8 @@ qeth_snmp_command(struct qeth_card *card, char *udata) { struct qeth_cmd_buffer *iob; struct qeth_ipa_cmd *cmd; - struct qeth_snmp_ureq ureq; + struct qeth_snmp_ureq *ureq; + int req_len; struct qeth_arp_query_info qinfo = {0, }; int rc = 0; @@ -4257,30 +4293,39 @@ qeth_snmp_command(struct qeth_card *card, char *udata) "on %s!\n", card->info.if_name); return -EOPNOTSUPP; } - if (copy_from_user(&ureq, udata, sizeof(struct qeth_snmp_ureq))) + /* skip 4 bytes (data_len struct member) to get req_len */ + if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int))) return -EFAULT; - qinfo.udata_len = ureq.hdr.data_len; - if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))) + ureq = kmalloc(req_len, GFP_KERNEL); + if (!ureq) { + QETH_DBF_TEXT(trace, 2, "snmpnome"); return -ENOMEM; + } + if (copy_from_user(ureq, udata, req_len)){ + kfree(ureq); + return -EFAULT; + } + qinfo.udata_len = ureq->hdr.data_len; + if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))){ + kfree(ureq); + return -ENOMEM; + } memset(qinfo.udata, 0, qinfo.udata_len); qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr); iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, - QETH_SNMP_SETADP_CMDLENGTH+ureq.hdr.req_len); + QETH_SNMP_SETADP_CMDLENGTH + req_len); cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); - memcpy(&cmd->data.setadapterparms.data.snmp, &ureq.cmd, - sizeof(struct qeth_snmp_cmd)); - rc = qeth_send_ipa_arp_cmd(card, iob, - QETH_SETADP_BASE_LEN + QETH_ARP_DATA_SIZE + - ureq.hdr.req_len, qeth_snmp_command_cb, - (void *)&qinfo); + memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len); + rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, + qeth_snmp_command_cb, (void *)&qinfo); if (rc) PRINT_WARN("SNMP command failed on %s: (0x%x)\n", card->info.if_name, rc); else copy_to_user(udata, qinfo.udata, qinfo.udata_len); - + kfree(ureq); kfree(qinfo.udata); return rc; } @@ -4476,13 +4521,17 @@ qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) rc = qeth_snmp_command(card, rq->ifr_ifru.ifru_data); break; case SIOC_QETH_GET_CARD_TYPE: + if ((card->info.type == QETH_CARD_TYPE_OSAE) && + !card->info.guestlan) + return 1; + return 0; break; case SIOCGMIIPHY: - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); mii_data->phy_id = 0; break; case SIOCGMIIREG: - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); if (mii_data->phy_id != 0) rc = -EINVAL; else @@ -4497,7 +4546,7 @@ qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) rc = -EPERM; break; } - mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data; + mii_data = if_mii(rq); if (mii_data->phy_id != 0) rc = -EINVAL; else diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 5178a6cc2..910c5f566 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.30 $) + * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.32 $) * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to sysfs. @@ -20,7 +20,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_SYS_C = "$Revision: 1.30 $"; +const char *VERSION_QETH_SYS_C = "$Revision: 1.32 $"; /*****************************************************************************/ /* */ @@ -1447,14 +1447,16 @@ qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf, { int rc; int signum; - char *tmp; + char *tmp, *tmp2; tmp = strsep((char **) &buf, "\n"); - if (!strcmp(tmp, "unregister")){ - return qeth_notifier_unregister(current); + if (!strncmp(tmp, "unregister", 10)){ + if ((rc = qeth_notifier_unregister(current))) + return rc; + return count; } - signum = simple_strtoul(buf, &tmp, 10); + signum = simple_strtoul(tmp, &tmp2, 10); if ((signum < 0) || (signum > 32)){ PRINT_WARN("Signal number %d is out of range\n", signum); return -EINVAL; @@ -1465,7 +1467,7 @@ qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf, return count; } -static DRIVER_ATTR(notifier_register, 0644, 0, +static DRIVER_ATTR(notifier_register, 0200, 0, qeth_driver_notifier_register_store); int diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index 2138af884..ffa996c8a 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -21,13 +22,14 @@ // #define DBG(args,...) do {} while (0); static struct semaphore m_sem; -static struct semaphore s_sem; extern int css_process_crw(int); extern int chsc_process_crw(void); extern int chp_process_crw(int, int); extern void css_reiterate_subchannels(void); -extern void css_trigger_slow_path(void); + +extern struct workqueue_struct *slow_path_wq; +extern struct work_struct slow_path_work; static void s390_handle_damage(char *msg) @@ -39,21 +41,6 @@ s390_handle_damage(char *msg) disabled_wait((unsigned long) __builtin_return_address(0)); } -static int -s390_mchk_slow_path(void *param) -{ - struct semaphore *sem; - - sem = (struct semaphore *)param; - /* Set a nice name. */ - daemonize("kslowcrw"); -repeat: - down_interruptible(sem); - css_trigger_slow_path(); - goto repeat; - return 0; -} - /* * Retrieve CRWs and call function to handle event. * @@ -130,7 +117,7 @@ repeat: } } if (slow) - up(&s_sem); + queue_work(slow_path_wq, &slow_path_work); goto repeat; return 0; } @@ -202,7 +189,6 @@ static int machine_check_init(void) { init_MUTEX_LOCKED(&m_sem); - init_MUTEX_LOCKED( &s_sem ); ctl_clear_bit(14, 25); /* disable damage MCH */ ctl_set_bit(14, 26); /* enable degradation MCH */ ctl_set_bit(14, 27); /* enable system recovery MCH */ @@ -226,7 +212,6 @@ static int __init machine_check_crw_init (void) { kernel_thread(s390_collect_crw_info, &m_sem, CLONE_FS|CLONE_FILES); - kernel_thread(s390_mchk_slow_path, &s_sem, CLONE_FS|CLONE_FILES); ctl_set_bit(14, 28); /* enable channel report MCH */ return 0; } diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 632488e1a..209c3fb95 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -125,18 +125,21 @@ #include #include #include +#include +#include +#include #include #include #include #include #include -#include -#include -#include -#include "scsi.h" +#include +#include +#include +#include #include - +#include #include #include @@ -164,15 +167,15 @@ MODULE_LICENSE("GPL"); #include "53c700_d.h" -STATIC int NCR_700_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); -STATIC int NCR_700_abort(Scsi_Cmnd * SCpnt); -STATIC int NCR_700_bus_reset(Scsi_Cmnd * SCpnt); -STATIC int NCR_700_dev_reset(Scsi_Cmnd * SCpnt); -STATIC int NCR_700_host_reset(Scsi_Cmnd * SCpnt); +STATIC int NCR_700_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); +STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt); +STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt); +STATIC int NCR_700_dev_reset(struct scsi_cmnd * SCpnt); +STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt); STATIC void NCR_700_chip_setup(struct Scsi_Host *host); STATIC void NCR_700_chip_reset(struct Scsi_Host *host); -STATIC int NCR_700_slave_configure(Scsi_Device *SDpnt); -STATIC void NCR_700_slave_destroy(Scsi_Device *SDpnt); +STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt); +STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt); STATIC struct device_attribute *NCR_700_dev_attrs[]; @@ -279,7 +282,7 @@ NCR_700_offset_period_to_sxfer(struct NCR_700_Host_Parameters *hostdata, } static inline __u8 -NCR_700_get_SXFER(Scsi_Device *SDp) +NCR_700_get_SXFER(struct scsi_device *SDp) { struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; @@ -289,7 +292,7 @@ NCR_700_get_SXFER(Scsi_Device *SDp) } struct Scsi_Host * -NCR_700_detect(Scsi_Host_Template *tpnt, +NCR_700_detect(struct scsi_host_template *tpnt, struct NCR_700_Host_Parameters *hostdata) { dma_addr_t pScript, pSlots; @@ -561,7 +564,7 @@ free_slot(struct NCR_700_command_slot *slot, the ITL and (if tagged) the ITLQ lists in _queuecommand */ STATIC void save_for_reselection(struct NCR_700_Host_Parameters *hostdata, - Scsi_Cmnd *SCp, __u32 dsp) + struct scsi_cmnd *SCp, __u32 dsp) { /* Its just possible that this gets executed twice */ if(SCp != NULL) { @@ -575,27 +578,25 @@ save_for_reselection(struct NCR_700_Host_Parameters *hostdata, } STATIC inline void -NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, Scsi_Cmnd *SCp, +NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp, struct NCR_700_command_slot *slot) { - if(SCp->sc_data_direction != SCSI_DATA_NONE && - SCp->sc_data_direction != SCSI_DATA_UNKNOWN) { - enum dma_data_direction direction = SCp->sc_data_direction; + if(SCp->sc_data_direction != DMA_NONE && + SCp->sc_data_direction != DMA_BIDIRECTIONAL) { if(SCp->use_sg) { dma_unmap_sg(hostdata->dev, SCp->buffer, - SCp->use_sg, direction); + SCp->use_sg, SCp->sc_data_direction); } else { - dma_unmap_single(hostdata->dev, - slot->dma_handle, + dma_unmap_single(hostdata->dev, slot->dma_handle, SCp->request_bufflen, - direction); + SCp->sc_data_direction); } } } STATIC inline void NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, - Scsi_Cmnd *SCp, int result) + struct scsi_cmnd *SCp, int result) { hostdata->state = NCR_700_HOST_FREE; hostdata->cmd = NULL; @@ -611,7 +612,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, #ifdef NCR_700_DEBUG printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n", SCp, SCp->cmnd[7], result); - print_sense("53c700", SCp); + scsi_print_sense("53c700", SCp); #endif /* restore the old result if the request sense was @@ -780,7 +781,7 @@ NCR_700_chip_reset(struct Scsi_Host *host) STATIC __u32 process_extended_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata, - Scsi_Cmnd *SCp, __u32 dsp, __u32 dsps) + struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) { __u32 resume_offset = dsp, temp = dsp + 8; __u8 pun = 0xff, lun = 0xff; @@ -849,7 +850,7 @@ process_extended_message(struct Scsi_Host *host, printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ", host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - print_msg(hostdata->msgin); + scsi_print_msg(hostdata->msgin); printk("\n"); /* just reject it */ hostdata->msgout[0] = A_REJECT_MSG; @@ -865,7 +866,7 @@ process_extended_message(struct Scsi_Host *host, STATIC __u32 process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata, - Scsi_Cmnd *SCp, __u32 dsp, __u32 dsps) + struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps) { /* work out where to return to */ __u32 temp = dsp + 8, resume_offset = dsp; @@ -879,7 +880,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata #ifdef NCR_700_DEBUG printk("scsi%d (%d:%d): message %s: ", host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - print_msg(hostdata->msgin); + scsi_print_msg(hostdata->msgin); printk("\n"); #endif @@ -927,7 +928,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - print_msg(hostdata->msgin); + scsi_print_msg(hostdata->msgin); printk("\n"); /* just reject it */ hostdata->msgout[0] = A_REJECT_MSG; @@ -946,7 +947,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata } STATIC __u32 -process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, +process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata) { @@ -975,7 +976,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]); } else { #ifdef NCR_DEBUG - print_command(SCp->cmnd); + scsi_print_command(SCp); printk(" cmd %p has status %d, requesting sense\n", SCp, hostdata->status[0]); #endif @@ -1004,7 +1005,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, SCp->cmnd[6] = NCR_700_INTERNAL_SENSE_MAGIC; SCp->cmnd[7] = hostdata->status[0]; SCp->use_sg = 0; - SCp->sc_data_direction = SCSI_DATA_READ; + SCp->sc_data_direction = DMA_FROM_DEVICE; dma_sync_single_for_device(hostdata->dev, slot->pCmd, SCp->cmd_len, DMA_TO_DEVICE); SCp->request_bufflen = sizeof(SCp->sense_buffer); @@ -1053,7 +1054,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, NCR_700_phase[i], sbcl_to_string(NCR_700_readb(host, SBCL_REG))); printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len); - print_command(SCp->cmnd); + scsi_print_command(SCp); NCR_700_internal_bus_reset(host); } else if((dsps & 0xfffff000) == A_FATAL) { @@ -1080,7 +1081,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, __u8 lun; struct NCR_700_command_slot *slot; __u8 reselection_id = hostdata->reselection_id; - Scsi_Device *SDp; + struct scsi_device *SDp; lun = hostdata->msgin[0] & 0x1f; @@ -1095,7 +1096,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, BUG(); } if(hostdata->msgin[1] == A_SIMPLE_TAG_MSG) { - Scsi_Cmnd *SCp = scsi_find_tag(SDp, hostdata->msgin[2]); + struct scsi_cmnd *SCp = scsi_find_tag(SDp, hostdata->msgin[2]); if(unlikely(SCp == NULL)) { printk(KERN_ERR "scsi%d: (%d:%d) no saved request for tag %d\n", host->host_no, reselection_id, lun, hostdata->msgin[2]); @@ -1107,7 +1108,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, host->host_no, SDp->id, SDp->lun, hostdata->msgin[2], slot, slot->tag)); } else { - Scsi_Cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG); + struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG); if(unlikely(SCp == NULL)) { printk(KERN_ERR "scsi%d: (%d:%d) no saved request for untagged cmd\n", host->host_no, reselection_id, lun); @@ -1234,7 +1235,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp, host->host_no, pun, lun, NCR_700_condition[i], NCR_700_phase[j], dsp - hostdata->pScript); if(SCp != NULL) { - print_command(SCp->cmnd); + scsi_print_command(SCp); if(SCp->use_sg) { for(i = 0; i < SCp->use_sg + 1; i++) { @@ -1270,7 +1271,7 @@ process_selection(struct Scsi_Host *host, __u32 dsp) __u32 resume_offset = 0; struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0]; - Scsi_Cmnd *SCp = hostdata->cmd; + struct scsi_cmnd *SCp = hostdata->cmd; __u8 sbcl; for(count = 0; count < 5; count++) { @@ -1373,7 +1374,7 @@ NCR_700_flush_fifo(struct Scsi_Host *host) { /* The queue lock with interrupts disabled must be held on entry to * this function */ STATIC int -NCR_700_start_command(Scsi_Cmnd *SCp) +NCR_700_start_command(struct scsi_cmnd *SCp) { struct NCR_700_command_slot *slot = (struct NCR_700_command_slot *)SCp->host_scribble; @@ -1481,7 +1482,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) __u32 dsps; __u8 sstat0 = 0, dstat = 0; __u32 dsp; - Scsi_Cmnd *SCp = hostdata->cmd; + struct scsi_cmnd *SCp = hostdata->cmd; enum NCR_700_Host_State state; handled = 1; @@ -1514,7 +1515,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) } if(sstat0 & SCSI_RESET_DETECTED) { - Scsi_Device *SDp; + struct scsi_device *SDp; int i; hostdata->state = NCR_700_HOST_BUSY; @@ -1530,7 +1531,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) /* clear all the slots and their pending commands */ for(i = 0; i < NCR_700_COMMAND_SLOTS_PER_HOST; i++) { - Scsi_Cmnd *SCp; + struct scsi_cmnd *SCp; struct NCR_700_command_slot *slot = &hostdata->slots[i]; @@ -1590,7 +1591,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) printk("scsi%d: (%d:%d) Expected phase mismatch in slot->SG[%d], transferred 0x%x\n", host->host_no, pun, lun, SGcount, data_transfer); - print_command(SCp->cmnd); + scsi_print_command(SCp); if(residual) { printk("scsi%d: (%d:%d) Expected phase mismatch in slot->SG[%d], transferred 0x%x, residual %d\n", host->host_no, pun, lun, @@ -1731,7 +1732,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs) } STATIC int -NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) +NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) { struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; @@ -1781,7 +1782,7 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) #ifdef NCR_700_DEBUG printk("53c700: scsi%d, command ", SCp->device->host->host_no); - print_command(SCp->cmnd); + scsi_print_command(SCp); #endif if(SCp->device->tagged_supported && !SCp->device->simple_tags && (hostdata->tag_negotiated &(1<device->id)) == 0 @@ -1827,13 +1828,13 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) /* sanity check: some of the commands generated by the mid-layer * have an eccentric idea of their sc_data_direction */ if(!SCp->use_sg && !SCp->request_bufflen - && SCp->sc_data_direction != SCSI_DATA_NONE) { + && SCp->sc_data_direction != DMA_NONE) { #ifdef NCR_700_DEBUG printk("53c700: Command"); - print_command(SCp->cmnd); + scsi_print_command(SCp); printk("Has wrong data direction %d\n", SCp->sc_data_direction); #endif - SCp->sc_data_direction = SCSI_DATA_NONE; + SCp->sc_data_direction = DMA_NONE; } switch (SCp->cmnd[0]) { @@ -1844,20 +1845,20 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) default: /* OK, get it from the command */ switch(SCp->sc_data_direction) { - case SCSI_DATA_UNKNOWN: + case DMA_BIDIRECTIONAL: default: printk(KERN_ERR "53c700: Unknown command for data direction "); - print_command(SCp->cmnd); + scsi_print_command(SCp); move_ins = 0; break; - case SCSI_DATA_NONE: + case DMA_NONE: move_ins = 0; break; - case SCSI_DATA_READ: + case DMA_FROM_DEVICE: move_ins = SCRIPT_MOVE_DATA_IN; break; - case SCSI_DATA_WRITE: + case DMA_TO_DEVICE: move_ins = SCRIPT_MOVE_DATA_OUT; break; } @@ -1914,13 +1915,13 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *)) } STATIC int -NCR_700_abort(Scsi_Cmnd * SCp) +NCR_700_abort(struct scsi_cmnd * SCp) { struct NCR_700_command_slot *slot; printk(KERN_INFO "scsi%d (%d:%d) New error handler wants to abort command\n\t", SCp->device->host->host_no, SCp->device->id, SCp->device->lun); - print_command(SCp->cmnd); + scsi_print_command(SCp); slot = (struct NCR_700_command_slot *)SCp->host_scribble; @@ -1946,7 +1947,7 @@ NCR_700_abort(Scsi_Cmnd * SCp) } STATIC int -NCR_700_bus_reset(Scsi_Cmnd * SCp) +NCR_700_bus_reset(struct scsi_cmnd * SCp) { DECLARE_COMPLETION(complete); struct NCR_700_Host_Parameters *hostdata = @@ -1954,7 +1955,7 @@ NCR_700_bus_reset(Scsi_Cmnd * SCp) printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t", SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp); - print_command(SCp->cmnd); + scsi_print_command(SCp); /* In theory, eh_complete should always be null because the * eh is single threaded, but just in case we're handling a * reset via sg or something */ @@ -1976,21 +1977,21 @@ NCR_700_bus_reset(Scsi_Cmnd * SCp) } STATIC int -NCR_700_dev_reset(Scsi_Cmnd * SCp) +NCR_700_dev_reset(struct scsi_cmnd * SCp) { printk(KERN_INFO "scsi%d (%d:%d) New error handler wants device reset\n\t", SCp->device->host->host_no, SCp->device->id, SCp->device->lun); - print_command(SCp->cmnd); + scsi_print_command(SCp); return FAILED; } STATIC int -NCR_700_host_reset(Scsi_Cmnd * SCp) +NCR_700_host_reset(struct scsi_cmnd * SCp) { printk(KERN_INFO "scsi%d (%d:%d) New error handler wants HOST reset\n\t", SCp->device->host->host_no, SCp->device->id, SCp->device->lun); - print_command(SCp->cmnd); + scsi_print_command(SCp); NCR_700_internal_bus_reset(SCp->device->host); NCR_700_chip_reset(SCp->device->host); @@ -2043,7 +2044,7 @@ NCR_700_set_offset(struct scsi_device *SDp, int offset) STATIC int -NCR_700_slave_configure(Scsi_Device *SDp) +NCR_700_slave_configure(struct scsi_device *SDp) { struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; @@ -2066,7 +2067,7 @@ NCR_700_slave_configure(Scsi_Device *SDp) } STATIC void -NCR_700_slave_destroy(Scsi_Device *SDp) +NCR_700_slave_destroy(struct scsi_device *SDp) { /* to do here: deallocate memory */ } diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h index c1f0aa3c5..b357a4aeb 100644 --- a/drivers/scsi/53c700.h +++ b/drivers/scsi/53c700.h @@ -9,9 +9,11 @@ #define _53C700_H #include - #include +#include + + #if defined(CONFIG_53C700_MEM_MAPPED) && defined(CONFIG_53C700_IO_MAPPED) #define CONFIG_53C700_BOTH_MAPPED #endif @@ -57,7 +59,8 @@ struct NCR_700_Host_Parameters; /* These are the externally used routines */ -struct Scsi_Host *NCR_700_detect(Scsi_Host_Template *, struct NCR_700_Host_Parameters *); +struct Scsi_Host *NCR_700_detect(struct scsi_host_template *, + struct NCR_700_Host_Parameters *); int NCR_700_release(struct Scsi_Host *host); irqreturn_t NCR_700_intr(int, void *, struct pt_regs *); @@ -102,7 +105,7 @@ struct NCR_700_SG_List { #define NCR_700_DEV_PRINT_SYNC_NEGOTIATION (1<<19) static inline void -NCR_700_set_depth(Scsi_Device *SDp, __u8 depth) +NCR_700_set_depth(struct scsi_device *SDp, __u8 depth) { long l = (long)SDp->hostdata; @@ -111,27 +114,27 @@ NCR_700_set_depth(Scsi_Device *SDp, __u8 depth) SDp->hostdata = (void *)l; } static inline __u8 -NCR_700_get_depth(Scsi_Device *SDp) +NCR_700_get_depth(struct scsi_device *SDp) { return ((((unsigned long)SDp->hostdata) & 0xff00)>>8); } static inline int -NCR_700_is_flag_set(Scsi_Device *SDp, __u32 flag) +NCR_700_is_flag_set(struct scsi_device *SDp, __u32 flag) { return (((unsigned long)SDp->hostdata) & flag) == flag; } static inline int -NCR_700_is_flag_clear(Scsi_Device *SDp, __u32 flag) +NCR_700_is_flag_clear(struct scsi_device *SDp, __u32 flag) { return (((unsigned long)SDp->hostdata) & flag) == 0; } static inline void -NCR_700_set_flag(Scsi_Device *SDp, __u32 flag) +NCR_700_set_flag(struct scsi_device *SDp, __u32 flag) { SDp->hostdata = (void *)((long)SDp->hostdata | (flag & 0xffff0000)); } static inline void -NCR_700_clear_flag(Scsi_Device *SDp, __u32 flag) +NCR_700_clear_flag(struct scsi_device *SDp, __u32 flag) { SDp->hostdata = (void *)((long)SDp->hostdata & ~(flag & 0xffff0000)); } @@ -147,7 +150,7 @@ struct NCR_700_command_slot { __u8 state; int tag; __u32 resume_offset; - Scsi_Cmnd *cmnd; + struct scsi_cmnd *cmnd; /* The pci_mapped address of the actual command in cmnd */ dma_addr_t pCmd; __u32 temp; @@ -185,7 +188,7 @@ struct NCR_700_Host_Parameters { __u32 pScript; /* physical mem addr of script */ enum NCR_700_Host_State state; /* protected by state lock */ - Scsi_Cmnd *cmd; + struct scsi_cmnd *cmd; /* Note: pScript contains the single consistent block of * memory. All the msgin, msgout and status are allocated in * this memory too (at separate cache lines). TOTAL_MEM_SIZE diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 0cd207e9e..6104ca046 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -227,7 +227,7 @@ config SCSI_DECSII depends on DECSTATION && SCSI config BLK_DEV_3W_XXXX_RAID - tristate "3ware Hardware ATA-RAID support" + tristate "3ware 5/6/7/8xxx ATA-RAID support" depends on PCI && SCSI help 3ware is the only hardware ATA-Raid product in Linux to date. @@ -239,6 +239,17 @@ config BLK_DEV_3W_XXXX_RAID Please read the comments at the top of . +config SCSI_3W_9XXX + tristate "3ware 9xxx SATA-RAID support" + depends on PCI && SCSI + help + This driver supports the 9000 series 3ware SATA-RAID cards. + + + + Please read the comments at the top of + . + config SCSI_7000FASST tristate "7000FASST SCSI support" depends on ISA && SCSI @@ -352,7 +363,7 @@ source "drivers/scsi/aic7xxx/Kconfig.aic79xx" # All the I2O code and drivers do not seem to be 64bit safe. config SCSI_DPT_I2O tristate "Adaptec I2O RAID support " - depends on !64BIT && SCSI + depends on !64BIT && SCSI && PCI help This driver supports all of Adaptec's I2O based RAID controllers as well as the DPT SmartRaid V cards. This is an Adaptec maintained @@ -478,9 +489,7 @@ config SCSI_BUSLOGIC Adapters. Consult the SCSI-HOWTO, available from , and the files and - for more information. If this - driver does not work correctly without modification, please contact - the author, Leonard N. Zubkoff, by email to lnz@dandelion.com. + for more information. To compile this driver as a module, choose M here: the module will be called BusLogic. @@ -494,9 +503,15 @@ config SCSI_OMIT_FLASHPOINT substantial, so users of MultiMaster Host Adapters may wish to omit it. +# +# This is marked broken because it uses over 4kB of stack in +# just two routines: +# 2076 CpqTsProcessIMQEntry +# 2052 PeekIMQEntry +# config SCSI_CPQFCTS tristate "Compaq Fibre Channel 64-bit/66Mhz HBA support" - depends on PCI && SCSI + depends on PCI && SCSI && BROKEN help Say Y here to compile in support for the Compaq StorageWorks Fibre Channel 64-bit/66Mhz Host Bus Adapter. @@ -1710,18 +1725,6 @@ config SCSI_SUNESP To compile this driver as a module, choose M here: the module will be called esp. -config SCSI_PC980155 - tristate "NEC PC-9801-55 SCSI support" - depends on X86_PC9800 && SCSI - help - If you have the NEC PC-9801-55 SCSI interface card or compatibles - for NEC PC-9801/PC-9821, say Y. - -config WD33C93_PIO - bool - depends on SCSI_PC980155 - default y - # bool 'Cyberstorm Mk III SCSI support (EXPERIMENTAL)' CONFIG_CYBERSTORMIII_SCSI config ZFCP diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 73e462e5d..fe95ba780 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -34,7 +34,6 @@ obj-$(CONFIG_SCSI_AMIGA7XX) += amiga7xx.o 53c7xx.o obj-$(CONFIG_A3000_SCSI) += a3000.o wd33c93.o obj-$(CONFIG_A2091_SCSI) += a2091.o wd33c93.o obj-$(CONFIG_GVP11_SCSI) += gvp11.o wd33c93.o -obj-$(CONFIG_SCSI_PC980155) += pc980155.o wd33c93.o obj-$(CONFIG_MVME147_SCSI) += mvme147.o wd33c93.o obj-$(CONFIG_SGIWD93_SCSI) += sgiwd93.o wd33c93.o obj-$(CONFIG_CYBERSTORM_SCSI) += NCR53C9x.o cyberstorm.o @@ -109,6 +108,7 @@ obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o obj-$(CONFIG_SCSI_PLUTO) += pluto.o obj-$(CONFIG_SCSI_DECNCR) += NCR53C9x.o dec_esp.o obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o +obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o obj-$(CONFIG_SCSI_PPA) += ppa.o obj-$(CONFIG_SCSI_IMM) += imm.o obj-$(CONFIG_JAZZ_ESP) += NCR53C9x.o jazz_esp.o @@ -142,7 +142,6 @@ scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \ scsi_devinfo.o scsi_mod-$(CONFIG_SYSCTL) += scsi_sysctl.o scsi_mod-$(CONFIG_SCSI_PROC_FS) += scsi_proc.o -scsi_mod-$(CONFIG_X86_PC9800) += scsi_pc98.o sd_mod-objs := sd.o sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 21350295b..9f70a7b0b 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c @@ -3646,4 +3646,15 @@ void esp_release(void) } #endif +EXPORT_SYMBOL(esp_abort); +EXPORT_SYMBOL(esp_allocate); +EXPORT_SYMBOL(esp_deallocate); +EXPORT_SYMBOL(esp_initialize); +EXPORT_SYMBOL(esp_intr); +EXPORT_SYMBOL(esp_queue); +EXPORT_SYMBOL(esp_reset); +EXPORT_SYMBOL(esp_slave_alloc); +EXPORT_SYMBOL(esp_slave_destroy); +EXPORT_SYMBOL(esps_in_use); + MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index 8c0fc3fb7..802f907a5 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c @@ -98,8 +98,6 @@ #include #include #include - -#include "scsi.h" #include #include "53c700.h" @@ -156,7 +154,7 @@ param_setup(char *string) /* Host template. The 53c700 routine NCR_700_detect will * fill in all of the missing routines */ -static Scsi_Host_Template NCR_D700_driver_template = { +static struct scsi_host_template NCR_D700_driver_template = { .module = THIS_MODULE, .name = "NCR Dual 700 MCA", .proc_name = "NCR_D700", diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index c48c59a1f..8eb05ddd2 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -756,27 +756,6 @@ */ - -/* - * --- Linux Version - */ - -#ifndef LINUX_VERSION_CODE -#include -#endif /* LINUX_VERSION_CODE */ - -/* Convert Linux Version, Patch-level, Sub-level to LINUX_VERSION_CODE. */ -#define ASC_LINUX_VERSION(V, P, S) (((V) * 65536) + ((P) * 256) + (S)) -#define ASC_LINUX_KERNEL22 (LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,4,0)) -#define ASC_LINUX_KERNEL24 (LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,4,0)) - -/* Driver supported only in version 2.2 and version >= 2.4. */ -#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,2,0) || \ - (LINUX_VERSION_CODE > ASC_LINUX_VERSION(2,3,0) && \ - LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,4,0)) -#error "AdvanSys driver supported only in 2.2 and 2.4 or greater kernels." -#endif - /* * --- Linux Include Files */ @@ -801,6 +780,7 @@ #include #include #include +#include #include #include @@ -874,9 +854,6 @@ typedef unsigned char uchar; -#ifndef NULL -#define NULL (0) -#endif #ifndef TRUE #define TRUE (1) #endif @@ -986,49 +963,6 @@ typedef unsigned char uchar; #define ASC_MIN_SENSE_LEN 14 #define ASC_MAX_CDB_LEN 12 #define ASC_SCSI_RESET_HOLD_TIME_US 60 -#define SCSICMD_TestUnitReady 0x00 -#define SCSICMD_Rewind 0x01 -#define SCSICMD_Rezero 0x01 -#define SCSICMD_RequestSense 0x03 -#define SCSICMD_Format 0x04 -#define SCSICMD_FormatUnit 0x04 -#define SCSICMD_Read6 0x08 -#define SCSICMD_Write6 0x0A -#define SCSICMD_Seek6 0x0B -#define SCSICMD_Inquiry 0x12 -#define SCSICMD_Verify6 0x13 -#define SCSICMD_ModeSelect6 0x15 -#define SCSICMD_ModeSense6 0x1A -#define SCSICMD_StartStopUnit 0x1B -#define SCSICMD_LoadUnloadTape 0x1B -#define SCSICMD_ReadCapacity 0x25 -#define SCSICMD_Read10 0x28 -#define SCSICMD_Write10 0x2A -#define SCSICMD_Seek10 0x2B -#define SCSICMD_Erase10 0x2C -#define SCSICMD_WriteAndVerify10 0x2E -#define SCSICMD_Verify10 0x2F -#define SCSICMD_WriteBuffer 0x3B -#define SCSICMD_ReadBuffer 0x3C -#define SCSICMD_ReadLong 0x3E -#define SCSICMD_WriteLong 0x3F -#define SCSICMD_ReadTOC 0x43 -#define SCSICMD_ReadHeader 0x44 -#define SCSICMD_ModeSelect10 0x55 -#define SCSICMD_ModeSense10 0x5A - -/* Inquiry Data Peripheral Device Types */ -#define SCSI_TYPE_DASD 0x00 -#define SCSI_TYPE_SASD 0x01 -#define SCSI_TYPE_PRN 0x02 -#define SCSI_TYPE_PROC 0x03 -#define SCSI_TYPE_WORM 0x04 -#define SCSI_TYPE_CDROM 0x05 -#define SCSI_TYPE_SCANNER 0x06 -#define SCSI_TYPE_OPTMEM 0x07 -#define SCSI_TYPE_MED_CHG 0x08 -#define SCSI_TYPE_COMM 0x09 -#define SCSI_TYPE_UNKNOWN 0x1F #define ADV_INQ_CLOCKING_ST_ONLY 0x0 #define ADV_INQ_CLOCKING_DT_ONLY 0x1 @@ -1047,36 +981,11 @@ typedef unsigned char uchar; #define ASC_SCSIDIR_T2H 0x08 #define ASC_SCSIDIR_H2T 0x10 #define ASC_SCSIDIR_NODATA 0x18 -#define SCSI_SENKEY_NO_SENSE 0x00 -#define SCSI_SENKEY_UNDEFINED 0x01 -#define SCSI_SENKEY_NOT_READY 0x02 -#define SCSI_SENKEY_MEDIUM_ERR 0x03 -#define SCSI_SENKEY_HW_ERR 0x04 -#define SCSI_SENKEY_ILLEGAL 0x05 -#define SCSI_SENKEY_ATTENTION 0x06 -#define SCSI_SENKEY_PROTECTED 0x07 -#define SCSI_SENKEY_BLANK 0x08 -#define SCSI_SENKEY_V_UNIQUE 0x09 -#define SCSI_SENKEY_CPY_ABORT 0x0A -#define SCSI_SENKEY_ABORT 0x0B -#define SCSI_SENKEY_EQUAL 0x0C -#define SCSI_SENKEY_VOL_OVERFLOW 0x0D -#define SCSI_SENKEY_MISCOMP 0x0E -#define SCSI_SENKEY_RESERVED 0x0F #define SCSI_ASC_NOMEDIA 0x3A #define ASC_SRB_HOST(x) ((uchar)((uchar)(x) >> 4)) #define ASC_SRB_TID(x) ((uchar)((uchar)(x) & (uchar)0x0F)) #define ASC_SRB_LUN(x) ((uchar)((uint)(x) >> 13)) #define PUT_CDB1(x) ((uchar)((uint)(x) >> 8)) -#define SS_GOOD 0x00 -#define SS_CHK_CONDITION 0x02 -#define SS_CONDITION_MET 0x04 -#define SS_TARGET_BUSY 0x08 -#define SS_INTERMID 0x10 -#define SS_INTERMID_COND_MET 0x14 -#define SS_RSERV_CONFLICT 0x18 -#define SS_CMD_TERMINATED 0x22 -#define SS_QUEUE_FULL 0x28 #define MS_CMD_DONE 0x00 #define MS_EXTEND 0x01 #define MS_SDTR_LEN 0x03 @@ -1085,26 +994,6 @@ typedef unsigned char uchar; #define MS_WDTR_CODE 0x03 #define MS_MDP_LEN 0x05 #define MS_MDP_CODE 0x00 -#define M1_SAVE_DATA_PTR 0x02 -#define M1_RESTORE_PTRS 0x03 -#define M1_DISCONNECT 0x04 -#define M1_INIT_DETECTED_ERR 0x05 -#define M1_ABORT 0x06 -#define M1_MSG_REJECT 0x07 -#define M1_NO_OP 0x08 -#define M1_MSG_PARITY_ERR 0x09 -#define M1_LINK_CMD_DONE 0x0A -#define M1_LINK_CMD_DONE_WFLAG 0x0B -#define M1_BUS_DVC_RESET 0x0C -#define M1_ABORT_TAG 0x0D -#define M1_CLR_QUEUE 0x0E -#define M1_INIT_RECOVERY 0x0F -#define M1_RELEASE_RECOVERY 0x10 -#define M1_KILL_IO_PROC 0x11 -#define M2_QTAG_MSG_SIMPLE 0x20 -#define M2_QTAG_MSG_HEAD 0x21 -#define M2_QTAG_MSG_ORDERED 0x22 -#define M2_IGNORE_WIDE_RESIDUE 0x23 /* * Inquiry data structure and bitfield macros @@ -1576,7 +1465,7 @@ typedef struct asc_dvc_cfg { uchar sdtr_period_offset[ASC_MAX_TID + 1]; ushort pci_slot_info; uchar adapter_info[6]; - struct pci_dev *pci_dev; + struct device *dev; } ASC_DVC_CFG; #define ASC_DEF_DVC_CNTL 0xFFFF @@ -3082,7 +2971,7 @@ typedef struct adv_dvc_cfg { ushort serial1; /* EEPROM serial number word 1 */ ushort serial2; /* EEPROM serial number word 2 */ ushort serial3; /* EEPROM serial number word 3 */ - struct pci_dev *pci_dev; /* pointer to the pci dev structure for this board */ + struct device *dev; /* pointer to the pci dev structure for this board */ } ADV_DVC_CFG; struct adv_dvc_var; @@ -3581,19 +3470,6 @@ typedef struct { #define NO_ISA_DMA 0xff /* No ISA DMA Channel Used */ -/* - * If the Linux kernel version supports freeing initialization code - * and data after loading, define macros for this purpose. These macros - * are not used when the driver is built as a module, cf. linux/init.h. - */ -#if ASC_LINUX_KERNEL24 -#define ASC_INITFUNC(type, func) type __init func -#elif ASC_LINUX_KERNEL22 -#define ASC_INITFUNC(type, func) __initfunc(type func) -#endif -#define ASC_INITDATA __initdata -#define ASC_INIT __init - #define ASC_INFO_SIZE 128 /* advansys_info() line size */ #ifdef CONFIG_PROC_FS @@ -3610,8 +3486,6 @@ typedef struct { } \ cp += len; \ } - -#define ASC_MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif /* CONFIG_PROC_FS */ /* Asc Library return codes */ @@ -3685,53 +3559,6 @@ typedef Scsi_Cmnd REQ, *REQP; /* Return non-zero, if the queue is empty. */ #define ASC_QUEUE_EMPTY(ascq) ((ascq)->q_tidmask == 0) -/* PCI configuration declarations */ - -#define PCI_BASE_CLASS_PREDEFINED 0x00 -#define PCI_BASE_CLASS_MASS_STORAGE 0x01 -#define PCI_BASE_CLASS_NETWORK 0x02 -#define PCI_BASE_CLASS_DISPLAY 0x03 -#define PCI_BASE_CLASS_MULTIMEDIA 0x04 -#define PCI_BASE_CLASS_MEMORY_CONTROLLER 0x05 -#define PCI_BASE_CLASS_BRIDGE_DEVICE 0x06 - -/* MASS STORAGE */ -#define PCI_SUB_CLASS_SCSI_CONTROLLER 0x00 -#define PCI_SUB_CLASS_IDE_CONTROLLER 0x01 -#define PCI_SUB_CLASS_FLOPPY_DISK_CONTROLLER 0x02 -#define PCI_SUB_CLASS_IPI_BUS_CONTROLLER 0x03 -#define PCI_SUB_CLASS_OTHER_MASS_CONTROLLER 0x80 - -/* NETWORK CONTROLLER */ -#define PCI_SUB_CLASS_ETHERNET_CONTROLLER 0x00 -#define PCI_SUB_CLASS_TOKEN_RING_CONTROLLER 0x01 -#define PCI_SUB_CLASS_FDDI_CONTROLLER 0x02 -#define PCI_SUB_CLASS_OTHER_NETWORK_CONTROLLER 0x80 - -/* DISPLAY CONTROLLER */ -#define PCI_SUB_CLASS_VGA_CONTROLLER 0x00 -#define PCI_SUB_CLASS_XGA_CONTROLLER 0x01 -#define PCI_SUB_CLASS_OTHER_DISPLAY_CONTROLLER 0x80 - -/* MULTIMEDIA CONTROLLER */ -#define PCI_SUB_CLASS_VIDEO_DEVICE 0x00 -#define PCI_SUB_CLASS_AUDIO_DEVICE 0x01 -#define PCI_SUB_CLASS_OTHER_MULTIMEDIA_DEVICE 0x80 - -/* MEMORY CONTROLLER */ -#define PCI_SUB_CLASS_RAM_CONTROLLER 0x00 -#define PCI_SUB_CLASS_FLASH_CONTROLLER 0x01 -#define PCI_SUB_CLASS_OTHER_MEMORY_CONTROLLER 0x80 - -/* BRIDGE CONTROLLER */ -#define PCI_SUB_CLASS_HOST_BRIDGE_CONTROLLER 0x00 -#define PCI_SUB_CLASS_ISA_BRIDGE_CONTROLLER 0x01 -#define PCI_SUB_CLASS_EISA_BRIDGE_CONTROLLER 0x02 -#define PCI_SUB_CLASS_MC_BRIDGE_CONTROLLER 0x03 -#define PCI_SUB_CLASS_PCI_TO_PCI_BRIDGE_CONTROLLER 0x04 -#define PCI_SUB_CLASS_PCMCIA_BRIDGE_CONTROLLER 0x05 -#define PCI_SUB_CLASS_OTHER_BRIDGE_CONTROLLER 0x80 - #define PCI_MAX_SLOT 0x1F #define PCI_MAX_BUS 0xFF #define PCI_IOADDRESS_MASK 0xFFFE @@ -3744,25 +3571,6 @@ typedef Scsi_Cmnd REQ, *REQP; #define ASC_PCI_DEVICE_ID_2500 0x2500 /* ASC-38C0800 */ #define ASC_PCI_DEVICE_ID_2700 0x2700 /* ASC-38C1600 */ -/* PCI IO Port Addresses to generate special cycle */ - -#define PCI_CONFIG_ADDRESS_MECH1 0x0CF8 -#define PCI_CONFIG_DATA_MECH1 0x0CFC - -#define PCI_CONFIG_FORWARD_REGISTER 0x0CFA /* 0=type 0; 1=type 1; */ - -#define PCI_CONFIG_BUS_NUMBER_MASK 0x00FF0000 -#define PCI_CONFIG_DEVICE_FUNCTION_MASK 0x0000FF00 -#define PCI_CONFIG_REGISTER_NUMBER_MASK 0x000000F8 - -#define PCI_DEVICE_FOUND 0x0000 -#define PCI_DEVICE_NOT_FOUND 0xffff - -#define SUBCLASS_OFFSET 0x0A -#define CLASSCODE_OFFSET 0x0B -#define VENDORID_OFFSET 0x00 -#define DEVICEID_OFFSET 0x02 - #ifndef ADVANSYS_STATS #define ASC_STATS(shp, counter) #define ASC_STATS_ADD(shp, counter, count) @@ -4145,19 +3953,6 @@ typedef struct _PCI_CONFIG_SPACE_ /* Note: All driver global data should be initialized. */ -#if ASC_LINUX_KERNEL22 -#ifdef CONFIG_PROC_FS -struct proc_dir_entry proc_scsi_advansys = -{ - PROC_SCSI_ADVANSYS, /* unsigned short low_ino */ - 8, /* unsigned short namelen */ - "advansys", /* const char *name */ - S_IFDIR | S_IRUGO | S_IXUGO, /* mode_t mode */ - 2 /* nlink_t nlink */ -}; -#endif /* CONFIG_PROC_FS */ -#endif /* ASC_LINUX_KERNEL22 */ - /* Number of boards detected in system. */ STATIC int asc_board_count = 0; STATIC struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { 0 }; @@ -4172,7 +3967,7 @@ STATIC ASC_SCSI_Q asc_scsi_q = { { 0 } }; STATIC ASC_SG_HEAD asc_sg_head = { 0 }; /* List of supported bus types. */ -STATIC ushort asc_bus[ASC_NUM_BUS] ASC_INITDATA = { +STATIC ushort asc_bus[ASC_NUM_BUS] __initdata = { ASC_IS_ISA, ASC_IS_VL, ASC_IS_EISA, @@ -4210,11 +4005,11 @@ STATIC PortAddr _asc_def_iop_base[]; STATIC irqreturn_t advansys_interrupt(int, void *, struct pt_regs *); STATIC int advansys_slave_configure(Scsi_Device *); -STATIC void asc_scsi_done_list(Scsi_Cmnd *, int from_isr); +STATIC void asc_scsi_done_list(Scsi_Cmnd *); STATIC int asc_execute_scsi_cmnd(Scsi_Cmnd *); STATIC int asc_build_req(asc_board_t *, Scsi_Cmnd *); STATIC int adv_build_req(asc_board_t *, Scsi_Cmnd *, ADV_SCSI_REQ_Q **); -STATIC int adv_get_sglist(asc_board_t *, adv_req_t *, Scsi_Cmnd *); +STATIC int adv_get_sglist(asc_board_t *, adv_req_t *, Scsi_Cmnd *, int); STATIC void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *); STATIC void adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *); STATIC void adv_async_callback(ADV_DVC_VAR *, uchar); @@ -4505,10 +4300,8 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, * it must not call SCSI mid-level functions including scsi_malloc() * and scsi_free(). */ -ASC_INITFUNC( -int, +int __init advansys_detect(Scsi_Host_Template *tpnt) -) { static int detect_called = ASC_FALSE; int iop; @@ -4526,6 +4319,7 @@ advansys_detect(Scsi_Host_Template *tpnt) struct pci_dev *pci_devicep[ASC_NUM_BOARD_SUPPORTED]; int pci_card_cnt_max = 0; int pci_card_cnt = 0; + struct device *dev = NULL; struct pci_dev *pci_devp = NULL; int pci_device_id_cnt = 0; unsigned int pci_device_id[ASC_PCI_DEVICE_ID_CNT] = { @@ -4550,12 +4344,6 @@ advansys_detect(Scsi_Host_Template *tpnt) ASC_DBG(1, "advansys_detect: begin\n"); -#if ASC_LINUX_KERNEL24 - tpnt->proc_name = "advansys"; -#elif ASC_LINUX_KERNEL22 - tpnt->proc_dir = &proc_scsi_advansys; -#endif - asc_board_count = 0; /* @@ -4681,13 +4469,9 @@ advansys_detect(Scsi_Host_Template *tpnt) NULL) { pci_device_id_cnt++; } else { -#if ASC_LINUX_KERNEL24 if (pci_enable_device(pci_devp) == 0) { pci_devicep[pci_card_cnt_max++] = pci_devp; } -#elif ASC_LINUX_KERNEL22 - pci_devicep[pci_card_cnt_max++] = pci_devp; -#endif } } @@ -4724,17 +4508,16 @@ advansys_detect(Scsi_Host_Template *tpnt) ASC_DBG2(2, "advansys_detect: devfn %d, bus number %d\n", pci_devp->devfn, pci_devp->bus->number); -#if ASC_LINUX_KERNEL24 iop = pci_resource_start(pci_devp, 0); -#elif ASC_LINUX_KERNEL22 - iop = pci_devp->base_address[0] & PCI_IOADDRESS_MASK; -#endif ASC_DBG2(1, "advansys_detect: vendorID %X, deviceID %X\n", pci_devp->vendor, pci_devp->device); ASC_DBG2(2, "advansys_detect: iop %X, irqLine %d\n", iop, pci_devp->irq); } + if(pci_devp) + dev = &pci_devp->dev; + #endif /* CONFIG_PCI */ break; @@ -4765,7 +4548,7 @@ advansys_detect(Scsi_Host_Template *tpnt) continue; } - scsi_set_device(shp, &pci_devp->dev); + scsi_set_device(shp, dev); /* Save a pointer to the Scsi_Host of each board found. */ asc_host[asc_board_count++] = shp; @@ -4849,11 +4632,7 @@ advansys_detect(Scsi_Host_Template *tpnt) iolen = ADV_38C1600_IOLEN; } #ifdef CONFIG_PCI -#if ASC_LINUX_KERNEL24 pci_memory_address = pci_resource_start(pci_devp, 1); -#elif ASC_LINUX_KERNEL22 - pci_memory_address = pci_devp->base_address[1]; -#endif ASC_DBG1(1, "advansys_detect: pci_memory_address: 0x%lx\n", (ulong) pci_memory_address); if ((boardp->ioremap_addr = @@ -4904,7 +4683,8 @@ advansys_detect(Scsi_Host_Template *tpnt) #endif /* CONFIG_PROC_FS */ if (ASC_NARROW_BOARD(boardp)) { - /* + asc_dvc_varp->cfg->dev = dev; + /* * Set the board bus type and PCI IRQ before * calling AscInitGetConfig(). */ @@ -4926,7 +4706,6 @@ advansys_detect(Scsi_Host_Template *tpnt) #ifdef CONFIG_PCI case ASC_IS_PCI: shp->irq = asc_dvc_varp->irq_no = pci_devp->irq; - asc_dvc_varp->cfg->pci_dev = pci_devp; asc_dvc_varp->cfg->pci_slot_info = ASC_PCI_MKID(pci_devp->bus->number, PCI_SLOT(pci_devp->devfn), @@ -4944,13 +4723,13 @@ advansys_detect(Scsi_Host_Template *tpnt) break; } } else { + adv_dvc_varp->cfg->dev = dev; /* * For Wide boards set PCI information before calling * AdvInitGetConfig(). */ #ifdef CONFIG_PCI shp->irq = adv_dvc_varp->irq_no = pci_devp->irq; - adv_dvc_varp->cfg->pci_dev = pci_devp; adv_dvc_varp->cfg->pci_slot_info = ASC_PCI_MKID(pci_devp->bus->number, PCI_SLOT(pci_devp->devfn), @@ -5321,11 +5100,7 @@ advansys_detect(Scsi_Host_Template *tpnt) /* BIOS start address. */ if (ASC_NARROW_BOARD(boardp)) { -#if ASC_LINUX_KERNEL24 shp->base = -#elif ASC_LINUX_KERNEL22 - shp->base = (char *) -#endif ((ulong) AscGetChipBiosAddress( asc_dvc_varp->iop_base, asc_dvc_varp->bus_type)); @@ -5360,11 +5135,7 @@ advansys_detect(Scsi_Host_Template *tpnt) * Convert x86 realmode code segment to a linear * address by shifting left 4. */ - shp->base = -#if ASC_LINUX_KERNEL22 - (char *) -#endif - ((ulong) boardp->bios_codeseg << 4); + shp->base = ((ulong) boardp->bios_codeseg << 4); } else { shp->base = 0; } @@ -5385,7 +5156,6 @@ advansys_detect(Scsi_Host_Template *tpnt) ASC_DBG2(2, "advansys_detect: request_region port 0x%lx, len 0x%x\n", (ulong) shp->io_port, boardp->asc_n_io_port); -#if ASC_LINUX_KERNEL24 if (request_region(shp->io_port, boardp->asc_n_io_port, "advansys") == NULL) { ASC_PRINT3( @@ -5398,9 +5168,6 @@ advansys_detect(Scsi_Host_Template *tpnt) asc_board_count--; continue; } -#elif ASC_LINUX_KERNEL22 - request_region(shp->io_port, boardp->asc_n_io_port, "advansys"); -#endif /* Register DMA Channel for Narrow boards. */ shp->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */ @@ -5880,7 +5647,7 @@ advansys_queuecommand(Scsi_Cmnd *scp, void (*done)(Scsi_Cmnd *)) default: done_scp = asc_dequeue_list(&boardp->done, NULL, ASC_TID_ALL); /* Interrupts could be enabled here. */ - asc_scsi_done_list(done_scp, 0); + asc_scsi_done_list(done_scp); break; } spin_unlock_irqrestore(&boardp->lock, flags); @@ -6063,7 +5830,7 @@ advansys_reset(Scsi_Cmnd *scp) * Complete all the 'done_scp' requests. */ if (done_scp != NULL) { - asc_scsi_done_list(done_scp, 0); + asc_scsi_done_list(done_scp); } ASC_DBG1(1, "advansys_reset: ret %d\n", ret); @@ -6149,10 +5916,8 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev, * ints[2] - second argument * ... */ -ASC_INITFUNC( -void, +void __init advansys_setup(char *str, int *ints) -) { int i; @@ -6328,7 +6093,7 @@ advansys_interrupt(int irq, void *dev_id, struct pt_regs *regs) * Complete all requests on the done list. */ - asc_scsi_done_list(done_scp, 1); + asc_scsi_done_list(done_scp); ASC_DBG(1, "advansys_interrupt: end\n"); return IRQ_HANDLED; @@ -6374,23 +6139,38 @@ advansys_slave_configure(Scsi_Device *device) * Interrupts can be enabled on entry. */ STATIC void -asc_scsi_done_list(Scsi_Cmnd *scp, int from_isr) +asc_scsi_done_list(Scsi_Cmnd *scp) { Scsi_Cmnd *tscp; - ulong flags = 0; ASC_DBG(2, "asc_scsi_done_list: begin\n"); while (scp != NULL) { + asc_board_t *boardp; + struct device *dev; + ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong) scp); tscp = REQPNEXT(scp); scp->host_scribble = NULL; + + boardp = ASC_BOARDP(scp->device->host); + + if (ASC_NARROW_BOARD(boardp)) + dev = boardp->dvc_cfg.asc_dvc_cfg.dev; + else + dev = boardp->dvc_cfg.adv_dvc_cfg.dev; + + if (scp->use_sg) + dma_unmap_sg(dev, (struct scatterlist *)scp->request_buffer, + scp->use_sg, scp->sc_data_direction); + else if (scp->request_bufflen) + dma_unmap_single(dev, scp->SCp.dma_handle, + scp->request_bufflen, scp->sc_data_direction); + ASC_STATS(scp->device->host, done); ASC_ASSERT(scp->scsi_done != NULL); - if (from_isr) - spin_lock_irqsave(scp->device->host->host_lock, flags); + scp->scsi_done(scp); - if (from_isr) - spin_unlock_irqrestore(scp->device->host->host_lock, flags); + scp = tscp; } ASC_DBG(2, "asc_scsi_done_list: done\n"); @@ -6619,6 +6399,8 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp) STATIC int asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp) { + struct device *dev = boardp->dvc_cfg.asc_dvc_cfg.dev; + /* * Mutually exclusive access is required to 'asc_scsi_q' and * 'asc_sg_head' until after the request is started. @@ -6665,9 +6447,9 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp) */ if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) && (boardp->reqcnt[scp->device->id] % 255) == 0) { - asc_scsi_q.q2.tag_code = M2_QTAG_MSG_ORDERED; + asc_scsi_q.q2.tag_code = MSG_ORDERED_TAG; } else { - asc_scsi_q.q2.tag_code = M2_QTAG_MSG_SIMPLE; + asc_scsi_q.q2.tag_code = MSG_SIMPLE_TAG; } /* @@ -6679,8 +6461,10 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp) * CDB request of single contiguous buffer. */ ASC_STATS(scp->device->host, cont_cnt); - asc_scsi_q.q1.data_addr = - cpu_to_le32(virt_to_bus(scp->request_buffer)); + scp->SCp.dma_handle = scp->request_bufflen ? + dma_map_single(dev, scp->request_buffer, + scp->request_bufflen, scp->sc_data_direction) : 0; + asc_scsi_q.q1.data_addr = cpu_to_le32(scp->SCp.dma_handle); asc_scsi_q.q1.data_cnt = cpu_to_le32(scp->request_bufflen); ASC_STATS_ADD(scp->device->host, cont_xfer, ASC_CEILING(scp->request_bufflen, 512)); @@ -6691,12 +6475,17 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp) * CDB scatter-gather request list. */ int sgcnt; + int use_sg; struct scatterlist *slp; - if (scp->use_sg > scp->device->host->sg_tablesize) { + slp = (struct scatterlist *)scp->request_buffer; + use_sg = dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction); + + if (use_sg > scp->device->host->sg_tablesize) { ASC_PRINT3( "asc_build_req: board %d: use_sg %d > sg_tablesize %d\n", - boardp->id, scp->use_sg, scp->device->host->sg_tablesize); + boardp->id, use_sg, scp->device->host->sg_tablesize); + dma_unmap_sg(dev, slp, scp->use_sg, scp->sc_data_direction); scp->result = HOST_BYTE(DID_ERROR); asc_enqueue(&boardp->done, scp, ASC_BACK); return ASC_ERROR; @@ -6715,19 +6504,16 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp) asc_scsi_q.q1.data_cnt = 0; asc_scsi_q.q1.data_addr = 0; /* This is a byte value, otherwise it would need to be swapped. */ - asc_sg_head.entry_cnt = asc_scsi_q.q1.sg_queue_cnt = scp->use_sg; + asc_sg_head.entry_cnt = asc_scsi_q.q1.sg_queue_cnt = use_sg; ASC_STATS_ADD(scp->device->host, sg_elem, asc_sg_head.entry_cnt); /* * Convert scatter-gather list into ASC_SG_HEAD list. */ - slp = (struct scatterlist *) scp->request_buffer; - for (sgcnt = 0; sgcnt < scp->use_sg; sgcnt++, slp++) { - asc_sg_head.sg_list[sgcnt].addr = - cpu_to_le32(virt_to_bus( - (unsigned char *)page_address(slp->page) + slp->offset)); - asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(slp->length); - ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(slp->length, 512)); + for (sgcnt = 0; sgcnt < use_sg; sgcnt++, slp++) { + asc_sg_head.sg_list[sgcnt].addr = cpu_to_le32(sg_dma_address(slp)); + asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(sg_dma_len(slp)); + ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(sg_dma_len(slp), 512)); } } @@ -6755,6 +6541,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, ADV_SCSI_REQ_Q *scsiqp; int i; int ret; + struct device *dev = boardp->dvc_cfg.adv_dvc_cfg.dev; /* * Allocate an adv_req_t structure from the board to execute @@ -6827,15 +6614,23 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather * buffer command. */ - scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen); - scsiqp->vdata_addr = scp->request_buffer; - scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer)); if (scp->use_sg == 0) { /* * CDB request of single contiguous buffer. */ reqp->sgblkp = NULL; + scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen); + if (scp->request_bufflen) { + scsiqp->vdata_addr = scp->request_buffer; + scp->SCp.dma_handle = + dma_map_single(dev, scp->request_buffer, + scp->request_bufflen, scp->sc_data_direction); + } else { + scsiqp->vdata_addr = 0; + scp->SCp.dma_handle = 0; + } + scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle); scsiqp->sg_list_ptr = NULL; scsiqp->sg_real_addr = 0; ASC_STATS(scp->device->host, cont_cnt); @@ -6845,10 +6640,21 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, /* * CDB scatter-gather request list. */ - if (scp->use_sg > ADV_MAX_SG_LIST) { + struct scatterlist *slp; + int use_sg; + + scsiqp->data_cnt = 0; + scsiqp->vdata_addr = 0; + scsiqp->data_addr = 0; + + slp = (struct scatterlist *)scp->request_buffer; + use_sg = dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction); + + if (use_sg > ADV_MAX_SG_LIST) { ASC_PRINT3( "adv_build_req: board %d: use_sg %d > ADV_MAX_SG_LIST %d\n", - boardp->id, scp->use_sg, scp->device->host->sg_tablesize); + boardp->id, use_sg, scp->device->host->sg_tablesize); + dma_unmap_sg(dev, slp, scp->use_sg, scp->sc_data_direction); scp->result = HOST_BYTE(DID_ERROR); asc_enqueue(&boardp->done, scp, ASC_BACK); @@ -6862,7 +6668,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, return ASC_ERROR; } - if ((ret = adv_get_sglist(boardp, reqp, scp)) != ADV_SUCCESS) { + if ((ret = adv_get_sglist(boardp, reqp, scp, use_sg)) != ADV_SUCCESS) { /* * Free the adv_req_t structure by adding it back to the * board free list. @@ -6874,7 +6680,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, } ASC_STATS(scp->device->host, sg_cnt); - ASC_STATS_ADD(scp->device->host, sg_elem, scp->use_sg); + ASC_STATS_ADD(scp->device->host, sg_elem, use_sg); } ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp); @@ -6898,7 +6704,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp, * ADV_ERROR(-1) - SG List creation failed */ STATIC int -adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp) +adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp, int use_sg) { adv_sgblk_t *sgblkp; ADV_SCSI_REQ_Q *scsiqp; @@ -6910,7 +6716,7 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp) scsiqp = (ADV_SCSI_REQ_Q *) ADV_32BALIGN(&reqp->scsi_req_q); slp = (struct scatterlist *) scp->request_buffer; - sg_elem_cnt = scp->use_sg; + sg_elem_cnt = use_sg; prev_sg_block = NULL; reqp->sgblkp = NULL; @@ -6982,11 +6788,9 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp) for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) { - sg_block->sg_list[i].sg_addr = - cpu_to_le32(virt_to_bus( - (unsigned char *)page_address(slp->page) + slp->offset)); - sg_block->sg_list[i].sg_count = cpu_to_le32(slp->length); - ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(slp->length, 512)); + sg_block->sg_list[i].sg_addr = cpu_to_le32(sg_dma_address(slp)); + sg_block->sg_list[i].sg_count = cpu_to_le32(sg_dma_len(slp)); + ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(sg_dma_len(slp), 512)); if (--sg_elem_cnt == 0) { /* Last ADV_SG_BLOCK and scatter-gather entry. */ @@ -7079,14 +6883,13 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) * If an INQUIRY command completed successfully, then call * the AscInquiryHandling() function to set-up the device. */ - if (scp->cmnd[0] == SCSICMD_Inquiry && scp->device->lun == 0 && + if (scp->cmnd[0] == INQUIRY && scp->device->lun == 0 && (scp->request_bufflen - qdonep->remain_bytes) >= 8) { AscInquiryHandling(asc_dvc_varp, scp->device->id & 0x7, (ASC_SCSI_INQUIRY *) scp->request_buffer); } -#if ASC_LINUX_KERNEL24 /* * Check for an underrun condition. * @@ -7099,15 +6902,14 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) (unsigned) qdonep->remain_bytes); scp->resid = qdonep->remain_bytes; } -#endif break; case QD_WITH_ERROR: ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n"); switch (qdonep->d3.host_stat) { case QHSTA_NO_ERROR: - if (qdonep->d3.scsi_stat == SS_CHK_CONDITION) { - ASC_DBG(2, "asc_isr_callback: SS_CHK_CONDITION\n"); + if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) { + ASC_DBG(2, "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n"); ASC_DBG_PRT_SENSE(2, scp->sense_buffer, sizeof(scp->sense_buffer)); /* @@ -7185,9 +6987,7 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) Scsi_Cmnd *scp; struct Scsi_Host *shp; int i; -#if ASC_LINUX_KERNEL24 ADV_DCNT resid_cnt; -#endif ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n", @@ -7270,7 +7070,6 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n"); scp->result = 0; -#if ASC_LINUX_KERNEL24 /* * Check for an underrun condition. * @@ -7284,15 +7083,14 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) (ulong) resid_cnt); scp->resid = resid_cnt; } -#endif break; case QD_WITH_ERROR: ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n"); switch (scsiqp->host_status) { case QHSTA_NO_ERROR: - if (scsiqp->scsi_status == SS_CHK_CONDITION) { - ASC_DBG(2, "adv_isr_callback: SS_CHK_CONDITION\n"); + if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) { + ASC_DBG(2, "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n"); ASC_DBG_PRT_SENSE(2, scp->sense_buffer, sizeof(scp->sense_buffer)); /* @@ -8858,7 +8656,7 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, (unsigned) offset, (unsigned) advoffset, cplen); if (offset <= advoffset) { /* Read offset below current offset, copy everything. */ - cnt = ASC_MIN(cplen, leftlen); + cnt = min(cplen, leftlen); ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", (ulong) curbuf, (ulong) cp, cnt); memcpy(curbuf, cp, cnt); @@ -8866,7 +8664,7 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, /* Read offset within current range, partial copy. */ cnt = (advoffset + cplen) - offset; cp = (cp + cplen) - cnt; - cnt = ASC_MIN(cnt, leftlen); + cnt = min(cnt, leftlen); ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n", (ulong) curbuf, (ulong) cp, cnt); memcpy(curbuf, cp, cnt); @@ -8899,7 +8697,7 @@ asc_prt_line(char *buf, int buflen, char *fmt, ...) (void) printk(s); ret = 0; } else { - ret = ASC_MIN(buflen, ret); + ret = min(buflen, ret); memcpy(buf, s, ret); } va_end(args); @@ -9002,16 +8800,14 @@ DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words) /* * Read a PCI configuration byte. */ -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init DvcReadPCIConfigByte( ASC_DVC_VAR *asc_dvc, ushort offset) -) { #ifdef CONFIG_PCI uchar byte_data; - pci_read_config_byte(asc_dvc->cfg->pci_dev, offset, &byte_data); + pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data); return byte_data; #else /* !defined(CONFIG_PCI) */ return 0; @@ -9021,16 +8817,14 @@ DvcReadPCIConfigByte( /* * Write a PCI configuration byte. */ -ASC_INITFUNC( -STATIC void, +STATIC void __init DvcWritePCIConfigByte( ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) -) { #ifdef CONFIG_PCI - pci_write_config_byte(asc_dvc->cfg->pci_dev, offset, byte_data); + pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data); #endif /* CONFIG_PCI */ } @@ -9038,13 +8832,10 @@ DvcWritePCIConfigByte( * Return the BIOS address of the adapter at the specified * I/O port and with the specified bus type. */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscGetChipBiosAddress( PortAddr iop_base, - ushort bus_type -) -) + ushort bus_type) { ushort cfg_lsw; ushort bios_addr; @@ -9119,16 +8910,14 @@ DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq, /* * Read a PCI configuration byte. */ -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init DvcAdvReadPCIConfigByte( ADV_DVC_VAR *asc_dvc, ushort offset) -) { #ifdef CONFIG_PCI uchar byte_data; - pci_read_config_byte(asc_dvc->cfg->pci_dev, offset, &byte_data); + pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data); return byte_data; #else /* CONFIG_PCI */ return 0; @@ -9138,16 +8927,14 @@ DvcAdvReadPCIConfigByte( /* * Write a PCI configuration byte. */ -ASC_INITFUNC( -STATIC void, +STATIC void __init DvcAdvWritePCIConfigByte( ADV_DVC_VAR *asc_dvc, ushort offset, uchar byte_data) -) { #ifdef CONFIG_PCI - pci_write_config_byte(asc_dvc->cfg->pci_dev, offset, byte_data); + pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data); #else /* CONFIG_PCI */ return 0; #endif /* CONFIG_PCI */ @@ -9358,16 +9145,6 @@ asc_prt_scsi_host(struct Scsi_Host *s) s->host_busy, s->host_no, (unsigned) s->last_reset); -#if ASC_LINUX_KERNEL24 - printk( -" hostt 0x%lx\n", - (ulong) s->hostt); -#elif ASC_LINUX_KERNEL22 - printk( -" host_queue 0x%lx, hostt 0x%lx, block 0x%lx,\n", - (ulong) s->host_queue, (ulong) s->hostt, (ulong) s->block); -#endif - printk( " base 0x%lx, io_port 0x%lx, n_io_port %u, irq 0x%x,\n", (ulong) s->base, (ulong) s->io_port, s->n_io_port, s->irq); @@ -9404,11 +9181,9 @@ asc_prt_scsi_cmnd(Scsi_Cmnd *s) asc_prt_hex(" CDB", s->cmnd, s->cmd_len); -#if ASC_LINUX_KERNEL24 printk ( "sc_data_direction %u, resid %d\n", s->sc_data_direction, s->resid); -#endif printk( " use_sg %u, sglist_len %u, abort_reason 0x%x\n", @@ -9423,15 +9198,9 @@ asc_prt_scsi_cmnd(Scsi_Cmnd *s) " timeout_per_command %d, timeout_total %d, timeout %d\n", s->timeout_per_command, s->timeout_total, s->timeout); -#if ASC_LINUX_KERNEL24 printk( " internal_timeout %u, flags %u\n", s->internal_timeout, s->flags); -#elif ASC_LINUX_KERNEL22 - printk( -" internal_timeout %u, flags %u, this_count %d\n", - s->internal_timeout, s->flags,s->this_count); -#endif printk( " scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n", @@ -9507,7 +9276,8 @@ asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h) printk( " pci_device_id %d, lib_serial_no %u, lib_version %u, mcode_date 0x%x,\n", - h->pci_dev->device, h->lib_serial_no, h->lib_version, h->mcode_date); + to_pci_dev(h->dev)->device, h->lib_serial_no, h->lib_version, + h->mcode_date); printk( " mcode_version %d, overrun_buf 0x%lx\n", @@ -9632,7 +9402,7 @@ asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h) printk( " mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n", - h->mcode_version, h->pci_dev->device, h->lib_version); + h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version); printk( " control_flag 0x%x, pci_slot_info 0x%x\n", @@ -9787,12 +9557,9 @@ asc_prt_hex(char *f, uchar *s, int l) * --- Asc Library Functions */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscGetEisaChipCfg( - PortAddr iop_base -) -) + PortAddr iop_base) { PortAddr eisa_cfg_iop; @@ -9801,13 +9568,11 @@ AscGetEisaChipCfg( return (inpw(eisa_cfg_iop)); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscSetChipScsiID( PortAddr iop_base, uchar new_host_id ) -) { ushort cfg_lsw; @@ -9821,12 +9586,9 @@ AscSetChipScsiID( return (AscGetChipScsiID(iop_base)); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscGetChipScsiCtrl( - PortAddr iop_base -) -) + PortAddr iop_base) { uchar sc; @@ -9836,13 +9598,11 @@ AscGetChipScsiCtrl( return (sc); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscGetChipVersion( PortAddr iop_base, ushort bus_type ) -) { if ((bus_type & ASC_IS_EISA) != 0) { PortAddr eisa_iop; @@ -9855,12 +9615,9 @@ AscGetChipVersion( return (AscGetChipVerNo(iop_base)); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscGetChipBusType( - PortAddr iop_base -) -) + PortAddr iop_base) { ushort chip_ver; @@ -9940,22 +9697,19 @@ AscFindSignature( return (0); } -STATIC PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] ASC_INITDATA = +STATIC PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __initdata = { 0x100, ASC_IOADR_1, 0x120, ASC_IOADR_2, 0x140, ASC_IOADR_3, ASC_IOADR_4, ASC_IOADR_5, ASC_IOADR_6, ASC_IOADR_7, ASC_IOADR_8 }; #ifdef CONFIG_ISA -STATIC uchar _isa_pnp_inited ASC_INITDATA = 0; +STATIC uchar _isa_pnp_inited __initdata = 0; -ASC_INITFUNC( -STATIC PortAddr, +STATIC PortAddr __init AscSearchIOPortAddr( PortAddr iop_beg, - ushort bus_type -) -) + ushort bus_type) { if (bus_type & ASC_IS_VL) { while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) { @@ -9986,12 +9740,10 @@ AscSearchIOPortAddr( return (0); } -ASC_INITFUNC( -STATIC PortAddr, +STATIC PortAddr __init AscSearchIOPortAddr11( PortAddr s_addr ) -) { int i; PortAddr iop_base; @@ -10017,11 +9769,8 @@ AscSearchIOPortAddr11( return (0); } -ASC_INITFUNC( -STATIC void, -AscSetISAPNPWaitForKey( - void) -) +STATIC void __init +AscSetISAPNPWaitForKey(void) { outp(ASC_ISA_PNP_PORT_ADDR, 0x02); outp(ASC_ISA_PNP_PORT_WRITE, 0x02); @@ -10029,25 +9778,20 @@ AscSetISAPNPWaitForKey( } #endif /* CONFIG_ISA */ -ASC_INITFUNC( -STATIC void, +STATIC void __init AscToggleIRQAct( PortAddr iop_base ) -) { AscSetChipStatus(iop_base, CIW_IRQ_ACT); AscSetChipStatus(iop_base, 0); return; } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscGetChipIRQ( PortAddr iop_base, - ushort bus_type -) -) + ushort bus_type) { ushort cfg_lsw; uchar chip_irq; @@ -10077,14 +9821,11 @@ AscGetChipIRQ( return ((uchar) (chip_irq + ASC_MIN_IRQ_NO)); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscSetChipIRQ( PortAddr iop_base, uchar irq_no, - ushort bus_type -) -) + ushort bus_type) { ushort cfg_lsw; @@ -10119,12 +9860,9 @@ AscSetChipIRQ( } #ifdef CONFIG_ISA -ASC_INITFUNC( -STATIC void, +STATIC void __init AscEnableIsaDma( - uchar dma_channel -) -) + uchar dma_channel) { if (dma_channel < 4) { outp(0x000B, (ushort) (0xC0 | dma_channel)); @@ -10285,7 +10023,7 @@ AscIsrChipHalted( return (0); } else { - ext_msg.msg_type = M1_MSG_REJECT; + ext_msg.msg_type = MESSAGE_REJECT; AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG, (uchar *) &ext_msg, @@ -10385,7 +10123,7 @@ AscIsrChipHalted( (ushort) ASCV_SCSIBUSY_B, scsi_busy); asc_dvc->queue_full_or_busy |= target_id; - if (scsi_status == SS_QUEUE_FULL) { + if (scsi_status == SAM_STAT_TASK_SET_FULL) { if (cur_dvc_qng > ASC_MIN_TAGGED_CMD) { cur_dvc_qng -= 1; asc_dvc->max_dvc_qng[tid_no] = cur_dvc_qng; @@ -10732,7 +10470,7 @@ AscIsrQDone( } else { if ((AscReadLramByte(iop_base, (ushort) (q_addr + (ushort) ASC_SCSIQ_CDB_BEG)) == - SCSICMD_StartStopUnit)) { + START_STOP)) { asc_dvc->unit_not_ready &= ~target_id; if (scsiq->d3.done_stat != QD_NO_ERROR) { asc_dvc->start_motor &= ~target_id; @@ -11005,14 +10743,14 @@ STATIC ADV_DCNT _asc_mcode_chksum = 0x012C453FUL; #define ASC_SYN_OFFSET_ONE_DISABLE_LIST 16 STATIC uchar _syn_offset_one_disable_cmd[ASC_SYN_OFFSET_ONE_DISABLE_LIST] = { - SCSICMD_Inquiry, - SCSICMD_RequestSense, - SCSICMD_ReadCapacity, - SCSICMD_ReadTOC, - SCSICMD_ModeSelect6, - SCSICMD_ModeSense6, - SCSICMD_ModeSelect10, - SCSICMD_ModeSense10, + INQUIRY, + REQUEST_SENSE, + READ_CAPACITY, + READ_TOC, + MODE_SELECT, + MODE_SENSE, + MODE_SELECT_10, + MODE_SENSE_10, 0xFF, 0xFF, 0xFF, @@ -11065,7 +10803,7 @@ AscExeScsiQueue( target_ix = scsiq->q2.target_ix; tid_no = ASC_TIX_TO_TID(target_ix); n_q_required = 1; - if (scsiq->cdbptr[0] == SCSICMD_RequestSense) { + if (scsiq->cdbptr[0] == REQUEST_SENSE) { if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) { asc_dvc->sdtr_done &= ~scsiq->q1.target_id; sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no); @@ -11134,7 +10872,7 @@ AscExeScsiQueue( } } if (disable_syn_offset_one_fix) { - scsiq->q2.tag_code &= ~M2_QTAG_MSG_SIMPLE; + scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG; scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX | ASC_TAG_FLAG_DISABLE_DISCONNECT); } else { @@ -11143,8 +10881,8 @@ AscExeScsiQueue( if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) { if (asc_dvc->bug_fix_cntl) { if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { - if ((scsi_cmd == SCSICMD_Read6) || - (scsi_cmd == SCSICMD_Read10)) { + if ((scsi_cmd == READ_6) || + (scsi_cmd == READ_10)) { addr = (ADV_PADDR) le32_to_cpu( sg_head->sg_list[sg_entry_cnt_minus_one].addr) + @@ -11193,8 +10931,8 @@ AscExeScsiQueue( } else { if (asc_dvc->bug_fix_cntl) { if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) { - if ((scsi_cmd == SCSICMD_Read6) || - (scsi_cmd == SCSICMD_Read10)) { + if ((scsi_cmd == READ_6) || + (scsi_cmd == READ_10)) { addr = le32_to_cpu(scsiq->q1.data_addr) + le32_to_cpu(scsiq->q1.data_cnt); extra_bytes = (uchar) ((ushort) addr & 0x0003); @@ -11365,7 +11103,7 @@ AscPutReadyQueue( } q_addr = ASC_QNO_TO_QADDR(q_no); if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) { - scsiq->q2.tag_code &= ~M2_QTAG_MSG_SIMPLE; + scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG ; } scsiq->q1.status = QS_FREE; AscMemWordCopyPtrToLram(iop_base, @@ -11862,12 +11600,9 @@ DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec) } #ifdef CONFIG_ISA -ASC_INITFUNC( -STATIC ASC_DCNT, +STATIC ASC_DCNT __init AscGetEisaProductID( - PortAddr iop_base -) -) + PortAddr iop_base) { PortAddr eisa_iop; ushort product_id_high, product_id_low; @@ -11881,12 +11616,9 @@ AscGetEisaProductID( return (product_id); } -ASC_INITFUNC( -STATIC PortAddr, +STATIC PortAddr __init AscSearchIOPortAddrEISA( - PortAddr iop_base -) -) + PortAddr iop_base) { ASC_DCNT eisa_product_id; @@ -12080,12 +11812,9 @@ AscResetChipAndScsiBus( return (AscIsChipHalted(iop_base)); } -ASC_INITFUNC( -STATIC ASC_DCNT, +STATIC ASC_DCNT __init AscGetMaxDmaCount( - ushort bus_type -) -) + ushort bus_type) { if (bus_type & ASC_IS_ISA) return (ASC_MAX_ISA_DMA_COUNT); @@ -12095,12 +11824,9 @@ AscGetMaxDmaCount( } #ifdef CONFIG_ISA -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscGetIsaDmaChannel( - PortAddr iop_base -) -) + PortAddr iop_base) { ushort channel; @@ -12112,13 +11838,10 @@ AscGetIsaDmaChannel( return (channel + 4); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscSetIsaDmaChannel( PortAddr iop_base, - ushort dma_channel -) -) + ushort dma_channel) { ushort cfg_lsw; uchar value; @@ -12136,13 +11859,10 @@ AscSetIsaDmaChannel( return (0); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscSetIsaDmaSpeed( PortAddr iop_base, - uchar speed_value -) -) + uchar speed_value) { speed_value &= 0x07; AscSetBank(iop_base, 1); @@ -12151,12 +11871,10 @@ AscSetIsaDmaSpeed( return (AscGetIsaDmaSpeed(iop_base)); } -ASC_INITFUNC( -STATIC uchar, +STATIC uchar __init AscGetIsaDmaSpeed( PortAddr iop_base ) -) { uchar speed_value; @@ -12168,12 +11886,10 @@ AscGetIsaDmaSpeed( } #endif /* CONFIG_ISA */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscReadPCIConfigWord( ASC_DVC_VAR *asc_dvc, ushort pci_config_offset) -) { uchar lsb, msb; @@ -12182,12 +11898,10 @@ AscReadPCIConfigWord( return ((ushort) ((msb << 8) | lsb)); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscInitGetConfig( ASC_DVC_VAR *asc_dvc ) -) { ushort warn_code; PortAddr iop_base; @@ -12267,12 +11981,10 @@ AscInitGetConfig( return(warn_code); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscInitSetConfig( ASC_DVC_VAR *asc_dvc ) -) { ushort warn_code = 0; @@ -12288,12 +12000,10 @@ AscInitSetConfig( return (warn_code); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscInitFromAscDvcVar( ASC_DVC_VAR *asc_dvc ) -) { PortAddr iop_base; ushort cfg_msw; @@ -12301,7 +12011,7 @@ AscInitFromAscDvcVar( ushort pci_device_id; iop_base = asc_dvc->iop_base; - pci_device_id = asc_dvc->cfg->pci_dev->device; + pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device; warn_code = 0; cfg_msw = AscGetChipCfgMsw(iop_base); if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) { @@ -12393,12 +12103,9 @@ AscInitAsc1000Driver( return (warn_code); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscInitAscDvcVar( - ASC_DVC_VAR *asc_dvc -) -) + ASC_DVC_VAR *asc_dvc) { int i; PortAddr iop_base; @@ -12508,12 +12215,8 @@ AscInitAscDvcVar( return (warn_code); } -ASC_INITFUNC( -STATIC ushort, -AscInitFromEEP( - ASC_DVC_VAR *asc_dvc -) -) +STATIC ushort __init +AscInitFromEEP(ASC_DVC_VAR *asc_dvc) { ASCEEP_CONFIG eep_config_buf; ASCEEP_CONFIG *eep_config; @@ -12729,12 +12432,9 @@ AscInitMicroCodeVar( return (warn_code); } -ASC_INITFUNC( -STATIC int, +STATIC int __init AscTestExternalLram( - ASC_DVC_VAR *asc_dvc -) -) + ASC_DVC_VAR *asc_dvc) { PortAddr iop_base; ushort q_addr; @@ -12756,13 +12456,11 @@ AscTestExternalLram( return (sta); } -ASC_INITFUNC( -STATIC int, +STATIC int __init AscWriteEEPCmdReg( PortAddr iop_base, uchar cmd_reg ) -) { uchar read_back; int retry; @@ -12781,13 +12479,11 @@ AscWriteEEPCmdReg( } } -ASC_INITFUNC( -STATIC int, +STATIC int __init AscWriteEEPDataReg( PortAddr iop_base, ushort data_reg ) -) { ushort read_back; int retry; @@ -12806,35 +12502,24 @@ AscWriteEEPDataReg( } } -ASC_INITFUNC( -STATIC void, -AscWaitEEPRead( - void -) -) +STATIC void __init +AscWaitEEPRead(void) { DvcSleepMilliSecond(1); return; } -ASC_INITFUNC( -STATIC void, -AscWaitEEPWrite( - void -) -) +STATIC void __init +AscWaitEEPWrite(void) { DvcSleepMilliSecond(20); return; } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscReadEEPWord( PortAddr iop_base, - uchar addr -) -) + uchar addr) { ushort read_wval; uchar cmd_reg; @@ -12849,14 +12534,11 @@ AscReadEEPWord( return (read_wval); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscWriteEEPWord( PortAddr iop_base, uchar addr, - ushort word_val -) -) + ushort word_val) { ushort read_wval; @@ -12876,13 +12558,10 @@ AscWriteEEPWord( return (read_wval); } -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AscGetEEPConfig( PortAddr iop_base, - ASCEEP_CONFIG * cfg_buf, ushort bus_type -) -) + ASCEEP_CONFIG * cfg_buf, ushort bus_type) { ushort wval; ushort sum; @@ -12928,13 +12607,10 @@ AscGetEEPConfig( return (sum); } -ASC_INITFUNC( -STATIC int, +STATIC int __init AscSetEEPConfigOnce( PortAddr iop_base, - ASCEEP_CONFIG * cfg_buf, ushort bus_type -) -) + ASCEEP_CONFIG * cfg_buf, ushort bus_type) { int n_error; ushort *wbuf; @@ -13026,13 +12702,11 @@ AscSetEEPConfigOnce( return (n_error); } -ASC_INITFUNC( -STATIC int, +STATIC int __init AscSetEEPConfig( PortAddr iop_base, ASCEEP_CONFIG * cfg_buf, ushort bus_type ) -) { int retry; int n_error; @@ -13066,17 +12740,17 @@ AscAsyncFix( { if (!(asc_dvc->init_sdtr & tid_bits)) { - if ((dvc_type == SCSI_TYPE_CDROM) && + if ((dvc_type == TYPE_ROM) && (AscCompareString((uchar *) inq->vendor_id, (uchar *) "HP ", 3) == 0)) { asc_dvc->pci_fix_asyn_xfer_always |= tid_bits; } asc_dvc->pci_fix_asyn_xfer |= tid_bits; - if ((dvc_type == SCSI_TYPE_PROC) || - (dvc_type == SCSI_TYPE_SCANNER) || - (dvc_type == SCSI_TYPE_CDROM) || - (dvc_type == SCSI_TYPE_SASD)) + if ((dvc_type == TYPE_PROCESSOR) || + (dvc_type == TYPE_SCANNER) || + (dvc_type == TYPE_ROM) || + (dvc_type == TYPE_TAPE)) { asc_dvc->pci_fix_asyn_xfer &= ~tid_bits; } @@ -14470,7 +14144,7 @@ STATIC ADV_DCNT _adv_asc38C1600_chksum = * unswapped on big-endian platforms. */ STATIC ADVEEP_3550_CONFIG -Default_3550_EEPROM_Config ASC_INITDATA = { +Default_3550_EEPROM_Config __initdata = { ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ 0x0000, /* cfg_msw */ 0xFFFF, /* disc_enable */ @@ -14508,7 +14182,7 @@ Default_3550_EEPROM_Config ASC_INITDATA = { }; STATIC ADVEEP_3550_CONFIG -ADVEEP_3550_Config_Field_IsChar ASC_INITDATA = { +ADVEEP_3550_Config_Field_IsChar __initdata = { 0, /* cfg_lsw */ 0, /* cfg_msw */ 0, /* -disc_enable */ @@ -14546,7 +14220,7 @@ ADVEEP_3550_Config_Field_IsChar ASC_INITDATA = { }; STATIC ADVEEP_38C0800_CONFIG -Default_38C0800_EEPROM_Config ASC_INITDATA = { +Default_38C0800_EEPROM_Config __initdata = { ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ 0x0000, /* 01 cfg_msw */ 0xFFFF, /* 02 disc_enable */ @@ -14611,7 +14285,7 @@ Default_38C0800_EEPROM_Config ASC_INITDATA = { }; STATIC ADVEEP_38C0800_CONFIG -ADVEEP_38C0800_Config_Field_IsChar ASC_INITDATA = { +ADVEEP_38C0800_Config_Field_IsChar __initdata = { 0, /* 00 cfg_lsw */ 0, /* 01 cfg_msw */ 0, /* 02 disc_enable */ @@ -14676,7 +14350,7 @@ ADVEEP_38C0800_Config_Field_IsChar ASC_INITDATA = { }; STATIC ADVEEP_38C1600_CONFIG -Default_38C1600_EEPROM_Config ASC_INITDATA = { +Default_38C1600_EEPROM_Config __initdata = { ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ 0x0000, /* 01 cfg_msw */ 0xFFFF, /* 02 disc_enable */ @@ -14741,7 +14415,7 @@ Default_38C1600_EEPROM_Config ASC_INITDATA = { }; STATIC ADVEEP_38C1600_CONFIG -ADVEEP_38C1600_Config_Field_IsChar ASC_INITDATA = { +ADVEEP_38C1600_Config_Field_IsChar __initdata = { 0, /* 00 cfg_lsw */ 0, /* 01 cfg_msw */ 0, /* 02 disc_enable */ @@ -14813,10 +14487,8 @@ ADVEEP_38C1600_Config_Field_IsChar ASC_INITDATA = { * For a non-fatal error return a warning code. If there are no warnings * then 0 is returned. */ -ASC_INITFUNC( -STATIC int, +STATIC int __init AdvInitGetConfig(ADV_DVC_VAR *asc_dvc) -) { ushort warn_code; AdvPortAddr iop_base; @@ -16800,10 +16472,8 @@ AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc) * * Note: Chip is stopped on entry. */ -ASC_INITFUNC( -STATIC int, +STATIC int __init AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) -) { AdvPortAddr iop_base; ushort warn_code; @@ -16974,10 +16644,8 @@ AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) * * Note: Chip is stopped on entry. */ -ASC_INITFUNC( -STATIC int, +STATIC int __init AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) -) { AdvPortAddr iop_base; ushort warn_code; @@ -17209,10 +16877,8 @@ AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) * * Note: Chip is stopped on entry. */ -ASC_INITFUNC( -STATIC int, +STATIC int __init AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) -) { AdvPortAddr iop_base; ushort warn_code; @@ -17477,10 +17143,8 @@ AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) * * Return a checksum based on the EEPROM configuration read. */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) -) { ushort wval, chksum; ushort *wbuf; @@ -17525,11 +17189,9 @@ AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) * * Return a checksum based on the EEPROM configuration read. */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) -) { ushort wval, chksum; ushort *wbuf; @@ -17574,11 +17236,9 @@ AdvGet38C0800EEPConfig(AdvPortAddr iop_base, * * Return a checksum based on the EEPROM configuration read. */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) -) { ushort wval, chksum; ushort *wbuf; @@ -17621,10 +17281,8 @@ AdvGet38C1600EEPConfig(AdvPortAddr iop_base, /* * Read the EEPROM from specified location */ -ASC_INITFUNC( -STATIC ushort, +STATIC ushort __init AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) -) { AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_READ | eep_word_addr); @@ -17635,10 +17293,8 @@ AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) /* * Wait for EEPROM command to complete */ -ASC_INITFUNC( -STATIC void, +STATIC void __init AdvWaitEEPCmd(AdvPortAddr iop_base) -) { int eep_delay_ms; @@ -18290,7 +17946,7 @@ AdvISR(ADV_DVC_VAR *asc_dvc) * the device, otherwise may erroneously set *_able bits. */ if (scsiq->done_status == QD_NO_ERROR && - scsiq->cdb[0] == SCSICMD_Inquiry && + scsiq->cdb[0] == INQUIRY && scsiq->target_lun == 0 && (scsiq->cdb[1] & ADV_INQ_RTN_VPD_AND_CMDDT) == ADV_INQ_RTN_STD_INQUIRY_DATA) diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 6e9d28f8f..66e3ffec9 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -257,7 +257,7 @@ #include #include "scsi.h" -#include "hosts.h" +#include #include "aha152x.h" @@ -577,11 +577,11 @@ struct aha152x_scdata { #define MSGO(i) (HOSTDATA(shpnt)->msgo[i]) #define MSGO_I (HOSTDATA(shpnt)->msgo_i) #define MSGOLEN (HOSTDATA(shpnt)->msgo_len) -#define ADDMSGO(x) (MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow")) +#define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow")) #define MSGI(i) (HOSTDATA(shpnt)->msgi[i]) #define MSGILEN (HOSTDATA(shpnt)->msgi_len) -#define ADDMSGI(x) (MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow")) +#define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow")) #define DATA_LEN (HOSTDATA(shpnt)->data_len) diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index 055938fa0..e5e86962f 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c @@ -150,7 +150,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "acornscsi.h" #include "msgqueue.h" #include "scsi.h" diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c index 54de7f5eb..cd5a63ca7 100644 --- a/drivers/scsi/arm/arxescsi.c +++ b/drivers/scsi/arm/arxescsi.c @@ -37,7 +37,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "fas216.h" struct arxescsi_info { diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index aa75d5056..6dad72222 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c @@ -17,7 +17,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index 89ffb3112..92bfdd9d8 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c @@ -35,7 +35,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "fas216.h" #include "scsi.h" diff --git a/drivers/scsi/arm/ecoscsi.c b/drivers/scsi/arm/ecoscsi.c index 7f27e5425..57e79614f 100644 --- a/drivers/scsi/arm/ecoscsi.c +++ b/drivers/scsi/arm/ecoscsi.c @@ -33,7 +33,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #define NCR5380_implementation_fields int port, ctrl #define NCR5380_local_declare() struct Scsi_Host *_instance diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index de4819fe2..530b59c01 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c @@ -41,7 +41,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "fas216.h" #include "scsi.h" diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 2630125ab..f54b47025 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -52,7 +52,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "fas216.h" #include "scsi.h" diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index ccca39b69..ecfee930c 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c @@ -17,7 +17,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #define AUTOSENSE /*#define PSEUDO_DMA*/ diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index e5dd354c4..d53b0c281 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c @@ -26,7 +26,7 @@ #include #include "../scsi.h" -#include "../hosts.h" +#include #include "fas216.h" #include "scsi.h" diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 3363c718b..a6588b0f8 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -424,16 +424,15 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev, int w_flag = 0x10 << drive_dn; int u_speed = 0; int sitre; - u16 reg4042, reg44, reg48, reg4a, reg54; - u8 reg55; + u16 reg4042, reg4a; + u8 reg48, reg54, reg55; pci_read_config_word(dev, maslave, ®4042); DPRINTK("reg4042 = 0x%04x\n", reg4042); sitre = (reg4042 & 0x4000) ? 1 : 0; - pci_read_config_word(dev, 0x44, ®44); - pci_read_config_word(dev, 0x48, ®48); + pci_read_config_byte(dev, 0x48, ®48); pci_read_config_word(dev, 0x4a, ®4a); - pci_read_config_word(dev, 0x54, ®54); + pci_read_config_byte(dev, 0x54, ®54); pci_read_config_byte(dev, 0x55, ®55); switch(speed) { @@ -450,23 +449,19 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev, } if (!(reg48 & u_flag)) - pci_write_config_word(dev, 0x48, reg48|u_flag); + pci_write_config_byte(dev, 0x48, reg48 | u_flag); if (speed == XFER_UDMA_5) { pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); } else { pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); } - if (!(reg4a & u_speed)) { - pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); - pci_write_config_word(dev, 0x4a, reg4a|u_speed); - } + if ((reg4a & a_speed) != u_speed) + pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed); if (speed > XFER_UDMA_2) { - if (!(reg54 & v_flag)) { - pci_write_config_word(dev, 0x54, reg54|v_flag); - } - } else { - pci_write_config_word(dev, 0x54, reg54 & ~v_flag); - } + if (!(reg54 & v_flag)) + pci_write_config_byte(dev, 0x54, reg54 | v_flag); + } else + pci_write_config_byte(dev, 0x54, reg54 & ~v_flag); } /* move to PCI layer, integrate w/ MSI stuff */ diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 508d84f6e..113838b44 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -154,7 +154,7 @@ static void print_opcode(int opcode) { } #endif -void print_command (unsigned char *command) { +void __scsi_print_command (unsigned char *command) { int i,s; print_opcode(command[0]); for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) @@ -173,7 +173,7 @@ void print_command (unsigned char *command) { * (e.g. "0x2" for Check Condition). **/ void -print_status(unsigned char scsi_status) { +scsi_print_status(unsigned char scsi_status) { #if (CONSTANTS & CONST_STATUS) const char * ccp; @@ -1014,12 +1014,12 @@ print_sense_internal(const char *devclass, #endif } -void print_sense(const char *devclass, struct scsi_cmnd *cmd) +void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) { print_sense_internal(devclass, cmd->sense_buffer, cmd->request); } -void print_req_sense(const char *devclass, struct scsi_request *sreq) +void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) { print_sense_internal(devclass, sreq->sr_sense_buffer, sreq->sr_request); } @@ -1051,7 +1051,7 @@ static const char *extended_msgs[] = { #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *)) #endif /* (CONSTANTS & CONST_MSG) */ -int print_msg (const unsigned char *msg) { +int scsi_print_msg (const unsigned char *msg) { int len = 0, i; if (msg[0] == EXTENDED_MESSAGE) { len = 3 + msg[1]; @@ -1124,13 +1124,13 @@ int print_msg (const unsigned char *msg) { return len; } -void print_Scsi_Cmnd(struct scsi_cmnd *cmd) { +void scsi_print_command(struct scsi_cmnd *cmd) { printk("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); printk(" command = "); - print_command(cmd->cmnd); + __scsi_print_command(cmd->cmnd); } #if (CONSTANTS & CONST_HOST) @@ -1139,7 +1139,7 @@ static const char * hostbyte_table[]={ "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY", NULL}; -void print_hostbyte(int scsiresult) +void scsi_print_hostbyte(int scsiresult) { static int maxcode=0; int i; @@ -1155,7 +1155,7 @@ void print_hostbyte(int scsiresult) printk("(%s) ",hostbyte_table[host_byte(scsiresult)]); } #else -void print_hostbyte(int scsiresult) +void scsi_print_hostbyte(int scsiresult) { printk("Hostbyte=0x%02x ",host_byte(scsiresult)); } #endif @@ -1170,7 +1170,7 @@ static const char * driversuggest_table[]={"SUGGEST_OK", unknown,unknown,unknown, "SUGGEST_SENSE",NULL}; -void print_driverbyte(int scsiresult) +void scsi_print_driverbyte(int scsiresult) { static int driver_max=0,suggest_max=0; int i,dr=driver_byte(scsiresult)&DRIVER_MASK, su=(driver_byte(scsiresult)&SUGGEST_MASK)>>4; @@ -1187,7 +1187,7 @@ void print_driverbyte(int scsiresult) suIMQ->QEntry[CI].type & 0x1FF) == 0x104 ) { TachFCHDR_GCMND* fchs; +#error This is too much stack ULONG ulFibreFrame[2048/4]; // max DWORDS in incoming FC Frame USHORT SFQpi = (USHORT)(fcChip->IMQ->QEntry[CI].word[0] & 0x0fffL); @@ -718,6 +719,7 @@ int CpqTsProcessIMQEntry(void *host) ULONG x_ID; ULONG ulBuff, dwStatus; TachFCHDR_GCMND* fchs; +#error This is too much stack ULONG ulFibreFrame[2048/4]; // max number of DWORDS in incoming Fibre Frame UCHAR ucInboundMessageType; // Inbound CM, dword 3 "type" field diff --git a/drivers/scsi/dc390.h b/drivers/scsi/dc390.h index 76fd8b12a..eeaf46a69 100644 --- a/drivers/scsi/dc390.h +++ b/drivers/scsi/dc390.h @@ -14,12 +14,9 @@ #define DC390_H #include -#ifndef KERNEL_VERSION -# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif #define DC390_BANNER "Tekram DC390/AM53C974" -#define DC390_VERSION "2.1b 2004-04-13" +#define DC390_VERSION "2.1d 2004-05-27" /* We don't have eh_abort_handler, eh_device_reset_handler, * eh_bus_reset_handler, eh_host_reset_handler yet! @@ -32,14 +29,4 @@ # define NEW_EH use_new_eh_code: 1, # define USE_NEW_EH #endif - -static int DC390_detect(Scsi_Host_Template *psht); -static int DC390_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)); -static int DC390_abort(Scsi_Cmnd *cmd); -static int DC390_reset(Scsi_Cmnd *cmd); -static int DC390_bios_param(struct scsi_device *sdev, struct block_device *dev, - sector_t capacity, int geom[]); - -static int DC390_release(struct Scsi_Host *); - #endif /* DC390_H */ diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 5139b0631..7229b2d10 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -68,8 +68,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver"); #include #include /* for virt_to_bus, etc. */ -#include "scsi.h" +#include +#include +#include #include +#include #include "dpt/dptsig.h" #include "dpti.h" @@ -86,9 +89,9 @@ static dpt_sig_S DPTI_sig = { #elif defined(__ia64__) PROC_INTEL, PROC_IA64, #elif defined(__sparc__) - PROC_ULTRASPARC, + PROC_ULTRASPARC, PROC_ULTRASPARC, #elif defined(__alpha__) - PROC_ALPHA , + PROC_ALPHA, PROC_ALPHA, #else (-1),(-1), #endif @@ -173,7 +176,7 @@ static struct pci_device_id dptids[] = { }; MODULE_DEVICE_TABLE(pci,dptids); -static int adpt_detect(Scsi_Host_Template* sht) +static int adpt_detect(struct scsi_host_template* sht) { struct pci_dev *pDev = NULL; adpt_hba* pHba; @@ -362,7 +365,7 @@ static void adpt_inquiry(adpt_hba* pHba) } -static int adpt_slave_configure(Scsi_Device * device) +static int adpt_slave_configure(struct scsi_device * device) { struct Scsi_Host *host = device->host; adpt_hba* pHba; @@ -378,7 +381,7 @@ static int adpt_slave_configure(Scsi_Device * device) return 0; } -static int adpt_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) +static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) { adpt_hba* pHba = NULL; struct adpt_device* pDev = NULL; /* dpt per device information */ @@ -643,7 +646,7 @@ stop_output: *=========================================================================== */ -static int adpt_abort(Scsi_Cmnd * cmd) +static int adpt_abort(struct scsi_cmnd * cmd) { adpt_hba* pHba = NULL; /* host bus adapter structure */ struct adpt_device* dptdevice; /* dpt per device information */ @@ -683,7 +686,7 @@ static int adpt_abort(Scsi_Cmnd * cmd) // This is the same for BLK and SCSI devices // NOTE this is wrong in the i2o.h definitions // This is not currently supported by our adapter but we issue it anyway -static int adpt_device_reset(Scsi_Cmnd* cmd) +static int adpt_device_reset(struct scsi_cmnd* cmd) { adpt_hba* pHba; u32 msg[4]; @@ -723,7 +726,7 @@ static int adpt_device_reset(Scsi_Cmnd* cmd) #define I2O_HBA_BUS_RESET 0x87 // This version of bus reset is called by the eh_error handler -static int adpt_bus_reset(Scsi_Cmnd* cmd) +static int adpt_bus_reset(struct scsi_cmnd* cmd) { adpt_hba* pHba; u32 msg[4]; @@ -745,7 +748,7 @@ static int adpt_bus_reset(Scsi_Cmnd* cmd) } // This version of reset is called by the eh_error_handler -static int adpt_reset(Scsi_Cmnd* cmd) +static int adpt_reset(struct scsi_cmnd* cmd) { adpt_hba* pHba; int rcode; @@ -860,7 +863,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p) #endif -static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev) +static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) { adpt_hba* pHba = NULL; @@ -1997,7 +2000,7 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs) { - Scsi_Cmnd* cmd; + struct scsi_cmnd* cmd; adpt_hba* pHba = dev_id; u32 m; ulong reply; @@ -2059,14 +2062,14 @@ static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs) status = I2O_POST_WAIT_OK; } if(!(context & 0x40000000)) { - cmd = (Scsi_Cmnd*) readl(reply+12); + cmd = (struct scsi_cmnd*) readl(reply+12); if(cmd != NULL) { printk(KERN_WARNING"%s: Apparent SCSI cmd in Post Wait Context - cmd=%p context=%x\n", pHba->name, cmd, context); } } adpt_i2o_post_wait_complete(context, status); } else { // SCSI message - cmd = (Scsi_Cmnd*) readl(reply+12); + cmd = (struct scsi_cmnd*) readl(reply+12); if(cmd != NULL){ if(cmd->serial_number != 0) { // If not timedout adpt_i2o_to_scsi(reply, cmd); @@ -2083,7 +2086,7 @@ out: if(pHba->host) return IRQ_RETVAL(handled); } -static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* d) +static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* d) { int i; u32 msg[MAX_MESSAGE_SIZE]; @@ -2108,16 +2111,16 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* * cmd->cmnd[0] is an unsigned char */ switch(cmd->sc_data_direction){ - case SCSI_DATA_READ: + case DMA_FROM_DEVICE: scsidir =0x40000000; // DATA IN (iop<--dev) break; - case SCSI_DATA_WRITE: + case DMA_TO_DEVICE: direction=0x04000000; // SGL OUT scsidir =0x80000000; // DATA OUT (iop-->dev) break; - case SCSI_DATA_NONE: + case DMA_NONE: break; - case SCSI_DATA_UNKNOWN: + case DMA_BIDIRECTIONAL: scsidir =0x40000000; // DATA IN (iop<--dev) // Assume In - and continue; break; @@ -2156,7 +2159,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* if(cmd->use_sg) { struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer; int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg, - scsi_to_pci_dma_dir(cmd->sc_data_direction)); + cmd->sc_data_direction); len = 0; @@ -2184,7 +2187,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* *mptr++ = pci_map_single(pHba->pDev, cmd->request_buffer, cmd->request_bufflen, - scsi_to_pci_dma_dir(cmd->sc_data_direction)); + cmd->sc_data_direction); } } @@ -2200,7 +2203,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* } -static s32 adpt_scsi_register(adpt_hba* pHba,Scsi_Host_Template * sht) +static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht) { struct Scsi_Host *host = NULL; @@ -2231,7 +2234,7 @@ static s32 adpt_scsi_register(adpt_hba* pHba,Scsi_Host_Template * sht) } -static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd) +static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd) { adpt_hba* pHba; u32 hba_status; @@ -2533,8 +2536,8 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) static void adpt_fail_posted_scbs(adpt_hba* pHba) { - Scsi_Cmnd* cmd = NULL; - Scsi_Device* d = NULL; + struct scsi_cmnd* cmd = NULL; + struct scsi_device* d = NULL; shost_for_each_device(d, pHba->host) { unsigned long flags; @@ -3358,7 +3361,7 @@ static static void adpt_delay(int millisec) #endif -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .name = "dpt_i2o", .proc_name = "dpt_i2o", .proc_info = adpt_proc_info, diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index 7f3c028a9..c43673bbe 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h @@ -37,19 +37,19 @@ * SCSI interface function Prototypes */ -static int adpt_detect(Scsi_Host_Template * sht); -static int adpt_queue(Scsi_Cmnd * cmd, void (*cmdcomplete) (Scsi_Cmnd *)); -static int adpt_abort(Scsi_Cmnd * cmd); -static int adpt_reset(Scsi_Cmnd* cmd); +static int adpt_detect(struct scsi_host_template * sht); +static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); +static int adpt_abort(struct scsi_cmnd * cmd); +static int adpt_reset(struct scsi_cmnd* cmd); static int adpt_release(struct Scsi_Host *host); -static int adpt_slave_configure(Scsi_Device *); +static int adpt_slave_configure(struct scsi_device *); static const char *adpt_info(struct Scsi_Host *pSHost); static int adpt_bios_param(struct scsi_device * sdev, struct block_device *dev, sector_t, int geom[]); -static int adpt_bus_reset(Scsi_Cmnd* cmd); -static int adpt_device_reset(Scsi_Cmnd* cmd); +static int adpt_bus_reset(struct scsi_cmnd* cmd); +static int adpt_device_reset(struct scsi_cmnd* cmd); /* @@ -198,7 +198,7 @@ struct adpt_device { u8 state; u16 tid; struct i2o_device* pI2o_dev; - Scsi_Device *pScsi_dev; + struct scsi_device *pScsi_dev; }; struct adpt_channel { @@ -296,9 +296,9 @@ static s32 adpt_i2o_quiesce_hba(adpt_hba* pHba); static s32 adpt_i2o_status_get(adpt_hba* pHba); static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba); static s32 adpt_i2o_hrt_get(adpt_hba* pHba); -static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* dptdevice); -static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd); -static s32 adpt_scsi_register(adpt_hba* pHba,Scsi_Host_Template * sht); +static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice); +static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd); +static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht); static s32 adpt_hba_reset(adpt_hba* pHba); static s32 adpt_i2o_reset_hba(adpt_hba* pHba); static s32 adpt_rescan(adpt_hba* pHba); @@ -308,7 +308,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba); static void adpt_inquiry(adpt_hba* pHba); static void adpt_fail_posted_scbs(adpt_hba* pHba); static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); -static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev) ; +static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ; static int adpt_i2o_online_hba(adpt_hba* pHba); static void adpt_i2o_post_wait_complete(u32, int); static int adpt_i2o_systab_send(adpt_hba* pHba); diff --git a/drivers/scsi/eata_generic.h b/drivers/scsi/eata_generic.h index 8bac58f82..34bce2c9e 100644 --- a/drivers/scsi/eata_generic.h +++ b/drivers/scsi/eata_generic.h @@ -317,7 +317,7 @@ struct eata_ccb { /* Send Command Packet structure */ __u8 rw_latency; __u8 retries; __u8 status; /* status of this queueslot */ - Scsi_Cmnd *cmd; /* address of cmd */ + struct scsi_cmnd *cmd; /* address of cmd */ struct eata_sg_list *sg_list; }; diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index ea79b5604..3c5151c15 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -46,6 +46,7 @@ * last change: 2002/11/02 OS: Linux 2.5.45 * ************************************************************/ +#include #include #include #include @@ -56,15 +57,14 @@ #include #include #include -#include -#include #include #include #include -#include "scsi.h" +#include +#include +#include #include -#include #include "eata_generic.h" #include "eata_pio.h" @@ -91,6 +91,8 @@ static unsigned char reg_IRQL[16]; static unsigned long int_counter; static unsigned long queue_counter; +static struct scsi_host_template driver_template; + /* * eata_proc_info * inout : decides on the direction of the dataflow and the meaning of the @@ -170,15 +172,15 @@ static int eata_pio_release(struct Scsi_Host *sh) if (sh->io_port && sh->n_io_port) release_region(sh->io_port, sh->n_io_port); } - return (TRUE); + return 1; } -static void IncStat(Scsi_Pointer * SCp, uint Increment) +static void IncStat(struct scsi_pointer *SCp, uint Increment) { SCp->ptr += Increment; if ((SCp->this_residual -= Increment) == 0) { if ((--SCp->buffers_residual) == 0) - SCp->Status = FALSE; + SCp->Status = 0; else { SCp->buffer++; SCp->ptr = page_address(SCp->buffer->page) + SCp->buffer->offset; @@ -204,7 +206,7 @@ static irqreturn_t do_eata_pio_int_handler(int irq, void *dev_id, static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) { uint eata_stat = 0xfffff; - Scsi_Cmnd *cmd; + struct scsi_cmnd *cmd; hostdata *hd; struct eata_ccb *cp; uint base; @@ -233,12 +235,12 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) if (stat & HA_SDRQ) { if (cp->DataIn) { z = 256; - odd = FALSE; + odd = 0; while ((cmd->SCp.Status) && ((z > 0) || (odd))) { if (odd) { *(cmd->SCp.ptr) = zwickel >> 8; IncStat(&cmd->SCp, 1); - odd = FALSE; + odd = 0; } x = min_t(unsigned int, z, cmd->SCp.this_residual / 2); insw(base + HA_RDATA, cmd->SCp.ptr, x); @@ -249,7 +251,7 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) *(cmd->SCp.ptr) = zwickel & 0xff; IncStat(&cmd->SCp, 1); z--; - odd = TRUE; + odd = 1; } } while (z > 0) { @@ -258,7 +260,7 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) } } else { /* cp->DataOut */ - odd = FALSE; + odd = 0; z = 256; while ((cmd->SCp.Status) && ((z > 0) || (odd))) { if (odd) { @@ -266,7 +268,7 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) IncStat(&cmd->SCp, 1); outw(zwickel, base + HA_RDATA); z--; - odd = FALSE; + odd = 0; } x = min_t(unsigned int, z, cmd->SCp.this_residual / 2); outsw(base + HA_RDATA, cmd->SCp.ptr, x); @@ -276,13 +278,13 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs) zwickel = *(cmd->SCp.ptr); zwickel &= 0xff; IncStat(&cmd->SCp, 1); - odd = TRUE; + odd = 1; } } while (z > 0 || odd) { outw(zwickel, base + HA_RDATA); z--; - odd = FALSE; + odd = 0; } } } @@ -331,7 +333,7 @@ static inline uint eata_pio_send_command(uint base, unsigned char command) while (inb(base + HA_RSTATUS) & HA_SBUSY) if (--loop == 0) - return (TRUE); + return 1; /* Enable interrupts for HBA. It is not the best way to do it at this * place, but I hope that it doesn't interfere with the IDE driver @@ -340,10 +342,11 @@ static inline uint eata_pio_send_command(uint base, unsigned char command) outb(HA_CTRL_8HEADS, base + HA_CTRLREG); outb(command, base + HA_WCOMMAND); - return (FALSE); + return 0; } -static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) +static int eata_pio_queue(struct scsi_cmnd *cmd, + void (*done)(struct scsi_cmnd *)) { uint x, y; uint base; @@ -383,21 +386,21 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) cmd->scsi_done = (void *) done; - if(cmd->sc_data_direction == SCSI_DATA_WRITE) - cp->DataOut = TRUE; /* Output mode */ + if (cmd->sc_data_direction == DMA_TO_DEVICE) + cp->DataOut = 1; /* Output mode */ else - cp->DataIn = TRUE; /* Input mode */ + cp->DataIn = 0; /* Input mode */ cp->Interpret = (cmd->device->id == hd->hostid); cp->cp_datalen = htonl((unsigned long) cmd->request_bufflen); - cp->Auto_Req_Sen = FALSE; + cp->Auto_Req_Sen = 0; cp->cp_reqDMA = htonl(0); cp->reqlen = 0; cp->cp_id = cmd->device->id; cp->cp_lun = cmd->device->lun; - cp->cp_dispri = FALSE; - cp->cp_identify = TRUE; + cp->cp_dispri = 0; + cp->cp_identify = 1; memcpy(cp->cp_cdb, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); cp->cp_statDMA = htonl(0); @@ -440,7 +443,7 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) return (0); } -static int eata_pio_abort(Scsi_Cmnd * cmd) +static int eata_pio_abort(struct scsi_cmnd *cmd) { uint loop = HZ; @@ -472,11 +475,11 @@ static int eata_pio_abort(Scsi_Cmnd * cmd) panic("eata_pio: abort: invalid slot status\n"); } -static int eata_pio_host_reset(Scsi_Cmnd * cmd) +static int eata_pio_host_reset(struct scsi_cmnd *cmd) { uint x, limit = 0; - unsigned char success = FALSE; - Scsi_Cmnd *sp; + unsigned char success = 0; + struct scsi_cmnd *sp; struct Scsi_Host *host = cmd->device->host; DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason)); @@ -530,7 +533,7 @@ static int eata_pio_host_reset(Scsi_Cmnd * cmd) sp->scsi_done(sp); } - HD(cmd)->state = FALSE; + HD(cmd)->state = 0; if (success) { /* hmmm... */ DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n")); @@ -550,8 +553,8 @@ static char *get_pio_board_data(unsigned long base, uint irq, uint id, unsigned memset(&cp, 0, sizeof(struct eata_ccb)); memset(buff, 0, sizeof(buff)); - cp.DataIn = TRUE; - cp.Interpret = TRUE; /* Interpret command */ + cp.DataIn = 1; + cp.Interpret = 1; /* Interpret command */ cp.cp_datalen = htonl(254); cp.cp_dataDMA = htonl(0); @@ -593,14 +596,14 @@ static int get_pio_conf_PIO(u32 base, struct get_conf *buf) int z; unsigned short *p; - if (check_region(base, 9)) - return (FALSE); + if (!request_region(base, 9, "eata_pio")) + return 0; memset(buf, 0, sizeof(struct get_conf)); while (inb(base + HA_RSTATUS) & HA_SBUSY) if (--loop == 0) - return (FALSE); + goto fail; DBG(DBG_PIO && DBG_PROBE, printk(KERN_DEBUG "Issuing PIO READ CONFIG to HBA at %#x\n", base)); eata_pio_send_command(base, EATA_CMD_PIO_READ_CONFIG); @@ -609,30 +612,40 @@ static int get_pio_conf_PIO(u32 base, struct get_conf *buf) for (p = (unsigned short *) buf; (long) p <= ((long) buf + (sizeof(struct get_conf) / 2)); p++) { while (!(inb(base + HA_RSTATUS) & HA_SDRQ)) if (--loop == 0) - return (FALSE); + goto fail; loop = HZ / 2; *p = inw(base + HA_RDATA); } - if (!(inb(base + HA_RSTATUS) & HA_SERROR)) { /* Error ? */ - if (htonl(EATA_SIGNATURE) == buf->signature) { - DBG(DBG_PIO && DBG_PROBE, printk(KERN_NOTICE "EATA Controller found " "at %#4x EATA Level: %x\n", base, (uint) (buf->version))); - - while (inb(base + HA_RSTATUS) & HA_SDRQ) - inw(base + HA_RDATA); - if (ALLOW_DMA_BOARDS == FALSE) { - for (z = 0; z < MAXISA; z++) - if (base == ISAbases[z]) { - buf->IRQ = ISAirqs[z]; - break; - } + if (inb(base + HA_RSTATUS) & HA_SERROR) { + DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during " + "transfer for HBA at %x\n", base)); + goto fail; + } + + if (htonl(EATA_SIGNATURE) != buf->signature) + goto fail; + + DBG(DBG_PIO && DBG_PROBE, printk(KERN_NOTICE "EATA Controller found " + "at %#4x EATA Level: %x\n", + base, (uint) (buf->version))); + + while (inb(base + HA_RSTATUS) & HA_SDRQ) + inw(base + HA_RDATA); + + if (!ALLOW_DMA_BOARDS) { + for (z = 0; z < MAXISA; z++) + if (base == ISAbases[z]) { + buf->IRQ = ISAirqs[z]; + break; } - return (TRUE); - } - } else { - DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during transfer " "for HBA at %x\n", base)); } - return (FALSE); + + return 1; + + fail: + release_region(base, 9); + return 0; } static void print_pio_config(struct get_conf *gc) @@ -670,7 +683,7 @@ static uint print_selftest(uint base) return (!(inb(base + HA_RSTATUS) & HA_SERROR)); } -static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) +static int register_pio_HBA(long base, struct get_conf *gc) { unsigned long size = 0; char *buff; @@ -681,47 +694,41 @@ static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * DBG(DBG_REGISTER, print_pio_config(gc)); - if (gc->DMA_support == TRUE) { + if (gc->DMA_support) { printk("HBA at %#.4lx supports DMA. Please use EATA-DMA driver.\n", base); - if (ALLOW_DMA_BOARDS == FALSE) - return (FALSE); + if (!ALLOW_DMA_BOARDS) + return 0; } if ((buff = get_pio_board_data((uint) base, gc->IRQ, gc->scsi_id[3], cplen = (htonl(gc->cplen) + 1) / 2, cppadlen = (htons(gc->cppadlen) + 1) / 2)) == NULL) { printk("HBA at %#lx didn't react on INQUIRY. Sorry.\n", (unsigned long) base); - return (FALSE); + return 0; } - if (print_selftest(base) == FALSE && ALLOW_DMA_BOARDS == FALSE) { + if (!print_selftest(base) && !ALLOW_DMA_BOARDS) { printk("HBA at %#lx failed while performing self test & setup.\n", (unsigned long) base); - return (FALSE); + return 0; } - request_region(base, 8, "eata_pio"); - size = sizeof(hostdata) + (sizeof(struct eata_ccb) * ntohs(gc->queuesiz)); - sh = scsi_register(tpnt, size); - if (sh == NULL) { - release_region(base, 8); - return FALSE; - } + sh = scsi_register(&driver_template, size); + if (sh == NULL) + return 0; if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */ if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", sh)) { reg_IRQ[gc->IRQ]++; if (!gc->IRQ_TR) - reg_IRQL[gc->IRQ] = TRUE; /* IRQ is edge triggered */ + reg_IRQL[gc->IRQ] = 1; /* IRQ is edge triggered */ } else { printk("Couldn't allocate IRQ %d, Sorry.\n", gc->IRQ); - release_region(base, 8); - return (FALSE); + return 0; } } else { /* More than one HBA on this IRQ */ - if (reg_IRQL[gc->IRQ] == TRUE) { + if (reg_IRQL[gc->IRQ]) { printk("Can't support more than one HBA on this IRQ,\n" " if the IRQ is edge triggered. Sorry.\n"); - release_region(base, 8); - return (FALSE); + return 0; } else reg_IRQ[gc->IRQ]++; } @@ -757,9 +764,9 @@ static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * } if (ntohl(gc->len) >= 0x22) { - if (gc->is_PCI == TRUE) + if (gc->is_PCI) hd->bustype = IS_PCI; - else if (gc->is_EISA == TRUE) + else if (gc->is_EISA) hd->bustype = IS_EISA; else hd->bustype = IS_ISA; @@ -780,7 +787,7 @@ static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * sh->unique_id = base; sh->base = base; sh->io_port = base; - sh->n_io_port = 8; + sh->n_io_port = 9; sh->irq = gc->IRQ; sh->dma_channel = PIO; sh->this_id = gc->scsi_id[3]; @@ -794,11 +801,11 @@ static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * sh->max_lun = 8; if (gc->SECOND) - hd->primary = FALSE; + hd->primary = 0; else - hd->primary = TRUE; + hd->primary = 1; - sh->unchecked_isa_dma = FALSE; /* We can only do PIO */ + sh->unchecked_isa_dma = 0; /* We can only do PIO */ hd->next = NULL; /* build a linked list of all HBAs */ hd->prev = last_HBA; @@ -811,22 +818,24 @@ static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * return (1); } -static void find_pio_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt) +static void find_pio_ISA(struct get_conf *buf) { int i; for (i = 0; i < MAXISA; i++) { - if (ISAbases[i]) { - if (get_pio_conf_PIO(ISAbases[i], buf) == TRUE) { - register_pio_HBA(ISAbases[i], buf, tpnt); - } + if (!ISAbases[i]) + continue; + if (!get_pio_conf_PIO(ISAbases[i], buf)) + continue; + if (!register_pio_HBA(ISAbases[i], buf)) + release_region(ISAbases[i], 9); + else ISAbases[i] = 0; - } } return; } -static void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) +static void find_pio_EISA(struct get_conf *buf) { u32 base; int i; @@ -836,7 +845,7 @@ static void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) #endif for (i = 0; i < MAXEISA; i++) { - if (EISAbases[i] == TRUE) { /* Still a possibility ? */ + if (EISAbases[i]) { /* Still a possibility ? */ base = 0x1c88 + (i * 0x1000); #if CHECKPAL @@ -847,12 +856,15 @@ static void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) if (((pal1 == 0x12) && (pal2 == 0x14)) || ((pal1 == 0x38) && (pal2 == 0xa3) && (pal3 == 0x82)) || ((pal1 == 0x06) && (pal2 == 0x94) && (pal3 == 0x24))) { DBG(DBG_PROBE, printk(KERN_NOTICE "EISA EATA id tags found: " "%x %x %x \n", (int) pal1, (int) pal2, (int) pal3)); #endif - if (get_pio_conf_PIO(base, buf) == TRUE) { + if (get_pio_conf_PIO(base, buf)) { DBG(DBG_PROBE && DBG_EISA, print_pio_config(buf)); if (buf->IRQ) { - register_pio_HBA(base, buf, tpnt); - } else + if (!register_pio_HBA(base, buf)) + release_region(base, 9); + } else { printk(KERN_NOTICE "eata_dma: No valid IRQ. HBA " "removed from list\n"); + release_region(base, 9); + } } /* Nothing found here so we take it from the list */ EISAbases[i] = 0; @@ -864,7 +876,7 @@ static void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) return; } -static void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) +static void find_pio_PCI(struct get_conf *buf) { #ifndef CONFIG_PCI printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n"); @@ -889,16 +901,21 @@ static void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) base += 0x10; /* Now, THIS is the real address */ if (base != 0x1f8) { /* We didn't find it in the primary search */ - if (get_pio_conf_PIO(base, buf) == TRUE) { - if (buf->FORCADR) /* If the address is forced */ + if (get_pio_conf_PIO(base, buf)) { + if (buf->FORCADR) { /* If the address is forced */ + release_region(base, 9); continue; /* we'll find it later */ + } /* OK. We made it till here, so we can go now * and register it. We only have to check and * eventually remove it from the EISA and ISA list */ - register_pio_HBA(base, buf, tpnt); + if (!register_pio_HBA(base, buf)) { + release_region(base, 9); + continue; + } if (base < 0x1000) { for (x = 0; x < MAXISA; ++x) { @@ -913,7 +930,7 @@ static void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) } } #if CHECK_BLINK - else if (check_blink_state(base) == TRUE) { + else if (check_blink_state(base)) { printk("eata_pio: HBA is in BLINK state.\n" "Consult your HBAs manual to correct this.\n"); } #endif @@ -922,20 +939,15 @@ static void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) #endif /* #ifndef CONFIG_PCI */ } - -static int eata_pio_detect(Scsi_Host_Template * tpnt) +static int eata_pio_detect(struct scsi_host_template *tpnt) { struct Scsi_Host *HBA_ptr; struct get_conf gc; int i; - tpnt->proc_name = "eata_pio"; - - find_pio_PCI(&gc, tpnt); - - find_pio_EISA(&gc, tpnt); - - find_pio_ISA(&gc, tpnt); + find_pio_PCI(&gc); + find_pio_EISA(&gc); + find_pio_ISA(&gc); for (i = 0; i <= MAXIRQ; i++) if (reg_IRQ[i]) @@ -955,16 +967,19 @@ static int eata_pio_detect(Scsi_Host_Template * tpnt) HBA_ptr->host_no, SD(HBA_ptr)->name, SD(HBA_ptr)->revision, SD(HBA_ptr)->EATA_revision, (SD(HBA_ptr)->bustype == 'P') ? "PCI " : (SD(HBA_ptr)->bustype == 'E') ? "EISA" : "ISA ", - (uint) HBA_ptr->base, HBA_ptr->irq, SD(HBA_ptr)->channel, HBA_ptr->this_id, (SD(HBA_ptr)->primary == TRUE) ? 'Y' : 'N', HBA_ptr->can_queue, HBA_ptr->sg_tablesize, HBA_ptr->cmd_per_lun); + (uint) HBA_ptr->base, HBA_ptr->irq, SD(HBA_ptr)->channel, HBA_ptr->this_id, + SD(HBA_ptr)->primary ? 'Y' : 'N', HBA_ptr->can_queue, + HBA_ptr->sg_tablesize, HBA_ptr->cmd_per_lun); HBA_ptr = SD(HBA_ptr)->next; } } return (registered_HBAs); } -static Scsi_Host_Template driver_template = { - .proc_info = eata_pio_proc_info, +static struct scsi_host_template driver_template = { + .proc_name = "eata_pio", .name = "EATA (Extended Attachment) PIO driver", + .proc_info = eata_pio_proc_info, .detect = eata_pio_detect, .release = eata_pio_release, .queuecommand = eata_pio_queue, diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index 5237cad18..782c31bec 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "esp.h" @@ -36,13 +37,17 @@ #include #include #include - #ifndef __sparc_v9__ #include #include #endif -#include +#include +#include +#include +#include +#include +#include #define DEBUG_ESP /* #define DEBUG_ESP_HME */ diff --git a/drivers/scsi/esp.h b/drivers/scsi/esp.h index 295739469..85beb4750 100644 --- a/drivers/scsi/esp.h +++ b/drivers/scsi/esp.h @@ -8,22 +8,9 @@ #ifndef _SPARC_ESP_H #define _SPARC_ESP_H -#include - -/* #include "scsi.h" */ -#include -#include -#include -#include -#include -#include -#include - /* For dvma controller register definitions. */ #include -#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir)) - /* The ESP SCSI controllers have their register sets in three * "classes": * @@ -86,6 +73,8 @@ struct esp_device { unsigned disconnect:1; }; +struct scsi_cmnd; + /* We get one of these for each ESP probed. */ struct esp { unsigned long eregs; /* ESP controller registers */ diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c index 9046901d7..763e33b13 100644 --- a/drivers/scsi/fd_mcs.c +++ b/drivers/scsi/fd_mcs.c @@ -87,6 +87,7 @@ #include #include #include +#include #include #include @@ -1337,23 +1338,14 @@ static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) { static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev, sector_t capacity, int *info_array) { - unsigned char buf[512 + sizeof(int) * 2]; + unsigned char *p = scsi_bios_ptable(bdev); int size = capacity; - int *sizes = (int *) buf; - unsigned char *data = (unsigned char *) (sizes + 2); - unsigned char do_read[] = { READ_6, 0, 0, 0, 1, 0 }; - int retcode; /* BIOS >= 3.4 for MCA cards */ /* This algorithm was provided by Future Domain (much thanks!). */ - sizes[0] = 0; /* zero bytes out */ - sizes[1] = 512; /* one sector in */ - memcpy(data, do_read, sizeof(do_read)); - retcode = kernel_scsi_ioctl(disk, SCSI_IOCTL_SEND_COMMAND, (void *) buf); - if (!retcode /* SCSI command ok */ - && data[511] == 0xaa && data[510] == 0x55 /* Partition table valid */ - && data[0x1c2]) { /* Partition type */ + if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */ + && p[4]) { /* Partition type */ /* The partition table layout is as follows: Start: 0x1b3h @@ -1383,8 +1375,8 @@ static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev Future Domain algorithm, but it seemed to be a reasonable thing to do, especially in the Linux and BSD worlds. */ - info_array[0] = data[0x1c3] + 1; /* heads */ - info_array[1] = data[0x1c4] & 0x3f; /* sectors */ + info_array[0] = p[5] + 1; /* heads */ + info_array[1] = p[6] & 0x3f; /* sectors */ } else { /* Note that this new method guarantees that there will always be less than 1024 cylinders on a platter. This is good for drives @@ -1403,6 +1395,7 @@ static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev } /* For both methods, compute the cylinders */ info_array[2] = (unsigned int) size / (info_array[0] * info_array[1]); + kfree(p); return 0; } diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 0fff870e5..9cd9f4c0f 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -279,6 +279,7 @@ #include #include #include +#include #include #include @@ -1564,12 +1565,7 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev, sector_t capacity, int *info_array) { int drive; - unsigned char buf[512 + sizeof (Scsi_Ioctl_Command)]; - Scsi_Ioctl_Command *sic = (Scsi_Ioctl_Command *) buf; int size = capacity; - unsigned char *data = sic->data; - unsigned char do_read[] = { READ_6, 0, 0, 0, 1, 0 }; - int retcode; unsigned long offset; struct drive_info { unsigned short cylinders; @@ -1657,16 +1653,10 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev, info_array[2] = i.cylinders; } else { /* 3.4 BIOS (and up?) */ /* This algorithm was provided by Future Domain (much thanks!). */ + unsigned char *p = scsi_bios_ptable(bdev); - sic->inlen = 0; /* zero bytes out */ - sic->outlen = 512; /* one sector in */ - memcpy( data, do_read, sizeof( do_read ) ); - retcode = kernel_scsi_ioctl( sdev, - SCSI_IOCTL_SEND_COMMAND, - sic ); - if (!retcode /* SCSI command ok */ - && data[511] == 0xaa && data[510] == 0x55 /* Partition table valid */ - && data[0x1c2]) { /* Partition type */ + if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */ + && p[4]) { /* Partition type */ /* The partition table layout is as follows: @@ -1697,8 +1687,8 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev, Future Domain algorithm, but it seemed to be a reasonable thing to do, especially in the Linux and BSD worlds. */ - info_array[0] = data[0x1c3] + 1; /* heads */ - info_array[1] = data[0x1c4] & 0x3f; /* sectors */ + info_array[0] = p[5] + 1; /* heads */ + info_array[1] = p[6] & 0x3f; /* sectors */ } else { /* Note that this new method guarantees that there will always be @@ -1718,6 +1708,7 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev, } /* For both methods, compute the cylinders */ info_array[2] = (unsigned int)size / (info_array[0] * info_array[1] ); + kfree(p); } return 0; diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 5047d985b..6cb8fa2bd 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -410,7 +410,7 @@ #endif #include "scsi.h" -#include "hosts.h" +#include #include "gdth.h" static void gdth_delay(int milliseconds); @@ -3520,7 +3520,7 @@ static void gdth_readapp_event(gdth_ha_str *ha, GDTH_UNLOCK_HA(ha, flags); } -static void gdth_clear_events() +static void gdth_clear_events(void) { TRACE(("gdth_clear_events()")); @@ -5293,13 +5293,13 @@ static int gdth_close(struct inode *inode, struct file *filep) return 0; } -static int ioc_event(unsigned long arg) +static int ioc_event(void __user *arg) { gdth_ioctl_event evt; gdth_ha_str *ha; ulong flags; - if (copy_from_user(&evt, (char *)arg, sizeof(gdth_ioctl_event)) || + if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)) || evt.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[evt.ionode]); @@ -5324,19 +5324,19 @@ static int ioc_event(unsigned long arg) } else { gdth_readapp_event(ha, evt.erase, &evt.event); } - if (copy_to_user((char *)arg, &evt, sizeof(gdth_ioctl_event))) + if (copy_to_user(arg, &evt, sizeof(gdth_ioctl_event))) return -EFAULT; return 0; } -static int ioc_lockdrv(unsigned long arg) +static int ioc_lockdrv(void __user *arg) { gdth_ioctl_lockdrv ldrv; unchar i, j; ulong flags; gdth_ha_str *ha; - if (copy_from_user(&ldrv, (char *)arg, sizeof(gdth_ioctl_lockdrv)) || + if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)) || ldrv.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[ldrv.ionode]); @@ -5362,7 +5362,7 @@ static int ioc_lockdrv(unsigned long arg) return 0; } -static int ioc_resetdrv(unsigned long arg, char *cmnd) +static int ioc_resetdrv(void __user *arg, char *cmnd) { gdth_ioctl_reset res; gdth_cmd_str cmd; @@ -5376,7 +5376,7 @@ static int ioc_resetdrv(unsigned long arg, char *cmnd) Scsi_Cmnd scp; #endif - if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) || + if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES) return -EFAULT; hanum = res.ionode; @@ -5418,12 +5418,12 @@ static int ioc_resetdrv(unsigned long arg, char *cmnd) gdth_do_cmd(&scp, &cmd, cmnd, 30); res.status = (ushort)scp.SCp.Status; #endif - if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset))) + if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; return 0; } -static int ioc_general(unsigned long arg, char *cmnd) +static int ioc_general(void __user *arg, char *cmnd) { gdth_ioctl_general gen; char *buf = NULL; @@ -5438,7 +5438,7 @@ static int ioc_general(unsigned long arg, char *cmnd) Scsi_Cmnd scp; #endif - if (copy_from_user(&gen, (char *)arg, sizeof(gdth_ioctl_general)) || + if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || gen.ionode >= gdth_ctr_count) return -EFAULT; hanum = gen.ionode; @@ -5447,7 +5447,7 @@ static int ioc_general(unsigned long arg, char *cmnd) if (!(buf = gdth_ioctl_alloc(hanum, gen.data_len + gen.sense_len, FALSE, &paddr))) return -EFAULT; - if (copy_from_user(buf, (char *)arg + sizeof(gdth_ioctl_general), + if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), gen.data_len + gen.sense_len)) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; @@ -5559,12 +5559,12 @@ static int ioc_general(unsigned long arg, char *cmnd) gen.info = scp.SCp.Message; #endif - if (copy_to_user((char *)arg + sizeof(gdth_ioctl_general), buf, + if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, gen.data_len + gen.sense_len)) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; } - if (copy_to_user((char *)arg, &gen, + if (copy_to_user(arg, &gen, sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); return -EFAULT; @@ -5573,7 +5573,7 @@ static int ioc_general(unsigned long arg, char *cmnd) return 0; } -static int ioc_hdrlist(unsigned long arg, char *cmnd) +static int ioc_hdrlist(void __user *arg, char *cmnd) { gdth_ioctl_rescan rsc; gdth_cmd_str cmd; @@ -5588,7 +5588,7 @@ static int ioc_hdrlist(unsigned long arg, char *cmnd) Scsi_Cmnd scp; #endif - if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) || + if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || rsc.ionode >= gdth_ctr_count) return -EFAULT; hanum = rsc.ionode; @@ -5652,12 +5652,12 @@ static int ioc_hdrlist(unsigned long arg, char *cmnd) scsi_release_command(scp); #endif - if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan))) + if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) return -EFAULT; return 0; } -static int ioc_rescan(unsigned long arg, char *cmnd) +static int ioc_rescan(void __user *arg, char *cmnd) { gdth_ioctl_rescan rsc; gdth_cmd_str cmd; @@ -5674,7 +5674,7 @@ static int ioc_rescan(unsigned long arg, char *cmnd) Scsi_Cmnd scp; #endif - if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) || + if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || rsc.ionode >= gdth_ctr_count) return -EFAULT; hanum = rsc.ionode; @@ -5852,7 +5852,7 @@ static int ioc_rescan(unsigned long arg, char *cmnd) scsi_release_command(scp); #endif - if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan))) + if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) return -EFAULT; return 0; } @@ -5870,6 +5870,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, #endif ulong flags; char cmnd[MAX_COMMAND_SIZE]; + void __user *argp = (void __user *)arg; memset(cmnd, 0xff, 12); @@ -5879,7 +5880,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, case GDTIOCTL_CTRCNT: { int cnt = gdth_ctr_count; - if (put_user(cnt, (int *)arg)) + if (put_user(cnt, (int __user *)argp)) return -EFAULT; break; } @@ -5887,7 +5888,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, case GDTIOCTL_DRVERS: { int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION; - if (put_user(ver, (int *)arg)) + if (put_user(ver, (int __user *)argp)) return -EFAULT; break; } @@ -5899,7 +5900,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, osv.version = (unchar)(LINUX_VERSION_CODE >> 16); osv.subversion = (unchar)(LINUX_VERSION_CODE >> 8); osv.revision = (ushort)(LINUX_VERSION_CODE & 0xff); - if (copy_to_user((char *)arg, &osv, sizeof(gdth_ioctl_osvers))) + if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers))) return -EFAULT; break; } @@ -5908,7 +5909,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, { gdth_ioctl_ctrtype ctrt; - if (copy_from_user(&ctrt, (char *)arg, sizeof(gdth_ioctl_ctrtype)) || + if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || ctrt.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[ctrt.ionode]); @@ -5930,26 +5931,26 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, } ctrt.info = ha->brd_phys; ctrt.oem_id = ha->oem_id; - if (copy_to_user((char *)arg, &ctrt, sizeof(gdth_ioctl_ctrtype))) + if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype))) return -EFAULT; break; } case GDTIOCTL_GENERAL: - return ioc_general(arg, cmnd); + return ioc_general(argp, cmnd); case GDTIOCTL_EVENT: - return ioc_event(arg); + return ioc_event(argp); case GDTIOCTL_LOCKDRV: - return ioc_lockdrv(arg); + return ioc_lockdrv(argp); case GDTIOCTL_LOCKCHN: { gdth_ioctl_lockchn lchn; unchar i, j; - if (copy_from_user(&lchn, (char *)arg, sizeof(gdth_ioctl_lockchn)) || + if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || lchn.ionode >= gdth_ctr_count) return -EFAULT; ha = HADATA(gdth_ctr_tab[lchn.ionode]); @@ -5978,17 +5979,17 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, } case GDTIOCTL_RESCAN: - return ioc_rescan(arg, cmnd); + return ioc_rescan(argp, cmnd); case GDTIOCTL_HDRLIST: - return ioc_hdrlist(arg, cmnd); + return ioc_hdrlist(argp, cmnd); case GDTIOCTL_RESET_BUS: { gdth_ioctl_reset res; int hanum, rval; - if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) || + if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || res.ionode >= gdth_ctr_count) return -EFAULT; hanum = res.ionode; @@ -6025,13 +6026,13 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, rval = gdth_eh_bus_reset(&scp); res.status = (rval == SUCCESS ? S_OK : S_GENERR); #endif - if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset))) + if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; break; } case GDTIOCTL_RESET_DRV: - return ioc_resetdrv(arg, cmnd); + return ioc_resetdrv(argp, cmnd); default: break; diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index b4683333c..811c66d72 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -318,6 +318,13 @@ ide_startstop_t idescsi_atapi_error (ide_drive_t *drive, const char *msg, byte s if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL) return ide_stopped; + /* retry only "normal" I/O: */ + if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { + rq->errors = 1; + ide_end_drive_cmd(drive, stat, err); + return ide_stopped; + } + if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) /* force an abort */ HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); @@ -334,6 +341,13 @@ ide_startstop_t idescsi_atapi_abort (ide_drive_t *drive, const char *msg) if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL) return ide_stopped; + /* retry only "normal" I/O: */ + if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { + rq->errors = 1; + ide_end_drive_cmd(drive, BUSY_STAT, 0); + return ide_stopped; + } + #if IDESCSI_DEBUG_LOG printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", ((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number); diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index e9c5098ed..2114bbf1e 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2884,6 +2884,7 @@ static int ipr_slave_alloc(struct scsi_device *sdev) (res->cfgte.res_addr.lun == sdev->lun)) { res->sdev = sdev; res->add_to_ml = 0; + res->in_erp = 0; sdev->hostdata = res; res->needs_sync_complete = 1; break; @@ -3435,8 +3436,10 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd) SCSI_SENSE_BUFFERSIZE); } - if (res) + if (res) { res->needs_sync_complete = 1; + res->in_erp = 0; + } ipr_unmap_sglist(ioa_cfg, ipr_cmd); list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q); scsi_cmd->scsi_done(scsi_cmd); @@ -3479,6 +3482,12 @@ static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd) static void ipr_erp_request_sense(struct ipr_cmnd *ipr_cmd) { struct ipr_cmd_pkt *cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt; + u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc); + + if (IPR_IOASC_SENSE_KEY(ioasc) > 0) { + ipr_erp_done(ipr_cmd); + return; + } ipr_reinit_ipr_cmnd_for_erp(ipr_cmd); @@ -3756,6 +3765,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg, ipr_erp_cancel_all(ipr_cmd); return; } + res->needs_sync_complete = 1; break; case IPR_IOASC_NR_INIT_CMD_REQUIRED: break; @@ -4808,6 +4818,7 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd) ipr_cmd->timer.data = (unsigned long) ipr_cmd; ipr_cmd->timer.expires = jiffies + IPR_OPERATIONAL_TIMEOUT; ipr_cmd->timer.function = (void (*)(unsigned long))ipr_timeout; + ipr_cmd->done = ipr_reset_ioa_job; add_timer(&ipr_cmd->timer); list_add_tail(&ipr_cmd->queue, &ioa_cfg->pending_q); diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index 468c80796..eadafebac 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h @@ -36,8 +36,8 @@ /* * Literals */ -#define IPR_DRIVER_VERSION "2.0.7" -#define IPR_DRIVER_DATE "(May 21, 2004)" +#define IPR_DRIVER_VERSION "2.0.9" +#define IPR_DRIVER_DATE "(May 26, 2004)" /* * IPR_DBG_TRACE: Setting this to 1 will turn on some general function tracing diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c index 429c22755..874010865 100644 --- a/drivers/scsi/lasi700.c +++ b/drivers/scsi/lasi700.c @@ -49,7 +49,6 @@ #include #include -#include "scsi.h" #include #include "lasi700.h" @@ -65,7 +64,7 @@ static struct parisc_device_id lasi700_ids[] = { { 0 } }; -static Scsi_Host_Template lasi700_template = { +static struct scsi_host_template lasi700_template = { .name = "LASI SCSI 53c700", .proc_name = "lasi700", .this_id = 7, diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 67e9b683b..c1d4e750e 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -3815,7 +3815,8 @@ mega_n_to_m(void *arg, megacmd_t *mc) umc = MBOX_P(uiocp); - upthru = (mega_passthru *)umc->xferaddr; + if (get_user(upthru, (mega_passthru **)&umc->xferaddr)) + return (-EFAULT); if( put_user(mc->status, (u8 *)&upthru->scsistatus) ) return (-EFAULT); @@ -3831,7 +3832,8 @@ mega_n_to_m(void *arg, megacmd_t *mc) umc = (megacmd_t *)uioc_mimd->mbox; - upthru = (mega_passthru *)umc->xferaddr; + if (get_user(upthru, (mega_passthru **)&umc->xferaddr)) + return (-EFAULT); if( put_user(mc->status, (u8 *)&upthru->scsistatus) ) return (-EFAULT); @@ -4082,12 +4084,9 @@ mega_del_logdrv(adapter_t *adapter, int logdrv) * Wait till all the issued commands are complete and there are no * commands in the pending queue */ - while( atomic_read(&adapter->pend_cmds) > 0 || - !list_empty(&adapter->pending_list) ) { - - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(1*HZ ); /* sleep for 1s */ - } + while (atomic_read(&adapter->pend_cmds) > 0 || + !list_empty(&adapter->pending_list)) + msleep(1000); /* sleep for 1s */ rval = mega_do_del_logdrv(adapter, logdrv); @@ -4610,6 +4609,41 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) pci_bus = pdev->bus->number; pci_dev_func = pdev->devfn; + + if(pdev->vendor == PCI_VENDOR_ID_INTEL) /* The megaraid3 stuff reports the id of the intel + part which is not remotely specific to the megaraid */ + { + u16 magic; + /* Don't fall over the Compaq management cards using the same PCI identifier */ + if(pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ && + pdev->subsystem_device == 0xC000) + return -ENODEV; + /* Now check the magic signature byte */ + pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic); + if(magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE) + return -ENODEV; + /* Ok it is probably a megaraid */ + } + + /* + * The megaraid3 stuff reports the ID of the Intel part which is not + * remotely specific to the megaraid + */ + if (pdev->vendor == PCI_VENDOR_ID_INTEL) { + u16 magic; + /* + * Don't fall over the Compaq management cards using the same + * PCI identifier + */ + if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ && + pdev->subsystem_device == 0xC000) + return -ENODEV; + /* Now check the magic signature byte */ + pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic); + if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE) + return -ENODEV; + /* Ok it is probably a megaraid */ + } /* * For these vendor and device ids, signature offsets are not diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index caa403438..9d0cab9ce 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -154,8 +154,8 @@ static int modes_defined = FALSE; static OSST_buffer *new_tape_buffer(int, int, int); static int enlarge_buffer(OSST_buffer *, int); static void normalize_buffer(OSST_buffer *); -static int append_to_buffer(const char *, OSST_buffer *, int); -static int from_buffer(OSST_buffer *, char *, int); +static int append_to_buffer(const char __user *, OSST_buffer *, int); +static int from_buffer(OSST_buffer *, char __user *, int); static int osst_zero_buffer_tail(OSST_buffer *); static int osst_copy_to_buffer(OSST_buffer *, unsigned char *); static int osst_copy_from_buffer(OSST_buffer *, unsigned char *); @@ -3157,13 +3157,13 @@ static void reset_state(OS_Scsi_Tape *STp) /* Entry points to osst */ /* Write command */ -static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) +static ssize_t osst_write(struct file * filp, const char __user * buf, size_t count, loff_t *ppos) { ssize_t total, retval = 0; ssize_t i, do_count, blks, transfer; int write_threshold; int doing_write = 0; - const char * b_point; + const char __user * b_point; Scsi_Request * SRpnt = NULL; ST_mode * STm; ST_partstat * STps; @@ -3486,7 +3486,7 @@ out: /* Read command */ -static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos) +static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, loff_t *ppos) { ssize_t total, retval = 0; ssize_t i, transfer; @@ -5189,7 +5189,7 @@ static void normalize_buffer(OSST_buffer *STbuffer) /* Move data from the user buffer to the tape buffer. Returns zero (success) or negative error code. */ -static int append_to_buffer(const char *ubp, OSST_buffer *st_bp, int do_count) +static int append_to_buffer(const char __user *ubp, OSST_buffer *st_bp, int do_count) { int i, cnt, res, offset; @@ -5222,7 +5222,7 @@ static int append_to_buffer(const char *ubp, OSST_buffer *st_bp, int do_count) /* Move data from the tape buffer to the user buffer. Returns zero (success) or negative error code. */ -static int from_buffer(OSST_buffer *st_bp, char *ubp, int do_count) +static int from_buffer(OSST_buffer *st_bp, char __user *ubp, int do_count) { int i, cnt, res, offset; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index f38faabf9..363d79399 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -46,7 +46,7 @@ #include #include <../drivers/scsi/scsi.h> -#include <../drivers/scsi/hosts.h> +#include #include #include @@ -1936,10 +1936,10 @@ static void nsp_cs_config(dev_link_t *link) nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host); for (dev = host->host_queue; dev != NULL; dev = dev->next) { - unsigned long arg[2], id; - kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg); - id = (arg[0] & 0x0f) + ((arg[0] >> 4) & 0xf0) + - ((arg[0] >> 8) & 0xf00) + ((arg[0] >> 12) & 0xf000); + unsigned long id; + id = (dev->id & 0x0f) + ((dev->lun & 0x0f) << 4) + + ((dev->channel & 0x0f) << 8) + + ((dev->host->host_no & 0x0f) << 12); node = &info->node[info->ndev]; node->minor = 0; switch (dev->type) { diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index f5a16ab7c..ae98131fa 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -3119,6 +3119,7 @@ qla1280_marker(struct scsi_qla_host *ha, int bus, int id, int lun, u8 type) * Returns: * 0 = success, was able to issue command. */ +#ifdef QLA_64BIT_PTR static int qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) { @@ -3381,9 +3382,8 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) return status; } +#else /* !QLA_64BIT_PTR */ - -#ifndef QLA_64BIT_PTR /* * qla1280_32bit_start_scsi * The start SCSI is responsible for building request packets on diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c index a13200d18..ef1fdfdc3 100644 --- a/drivers/scsi/qlogicfc.c +++ b/drivers/scsi/qlogicfc.c @@ -100,6 +100,7 @@ #define DEFAULT_LOOP_COUNT 1000000000 +#define ISP_TIMEOUT (2*HZ) /* End Configuration section ************************************************ */ #include @@ -1305,7 +1306,7 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *)) cmd->control_flags = cpu_to_le16(CFLAG_READ); if (Cmnd->device->tagged_supported) { - if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * SCSI_TIMEOUT)) { + if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * ISP_TIMEOUT)) { cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG); hostdata->tag_ages[Cmnd->device->id] = jiffies; } else diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 29522c4f5..c49ca7f2f 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -37,7 +38,15 @@ #include #include -#include +#include +#include +#include +#include +#include +#include +#include + + #define MAX_TARGETS 16 #define MAX_LUNS 8 /* 32 for 1.31 F/W */ diff --git a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h index 91dead6ad..a40ff75ca 100644 --- a/drivers/scsi/qlogicpti.h +++ b/drivers/scsi/qlogicpti.h @@ -6,19 +6,6 @@ #ifndef _QLOGICPTI_H #define _QLOGICPTI_H -#include - -/* #include "scsi.h" */ -#include -#include -#include -#include -#include -#include -#include - -#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir)) - /* Qlogic/SBUS controller registers. */ #define SBUS_CFG1 0x006UL #define SBUS_CTRL 0x008UL @@ -343,6 +330,8 @@ struct pti_queue_entry { char __opaque[QUEUE_ENTRY_LEN]; }; +struct scsi_cmnd; + /* Software state for the driver. */ struct qlogicpti { /* These are the hot elements in the cache, so they come first. */ diff --git a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h index fd5c8a381..cb6b5fbb7 100644 --- a/drivers/scsi/scsi.h +++ b/drivers/scsi/scsi.h @@ -11,6 +11,11 @@ * add scatter-gather, multiple outstanding request, and other * enhancements. */ +/* + * NOTE: this file only contains compatibility glue for old drivers. All + * these wrappers will be removed sooner or later. For new code please use + * the interfaces declared in the headers in include/scsi/ + */ #ifndef _SCSI_H #define _SCSI_H @@ -18,6 +23,7 @@ #include /* for CONFIG_SCSI_LOGGING */ #include +#include #include #include #include @@ -34,33 +40,12 @@ #define FALSE 0 #endif -#ifdef DEBUG -#define SCSI_TIMEOUT (5*HZ) -#else -#define SCSI_TIMEOUT (2*HZ) -#endif - struct Scsi_Host; struct scsi_cmnd; struct scsi_device; struct scsi_target; struct scatterlist; -/* - * Prototypes for functions in constants.c - * Some of these used to live in constants.h - */ -extern void print_Scsi_Cmnd(struct scsi_cmnd *); -extern void print_command(unsigned char *); -extern void print_sense(const char *, struct scsi_cmnd *); -extern void print_req_sense(const char *, struct scsi_request *); -extern void print_driverbyte(int scsiresult); -extern void print_hostbyte(int scsiresult); -extern void print_status(unsigned char status); -extern int print_msg(const unsigned char *); -extern const char *scsi_sense_key_string(unsigned char); -extern const char *scsi_extd_sense_format(unsigned char, unsigned char); - /* * Legacy dma direction interfaces. * @@ -76,6 +61,42 @@ extern const char *scsi_extd_sense_format(unsigned char, unsigned char); #define scsi_to_pci_dma_dir(scsi_dir) ((int)(scsi_dir)) #define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir)) +/* + * Old names for debug prettyprinting functions. + */ +static inline void print_Scsi_Cmnd(struct scsi_cmnd *cmd) +{ + return scsi_print_command(cmd); +} +static inline void print_command(unsigned char *cdb) +{ + return __scsi_print_command(cdb); +} +static inline void print_sense(const char *devclass, struct scsi_cmnd *cmd) +{ + return scsi_print_sense(devclass, cmd); +} +static inline void print_req_sense(const char *devclass, struct scsi_request *req) +{ + return scsi_print_req_sense(devclass, req); +} +static inline void print_driverbyte(int scsiresult) +{ + return scsi_print_driverbyte(scsiresult); +} +static inline void print_hostbyte(int scsiresult) +{ + return scsi_print_hostbyte(scsiresult); +} +static inline void print_status(unsigned char status) +{ + return scsi_print_status(status); +} +static inline int print_msg(const unsigned char *msg) +{ + return scsi_print_msg(msg); +} + /* * This is the crap from the old error handling code. We have it in a special * place so that we can more easily delete it later on. diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 3e7e2cb39..d291d68cd 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -1,4 +1,4 @@ -/* +/* * linux/kernel/scsi_debug.c * vvvvvvvvvvvvvvvvvvvvvvv Original vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv * Copyright (C) 1992 Eric Youngdale @@ -7,9 +7,9 @@ * anything out of the ordinary is seen. * ^^^^^^^^^^^^^^^^^^^^^^^ Original ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * - * This version is more generic, simulating a variable number of disk - * (or disk like devices) sharing a common amount of RAM - * + * This version is more generic, simulating a variable number of disk + * (or disk like devices) sharing a common amount of RAM + * * * For documentation see http://www.torque.net/sg/sdebug25.html * @@ -55,7 +55,8 @@ #include "scsi_logging.h" #include "scsi_debug.h" -static const char * scsi_debug_version_str = "Version: 1.71 (20031007)"; +#define SCSI_DEBUG_VERSION "1.73" +static const char * scsi_debug_version_date = "20040518"; /* Additional Sense Code (ASC) used */ #define NO_ADDED_SENSE 0x0 @@ -76,11 +77,13 @@ static const char * scsi_debug_version_str = "Version: 1.71 (20031007)"; /* With these defaults, this driver will make 1 host with 1 target * (id 0) containing 1 logical unit (lun 0). That is 1 device. */ +#define DEF_DELAY 1 #define DEF_DEV_SIZE_MB 8 #define DEF_EVERY_NTH 0 -#define DEF_DELAY 1 -#define DEF_SCSI_LEVEL 3 +#define DEF_NUM_PARTS 0 #define DEF_OPTS 0 +#define DEF_SCSI_LEVEL 3 +#define DEF_PTYPE 0 /* bit mask values for scsi_debug_opts */ #define SCSI_DEBUG_OPT_NOISE 1 @@ -101,19 +104,21 @@ static const char * scsi_debug_version_str = "Version: 1.71 (20031007)"; * or "peripheral device" addressing (value 0) */ #define SAM2_LUN_ADDRESS_METHOD 0 +static int scsi_debug_add_host = DEF_NUM_HOST; +static int scsi_debug_delay = DEF_DELAY; static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB; -static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */ -static int scsi_debug_opts = DEF_OPTS; static int scsi_debug_every_nth = DEF_EVERY_NTH; -static int scsi_debug_cmnd_count = 0; -static int scsi_debug_delay = DEF_DELAY; static int scsi_debug_max_luns = DEF_MAX_LUNS; +static int scsi_debug_num_parts = DEF_NUM_PARTS; +static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */ +static int scsi_debug_opts = DEF_OPTS; static int scsi_debug_scsi_level = DEF_SCSI_LEVEL; -static int scsi_debug_add_host = DEF_NUM_HOST; +static int scsi_debug_ptype = DEF_PTYPE; /* SCSI peripheral type (0==disk) */ + +static int scsi_debug_cmnd_count = 0; #define DEV_READONLY(TGT) (0) #define DEV_REMOVEABLE(TGT) (0) -#define PERIPH_DEVICE_TYPE(TGT) (TYPE_DISK); static unsigned long sdebug_store_size; /* in bytes */ static sector_t sdebug_capacity; /* in sectors */ @@ -129,6 +134,8 @@ static int sdebug_sectors_per; /* sectors per cylinder */ #define SECT_SIZE (1 << POW2_SECT_SIZE) #define SECT_SIZE_PER(TGT) SECT_SIZE +#define SDEBUG_MAX_PARTS 4 + #define SDEBUG_SENSE_LEN 32 struct sdebug_dev_info { @@ -215,7 +222,7 @@ static struct device_driver sdebug_driverfs_driver = { .remove = sdebug_driver_remove, }; -static const int check_condition_result = +static const int check_condition_result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; /* function declarations */ @@ -224,7 +231,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, static int resp_mode_sense(unsigned char * cmd, int target, unsigned char * buff, int bufflen, struct sdebug_dev_info * devip); -static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, +static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, int num, struct sdebug_dev_info * devip); static int resp_write(struct scsi_cmnd * SCpnt, int upper_blk, int block, int num, struct sdebug_dev_info * devip); @@ -232,14 +239,15 @@ static int resp_report_luns(unsigned char * cmd, unsigned char * buff, int bufflen, struct sdebug_dev_info * devip); static void timer_intr_handler(unsigned long); static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev); -static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, +static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, int asc, int asq, int inbandLen); -static int check_reset(struct scsi_cmnd * SCpnt, +static int check_reset(struct scsi_cmnd * SCpnt, struct sdebug_dev_info * devip); -static int schedule_resp(struct scsi_cmnd * cmnd, - struct sdebug_dev_info * devip, +static int schedule_resp(struct scsi_cmnd * cmnd, + struct sdebug_dev_info * devip, done_funct_t done, int scsi_result, int delta_jiff); -static void init_all_queued(void); +static void __init sdebug_build_parts(unsigned char * ramp); +static void __init init_all_queued(void); static void stop_all_queued(void); static int stop_queued_cmnd(struct scsi_cmnd * cmnd); static int inquiry_evpd_83(unsigned char * arr, int dev_id_num, @@ -249,6 +257,8 @@ static void do_remove_driverfs_files(void); static int sdebug_add_adapter(void); static void sdebug_remove_adapter(void); +static void sdebug_max_tgts_luns(void); + static struct device pseudo_primary; static struct bus_type pseudo_lld_bus; @@ -257,7 +267,7 @@ static unsigned char * scatg2virt(const struct scatterlist * sclp) if (NULL == sclp) return NULL; else if (sclp->page) - return (unsigned char *)page_address(sclp->page) + + return (unsigned char *)page_address(sclp->page) + sclp->offset; else return NULL; @@ -288,7 +298,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) bufflen = sgpnt[0].length; /* READ and WRITE process scatterlist themselves */ } - else + else buff = (unsigned char *) SCpnt->request_buffer; if (NULL == buff) { buff = spare_buff; /* assume cmd moves no data */ @@ -304,11 +314,11 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) } if (SCpnt->device->lun >= scsi_debug_max_luns) - return schedule_resp(SCpnt, NULL, done, + return schedule_resp(SCpnt, NULL, done, DID_NO_CONNECT << 16, 0); devip = devInfoReg(SCpnt->device); if (NULL == devip) - return schedule_resp(SCpnt, NULL, done, + return schedule_resp(SCpnt, NULL, done, DID_NO_CONNECT << 16, 0); if ((scsi_debug_every_nth > 0) && @@ -331,7 +341,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) * shouldn't need to call REQUEST_SENSE */ if (devip) { sbuff = devip->sense_buff; - memcpy(buff, sbuff, (bufflen < SDEBUG_SENSE_LEN) ? + memcpy(buff, sbuff, (bufflen < SDEBUG_SENSE_LEN) ? bufflen : SDEBUG_SENSE_LEN); mk_sense_buffer(devip, 0, NO_ADDED_SENSE, 0, 7); } else { @@ -392,29 +402,29 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) break; upper_blk = 0; if ((*cmd) == READ_16) { - upper_blk = cmd[5] + (cmd[4] << 8) + + upper_blk = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); - block = cmd[9] + (cmd[8] << 8) + + block = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); - num = cmd[13] + (cmd[12] << 8) + + num = cmd[13] + (cmd[12] << 8) + (cmd[11] << 16) + (cmd[10] << 24); } else if ((*cmd) == READ_12) { - block = cmd[5] + (cmd[4] << 8) + + block = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); - num = cmd[9] + (cmd[8] << 8) + + num = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); } else if ((*cmd) == READ_10) { - block = cmd[5] + (cmd[4] << 8) + + block = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); num = cmd[8] + (cmd[7] << 8); } else { - block = cmd[3] + (cmd[2] << 8) + + block = cmd[3] + (cmd[2] << 8) + ((cmd[1] & 0x1f) << 16); num = cmd[4]; } errsts = resp_read(SCpnt, upper_blk, block, num, devip); if (inj_recovered && (0 == errsts)) { - mk_sense_buffer(devip, RECOVERED_ERROR, + mk_sense_buffer(devip, RECOVERED_ERROR, THRESHHOLD_EXCEEDED, 0, 18); errsts = check_condition_result; } @@ -430,29 +440,29 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) break; upper_blk = 0; if ((*cmd) == WRITE_16) { - upper_blk = cmd[5] + (cmd[4] << 8) + + upper_blk = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); - block = cmd[9] + (cmd[8] << 8) + + block = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); - num = cmd[13] + (cmd[12] << 8) + + num = cmd[13] + (cmd[12] << 8) + (cmd[11] << 16) + (cmd[10] << 24); } else if ((*cmd) == WRITE_12) { - block = cmd[5] + (cmd[4] << 8) + + block = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); - num = cmd[9] + (cmd[8] << 8) + + num = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); } else if ((*cmd) == WRITE_10) { - block = cmd[5] + (cmd[4] << 8) + + block = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); num = cmd[8] + (cmd[7] << 8); } else { - block = cmd[3] + (cmd[2] << 8) + + block = cmd[3] + (cmd[2] << 8) + ((cmd[1] & 0x1f) << 16); num = cmd[4]; } errsts = resp_write(SCpnt, upper_blk, block, num, devip); if (inj_recovered && (0 == errsts)) { - mk_sense_buffer(devip, RECOVERED_ERROR, + mk_sense_buffer(devip, RECOVERED_ERROR, THRESHHOLD_EXCEEDED, 0, 18); errsts = check_condition_result; } @@ -500,7 +510,7 @@ static const char * vendor_id = "Linux "; static const char * product_id = "scsi_debug "; static const char * product_rev = "0004"; -static int inquiry_evpd_83(unsigned char * arr, int dev_id_num, +static int inquiry_evpd_83(unsigned char * arr, int dev_id_num, const char * dev_id_str, int dev_id_str_len) { int num; @@ -537,7 +547,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, { unsigned char pq_pdt; unsigned char arr[SDEBUG_MAX_INQ_ARR_SZ]; - int min_len = bufflen > SDEBUG_MAX_INQ_ARR_SZ ? + int min_len = bufflen > SDEBUG_MAX_INQ_ARR_SZ ? SDEBUG_MAX_INQ_ARR_SZ : bufflen; if (bufflen < cmd[4]) @@ -545,7 +555,7 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, "< alloc_length=%d\n", bufflen, (int)cmd[4]); memset(buff, 0, bufflen); memset(arr, 0, SDEBUG_MAX_INQ_ARR_SZ); - pq_pdt = PERIPH_DEVICE_TYPE(target); + pq_pdt = (scsi_debug_ptype & 0x1f); arr[0] = pq_pdt; if (0x2 & cmd[1]) { /* CMDDT bit set */ mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, @@ -573,11 +583,11 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, dev_id_str, len); } else { /* Illegal request, invalid field in cdb */ - mk_sense_buffer(devip, ILLEGAL_REQUEST, + mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0, 18); return check_condition_result; } - memcpy(buff, arr, min_len); + memcpy(buff, arr, min_len); return 0; } /* drops through here for a standard inquiry */ @@ -592,11 +602,11 @@ static int resp_inquiry(unsigned char * cmd, int target, unsigned char * buff, return 0; } -/* <> */ +/* <> */ static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target) { /* Read-Write Error Recovery page for mode_sense */ - unsigned char err_recov_pg[] = {0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, + unsigned char err_recov_pg[] = {0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, 5, 0, 0xff, 0xff}; memcpy(p, err_recov_pg, sizeof(err_recov_pg)); @@ -607,7 +617,7 @@ static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target) static int resp_disconnect_pg(unsigned char * p, int pcontrol, int target) { /* Disconnect-Reconnect page for mode_sense */ - unsigned char disconnect_pg[] = {0x2, 0xe, 128, 128, 0, 10, 0, 0, + unsigned char disconnect_pg[] = {0x2, 0xe, 128, 128, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; memcpy(p, disconnect_pg, sizeof(disconnect_pg)); @@ -636,7 +646,7 @@ static int resp_format_pg(unsigned char * p, int pcontrol, int target) static int resp_caching_pg(unsigned char * p, int pcontrol, int target) { /* Caching page for mode_sense */ - unsigned char caching_pg[] = {0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, + unsigned char caching_pg[] = {0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x80, 0x14, 0, 0, 0, 0, 0, 0}; memcpy(p, caching_pg, sizeof(caching_pg)); @@ -678,7 +688,7 @@ static int resp_mode_sense(unsigned char * cmd, int target, int alloc_len, msense_6, offset, len; unsigned char * ap; unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; - int min_len = bufflen > SDEBUG_MAX_MSENSE_SZ ? + int min_len = bufflen > SDEBUG_MAX_MSENSE_SZ ? SDEBUG_MAX_MSENSE_SZ : bufflen; SCSI_LOG_LLQUEUE(3, printk("Mode sense ...(%p %d)\n", buff, bufflen)); @@ -753,14 +763,14 @@ static int resp_mode_sense(unsigned char * cmd, int target, arr[0] = offset - 1; else { offset -= 2; - arr[0] = (offset >> 8) & 0xff; - arr[1] = offset & 0xff; + arr[0] = (offset >> 8) & 0xff; + arr[1] = offset & 0xff; } memcpy(buff, arr, min_len); return 0; } -static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, +static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, int num, struct sdebug_dev_info * devip) { unsigned char *buff = (unsigned char *) SCpnt->request_buffer; @@ -770,14 +780,14 @@ static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, unsigned long iflags; if (upper_blk || (block + num > sdebug_capacity)) { - mk_sense_buffer(devip, ILLEGAL_REQUEST, ADDR_OUT_OF_RANGE, + mk_sense_buffer(devip, ILLEGAL_REQUEST, ADDR_OUT_OF_RANGE, 0, 18); return check_condition_result; } if ((SCSI_DEBUG_OPT_MEDIUM_ERR & scsi_debug_opts) && - (block <= OPT_MEDIUM_ERR_ADDR) && + (block <= OPT_MEDIUM_ERR_ADDR) && ((block + num) > OPT_MEDIUM_ERR_ADDR)) { - mk_sense_buffer(devip, MEDIUM_ERROR, UNRECOVERED_READ_ERR, + mk_sense_buffer(devip, MEDIUM_ERROR, UNRECOVERED_READ_ERR, 0, 18); /* claim unrecoverable read error */ return check_condition_result; @@ -785,7 +795,7 @@ static int resp_read(struct scsi_cmnd * SCpnt, int upper_blk, int block, read_lock_irqsave(&atomic_rw, iflags); sgcount = 0; nbytes = bufflen; - /* printk(KERN_INFO "scsi_debug_read: block=%d, tot_bufflen=%d\n", + /* printk(KERN_INFO "scsi_debug_read: block=%d, tot_bufflen=%d\n", block, bufflen); */ if (SCpnt->use_sg) { sgcount = 0; @@ -857,7 +867,7 @@ static int resp_write(struct scsi_cmnd * SCpnt, int upper_blk, int block, static int resp_report_luns(unsigned char * cmd, unsigned char * buff, int bufflen, struct sdebug_dev_info * devip) { - unsigned int alloc_len; + unsigned int alloc_len; int lun_cnt, i, upper; int select_report = (int)cmd[2]; struct scsi_lun *one_lun; @@ -868,19 +878,19 @@ static int resp_report_luns(unsigned char * cmd, unsigned char * buff, 0, 18); return check_condition_result; } - if (bufflen > 8) { /* can produce response with up to 16k luns + if (bufflen > 8) { /* can produce response with up to 16k luns (lun 0 to lun 16383) */ memset(buff, 0, bufflen); lun_cnt = scsi_debug_max_luns; buff[2] = ((sizeof(struct scsi_lun) * lun_cnt) >> 8) & 0xff; buff[3] = (sizeof(struct scsi_lun) * lun_cnt) & 0xff; - lun_cnt = min((int)((bufflen - 8) / sizeof(struct scsi_lun)), + lun_cnt = min((int)((bufflen - 8) / sizeof(struct scsi_lun)), lun_cnt); one_lun = (struct scsi_lun *) &buff[8]; for (i = 0; i < lun_cnt; i++) { upper = (i >> 8) & 0x3f; if (upper) - one_lun[i].scsi_lun[0] = + one_lun[i].scsi_lun[0] = (upper | (SAM2_LUN_ADDRESS_METHOD << 6)); one_lun[i].scsi_lun[1] = i & 0xff; } @@ -926,7 +936,7 @@ static int scsi_debug_slave_alloc(struct scsi_device * sdp) static int scsi_debug_slave_configure(struct scsi_device * sdp) { - struct sdebug_dev_info * devip; + struct sdebug_dev_info * devip; if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %u>\n", @@ -936,14 +946,14 @@ static int scsi_debug_slave_configure(struct scsi_device * sdp) devip = devInfoReg(sdp); sdp->hostdata = devip; if (sdp->host->cmd_per_lun) - scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING, + scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING, sdp->host->cmd_per_lun); return 0; } static void scsi_debug_slave_destroy(struct scsi_device * sdp) { - struct sdebug_dev_info * devip = + struct sdebug_dev_info * devip = (struct sdebug_dev_info *)sdp->hostdata; if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) @@ -980,6 +990,18 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev) open_devip = devip; } } + if (NULL == open_devip) { /* try and make a new one */ + open_devip = kmalloc(sizeof(*open_devip),GFP_KERNEL); + if (NULL == open_devip) { + printk(KERN_ERR "%s: out of memory at line %d\n", + __FUNCTION__, __LINE__); + return NULL; + } + memset(open_devip, 0, sizeof(*open_devip)); + open_devip->sdbg_host = sdbg_host; + list_add_tail(&open_devip->dev_list, + &sdbg_host->dev_info_list); + } if (open_devip) { open_devip->channel = sdev->channel; open_devip->target = sdev->id; @@ -994,7 +1016,7 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev) return NULL; } -static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, +static void mk_sense_buffer(struct sdebug_dev_info * devip, int key, int asc, int asq, int inbandLen) { unsigned char * sbuff; @@ -1029,7 +1051,7 @@ static int scsi_debug_biosparam(struct scsi_device *sdev, printk(KERN_INFO "scsi_debug: biosparam\n"); buf = scsi_bios_ptable(bdev); if (buf) { - res = scsi_partsize(buf, capacity, + res = scsi_partsize(buf, capacity, &info[2], &info[0], &info[1]); kfree(buf); if (! res) @@ -1138,7 +1160,7 @@ static void stop_all_queued(void) } /* Initializes timers in queued array */ -static void init_all_queued(void) +static void __init init_all_queued(void) { unsigned long iflags; int k; @@ -1154,11 +1176,61 @@ static void init_all_queued(void) spin_unlock_irqrestore(&queued_arr_lock, iflags); } -static int schedule_resp(struct scsi_cmnd * cmnd, +static void __init sdebug_build_parts(unsigned char * ramp) +{ + struct partition * pp; + int starts[SDEBUG_MAX_PARTS + 2]; + int sectors_per_part, num_sectors, k; + int heads_by_sects, start_sec, end_sec; + + /* assume partition table already zeroed */ + if ((scsi_debug_num_parts < 1) || (sdebug_store_size < 1048576)) + return; + if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) { + scsi_debug_num_parts = SDEBUG_MAX_PARTS; + printk(KERN_WARNING "scsi_debug:build_parts: reducing " + "partitions to %d\n", SDEBUG_MAX_PARTS); + } + num_sectors = (int)(sdebug_store_size / SECT_SIZE); + sectors_per_part = (num_sectors - sdebug_sectors_per) + / scsi_debug_num_parts; + heads_by_sects = sdebug_heads * sdebug_sectors_per; + starts[0] = sdebug_sectors_per; + for (k = 1; k < scsi_debug_num_parts; ++k) + starts[k] = ((k * sectors_per_part) / heads_by_sects) + * heads_by_sects; + starts[scsi_debug_num_parts] = num_sectors; + starts[scsi_debug_num_parts + 1] = 0; + + ramp[510] = 0x55; /* magic partition markings */ + ramp[511] = 0xAA; + pp = (struct partition *)(ramp + 0x1be); + for (k = 0; starts[k + 1]; ++k, ++pp) { + start_sec = starts[k]; + end_sec = starts[k + 1] - 1; + pp->boot_ind = 0; + + pp->cyl = start_sec / heads_by_sects; + pp->head = (start_sec - (pp->cyl * heads_by_sects)) + / sdebug_sectors_per; + pp->sector = (start_sec % sdebug_sectors_per) + 1; + + pp->end_cyl = end_sec / heads_by_sects; + pp->end_head = (end_sec - (pp->end_cyl * heads_by_sects)) + / sdebug_sectors_per; + pp->end_sector = (end_sec % sdebug_sectors_per) + 1; + + pp->start_sect = start_sec; + pp->nr_sects = end_sec - start_sec + 1; + pp->sys_ind = 0x83; /* plain Linux partition */ + } +} + +static int schedule_resp(struct scsi_cmnd * cmnd, struct sdebug_dev_info * devip, done_funct_t done, int scsi_result, int delta_jiff) { - int k, num; + int k, num; if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && cmnd) { printk(KERN_INFO "scsi_debug: cmd "); @@ -1176,7 +1248,7 @@ static int schedule_resp(struct scsi_cmnd * cmnd, if (cmnd && devip) { /* simulate autosense by this driver */ if (SAM_STAT_CHECK_CONDITION == (scsi_result & 0xff)) - memcpy(cmnd->sense_buffer, devip->sense_buff, + memcpy(cmnd->sense_buffer, devip->sense_buff, (SCSI_SENSE_BUFFERSIZE > SDEBUG_SENSE_LEN) ? SDEBUG_SENSE_LEN : SCSI_SENSE_BUFFERSIZE); } @@ -1219,38 +1291,43 @@ static int schedule_resp(struct scsi_cmnd * cmnd, /* Set 'perm' (4th argument) to 0 to disable module_param's definition * of sysfs parameters (which module_param doesn't yet support). - * Sysfs parameters defined explicitly below. + * Sysfs parameters defined explicitly below. */ -module_param_named(num_tgts, scsi_debug_num_tgts, int, 0); -module_param_named(max_luns, scsi_debug_max_luns, int, 0); -module_param_named(scsi_level, scsi_debug_scsi_level, int, 0); +module_param_named(add_host, scsi_debug_add_host, int, 0); /* perm=0644 */ +module_param_named(delay, scsi_debug_delay, int, 0); /* perm=0644 */ module_param_named(dev_size_mb, scsi_debug_dev_size_mb, int, 0); -module_param_named(opts, scsi_debug_opts, int, 0); /* perm=0644 */ module_param_named(every_nth, scsi_debug_every_nth, int, 0); -module_param_named(delay, scsi_debug_delay, int, 0); /* perm=0644 */ -module_param_named(add_host, scsi_debug_add_host, int, 0); /* perm=0644 */ +module_param_named(max_luns, scsi_debug_max_luns, int, 0); +module_param_named(num_parts, scsi_debug_num_parts, int, 0); +module_param_named(num_tgts, scsi_debug_num_tgts, int, 0); +module_param_named(opts, scsi_debug_opts, int, 0); /* perm=0644 */ +module_param_named(ptype, scsi_debug_ptype, int, 0); +module_param_named(scsi_level, scsi_debug_scsi_level, int, 0); MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert"); MODULE_DESCRIPTION("SCSI debug adapter driver"); MODULE_LICENSE("GPL"); +MODULE_VERSION(SCSI_DEBUG_VERSION); -MODULE_PARM_DESC(num_tgts, "number of SCSI targets per host to simulate"); -MODULE_PARM_DESC(max_luns, "number of SCSI LUNs per target to simulate"); -MODULE_PARM_DESC(scsi_level, "SCSI level to simulate"); +MODULE_PARM_DESC(add_host, "0..127 hosts allowed(def=1)"); +MODULE_PARM_DESC(delay, "# of jiffies to delay response(def=1)"); MODULE_PARM_DESC(dev_size_mb, "size in MB of ram shared by devs"); -MODULE_PARM_DESC(opts, "1->noise, 2->medium_error, 4->..."); MODULE_PARM_DESC(every_nth, "timeout every nth command(def=100)"); -MODULE_PARM_DESC(delay, "# of jiffies to delay response(def=1)"); -MODULE_PARM_DESC(add_host, "0..127 hosts allowed(def=1)"); +MODULE_PARM_DESC(max_luns, "number of SCSI LUNs per target to simulate"); +MODULE_PARM_DESC(num_parts, "number of partitions(def=0)"); +MODULE_PARM_DESC(num_tgts, "number of SCSI targets per host to simulate"); +MODULE_PARM_DESC(opts, "1->noise, 2->medium_error, 4->..."); +MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])"); +MODULE_PARM_DESC(scsi_level, "SCSI level to simulate"); static char sdebug_info[256]; static const char * scsi_debug_info(struct Scsi_Host * shp) { - sprintf(sdebug_info, "scsi_debug, %s, num_tgts=%d, " - "dev_size_mb=%d, opts=0x%x", scsi_debug_version_str, - scsi_debug_num_tgts, scsi_debug_dev_size_mb, + sprintf(sdebug_info, "scsi_debug, version %s [%s], " + "dev_size_mb=%d, opts=0x%x", SCSI_DEBUG_VERSION, + scsi_debug_version_date, scsi_debug_dev_size_mb, scsi_debug_opts); return sdebug_info; } @@ -1282,14 +1359,15 @@ static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **sta return length; } begin = 0; - pos = len = sprintf(buffer, "scsi_debug adapter driver, %s\n" + pos = len = sprintf(buffer, "scsi_debug adapter driver, version " + "%s [%s]\n" "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " "every_nth=%d(curr:%d)\n" "delay=%d, max_luns=%d, scsi_level=%d\n" "sector_size=%d bytes, cylinders=%d, heads=%d, sectors=%d\n" - "number of aborts=%d, device_reset=%d, bus_resets=%d, " + "number of aborts=%d, device_reset=%d, bus_resets=%d, " "host_resets=%d\n", - scsi_debug_version_str, scsi_debug_num_tgts, + SCSI_DEBUG_VERSION, scsi_debug_version_date, scsi_debug_num_tgts, scsi_debug_dev_size_mb, scsi_debug_opts, scsi_debug_every_nth, scsi_debug_cmnd_count, scsi_debug_delay, scsi_debug_max_luns, scsi_debug_scsi_level, @@ -1306,12 +1384,12 @@ static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **sta return len; } -static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_delay); } -static ssize_t sdebug_delay_store(struct device_driver * ddp, +static ssize_t sdebug_delay_store(struct device_driver * ddp, const char * buf, size_t count) { int delay; @@ -1325,15 +1403,15 @@ static ssize_t sdebug_delay_store(struct device_driver * ddp, } return -EINVAL; } -DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_show, +DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_show, sdebug_delay_store) -static ssize_t sdebug_opts_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_opts_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "0x%x\n", scsi_debug_opts); } -static ssize_t sdebug_opts_store(struct device_driver * ddp, +static ssize_t sdebug_opts_store(struct device_driver * ddp, const char * buf, size_t count) { int opts; @@ -1354,38 +1432,62 @@ opts_done: scsi_debug_cmnd_count = 0; return count; } -DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_show, +DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_show, sdebug_opts_store) -static ssize_t sdebug_num_tgts_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_ptype_show(struct device_driver * ddp, char * buf) +{ + return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_ptype); +} +static ssize_t sdebug_ptype_store(struct device_driver * ddp, + const char * buf, size_t count) +{ + int n; + + if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { + scsi_debug_ptype = n; + return count; + } + return -EINVAL; +} +DRIVER_ATTR(ptype, S_IRUGO | S_IWUSR, sdebug_ptype_show, sdebug_ptype_store) + +static ssize_t sdebug_num_tgts_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_tgts); } -static ssize_t sdebug_num_tgts_store(struct device_driver * ddp, +static ssize_t sdebug_num_tgts_store(struct device_driver * ddp, const char * buf, size_t count) { int n; if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { scsi_debug_num_tgts = n; + sdebug_max_tgts_luns(); return count; } return -EINVAL; } -DRIVER_ATTR(num_tgts, S_IRUGO | S_IWUSR, sdebug_num_tgts_show, - sdebug_num_tgts_store) +DRIVER_ATTR(num_tgts, S_IRUGO | S_IWUSR, sdebug_num_tgts_show, + sdebug_num_tgts_store) -static ssize_t sdebug_dev_size_mb_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_dev_size_mb_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_dev_size_mb); } -DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_show, NULL) +DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_show, NULL) + +static ssize_t sdebug_num_parts_show(struct device_driver * ddp, char * buf) +{ + return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_parts); +} +DRIVER_ATTR(num_parts, S_IRUGO, sdebug_num_parts_show, NULL) -static ssize_t sdebug_every_nth_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_every_nth_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_every_nth); } -static ssize_t sdebug_every_nth_store(struct device_driver * ddp, +static ssize_t sdebug_every_nth_store(struct device_driver * ddp, const char * buf, size_t count) { int nth; @@ -1398,38 +1500,39 @@ static ssize_t sdebug_every_nth_store(struct device_driver * ddp, return -EINVAL; } DRIVER_ATTR(every_nth, S_IRUGO | S_IWUSR, sdebug_every_nth_show, - sdebug_every_nth_store) + sdebug_every_nth_store) -static ssize_t sdebug_max_luns_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_max_luns_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_luns); } -static ssize_t sdebug_max_luns_store(struct device_driver * ddp, +static ssize_t sdebug_max_luns_store(struct device_driver * ddp, const char * buf, size_t count) { int n; if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { scsi_debug_max_luns = n; + sdebug_max_tgts_luns(); return count; } return -EINVAL; } -DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show, - sdebug_max_luns_store) +DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show, + sdebug_max_luns_store) -static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_scsi_level); } -DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_show, NULL) +DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_show, NULL) -static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_add_host_show(struct device_driver * ddp, char * buf) { return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_add_host); } -static ssize_t sdebug_add_host_store(struct device_driver * ddp, +static ssize_t sdebug_add_host_store(struct device_driver * ddp, const char * buf, size_t count) { int delta_hosts; @@ -1461,28 +1564,32 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp, DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, sdebug_add_host_store) -static void do_create_driverfs_files() +static void do_create_driverfs_files(void) { + driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host); driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay); - driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); - driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth); driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns); + driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); + driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts); + driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype); + driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); driver_create_file(&sdebug_driverfs_driver, &driver_attr_scsi_level); - driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host); } -static void do_remove_driverfs_files() +static void do_remove_driverfs_files(void) { - driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_scsi_level); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_opts); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_ptype); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_parts); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); - driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); - driver_remove_file(&sdebug_driverfs_driver, &driver_attr_opts); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_delay); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host); } static int __init scsi_debug_init(void) @@ -1491,23 +1598,25 @@ static int __init scsi_debug_init(void) int host_to_add; int k; + if (scsi_debug_dev_size_mb < 1) + scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */ sdebug_store_size = (unsigned long)scsi_debug_dev_size_mb * 1048576; sdebug_capacity = sdebug_store_size / SECT_SIZE; /* play around with geometry, don't waste too much on track 0 */ sdebug_heads = 8; sdebug_sectors_per = 32; - if (scsi_debug_dev_size_mb >= 16) + if (scsi_debug_dev_size_mb >= 16) sdebug_heads = 32; else if (scsi_debug_dev_size_mb >= 256) sdebug_heads = 64; - sdebug_cylinders_per = (unsigned long)sdebug_capacity / + sdebug_cylinders_per = (unsigned long)sdebug_capacity / (sdebug_sectors_per * sdebug_heads); - if (sdebug_cylinders_per >= 1024) { + if (sdebug_cylinders_per >= 1024) { /* other LLDs do this; implies >= 1GB ram disk ... */ sdebug_heads = 255; sdebug_sectors_per = 63; - sdebug_cylinders_per = (unsigned long)sdebug_capacity / + sdebug_cylinders_per = (unsigned long)sdebug_capacity / (sdebug_sectors_per * sdebug_heads); } @@ -1518,6 +1627,8 @@ static int __init scsi_debug_init(void) return -ENOMEM; } memset(fake_storep, 0, sz); + if (scsi_debug_num_parts > 0) + sdebug_build_parts(fake_storep); init_all_queued(); @@ -1575,7 +1686,7 @@ static struct device pseudo_primary = { .release = pseudo_0_release, }; -static int pseudo_lld_bus_match(struct device *dev, +static int pseudo_lld_bus_match(struct device *dev, struct device_driver *dev_driver) { return 1; @@ -1594,7 +1705,7 @@ static void sdebug_release_adapter(struct device * dev) kfree(sdbg_host); } -static int sdebug_add_adapter() +static int sdebug_add_adapter(void) { int k, devs_per_host; int error = 0; @@ -1657,7 +1768,7 @@ clean: return error; } -static void sdebug_remove_adapter() +static void sdebug_remove_adapter(void) { struct sdebug_host_info * sdbg_host = NULL; @@ -1737,3 +1848,21 @@ static int sdebug_driver_remove(struct device * dev) scsi_host_put(sdbg_host->shost); return 0; } + +static void sdebug_max_tgts_luns(void) +{ + struct sdebug_host_info * sdbg_host; + struct Scsi_Host *hpnt; + + spin_lock(&sdebug_host_list_lock); + list_for_each_entry(sdbg_host, &sdebug_host_list, host_list) { + hpnt = sdbg_host->shost; + if ((hpnt->this_id >= 0) && + (scsi_debug_num_tgts > hpnt->this_id)) + hpnt->max_id = scsi_debug_num_tgts + 1; + else + hpnt->max_id = scsi_debug_num_tgts; + hpnt->max_lun = scsi_debug_max_luns; + } + spin_unlock(&sdebug_host_list_lock); +} diff --git a/drivers/scsi/scsi_debug.h b/drivers/scsi/scsi_debug.h index 58f98af39..a6c6ec912 100644 --- a/drivers/scsi/scsi_debug.h +++ b/drivers/scsi/scsi_debug.h @@ -5,7 +5,7 @@ static int scsi_debug_slave_alloc(struct scsi_device *); static int scsi_debug_slave_configure(struct scsi_device *); static void scsi_debug_slave_destroy(struct scsi_device *); -static int scsi_debug_queuecommand(struct scsi_cmnd *, +static int scsi_debug_queuecommand(struct scsi_cmnd *, void (*done) (struct scsi_cmnd *)); static int scsi_debug_ioctl(struct scsi_device *, int, void *); static int scsi_debug_biosparam(struct scsi_device *, struct block_device *, @@ -17,9 +17,6 @@ static int scsi_debug_host_reset(struct scsi_cmnd *); static int scsi_debug_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); static const char * scsi_debug_info(struct Scsi_Host *); -/* - * This driver is written for the lk 2.5 series - */ #define SCSI_DEBUG_CANQUEUE 255 /* needs to be >= 1 */ #define SCSI_DEBUG_MAX_CMD_LEN 16 diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 0dedc422c..7bcadb63b 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c @@ -27,7 +27,7 @@ struct scsi_dev_info_list { static const char spaces[] = " "; /* 16 of them */ static unsigned scsi_default_dev_flags; static LIST_HEAD(scsi_dev_info_list); -static __init char scsi_dev_flags[256]; +static __initdata char scsi_dev_flags[256]; /* * scsi_static_device_list: deprecated list of devices that require @@ -118,7 +118,7 @@ static struct { {"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN}, {"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN}, {"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN}, - {"BELKIN", "USB 2 HS-CF", "1.95", BLIST_SPARSELUN}, + {"BELKIN", "USB 2 HS-CF", "1.95", BLIST_FORCELUN}, {"CANON", "IPUBJD", NULL, BLIST_SPARSELUN}, {"CBOX3", "USB Storage-SMC", "300A", BLIST_FORCELUN}, {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */ @@ -142,7 +142,6 @@ static struct { {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, {"FSC", "CentricStor", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"Generic", "USB SD Reader", "1.00", BLIST_FORCELUN}, - {"Generic", "USB Storage-SMC", "0090", BLIST_FORCELUN}, {"Generic", "USB Storage-SMC", "0180", BLIST_FORCELUN}, {"Generic", "USB Storage-SMC", "0207", BLIST_FORCELUN}, {"HITACHI", "DF400", "*", BLIST_SPARSELUN}, @@ -155,7 +154,6 @@ static struct { {"HP", "C1557A", NULL, BLIST_FORCELUN}, {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, - {"ICSI", "SD Card", "2.7C", BLIST_FORCELUN}, {"iomega", "jaz 1GB", "J.86", BLIST_NOTQ | BLIST_NOLUN}, {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 05ebb8c86..b0b35affe 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -31,20 +31,15 @@ #include "scsi_priv.h" #include "scsi_logging.h" -#ifdef DEBUG -#define SENSE_TIMEOUT SCSI_TIMEOUT -#else -#define SENSE_TIMEOUT (10*HZ) -#endif - -#define START_UNIT_TIMEOUT (30*HZ) +#define SENSE_TIMEOUT (10*HZ) +#define START_UNIT_TIMEOUT (30*HZ) /* * These should *probably* be handled by the host itself. * Since it is allowed to sleep, it probably should. */ -#define BUS_RESET_SETTLE_TIME 10*HZ -#define HOST_RESET_SETTLE_TIME 10*HZ +#define BUS_RESET_SETTLE_TIME (10*HZ) +#define HOST_RESET_SETTLE_TIME (10*HZ) /* called with shost->host_lock held */ void scsi_eh_wakeup(struct Scsi_Host *shost) @@ -1026,7 +1021,8 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd) spin_unlock_irqrestore(scmd->device->host->host_lock, flags); if (rtn == SUCCESS) { - scsi_sleep(BUS_RESET_SETTLE_TIME); + if (!scmd->device->host->hostt->skip_settle_delay) + scsi_sleep(BUS_RESET_SETTLE_TIME); spin_lock_irqsave(scmd->device->host->host_lock, flags); scsi_report_bus_reset(scmd->device->host, scmd->device->channel); spin_unlock_irqrestore(scmd->device->host->host_lock, flags); @@ -1057,7 +1053,8 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) spin_unlock_irqrestore(scmd->device->host->host_lock, flags); if (rtn == SUCCESS) { - scsi_sleep(HOST_RESET_SETTLE_TIME); + if (!scmd->device->host->hostt->skip_settle_delay) + scsi_sleep(HOST_RESET_SETTLE_TIME); spin_lock_irqsave(scmd->device->host->host_lock, flags); scsi_report_bus_reset(scmd->device->host, scmd->device->channel); spin_unlock_irqrestore(scmd->device->host->host_lock, flags); diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 76f0a64bd..faab1a00a 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -447,19 +447,3 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) } return -EINVAL; } - -/* - * Just like scsi_ioctl, only callable from kernel space with no - * fs segment fiddling. - */ - -int kernel_scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg) -{ - mm_segment_t oldfs; - int tmp; - oldfs = get_fs(); - set_fs(get_ds()); - tmp = scsi_ioctl(sdev, cmd, arg); - set_fs(oldfs); - return tmp; -} diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f77d2e8c7..beb5841d5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -255,7 +255,6 @@ void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer, sreq->sr_request->rq_status = RQ_SCSI_BUSY; scsi_do_req(sreq, cmnd, buffer, bufflen, scsi_wait_done, timeout, retries); - generic_unplug_device(sreq->sr_device->request_queue); wait_for_completion(&wait); sreq->sr_request->waiting = NULL; if (sreq->sr_request->rq_status != RQ_SCSI_DONE) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 699d274b6..1f006bfd2 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -44,6 +44,11 @@ #define ALLOC_FAILURE_MSG KERN_ERR "%s: Allocation failure during" \ " SCSI scanning, some SCSI devices might not be configured\n" +/* + * Default timeout + */ +#define SCSI_TIMEOUT (2*HZ) + /* * Prefix values for the SCSI id's (stored in driverfs name field) */ diff --git a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c index 48126e176..417790d7b 100644 --- a/drivers/scsi/scsi_syms.c +++ b/drivers/scsi/scsi_syms.c @@ -46,15 +46,14 @@ EXPORT_SYMBOL(scsicam_bios_param); EXPORT_SYMBOL(scsi_partsize); EXPORT_SYMBOL(scsi_bios_ptable); EXPORT_SYMBOL(scsi_ioctl); -EXPORT_SYMBOL(print_command); -EXPORT_SYMBOL(print_sense); -EXPORT_SYMBOL(print_req_sense); -EXPORT_SYMBOL(print_msg); -EXPORT_SYMBOL(print_status); +EXPORT_SYMBOL(scsi_print_command); +EXPORT_SYMBOL(__scsi_print_command); +EXPORT_SYMBOL(scsi_print_sense); +EXPORT_SYMBOL(scsi_print_req_sense); +EXPORT_SYMBOL(scsi_print_msg); +EXPORT_SYMBOL(scsi_print_status); EXPORT_SYMBOL(scsi_sense_key_string); EXPORT_SYMBOL(scsi_extd_sense_format); -EXPORT_SYMBOL(kernel_scsi_ioctl); -EXPORT_SYMBOL(print_Scsi_Cmnd); EXPORT_SYMBOL(scsi_block_when_processing_errors); EXPORT_SYMBOL(scsi_ioctl_send_command); EXPORT_SYMBOL(scsi_set_medium_removal); diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f2cd32a14..3b30baff2 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -173,7 +173,7 @@ store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) spi_dv_device(sdev); return count; } -static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate) +static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); /* Translate the period into ns according to the current spec * for SDTR/PPR messages */ @@ -390,10 +390,11 @@ spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, { struct spi_internal *i = to_spi_internal(sreq->sr_host->transportt); struct scsi_device *sdev = sreq->sr_device; - int period, prevperiod = 0; + int period = 0, prevperiod = 0; for (;;) { + int newperiod; if (compare_fn(sreq, buffer, ptr, DV_LOOPS)) /* Successful DV */ break; @@ -401,7 +402,8 @@ spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, /* OK, retrain, fallback */ if (i->f->get_period) i->f->get_period(sdev); - period = spi_period(sdev); + newperiod = spi_period(sdev); + period = newperiod > period ? newperiod : period; if (period < 0x0d) period++; else diff --git a/drivers/scsi/scsiiom.c b/drivers/scsi/scsiiom.c index b9285e51a..181cd48b3 100644 --- a/drivers/scsi/scsiiom.c +++ b/drivers/scsi/scsiiom.c @@ -12,7 +12,7 @@ dc390_freetag (PDCB pDCB, PSRB pSRB) pDCB->TagMask &= ~(1 << pSRB->TagNumber); /* free tag mask */ pSRB->TagNumber = 255; } -}; +} static UCHAR @@ -75,7 +75,7 @@ dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) printk (KERN_WARNING "DC390: Out of tags for Dev. %02x %02x\n", pDCB->TargetID, pDCB->TargetLUN); return 1; //goto no_tag; - }; + } DC390_write8 (ScsiFifo, SIMPLE_QUEUE_TAG); pDCB->TagMask |= (1 << tag_no); pSRB->TagNumber = tag_no; DC390_write8 (ScsiFifo, tag_no); @@ -86,7 +86,7 @@ dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) { // no_tag: DEBUG1(printk (KERN_DEBUG "DC390: Select w%s/DisCn for Cmd %li (SRB %p), No TagQ\n", (disc_allowed?"":"o"), pSRB->pcmd->pid, pSRB)); - }; + } pSRB->SRBState = SRB_START_; @@ -104,7 +104,7 @@ dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) //pSRB->SRBState = SRB_MSGOUT_; pSRB->SRBState |= DO_SYNC_NEGO; cmd = SEL_W_ATN_STOP; - }; + } /* Command is written in CommandPhase, if SEL_W_ATN_STOP ... */ if (cmd != SEL_W_ATN_STOP) @@ -125,7 +125,7 @@ dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) ptr = (PUCHAR) pSRB->pcmd->cmnd; for (i=0; ipcmd->cmd_len; i++) DC390_write8 (ScsiFifo, *(ptr++)); - }; + } } DEBUG0(if (pACB->pActiveDCB) \ printk (KERN_WARNING "DC390: ActiveDCB != 0\n")); @@ -141,7 +141,7 @@ dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB ) //DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); pACB->SelLost++; return 1; - }; + } DC390_write8 (ScsiCmd, cmd); pACB->pActiveDCB = pDCB; pDCB->pActiveSRB = pSRB; pACB->Connected = 1; @@ -176,7 +176,7 @@ dc390_dma_intr (PACB pACB) { printk (KERN_ERR "DC390: DMA error (%02x)!\n", dstate); return dstate; - }; + } if (dstate & DMA_XFER_DONE) { UINT residual, xferCnt; int ctr = 6000000; @@ -253,7 +253,7 @@ DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs) { DEBUG0(printk (KERN_WARNING "DC390 Int w/o SCSI actions (only DMA?)\n")); return IRQ_NONE; - }; + } #else //DC390_write32 (DMA_ScsiBusCtrl, WRT_ERASE_DMA_STAT | EN_INT_ON_PCI_ABORT); //dstatus = DC390_read8 (DMA_Status); @@ -313,7 +313,7 @@ DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs) { printk (KERN_ERR "DC390: Suc. op/ Serv. req: pActiveDCB = 0!\n"); goto unlock; - }; + } pSRB = pDCB->pActiveSRB; if( pDCB->DCBFlag & ABORT_DEV_ ) dc390_EnableMsgOut_Abort (pACB, pSRB); @@ -549,7 +549,7 @@ dc390_reprog (PACB pACB, PDCB pDCB) DC390_write8 (CtrlReg3, pDCB->CtrlR3); DC390_write8 (CtrlReg4, pDCB->CtrlR4); dc390_SetXferRate (pACB, pDCB); -}; +} #ifdef DC390_DEBUG0 @@ -561,7 +561,7 @@ dc390_printMsg (UCHAR *MsgBuf, UCHAR len) for (i = 1; i < len; i++) printk (" %02x", MsgBuf[i]); printk ("\n"); -}; +} #endif #define DC390_ENABLE_MSGOUT DC390_write8 (ScsiCmd, SET_ATN_CMD) @@ -671,11 +671,11 @@ dc390_MsgIn_set_sync (PACB pACB, PSRB pSRB) { printk (KERN_INFO "DC390: Set sync nego period to %ins\n", pDCB->NegoPeriod << 2); pSRB->MsgInBuf[3] = pDCB->NegoPeriod; - }; + } memcpy (pSRB->MsgOutBuf, pSRB->MsgInBuf, 5); pSRB->MsgCnt = 5; DC390_ENABLE_MSGOUT; - }; + } pSRB->SRBState &= ~DO_SYNC_NEGO; pDCB->SyncMode |= SYNC_ENABLE+SYNC_NEGO_DONE; @@ -713,7 +713,7 @@ dc390_MsgIn_set_sync (PACB pACB, PSRB pSRB) } dc390_reprog (pACB, pDCB); -}; +} /* handle RESTORE_PTR */ @@ -761,7 +761,7 @@ dc390_restore_ptr (PACB pACB, PSRB pSRB) } pSRB->TotalXferredLen = pSRB->Saved_Ptr; -}; +} /* According to the docs, the AM53C974 reads the message and @@ -789,7 +789,7 @@ dc390_MsgIn_complete (UCHAR *msgbuf, UINT len) /* read and eval received messages */ -void +static void dc390_MsgIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus) { PDCB pDCB = pACB->pActiveDCB; @@ -832,7 +832,7 @@ dc390_MsgIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus) dc390_MsgIn_set_async (pACB, pSRB); else dc390_MsgIn_set_sync (pACB, pSRB); - }; + } // nothing has to be done case COMMAND_COMPLETE: break; @@ -948,7 +948,7 @@ dc390_DataInPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus) dc390_DataIO_Comm (pACB, pSRB, READ_DIRECTION); } -void +static void dc390_CommandPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus) { PDCB pDCB; @@ -989,7 +989,7 @@ dc390_StatusPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus) //DC390_write8 (DMA_Cmd, DMA_IDLE_CMD); } -void +static void dc390_MsgOutPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus) { UCHAR bval, i, cnt; @@ -1097,7 +1097,7 @@ dc390_SetXferRate( PACB pACB, PDCB pDCB ) } -void +static void dc390_Disconnect( PACB pACB ) { PDCB pDCB; @@ -1179,7 +1179,7 @@ disc1: } -void +static void dc390_Reselect( PACB pACB ) { PDCB pDCB; @@ -1276,7 +1276,7 @@ dc390_remove_dev (PACB pACB, PDCB pDCB) DCBDEBUG(printk (KERN_INFO "DC390: Driver won't free DCB (ID %i, LUN %i): 0x%08x because of SRBCnt %i\n",\ pDCB->TargetID, pDCB->TargetLUN, (int)pDCB, pDCB->GoingSRBCnt)); return; - }; + } pACB->DCBmap[pDCB->TargetID] &= ~(1 << pDCB->TargetLUN); // The first one @@ -1302,8 +1302,7 @@ dc390_remove_dev (PACB pACB, PDCB pDCB) if (pDCB == pACB->pDCBRunRobin) pACB->pDCBRunRobin = pDCB->pNextDCB; kfree (pDCB); pACB->DCBCnt--; - /* pACB->DeviceCnt--; */ -}; +} static UCHAR __inline__ @@ -1314,7 +1313,7 @@ dc390_tagq_blacklist (char* name) if (memcmp (name, dc390_baddevname1[i], 28) == 0) return 1; return 0; -}; +} static void @@ -1336,7 +1335,7 @@ dc390_disc_tagq_set (PDCB pDCB, PSCSI_INQDATA ptr) else pDCB->MaxCommand = 1; } -}; +} static void @@ -1346,13 +1345,13 @@ dc390_add_dev (PACB pACB, PDCB pDCB, PSCSI_INQDATA ptr) pDCB->DevType = bval1; /* if (bval1 == TYPE_DISK || bval1 == TYPE_MOD) */ dc390_disc_tagq_set (pDCB, ptr); -}; +} -void +static void dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB ) { - UCHAR bval, status, i, DCB_removed; + UCHAR bval, status, i; PSCSICMD pcmd; PSCSI_INQDATA ptr; PSGL ptr2; @@ -1362,11 +1361,10 @@ dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB ) /* KG: Moved pci_unmap here */ dc390_pci_unmap(pSRB); - DCB_removed = 0; status = pSRB->TargetStatus; ptr = (PSCSI_INQDATA) (pcmd->request_buffer); if( pcmd->use_sg ) - ptr = (PSCSI_INQDATA) sg_dma_address((PSGL) ptr); + ptr = (PSCSI_INQDATA) (page_address(((PSGL) ptr)->page) + ((PSGL) ptr)->offset); DEBUG0(printk (" SRBdone (%02x,%08x), SRB %p, pid %li\n", status, pcmd->result,\ pSRB, pcmd->pid)); @@ -1564,55 +1562,22 @@ ckc_e: pcmd->sense_buffer[2], pcmd->sense_buffer[3]); else printk ("\n"); #endif - if( (host_byte(pcmd->result) != DID_OK && !(status_byte(pcmd->result) & CHECK_CONDITION) && !(status_byte(pcmd->result) & BUSY)) || - ((driver_byte(pcmd->result) & DRIVER_SENSE) && (pcmd->sense_buffer[0] & 0x70) == 0x70 && - (pcmd->sense_buffer[2] & 0xf) == ILLEGAL_REQUEST) || host_byte(pcmd->result) & DID_ERROR ) - { - /* device not present: remove */ - //dc390_Going_remove (pDCB, pSRB); - dc390_remove_dev (pACB, pDCB); DCB_removed = 1; - - if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) && - ((pcmd->device->lun == 0) || (pcmd->device->lun == pACB->pScsiHost->max_lun - 1)) ) - pACB->scan_devices = 0; - } - else - { - /* device present: add */ - if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) && - (pcmd->device->lun == pACB->pScsiHost->max_lun - 1) ) - pACB->scan_devices = END_SCAN ; - /* pACB->DeviceCnt++; */ /* Dev is added on INQUIRY */ - } } } - - //if( pSRB->pcmd->cmnd[0] == INQUIRY && - // (host_byte(pcmd->result) == DID_OK || status_byte(pcmd->result) & CHECK_CONDITION) ) + if( pcmd->cmnd[0] == INQUIRY && (pcmd->result == (DID_OK << 16) || status_byte(pcmd->result) & CHECK_CONDITION) ) { - if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV && !DCB_removed) - { - //printk ("DC390: Type = nodev! (%02i-%i)\n", pcmd->target, pcmd->lun); - /* device not present: remove */ - //dc390_Going_remove (pDCB, pSRB); - dc390_remove_dev (pACB, pDCB); DCB_removed = 1; - } - else + if ((ptr->DevType & SCSI_DEVTYPE) != TYPE_NODEV) { /* device found: add */ dc390_add_dev (pACB, pDCB, ptr); - if (pACB->scan_devices) pACB->DeviceCnt++; } - if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) && - (pcmd->device->lun == pACB->pScsiHost->max_lun - 1) ) - pACB->scan_devices = 0; - }; + } pcmd->resid = pcmd->request_bufflen - pSRB->TotalXferredLen; - if (!DCB_removed) dc390_Going_remove (pDCB, pSRB); + dc390_Going_remove (pDCB, pSRB); /* Add to free list */ dc390_Free_insert (pACB, pSRB); @@ -1625,7 +1590,7 @@ ckc_e: /* Remove all SRBs from Going list and inform midlevel */ -void +static void dc390_DoingSRB_Done( PACB pACB, PSCSICMD cmd ) { PDCB pDCB, pdcb; @@ -1760,4 +1725,3 @@ dc390_InvalidCmd( PACB pACB ) if( pACB->pActiveDCB->pActiveSRB->SRBState & (SRB_START_+SRB_MSGOUT) ) DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); } - diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 99a8df70b..b9420b513 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -763,11 +763,11 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt) good_bytes = 0; break; - case RECOVERED_ERROR: + case RECOVERED_ERROR: /* an error occurred, but it recovered */ + case NO_SENSE: /* LLDD got sense data */ /* - * An error occurred, but it recovered. Inform the - * user, but make sure that it's not treated as a - * hard error. + * Inform the user, but make sure that it's not treated + * as a hard error. */ print_sense("sd", SCpnt); SCpnt->result = 0; diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index e0f17f0b4..a3e68b4ae 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -42,7 +42,6 @@ static int sg_version_num = 30531; /* 2 digits for each component */ #include #include #include -#include #include #include #include @@ -60,7 +59,7 @@ static int sg_version_num = 30531; /* 2 digits for each component */ #ifdef CONFIG_SCSI_PROC_FS #include -static char *sg_version_date = "20040513"; +static char *sg_version_date = "20040516"; static int sg_proc_init(void); static void sg_proc_cleanup(void); @@ -73,7 +72,7 @@ static void sg_proc_cleanup(void); #define SG_ALLOW_DIO_DEF 0 #define SG_ALLOW_DIO_CODE /* compile out by commenting this define */ -#define SG_MAX_DEVS 8192 +#define SG_MAX_DEVS 32768 /* * Suppose you want to calculate the formula muldiv(x,m,d)=int(x * m / d) @@ -724,7 +723,6 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, (void *) SRpnt->sr_buffer, hp->dxfer_len, sg_cmd_done, timeout, SG_DEFAULT_RETRIES); /* dxfer_len overwrites SRpnt->sr_bufflen, hence need for b_malloc_len */ - generic_unplug_device(q); return 0; } @@ -1337,9 +1335,11 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) void *old_sg_dev_arr = NULL; int k, error; - sdp = vmalloc(sizeof(Sg_device)); - if (!sdp) + sdp = kmalloc(sizeof(Sg_device), GFP_KERNEL); + if (!sdp) { + printk(KERN_WARNING "kmalloc Sg_device failure\n"); return -ENOMEM; + } write_lock_irqsave(&sg_dev_arr_lock, iflags); if (unlikely(sg_nr_dev >= sg_dev_max)) { /* try to resize */ @@ -1347,7 +1347,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) int tmp_dev_max = sg_nr_dev + SG_DEV_ARR_LUMP; write_unlock_irqrestore(&sg_dev_arr_lock, iflags); - tmp_da = vmalloc(tmp_dev_max * sizeof(Sg_device *)); + tmp_da = kmalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL); if (unlikely(!tmp_da)) goto expand_failed; @@ -1381,12 +1381,12 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) out: if (error < 0) - vfree(sdp); - vfree(old_sg_dev_arr); + kfree(sdp); + kfree(old_sg_dev_arr); return error; expand_failed: - printk(KERN_ERR "sg_alloc: device array cannot be resized\n"); + printk(KERN_WARNING "sg_alloc: device array cannot be resized\n"); error = -ENOMEM; goto out; @@ -1410,20 +1410,26 @@ sg_add(struct class_device *cl_dev) int error, k; disk = alloc_disk(1); - if (!disk) + if (!disk) { + printk(KERN_WARNING "alloc_disk failed\n"); return -ENOMEM; + } disk->major = SCSI_GENERIC_MAJOR; error = -ENOMEM; cdev = cdev_alloc(); - if (!cdev) + if (!cdev) { + printk(KERN_WARNING "cdev_alloc failed\n"); goto out; + } cdev->owner = THIS_MODULE; cdev->ops = &sg_fops; error = sg_alloc(disk, scsidp); - if (error < 0) + if (error < 0) { + printk(KERN_WARNING "sg_alloc failed\n"); goto out; + } k = error; sdp = sg_dev_arr[k]; @@ -1531,7 +1537,7 @@ sg_remove(struct class_device *cl_dev) put_disk(sdp->disk); sdp->disk = NULL; if (NULL == sdp->headfp) - vfree((char *) sdp); + kfree((char *) sdp); } if (delay) @@ -1596,7 +1602,7 @@ exit_sg(void) unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); if (sg_dev_arr != NULL) { - vfree((char *) sg_dev_arr); + kfree((char *) sg_dev_arr); sg_dev_arr = NULL; } sg_dev_max = 0; @@ -2498,7 +2504,7 @@ sg_remove_sfp(Sg_device * sdp, Sg_fd * sfp) } if (k < maxd) sg_dev_arr[k] = NULL; - vfree((char *) sdp); + kfree((char *) sdp); res = 1; } write_unlock_irqrestore(&sg_dev_arr_lock, iflags); diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 7abd5d1cc..f73bf835d 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c @@ -35,9 +35,8 @@ #include #include #include - -#include "scsi.h" #include + #include "53c700.h" @@ -86,7 +85,7 @@ param_setup(char *str) } __setup("sim710=", param_setup); -static Scsi_Host_Template sim710_driver_template = { +static struct scsi_host_template sim710_driver_template = { .name = "LSI (Symbios) 710 MCA/EISA", .proc_name = "sim710", .this_id = 7, diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 4713c8018..db0d11d17 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -754,12 +754,11 @@ Enomem: static void get_capabilities(struct scsi_cd *cd) { unsigned char *buffer; - int rc, n, mrw_write = 0, mrw = 1,ram_write=0; struct scsi_mode_data data; struct scsi_request *SRpnt; unsigned char cmd[MAX_COMMAND_SIZE]; unsigned int the_result; - int retries; + int retries, rc, n; static char *loadmech[] = { @@ -831,19 +830,6 @@ static void get_capabilities(struct scsi_cd *cd) return; } - if (cdrom_is_mrw(&cd->cdi, &mrw_write)) { - mrw = 0; - cd->cdi.mask |= CDC_MRW; - cd->cdi.mask |= CDC_MRW_W; - } - if (!mrw_write) - cd->cdi.mask |= CDC_MRW_W; - - if (cdrom_is_random_writable(&cd->cdi, &ram_write)) - cd->cdi.mask |= CDC_RAM; - if (!ram_write) - cd->cdi.mask |= CDC_RAM; - n = data.header_length + data.block_descriptor_length; cd->cdi.speed = ((buffer[n + 8] << 8) + buffer[n + 9]) / 176; cd->readcd_known = 1; diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 053488579..e94c3a2d8 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -331,6 +331,9 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) int result; unsigned char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); + if (!buffer) + return -ENOMEM; + memset(&cgc, 0, sizeof(struct packet_command)); cgc.timeout = IOCTL_TIMEOUT; diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 8e1433fa1..24a3c492a 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -176,8 +176,8 @@ static int modes_defined; static ST_buffer *new_tape_buffer(int, int, int); static int enlarge_buffer(ST_buffer *, int, int); static void normalize_buffer(ST_buffer *); -static int append_to_buffer(const char *, ST_buffer *, int); -static int from_buffer(ST_buffer *, char *, int); +static int append_to_buffer(const char __user *, ST_buffer *, int); +static int from_buffer(ST_buffer *, char __user *, int); static void move_buffer_data(ST_buffer *, int); static void buf_to_sg(ST_buffer *, unsigned int); @@ -1276,7 +1276,7 @@ static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t } -static int setup_buffering(Scsi_Tape *STp, const char *buf, size_t count, int is_read) +static int setup_buffering(Scsi_Tape *STp, const char __user *buf, size_t count, int is_read) { int i, bufsize, retval = 0; ST_buffer *STbp = STp->buffer; @@ -1348,7 +1348,7 @@ static void release_buffering(Scsi_Tape *STp) /* Write command */ static ssize_t - st_write(struct file *filp, const char *buf, size_t count, loff_t * ppos) +st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) { ssize_t total; ssize_t i, do_count, blks, transfer; @@ -1356,7 +1356,7 @@ static ssize_t int undone, retry_eot = 0, scode; int async_write; unsigned char cmd[MAX_COMMAND_SIZE]; - const char *b_point; + const char __user *b_point; Scsi_Request *SRpnt = NULL; Scsi_Tape *STp = filp->private_data; ST_mode *STm; @@ -1817,7 +1817,7 @@ static long read_tape(Scsi_Tape *STp, long count, Scsi_Request ** aSRpnt) /* Read command */ static ssize_t - st_read(struct file *filp, char *buf, size_t count, loff_t * ppos) +st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) { ssize_t total; ssize_t retval = 0; @@ -3527,7 +3527,7 @@ static void normalize_buffer(ST_buffer * STbuffer) /* Move data from the user buffer to the tape buffer. Returns zero (success) or negative error code. */ -static int append_to_buffer(const char *ubp, ST_buffer * st_bp, int do_count) +static int append_to_buffer(const char __user *ubp, ST_buffer * st_bp, int do_count) { int i, cnt, res, offset; @@ -3558,7 +3558,7 @@ static int append_to_buffer(const char *ubp, ST_buffer * st_bp, int do_count) /* Move data from the tape buffer to the user buffer. Returns zero (success) or negative error code. */ -static int from_buffer(ST_buffer * st_bp, char *ubp, int do_count) +static int from_buffer(ST_buffer * st_bp, char __user *ubp, int do_count) { int i, cnt, res, offset; diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c index 9712b58da..de5cc5912 100644 --- a/drivers/scsi/sym53c416.c +++ b/drivers/scsi/sym53c416.c @@ -622,12 +622,13 @@ void sym53c416_probe(void) int ints[2]; ints[0] = 1; - for(; *base; base++) - { - if(!check_region(*base, IO_RANGE) && sym53c416_test(*base)) - { - ints[1] = *base; - sym53c416_setup(NULL, ints); + for(; *base; base++) { + if (request_region(*base, IO_RANGE, ID)) { + if (sym53c416_test(*base)) { + ints[1] = *base; + sym53c416_setup(NULL, ints); + } + release_region(*base, IO_RANGE); } } } @@ -702,44 +703,42 @@ int __init sym53c416_detect(Scsi_Host_Template *tpnt) sym53c416_probe(); /* Now we register and set up each host adapter found... */ - for(count = 0, i = 0; i < host_index; i++) - { - if(!sym53c416_test(hosts[i].base)) + for(count = 0, i = 0; i < host_index; i++) { + if (!request_region(hosts[i].base, IO_RANGE, ID)) + continue; + if (!sym53c416_test(hosts[i].base)) { printk(KERN_WARNING "No sym53c416 found at address 0x%03x\n", hosts[i].base); - else - { - if(hosts[i].irq == 0) - /* We don't have an irq yet, so we should probe for one */ - if((hosts[i].irq = sym53c416_probeirq(hosts[i].base, hosts[i].scsi_id)) == 0) - printk(KERN_WARNING "IRQ autoprobing failed for sym53c416 at address 0x%03x\n", hosts[i].base); - if(hosts[i].irq && !check_region(hosts[i].base, IO_RANGE)) - { - shpnt = scsi_register(tpnt, 0); - if(shpnt==NULL) - continue; - spin_lock_irqsave(&sym53c416_lock, flags); - /* Request for specified IRQ */ - if(request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, shpnt)) - { - spin_unlock_irqrestore(&sym53c416_lock, flags); - printk(KERN_ERR "sym53c416: Unable to assign IRQ %d\n", hosts[i].irq); - scsi_unregister(shpnt); - } - else - { - /* Inform the kernel of our IO range */ - request_region(hosts[i].base, IO_RANGE, ID); - shpnt->unique_id = hosts[i].base; - shpnt->io_port = hosts[i].base; - shpnt->n_io_port = IO_RANGE; - shpnt->irq = hosts[i].irq; - shpnt->this_id = hosts[i].scsi_id; - sym53c416_init(hosts[i].base, hosts[i].scsi_id); - count++; - spin_unlock_irqrestore(&sym53c416_lock, flags); - } - } + goto fail_release_region; } + + /* We don't have an irq yet, so we should probe for one */ + if (!hosts[i].irq) + hosts[i].irq = sym53c416_probeirq(hosts[i].base, hosts[i].scsi_id); + if (!hosts[i].irq) + goto fail_release_region; + + shpnt = scsi_register(tpnt, 0); + if (!shpnt) + goto fail_release_region; + /* Request for specified IRQ */ + if (request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, shpnt)) + goto fail_free_host; + + spin_lock_irqsave(&sym53c416_lock, flags); + shpnt->unique_id = hosts[i].base; + shpnt->io_port = hosts[i].base; + shpnt->n_io_port = IO_RANGE; + shpnt->irq = hosts[i].irq; + shpnt->this_id = hosts[i].scsi_id; + sym53c416_init(hosts[i].base, hosts[i].scsi_id); + count++; + spin_unlock_irqrestore(&sym53c416_lock, flags); + continue; + + fail_free_host: + scsi_unregister(shpnt); + fail_release_region: + release_region(hosts[i].base, IO_RANGE); } return count; } diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index dd51823a5..d336e3028 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c @@ -172,6 +172,11 @@ * 2.1b1 04/01/31 GL (applied 05.04) Remove internal * * command-queuing. * * 2.1b2 04/02/01 CH (applied 05.04) Fix error-handling * + * 2.1c 04/05/23 GL Update to use the new pci_driver API, * + * some scsi EH updates, more cleanup. * + * 2.1d 04/05/27 GL Moved setting of scan_devices to * + * slave_alloc/_configure/_destroy, as * + * suggested by CH. * ***********************************************************************/ /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */ @@ -267,7 +272,6 @@ #include #include -#if defined(MODULE) static struct pci_device_id tmscsim_pci_tbl[] = { { .vendor = PCI_VENDOR_ID_AMD, @@ -278,8 +282,7 @@ static struct pci_device_id tmscsim_pci_tbl[] = { { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(pci, tmscsim_pci_tbl); -#endif - + #define USE_SPINLOCKS 1 #define DC390_IFLAGS unsigned long iflags @@ -342,6 +345,8 @@ static void dc390_updateDCB (PACB pACB, PDCB pDCB); static int DC390_release(struct Scsi_Host *host); static int dc390_shutdown (struct Scsi_Host *host); +static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start, + off_t offset, int length, int inout); static PACB dc390_pACB_start= NULL; static PACB dc390_pACB_current = NULL; @@ -351,16 +356,14 @@ static UCHAR dc390_adapterCnt = 0; /* Startup values, to be overriden on the commandline */ static int tmscsim[] = {-2, -2, -2, -2, -2, -2}; +static int tmscsim_paramnum = ARRAY_SIZE(tmscsim); -#if defined(MODULE) -MODULE_PARM(tmscsim, "1-6i"); +module_param_array(tmscsim, int, tmscsim_paramnum, 0); MODULE_PARM_DESC(tmscsim, "Host SCSI ID, Speed (0=10MHz), Device Flags, Adapter Flags, Max Tags (log2(tags)-1), DelayReset (s)"); MODULE_AUTHOR("C.L. Huang / Kurt Garloff"); MODULE_DESCRIPTION("SCSI host adapter driver for Tekram DC390 and other AMD53C974A based PCI SCSI adapters"); MODULE_LICENSE("GPL"); - MODULE_SUPPORTED_DEVICE("sd,sr,sg,st"); -#endif static PVOID dc390_phase0[]={ dc390_DataOut_0, @@ -913,6 +916,14 @@ static void dc390_SendSRB( PACB pACB, PSRB pSRB ) } } +static struct scatterlist* dc390_sg_build_single(struct scatterlist *sg, void *addr, unsigned int length) +{ + memset(sg, 0, sizeof(struct scatterlist)); + sg->page = virt_to_page(addr); + sg->length = length; + sg->offset = (unsigned long)addr & ~PAGE_MASK; + return sg; +} /* Create pci mapping */ static int dc390_pci_map (PSRB pSRB) @@ -921,40 +932,43 @@ static int dc390_pci_map (PSRB pSRB) Scsi_Cmnd *pcmd = pSRB->pcmd; struct pci_dev *pdev = pSRB->pSRBDCB->pDCBACB->pdev; dc390_cmd_scp_t* cmdp = ((dc390_cmd_scp_t*)(&pcmd->SCp)); + /* Map sense buffer */ if (pSRB->SRBFlag & AUTO_REQSENSE) { - sg_dma_address(&pSRB->Segmentx) = cmdp->saved_dma_handle = - pci_map_page(pdev, virt_to_page(pcmd->sense_buffer), - (unsigned long)pcmd->sense_buffer & ~PAGE_MASK, sizeof(pcmd->sense_buffer), - DMA_FROM_DEVICE); - sg_dma_len(&pSRB->Segmentx) = sizeof(pcmd->sense_buffer); - pSRB->SGcount = 1; - pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; + pSRB->pSegmentList = dc390_sg_build_single(&pSRB->Segmentx, pcmd->sense_buffer, sizeof(pcmd->sense_buffer)); + pSRB->SGcount = pci_map_sg(pdev, pSRB->pSegmentList, 1, + DMA_FROM_DEVICE); + cmdp->saved_dma_handle = sg_dma_address(pSRB->pSegmentList); + + /* TODO: error handling */ + if (pSRB->SGcount != 1) + error = 1; DEBUG1(printk("%s(): Mapped sense buffer %p at %x\n", __FUNCTION__, pcmd->sense_buffer, cmdp->saved_dma_handle)); - /* Make SG list */ + /* Map SG list */ } else if (pcmd->use_sg) { - pSRB->pSegmentList = (PSGL) pcmd->request_buffer; - pSRB->SGcount = pci_map_sg(pdev, pSRB->pSegmentList, - pcmd->use_sg, - scsi_to_pci_dma_dir(pcmd->sc_data_direction)); + pSRB->pSegmentList = (PSGL) pcmd->request_buffer; + pSRB->SGcount = pci_map_sg(pdev, pSRB->pSegmentList, pcmd->use_sg, + scsi_to_pci_dma_dir(pcmd->sc_data_direction)); /* TODO: error handling */ if (!pSRB->SGcount) error = 1; - DEBUG1(printk("%s(): Mapped SG %p with %d (%d) elements\n", __FUNCTION__, pcmd->request_buffer, pSRB->SGcount, pcmd->use_sg)); + DEBUG1(printk("%s(): Mapped SG %p with %d (%d) elements\n",\ + __FUNCTION__, pcmd->request_buffer, pSRB->SGcount, pcmd->use_sg)); /* Map single segment */ } else if (pcmd->request_buffer && pcmd->request_bufflen) { - sg_dma_address(&pSRB->Segmentx) = cmdp->saved_dma_handle = - pci_map_page(pdev, virt_to_page(pcmd->request_buffer), - (unsigned long)pcmd->request_buffer & ~PAGE_MASK, - pcmd->request_bufflen, scsi_to_pci_dma_dir(pcmd->sc_data_direction)); + pSRB->pSegmentList = dc390_sg_build_single(&pSRB->Segmentx, pcmd->request_buffer, pcmd->request_bufflen); + pSRB->SGcount = pci_map_sg(pdev, pSRB->pSegmentList, 1, + scsi_to_pci_dma_dir(pcmd->sc_data_direction)); + cmdp->saved_dma_handle = sg_dma_address(pSRB->pSegmentList); + /* TODO: error handling */ - sg_dma_len(&pSRB->Segmentx) = pcmd->request_bufflen; - pSRB->SGcount = 1; - pSRB->pSegmentList = (PSGL) &pSRB->Segmentx; + if (pSRB->SGcount != 1) + error = 1; DEBUG1(printk("%s(): Mapped request buffer %p at %x\n", __FUNCTION__, pcmd->request_buffer, cmdp->saved_dma_handle)); /* No mapping !? */ } else pSRB->SGcount = 0; + return error; } @@ -963,21 +977,16 @@ static void dc390_pci_unmap (PSRB pSRB) { Scsi_Cmnd* pcmd = pSRB->pcmd; struct pci_dev *pdev = pSRB->pSRBDCB->pDCBACB->pdev; - dc390_cmd_scp_t* cmdp = ((dc390_cmd_scp_t*)(&pcmd->SCp)); + DEBUG1(dc390_cmd_scp_t* cmdp = ((dc390_cmd_scp_t*)(&pcmd->SCp))); if (pSRB->SRBFlag) { - pci_unmap_page(pdev, cmdp->saved_dma_handle, - sizeof(pcmd->sense_buffer), DMA_FROM_DEVICE); + pci_unmap_sg(pdev, &pSRB->Segmentx, 1, DMA_FROM_DEVICE); DEBUG1(printk("%s(): Unmapped sense buffer at %x\n", __FUNCTION__, cmdp->saved_dma_handle)); } else if (pcmd->use_sg) { - pci_unmap_sg(pdev, pcmd->request_buffer, pcmd->use_sg, - scsi_to_pci_dma_dir(pcmd->sc_data_direction)); + pci_unmap_sg(pdev, pcmd->request_buffer, pcmd->use_sg, scsi_to_pci_dma_dir(pcmd->sc_data_direction)); DEBUG1(printk("%s(): Unmapped SG at %p with %d elements\n", __FUNCTION__, pcmd->request_buffer, pcmd->use_sg)); } else if (pcmd->request_buffer && pcmd->request_bufflen) { - pci_unmap_page(pdev, - cmdp->saved_dma_handle, - pcmd->request_bufflen, - scsi_to_pci_dma_dir(pcmd->sc_data_direction)); + pci_unmap_sg(pdev, &pSRB->Segmentx, 1, scsi_to_pci_dma_dir(pcmd->sc_data_direction)); DEBUG1(printk("%s(): Unmapped request buffer at %x\n", __FUNCTION__, cmdp->saved_dma_handle)); } } @@ -1031,15 +1040,15 @@ static void dc390_BuildSRB (Scsi_Cmnd* pcmd, PDCB pDCB, PSRB pSRB) * 2.0.x: always return 0 * 2.1.x: old model: (use_new_eh_code == 0): like 2.0.x * TO BE DONE: - * new model: return 0 if successful - * return 1 if command cannot be queued (queue full) + * new model: return 0 if successful, or must not be re-queued + * return 1 if command cannot be queued (queue full) * command will be inserted in midlevel queue then ... * ***********************************************************************/ static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { - PDCB pDCB; + PDCB pDCB = (PDCB) cmd->device->hostdata; PSRB pSRB; PACB pACB = (PACB) cmd->device->host->hostdata; @@ -1050,42 +1059,19 @@ static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) /* TODO: Change the policy: Always accept TEST_UNIT_READY or INQUIRY * commands and alloc a DCB for the device if not yet there. DCB will * be removed in dc390_SRBdone if SEL_TIMEOUT */ - - if( (pACB->scan_devices == END_SCAN) && (cmd->cmnd[0] != INQUIRY) ) - pACB->scan_devices = 0; - - else if( (pACB->scan_devices) && (cmd->cmnd[0] == READ_6) ) - pACB->scan_devices = 0; - - if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) && - !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) ) - { - pACB->scan_devices = 1; - - dc390_initDCB( pACB, &pDCB, cmd->device->id, cmd->device->lun ); - if (!pDCB) - { - printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", - cmd->device->id, cmd->device->lun); - goto fail; - } - - } - else if( !(pACB->scan_devices) && !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) ) - { + if (!(pACB->scan_devices) && !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun))) { printk(KERN_INFO "DC390: Ignore target %02x lun %02x\n", cmd->device->id, cmd->device->lun); goto fail; } - else - { - pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun); - if (!pDCB) - { /* should never happen */ - printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n", - cmd->device->id, cmd->device->lun); - goto fail; - } + + /* Should it be: BUG_ON(!pDCB); ? */ + + if (!pDCB) + { /* should never happen */ + printk (KERN_ERR "DC390: no DCB found, target %02x lun %02x\n", + cmd->device->id, cmd->device->lun); + goto fail; } pACB->Cmds++; @@ -1304,7 +1290,7 @@ static void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB) static int DC390_abort (Scsi_Cmnd *cmd) { - PDCB pDCB; + PDCB pDCB = (PDCB) cmd->device->hostdata; PSRB pSRB, psrb; UINT count, i; int status; @@ -1314,7 +1300,6 @@ static int DC390_abort (Scsi_Cmnd *cmd) printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n", cmd->pid, cmd->device->id, cmd->device->lun); - pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun); if( !pDCB ) goto NOT_RUN; /* Added 98/07/02 KG */ @@ -1561,15 +1546,16 @@ static void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun ) { PEEprom prom; UCHAR index; - PDCB pDCB, pDCB2; + PDCB pDCB, pDCB2 = 0; pDCB = kmalloc (sizeof(DC390_DCB), GFP_ATOMIC); DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n", \ id, lun, pDCB)); - + *ppDCB = pDCB; - if (!pDCB) return; - pDCB2 = 0; + if (!pDCB) + return; + if( pACB->DCBCnt == 0 ) { pACB->pLinkDCB = pDCB; @@ -1745,8 +1731,6 @@ static void __init dc390_initACB (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index pACB->SRBCount = MAX_SRB_CNT; pACB->AdapterIndex = index; pACB->status = 0; - psh->this_id = dc390_eepromBuf[index][EE_ADAPT_SCSI_ID]; - pACB->DeviceCnt = 0; pACB->DCBCnt = 0; pACB->TagMaxNum = 2 << dc390_eepromBuf[index][EE_TAG_CMD_NUM]; pACB->ACBFlag = 0; @@ -1856,7 +1840,7 @@ static int __init dc390_initAdapter (PSH psh, ULONG io_port, UCHAR Irq, UCHAR in * * Inputs : host - pointer to this host adapter's structure * io_port - IO ports mapped to this adapter - * Irq - IRQ assigned to this adpater + * irq - IRQ assigned to this adpater * struct pci_dev - PCI access handle * index - Adapter index * @@ -1865,10 +1849,8 @@ static int __init dc390_initAdapter (PSH psh, ULONG io_port, UCHAR Irq, UCHAR in * Note: written in capitals, because the locking is only done here, * not in DC390_detect, called from outside ***********************************************************************/ - -static int __init DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, struct pci_dev *pdev, UCHAR index) +static int __init dc390_init (PSH psh, unsigned long io_port, u8 irq, struct pci_dev *pdev, UCHAR index) { - PSH psh; PACB pACB; if (dc390_CheckEEpromCheckSum (PDEV, index)) @@ -1890,25 +1872,16 @@ static int __init DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, struct pci_de dc390_check_for_safe_settings (); dc390_EEprom_Override (index); } - - psh = scsi_register( psht, sizeof(DC390_ACB) ); - if( !psh ) return( -1 ); - - scsi_set_device(psh, &pdev->dev); pACB = (PACB) psh->hostdata; DEBUG0(printk(KERN_INFO "DC390: pSH = %8x, Index %02i\n", (UINT) psh, index)); - dc390_initACB( psh, io_port, Irq, index ); + dc390_initACB( psh, io_port, irq, index ); PDEVSET; - if( !dc390_initAdapter( psh, io_port, Irq, index ) ) + if( !dc390_initAdapter( psh, io_port, irq, index ) ) { - DEBUG0(printk("DC390: pACB = %8x, pDCBmap = %8x, pSRB_array = %8x\n",\ - (UINT) pACB, (UINT) pACB->DCBmap, (UINT) pACB->SRB_array)); - DEBUG0(printk("DC390: ACB size= %4x, DCB size= %4x, SRB size= %4x\n",\ - sizeof(DC390_ACB), sizeof(DC390_DCB), sizeof(DC390_SRB) )); return (0); } else @@ -1927,42 +1900,131 @@ static void __init dc390_set_pci_cfg (PDEVDECL) PCI_WRITE_CONFIG_WORD (PDEV, PCI_STATUS, (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY)); } -int __init DC390_detect (Scsi_Host_Template *psht) +/** + * dc390_slave_alloc - Called by the scsi mid layer to tell us about a new + * scsi device that we need to deal with. + * + * @scsi_device: The new scsi device that we need to handle. + */ +static int dc390_slave_alloc(struct scsi_device *scsi_device) +{ + PDCB pDCB; + PACB pACB = (PACB) scsi_device->host->hostdata; + dc390_initDCB(pACB, &pDCB, scsi_device->id, scsi_device->lun); + if (pDCB != NULL) { + scsi_device->hostdata = pDCB; + pACB->scan_devices = 1; + return 0; + } + return -ENOMEM; +} + +/** + * dc390_slave_destroy - Called by the scsi mid layer to tell us about a + * device that is going away. + * + * @scsi_device: The scsi device that we need to remove. + */ +static void dc390_slave_destroy(struct scsi_device *scsi_device) +{ + PACB pACB = (PACB) scsi_device->host->hostdata; + PDCB pDCB = (PDCB) scsi_device->hostdata; + pACB->scan_devices = 0; + if (pDCB != NULL) + dc390_remove_dev(pACB, pDCB); + else + printk(KERN_ERR"%s() called for non-existing device!\n", __FUNCTION__); +} + +static int dc390_slave_configure(struct scsi_device *scsi_device) { - struct pci_dev *pdev = NULL; - UCHAR irq; - ULONG io_port; + PACB pACB = (PACB) scsi_device->host->hostdata; + pACB->scan_devices = 0; + return 0; +} - dc390_pACB_start = NULL; +static Scsi_Host_Template driver_template = { + .module = THIS_MODULE, + .proc_name = "tmscsim", + .proc_info = DC390_proc_info, + .name = DC390_BANNER " V" DC390_VERSION, + .slave_alloc = dc390_slave_alloc, + .slave_configure = dc390_slave_configure, + .slave_destroy = dc390_slave_destroy, + .queuecommand = DC390_queue_command, + .eh_abort_handler = DC390_abort, + .eh_bus_reset_handler = DC390_reset, + .bios_param = DC390_bios_param, + .can_queue = 42, + .this_id = 7, + .sg_tablesize = SG_ALL, + .cmd_per_lun = 16, + .use_clustering = DISABLE_CLUSTERING, +}; - if ( PCI_PRESENT ) - while ((pdev = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974, pdev))) - { - if (pci_enable_device (pdev)) - continue; +static int __devinit dc390_init_one(struct pci_dev *dev, + const struct pci_device_id *id) +{ + struct Scsi_Host *scsi_host; + unsigned long io_port; + u8 irq; + PACB pACB; + int ret = -ENOMEM; - if (pci_set_dma_mask(pdev, 0xffffffff)) { - printk(KERN_ERR "DC390(%i): No suitable DMA available.\n", dc390_adapterCnt); - continue; - } - PCI_GET_IO_AND_IRQ; - DEBUG0(printk(KERN_INFO "DC390(%i): IO_PORT=%04x,IRQ=%x\n", dc390_adapterCnt, (UINT) io_port, irq)); + if (pci_enable_device(dev)) + return -ENODEV; - if( !DC390_init(psht, io_port, irq, PDEV, dc390_adapterCnt)) - { - pci_set_master(pdev); - dc390_set_pci_cfg (PDEV); - dc390_adapterCnt++; - } + io_port = pci_resource_start(dev, 0); + irq = dev->irq; + + /* allocate scsi host information (includes out adapter) */ + scsi_host = scsi_host_alloc(&driver_template, sizeof(struct _ACB)); + if (!scsi_host) + goto nomem; + + pACB = (PACB) scsi_host->hostdata; + + if (dc390_init(scsi_host, io_port, irq, dev, dc390_adapterCnt)) { + ret = -EBUSY; + goto busy; } - else - printk (KERN_ERR "DC390: No PCI BIOS found!\n"); - - if (dc390_adapterCnt) - psht->proc_name = "tmscsim"; - printk(KERN_INFO "DC390: %i adapters found\n", dc390_adapterCnt); - return( dc390_adapterCnt ); + pci_set_master(dev); + dc390_set_pci_cfg(dev); + dc390_adapterCnt++; + + /* get the scsi mid level to scan for new devices on the bus */ + if (scsi_add_host(scsi_host, &dev->dev)) { + ret = -ENODEV; + goto nodev; + } + pci_set_drvdata(dev, scsi_host); + scsi_scan_host(scsi_host); + + return 0; + +nodev: +busy: + scsi_host_put(scsi_host); +nomem: + pci_disable_device(dev); + return ret; +} + +/** + * dc390_remove_one - Called to remove a single instance of the adapter. + * + * @dev: The PCI device to remove. + */ +static void __devexit dc390_remove_one(struct pci_dev *dev) +{ + struct Scsi_Host *scsi_host = pci_get_drvdata(dev); + + scsi_remove_host(scsi_host); + DC390_release(scsi_host); + pci_disable_device(dev); + scsi_host_put(scsi_host); + pci_set_drvdata(dev, NULL); } /******************************************************************** @@ -2035,7 +2097,7 @@ static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start, SPRINTF(" Lost arbitrations %i, Sel. connected %i, Connected: %s\n", pACB->SelLost, pACB->SelConn, pACB->Connected? "Yes": "No"); - SPRINTF("Nr of attached devices: %i, Nr of DCBs: %i\n", pACB->DeviceCnt, pACB->DCBCnt); + SPRINTF("Nr of DCBs: %i\n", pACB->DCBCnt); SPRINTF("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n", pACB->DCBmap[0], pACB->DCBmap[1], pACB->DCBmap[2], pACB->DCBmap[3], pACB->DCBmap[4], pACB->DCBmap[5], pACB->DCBmap[6], pACB->DCBmap[7]); @@ -2122,7 +2184,7 @@ static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start, static int dc390_shutdown (struct Scsi_Host *host) { UCHAR bval; - PACB pACB = (PACB)(host->hostdata); + PACB pACB = (PACB) host->hostdata; /* pACB->soft_reset(host); */ @@ -2142,7 +2204,7 @@ static int dc390_shutdown (struct Scsi_Host *host) static void dc390_freeDCBs (struct Scsi_Host *host) { PDCB pDCB, nDCB; - PACB pACB = (PACB)(host->hostdata); + PACB pACB = (PACB) host->hostdata; pDCB = pACB->pLinkDCB; if (!pDCB) return; @@ -2161,7 +2223,7 @@ static void dc390_freeDCBs (struct Scsi_Host *host) static int DC390_release (struct Scsi_Host *host) { DC390_IFLAGS; - PACB pACB = (PACB)(host->hostdata); + PACB pACB = (PACB) host->hostdata; DC390_LOCK_IO(host); @@ -2177,24 +2239,25 @@ static int DC390_release (struct Scsi_Host *host) release_region(host->io_port,host->n_io_port); dc390_freeDCBs (host); DC390_UNLOCK_IO(host); - scsi_unregister(host); return( 1 ); } -static Scsi_Host_Template driver_template = { - .proc_name = "tmscsim", - .proc_info = DC390_proc_info, - .name = DC390_BANNER " V" DC390_VERSION, - .detect = DC390_detect, - .release = DC390_release, - .queuecommand = DC390_queue_command, - .eh_abort_handler = DC390_abort, - .eh_bus_reset_handler = DC390_reset, - .bios_param = DC390_bios_param, - .can_queue = 42, - .this_id = 7, - .sg_tablesize = SG_ALL, - .cmd_per_lun = 16, - .use_clustering = DISABLE_CLUSTERING, +static struct pci_driver dc390_driver = { + .name = "tmscsim", + .id_table = tmscsim_pci_tbl, + .probe = dc390_init_one, + .remove = __devexit_p(dc390_remove_one), }; -#include "scsi_module.c" + +static int __init dc390_module_init(void) +{ + return pci_module_init(&dc390_driver); +} + +static void __exit dc390_module_exit(void) +{ + pci_unregister_driver(&dc390_driver); +} + +module_init(dc390_module_init); +module_exit(dc390_module_exit); diff --git a/drivers/scsi/tmscsim.h b/drivers/scsi/tmscsim.h index fd12e6062..7f3ad6216 100644 --- a/drivers/scsi/tmscsim.h +++ b/drivers/scsi/tmscsim.h @@ -22,8 +22,6 @@ #define SEL_TIMEOUT 153 /* 250 ms selection timeout (@ 40 MHz) */ -#define END_SCAN 2 - #define pci_dma_lo32(a) (a & 0xffffffff) typedef u8 UCHAR; /* 8 bits */ @@ -196,10 +194,8 @@ UCHAR status; UCHAR SRBCount; UCHAR AdapterIndex; /*; nth Adapter this driver */ -UCHAR DeviceCnt; UCHAR DCBCnt; -/* 0x10: */ UCHAR TagMaxNum; UCHAR ACBFlag; UCHAR Gmode2; @@ -213,13 +209,11 @@ PDCB pActiveDCB; PSRB pFreeSRB; PSRB pTmpSRB; -/* 0x2c: */ UCHAR msgin123[4]; UCHAR DCBmap[MAX_SCSI_ID]; UCHAR Connected; UCHAR pad; -/* 0x30: */ #if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0) spinlock_t lock; #endif @@ -230,20 +224,17 @@ UCHAR MsgLen; UCHAR Ignore_IRQ; /* Not used */ PDEVDECL1; /* Pointer to PCI cfg. space */ -/* 0x40/0x3c: */ + ULONG Cmds; UINT SelLost; UINT SelConn; UINT CmdInQ; UINT CmdOutOfSRB; -/* 0x54/0x50: */ struct timer_list Waiting_Timer; -/* 0x68/0x64: */ + DC390_SRB TmpSRB; -/* 0xcc/0xc8: */ DC390_SRB SRB_array[MAX_SRB_CNT]; /* 50 SRBs */ -/* 0xfa4/0xfa0: */ }; typedef struct _ACB DC390_ACB, *PACB; diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 042b47af9..037e1ab6f 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c @@ -1605,6 +1605,7 @@ static int wd7000_release(struct Scsi_Host *shost) return 0; } +#if 0 /* * I have absolutely NO idea how to do an abort with the WD7000... */ @@ -1619,7 +1620,7 @@ static int wd7000_abort(Scsi_Cmnd * SCpnt) } return FAILED; } - +#endif /* * I also have no idea how to do a reset... diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c index d8c8a8157..99ff6725e 100644 --- a/drivers/serial/8250_acpi.c +++ b/drivers/serial/8250_acpi.c @@ -57,28 +57,18 @@ static acpi_status acpi_serial_port(struct serial_struct *req, static acpi_status acpi_serial_ext_irq(struct serial_struct *req, struct acpi_resource_ext_irq *ext_irq) { - if (ext_irq->number_of_interrupts > 0) { -#ifdef CONFIG_IA64 - req->irq = acpi_register_irq(ext_irq->interrupts[0], - ext_irq->active_high_low, ext_irq->edge_level); -#else - req->irq = ext_irq->interrupts[0]; -#endif - } + if (ext_irq->number_of_interrupts > 0) + req->irq = acpi_register_gsi(ext_irq->interrupts[0], + ext_irq->edge_level, ext_irq->active_high_low); return AE_OK; } static acpi_status acpi_serial_irq(struct serial_struct *req, struct acpi_resource_irq *irq) { - if (irq->number_of_interrupts > 0) { -#ifdef CONFIG_IA64 - req->irq = acpi_register_irq(irq->interrupts[0], - irq->active_high_low, irq->edge_level); -#else - req->irq = irq->interrupts[0]; -#endif - } + if (irq->number_of_interrupts > 0) + req->irq = acpi_register_gsi(irq->interrupts[0], + irq->edge_level, irq->active_high_low); return AE_OK; } diff --git a/drivers/serial/8250_hcdp.c b/drivers/serial/8250_hcdp.c index e7b573f63..4be2e6062 100644 --- a/drivers/serial/8250_hcdp.c +++ b/drivers/serial/8250_hcdp.c @@ -183,16 +183,12 @@ setup_serial_hcdp(void *tablep) } if (HCDP_IRQ_SUPPORTED(hcdp_dev)) { -#ifdef CONFIG_IA64 if (HCDP_PCI_UART(hcdp_dev)) - port.irq = acpi_register_irq(gsi, - ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE); + port.irq = acpi_register_gsi(gsi, + ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); else - port.irq = acpi_register_irq(gsi, - ACPI_ACTIVE_HIGH, ACPI_EDGE_SENSITIVE); -#else - port.irq = gsi; -#endif + port.irq = acpi_register_gsi(gsi, + ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH); port.flags |= UPF_AUTO_IRQ; if (HCDP_PCI_UART(hcdp_dev)) diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index a0d988dc9..2f215ce80 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c @@ -361,9 +361,6 @@ static int __devinit check_resources(struct pnp_option *option) ((port->min == 0x2f8) || (port->min == 0x3f8) || (port->min == 0x2e8) || -#ifdef CONFIG_X86_PC9800 - (port->min == 0x8b0) || -#endif (port->min == 0x3e8))) return 1; } @@ -437,7 +434,7 @@ static struct pnp_driver serial_pnp_driver = { .name = "serial", .id_table = pnp_dev_table, .probe = serial_pnp_probe, - .remove = serial_pnp_remove, + .remove = __devexit_p(serial_pnp_remove), }; static int __init serial8250_pnp_init(void) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 23f452ad3..e5ce98eb0 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -259,6 +259,7 @@ config SERIAL_S3C2410 config SERIAL_S3C2410_CONSOLE bool "Support for console on S3C2410 serial port" depends on SERIAL_S3C2410=y + select SERIAL_CORE_CONSOLE help Allow selection of the S3C2410 on-board serial ports for use as an virtual console. @@ -517,19 +518,6 @@ config V850E_UART_CONSOLE depends on V850E_UART select SERIAL_CORE_CONSOLE -config SERIAL98 - tristate "PC-9800 8251-based primary serial port support" - depends on X86_PC9800 - select SERIAL_CORE - help - If you want to use standard primary serial ports on PC-9800, - say Y. Otherwise, say N. - -config SERIAL98_CONSOLE - bool "Support for console on PC-9800 standard serial port" - depends on SERIAL98=y - select SERIAL_CORE_CONSOLE - config SERIAL_SH_SCI tristate "SH SCI(F) serial port support" depends on SUPERH || H8300 diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 1252dfb2c..c2eb159d8 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -33,7 +33,6 @@ obj-$(CONFIG_SERIAL_68328) += 68328serial.o obj-$(CONFIG_SERIAL_68360) += 68360serial.o obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o obj-$(CONFIG_V850E_UART) += v850e_uart.o -obj-$(CONFIG_SERIAL98) += serial98.o obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o obj-$(CONFIG_SERIAL_AU1X00) += au1x00_uart.o obj-$(CONFIG_SERIAL_DZ) += dz.o diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index f90247482..c91f6b149 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -44,6 +44,7 @@ #include #include #include +#include #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -68,6 +69,7 @@ */ struct uart_amba_port { struct uart_port port; + struct clk *clk; unsigned int im; /* interrupt mask */ unsigned int old_status; }; @@ -351,12 +353,21 @@ static int pl011_startup(struct uart_port *port) unsigned int cr; int retval; + /* + * Try to enable the clock producer. + */ + retval = clk_enable(uap->clk); + if (retval) + goto out; + + uap->port.uartclk = clk_get_rate(uap->clk); + /* * Allocate the IRQ */ retval = request_irq(uap->port.irq, pl011_int, 0, "uart-pl011", uap); if (retval) - goto out; + goto clk_dis; writew(UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, uap->port.membase + UART011_IFLS); @@ -391,6 +402,8 @@ static int pl011_startup(struct uart_port *port) return 0; + clk_dis: + clk_disable(uap->clk); out: return retval; } @@ -425,6 +438,11 @@ static void pl011_shutdown(struct uart_port *port) val = readw(uap->port.membase + UART011_LCRH); val &= ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN); writew(val, uap->port.membase + UART011_LCRH); + + /* + * Shut down the clock producer + */ + clk_disable(uap->clk); } static void @@ -594,38 +612,40 @@ static struct uart_amba_port *amba_ports[UART_NR]; #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE static inline void -pl011_console_write_char(struct uart_port *port, char ch) +pl011_console_write_char(struct uart_amba_port *uap, char ch) { unsigned int status; do { - status = readw(port->membase + UART01x_FR); + status = readw(uap->port.membase + UART01x_FR); } while (status & UART01x_FR_TXFF); - writew(ch, port->membase + UART01x_DR); + writew(ch, uap->port.membase + UART01x_DR); } static void pl011_console_write(struct console *co, const char *s, unsigned int count) { - struct uart_port *port = &amba_ports[co->index]->port; + struct uart_amba_port *uap = amba_ports[co->index]; unsigned int status, old_cr, new_cr; int i; + clk_enable(uap->clk); + /* * First save the CR then disable the interrupts */ - old_cr = readw(port->membase + UART011_CR); + old_cr = readw(uap->port.membase + UART011_CR); new_cr = old_cr & ~UART011_CR_CTSEN; new_cr |= UART01x_CR_UARTEN | UART011_CR_TXE; - writew(new_cr, port->membase + UART011_CR); + writew(new_cr, uap->port.membase + UART011_CR); /* * Now, do each character */ for (i = 0; i < count; i++) { - pl011_console_write_char(port, s[i]); + pl011_console_write_char(uap, s[i]); if (s[i] == '\n') - pl011_console_write_char(port, '\r'); + pl011_console_write_char(uap, '\r'); } /* @@ -633,19 +653,21 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) * and restore the TCR */ do { - status = readw(port->membase + UART01x_FR); + status = readw(uap->port.membase + UART01x_FR); } while (status & UART01x_FR_BUSY); - writew(old_cr, port->membase + UART011_CR); + writew(old_cr, uap->port.membase + UART011_CR); + + clk_disable(uap->clk); } static void __init -pl011_console_get_options(struct uart_port *port, int *baud, +pl011_console_get_options(struct uart_amba_port *uap, int *baud, int *parity, int *bits) { - if (readw(port->membase + UART011_CR) & UART01x_CR_UARTEN) { + if (readw(uap->port.membase + UART011_CR) & UART01x_CR_UARTEN) { unsigned int lcr_h, ibrd, fbrd; - lcr_h = readw(port->membase + UART011_LCRH); + lcr_h = readw(uap->port.membase + UART011_LCRH); *parity = 'n'; if (lcr_h & UART01x_LCRH_PEN) { @@ -660,10 +682,10 @@ pl011_console_get_options(struct uart_port *port, int *baud, else *bits = 8; - ibrd = readw(port->membase + UART011_IBRD); - fbrd = readw(port->membase + UART011_FBRD); + ibrd = readw(uap->port.membase + UART011_IBRD); + fbrd = readw(uap->port.membase + UART011_FBRD); - *baud = port->uartclk * 4 / (64 * ibrd + fbrd); + *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd); } } @@ -685,10 +707,12 @@ static int __init pl011_console_setup(struct console *co, char *options) co->index = 0; uap = amba_ports[co->index]; + uap->port.uartclk = clk_get_rate(uap->clk); + if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else - pl011_console_get_options(&uap->port, &baud, &parity, &bits); + pl011_console_get_options(uap, &baud, &parity, &bits); return uart_set_options(&uap->port, co, baud, parity, bits, flow); } @@ -747,16 +771,21 @@ static int pl011_probe(struct amba_device *dev, void *id) } memset(uap, 0, sizeof(struct uart_amba_port)); + uap->clk = clk_get(&dev->dev, "UARTCLK"); + if (IS_ERR(uap->clk)) { + ret = PTR_ERR(uap->clk); + goto unmap; + } + + ret = clk_use(uap->clk); + if (ret) + goto putclk; + uap->port.dev = &dev->dev; uap->port.mapbase = dev->res.start; uap->port.membase = base; uap->port.iotype = UPIO_MEM; uap->port.irq = dev->irq[0]; -#if 0 /* FIXME */ - uap->port.uartclk = 14745600; -#else - uap->port.uartclk = 24000000; -#endif uap->port.fifosize = 16; uap->port.ops = &amba_pl011_pops; uap->port.flags = UPF_BOOT_AUTOCONF; @@ -769,6 +798,10 @@ static int pl011_probe(struct amba_device *dev, void *id) if (ret) { amba_set_drvdata(dev, NULL); amba_ports[i] = NULL; + clk_unuse(uap->clk); + putclk: + clk_put(uap->clk); + unmap: iounmap(base); free: kfree(uap); @@ -791,6 +824,8 @@ static int pl011_remove(struct amba_device *dev) amba_ports[i] = NULL; iounmap(uap->port.membase); + clk_unuse(uap->clk); + clk_put(uap->clk); kfree(uap); return 0; } diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 84b4a8e0a..22a02bd69 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c @@ -37,7 +37,7 @@ #define SERIAL_S3C2410_NAME "ttySAC" #define SERIAL_S3C2410_MAJOR 204 -#define SERIAL_S3C2410_MINOR 4 +#define SERIAL_S3C2410_MINOR 64 /* we can support 3 uarts, but not always use them */ diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index 5778788a2..b6cfcd240 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c @@ -461,8 +461,8 @@ static void DAA_Coeff_Japan(IXJ *j); static int ixj_init_filter(IXJ *j, IXJ_FILTER * jf); static int ixj_init_filter_raw(IXJ *j, IXJ_FILTER_RAW * jfr); static int ixj_init_tone(IXJ *j, IXJ_TONE * ti); -static int ixj_build_cadence(IXJ *j, IXJ_CADENCE * cp); -static int ixj_build_filter_cadence(IXJ *j, IXJ_FILTER_CADENCE * cp); +static int ixj_build_cadence(IXJ *j, IXJ_CADENCE __user * cp); +static int ixj_build_filter_cadence(IXJ *j, IXJ_FILTER_CADENCE __user * cp); /* Serial Control Interface funtions */ static int SCI_Control(IXJ *j, int control); static int SCI_Prepare(IXJ *j); @@ -2855,7 +2855,7 @@ static void alaw2ulaw(unsigned char *buff, unsigned long len) } } -static ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos) +static ssize_t ixj_read(struct file * file_p, char __user *buf, size_t length, loff_t * ppos) { unsigned long i = *ppos; IXJ * j = get_ixj(NUM(file_p->f_dentry->d_inode)); @@ -2910,7 +2910,7 @@ static ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * } } -static ssize_t ixj_enhanced_read(struct file * file_p, char *buf, size_t length, +static ssize_t ixj_enhanced_read(struct file * file_p, char __user *buf, size_t length, loff_t * ppos) { int pre_retval; @@ -2935,7 +2935,7 @@ static ssize_t ixj_enhanced_read(struct file * file_p, char *buf, size_t length, return read_retval; } -static ssize_t ixj_write(struct file *file_p, const char *buf, size_t count, loff_t * ppos) +static ssize_t ixj_write(struct file *file_p, const char __user *buf, size_t count, loff_t * ppos) { unsigned long i = *ppos; IXJ *j = file_p->private_data; @@ -2989,7 +2989,7 @@ static ssize_t ixj_write(struct file *file_p, const char *buf, size_t count, lof return min(count, j->write_buffer_size); } -static ssize_t ixj_enhanced_write(struct file * file_p, const char *buf, size_t count, loff_t * ppos) +static ssize_t ixj_enhanced_write(struct file * file_p, const char __user *buf, size_t count, loff_t * ppos) { int pre_retval; ssize_t write_retval = 0; @@ -5938,31 +5938,41 @@ static void ixj_testram(IXJ *j) ixj_WriteDSPCommand(0x3001, j); /* Test External SRAM */ } -static int ixj_build_cadence(IXJ *j, IXJ_CADENCE * cp) +static int ixj_build_cadence(IXJ *j, IXJ_CADENCE __user * cp) { - IXJ_CADENCE *lcp; + ixj_cadence *lcp; + IXJ_CADENCE_ELEMENT __user *cep; IXJ_CADENCE_ELEMENT *lcep; IXJ_TONE ti; + int err; - lcp = kmalloc(sizeof(IXJ_CADENCE), GFP_KERNEL); + lcp = kmalloc(sizeof(ixj_cadence), GFP_KERNEL); if (lcp == NULL) return -ENOMEM; - if (copy_from_user(lcp, (char *) cp, sizeof(IXJ_CADENCE)) || (unsigned)lcp->elements_used >= ~0U/sizeof(IXJ_CADENCE_ELEMENT) ) - { - kfree(lcp); - return -EFAULT; - } + + err = -EFAULT; + if (copy_from_user(&lcp->elements_used, + &cp->elements_used, sizeof(int))) + goto out; + if (copy_from_user(&lcp->termination, + &cp->termination, sizeof(IXJ_CADENCE_TERM))) + goto out; + if (get_user(cep, &cp->ce)) + goto out; + + err = -EINVAL; + if ((unsigned)lcp->elements_used >= ~0U/sizeof(IXJ_CADENCE_ELEMENT)) + goto out; + + err = -ENOMEM; lcep = kmalloc(sizeof(IXJ_CADENCE_ELEMENT) * lcp->elements_used, GFP_KERNEL); - if (lcep == NULL) { - kfree(lcp); - return -ENOMEM; - } - if (copy_from_user(lcep, lcp->ce, sizeof(IXJ_CADENCE_ELEMENT) * lcp->elements_used)) - { - kfree(lcep); - kfree(lcp); - return -EFAULT; - } + if (!lcep) + goto out; + + err = -EFAULT; + if (copy_from_user(lcep, cep, sizeof(IXJ_CADENCE_ELEMENT) * lcp->elements_used)) + goto out1; + if (j->cadence_t) { kfree(j->cadence_t->ce); kfree(j->cadence_t); @@ -5982,9 +5992,14 @@ static int ixj_build_cadence(IXJ *j, IXJ_CADENCE * cp) } ixj_play_tone(j, lcp->ce[0].index); return 1; +out1: + kfree(lcep); +out: + kfree(lcp); + return err; } -static int ixj_build_filter_cadence(IXJ *j, IXJ_FILTER_CADENCE * cp) +static int ixj_build_filter_cadence(IXJ *j, IXJ_FILTER_CADENCE __user * cp) { IXJ_FILTER_CADENCE *lcp; lcp = kmalloc(sizeof(IXJ_FILTER_CADENCE), GFP_KERNEL); @@ -5994,7 +6009,7 @@ static int ixj_build_filter_cadence(IXJ *j, IXJ_FILTER_CADENCE * cp) } return -ENOMEM; } - if (copy_from_user(lcp, (char *) cp, sizeof(IXJ_FILTER_CADENCE))) { + if (copy_from_user(lcp, cp, sizeof(IXJ_FILTER_CADENCE))) { if(ixjdebug & 0x0001) { printk(KERN_INFO "Could not copy cadence to kernel\n"); } @@ -6206,6 +6221,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, IXJ_TONE ti; IXJ_FILTER jf; IXJ_FILTER_RAW jfr; + void __user *argp = (void __user *)arg; unsigned int raise, mant; unsigned int minor = iminor(inode); @@ -6251,7 +6267,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, retval = j->serial; break; case IXJCTL_VERSION: - if (copy_to_user((char *) arg, ixj_c_revision, strlen(ixj_c_revision))) + if (copy_to_user(argp, ixj_c_revision, strlen(ixj_c_revision))) retval = -EFAULT; break; case PHONE_RING_CADENCE: @@ -6259,7 +6275,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, break; case IXJCTL_CIDCW: if(arg) { - if (copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID))) { + if (copy_from_user(&j->cid_send, argp, sizeof(PHONE_CID))) { retval = -EFAULT; break; } @@ -6274,7 +6290,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, /* Fall through */ case PHONE_RING_START: if(arg) { - if (copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID))) { + if (copy_from_user(&j->cid_send, argp, sizeof(PHONE_CID))) { retval = -EFAULT; break; } @@ -6432,22 +6448,22 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, samplerate = arg; break; case IXJCTL_DRYBUFFER_READ: - put_user(j->drybuffer, (unsigned long *) arg); + put_user(j->drybuffer, (unsigned long __user *) argp); break; case IXJCTL_DRYBUFFER_CLEAR: j->drybuffer = 0; break; case IXJCTL_FRAMES_READ: - put_user(j->framesread, (unsigned long *) arg); + put_user(j->framesread, (unsigned long __user *) argp); break; case IXJCTL_FRAMES_WRITTEN: - put_user(j->frameswritten, (unsigned long *) arg); + put_user(j->frameswritten, (unsigned long __user *) argp); break; case IXJCTL_READ_WAIT: - put_user(j->read_wait, (unsigned long *) arg); + put_user(j->read_wait, (unsigned long __user *) argp); break; case IXJCTL_WRITE_WAIT: - put_user(j->write_wait, (unsigned long *) arg); + put_user(j->write_wait, (unsigned long __user *) argp); break; case PHONE_MAXRINGS: j->maxrings = arg; @@ -6573,7 +6589,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, 12, 10, 16, 9, 8, 48, 5, 40, 40, 80, 40, 40, 6 }; - if(copy_from_user(&pd, (void *)arg, sizeof(pd))) { + if(copy_from_user(&pd, argp, sizeof(pd))) { retval = -EFAULT; break; } @@ -6590,7 +6606,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, default:val=proto_size[pd.type]*3;break; } pd.buf_min=pd.buf_max=pd.buf_opt=val; - if(copy_to_user((void *)arg, &pd, sizeof(pd))) + if(copy_to_user(argp, &pd, sizeof(pd))) retval = -EFAULT; break; } @@ -6644,7 +6660,7 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, ixj_write_vmwi(j, arg); break; case IXJCTL_CID: - if (copy_to_user((char *) arg, &j->cid, sizeof(PHONE_CID))) + if (copy_to_user(argp, &j->cid, sizeof(PHONE_CID))) retval = -EFAULT; j->ex.bits.caller_id = 0; break; @@ -6666,13 +6682,13 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, break; case PHONE_CAPABILITIES_LIST: add_caps(j); - if (copy_to_user((char *) arg, j->caplist, sizeof(struct phone_capability) * j->caps)) + if (copy_to_user(argp, j->caplist, sizeof(struct phone_capability) * j->caps)) retval = -EFAULT; break; case PHONE_CAPABILITIES_CHECK: { struct phone_capability cap; - if (copy_from_user(&cap, (char *) arg, sizeof(cap))) + if (copy_from_user(&cap, argp, sizeof(cap))) retval = -EFAULT; else { add_caps(j); @@ -6688,12 +6704,12 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, j->ex.bits.pstn_ring = 0; break; case IXJCTL_SET_FILTER: - if (copy_from_user(&jf, (char *) arg, sizeof(jf))) + if (copy_from_user(&jf, argp, sizeof(jf))) retval = -EFAULT; retval = ixj_init_filter(j, &jf); break; case IXJCTL_SET_FILTER_RAW: - if (copy_from_user(&jfr, (char *) arg, sizeof(jfr))) + if (copy_from_user(&jfr, argp, sizeof(jfr))) retval = -EFAULT; else retval = ixj_init_filter_raw(j, &jfr); @@ -6705,19 +6721,19 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, retval = j->filter_hist[arg]; break; case IXJCTL_INIT_TONE: - if (copy_from_user(&ti, (char *) arg, sizeof(ti))) + if (copy_from_user(&ti, argp, sizeof(ti))) retval = -EFAULT; else retval = ixj_init_tone(j, &ti); break; case IXJCTL_TONE_CADENCE: - retval = ixj_build_cadence(j, (IXJ_CADENCE *) arg); + retval = ixj_build_cadence(j, argp); break; case IXJCTL_FILTER_CADENCE: - retval = ixj_build_filter_cadence(j, (IXJ_FILTER_CADENCE *) arg); + retval = ixj_build_filter_cadence(j, argp); break; case IXJCTL_SIGCTL: - if (copy_from_user(&j->sigdef, (char *)arg, sizeof(IXJ_SIGDEF))) { + if (copy_from_user(&j->sigdef, argp, sizeof(IXJ_SIGDEF))) { retval = -EFAULT; break; } diff --git a/drivers/telephony/ixj.h b/drivers/telephony/ixj.h index 65d837d5f..ad23b28e6 100644 --- a/drivers/telephony/ixj.h +++ b/drivers/telephony/ixj.h @@ -1166,6 +1166,12 @@ typedef struct { * ******************************************************************************/ +typedef struct { + int elements_used; + IXJ_CADENCE_TERM termination; + IXJ_CADENCE_ELEMENT *ce; +} ixj_cadence; + typedef struct { struct phone_device p; struct timer_list timer; @@ -1220,8 +1226,8 @@ typedef struct { char tone_index; char tone_state; char maxrings; - IXJ_CADENCE *cadence_t; - IXJ_CADENCE *cadence_r; + ixj_cadence *cadence_t; + ixj_cadence *cadence_r; int tone_cadence_state; IXJ_CADENCE_F cadence_f[6]; DTMF dtmf; diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 4c74401ae..0e805e4f3 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -7,7 +7,7 @@ menu "USB support" # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. config USB tristate "Support for Host-side USB" - depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610 + depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610 || ARCH_LH7A404 ---help--- Universal Serial Bus (USB) is a specification for a serial bus subsystem which offers higher speeds and more features than the diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c index 4aa223576..96a1c025d 100644 --- a/drivers/usb/class/audio.c +++ b/drivers/usb/class/audio.c @@ -2008,6 +2008,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign { struct usb_mixerdev *ms = (struct usb_mixerdev *)file->private_data; int i, j, val; + int __user *user_arg = (int __user *)arg; if (!ms->state->usbdev) return -ENODEV; @@ -2034,7 +2035,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, user_arg); if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_IOC_DIR(cmd) == _IOC_READ) { @@ -2043,27 +2044,27 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign val = get_rec_src(ms); if (val < 0) return val; - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ for (val = i = 0; i < ms->numch; i++) val |= 1 << ms->ch[i].osschannel; - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < ms->numch; i++) if (ms->ch[i].slctunitid) val |= 1 << ms->ch[i].osschannel; - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < ms->numch; i++) if (ms->ch[i].flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)) val |= 1 << ms->ch[i].osschannel; - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); + return put_user(SOUND_CAP_EXCL_INPUT, user_arg); default: i = _IOC_NR(cmd); @@ -2071,7 +2072,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign return -EINVAL; for (j = 0; j < ms->numch; j++) { if (ms->ch[j].osschannel == i) { - return put_user(ms->ch[j].value, (int *)arg); + return put_user(ms->ch[j].value, user_arg); } } return -EINVAL; @@ -2082,7 +2083,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign ms->modcnt++; switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; return set_rec_src(ms, val); @@ -2093,11 +2094,11 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign for (j = 0; j < ms->numch && ms->ch[j].osschannel != i; j++); if (j >= ms->numch) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (wrmixer(ms, j, val)) return -EIO; - return put_user(ms->ch[j].value, (int *)arg); + return put_user(ms->ch[j].value, user_arg); } } @@ -2370,6 +2371,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int { struct usb_audiodev *as = (struct usb_audiodev *)file->private_data; struct usb_audio_state *s = as->state; + int __user *user_arg = (int __user *)arg; unsigned long flags; audio_buf_info abinfo; count_info cinfo; @@ -2387,7 +2389,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int #endif switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, user_arg); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -2399,7 +2401,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int case SNDCTL_DSP_GETCAPS: return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | - DSP_CAP_MMAP | DSP_CAP_BATCH, (int *)arg); + DSP_CAP_MMAP | DSP_CAP_BATCH, user_arg); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -2413,7 +2415,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (val >= 0) { if (val < 4000) @@ -2423,10 +2425,12 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int if (set_format(as, file->f_mode, AFMT_QUERY, val)) return -EIO; } - return put_user((file->f_mode & FMODE_READ) ? as->usbin.dma.srate : as->usbout.dma.srate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? + as->usbin.dma.srate : as->usbout.dma.srate, + user_arg); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; if (val) @@ -2438,7 +2442,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (val != 0) { val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; @@ -2450,14 +2454,14 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int return -EIO; } val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; - return put_user(AFMT_ISSTEREO(val2) ? 2 : 1, (int *)arg); + return put_user(AFMT_ISSTEREO(val2) ? 2 : 1, user_arg); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ return put_user(AFMT_U8 | AFMT_U16_LE | AFMT_U16_BE | - AFMT_S8 | AFMT_S16_LE | AFMT_S16_BE, (int *)arg); + AFMT_S8 | AFMT_S16_LE | AFMT_S16_BE, user_arg); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (val != AFMT_QUERY) { if (hweight32(val) != 1) @@ -2471,7 +2475,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int return -EIO; } val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; - return put_user(val2 & ~AFMT_STEREO, (int *)arg); + return put_user(val2 & ~AFMT_STEREO, user_arg); case SNDCTL_DSP_POST: return 0; @@ -2482,10 +2486,10 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && as->usbout.flags & FLG_RUNNING) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -2543,7 +2547,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int spin_lock_irqsave(&as->lock, flags); val = as->usbout.dma.count; spin_unlock_irqrestore(&as->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, user_arg); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2577,14 +2581,14 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_out(as))) return val; - return put_user(as->usbout.dma.fragsize, (int *)arg); + return put_user(as->usbout.dma.fragsize, user_arg); } if ((val = prog_dmabuf_in(as))) return val; - return put_user(as->usbin.dma.fragsize, (int *)arg); + return put_user(as->usbin.dma.fragsize, user_arg); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (file->f_mode & FMODE_READ) { as->usbin.dma.ossfragshift = val & 0xffff; @@ -2612,7 +2616,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int if ((file->f_mode & FMODE_READ && as->usbin.dma.subdivision) || (file->f_mode & FMODE_WRITE && as->usbout.dma.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, user_arg)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2623,15 +2627,17 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? as->usbin.dma.srate : as->usbout.dma.srate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? + as->usbin.dma.srate : as->usbout.dma.srate, + user_arg); case SOUND_PCM_READ_CHANNELS: val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; - return put_user(AFMT_ISSTEREO(val2) ? 2 : 1, (int *)arg); + return put_user(AFMT_ISSTEREO(val2) ? 2 : 1, user_arg); case SOUND_PCM_READ_BITS: val2 = (file->f_mode & FMODE_READ) ? as->usbin.dma.format : as->usbout.dma.format; - return put_user(AFMT_IS16BIT(val2) ? 16 : 8, (int *)arg); + return put_user(AFMT_IS16BIT(val2) ? 16 : 8, user_arg); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0c2ca79b5..e4c5c6d9f 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -27,6 +27,7 @@ * v0.22 - probe only the control interface. if usbcore doesn't choose the * config we want, sysadmin changes bConfigurationValue in sysfs. * v0.23 - use softirq for rx processing, as needed by tty layer + * v0.24 - change probe method to evaluate CDC union descriptor */ /* @@ -60,6 +61,8 @@ #include #include +#include "cdc-acm.h" + /* * Version Information */ @@ -67,102 +70,12 @@ #define DRIVER_AUTHOR "Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik" #define DRIVER_DESC "USB Abstract Control Model driver for USB modems and ISDN adapters" -/* - * CMSPAR, some architectures can't have space and mark parity. - */ - -#ifndef CMSPAR -#define CMSPAR 0 -#endif - -/* - * Major and minor numbers. - */ - -#define ACM_TTY_MAJOR 166 -#define ACM_TTY_MINORS 32 - -/* - * Requests. - */ - -#define USB_RT_ACM (USB_TYPE_CLASS | USB_RECIP_INTERFACE) - -#define ACM_REQ_COMMAND 0x00 -#define ACM_REQ_RESPONSE 0x01 -#define ACM_REQ_SET_FEATURE 0x02 -#define ACM_REQ_GET_FEATURE 0x03 -#define ACM_REQ_CLEAR_FEATURE 0x04 - -#define ACM_REQ_SET_LINE 0x20 -#define ACM_REQ_GET_LINE 0x21 -#define ACM_REQ_SET_CONTROL 0x22 -#define ACM_REQ_SEND_BREAK 0x23 - -/* - * IRQs. - */ - -#define ACM_IRQ_NETWORK 0x00 -#define ACM_IRQ_LINE_STATE 0x20 - -/* - * Output control lines. - */ - -#define ACM_CTRL_DTR 0x01 -#define ACM_CTRL_RTS 0x02 - -/* - * Input control lines and line errors. - */ - -#define ACM_CTRL_DCD 0x01 -#define ACM_CTRL_DSR 0x02 -#define ACM_CTRL_BRK 0x04 -#define ACM_CTRL_RI 0x08 - -#define ACM_CTRL_FRAMING 0x10 -#define ACM_CTRL_PARITY 0x20 -#define ACM_CTRL_OVERRUN 0x40 - -/* - * Line speed and caracter encoding. - */ - -struct acm_line { - __u32 speed; - __u8 stopbits; - __u8 parity; - __u8 databits; -} __attribute__ ((packed)); - -/* - * Internal driver structures. - */ - -struct acm { - struct usb_device *dev; /* the corresponding usb device */ - struct usb_interface *control; /* control interface */ - struct usb_interface *data; /* data interface */ - struct tty_struct *tty; /* the corresponding tty */ - struct urb *ctrlurb, *readurb, *writeurb; /* urbs */ - struct acm_line line; /* line coding (bits, stop, parity) */ - struct work_struct work; /* work queue entry for line discipline waking up */ - struct tasklet_struct bh; /* rx processing */ - unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ - unsigned int ctrlout; /* output control lines (DTR, RTS) */ - unsigned int writesize; /* max packet size for the output bulk endpoint */ - unsigned int used; /* someone has this acm's device open */ - unsigned int minor; /* acm minor number */ - unsigned char throttle; /* throttled by tty layer */ - unsigned char clocal; /* termios CLOCAL */ -}; - static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static DECLARE_MUTEX(open_sem); + #define ACM_READY(acm) (acm && acm->dev && acm->used) /* @@ -310,12 +223,14 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) struct acm *acm = (struct acm *)urb->context; if (!ACM_READY(acm)) - return; + goto out; if (urb->status) dbg("nonzero write bulk status received: %d", urb->status); schedule_work(&acm->work); +out: + acm->ready_for_write = 1; } static void acm_softint(void *private) @@ -346,22 +261,23 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) tty->driver_data = acm; acm->tty = tty; - lock_kernel(); + down(&open_sem); - if (acm->used++) { - unlock_kernel(); - return 0; + if (acm->used) { + goto done; } - unlock_kernel(); - acm->ctrlurb->dev = acm->dev; - if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) + if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { dbg("usb_submit_urb(ctrl irq) failed"); + goto bail_out; + } acm->readurb->dev = acm->dev; - if (usb_submit_urb(acm->readurb, GFP_KERNEL)) + if (usb_submit_urb(acm->readurb, GFP_KERNEL)) { dbg("usb_submit_urb(read bulk) failed"); + goto bail_out_and_unlink; + } acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS); @@ -369,7 +285,16 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) otherwise it is scheduled, and with high data rates data can get lost. */ tty->low_latency = 1; +done: + acm->used++; + up(&open_sem); return 0; + +bail_out_and_unlink: + usb_unlink_urb(acm->ctrlurb); +bail_out: + up(&open_sem); + return -EIO; } static void acm_tty_close(struct tty_struct *tty, struct file *filp) @@ -379,6 +304,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) if (!acm || !acm->used) return; + down(&open_sem); if (!--acm->used) { if (acm->dev) { acm_set_control(acm, acm->ctrlout = 0); @@ -394,6 +320,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) kfree(acm); } } + up(&open_sem); } static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count) @@ -403,7 +330,7 @@ static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned c if (!ACM_READY(acm)) return -EINVAL; - if (acm->writeurb->status == -EINPROGRESS) + if (!acm->ready_for_write) return 0; if (!count) return 0; @@ -419,10 +346,11 @@ static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned c acm->writeurb->transfer_buffer_length = count; acm->writeurb->dev = acm->dev; - /* GFP_KERNEL probably works if from_user */ - stat = usb_submit_urb(acm->writeurb, GFP_ATOMIC); + acm->ready_for_write = 0; + stat = usb_submit_urb(acm->writeurb, GFP_NOIO); if (stat < 0) { dbg("usb_submit_urb(write bulk) failed"); + acm->ready_for_write = 1; return stat; } @@ -434,7 +362,7 @@ static int acm_tty_write_room(struct tty_struct *tty) struct acm *acm = tty->driver_data; if (!ACM_READY(acm)) return -EINVAL; - return acm->writeurb->status == -EINPROGRESS ? 0 : acm->writesize; + return !acm->ready_for_write ? 0 : acm->writesize; } static int acm_tty_chars_in_buffer(struct tty_struct *tty) @@ -442,7 +370,7 @@ static int acm_tty_chars_in_buffer(struct tty_struct *tty) struct acm *acm = tty->driver_data; if (!ACM_READY(acm)) return -EINVAL; - return acm->writeurb->status == -EINPROGRESS ? acm->writeurb->transfer_buffer_length : 0; + return !acm->ready_for_write ? acm->writeurb->transfer_buffer_length : 0; } static void acm_tty_throttle(struct tty_struct *tty) @@ -567,77 +495,102 @@ static void acm_tty_set_termios(struct tty_struct *tty, struct termios *termios_ * USB probe and disconnect routines. */ -#define CHECK_XFERTYPE(descr, xfer_type) (((descr)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == xfer_type) - static int acm_probe (struct usb_interface *intf, const struct usb_device_id *id) { - struct usb_device *dev; + struct union_desc *union_header = NULL; + char *buffer = intf->altsetting->extra; + int buflen = intf->altsetting->extralen; + struct usb_interface *control_interface; + struct usb_interface *data_interface; + struct usb_endpoint_descriptor *epctrl; + struct usb_endpoint_descriptor *epread; + struct usb_endpoint_descriptor *epwrite; + struct usb_device *usb_dev = interface_to_usbdev(intf); struct acm *acm; - struct usb_host_config *cfacm; - struct usb_interface *data = NULL; - struct usb_host_interface *ifcom, *ifdata = NULL; - struct usb_endpoint_descriptor *epctrl = NULL; - struct usb_endpoint_descriptor *epread = NULL; - struct usb_endpoint_descriptor *epwrite = NULL; - int readsize, ctrlsize, minor, j; - unsigned char *buf; - - dev = interface_to_usbdev (intf); - - cfacm = dev->actconfig; - - /* We know we're probe()d with the control interface. */ - ifcom = intf->cur_altsetting; - - /* ACM doesn't guarantee the data interface is - * adjacent to the control interface, or that if one - * is there it's not for call management ... so find - * it - */ - for (j = 0; j < cfacm->desc.bNumInterfaces; j++) { - ifdata = cfacm->interface[j]->cur_altsetting; - data = cfacm->interface[j]; - - if (ifdata->desc.bInterfaceClass == USB_CLASS_CDC_DATA - && ifdata->desc.bNumEndpoints == 2) { - - epctrl = &ifcom->endpoint[0].desc; - epread = &ifdata->endpoint[0].desc; - epwrite = &ifdata->endpoint[1].desc; - - if ((epctrl->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN - || !CHECK_XFERTYPE(epctrl, USB_ENDPOINT_XFER_INT) - || !CHECK_XFERTYPE(epread, USB_ENDPOINT_XFER_BULK) - || !CHECK_XFERTYPE(epwrite, USB_ENDPOINT_XFER_BULK) - || ((epread->bEndpointAddress & USB_DIR_IN) - ^ (epwrite->bEndpointAddress & USB_DIR_IN)) != USB_DIR_IN) { - /* not suitable */ - goto next_interface; - } - - if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { - /* descriptors are swapped */ - epread = &ifdata->endpoint[1].desc; - epwrite = &ifdata->endpoint[0].desc; - } - dev_dbg(&intf->dev, "found data interface at %d\n", j); - break; - } else { -next_interface: - ifdata = NULL; - data = NULL; + int minor; + int ctrlsize,readsize; + char *buf; + + if (!buffer) { + err("Wierd descriptor references"); + return -EINVAL; + } + + while (buflen > 0) { + if (buffer [1] != USB_DT_CS_INTERFACE) { + err("skipping garbage"); + goto next_desc; } + + switch (buffer [2]) { + case CDC_UNION_TYPE: /* we've found it */ + if (union_header) { + err("More than one union descriptor, skipping ..."); + goto next_desc; + } + union_header = (struct union_desc *)buffer; + break; + default: + err("Ignoring extra header"); + break; + } +next_desc: + buflen -= buffer[0]; + buffer += buffer[0]; + } + + if (!union_header) { + dev_dbg(&intf->dev,"No union descriptor, giving up\n"); + return -ENODEV; } - /* there's been a problem */ - if (!ifdata) { - dev_dbg(&intf->dev, "data interface not found\n"); + control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); + data_interface = usb_ifnum_to_if(usb_dev, union_header->bSlaveInterface0); + if (!control_interface || !data_interface) { + dev_dbg(&intf->dev,"no interfaces\n"); return -ENODEV; + } + + if (usb_interface_claimed(data_interface)) { /* valid in this context */ + dev_dbg(&intf->dev,"The data interface isn't available\n"); + return -EBUSY; + } + + /*workaround for switched interfaces */ + if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { + if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { + struct usb_interface *t; + dev_dbg(&intf->dev,"Your device has switched interfaces.\n"); + t = control_interface; + control_interface = data_interface; + data_interface = t; + } else { + return -EINVAL; + } } + if (data_interface->cur_altsetting->desc.bNumEndpoints < 2) + return -EINVAL; + + epctrl = &control_interface->cur_altsetting->endpoint[0].desc; + epread = &data_interface->cur_altsetting->endpoint[0].desc; + epwrite = &data_interface->cur_altsetting->endpoint[1].desc; + + /* workaround for switched endpoints */ + if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { + /* descriptors are swapped */ + struct usb_endpoint_descriptor *t; + dev_dbg(&intf->dev,"The data interface has switched endpoints\n"); + + t = epread; + epread = epwrite; + epwrite = t; + } + dbg("interfaces are valid"); for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++); + if (acm_table[minor]) { err("no more free acm devices"); return -ENODEV; @@ -647,20 +600,21 @@ next_interface: dev_dbg(&intf->dev, "out of memory (acm kmalloc)\n"); return -ENOMEM; } - memset(acm, 0, sizeof(struct acm)); ctrlsize = epctrl->wMaxPacketSize; readsize = epread->wMaxPacketSize; acm->writesize = epwrite->wMaxPacketSize; - acm->control = intf; - acm->data = data; + acm->control = control_interface; + acm->data = data_interface; acm->minor = minor; - acm->dev = dev; + acm->dev = usb_dev; acm->bh.func = acm_rx_tasklet; acm->bh.data = (unsigned long) acm; INIT_WORK(&acm->work, acm_softint, acm); + acm->ready_for_write = 1; + if (!(buf = kmalloc(ctrlsize + readsize + acm->writesize, GFP_KERNEL))) { dev_dbg(&intf->dev, "out of memory (buf kmalloc)\n"); @@ -693,29 +647,17 @@ next_interface: return -ENOMEM; } - usb_fill_int_urb(acm->ctrlurb, dev, usb_rcvintpipe(dev, epctrl->bEndpointAddress), - buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval); + usb_fill_int_urb(acm->ctrlurb, usb_dev, usb_rcvintpipe(usb_dev, epctrl->bEndpointAddress), + buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval); - usb_fill_bulk_urb(acm->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress), - buf += ctrlsize, readsize, acm_read_bulk, acm); + usb_fill_bulk_urb(acm->readurb, usb_dev, usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress), + buf += ctrlsize, readsize, acm_read_bulk, acm); acm->readurb->transfer_flags |= URB_NO_FSBR; - usb_fill_bulk_urb(acm->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress), - buf += readsize, acm->writesize, acm_write_bulk, acm); + usb_fill_bulk_urb(acm->writeurb, usb_dev, usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), + buf += readsize, acm->writesize, acm_write_bulk, acm); acm->writeurb->transfer_flags |= URB_NO_FSBR; - if ( (j = usb_driver_claim_interface(&acm_driver, data, acm)) != 0) { - err("claim failed"); - usb_free_urb(acm->ctrlurb); - usb_free_urb(acm->readurb); - usb_free_urb(acm->writeurb); - kfree(acm); - kfree(buf); - return j; - } - - tty_register_device(acm_tty_driver, minor, &intf->dev); - dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor); acm_set_control(acm, acm->ctrlout); @@ -724,11 +666,14 @@ next_interface: acm->line.databits = 8; acm_set_line(acm, &acm->line); + usb_driver_claim_interface(&acm_driver, data_interface, acm); + + tty_register_device(acm_tty_driver, minor, &intf->dev); + acm_table[minor] = acm; usb_set_intfdata (intf, acm); return 0; } -#undef CHECK_XFERTYPE static void acm_disconnect(struct usb_interface *intf) { @@ -746,6 +691,8 @@ static void acm_disconnect(struct usb_interface *intf) usb_unlink_urb(acm->readurb); usb_unlink_urb(acm->writeurb); + flush_scheduled_work(); /* wait for acm_softint */ + kfree(acm->ctrlurb->transfer_buffer); usb_driver_release_interface(&acm_driver, acm->data); diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 8836be095..20a717fac 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -75,6 +75,7 @@ #define IOCNR_HP_SET_CHANNEL 4 #define IOCNR_GET_BUS_ADDRESS 5 #define IOCNR_GET_VID_PID 6 +#define IOCNR_SOFT_RESET 7 /* Get device_id string: */ #define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len) /* The following ioctls were added for http://hpoj.sourceforge.net: */ @@ -90,6 +91,8 @@ #define LPIOC_GET_BUS_ADDRESS(len) _IOC(_IOC_READ, 'P', IOCNR_GET_BUS_ADDRESS, len) /* Get two-int array: [0]=vendor ID, [1]=product ID: */ #define LPIOC_GET_VID_PID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_VID_PID, len) +/* Perform class specific soft reset */ +#define LPIOC_SOFT_RESET _IOC(_IOC_NONE, 'P', IOCNR_SOFT_RESET, 0); /* * A DEVICE_ID string may include the printer's serial number. @@ -587,6 +590,13 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, usblp->minor, twoints[0], twoints[1]); break; + case IOCNR_SOFT_RESET: + if (_IOC_DIR(cmd) != _IOC_NONE) { + retval = -EINVAL; + goto done; + } + retval = usblp_reset(usblp); + break; default: retval = -ENOTTY; } @@ -761,6 +771,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, usblp->minor, usblp->readurb->status); usblp->readurb->dev = usblp->dev; usblp->readcount = 0; + usblp->rcomplete = 0; if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0) dbg("error submitting urb"); count = -EIO; diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 30b4378aa..5541363b6 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c @@ -589,6 +589,8 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbyte bus = list_entry(buslist, struct usb_bus, bus_list); /* recurse through all children of the root hub */ + if (!bus->root_hub) + continue; down(&bus->root_hub->serialize); ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, bus->root_hub, bus, 0, 0, 0); up(&bus->root_hub->serialize); diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 734ba0a0c..3b7f08900 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -558,7 +558,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) if (usbfs_snoop) { dev_info(&dev->dev, "control read: data "); for (j = 0; j < ctrl.wLength; ++j) - printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]); + printk ("%02x ", (unsigned char)(tbuf)[j]); printk("\n"); } if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { @@ -578,7 +578,7 @@ static int proc_control(struct dev_state *ps, void __user *arg) if (usbfs_snoop) { dev_info(&dev->dev, "control write: data: "); for (j = 0; j < ctrl.wLength; ++j) - printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]); + printk ("%02x ", (unsigned char)(tbuf)[j]); printk("\n"); } i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, @@ -719,7 +719,7 @@ static int proc_connectinfo(struct dev_state *ps, void __user *arg) static int proc_resetdevice(struct dev_state *ps) { - return usb_reset_device(ps->dev); + return __usb_reset_device(ps->dev); } @@ -862,7 +862,7 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg) isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets; if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) return -ENOMEM; - if (copy_from_user(isopkt, &((struct usbdevfs_urb *)arg)->iso_frame_desc, isofrmlen)) { + if (copy_from_user(isopkt, &((struct usbdevfs_urb __user *)arg)->iso_frame_desc, isofrmlen)) { kfree(isopkt); return -EFAULT; } @@ -1023,7 +1023,7 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg) free_async(as); if (ret) return ret; - if (put_user(addr, (void **)arg)) + if (put_user(addr, (void __user * __user *)arg)) return -EFAULT; return 0; } @@ -1045,7 +1045,7 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) free_async(as); if (ret) return ret; - if (put_user(addr, (void **)arg)) + if (put_user(addr, (void __user * __user *)arg)) return -EFAULT; return 0; } @@ -1174,6 +1174,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd { struct dev_state *ps = (struct dev_state *)file->private_data; struct usb_device *dev = ps->dev; + void __user *p = (void __user *)arg; int ret = -ENOTTY; if (!(file->f_mode & FMODE_WRITE)) @@ -1187,21 +1188,21 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case USBDEVFS_CONTROL: snoop(&dev->dev, "%s: CONTROL\n", __FUNCTION__); - ret = proc_control(ps, (void __user *)arg); + ret = proc_control(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_BULK: snoop(&dev->dev, "%s: BULK\n", __FUNCTION__); - ret = proc_bulk(ps, (void __user *)arg); + ret = proc_bulk(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_RESETEP: snoop(&dev->dev, "%s: RESETEP\n", __FUNCTION__); - ret = proc_resetep(ps, (void __user *)arg); + ret = proc_resetep(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; @@ -1213,71 +1214,71 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd case USBDEVFS_CLEAR_HALT: snoop(&dev->dev, "%s: CLEAR_HALT\n", __FUNCTION__); - ret = proc_clearhalt(ps, (void __user *)arg); + ret = proc_clearhalt(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_GETDRIVER: snoop(&dev->dev, "%s: GETDRIVER\n", __FUNCTION__); - ret = proc_getdriver(ps, (void __user *)arg); + ret = proc_getdriver(ps, p); break; case USBDEVFS_CONNECTINFO: snoop(&dev->dev, "%s: CONNECTINFO\n", __FUNCTION__); - ret = proc_connectinfo(ps, (void __user *)arg); + ret = proc_connectinfo(ps, p); break; case USBDEVFS_SETINTERFACE: snoop(&dev->dev, "%s: SETINTERFACE\n", __FUNCTION__); - ret = proc_setintf(ps, (void __user *)arg); + ret = proc_setintf(ps, p); break; case USBDEVFS_SETCONFIGURATION: snoop(&dev->dev, "%s: SETCONFIGURATION\n", __FUNCTION__); - ret = proc_setconfig(ps, (void __user *)arg); + ret = proc_setconfig(ps, p); break; case USBDEVFS_SUBMITURB: snoop(&dev->dev, "%s: SUBMITURB\n", __FUNCTION__); - ret = proc_submiturb(ps, (void __user *)arg); + ret = proc_submiturb(ps, p); if (ret >= 0) inode->i_mtime = CURRENT_TIME; break; case USBDEVFS_DISCARDURB: snoop(&dev->dev, "%s: DISCARDURB\n", __FUNCTION__); - ret = proc_unlinkurb(ps, (void __user *)arg); + ret = proc_unlinkurb(ps, p); break; case USBDEVFS_REAPURB: snoop(&dev->dev, "%s: REAPURB\n", __FUNCTION__); - ret = proc_reapurb(ps, (void __user *)arg); + ret = proc_reapurb(ps, p); break; case USBDEVFS_REAPURBNDELAY: snoop(&dev->dev, "%s: REAPURBDELAY\n", __FUNCTION__); - ret = proc_reapurbnonblock(ps, (void __user *)arg); + ret = proc_reapurbnonblock(ps, p); break; case USBDEVFS_DISCSIGNAL: snoop(&dev->dev, "%s: DISCSIGNAL\n", __FUNCTION__); - ret = proc_disconnectsignal(ps, (void __user *)arg); + ret = proc_disconnectsignal(ps, p); break; case USBDEVFS_CLAIMINTERFACE: snoop(&dev->dev, "%s: CLAIMINTERFACE\n", __FUNCTION__); - ret = proc_claiminterface(ps, (void __user *)arg); + ret = proc_claiminterface(ps, p); break; case USBDEVFS_RELEASEINTERFACE: snoop(&dev->dev, "%s: RELEASEINTERFACE\n", __FUNCTION__); - ret = proc_releaseinterface(ps, (void __user *)arg); + ret = proc_releaseinterface(ps, p); break; case USBDEVFS_IOCTL: snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); - ret = proc_ioctl(ps, (void __user *) arg); + ret = proc_ioctl(ps, p); break; } up(&dev->serialize); diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index da209adc3..3a710e037 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -229,7 +229,6 @@ EXPORT_SYMBOL (usb_hcd_pci_probe); void usb_hcd_pci_remove (struct pci_dev *dev) { struct usb_hcd *hcd; - struct usb_device *hub; hcd = pci_get_drvdata(dev); if (!hcd) @@ -239,12 +238,11 @@ void usb_hcd_pci_remove (struct pci_dev *dev) if (in_interrupt ()) BUG (); - hub = hcd->self.root_hub; if (HCD_IS_RUNNING (hcd->state)) hcd->state = USB_STATE_QUIESCING; dev_dbg (hcd->self.controller, "roothub graceful disconnect\n"); - usb_disconnect (&hub); + usb_disconnect (&hcd->self.root_hub); hcd->driver->stop (hcd); hcd_buffer_destroy (hcd); diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 04a8b324d..ecac9fac2 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -764,8 +764,9 @@ EXPORT_SYMBOL (usb_deregister_bus); * * The USB host controller calls this function to register the root hub * properly with the USB subsystem. It sets up the device properly in - * the device model tree, and then calls usb_new_device() to register the - * usb device. It also assigns the root hub's USB address (always 1). + * the device tree and stores the root_hub pointer in the bus structure, + * then calls usb_new_device() to register the usb device. It also + * assigns the root hub's USB address (always 1). */ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev) { @@ -777,7 +778,10 @@ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev memset (&usb_dev->bus->devmap.devicemap, 0, sizeof usb_dev->bus->devmap.devicemap); set_bit (devnum, usb_dev->bus->devmap.devicemap); - usb_dev->state = USB_STATE_ADDRESS; + usb_set_device_state(usb_dev, USB_STATE_ADDRESS); + + down (&usb_bus_list_lock); + usb_dev->bus->root_hub = usb_dev; usb_dev->epmaxpacketin[0] = usb_dev->epmaxpacketout[0] = 64; retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE); @@ -787,14 +791,15 @@ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev return (retval < 0) ? retval : -EMSGSIZE; } - (void) usb_get_dev (usb_dev); down (&usb_dev->serialize); retval = usb_new_device (usb_dev); - if (retval) + up (&usb_dev->serialize); + if (retval) { + usb_dev->bus->root_hub = NULL; dev_err (parent_dev, "can't register root hub for %s, %d\n", usb_dev->dev.bus_id, retval); - up (&usb_dev->serialize); - usb_put_dev (usb_dev); + } + up (&usb_bus_list_lock); return retval; } EXPORT_SYMBOL (usb_register_root_hub); @@ -1574,11 +1579,13 @@ static void hcd_panic (void *_hcd) unsigned i; /* hc's root hub is removed later removed in hcd->stop() */ - hub->state = USB_STATE_NOTATTACHED; + down (&hub->serialize); + usb_set_device_state(hub, USB_STATE_NOTATTACHED); for (i = 0; i < hub->maxchild; i++) { if (hub->children [i]) usb_disconnect (&hub->children [i]); } + up (&hub->serialize); } /** diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index f56fa8026..5d04c9b8d 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h @@ -244,17 +244,10 @@ extern struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *, unsigned port); extern int usb_new_device(struct usb_device *dev); extern void usb_disconnect(struct usb_device **); -extern void usb_choose_address(struct usb_device *dev); -extern void usb_release_address(struct usb_device *dev); -/* exported to hub driver ONLY to support usb_reset_device () */ extern int usb_get_configuration(struct usb_device *dev); extern void usb_destroy_configuration(struct usb_device *dev); -/* use these only before the device's address has been set */ -#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30)) -#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | USB_DIR_IN) - /*-------------------------------------------------------------------------*/ /* @@ -346,7 +339,8 @@ extern void usb_deregister_bus (struct usb_bus *); extern int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev); -static inline int hcd_register_root (struct usb_hcd *hcd) +static inline int hcd_register_root (struct usb_device *usb_dev, + struct usb_hcd *hcd) { /* hcd->driver->start() reported can_wakeup, probably with * assistance from board's boot firmware. @@ -356,8 +350,7 @@ static inline int hcd_register_root (struct usb_hcd *hcd) dev_dbg (hcd->self.controller, "supports USB remote wakeup\n"); hcd->remote_wakeup = hcd->can_wakeup; - return usb_register_root_hub ( - hcd_to_bus (hcd)->root_hub, hcd->self.controller); + return usb_register_root_hub (usb_dev, hcd->self.controller); } /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index cdade3278..592f289e5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -9,6 +9,11 @@ */ #include +#ifdef CONFIG_USB_DEBUG + #define DEBUG +#else + #undef DEBUG +#endif #include #include #include @@ -19,11 +24,6 @@ #include #include #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include #include @@ -36,11 +36,13 @@ #include "hcd.h" #include "hub.h" +/* Protect all struct usb_device state members */ +static spinlock_t device_state_lock = SPIN_LOCK_UNLOCKED; + /* Wakes up khubd */ static spinlock_t hub_event_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */ -static LIST_HEAD(hub_list); /* List of all hubs (for cleanup) */ static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); static pid_t khubd_pid = 0; /* PID of khubd */ @@ -229,6 +231,8 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs) { struct usb_hub *hub = (struct usb_hub *)urb->context; int status; + int i; + unsigned long bits; spin_lock(&hub_event_lock); hub->urb_active = 0; @@ -253,6 +257,11 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs) /* let khubd handle things */ case 0: /* we got data: port status changed */ + bits = 0; + for (i = 0; i < urb->actual_length; ++i) + bits |= ((unsigned long) ((*hub->buffer)[i])) + << (i*8); + hub->event_bits[0] = bits; break; } @@ -260,7 +269,7 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs) /* Something happened, let khubd figure it out */ if (list_empty(&hub->event_list)) { - list_add(&hub->event_list, &hub_event_list); + list_add_tail(&hub->event_list, &hub_event_list); wake_up(&khubd_wait); } @@ -268,7 +277,7 @@ resubmit: if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0 /* ENODEV means we raced disconnect() */ && status != -ENODEV) - dev_err (&hub->intf->dev, "resubmit --> %d\n", urb->status); + dev_err (&hub->intf->dev, "resubmit --> %d\n", status); if (status == 0) hub->urb_active = 1; done: @@ -632,7 +641,6 @@ static void hub_disconnect(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata (intf); DECLARE_COMPLETION(urb_complete); - unsigned long flags; if (!hub) return; @@ -641,17 +649,13 @@ static void hub_disconnect(struct usb_interface *intf) highspeed_hubs--; usb_set_intfdata (intf, NULL); - spin_lock_irqsave(&hub_event_lock, flags); + spin_lock_irq(&hub_event_lock); hub->urb_complete = &urb_complete; /* Delete it and then reset it */ list_del_init(&hub->event_list); - list_del_init(&hub->hub_list); - spin_unlock_irqrestore(&hub_event_lock, flags); - - down(&hub->khubd_sem); /* Wait for khubd to leave this hub alone. */ - up(&hub->khubd_sem); + spin_unlock_irq(&hub_event_lock); /* assuming we used keventd, it must quiesce too */ if (hub->has_indicators) @@ -695,7 +699,6 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) struct usb_device *hdev; struct usb_hub *hub; struct device *hub_dev; - unsigned long flags; desc = intf->cur_altsetting; hdev = interface_to_usbdev(intf); @@ -711,23 +714,19 @@ descriptor_error: } /* Multiple endpoints? What kind of mutant ninja-hub is this? */ - if (desc->desc.bNumEndpoints != 1) { + if (desc->desc.bNumEndpoints != 1) goto descriptor_error; - } endpoint = &desc->endpoint[0].desc; /* Output endpoint? Curiouser and curiouser.. */ - if (!(endpoint->bEndpointAddress & USB_DIR_IN)) { + if (!(endpoint->bEndpointAddress & USB_DIR_IN)) goto descriptor_error; - } /* If it's not an interrupt endpoint, we'd better punt! */ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - != USB_ENDPOINT_XFER_INT) { + != USB_ENDPOINT_XFER_INT) goto descriptor_error; - return -EIO; - } /* We found a hub */ dev_info (hub_dev, "USB hub found\n"); @@ -742,15 +741,8 @@ descriptor_error: INIT_LIST_HEAD(&hub->event_list); hub->intf = intf; - init_MUTEX(&hub->khubd_sem); INIT_WORK(&hub->leds, led_work, hub); - /* Record the new hub's existence */ - spin_lock_irqsave(&hub_event_lock, flags); - INIT_LIST_HEAD(&hub->hub_list); - list_add(&hub->hub_list, &hub_list); - spin_unlock_irqrestore(&hub_event_lock, flags); - usb_set_intfdata (intf, hub); if (hdev->speed == USB_SPEED_HIGH) @@ -827,6 +819,7 @@ static int hub_reset(struct usb_hub *hub) return 0; } +/* FIXME! This routine should be subsumed into hub_reset */ static void hub_start_disconnect(struct usb_device *hdev) { struct usb_device *parent = hdev->parent; @@ -845,6 +838,289 @@ static void hub_start_disconnect(struct usb_device *hdev) dev_err(&hdev->dev, "cannot disconnect hub!\n"); } + +static void recursively_mark_NOTATTACHED(struct usb_device *udev) +{ + int i; + + for (i = 0; i < udev->maxchild; ++i) { + if (udev->children[i]) + recursively_mark_NOTATTACHED(udev->children[i]); + } + udev->state = USB_STATE_NOTATTACHED; +} + +/** + * usb_set_device_state - change a device's current state (usbcore-internal) + * @udev: pointer to device whose state should be changed + * @new_state: new state value to be stored + * + * udev->state is _not_ protected by the udev->serialize semaphore. This + * is so that devices can be marked as disconnected as soon as possible, + * without having to wait for the semaphore to be released. Instead, + * changes to the state must be protected by the device_state_lock spinlock. + * + * Once a device has been added to the device tree, all changes to its state + * should be made using this routine. The state should _not_ be set directly. + * + * If udev->state is already USB_STATE_NOTATTACHED then no change is made. + * Otherwise udev->state is set to new_state, and if new_state is + * USB_STATE_NOTATTACHED then all of udev's descendant's states are also set + * to USB_STATE_NOTATTACHED. + */ +void usb_set_device_state(struct usb_device *udev, + enum usb_device_state new_state) +{ + unsigned long flags; + + spin_lock_irqsave(&device_state_lock, flags); + if (udev->state == USB_STATE_NOTATTACHED) + ; /* do nothing */ + else if (new_state != USB_STATE_NOTATTACHED) + udev->state = new_state; + else + recursively_mark_NOTATTACHED(udev); + spin_unlock_irqrestore(&device_state_lock, flags); +} + + +static void choose_address(struct usb_device *udev) +{ + int devnum; + struct usb_bus *bus = udev->bus; + + /* If khubd ever becomes multithreaded, this will need a lock */ + + /* Try to allocate the next devnum beginning at bus->devnum_next. */ + devnum = find_next_zero_bit(bus->devmap.devicemap, 128, + bus->devnum_next); + if (devnum >= 128) + devnum = find_next_zero_bit(bus->devmap.devicemap, 128, 1); + + bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1); + + if (devnum < 128) { + set_bit(devnum, bus->devmap.devicemap); + udev->devnum = devnum; + } +} + +static void release_address(struct usb_device *udev) +{ + if (udev->devnum > 0) { + clear_bit(udev->devnum, udev->bus->devmap.devicemap); + udev->devnum = -1; + } +} + +/** + * usb_disconnect - disconnect a device (usbcore-internal) + * @pdev: pointer to device being disconnected + * Context: !in_interrupt () + * + * Something got disconnected. Get rid of it, and all of its children. + * If *pdev is a normal device then the parent hub should be locked. + * If *pdev is a root hub then this routine will acquire the + * usb_bus_list_lock on behalf of the caller. + * + * Only hub drivers (including virtual root hub drivers for host + * controllers) should ever call this. + * + * This call is synchronous, and may not be used in an interrupt context. + */ +void usb_disconnect(struct usb_device **pdev) +{ + struct usb_device *udev = *pdev; + int i; + + if (!udev) { + pr_debug ("%s nodev\n", __FUNCTION__); + return; + } + + /* mark the device as inactive, so any further urb submissions for + * this device will fail. + */ + usb_set_device_state(udev, USB_STATE_NOTATTACHED); + + /* lock the bus list on behalf of HCDs unregistering their root hubs */ + if (!udev->parent) + down(&usb_bus_list_lock); + down(&udev->serialize); + + dev_info (&udev->dev, "USB disconnect, address %d\n", udev->devnum); + + /* Free up all the children before we remove this device */ + for (i = 0; i < USB_MAXCHILDREN; i++) { + if (udev->children[i]) + usb_disconnect(&udev->children[i]); + } + + /* deallocate hcd/hardware state ... nuking all pending urbs and + * cleaning up all state associated with the current configuration + */ + usb_disable_device(udev, 0); + + /* Free the device number, remove the /proc/bus/usb entry and + * the sysfs attributes, and delete the parent's children[] + * (or root_hub) pointer. + */ + dev_dbg (&udev->dev, "unregistering device\n"); + release_address(udev); + usbfs_remove_device(udev); + usb_remove_sysfs_dev_files(udev); + + /* Avoid races with recursively_mark_NOTATTACHED() */ + spin_lock_irq(&device_state_lock); + *pdev = NULL; + spin_unlock_irq(&device_state_lock); + + up(&udev->serialize); + if (!udev->parent) + up(&usb_bus_list_lock); + + device_unregister(&udev->dev); +} + +static int choose_configuration(struct usb_device *udev) +{ + int c, i; + + /* NOTE: this should interact with hub power budgeting */ + + c = udev->config[0].desc.bConfigurationValue; + if (udev->descriptor.bNumConfigurations != 1) { + for (i = 0; i < udev->descriptor.bNumConfigurations; i++) { + struct usb_interface_descriptor *desc; + + /* heuristic: Linux is more likely to have class + * drivers, so avoid vendor-specific interfaces. + */ + desc = &udev->config[i].intf_cache[0] + ->altsetting->desc; + if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) + continue; + /* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */ + if (desc->bInterfaceClass == USB_CLASS_COMM + && desc->bInterfaceSubClass == 2 + && desc->bInterfaceProtocol == 0xff) + continue; + c = udev->config[i].desc.bConfigurationValue; + break; + } + dev_info(&udev->dev, + "configuration #%d chosen from %d choices\n", + c, udev->descriptor.bNumConfigurations); + } + return c; +} + +#ifdef DEBUG +static void show_string(struct usb_device *udev, char *id, int index) +{ + char *buf; + + if (!index) + return; + if (!(buf = kmalloc(256, GFP_KERNEL))) + return; + if (usb_string(udev, index, buf, 256) > 0) + dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, buf); + kfree(buf); +} + +#else +static inline void show_string(struct usb_device *udev, char *id, int index) +{} +#endif + +/* + * usb_new_device - perform initial device setup (usbcore-internal) + * @udev: newly addressed device (in ADDRESS state) + * + * This is called with devices which have been enumerated, but not yet + * configured. The device descriptor is available, but not descriptors + * for any device configuration. The caller must have locked udev and + * either the parent hub (if udev is a normal device) or else the + * usb_bus_list_lock (if udev is a root hub). The parent's pointer to + * udev has already been installed, but udev is not yet visible through + * sysfs or other filesystem code. + * + * Returns 0 for success (device is configured and listed, with its + * interfaces, in sysfs); else a negative errno value. + * + * This call is synchronous, and may not be used in an interrupt context. + * + * Only the hub driver should ever call this; root hub registration + * uses it indirectly. + */ +int usb_new_device(struct usb_device *udev) +{ + int err; + int c; + + err = usb_get_configuration(udev); + if (err < 0) { + dev_err(&udev->dev, "can't read configurations, error %d\n", + err); + goto fail; + } + + /* Tell the world! */ + dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, " + "SerialNumber=%d\n", + udev->descriptor.iManufacturer, + udev->descriptor.iProduct, + udev->descriptor.iSerialNumber); + + if (udev->descriptor.iProduct) + show_string(udev, "Product", + udev->descriptor.iProduct); + if (udev->descriptor.iManufacturer) + show_string(udev, "Manufacturer", + udev->descriptor.iManufacturer); + if (udev->descriptor.iSerialNumber) + show_string(udev, "SerialNumber", + udev->descriptor.iSerialNumber); + + /* put device-specific files into sysfs */ + err = device_add (&udev->dev); + if (err) { + dev_err(&udev->dev, "can't device_add, error %d\n", err); + goto fail; + } + usb_create_sysfs_dev_files (udev); + + /* choose and set the configuration. that registers the interfaces + * with the driver core, and lets usb device drivers bind to them. + */ + c = choose_configuration(udev); + if (c < 0) + dev_warn(&udev->dev, + "can't choose an initial configuration\n"); + else { + err = usb_set_configuration(udev, c); + if (err) { + dev_err(&udev->dev, "can't set config #%d, error %d\n", + c, err); + usb_remove_sysfs_dev_files(udev); + device_del(&udev->dev); + goto fail; + } + } + + /* USB device state == configured ... usable */ + + /* add a /proc/bus/usb entry */ + usbfs_add_device(udev); + return 0; + +fail: + usb_set_device_state(udev, USB_STATE_NOTATTACHED); + return err; +} + + static int hub_port_status(struct usb_device *hdev, int port, u16 *status, u16 *change) { @@ -934,16 +1210,20 @@ static int hub_port_reset(struct usb_device *hdev, int port, /* Reset the port */ for (i = 0; i < PORT_RESET_TRIES; i++) { - set_port_feature(hdev, port + 1, USB_PORT_FEAT_RESET); + status = set_port_feature(hdev, port + 1, USB_PORT_FEAT_RESET); + if (status) + dev_err(hub_dev, "cannot reset port %d (err = %d)\n", + port + 1, status); + else + status = hub_port_wait_reset(hdev, port, udev, delay); /* return on disconnect or reset */ - status = hub_port_wait_reset(hdev, port, udev, delay); if (status == -ENOTCONN || status == 0) { clear_port_feature(hdev, port + 1, USB_PORT_FEAT_C_RESET); - udev->state = status + usb_set_device_state(udev, status ? USB_STATE_NOTATTACHED - : USB_STATE_DEFAULT; + : USB_STATE_DEFAULT); return status; } @@ -964,6 +1244,9 @@ static int hub_port_disable(struct usb_device *hdev, int port) { int ret; + if (hdev->children[port]) + usb_set_device_state(hdev->children[port], + USB_STATE_NOTATTACHED); ret = clear_port_feature(hdev, port + 1, USB_PORT_FEAT_ENABLE); if (ret) dev_err(hubdev(hdev), "cannot disable port %d (err = %d)\n", @@ -975,57 +1258,62 @@ static int hub_port_disable(struct usb_device *hdev, int port) /* USB 2.0 spec, 7.1.7.3 / fig 7-29: * * Between connect detection and reset signaling there must be a delay - * of 100ms at least for debounce and power-settling. The corresponding + * of 100ms at least for debounce and power-settling. The corresponding * timer shall restart whenever the downstream port detects a disconnect. * - * Apparently there are some bluetooth and irda-dongles and a number - * of low-speed devices which require longer delays of about 200-400ms. + * Apparently there are some bluetooth and irda-dongles and a number of + * low-speed devices for which this debounce period may last over a second. * Not covered by the spec - but easy to deal with. * - * This implementation uses 400ms minimum debounce timeout and checks - * every 25ms for transient disconnects to restart the delay. + * This implementation uses a 1500ms total debounce timeout; if the + * connection isn't stable by then it returns -ETIMEDOUT. It checks + * every 25ms for transient disconnects. When the port status has been + * unchanged for 100ms it returns the port status. */ -#define HUB_DEBOUNCE_TIMEOUT 400 -#define HUB_DEBOUNCE_STEP 25 -#define HUB_DEBOUNCE_STABLE 4 +#define HUB_DEBOUNCE_TIMEOUT 1500 +#define HUB_DEBOUNCE_STEP 25 +#define HUB_DEBOUNCE_STABLE 100 static int hub_port_debounce(struct usb_device *hdev, int port) { int ret; - int delay_time, stable_count; + int total_time, stable_time = 0; u16 portchange, portstatus; - unsigned connection; - - connection = 0; - stable_count = 0; - for (delay_time = 0; delay_time < HUB_DEBOUNCE_TIMEOUT; delay_time += HUB_DEBOUNCE_STEP) { - msleep(HUB_DEBOUNCE_STEP); + unsigned connection = 0xffff; + for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) { ret = hub_port_status(hdev, port, &portstatus, &portchange); if (ret < 0) return ret; - if ((portstatus & USB_PORT_STAT_CONNECTION) == connection) { - if (connection) { - if (++stable_count == HUB_DEBOUNCE_STABLE) - break; - } + if (!(portchange & USB_PORT_STAT_C_CONNECTION) && + (portstatus & USB_PORT_STAT_CONNECTION) == connection) { + stable_time += HUB_DEBOUNCE_STEP; + if (stable_time >= HUB_DEBOUNCE_STABLE) + break; } else { - stable_count = 0; + stable_time = 0; + connection = portstatus & USB_PORT_STAT_CONNECTION; } - connection = portstatus & USB_PORT_STAT_CONNECTION; - if ((portchange & USB_PORT_STAT_C_CONNECTION)) { - clear_port_feature(hdev, port+1, USB_PORT_FEAT_C_CONNECTION); + if (portchange & USB_PORT_STAT_C_CONNECTION) { + clear_port_feature(hdev, port+1, + USB_PORT_FEAT_C_CONNECTION); } + + if (total_time >= HUB_DEBOUNCE_TIMEOUT) + break; + msleep(HUB_DEBOUNCE_STEP); } dev_dbg (hubdev (hdev), - "debounce: port %d: delay %dms stable %d status 0x%x\n", - port + 1, delay_time, stable_count, portstatus); + "debounce: port %d: total %dms stable %dms status 0x%x\n", + port + 1, total_time, stable_time, portstatus); - return (portstatus & USB_PORT_STAT_CONNECTION) ? 0 : -ENOTCONN; + if (stable_time < HUB_DEBOUNCE_STABLE) + return -ETIMEDOUT; + return portstatus; } static int hub_set_address(struct usb_device *udev) @@ -1037,11 +1325,11 @@ static int hub_set_address(struct usb_device *udev) if (udev->state != USB_STATE_DEFAULT && udev->state != USB_STATE_ADDRESS) return -EINVAL; - retval = usb_control_msg(udev, usb_snddefctrl(udev), + retval = usb_control_msg(udev, (PIPE_CONTROL << 30) /* Address 0 */, USB_REQ_SET_ADDRESS, 0, udev->devnum, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT); if (retval == 0) - udev->state = USB_STATE_ADDRESS; + usb_set_device_state(udev, USB_STATE_ADDRESS); return retval; } @@ -1109,33 +1397,9 @@ hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port) udev->epmaxpacketin [0] = i; udev->epmaxpacketout[0] = i; - /* set the address */ - if (udev->devnum <= 0) { - usb_choose_address(udev); - if (udev->devnum <= 0) - goto fail; - - /* Set up TT records, if needed */ - if (hdev->tt) { - udev->tt = hdev->tt; - udev->ttport = hdev->ttport; - } else if (udev->speed != USB_SPEED_HIGH - && hdev->speed == USB_SPEED_HIGH) { - struct usb_hub *hub; - - hub = usb_get_intfdata (hdev->actconfig - ->interface[0]); - udev->tt = &hub->tt; - udev->ttport = port + 1; - } - - /* force the right log message (below) at low speed */ - oldspeed = USB_SPEED_UNKNOWN; - } - dev_info (&udev->dev, "%s %s speed USB device using address %d\n", - (oldspeed == USB_SPEED_UNKNOWN) ? "new" : "reset", + (udev->config) ? "reset" : "new", ({ char *speed; switch (udev->speed) { case USB_SPEED_LOW: speed = "low"; break; case USB_SPEED_FULL: speed = "full"; break; @@ -1143,6 +1407,19 @@ hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port) default: speed = "?"; break; }; speed;}), udev->devnum); + + /* Set up TT records, if needed */ + if (hdev->tt) { + udev->tt = hdev->tt; + udev->ttport = hdev->ttport; + } else if (udev->speed != USB_SPEED_HIGH + && hdev->speed == USB_SPEED_HIGH) { + struct usb_hub *hub; + + hub = usb_get_intfdata(hdev->actconfig->interface[0]); + udev->tt = &hub->tt; + udev->ttport = port + 1; + } /* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way? * Because device hardware and firmware is sometimes buggy in @@ -1164,12 +1441,7 @@ hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port) dev_err(&udev->dev, "device not accepting address %d, error %d\n", udev->devnum, retval); - fail: - hub_port_disable(hdev, port); - usb_release_address(udev); - usb_put_dev(udev); - up(&usb_address0_sem); - return retval; + goto fail; } /* cope with hardware quirkiness: @@ -1192,7 +1464,8 @@ hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port) if (udev->speed == USB_SPEED_FULL && (udev->epmaxpacketin [0] != udev->descriptor.bMaxPacketSize0)) { - usb_disable_endpoint(udev, 0); + usb_disable_endpoint(udev, 0 + USB_DIR_IN); + usb_disable_endpoint(udev, 0 + USB_DIR_OUT); usb_endpoint_running(udev, 0, 1); usb_endpoint_running(udev, 0, 0); udev->epmaxpacketin [0] = udev->descriptor.bMaxPacketSize0; @@ -1208,11 +1481,11 @@ hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port) goto fail; } - /* now dev is visible to other tasks */ - hdev->children[port] = udev; + retval = 0; +fail: up(&usb_address0_sem); - return 0; + return retval; } static void @@ -1271,7 +1544,14 @@ hub_power_remaining (struct usb_hub *hub, struct usb_device *hdev) } return remaining; } - + +/* Handle physical or logical connection change events. + * This routine is called when: + * a port connection-change occurs; + * a port enable-change occurs (often caused by EMI); + * usb_reset_device() encounters changed descriptors (as from + * a firmware download) + */ static void hub_port_connect_change(struct usb_hub *hub, int port, u16 portstatus, u16 portchange) { @@ -1282,9 +1562,6 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, dev_dbg (hub_dev, "port %d, status %04x, change %04x, %s\n", port + 1, portstatus, portchange, portspeed (portstatus)); - - /* Clear the connection change status */ - clear_port_feature(hdev, port + 1, USB_PORT_FEAT_C_CONNECTION); if (hub->has_indicators) { set_port_led(hdev, port + 1, HUB_LED_AUTO); @@ -1295,6 +1572,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, if (hdev->children[port]) usb_disconnect(&hdev->children[port]); + if (portchange & USB_PORT_STAT_C_CONNECTION) { + status = hub_port_debounce(hdev, port); + if (status < 0) { + dev_err (hub_dev, + "connect-debounce failed, port %d disabled\n", + port+1); + goto done; + } + portstatus = status; + } + /* Return now if nothing is connected */ if (!(portstatus & USB_PORT_STAT_CONNECTION)) { @@ -1308,13 +1596,6 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, goto done; return; } - - if (hub_port_debounce(hdev, port)) { - dev_err (hub_dev, - "connect-debounce failed, port %d disabled\n", - port+1); - goto done; - } for (i = 0; i < SET_CONFIG_TRIES; i++) { struct usb_device *udev; @@ -1328,21 +1609,26 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, "couldn't allocate port %d usb_device\n", port+1); goto done; } - udev->state = USB_STATE_POWERED; - + + usb_set_device_state(udev, USB_STATE_POWERED); + /* hub can tell if it's lowspeed already: D- pullup (not D+) */ if (portstatus & USB_PORT_STAT_LOW_SPEED) udev->speed = USB_SPEED_LOW; else udev->speed = USB_SPEED_UNKNOWN; + + /* set the address */ + choose_address(udev); + if (udev->devnum <= 0) { + status = -ENOTCONN; /* Don't retry */ + goto loop; + } - /* reset, set address, get descriptor, add to hub's children */ - down (&udev->serialize); + /* reset and get descriptor */ status = hub_port_init(hdev, udev, port); - if (status == -ENOTCONN) - break; if (status < 0) - continue; + goto loop; /* consecutive bus-powered hubs aren't reliable; they can * violate the voltage drop budget. if the new child has @@ -1358,7 +1644,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, &devstat); if (status < 0) { dev_dbg(&udev->dev, "get status %d ?\n", status); - continue; + goto loop; } cpu_to_le16s(&devstat); if ((devstat & (1 << USB_DEVICE_SELF_POWERED)) == 0) { @@ -1370,10 +1656,8 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, INDICATOR_AMBER_BLINK; schedule_work (&hub->leds); } - hdev->children[port] = NULL; - usb_put_dev(udev); - hub_port_disable(hdev, port); - return; + status = -ENOTCONN; /* Don't retry */ + goto loop; } } @@ -1383,13 +1667,37 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, && highspeed_hubs != 0) check_highspeed (hub, udev, port); + /* Store the parent's children[] pointer. At this point + * udev becomes globally accessible, although presumably + * no one will look at it until hdev is unlocked. + */ + down (&udev->serialize); + status = 0; + + /* We mustn't add new devices if the parent hub has + * been disconnected; we would race with the + * recursively_mark_NOTATTACHED() routine. + */ + spin_lock_irq(&device_state_lock); + if (hdev->state == USB_STATE_NOTATTACHED) + status = -ENOTCONN; + else + hdev->children[port] = udev; + spin_unlock_irq(&device_state_lock); + /* Run it through the hoops (find a driver, etc) */ - status = usb_new_device(udev); - if (status != 0) { - hdev->children[port] = NULL; - continue; + if (!status) { + status = usb_new_device(udev); + if (status) { + spin_lock_irq(&device_state_lock); + hdev->children[port] = NULL; + spin_unlock_irq(&device_state_lock); + } } + up (&udev->serialize); + if (status) + goto loop; status = hub_power_remaining(hub, hdev); if (status) @@ -1398,6 +1706,15 @@ static void hub_port_connect_change(struct usb_hub *hub, int port, 2 * status); return; + +loop: + hub_port_disable(hdev, port); + usb_disable_endpoint(udev, 0 + USB_DIR_IN); + usb_disable_endpoint(udev, 0 + USB_DIR_OUT); + release_address(udev); + usb_put_dev(udev); + if (status == -ENOTCONN) + break; } done: @@ -1406,7 +1723,6 @@ done: static void hub_events(void) { - unsigned long flags; struct list_head *tmp; struct usb_device *hdev; struct usb_hub *hub; @@ -1416,6 +1732,7 @@ static void hub_events(void) u16 portstatus; u16 portchange; int i, ret; + int connect_change; /* * We restart the list every time to avoid a deadlock with @@ -1424,24 +1741,32 @@ static void hub_events(void) * Not the most efficient, but avoids deadlocks. */ while (1) { - spin_lock_irqsave(&hub_event_lock, flags); - if (list_empty(&hub_event_list)) + /* Grab the first entry at the beginning of the list */ + spin_lock_irq(&hub_event_lock); + if (list_empty(&hub_event_list)) { + spin_unlock_irq(&hub_event_lock); break; + } - /* Grab the next entry from the beginning of the list */ tmp = hub_event_list.next; + list_del_init(tmp); hub = list_entry(tmp, struct usb_hub, event_list); hdev = interface_to_usbdev(hub->intf); hub_dev = &hub->intf->dev; - list_del_init(tmp); - - if (unlikely(down_trylock(&hub->khubd_sem))) - BUG(); /* never blocks, we were on list */ + usb_get_dev(hdev); + spin_unlock_irq(&hub_event_lock); - spin_unlock_irqrestore(&hub_event_lock, flags); + /* Lock the device, then check to see if we were + * disconnected while waiting for the lock to succeed. */ + down(&hdev->serialize); + if (hdev->state != USB_STATE_CONFIGURED || + !hdev->actconfig || + hub != usb_get_intfdata( + hdev->actconfig->interface[0])) + goto loop; if (hub->error) { dev_dbg (hub_dev, "resetting for error %d\n", @@ -1450,27 +1775,35 @@ static void hub_events(void) if (hub_reset(hub)) { dev_dbg (hub_dev, "can't reset; disconnecting\n"); - up(&hub->khubd_sem); hub_start_disconnect(hdev); - continue; + goto loop; } hub->nerrors = 0; hub->error = 0; } + /* deal with port status changes */ for (i = 0; i < hub->descriptor->bNbrPorts; i++) { + if (!test_and_clear_bit(i+1, hub->event_bits)) + continue; ret = hub_port_status(hdev, i, &portstatus, &portchange); - if (ret < 0) { + if (ret < 0) continue; - } + connect_change = 0; if (portchange & USB_PORT_STAT_C_CONNECTION) { - hub_port_connect_change(hub, i, portstatus, portchange); - } else if (portchange & USB_PORT_STAT_C_ENABLE) { - dev_dbg (hub_dev, - "port %d enable change, status %08x\n", - i + 1, portstatus); + clear_port_feature(hdev, + i + 1, USB_PORT_FEAT_C_CONNECTION); + connect_change = 1; + } + + if (portchange & USB_PORT_STAT_C_ENABLE) { + if (!connect_change) + dev_dbg (hub_dev, + "port %d enable change, " + "status %08x\n", + i + 1, portstatus); clear_port_feature(hdev, i + 1, USB_PORT_FEAT_C_ENABLE); @@ -1481,15 +1814,14 @@ static void hub_events(void) * Works at least with mouse driver. */ if (!(portstatus & USB_PORT_STAT_ENABLE) - && (portstatus & USB_PORT_STAT_CONNECTION) - && (hdev->children[i])) { + && !connect_change + && hdev->children[i]) { dev_err (hub_dev, "port %i " "disabled by hub (EMI?), " "re-enabling...", i + 1); - hub_port_connect_change(hub, - i, portstatus, portchange); + connect_change = 1; } } @@ -1517,10 +1849,16 @@ static void hub_events(void) clear_port_feature(hdev, i + 1, USB_PORT_FEAT_C_RESET); } + + if (connect_change) + hub_port_connect_change(hub, i, + portstatus, portchange); } /* end for i */ /* deal with hub status changes */ - if (hub_hub_status(hub, &hubstatus, &hubchange) < 0) + if (test_and_clear_bit(0, hub->event_bits) == 0) + ; /* do nothing */ + else if (hub_hub_status(hub, &hubstatus, &hubchange) < 0) dev_err (hub_dev, "get_hub_status failed\n"); else { if (hubchange & HUB_CHANGE_LOCAL_POWER) { @@ -1534,10 +1872,12 @@ static void hub_events(void) hub_power_on(hub); } } - up(&hub->khubd_sem); - } /* end while (1) */ - spin_unlock_irqrestore(&hub_event_lock, flags); +loop: + up(&hdev->serialize); + usb_put_dev(hdev); + + } /* end while (1) */ } static int hub_thread(void *__unused) @@ -1581,9 +1921,6 @@ static struct usb_driver hub_driver = { .id_table = hub_id_table, }; -/* - * This should be a separate module. - */ int usb_hub_init(void) { pid_t pid; @@ -1726,7 +2063,7 @@ int __usb_reset_device(struct usb_device *udev) udev->actconfig->desc.bConfigurationValue, ret); goto re_enumerate; } - udev->state = USB_STATE_CONFIGURED; + usb_set_device_state(udev, USB_STATE_CONFIGURED); for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { struct usb_interface *intf = udev->actconfig->interface[i]; @@ -1752,7 +2089,7 @@ int __usb_reset_device(struct usb_device *udev) re_enumerate: /* FIXME make some task re-enumerate; don't just mark unusable */ - udev->state = USB_STATE_NOTATTACHED; + hub_port_disable(parent, port); return -ENODEV; } EXPORT_SYMBOL(__usb_reset_device); diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index a24b1afa7..2fada0e11 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -202,11 +202,13 @@ struct usb_hub { int error; /* last reported error */ int nerrors; /* track consecutive errors */ - struct list_head hub_list; /* all hubs */ struct list_head event_list; /* hubs w/data or errs ready */ + unsigned long event_bits[1]; /* status change bitmask */ +#if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */ +#error event_bits[] is too short! +#endif struct usb_hub_descriptor *descriptor; /* class descriptor */ - struct semaphore khubd_sem; struct usb_tt tt; /* Transaction Translator */ u8 power_budget; /* in 2mA units; or zero */ @@ -216,4 +218,15 @@ struct usb_hub { struct work_struct leds; }; +/* use this for low-powered root hubs */ +static inline void +hub_set_power_budget (struct usb_device *hubdev, unsigned mA) +{ + struct usb_hub *hub; + + hub = (struct usb_hub *) + usb_get_intfdata (hubdev->actconfig->interface[0]); + hub->power_budget = min(mA,(unsigned)500)/2; +} + #endif /* __LINUX_HUB_H */ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 6304f2750..18a5da45e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -566,22 +566,19 @@ void usb_sg_cancel (struct usb_sg_request *io) */ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size) { - int i = 5; + int i; int result; memset(buf,0,size); // Make sure we parse really received data - while (i--) { + for (i = 0; i < 3; ++i) { /* retry on length 0 or stall; some devices are flakey */ - if ((result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), - USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, - (type << 8) + index, 0, buf, size, - HZ * USB_CTRL_GET_TIMEOUT)) > 0 - || result != -EPIPE) + result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, + (type << 8) + index, 0, buf, size, + HZ * USB_CTRL_GET_TIMEOUT); + if (!(result == 0 || result == -EPIPE)) break; - - dev_dbg (&dev->dev, "RETRY descriptor, result %d\n", result); - result = -ENOMSG; } return result; } @@ -830,6 +827,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) interface = dev->actconfig->interface[i]; dev_dbg (&dev->dev, "unregistering interface %s\n", interface->dev.bus_id); + usb_remove_sysfs_intf_files(interface); device_del (&interface->dev); } @@ -842,7 +840,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) } dev->actconfig = 0; if (dev->state == USB_STATE_CONFIGURED) - dev->state = USB_STATE_ADDRESS; + usb_set_device_state(dev, USB_STATE_ADDRESS); } } @@ -1047,7 +1045,7 @@ int usb_reset_configuration(struct usb_device *dev) config->desc.bConfigurationValue, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT); if (retval < 0) { - dev->state = USB_STATE_ADDRESS; + usb_set_device_state(dev, USB_STATE_ADDRESS); return retval; } @@ -1185,9 +1183,9 @@ free_interfaces: dev->actconfig = cp; if (!cp) - dev->state = USB_STATE_ADDRESS; + usb_set_device_state(dev, USB_STATE_ADDRESS); else { - dev->state = USB_STATE_CONFIGURED; + usb_set_device_state(dev, USB_STATE_CONFIGURED); /* Initialize the new interface structures and the * hc/hcd/usbcore interface/endpoint state. @@ -1322,7 +1320,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) */ err = usb_get_string(dev, dev->string_langid, index, tbuf, 2); - if (err == -EPIPE) { + if (err == -EPIPE || err == 0) { dev_dbg(&dev->dev, "RETRY string %d read/%d\n", index, 2); err = usb_get_string(dev, dev->string_langid, index, tbuf, 2); } @@ -1331,7 +1329,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) len=tbuf[0]; err = usb_get_string(dev, dev->string_langid, index, tbuf, len); - if (err == -EPIPE) { + if (err == -EPIPE || err == 0) { dev_dbg(&dev->dev, "RETRY string %d read/%d\n", index, len); err = usb_get_string(dev, dev->string_langid, index, tbuf, len); } diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 38c64f656..78c5ca2f1 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -2,8 +2,8 @@ * drivers/usb/core/sysfs.c * * (C) Copyright 2002 David Brownell - * (C) Copyright 2002 Greg Kroah-Hartman - * (C) Copyright 2002 IBM Corp. + * (C) Copyright 2002,2004 Greg Kroah-Hartman + * (C) Copyright 2002,2004 IBM Corp. * * All of the sysfs file attributes for usb devices and interfaces. * @@ -162,29 +162,35 @@ usb_descriptor_attr (bDeviceSubClass, "%02x\n") usb_descriptor_attr (bDeviceProtocol, "%02x\n") usb_descriptor_attr (bNumConfigurations, "%d\n") +static struct attribute *dev_attrs[] = { + /* current configuration's attributes */ + &dev_attr_bNumInterfaces.attr, + &dev_attr_bConfigurationValue.attr, + &dev_attr_bmAttributes.attr, + &dev_attr_bMaxPower.attr, + /* device attributes */ + &dev_attr_idVendor.attr, + &dev_attr_idProduct.attr, + &dev_attr_bcdDevice.attr, + &dev_attr_bDeviceClass.attr, + &dev_attr_bDeviceSubClass.attr, + &dev_attr_bDeviceProtocol.attr, + &dev_attr_bNumConfigurations.attr, + &dev_attr_speed.attr, + &dev_attr_devnum.attr, + &dev_attr_version.attr, + &dev_attr_maxchild.attr, + NULL, +}; +static struct attribute_group dev_attr_grp = { + .attrs = dev_attrs, +}; void usb_create_sysfs_dev_files (struct usb_device *udev) { struct device *dev = &udev->dev; - /* current configuration's attributes */ - device_create_file (dev, &dev_attr_bNumInterfaces); - device_create_file (dev, &dev_attr_bConfigurationValue); - device_create_file (dev, &dev_attr_bmAttributes); - device_create_file (dev, &dev_attr_bMaxPower); - - /* device attributes */ - device_create_file (dev, &dev_attr_idVendor); - device_create_file (dev, &dev_attr_idProduct); - device_create_file (dev, &dev_attr_bcdDevice); - device_create_file (dev, &dev_attr_bDeviceClass); - device_create_file (dev, &dev_attr_bDeviceSubClass); - device_create_file (dev, &dev_attr_bDeviceProtocol); - device_create_file (dev, &dev_attr_bNumConfigurations); - - /* speed varies depending on how you connect the device */ - device_create_file (dev, &dev_attr_speed); - // FIXME iff there are other speed configs, show how many + sysfs_create_group(&dev->kobj, &dev_attr_grp); if (udev->descriptor.iManufacturer) device_create_file (dev, &dev_attr_manufacturer); @@ -192,10 +198,20 @@ void usb_create_sysfs_dev_files (struct usb_device *udev) device_create_file (dev, &dev_attr_product); if (udev->descriptor.iSerialNumber) device_create_file (dev, &dev_attr_serial); +} + +void usb_remove_sysfs_dev_files (struct usb_device *udev) +{ + struct device *dev = &udev->dev; - device_create_file (dev, &dev_attr_devnum); - device_create_file (dev, &dev_attr_version); - device_create_file (dev, &dev_attr_maxchild); + sysfs_remove_group(&dev->kobj, &dev_attr_grp); + + if (udev->descriptor.iManufacturer) + device_remove_file(dev, &dev_attr_manufacturer); + if (udev->descriptor.iProduct) + device_remove_file(dev, &dev_attr_product); + if (udev->descriptor.iSerialNumber) + device_remove_file(dev, &dev_attr_serial); } /* Interface fields */ @@ -217,13 +233,26 @@ usb_intf_attr (bInterfaceSubClass, "%02x\n") usb_intf_attr (bInterfaceProtocol, "%02x\n") usb_intf_attr (iInterface, "%02x\n") +static struct attribute *intf_attrs[] = { + &dev_attr_bInterfaceNumber.attr, + &dev_attr_bAlternateSetting.attr, + &dev_attr_bNumEndpoints.attr, + &dev_attr_bInterfaceClass.attr, + &dev_attr_bInterfaceSubClass.attr, + &dev_attr_bInterfaceProtocol.attr, + &dev_attr_iInterface.attr, + NULL, +}; +static struct attribute_group intf_attr_grp = { + .attrs = intf_attrs, +}; + void usb_create_sysfs_intf_files (struct usb_interface *intf) { - device_create_file (&intf->dev, &dev_attr_bInterfaceNumber); - device_create_file (&intf->dev, &dev_attr_bAlternateSetting); - device_create_file (&intf->dev, &dev_attr_bNumEndpoints); - device_create_file (&intf->dev, &dev_attr_bInterfaceClass); - device_create_file (&intf->dev, &dev_attr_bInterfaceSubClass); - device_create_file (&intf->dev, &dev_attr_bInterfaceProtocol); - device_create_file (&intf->dev, &dev_attr_iInterface); + sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); +} + +void usb_remove_sysfs_intf_files (struct usb_interface *intf) +{ + sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp); } diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 3c2ddb5d0..3a16e07d0 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -883,6 +883,8 @@ struct usb_device *usb_find_device(u16 vendor_id, u16 product_id) buslist != &usb_bus_list; buslist = buslist->next) { bus = container_of(buslist, struct usb_bus, bus_list); + if (!bus->root_hub) + continue; dev = match_device(bus->root_hub, vendor_id, product_id); if (dev) goto exit; @@ -944,235 +946,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, return -1; } -/** - * usb_disconnect - disconnect a device (usbcore-internal) - * @pdev: pointer to device being disconnected - * Context: !in_interrupt () - * - * Something got disconnected. Get rid of it, and all of its children. - * - * Only hub drivers (including virtual root hub drivers for host - * controllers) should ever call this. - * - * This call is synchronous, and may not be used in an interrupt context. - */ -void usb_disconnect(struct usb_device **pdev) -{ - struct usb_device *dev = *pdev; - struct usb_bus *bus; - struct usb_operations *ops; - int i; - - might_sleep (); - - if (!dev) { - pr_debug ("%s nodev\n", __FUNCTION__); - return; - } - bus = dev->bus; - if (!bus) { - pr_debug ("%s nobus\n", __FUNCTION__); - return; - } - ops = bus->op; - - *pdev = NULL; - - /* mark the device as inactive, so any further urb submissions for - * this device will fail. - */ - dev->state = USB_STATE_NOTATTACHED; - down(&dev->serialize); - - dev_info (&dev->dev, "USB disconnect, address %d\n", dev->devnum); - - /* Free up all the children before we remove this device */ - for (i = 0; i < USB_MAXCHILDREN; i++) { - struct usb_device **child = dev->children + i; - if (*child) - usb_disconnect(child); - } - - /* deallocate hcd/hardware state ... nuking all pending urbs and - * cleaning up all state associated with the current configuration - */ - usb_disable_device(dev, 0); - - /* Free the device number and remove the /proc/bus/usb entry */ - dev_dbg (&dev->dev, "unregistering device\n"); - usb_release_address(dev); - usbfs_remove_device(dev); - up(&dev->serialize); - device_unregister(&dev->dev); -} - -/** - * usb_choose_address - pick device address (usbcore-internal) - * @dev: newly detected device (in DEFAULT state) - * - * Picks a device address. It's up to the hub (or root hub) driver - * to handle and manage enumeration, starting from the DEFAULT state. - * Only hub drivers (but not virtual root hub drivers for host - * controllers) should ever call this. - */ -void usb_choose_address(struct usb_device *dev) -{ - int devnum; - // FIXME needs locking for SMP!! - /* why? this is called only from the hub thread, - * which hopefully doesn't run on multiple CPU's simultaneously 8-) - */ - - /* Try to allocate the next devnum beginning at bus->devnum_next. */ - devnum = find_next_zero_bit(dev->bus->devmap.devicemap, 128, dev->bus->devnum_next); - if (devnum >= 128) - devnum = find_next_zero_bit(dev->bus->devmap.devicemap, 128, 1); - - dev->bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1); - - if (devnum < 128) { - set_bit(devnum, dev->bus->devmap.devicemap); - dev->devnum = devnum; - } -} - -/** - * usb_release_address - deallocate device address (usbcore-internal) - * @dev: newly removed device - * - * Removes and deallocates the address assigned to a device. - * Only hub drivers (but not virtual root hub drivers for host - * controllers) should ever call this. - */ -void usb_release_address(struct usb_device *dev) -{ - if (dev->devnum > 0) { - clear_bit(dev->devnum, dev->bus->devmap.devicemap); - dev->devnum = -1; - } -} - - -static inline void usb_show_string(struct usb_device *dev, char *id, int index) -{ - char *buf; - - if (!index) - return; - if (!(buf = kmalloc(256, GFP_KERNEL))) - return; - if (usb_string(dev, index, buf, 256) > 0) - dev_printk(KERN_INFO, &dev->dev, "%s: %s\n", id, buf); - kfree(buf); -} - -static int usb_choose_configuration(struct usb_device *dev) -{ - int c, i; - - c = dev->config[0].desc.bConfigurationValue; - if (dev->descriptor.bNumConfigurations != 1) { - for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { - struct usb_interface_descriptor *desc; - - /* heuristic: Linux is more likely to have class - * drivers, so avoid vendor-specific interfaces. - */ - desc = &dev->config[i].intf_cache[0] - ->altsetting->desc; - if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) - continue; - /* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */ - if (desc->bInterfaceClass == USB_CLASS_COMM - && desc->bInterfaceSubClass == 2 - && desc->bInterfaceProtocol == 0xff) - continue; - c = dev->config[i].desc.bConfigurationValue; - break; - } - dev_info(&dev->dev, - "configuration #%d chosen from %d choices\n", - c, dev->descriptor.bNumConfigurations); - } - return c; -} - -/* - * usb_new_device - perform initial device setup (usbcore-internal) - * @dev: newly addressed device (in ADDRESS state) - * - * This is called with devices which have been enumerated, but not yet - * configured. The device descriptor is available, but not descriptors - * for any device configuration. The caller owns dev->serialize, and - * the device is not visible through sysfs or other filesystem code. - * - * Returns 0 for success (device is configured and listed, with its - * interfaces, in sysfs); else a negative errno value. On error, one - * reference count to the device has been dropped. - * - * This call is synchronous, and may not be used in an interrupt context. - * - * Only the hub driver should ever call this; root hub registration - * uses it only indirectly. - */ -int usb_new_device(struct usb_device *dev) -{ - int err; - int c; - - err = usb_get_configuration(dev); - if (err < 0) { - dev_err(&dev->dev, "can't read configurations, error %d\n", - err); - goto fail; - } - - /* Tell the world! */ - dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n", - dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber); - -#ifdef DEBUG - if (dev->descriptor.iProduct) - usb_show_string(dev, "Product", dev->descriptor.iProduct); - if (dev->descriptor.iManufacturer) - usb_show_string(dev, "Manufacturer", dev->descriptor.iManufacturer); - if (dev->descriptor.iSerialNumber) - usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber); -#endif - - /* put device-specific files into sysfs */ - err = device_add (&dev->dev); - if (err) { - dev_err(&dev->dev, "can't device_add, error %d\n", err); - goto fail; - } - usb_create_sysfs_dev_files (dev); - - /* choose and set the configuration. that registers the interfaces - * with the driver core, and lets usb device drivers bind to them. - * NOTE: should interact with hub power budgeting. - */ - c = usb_choose_configuration(dev); - err = usb_set_configuration(dev, c); - if (err) { - dev_err(&dev->dev, "can't set config #%d, error %d\n", c, err); - device_del(&dev->dev); - goto fail; - } - - /* USB device state == configured ... usable */ - - /* add a /proc/bus/usb entry */ - usbfs_add_device(dev); - - return 0; -fail: - dev->state = USB_STATE_NOTATTACHED; - usb_release_address(dev); - usb_put_dev(dev); - return err; -} - /** * usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP * @dev: device the buffer will be used with diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 886b79daa..7d978af3a 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,7 +1,9 @@ /* Functions local to drivers/usb/core/ */ extern void usb_create_sysfs_dev_files (struct usb_device *dev); +extern void usb_remove_sysfs_dev_files (struct usb_device *dev); extern void usb_create_sysfs_intf_files (struct usb_interface *intf); +extern void usb_remove_sysfs_intf_files (struct usb_interface *intf); extern int usb_probe_interface (struct device *dev); extern int usb_unbind_interface (struct device *dev); @@ -19,5 +21,8 @@ extern int usb_get_device_descriptor(struct usb_device *dev, unsigned int size); extern int usb_set_configuration(struct usb_device *dev, int configuration); +extern void usb_set_device_state(struct usb_device *udev, + enum usb_device_state new_state); + /* for labeling diagnostics */ extern const char *usbcore_name; diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 5fd8ea6f6..0c99e0719 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -825,8 +825,7 @@ static int dummy_urb_enqueue ( dum = container_of (hcd, struct dummy, hcd); spin_lock_irqsave (&dum->lock, flags); - if (!dum->hdev) - dum->hdev = urb->dev->hcpriv; + dum->hdev = urb->dev->hcpriv; urb->hcpriv = dum; if (usb_pipetype (urb->pipe) == PIPE_CONTROL) urb->error_count = 1; /* mark as a new urb */ @@ -994,10 +993,17 @@ static int periodic_bytes (struct dummy *dum, struct dummy_ep *ep) return limit; } +#define is_active(dum) ((dum->port_status & \ + (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE | \ + USB_PORT_STAT_SUSPEND)) \ + == (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) + static struct dummy_ep *find_endpoint (struct dummy *dum, u8 address) { int i; + if (!is_active (dum)) + return NULL; if ((address & ~USB_DIR_IN) == 0) return &dum->ep [0]; for (i = 1; i < DUMMY_ENDPOINTS; i++) { @@ -1011,6 +1017,8 @@ static struct dummy_ep *find_endpoint (struct dummy *dum, u8 address) return NULL; } +#undef is_active + #define Dev_Request (USB_TYPE_STANDARD | USB_RECIP_DEVICE) #define Dev_InRequest (Dev_Request | USB_DIR_IN) #define Intf_Request (USB_TYPE_STANDARD | USB_RECIP_INTERFACE) @@ -1152,11 +1160,6 @@ restart: case USB_REQ_SET_ADDRESS: if (setup.bRequestType != Dev_Request) break; - if (dum->address != 0) { - maybe_set_status (urb, -ETIMEDOUT); - urb->actual_length = 0; - goto return_urb; - } dum->address = setup.wValue; maybe_set_status (urb, 0); dev_dbg (hardware, "set_address = %d\n", @@ -1404,9 +1407,8 @@ static int dummy_hub_control ( break; case USB_PORT_FEAT_POWER: dum->port_status = 0; - dum->address = 0; - dum->hdev = 0; dum->resuming = 0; + stop_activity(dum, dum->driver); break; default: dum->port_status &= ~(1 << wValue); @@ -1657,7 +1659,7 @@ clean0: INIT_LIST_HEAD (&hcd->dev_list); usb_register_bus (bus); - bus->root_hub = root = usb_alloc_dev (0, bus, 0); + root = usb_alloc_dev (0, bus, 0); if (!root) { retval = -ENOMEM; clean1: @@ -1671,14 +1673,16 @@ clean1: root->speed = USB_SPEED_HIGH; /* ...then configured, so khubd sees us. */ - if ((retval = hcd_register_root (&dum->hcd)) != 0) { - bus->root_hub = 0; + if ((retval = hcd_register_root (root, &dum->hcd)) != 0) { usb_put_dev (root); clean2: dum->hcd.state = USB_STATE_QUIESCING; goto clean1; } + /* only show a low-power port: just 8mA */ + hub_set_power_budget (root, 8); + dum->started = 1; if ((retval = dummy_register_udc (dum)) != 0) { diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 77262750f..a4bf49e1a 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -118,6 +118,7 @@ struct eth_dev { unsigned zlp:1; unsigned cdc:1; unsigned rndis:1; + unsigned suspended:1; u16 cdc_filter; unsigned long todo; #define WORK_RX_MEMORY 0 @@ -1345,24 +1346,23 @@ static void eth_setup_complete (struct usb_ep *ep, struct usb_request *req) static void rndis_response_complete (struct usb_ep *ep, struct usb_request *req) { - struct eth_dev *dev = ep->driver_data; - if (req->status || req->actual != req->length) DEBUG (dev, "rndis response complete --> %d, %d/%d\n", req->status, req->actual, req->length); /* done sending after CDC_GET_ENCAPSULATED_RESPONSE */ - rndis_free_response (dev->rndis_config, req->buf); } static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req) { struct eth_dev *dev = ep->driver_data; + int status; /* received RNDIS command from CDC_SEND_ENCAPSULATED_COMMAND */ spin_lock(&dev->lock); - if (rndis_msg_parser (dev->rndis_config, (u8 *) req->buf)) - ERROR(dev, "%s: rndis parse error\n", __FUNCTION__ ); + status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf); + if (status < 0) + ERROR(dev, "%s: rndis parse error %d\n", __FUNCTION__, status); spin_unlock(&dev->lock); } @@ -1580,6 +1580,7 @@ done_set_intf: if (buf) { memcpy (req->buf, buf, value); req->complete = rndis_response_complete; + rndis_free_response(dev->rndis_config, buf); } /* else stalls ... spec says to avoid that */ } @@ -1651,12 +1652,12 @@ static struct net_device_stats *eth_get_stats (struct net_device *net) return &((struct eth_dev *) net->priv)->stats; } -static int eth_ethtool_ioctl (struct net_device *net, void *useraddr) +static int eth_ethtool_ioctl (struct net_device *net, void __user *useraddr) { struct eth_dev *dev = (struct eth_dev *) net->priv; u32 cmd; - if (get_user (cmd, (u32 *)useraddr)) + if (get_user (cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -1694,7 +1695,7 @@ static int eth_ioctl (struct net_device *net, struct ifreq *rq, int cmd) { switch (cmd) { case SIOCETHTOOL: - return eth_ethtool_ioctl (net, (void *)rq->ifr_data); + return eth_ethtool_ioctl(net, rq->ifr_data); default: return -EOPNOTSUPP; } @@ -2064,6 +2065,16 @@ static void rndis_send_media_state (struct eth_dev *dev, int connect) } } +static void rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req) +{ + if (req->status || req->actual != req->length) + DEBUG (dev, "rndis control ack complete --> %d, %d/%d\n", + req->status, req->actual, req->length); + + usb_ep_free_buffer(ep, req->buf, req->dma, 8); + usb_ep_free_request(ep, req); +} + static int rndis_control_ack (struct net_device *net) { struct eth_dev *dev = (struct eth_dev *) net->priv; @@ -2095,7 +2106,7 @@ static int rndis_control_ack (struct net_device *net) * CDC_NOTIFY_RESPONSE_AVAILABLE should work too */ resp->length = 8; - resp->complete = rndis_response_complete; + resp->complete = rndis_control_ack_complete; *((u32 *) resp->buf) = __constant_cpu_to_le32 (1); *((u32 *) resp->buf + 1) = __constant_cpu_to_le32 (0); @@ -2103,7 +2114,7 @@ static int rndis_control_ack (struct net_device *net) length = usb_ep_queue (dev->status_ep, resp, GFP_ATOMIC); if (length < 0) { resp->status = 0; - rndis_response_complete (dev->status_ep, resp); + rndis_control_ack_complete (dev->status_ep, resp); } return 0; @@ -2302,17 +2313,6 @@ eth_bind (struct usb_gadget *gadget) UTS_SYSNAME " " UTS_RELEASE "/%s", gadget->name); - /* CDC subset ... recognized by Linux since 2.4.10, but Windows - * drivers aren't widely available. - */ - if (!cdc) { - device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; - device_desc.idVendor = - __constant_cpu_to_le16(SIMPLE_VENDOR_NUM); - device_desc.idProduct = - __constant_cpu_to_le16(SIMPLE_PRODUCT_NUM); - } - /* If there's an RNDIS configuration, that's what Windows wants to * be using ... so use these product IDs here and in the "linux.inf" * needed to install MSFT drivers. Current Linux kernels will use @@ -2326,6 +2326,16 @@ eth_bind (struct usb_gadget *gadget) __constant_cpu_to_le16(RNDIS_PRODUCT_NUM); snprintf (product_desc, sizeof product_desc, "RNDIS/%s", driver_desc); + + /* CDC subset ... recognized by Linux since 2.4.10, but Windows + * drivers aren't widely available. + */ + } else if (!cdc) { + device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; + device_desc.idVendor = + __constant_cpu_to_le16(SIMPLE_VENDOR_NUM); + device_desc.idProduct = + __constant_cpu_to_le16(SIMPLE_PRODUCT_NUM); } /* support optional vendor/distro customization */ @@ -2554,6 +2564,26 @@ fail: /*-------------------------------------------------------------------------*/ +static void +eth_suspend (struct usb_gadget *gadget) +{ + struct eth_dev *dev = get_gadget_data (gadget); + + DEBUG (dev, "suspend\n"); + dev->suspended = 1; +} + +static void +eth_resume (struct usb_gadget *gadget) +{ + struct eth_dev *dev = get_gadget_data (gadget); + + DEBUG (dev, "resume\n"); + dev->suspended = 0; +} + +/*-------------------------------------------------------------------------*/ + static struct usb_gadget_driver eth_driver = { #ifdef CONFIG_USB_GADGET_DUALSPEED .speed = USB_SPEED_HIGH, @@ -2567,6 +2597,9 @@ static struct usb_gadget_driver eth_driver = { .setup = eth_setup, .disconnect = eth_disconnect, + .suspend = eth_suspend, + .resume = eth_resume, + .driver = { .name = (char *) shortname, // .shutdown = ... diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 55f424691..df7eb892b 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -2501,7 +2501,7 @@ static int send_status(struct fsg_dev *fsg) /* Store and send the Bulk-only CSW */ csw->Signature = __constant_cpu_to_le32(USB_BULK_CS_SIG); csw->Tag = fsg->tag; - csw->Residue = fsg->residue; + csw->Residue = cpu_to_le32(fsg->residue); csw->Status = status; bh->inreq->length = USB_BULK_CS_WRAP_LEN; @@ -2947,7 +2947,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) fsg->data_dir = DATA_DIR_TO_HOST; else fsg->data_dir = DATA_DIR_FROM_HOST; - fsg->data_size = cbw->DataTransferLength; + fsg->data_size = le32_to_cpu(cbw->DataTransferLength); if (fsg->data_size == 0) fsg->data_dir = DATA_DIR_NONE; fsg->lun = cbw->Lun; @@ -3834,6 +3834,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) } /* Find all the endpoints we will use */ + usb_ep_autoconfig_reset(gadget); ep = usb_ep_autoconfig(gadget, &fs_bulk_in_desc); if (!ep) goto autoconf_fail; diff --git a/drivers/usb/gadget/ndis.h b/drivers/usb/gadget/ndis.h index 611eac8bb..c553bbf68 100644 --- a/drivers/usb/gadget/ndis.h +++ b/drivers/usb/gadget/ndis.h @@ -26,11 +26,41 @@ #define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B +enum NDIS_DEVICE_POWER_STATE { + NdisDeviceStateUnspecified = 0, + NdisDeviceStateD0, + NdisDeviceStateD1, + NdisDeviceStateD2, + NdisDeviceStateD3, + NdisDeviceStateMaximum +}; + +struct NDIS_PM_WAKE_UP_CAPABILITIES { + enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp; + enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp; + enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp; +}; + /* NDIS_PNP_CAPABILITIES.Flags constants */ #define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001 #define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002 #define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004 +struct NDIS_PNP_CAPABILITIES { + u32 Flags; + struct NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities; +}; + +struct NDIS_PM_PACKET_PATTERN { + u32 Priority; + u32 Reserved; + u32 MaskSize; + u32 PatternOffset; + u32 PatternSize; + u32 PatternFlags; +}; + + /* Required Object IDs (OIDs) */ #define OID_GEN_SUPPORTED_LIST 0x00010101 #define OID_GEN_HARDWARE_STATUS 0x00010102 diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 2ae830960..bc00e0771 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -1902,6 +1902,8 @@ static void ep0_start (struct net2280 *dev) , &dev->usb->stdrsp); writel ( (1 << USB_ROOT_PORT_WAKEUP_ENABLE) | (1 << SELF_POWERED_USB_DEVICE) + /* erratum 0102 workaround */ + | ((dev->chiprev == 0100) ? 0 : 1) << SUSPEND_IMMEDIATELY | (1 << REMOTE_WAKEUP_SUPPORT) | (1 << USB_DETECT_ENABLE) | (1 << SELF_POWERED_STATUS) @@ -1917,6 +1919,7 @@ static void ep0_start (struct net2280 *dev) | (1 << PCI_RETRY_ABORT_INTERRUPT_ENABLE) | (1 << VBUS_INTERRUPT_ENABLE) | (1 << ROOT_PORT_RESET_INTERRUPT_ENABLE) + | (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE) , &dev->regs->pciirqenb1); /* don't leave any writes posted */ @@ -2513,19 +2516,24 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat) return; } - /* NOTE: we don't actually suspend the hardware; that starts to - * interact with PCI power management, and needs something like a - * controller->suspend() call to clear SUSPEND_REQUEST_INTERRUPT. - * we shouldn't see resume interrupts. - * for rev 0100, this also avoids erratum 0102. + /* NOTE: chip stays in PCI D0 state for now, but it could + * enter D1 to save more power */ tmp = (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT); if (stat & tmp) { - if (dev->driver->suspend) - dev->driver->suspend (&dev->gadget); + writel (tmp, &dev->regs->irqstat1); + if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) { + if (dev->driver->suspend) + dev->driver->suspend (&dev->gadget); + /* we use SUSPEND_IMMEDIATELY */ + stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT); + } else { + if (dev->driver->resume) + dev->driver->resume (&dev->gadget); + /* at high speed, note erratum 0133 */ + } stat &= ~tmp; } - stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT); /* clear any other status/irqs */ if (stat) @@ -2533,6 +2541,7 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat) /* some status we can just ignore */ stat &= ~((1 << CONTROL_STATUS_INTERRUPT) + | (1 << SUSPEND_REQUEST_INTERRUPT) | (1 << RESUME_INTERRUPT) | (1 << SOF_INTERRUPT)); if (!stat) diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index fd4e8002e..05fc22d14 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -18,6 +18,9 @@ * * 03/25/2004 Kai-Uwe Bloem * Fixed rndis_rm_hdr length bug. + * + * Copyright (C) 2004 by David Brownell + * updates to merge with Linux 2.6, better match RNDIS spec */ #include @@ -35,28 +38,34 @@ #include #include + +#undef RNDIS_PM +#undef VERBOSE + #include "rndis.h" /* The driver for your USB chip needs to support ep0 OUT to work with - * RNDIS, plus the same three descriptors as CDC Ethernet. + * RNDIS, plus all three CDC Ethernet endpoints (interrupt not optional). * * Windows hosts need an INF file like Documentation/usb/linux.inf + * and will be happier if you provide the host_addr module parameter. */ -#ifndef __LITTLE_ENDIAN -#warning this code is missing all cpu_to_leXX() calls ... -#endif - #if 0 -#define DEBUG if (rndis_debug) printk +#define DEBUG(str,args...) do { \ + if (rndis_debug) \ + printk(KERN_DEBUG str , ## args ); \ + } while (0) static int rndis_debug = 0; module_param (rndis_debug, bool, 0); MODULE_PARM_DESC (rndis_debug, "enable debugging"); #else -#define DEBUG(str,args...) do{}while(0) + +#define rndis_debug 0 +#define DEBUG(str,args...) do{}while(0) #endif #define RNDIS_MAX_CONFIGS 1 @@ -79,16 +88,14 @@ static int rndis_keepalive_response (int configNr, static rndis_resp_t *rndis_add_response (int configNr, u32 length); -/* FIXME OMITTED OIDs, that RNDIS-on-USB "must" support, include - * - power management (OID_PNP_CAPABILITIES, ...) - * - network wakeup (OID_PNP_ENABLE_WAKE_UP, ...) - */ /* NDIS Functions */ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) { int retval = -ENOTSUPP; u32 length = 0; + u32 *tmp; + int i, count; rndis_query_cmplt_type *resp; if (!r) return -ENOMEM; @@ -97,11 +104,17 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) if (!resp) return -ENOMEM; switch (OID) { + + /* general oids (table 4-1) */ + /* mandatory */ case OID_GEN_SUPPORTED_LIST: DEBUG ("%s: OID_GEN_SUPPORTED_LIST\n", __FUNCTION__); length = sizeof (oid_supported_list); - memcpy ((u8 *) resp + 24, oid_supported_list, length); + count = length / sizeof (u32); + tmp = (u32 *) ((u8 *)resp + 24); + for (i = 0; i < count; i++) + tmp[i] = cpu_to_le32 (oid_supported_list[i]); retval = 0; break; @@ -115,7 +128,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) * reddite ergo quae sunt Caesaris Caesari * et quae sunt Dei Deo! */ - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; @@ -123,7 +136,8 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_MEDIA_SUPPORTED: DEBUG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr].medium; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].medium); retval = 0; break; @@ -132,24 +146,21 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__); length = 4; /* one medium, one transport... (maybe you do it better) */ - *((u32 *) resp + 6) = rndis_per_dev_params [configNr].medium; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].medium); retval = 0; break; - case OID_GEN_MAXIMUM_LOOKAHEAD: - DEBUG("%s: OID_GEN_MAXIMUM_LOOKAHEAD\n", __FUNCTION__); - break; - /* mandatory */ case OID_GEN_MAXIMUM_FRAME_SIZE: DEBUG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__); if (rndis_per_dev_params [configNr].dev) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .dev->mtu; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].dev->mtu); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -160,30 +171,20 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) length = 4; if (rndis_per_dev_params [configNr].media_state == NDIS_MEDIA_STATE_DISCONNECTED) - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); else - *((u32 *) resp + 6) = rndis_per_dev_params [configNr].speed; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].speed); retval = 0; break; - - case OID_GEN_TRANSMIT_BUFFER_SPACE: - DEBUG("%s: OID_GEN_TRANSMIT_BUFFER_SPACE\n", __FUNCTION__); - length = 4; - *((u32 *) resp + 6) = 0; - retval = 0; - break; - - case OID_GEN_RECEIVE_BUFFER_SPACE: - DEBUG("%s: OID_GEN_RECEIVE_BUFFER_SPACE\n", __FUNCTION__); - break; - + /* mandatory */ case OID_GEN_TRANSMIT_BLOCK_SIZE: DEBUG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __FUNCTION__); if (rndis_per_dev_params [configNr].dev) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .dev->mtu; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].dev->mtu); retval = 0; } break; @@ -193,8 +194,8 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__); if (rndis_per_dev_params [configNr].dev) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .dev->mtu; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].dev->mtu); retval = 0; } break; @@ -203,7 +204,8 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_VENDOR_ID: DEBUG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr].vendorID; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].vendorID); retval = 0; break; @@ -216,129 +218,92 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) retval = 0; break; + case OID_GEN_VENDOR_DRIVER_VERSION: + DEBUG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__); + length = 4; + /* Created as LE */ + *((u32 *) resp + 6) = rndis_driver_version; + retval = 0; + break; + /* mandatory */ case OID_GEN_CURRENT_PACKET_FILTER: DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params[configNr].filter; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params[configNr].filter); retval = 0; break; - - case OID_GEN_CURRENT_LOOKAHEAD: - DEBUG("%s: OID_GEN_CURRENT_LOOKAHEAD\n", __FUNCTION__); - break; - - case OID_GEN_DRIVER_VERSION: - DEBUG("%s: OID_GEN_DRIVER_VERSION\n", __FUNCTION__); - break; - + /* mandatory */ case OID_GEN_MAXIMUM_TOTAL_SIZE: DEBUG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = RNDIS_MAX_TOTAL_SIZE; - retval = 0; - break; - - case OID_GEN_PROTOCOL_OPTIONS: - DEBUG("%s: OID_GEN_PROTOCOL_OPTIONS\n", __FUNCTION__); - break; - - case OID_GEN_MAC_OPTIONS: - DEBUG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__); - length = 4; - *((u32 *) resp + 6) = NDIS_MAC_OPTION_RECEIVE_SERIALIZED | - NDIS_MAC_OPTION_FULL_DUPLEX; + *((u32 *) resp + 6) = __constant_cpu_to_le32( + RNDIS_MAX_TOTAL_SIZE); retval = 0; break; - + /* mandatory */ case OID_GEN_MEDIA_CONNECT_STATUS: DEBUG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .media_state; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .media_state); retval = 0; break; - - case OID_GEN_MAXIMUM_SEND_PACKETS: - DEBUG("%s: OID_GEN_MAXIMUM_SEND_PACKETS\n", __FUNCTION__); - break; - - /* mandatory */ - case OID_GEN_VENDOR_DRIVER_VERSION: - DEBUG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__); - length = 4; - *((u32 *) resp + 6) = rndis_driver_version; - retval = 0; - break; - - case OID_GEN_SUPPORTED_GUIDS: - DEBUG("%s: OID_GEN_SUPPORTED_GUIDS\n", __FUNCTION__); - break; - - case OID_GEN_NETWORK_LAYER_ADDRESSES: - DEBUG("%s: OID_GEN_NETWORK_LAYER_ADDRESSES\n", __FUNCTION__); - break; - - case OID_GEN_TRANSPORT_HEADER_OFFSET: - DEBUG("%s: OID_GEN_TRANSPORT_HEADER_OFFSET\n", __FUNCTION__); - break; - - case OID_GEN_MACHINE_NAME: - DEBUG("%s: OID_GEN_MACHINE_NAME\n", __FUNCTION__); - break; - - case OID_GEN_RNDIS_CONFIG_PARAMETER: - DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER\n", __FUNCTION__); + + case OID_GEN_PHYSICAL_MEDIUM: + DEBUG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; - - case OID_GEN_VLAN_ID: - DEBUG("%s: OID_GEN_VLAN_ID\n", __FUNCTION__); - break; - - case OID_GEN_MEDIA_CAPABILITIES: - DEBUG("%s: OID_GEN_MEDIA_CAPABILITIES\n", __FUNCTION__); - break; - - case OID_GEN_PHYSICAL_MEDIUM: - DEBUG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__); + + /* The RNDIS specification is incomplete/wrong. Some versions + * of MS-Windows expect OIDs that aren't specified there. Other + * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! + */ + case OID_GEN_MAC_OPTIONS: /* from WinME */ + DEBUG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32( + NDIS_MAC_OPTION_RECEIVE_SERIALIZED + | NDIS_MAC_OPTION_FULL_DUPLEX); retval = 0; break; - + + /* statistics OIDs (table 4-2) */ + /* mandatory */ case OID_GEN_XMIT_OK: DEBUG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .stats->tx_packets - + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].stats->tx_packets - rndis_per_dev_params [configNr].stats->tx_errors - - rndis_per_dev_params [configNr].stats->tx_dropped; + rndis_per_dev_params [configNr].stats->tx_dropped); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; - + /* mandatory */ case OID_GEN_RCV_OK: DEBUG("%s: OID_GEN_RCV_OK\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_packets - + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr].stats->rx_packets - rndis_per_dev_params [configNr].stats->rx_errors - - rndis_per_dev_params [configNr].stats->rx_dropped; + rndis_per_dev_params [configNr].stats->rx_dropped); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -348,11 +313,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_GEN_XMIT_ERROR\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->tx_errors; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->tx_errors); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -361,11 +327,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_RCV_ERROR: DEBUG("%s: OID_GEN_RCV_ERROR\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_errors; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_errors); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -374,15 +341,17 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_RCV_NO_BUFFER: DEBUG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_dropped; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_dropped); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; - + +#ifdef RNDIS_OPTIONAL_STATS case OID_GEN_DIRECTED_BYTES_XMIT: DEBUG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __FUNCTION__); /* @@ -392,14 +361,17 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) */ if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = (rndis_per_dev_params [configNr]. - stats->tx_packets - - rndis_per_dev_params [configNr].stats->tx_errors - - rndis_per_dev_params [configNr].stats->tx_dropped) - *123; + *((u32 *) resp + 6) = cpu_to_le32 ( + (rndis_per_dev_params [configNr] + .stats->tx_packets - + rndis_per_dev_params [configNr] + .stats->tx_errors - + rndis_per_dev_params [configNr] + .stats->tx_dropped) + * 123); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -409,14 +381,17 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) /* dito */ if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = (rndis_per_dev_params [configNr]. - stats->tx_packets - - rndis_per_dev_params [configNr].stats->tx_errors - - rndis_per_dev_params [configNr].stats->tx_dropped) - /123; + *((u32 *) resp + 6) = cpu_to_le32 ( + (rndis_per_dev_params [configNr] + .stats->tx_packets - + rndis_per_dev_params [configNr] + .stats->tx_errors - + rndis_per_dev_params [configNr] + .stats->tx_dropped) + / 123); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -424,11 +399,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_MULTICAST_BYTES_XMIT: DEBUG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->multicast*1234; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->multicast*1234); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -436,11 +412,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_MULTICAST_FRAMES_XMIT: DEBUG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->multicast; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->multicast); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -448,11 +425,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_BROADCAST_BYTES_XMIT: DEBUG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->tx_packets/42*255; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->tx_packets/42*255); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -460,35 +438,37 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_BROADCAST_FRAMES_XMIT: DEBUG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->tx_packets/42; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->tx_packets/42); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; case OID_GEN_DIRECTED_BYTES_RCV: DEBUG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__); - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; case OID_GEN_DIRECTED_FRAMES_RCV: DEBUG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__); - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; case OID_GEN_MULTICAST_BYTES_RCV: DEBUG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->multicast*1111; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->multicast * 1111); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -496,11 +476,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_MULTICAST_FRAMES_RCV: DEBUG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->multicast; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->multicast); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -508,11 +489,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_BROADCAST_BYTES_RCV: DEBUG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_packets/42*255; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_packets/42*255); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -520,11 +502,12 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_BROADCAST_FRAMES_RCV: DEBUG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_packets/42; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_packets/42); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -532,61 +515,25 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_GEN_RCV_CRC_ERROR: DEBUG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { - *((u32 *) resp + 6) = rndis_per_dev_params [configNr]. - stats->rx_crc_errors; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_crc_errors); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; case OID_GEN_TRANSMIT_QUEUE_LENGTH: DEBUG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__); - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; - - case OID_GEN_GET_TIME_CAPS: - DEBUG("%s: OID_GEN_GET_TIME_CAPS\n", __FUNCTION__); - break; - - case OID_GEN_GET_NETCARD_TIME: - DEBUG("%s: OID_GEN_GET_NETCARD_TIME\n", __FUNCTION__); - break; - - case OID_GEN_NETCARD_LOAD: - DEBUG("%s: OID_GEN_NETCARD_LOAD\n", __FUNCTION__); - break; - - case OID_GEN_DEVICE_PROFILE: - DEBUG("%s: OID_GEN_DEVICE_PROFILE\n", __FUNCTION__); - break; - - case OID_GEN_INIT_TIME_MS: - DEBUG("%s: OID_GEN_INIT_TIME_MS\n", __FUNCTION__); - break; - - case OID_GEN_RESET_COUNTS: - DEBUG("%s: OID_GEN_RESET_COUNTS\n", __FUNCTION__); - break; - - case OID_GEN_MEDIA_SENSE_COUNTS: - DEBUG("%s: OID_GEN_MEDIA_SENSE_COUNTS\n", __FUNCTION__); - break; - - case OID_GEN_FRIENDLY_NAME: - DEBUG("%s: OID_GEN_FRIENDLY_NAME\n", __FUNCTION__); - break; - - case OID_GEN_MINIPORT_INFO: - DEBUG("%s: OID_GEN_MINIPORT_INFO\n", __FUNCTION__); - break; - - case OID_GEN_RESET_VERIFY_PARAMETERS: - DEBUG("%s: OID_GEN_RESET_VERIFY_PARAMETERS\n", __FUNCTION__); - break; - +#endif /* RNDIS_OPTIONAL_STATS */ + + /* ieee802.3 OIDs (table 4-3) */ + /* mandatory */ case OID_802_3_PERMANENT_ADDRESS: DEBUG("%s: OID_802_3_PERMANENT_ADDRESS\n", __FUNCTION__); @@ -597,7 +544,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) length); retval = 0; } else { - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; } break; @@ -619,7 +566,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); length = 4; /* Multicast base address only */ - *((u32 *) resp + 6) = 0xE0000000; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0xE0000000); retval = 0; break; @@ -628,22 +575,25 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__); length = 4; /* Multicast base address only */ - *((u32 *) resp + 6) = 1; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (1); retval = 0; break; case OID_802_3_MAC_OPTIONS: DEBUG("%s: OID_802_3_MAC_OPTIONS\n", __FUNCTION__); break; - + + /* ieee802.3 statistics OIDs (table 4-4) */ + /* mandatory */ case OID_802_3_RCV_ERROR_ALIGNMENT: DEBUG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __FUNCTION__); if (rndis_per_dev_params [configNr].stats) { length = 4; - *((u32 *) resp + 6) = rndis_per_dev_params [configNr] - .stats->rx_frame_errors; + *((u32 *) resp + 6) = cpu_to_le32 ( + rndis_per_dev_params [configNr] + .stats->rx_frame_errors); retval = 0; } break; @@ -652,7 +602,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_802_3_XMIT_ONE_COLLISION: DEBUG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; @@ -660,10 +610,11 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) case OID_802_3_XMIT_MORE_COLLISIONS: DEBUG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__); length = 4; - *((u32 *) resp + 6) = 0; + *((u32 *) resp + 6) = __constant_cpu_to_le32 (0); retval = 0; break; +#ifdef RNDIS_OPTIONAL_STATS case OID_802_3_XMIT_DEFERRED: DEBUG("%s: OID_802_3_XMIT_DEFERRED\n", __FUNCTION__); /* TODO */ @@ -698,14 +649,46 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r) DEBUG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __FUNCTION__); /* TODO */ break; - - default: printk (KERN_ERR "%s: unknown OID 0x%08X\n", +#endif /* RNDIS_OPTIONAL_STATS */ + +#ifdef RNDIS_PM + /* power management OIDs (table 4-5) */ + case OID_PNP_CAPABILITIES: + DEBUG("%s: OID_PNP_CAPABILITIES\n", __FUNCTION__); + + /* just PM, and remote wakeup on link status change + * (not magic packet or pattern match) + */ + length = sizeof (struct NDIS_PNP_CAPABILITIES); + memset (resp, 0, length); + { + struct NDIS_PNP_CAPABILITIES *caps = (void *) resp; + + caps->Flags = NDIS_DEVICE_WAKE_UP_ENABLE; + caps->WakeUpCapabilities.MinLinkChangeWakeUp + = NdisDeviceStateD3; + + /* FIXME then use usb_gadget_wakeup(), and + * set USB_CONFIG_ATT_WAKEUP in config desc + */ + } + retval = 0; + break; + case OID_PNP_QUERY_POWER: + DEBUG("%s: OID_PNP_QUERY_POWER\n", __FUNCTION__); + /* sure, handle any power state that maps to USB suspend */ + retval = 0; + break; +#endif + + default: + printk (KERN_WARNING "%s: query unknown OID 0x%08X\n", __FUNCTION__, OID); } - resp->InformationBufferOffset = 16; - resp->InformationBufferLength = length; - resp->MessageLength = 24 + length; + resp->InformationBufferOffset = __constant_cpu_to_le32 (16); + resp->InformationBufferLength = cpu_to_le32 (length); + resp->MessageLength = cpu_to_le32 (24 + length); r->length = 24 + length; return retval; } @@ -715,9 +698,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, { rndis_set_cmplt_type *resp; int i, retval = -ENOTSUPP; - struct rndis_config_parameter *param; struct rndis_params *params; - u8 *cp; if (!r) return -ENOMEM; @@ -725,20 +706,37 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, if (!resp) return -ENOMEM; - cp = (u8 *)resp; + DEBUG("set OID %08x value, len %d:\n", OID, buf_len); + for (i = 0; i < buf_len; i += 16) { + DEBUG ("%03d: " + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + "\n", + i, + buf[i], buf [i+1], + buf[i+2], buf[i+3], + buf[i+4], buf [i+5], + buf[i+6], buf[i+7], + buf[i+8], buf [i+9], + buf[i+10], buf[i+11], + buf[i+12], buf [i+13], + buf[i+14], buf[i+15]); + } switch (OID) { case OID_GEN_CURRENT_PACKET_FILTER: params = &rndis_per_dev_params [configNr]; retval = 0; - /* FIXME use this NDIS_PACKET_TYPE_* bitflags to + /* FIXME use these NDIS_PACKET_TYPE_* bitflags to * filter packets in hard_start_xmit() * NDIS_PACKET_TYPE_x == CDC_PACKET_TYPE_x for x in: * PROMISCUOUS, DIRECTED, * MULTICAST, ALL_MULTICAST, BROADCAST */ - params->filter = *(u32 *)buf; + params->filter = cpu_to_le32p((u32 *)buf); DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", __FUNCTION__, params->filter); @@ -763,23 +761,40 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__); retval = 0; break; - +#if 0 case OID_GEN_RNDIS_CONFIG_PARAMETER: - DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER\n", __FUNCTION__); + { + struct rndis_config_parameter *param; param = (struct rndis_config_parameter *) buf; - if (param) { - for (i = 0; i < param->ParameterNameLength; i++) { - DEBUG ("%c", - *(buf + param->ParameterNameOffset + i)); - } - DEBUG ("\n"); + DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER '%*s'\n", + __FUNCTION__, + min(cpu_to_le32(param->ParameterNameLength),80), + buf + param->ParameterNameOffset); + retval = 0; } - + break; +#endif + +#ifdef RNDIS_PM + case OID_PNP_SET_POWER: + DEBUG ("OID_PNP_SET_POWER\n"); + /* sure, handle any power state that maps to USB suspend */ retval = 0; break; - - default: printk (KERN_ERR "%s: unknown OID 0x%08X\n", - __FUNCTION__, OID); + + case OID_PNP_ENABLE_WAKE_UP: + /* always-connected ... */ + DEBUG ("OID_PNP_ENABLE_WAKE_UP\n"); + retval = 0; + break; + + // no PM resume patterns supported (specified where?) + // so OID_PNP_{ADD,REMOVE}_WAKE_UP_PATTERN always fails +#endif + + default: + printk (KERN_WARNING "%s: set unknown OID 0x%08X, size %d\n", + __FUNCTION__, OID, buf_len); } return retval; @@ -804,22 +819,24 @@ static int rndis_init_response (int configNr, rndis_init_msg_type *buf) if (!resp) return -ENOMEM; - resp->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT; - resp->MessageLength = 52; - resp->RequestID = buf->RequestID; - resp->Status = RNDIS_STATUS_SUCCESS; - resp->MajorVersion = RNDIS_MAJOR_VERSION; - resp->MinorVersion = RNDIS_MINOR_VERSION; - resp->DeviceFlags = RNDIS_DF_CONNECTIONLESS; - resp->Medium = RNDIS_MEDIUM_802_3; - resp->MaxPacketsPerTransfer = 1; - resp->MaxTransferSize = rndis_per_dev_params [configNr].dev->mtu + resp->MessageType = __constant_cpu_to_le32 ( + REMOTE_NDIS_INITIALIZE_CMPLT); + resp->MessageLength = __constant_cpu_to_le32 (52); + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ + resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); + resp->MajorVersion = __constant_cpu_to_le32 (RNDIS_MAJOR_VERSION); + resp->MinorVersion = __constant_cpu_to_le32 (RNDIS_MINOR_VERSION); + resp->DeviceFlags = __constant_cpu_to_le32 (RNDIS_DF_CONNECTIONLESS); + resp->Medium = __constant_cpu_to_le32 (RNDIS_MEDIUM_802_3); + resp->MaxPacketsPerTransfer = __constant_cpu_to_le32 (1); + resp->MaxTransferSize = cpu_to_le32 ( + rndis_per_dev_params [configNr].dev->mtu + sizeof (struct ethhdr) + sizeof (struct rndis_packet_msg_type) - + 22; - resp->PacketAlignmentFactor = 0; - resp->AFListOffset = 0; - resp->AFListSize = 0; + + 22); + resp->PacketAlignmentFactor = __constant_cpu_to_le32 (0); + resp->AFListOffset = __constant_cpu_to_le32 (0); + resp->AFListSize = __constant_cpu_to_le32 (0); if (rndis_per_dev_params [configNr].ack) rndis_per_dev_params [configNr].ack ( @@ -833,7 +850,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) rndis_query_cmplt_type *resp; rndis_resp_t *r; - DEBUG("%s: OID = %08X\n", __FUNCTION__, buf->OID); + // DEBUG("%s: OID = %08X\n", __FUNCTION__, cpu_to_le32(buf->OID)); if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP; /* @@ -847,17 +864,18 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) if (!resp) return -ENOMEM; - resp->MessageType = REMOTE_NDIS_QUERY_CMPLT; - resp->MessageLength = 24; - resp->RequestID = buf->RequestID; + resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT); + resp->MessageLength = __constant_cpu_to_le32 (24); + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ - if (gen_ndis_query_resp (configNr, buf->OID, r)) { + if (gen_ndis_query_resp (configNr, cpu_to_le32 (buf->OID), r)) { /* OID not supported */ - resp->Status = RNDIS_STATUS_NOT_SUPPORTED; - resp->InformationBufferLength = 0; - resp->InformationBufferOffset = 0; + resp->Status = __constant_cpu_to_le32 ( + RNDIS_STATUS_NOT_SUPPORTED); + resp->InformationBufferLength = __constant_cpu_to_le32 (0); + resp->InformationBufferOffset = __constant_cpu_to_le32 (0); } else - resp->Status = RNDIS_STATUS_SUCCESS; + resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); if (rndis_per_dev_params [configNr].ack) rndis_per_dev_params [configNr].ack ( @@ -867,38 +885,42 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf) static int rndis_set_response (int configNr, rndis_set_msg_type *buf) { + u32 BufLength, BufOffset; rndis_set_cmplt_type *resp; rndis_resp_t *r; - int i; r = rndis_add_response (configNr, sizeof (rndis_set_cmplt_type)); if (!r) return -ENOMEM; resp = (rndis_set_cmplt_type *) r->buf; if (!resp) return -ENOMEM; - - DEBUG("%s: Length: %d\n", __FUNCTION__, buf->InformationBufferLength); - DEBUG("%s: Offset: %d\n", __FUNCTION__, buf->InformationBufferOffset); + + BufLength = cpu_to_le32 (buf->InformationBufferLength); + BufOffset = cpu_to_le32 (buf->InformationBufferOffset); + +#ifdef VERBOSE + DEBUG("%s: Length: %d\n", __FUNCTION__, BufLength); + DEBUG("%s: Offset: %d\n", __FUNCTION__, BufOffset); DEBUG("%s: InfoBuffer: ", __FUNCTION__); - for (i = 0; i < buf->InformationBufferLength; i++) { - DEBUG ("%02x ", *(((u8 *) buf) + i + 12 + - buf->InformationBufferOffset)); + for (i = 0; i < BufLength; i++) { + DEBUG ("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); } DEBUG ("\n"); +#endif - resp->MessageType = REMOTE_NDIS_SET_CMPLT; - resp->MessageLength = 16; - resp->RequestID = buf->RequestID; - if (gen_ndis_set_resp (configNr, buf->OID, - ((u8 *) buf) + 28, - buf->InformationBufferLength, r)) - resp->Status = RNDIS_STATUS_NOT_SUPPORTED; - else resp->Status = RNDIS_STATUS_SUCCESS; + resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); + resp->MessageLength = __constant_cpu_to_le32 (16); + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ + if (gen_ndis_set_resp (configNr, cpu_to_le32 (buf->OID), + ((u8 *) buf) + 8 + BufOffset, BufLength, r)) + resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED); + else resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); if (rndis_per_dev_params [configNr].ack) - rndis_per_dev_params [configNr].ack (rndis_per_dev_params [configNr].dev); + rndis_per_dev_params [configNr].ack ( + rndis_per_dev_params [configNr].dev); return 0; } @@ -914,10 +936,11 @@ static int rndis_reset_response (int configNr, rndis_reset_msg_type *buf) resp = (rndis_reset_cmplt_type *) r->buf; if (!resp) return -ENOMEM; - resp->MessageType = REMOTE_NDIS_RESET_CMPLT; - resp->MessageLength = 16; - resp->Status = RNDIS_STATUS_SUCCESS; - resp->AddressingReset = 1; /* resent information */ + resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT); + resp->MessageLength = __constant_cpu_to_le32 (16); + resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); + /* resent information */ + resp->AddressingReset = __constant_cpu_to_le32 (1); if (rndis_per_dev_params [configNr].ack) rndis_per_dev_params [configNr].ack ( @@ -938,10 +961,11 @@ static int rndis_keepalive_response (int configNr, resp = (rndis_keepalive_cmplt_type *) r->buf; if (!resp) return -ENOMEM; - resp->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT; - resp->MessageLength = 16; - resp->RequestID = buf->RequestID; - resp->Status = RNDIS_STATUS_SUCCESS; + resp->MessageType = __constant_cpu_to_le32 ( + REMOTE_NDIS_KEEPALIVE_CMPLT); + resp->MessageLength = __constant_cpu_to_le32 (16); + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ + resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS); if (rndis_per_dev_params [configNr].ack) rndis_per_dev_params [configNr].ack ( @@ -969,11 +993,12 @@ static int rndis_indicate_status_msg (int configNr, u32 status) resp = (rndis_indicate_status_msg_type *) r->buf; if (!resp) return -ENOMEM; - resp->MessageType = REMOTE_NDIS_INDICATE_STATUS_MSG; - resp->MessageLength = 20; - resp->Status = status; - resp->StatusBufferLength = 0; - resp->StatusBufferOffset = 0; + resp->MessageType = __constant_cpu_to_le32 ( + REMOTE_NDIS_INDICATE_STATUS_MSG); + resp->MessageLength = __constant_cpu_to_le32 (20); + resp->Status = cpu_to_le32 (status); + resp->StatusBufferLength = __constant_cpu_to_le32 (0); + resp->StatusBufferOffset = __constant_cpu_to_le32 (0); if (rndis_per_dev_params [configNr].ack) rndis_per_dev_params [configNr].ack ( @@ -1014,8 +1039,8 @@ int rndis_msg_parser (u8 configNr, u8 *buf) return -ENOMEM; tmp = (u32 *) buf; - MsgType = *tmp; - MsgLength = *(tmp + 1); + MsgType = cpu_to_le32p(tmp++); + MsgLength = cpu_to_le32p(tmp++); if (configNr >= RNDIS_MAX_CONFIGS) return -ENOTSUPP; @@ -1025,14 +1050,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf) switch (MsgType) { case REMOTE_NDIS_INITIALIZE_MSG: - DEBUG(KERN_INFO "%s: REMOTE_NDIS_INITIALIZE_MSG\n", + DEBUG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", __FUNCTION__ ); params->state = RNDIS_INITIALIZED; return rndis_init_response (configNr, (rndis_init_msg_type *) buf); case REMOTE_NDIS_HALT_MSG: - DEBUG(KERN_INFO "%s: REMOTE_NDIS_HALT_MSG\n", + DEBUG("%s: REMOTE_NDIS_HALT_MSG\n", __FUNCTION__ ); params->state = RNDIS_UNINITIALIZED; if (params->dev) { @@ -1042,34 +1067,57 @@ int rndis_msg_parser (u8 configNr, u8 *buf) return 0; case REMOTE_NDIS_QUERY_MSG: - DEBUG(KERN_INFO "%s: REMOTE_NDIS_QUERY_MSG\n", - __FUNCTION__ ); return rndis_query_response (configNr, (rndis_query_msg_type *) buf); case REMOTE_NDIS_SET_MSG: - DEBUG(KERN_INFO "%s: REMOTE_NDIS_SET_MSG\n", - __FUNCTION__ ); return rndis_set_response (configNr, (rndis_set_msg_type *) buf); case REMOTE_NDIS_RESET_MSG: - DEBUG(KERN_INFO "%s: REMOTE_NDIS_RESET_MSG\n", + DEBUG("%s: REMOTE_NDIS_RESET_MSG\n", __FUNCTION__ ); return rndis_reset_response (configNr, (rndis_reset_msg_type *) buf); case REMOTE_NDIS_KEEPALIVE_MSG: /* For USB: host does this every 5 seconds */ - DEBUG(KERN_INFO "%s: REMOTE_NDIS_KEEPALIVE_MSG\n", +#ifdef VERBOSE + DEBUG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", __FUNCTION__ ); +#endif return rndis_keepalive_response (configNr, (rndis_keepalive_msg_type *) buf); default: - printk (KERN_ERR "%s: unknown RNDIS Message Type 0x%08X\n", - __FUNCTION__ , MsgType); + /* At least Windows XP emits some undefined RNDIS messages. + * In one case those messages seemed to relate to the host + * suspending itself. + */ + printk (KERN_WARNING + "%s: unknown RNDIS message 0x%08X len %d\n", + __FUNCTION__ , MsgType, MsgLength); + { + unsigned i; + for (i = 0; i < MsgLength; i += 16) { + DEBUG ("%03d: " + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + " %02x %02x %02x %02x" + "\n", + i, + buf[i], buf [i+1], + buf[i+2], buf[i+3], + buf[i+4], buf [i+5], + buf[i+6], buf[i+7], + buf[i+8], buf [i+9], + buf[i+10], buf[i+11], + buf[i+12], buf [i+13], + buf[i+14], buf[i+15]); + } + } break; } @@ -1079,13 +1127,12 @@ int rndis_msg_parser (u8 configNr, u8 *buf) int rndis_register (int (* rndis_control_ack) (struct net_device *)) { u8 i; - DEBUG("%s: ", __FUNCTION__ ); for (i = 0; i < RNDIS_MAX_CONFIGS; i++) { if (!rndis_per_dev_params [i].used) { rndis_per_dev_params [i].used = 1; rndis_per_dev_params [i].ack = rndis_control_ack; - DEBUG("configNr = %d\n", i); + DEBUG("%s: configNr = %d\n", __FUNCTION__, i); return i; } } @@ -1145,10 +1192,10 @@ void rndis_add_hdr (struct sk_buff *skb) if (!skb) return; skb_push (skb, sizeof (struct rndis_packet_msg_type)); memset (skb->data, 0, sizeof (struct rndis_packet_msg_type)); - *((u32 *) skb->data) = 1; - *((u32 *) skb->data + 1) = skb->len; - *((u32 *) skb->data + 2) = 36; - *((u32 *) skb->data + 3) = skb->len - 44; + *((u32 *) skb->data) = __constant_cpu_to_le32 (1); + *((u32 *) skb->data + 1) = cpu_to_le32(skb->len); + *((u32 *) skb->data + 2) = __constant_cpu_to_le32 (36); + *((u32 *) skb->data + 3) = cpu_to_le32(skb->len - 44); return; } @@ -1208,14 +1255,16 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length) int rndis_rm_hdr (u8 *buf, u32 *length) { - u32 i, messageLen, dataOffset; + u32 i, messageLen, dataOffset, *tmp; + tmp = (u32 *) buf; + if (!buf || !length) return -1; - if (*((u32 *) buf) != 1) return -1; + if (cpu_to_le32p(tmp++) != 1) return -1; - messageLen = *((u32 *) buf + 1); - - dataOffset = *((u32 *) buf + 2) + 8; + messageLen = cpu_to_le32p(tmp++); + dataOffset = cpu_to_le32p(tmp++) + 8; + if (messageLen < dataOffset || messageLen > *length) return -1; for (i = dataOffset; i < messageLen; i++) diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 150ec8e5a..fa7d90854 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h @@ -59,10 +59,18 @@ #define RNDIS_MEDIUM_802_3 0x00000000U +/* from drivers/net/sk98lin/h/skgepnmi.h */ +#define OID_PNP_CAPABILITIES 0xFD010100 +#define OID_PNP_SET_POWER 0xFD010101 +#define OID_PNP_QUERY_POWER 0xFD010102 +#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 +#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 +#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 + + /* supported OIDs */ static const u32 oid_supported_list [] = { - /* mandatory general */ /* the general stuff */ OID_GEN_SUPPORTED_LIST, OID_GEN_HARDWARE_STATUS, @@ -70,7 +78,6 @@ static const u32 oid_supported_list [] = OID_GEN_MEDIA_IN_USE, OID_GEN_MAXIMUM_FRAME_SIZE, OID_GEN_LINK_SPEED, - OID_GEN_TRANSMIT_BUFFER_SPACE, OID_GEN_TRANSMIT_BLOCK_SIZE, OID_GEN_RECEIVE_BLOCK_SIZE, OID_GEN_VENDOR_ID, @@ -78,10 +85,11 @@ static const u32 oid_supported_list [] = OID_GEN_VENDOR_DRIVER_VERSION, OID_GEN_CURRENT_PACKET_FILTER, OID_GEN_MAXIMUM_TOTAL_SIZE, - OID_GEN_MAC_OPTIONS, OID_GEN_MEDIA_CONNECT_STATUS, OID_GEN_PHYSICAL_MEDIUM, +#if 0 OID_GEN_RNDIS_CONFIG_PARAMETER, +#endif /* the statistical stuff */ OID_GEN_XMIT_OK, @@ -89,6 +97,7 @@ static const u32 oid_supported_list [] = OID_GEN_XMIT_ERROR, OID_GEN_RCV_ERROR, OID_GEN_RCV_NO_BUFFER, +#ifdef RNDIS_OPTIONAL_STATS OID_GEN_DIRECTED_BYTES_XMIT, OID_GEN_DIRECTED_FRAMES_XMIT, OID_GEN_MULTICAST_BYTES_XMIT, @@ -103,6 +112,7 @@ static const u32 oid_supported_list [] = OID_GEN_BROADCAST_FRAMES_RCV, OID_GEN_RCV_CRC_ERROR, OID_GEN_TRANSMIT_QUEUE_LENGTH, +#endif /* RNDIS_OPTIONAL_STATS */ /* mandatory 802.3 */ /* the general stuff */ @@ -115,7 +125,30 @@ static const u32 oid_supported_list [] = /* the statistical stuff */ OID_802_3_RCV_ERROR_ALIGNMENT, OID_802_3_XMIT_ONE_COLLISION, - OID_802_3_XMIT_MORE_COLLISIONS + OID_802_3_XMIT_MORE_COLLISIONS, +#ifdef RNDIS_OPTIONAL_STATS + OID_802_3_XMIT_DEFERRED, + OID_802_3_XMIT_MAX_COLLISIONS, + OID_802_3_RCV_OVERRUN, + OID_802_3_XMIT_UNDERRUN, + OID_802_3_XMIT_HEARTBEAT_FAILURE, + OID_802_3_XMIT_TIMES_CRS_LOST, + OID_802_3_XMIT_LATE_COLLISIONS, +#endif /* RNDIS_OPTIONAL_STATS */ + +#ifdef RNDIS_PM + /* PM and wakeup are mandatory for USB: */ + + /* power management */ + OID_PNP_CAPABILITIES, + OID_PNP_QUERY_POWER, + OID_PNP_SET_POWER, + + /* wake up host */ + OID_PNP_ENABLE_WAKE_UP, + OID_PNP_ADD_WAKE_UP_PATTERN, + OID_PNP_REMOVE_WAKE_UP_PATTERN, +#endif }; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 08fb7643b..aaf3334e7 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -290,16 +290,17 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) { if (cap & (1 << 16)) { int msec = 500; + struct pci_dev *pdev = to_pci_dev(ehci->hcd.self.controller); /* request handoff to OS */ - cap &= 1 << 24; - pci_write_config_dword (to_pci_dev(ehci->hcd.self.controller), where, cap); + cap |= 1 << 24; + pci_write_config_dword(pdev, where, cap); /* and wait a while for it to happen */ do { msleep(10); msec -= 10; - pci_read_config_dword (to_pci_dev(ehci->hcd.self.controller), where, &cap); + pci_read_config_dword(pdev, where, &cap); } while ((cap & (1 << 16)) && msec); if (cap & (1 << 16)) { ehci_err (ehci, "BIOS handoff failed (%d, %04x)\n", @@ -343,6 +344,7 @@ static int ehci_hc_reset (struct usb_hcd *hcd) dbg_hcc_params (ehci, "reset"); #ifdef CONFIG_PCI + writel(0, &ehci->regs->intr_enable); /* EHCI 0.96 and later may have "extended capabilities" */ if (hcd->self.controller->bus == &pci_bus_type) temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); @@ -520,7 +522,7 @@ static int ehci_start (struct usb_hcd *hcd) /* wire up the root hub */ bus = hcd_to_bus (hcd); - bus->root_hub = udev = usb_alloc_dev (NULL, bus, 0); + udev = usb_alloc_dev (NULL, bus, 0); if (!udev) { done2: ehci_mem_cleanup (ehci); @@ -553,11 +555,10 @@ done2: * and device drivers may start it running. */ udev->speed = USB_SPEED_HIGH; - if (hcd_register_root (hcd) != 0) { + if (hcd_register_root (udev, hcd) != 0) { if (hcd->state == USB_STATE_RUNNING) ehci_ready (ehci); ehci_reset (ehci); - bus->root_hub = 0; usb_put_dev (udev); retval = -ENODEV; goto done2; diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 3682fb948..d3bcf4818 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c @@ -483,7 +483,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh) qh->start = frame; /* reset S-frame and (maybe) C-frame masks */ - qh->hw_info2 &= ~0xffff; + qh->hw_info2 &= ~__constant_cpu_to_le32(0xffff); qh->hw_info2 |= cpu_to_le32 (1 << uframe) | c_mask; } else dbg ("reused previous qh %p schedule", qh); diff --git a/drivers/usb/host/hc_sl811_rh.c b/drivers/usb/host/hc_sl811_rh.c index a4dd4628e..aaaa705bc 100644 --- a/drivers/usb/host/hc_sl811_rh.c +++ b/drivers/usb/host/hc_sl811_rh.c @@ -557,18 +557,24 @@ static int rh_unlink_urb (struct urb * urb) static int rh_connect_rh (hci_t * hci) { struct usb_device *usb_dev; + int retval; hci->rh.devnum = 0; usb_dev = usb_alloc_dev (NULL, hci->bus, 0); if (!usb_dev) return -ENOMEM; - hci->bus->root_hub = usb_dev; usb_dev->devnum = 1; usb_dev->bus->devnum_next = usb_dev->devnum + 1; set_bit (usb_dev->devnum, usb_dev->bus->devmap.devicemap); - if (usb_new_device (usb_dev) != 0) { + down (&usb_bus_list_lock); + hci->bus->root_hub = usb_dev; + retval = usb_new_device (usb_dev); + if (retval != 0) + hci->bus->root_hub = NULL; + up (&usb_bus_list_lock); + if (retval != 0) { usb_put_dev (usb_dev); return -ENODEV; } diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 3918eb3f2..582a55a60 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c @@ -134,13 +134,13 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) struct ohci_regs *regs = controller->regs; u32 temp; - temp = readl (®s->revision) & 0xff; + temp = ohci_readl (®s->revision) & 0xff; ohci_dbg_sw (controller, next, size, "OHCI %d.%d, %s legacy support registers\n", 0x03 & (temp >> 4), (temp & 0x0f), (temp & 0x10) ? "with" : "NO"); - temp = readl (®s->control); + temp = ohci_readl (®s->control); ohci_dbg_sw (controller, next, size, "control 0x%03x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", temp, @@ -155,7 +155,7 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) temp & OHCI_CTRL_CBSR ); - temp = readl (®s->cmdstatus); + temp = ohci_readl (®s->cmdstatus); ohci_dbg_sw (controller, next, size, "cmdstatus 0x%05x SOC=%d%s%s%s%s\n", temp, (temp & OHCI_SOC) >> 16, @@ -166,26 +166,26 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) ); ohci_dump_intr_mask (controller, "intrstatus", - readl (®s->intrstatus), next, size); + ohci_readl (®s->intrstatus), next, size); ohci_dump_intr_mask (controller, "intrenable", - readl (®s->intrenable), next, size); + ohci_readl (®s->intrenable), next, size); // intrdisable always same as intrenable maybe_print_eds (controller, "ed_periodcurrent", - readl (®s->ed_periodcurrent), next, size); + ohci_readl (®s->ed_periodcurrent), next, size); maybe_print_eds (controller, "ed_controlhead", - readl (®s->ed_controlhead), next, size); + ohci_readl (®s->ed_controlhead), next, size); maybe_print_eds (controller, "ed_controlcurrent", - readl (®s->ed_controlcurrent), next, size); + ohci_readl (®s->ed_controlcurrent), next, size); maybe_print_eds (controller, "ed_bulkhead", - readl (®s->ed_bulkhead), next, size); + ohci_readl (®s->ed_bulkhead), next, size); maybe_print_eds (controller, "ed_bulkcurrent", - readl (®s->ed_bulkcurrent), next, size); + ohci_readl (®s->ed_bulkcurrent), next, size); maybe_print_eds (controller, "donehead", - readl (®s->donehead), next, size); + ohci_readl (®s->donehead), next, size); } #define dbg_port_sw(hc,num,value,next,size) \ @@ -637,7 +637,7 @@ show_registers (struct class_device *class_dev, char *buf) "hcca frame 0x%04x\n", OHCI_FRAME_NO(ohci->hcca)); /* other registers mostly affect frame timings */ - rdata = readl (®s->fminterval); + rdata = ohci_readl (®s->fminterval); temp = scnprintf (next, size, "fmintvl 0x%08x %sFSMPS=0x%04x FI=0x%04x\n", rdata, (rdata >> 31) ? " FIT" : "", @@ -645,20 +645,20 @@ show_registers (struct class_device *class_dev, char *buf) size -= temp; next += temp; - rdata = readl (®s->fmremaining); + rdata = ohci_readl (®s->fmremaining); temp = scnprintf (next, size, "fmremaining 0x%08x %sFR=0x%04x\n", rdata, (rdata >> 31) ? " FRT" : "", rdata & 0x3fff); size -= temp; next += temp; - rdata = readl (®s->periodicstart); + rdata = ohci_readl (®s->periodicstart); temp = scnprintf (next, size, "periodicstart 0x%04x\n", rdata & 0x3fff); size -= temp; next += temp; - rdata = readl (®s->lsthresh); + rdata = ohci_readl (®s->lsthresh); temp = scnprintf (next, size, "lsthresh 0x%04x\n", rdata & 0x3fff); size -= temp; diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index b5279a019..690e2bee4 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -17,6 +17,7 @@ * * History: * + * 2004/03/24 LH7A404 support (Durgesh Pattamatta & Marc Singer) * 2004/02/04 use generic dma_* functions instead of pci_* (dsaxena@plexity.net) * 2003/02/24 show registers in sysfs (Kevin Brosius) * @@ -393,7 +394,7 @@ static int hc_reset (struct ohci_hcd *ohci) /* boot firmware should have set this up (5.1.1.3.1) */ if (!ohci->fminterval) { - temp = readl (&ohci->regs->fminterval); + temp = ohci_readl (&ohci->regs->fminterval); if (temp & 0x3fff0000) ohci->fminterval = temp; else @@ -405,7 +406,7 @@ static int hc_reset (struct ohci_hcd *ohci) * On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ #ifndef __hppa__ - if (readl (&ohci->regs->control) & OHCI_CTRL_IR) { + if (ohci_readl (&ohci->regs->control) & OHCI_CTRL_IR) { ohci_dbg (ohci, "USB HC TakeOver from BIOS/SMM\n"); /* this timeout is arbitrary. we make it long, so systems @@ -416,7 +417,7 @@ static int hc_reset (struct ohci_hcd *ohci) writel (OHCI_INTR_OC, &ohci->regs->intrenable); writel (OHCI_OCR, &ohci->regs->cmdstatus); - while (readl (&ohci->regs->control) & OHCI_CTRL_IR) { + while (ohci_readl (&ohci->regs->control) & OHCI_CTRL_IR) { msleep (10); if (--temp == 0) { ohci_err (ohci, "USB HC TakeOver failed!\n"); @@ -430,13 +431,13 @@ static int hc_reset (struct ohci_hcd *ohci) writel (OHCI_INTR_MIE, &ohci->regs->intrdisable); ohci_dbg (ohci, "reset, control = 0x%x\n", - readl (&ohci->regs->control)); + ohci_readl (&ohci->regs->control)); /* Reset USB (needed by some controllers); RemoteWakeupConnected * saved if boot firmware (BIOS/SMM/...) told us it's connected * (for OHCI integrated on mainboard, it normally is) */ - ohci->hc_control = readl (&ohci->regs->control); + ohci->hc_control = ohci_readl (&ohci->regs->control); ohci->hc_control &= OHCI_CTRL_RWC; /* hcfs 0 = RESET */ if (ohci->hc_control) ohci->hcd.can_wakeup = 1; @@ -450,13 +451,13 @@ static int hc_reset (struct ohci_hcd *ohci) &ohci->regs->roothub.portstatus [temp]); } // flush those pci writes - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); msleep (50); /* HC Reset requires max 10 us delay */ writel (OHCI_HCR, &ohci->regs->cmdstatus); temp = 30; /* ... allow extra time */ - while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) { + while ((ohci_readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) { if (--temp == 0) { ohci_err (ohci, "USB HC reset timed out!\n"); return -1; @@ -473,7 +474,7 @@ static int hc_reset (struct ohci_hcd *ohci) */ writel (ohci->hc_control, &ohci->regs->control); // flush those pci writes - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); return 0; } @@ -505,8 +506,8 @@ static int hc_start (struct ohci_hcd *ohci) /* some OHCI implementations are finicky about how they init. * bogus values here mean not even enumeration could work. */ - if ((readl (&ohci->regs->fminterval) & 0x3fff0000) == 0 - || !readl (&ohci->regs->periodicstart)) { + if ((ohci_readl (&ohci->regs->fminterval) & 0x3fff0000) == 0 + || !ohci_readl (&ohci->regs->periodicstart)) { ohci_err (ohci, "init err\n"); return -EOVERFLOW; } @@ -548,7 +549,7 @@ static int hc_start (struct ohci_hcd *ohci) writel (RH_HS_LPSC, &ohci->regs->roothub.status); writel (power_switching ? RH_B_PPCM : 0, &ohci->regs->roothub.b); // flush those pci writes - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); // POTPGT delay is bits 24-31, in 2 ms units. mdelay ((roothub_a (ohci) >> 23) & 0x1fe); @@ -560,7 +561,7 @@ static int hc_start (struct ohci_hcd *ohci) } /* connect the virtual root hub */ - bus->root_hub = udev = usb_alloc_dev (NULL, bus, 0); + udev = usb_alloc_dev (NULL, bus, 0); ohci->hcd.state = USB_STATE_RUNNING; if (!udev) { disable (ohci); @@ -570,9 +571,8 @@ static int hc_start (struct ohci_hcd *ohci) } udev->speed = USB_SPEED_FULL; - if (hcd_register_root (&ohci->hcd) != 0) { + if (hcd_register_root (udev, &ohci->hcd) != 0) { usb_put_dev (udev); - bus->root_hub = NULL; disable (ohci); ohci->hc_control &= ~OHCI_CTRL_HCFS; writel (ohci->hc_control, &ohci->regs->control); @@ -592,19 +592,20 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs) struct ohci_regs *regs = ohci->regs; int ints; - /* we can eliminate a (slow) readl() if _only_ WDH caused this irq */ + /* we can eliminate a (slow) ohci_readl() + if _only_ WDH caused this irq */ if ((ohci->hcca->done_head != 0) && ! (le32_to_cpup (&ohci->hcca->done_head) & 0x01)) { ints = OHCI_INTR_WDH; /* cardbus/... hardware gone before remove() */ - } else if ((ints = readl (®s->intrstatus)) == ~(u32)0) { + } else if ((ints = ohci_readl (®s->intrstatus)) == ~(u32)0) { disable (ohci); ohci_dbg (ohci, "device removed!\n"); return IRQ_HANDLED; /* interrupt for some other device? */ - } else if ((ints &= readl (®s->intrenable)) == 0) { + } else if ((ints &= ohci_readl (®s->intrenable)) == 0) { return IRQ_NONE; } @@ -650,7 +651,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs) writel (ints, ®s->intrstatus); writel (OHCI_INTR_MIE, ®s->intrenable); // flush those pci writes - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); } return IRQ_HANDLED; @@ -798,6 +799,14 @@ MODULE_LICENSE ("GPL"); #include "ohci-omap.c" #endif -#if !(defined(CONFIG_PCI) || defined(CONFIG_SA1111) || defined(CONFIG_ARCH_OMAP)) +#ifdef CONFIG_ARCH_LH7A404 +#include "ohci-lh7a404.c" +#endif + +#if !(defined(CONFIG_PCI) \ + || defined(CONFIG_SA1111) \ + || defined(CONFIG_ARCH_OMAP) \ + || defined (CONFIG_ARCH_LH7A404) \ + ) #error "missing bus glue for ohci-hcd" #endif diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 516d87d9c..bb6c3da23 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -20,20 +20,20 @@ * till some bits (mostly reserved) are clear; ok for all revs. */ #define read_roothub(hc, register, mask) ({ \ - u32 temp = readl (&hc->regs->roothub.register); \ + u32 temp = ohci_readl (&hc->regs->roothub.register); \ if (temp == -1) \ disable (hc); \ else if (hc->flags & OHCI_QUIRK_AMD756) \ while (temp & mask) \ - temp = readl (&hc->regs->roothub.register); \ + temp = ohci_readl (&hc->regs->roothub.register); \ temp; }) static u32 roothub_a (struct ohci_hcd *hc) { return read_roothub (hc, a, 0xfc0fe000); } static inline u32 roothub_b (struct ohci_hcd *hc) - { return readl (&hc->regs->roothub.b); } + { return ohci_readl (&hc->regs->roothub.b); } static inline u32 roothub_status (struct ohci_hcd *hc) - { return readl (&hc->regs->roothub.status); } + { return ohci_readl (&hc->regs->roothub.status); } static u32 roothub_portstatus (struct ohci_hcd *hc, int i) { return read_roothub (hc, portstatus [i], 0xffe0fce0); } @@ -83,14 +83,14 @@ static int ohci_hub_suspend (struct usb_hcd *hcd) spin_lock_irq (&ohci->lock); - ohci->hc_control = readl (&ohci->regs->control); + ohci->hc_control = ohci_readl (&ohci->regs->control); switch (ohci->hc_control & OHCI_CTRL_HCFS) { case OHCI_USB_RESUME: ohci_dbg (ohci, "resume/suspend?\n"); ohci->hc_control &= ~OHCI_CTRL_HCFS; ohci->hc_control |= OHCI_USB_RESET; writel (ohci->hc_control, &ohci->regs->control); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); /* FALL THROUGH */ case OHCI_USB_RESET: status = -EBUSY; @@ -109,7 +109,7 @@ static int ohci_hub_suspend (struct usb_hcd *hcd) ohci->hc_control &= ~OHCI_SCHED_ENABLES; writel (ohci->hc_control, &ohci->regs->control); - ohci->hc_control = readl (&ohci->regs->control); + ohci->hc_control = ohci_readl (&ohci->regs->control); writel (OHCI_INTR_SF, &ohci->regs->intrstatus); /* sched disables take effect on the next frame, @@ -120,7 +120,7 @@ static int ohci_hub_suspend (struct usb_hcd *hcd) while (limit > 0) { udelay (250); limit =- 250; - if (readl (&ohci->regs->intrstatus) & OHCI_INTR_SF) + if (ohci_readl (&ohci->regs->intrstatus) & OHCI_INTR_SF) break; } dl_done_list (ohci, 0); @@ -128,7 +128,7 @@ static int ohci_hub_suspend (struct usb_hcd *hcd) } dl_done_list (ohci, 0); finish_unlinks (ohci, OHCI_FRAME_NO(ohci->hcca), 0); - writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus); + writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus); /* maybe resume can wake root hub */ if (ohci->hcd.remote_wakeup) @@ -140,7 +140,7 @@ static int ohci_hub_suspend (struct usb_hcd *hcd) ohci->hc_control &= ~OHCI_CTRL_HCFS; ohci->hc_control |= OHCI_USB_SUSPEND; writel (ohci->hc_control, &ohci->regs->control); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); /* no resumes until devices finish suspending */ ohci->next_statechange = jiffies + msecs_to_jiffies (5); @@ -179,13 +179,13 @@ static int ohci_hub_resume (struct usb_hcd *hcd) return -EAGAIN; spin_lock_irq (&ohci->lock); - ohci->hc_control = readl (&ohci->regs->control); + ohci->hc_control = ohci_readl (&ohci->regs->control); switch (ohci->hc_control & OHCI_CTRL_HCFS) { case OHCI_USB_SUSPEND: ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES); ohci->hc_control |= OHCI_USB_RESUME; writel (ohci->hc_control, &ohci->regs->control); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); ohci_dbg (ohci, "resume root hub\n"); break; case OHCI_USB_RESUME: @@ -210,7 +210,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd) temp = roothub_a (ohci) & RH_A_NDP; enables = 0; while (temp--) { - u32 stat = readl (&ohci->regs->roothub.portstatus [temp]); + u32 stat = ohci_readl (&ohci->regs->roothub.portstatus [temp]); /* force global, not selective, resume */ if (!(stat & RH_PS_PSS)) @@ -222,7 +222,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd) ohci->hcd.state = USB_STATE_RESUMING; mdelay (20 /* usb 11.5.1.10 */ + 15); - temp = readl (&ohci->regs->control); + temp = ohci_readl (&ohci->regs->control); temp &= OHCI_CTRL_HCFS; if (temp != OHCI_USB_RESUME) { ohci_err (ohci, "controller won't resume\n"); @@ -243,11 +243,11 @@ static int ohci_hub_resume (struct usb_hcd *hcd) writel (OHCI_INTR_INIT, &ohci->regs->intrenable); if (ohci->ed_rm_list) writel (OHCI_INTR_SF, &ohci->regs->intrenable); - writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus); + writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus); /* Then re-enable operations */ writel (OHCI_USB_OPER, &ohci->regs->control); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); msleep (3); temp = OHCI_CONTROL_INIT | OHCI_USB_OPER; @@ -255,7 +255,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd) temp |= OHCI_CTRL_RWC; ohci->hc_control = temp; writel (temp, &ohci->regs->control); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); /* TRSMRCY */ msleep (10); @@ -290,7 +290,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd) writel (ohci->hc_control, &ohci->regs->control); if (temp) writel (status, &ohci->regs->cmdstatus); - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); } ohci->hcd.state = USB_STATE_RUNNING; @@ -332,7 +332,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) if (!HCD_IS_RUNNING(ohci->hcd.state)) return -ESHUTDOWN; ohci_err (ohci, "bogus NDP=%d, rereads as NDP=%d\n", - ports, readl (&ohci->regs->roothub.a) & RH_A_NDP); + ports, ohci_readl (&ohci->regs->roothub.a) & RH_A_NDP); /* retry later; "should not happen" */ return 0; } @@ -496,7 +496,7 @@ static int ohci_hub_control ( goto error; } writel (temp, &ohci->regs->roothub.portstatus [wIndex]); - // readl (&ohci->regs->roothub.portstatus [wIndex]); + // ohci_readl (&ohci->regs->roothub.portstatus [wIndex]); break; case GetHubDescriptor: ohci_hub_descriptor (ohci, (struct usb_hub_descriptor *) buf); @@ -541,7 +541,7 @@ static int ohci_hub_control ( &ohci->regs->roothub.portstatus [wIndex]); break; case USB_PORT_FEAT_RESET: - temp = readl (&ohci->regs->roothub.portstatus [wIndex]); + temp = ohci_readl (&ohci->regs->roothub.portstatus [wIndex]); if (temp & RH_PS_CCS) writel (RH_PS_PRS, &ohci->regs->roothub.portstatus [wIndex]); diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index eba974d5c..b82c93985 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -454,7 +454,6 @@ int usb_hcd_omap_probe (const struct hc_driver *driver, */ void usb_hcd_omap_remove (struct usb_hcd *hcd, struct omap_dev *dev) { - struct usb_device *hub; void *base; info ("remove: %s, state %x", hcd->self.bus_name, hcd->state); @@ -462,11 +461,10 @@ void usb_hcd_omap_remove (struct usb_hcd *hcd, struct omap_dev *dev) if (in_interrupt ()) BUG (); - hub = hcd->self.root_hub; hcd->state = USB_STATE_QUIESCING; dbg ("%s: roothub graceful disconnect", hcd->self.bus_name); - usb_disconnect (&hub); + usb_disconnect (&hcd->self.root_hub); hcd->driver->stop (hcd); hcd_buffer_destroy (hcd); diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index f103b15b5..76741410f 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c @@ -321,7 +321,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) if (!ed->hwNextED) { ohci->hc_control &= ~OHCI_CTRL_CLE; writel (ohci->hc_control, &ohci->regs->control); - // a readl() later syncs CLE with the HC + // a ohci_readl() later syncs CLE with the HC } else writel (le32_to_cpup (&ed->hwNextED), &ohci->regs->ed_controlhead); @@ -345,7 +345,7 @@ static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) if (!ed->hwNextED) { ohci->hc_control &= ~OHCI_CTRL_BLE; writel (ohci->hc_control, &ohci->regs->control); - // a readl() later syncs BLE with the HC + // a ohci_readl() later syncs BLE with the HC } else writel (le32_to_cpup (&ed->hwNextED), &ohci->regs->ed_bulkhead); @@ -481,7 +481,7 @@ static void start_ed_unlink (struct ohci_hcd *ohci, struct ed *ed) writel (OHCI_INTR_SF, &ohci->regs->intrstatus); writel (OHCI_INTR_SF, &ohci->regs->intrenable); // flush those writes, and get latest HCCA contents - (void) readl (&ohci->regs->control); + (void) ohci_readl (&ohci->regs->control); /* SF interrupt might get delayed; record the frame counter value that * indicates when the HC isn't looking at it, so concurrent unlinks diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 5b599cb64..34cce497e 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c @@ -237,7 +237,6 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver, */ void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev) { - struct usb_device *hub; void *base; info ("remove: %s, state %x", hcd->self.bus_name, hcd->state); @@ -245,11 +244,10 @@ void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev) if (in_interrupt ()) BUG (); - hub = hcd->self.root_hub; hcd->state = USB_STATE_QUIESCING; dbg ("%s: roothub graceful disconnect", hcd->self.bus_name); - usb_disconnect (&hub); + usb_disconnect (&hcd->self.root_hub); hcd->driver->stop (hcd); hcd->state = USB_STATE_HALT; diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 70f32ef72..5f0384417 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -429,3 +429,22 @@ static inline void periodic_reinit (struct ohci_hcd *ohci) # define ohci_vdbg(ohci, fmt, args...) do { } while (0) #endif +#ifdef CONFIG_ARCH_LH7A404 + /* Marc Singer: at the time this code was written, the LH7A404 + * had a problem reading the USB host registers. This + * implementation of the ohci_readl function performs the read + * twice as a work-around. + */ +static inline unsigned int ohci_readl (void* regs) +{ + *(volatile unsigned int*) regs; + return *(volatile unsigned int*) regs; +} +#else + /* Standard version of ohci_readl uses standard, platform + * specific implementation. */ +static inline unsigned int ohci_readl (void* regs) +{ + return readl (regs); +} +#endif diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index afe032003..92d1c28c2 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -103,8 +103,8 @@ static void uhci_free_pending_tds(struct uhci_hcd *uhci); static void hc_state_transitions(struct uhci_hcd *uhci); /* If a transfer is still active after this much time, turn off FSBR */ -#define IDLE_TIMEOUT (HZ / 20) /* 50 ms */ -#define FSBR_DELAY (HZ / 20) /* 50 ms */ +#define IDLE_TIMEOUT msecs_to_jiffies(50) +#define FSBR_DELAY msecs_to_jiffies(50) /* When we timeout an idle transfer for FSBR, we'll switch it over to */ /* depth first traversal. We'll do it in groups of this number of TD's */ @@ -1611,6 +1611,7 @@ static void stall_callback(unsigned long ptr) struct uhci_hcd *uhci = hcd_to_uhci(hcd); struct list_head list, *tmp, *head; unsigned long flags; + int called_uhci_finish_completion = 0; INIT_LIST_HEAD(&list); @@ -1619,6 +1620,7 @@ static void stall_callback(unsigned long ptr) uhci_get_current_frame_number(uhci) != uhci->urb_remove_age) { uhci_remove_pending_urbps(uhci); uhci_finish_completion(hcd, NULL); + called_uhci_finish_completion = 1; } head = &uhci->urb_list; @@ -1646,6 +1648,10 @@ static void stall_callback(unsigned long ptr) } spin_unlock_irqrestore(&uhci->schedule_lock, flags); + /* Wake up anyone waiting for an URB to complete */ + if (called_uhci_finish_completion) + wake_up_all(&uhci->waitqh); + head = &list; tmp = head->next; while (tmp != head) { @@ -1676,7 +1682,7 @@ static int init_stall_timer(struct usb_hcd *hcd) init_timer(&uhci->stall_timer); uhci->stall_timer.function = stall_callback; uhci->stall_timer.data = (unsigned long)hcd; - uhci->stall_timer.expires = jiffies + (HZ / 10); + uhci->stall_timer.expires = jiffies + msecs_to_jiffies(100); add_timer(&uhci->stall_timer); return 0; @@ -1831,16 +1837,20 @@ static void reset_hc(struct uhci_hcd *uhci) { unsigned int io_addr = uhci->io_addr; + /* Turn off PIRQ, SMI, and all interrupts. This also turns off + * the BIOS's USB Legacy Support. + */ + pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); + outw(0, uhci->io_addr + USBINTR); + /* Global reset for 50ms */ uhci->state = UHCI_RESET; outw(USBCMD_GRESET, io_addr + USBCMD); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout((HZ*50+999) / 1000); + msleep(50); outw(0, io_addr + USBCMD); /* Another 10ms delay */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout((HZ*10+999) / 1000); + msleep(10); uhci->resume_detect = 0; } @@ -1865,7 +1875,7 @@ static void wakeup_hc(struct uhci_hcd *uhci) /* Global resume for >= 20ms */ outw(USBCMD_FGR | USBCMD_EGSM, io_addr + USBCMD); uhci->state = UHCI_RESUMING_1; - uhci->state_end = jiffies + (20*HZ+999) / 1000; + uhci->state_end = jiffies + msecs_to_jiffies(20); break; case UHCI_RESUMING_1: /* End global resume */ @@ -1990,7 +2000,9 @@ static void start_hc(struct uhci_hcd *uhci) } } - /* Turn on all interrupts */ + /* Turn on PIRQ and all interrupts */ + pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, + USBLEGSUP_DEFAULT); outw(USBINTR_TIMEOUT | USBINTR_RESUME | USBINTR_IOC | USBINTR_SP, io_addr + USBINTR); @@ -2054,15 +2066,10 @@ static int uhci_reset(struct usb_hcd *hcd) uhci->io_addr = (unsigned long) hcd->regs; - /* Turn off all interrupts */ - outw(0, uhci->io_addr + USBINTR); - - /* Maybe kick BIOS off this hardware. Then reset, so we won't get + /* Kick BIOS off this hardware and reset, so we won't get * interrupts from any previous setup. */ reset_hc(uhci); - pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, - USBLEGSUP_DEFAULT); return 0; } @@ -2178,7 +2185,7 @@ static int uhci_start(struct usb_hcd *hcd) uhci->rh_numports = port; - hcd->self.root_hub = udev = usb_alloc_dev(NULL, &hcd->self, 0); + udev = usb_alloc_dev(NULL, &hcd->self, 0); if (!udev) { dev_err(uhci_dev(uhci), "unable to allocate root hub\n"); goto err_alloc_root_hub; @@ -2260,7 +2267,7 @@ static int uhci_start(struct usb_hcd *hcd) udev->speed = USB_SPEED_FULL; - if (usb_register_root_hub(udev, uhci_dev(uhci)) != 0) { + if (hcd_register_root(udev, &uhci->hcd) != 0) { dev_err(uhci_dev(uhci), "unable to start root hub\n"); retval = -ENOMEM; goto err_start_root_hub; @@ -2288,7 +2295,6 @@ err_alloc_skelqh: err_alloc_term_td: usb_put_dev(udev); - hcd->self.root_hub = NULL; err_alloc_root_hub: dma_pool_destroy(uhci->qh_pool); @@ -2369,14 +2375,18 @@ static int uhci_resume(struct usb_hcd *hcd) /* * Some systems don't maintain the UHCI register values * during a PM suspend/resume cycle, so reinitialize - * the Frame Number, the Framelist Base Address, and the - * Interrupt Enable registers. + * the Frame Number, Framelist Base Address, Interrupt + * Enable, and Legacy Support registers. */ + pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, + 0); outw(uhci->saved_framenumber, uhci->io_addr + USBFRNUM); outl(uhci->fl->dma_handle, uhci->io_addr + USBFLBASEADD); outw(USBINTR_TIMEOUT | USBINTR_RESUME | USBINTR_IOC | USBINTR_SP, uhci->io_addr + USBINTR); uhci->resume_detect = 1; + pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, + USBLEGSUP_DEFAULT); } else { reset_hc(uhci); start_hc(uhci); diff --git a/drivers/usb/image/hpusbscsi.c b/drivers/usb/image/hpusbscsi.c index bd69f10c6..dabc3666a 100644 --- a/drivers/usb/image/hpusbscsi.c +++ b/drivers/usb/image/hpusbscsi.c @@ -11,7 +11,7 @@ #include #include #include "../../scsi/scsi.h" -#include "../../scsi/hosts.h" +#include #include "hpusbscsi.h" diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c index b05c16866..d9461e342 100644 --- a/drivers/usb/image/mdc800.c +++ b/drivers/usb/image/mdc800.c @@ -667,10 +667,10 @@ static int mdc800_device_release (struct inode* inode, struct file *file) /* * The Device read callback Function */ -static ssize_t mdc800_device_read (struct file *file, char *buf, size_t len, loff_t *pos) +static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t len, loff_t *pos) { size_t left=len, sts=len; /* single transfer size */ - char* ptr=buf; + char __user *ptr = buf; long timeout; DECLARE_WAITQUEUE(wait, current); @@ -767,7 +767,7 @@ static ssize_t mdc800_device_read (struct file *file, char *buf, size_t len, lof * After this the driver initiates the request for the answer or * just waits until the camera becomes ready. */ -static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t len, loff_t *pos) +static ssize_t mdc800_device_write (struct file *file, const char __user *buf, size_t len, loff_t *pos) { size_t i=0; DECLARE_WAITQUEUE(wait, current); diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 19acf6221..94f6f2719 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -136,7 +136,7 @@ #include #include #include "../../scsi/scsi.h" -#include "../../scsi/hosts.h" +#include #include "microtek.h" diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 0f0282289..dc2f8f06c 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig @@ -219,14 +219,16 @@ config USB_XPAD module will be called xpad. config USB_ATI_REMOTE - tristate "ATI USB RF remote control" + tristate "ATI / X10 USB RF remote control" depends on USB && INPUT ---help--- - Say Y here if you want to use one of ATI's USB remote controls. - These are RF remotes with USB receivers. They come with many of ATI's - All-In-Wonder video cards. This driver provides mouse pointer, left - and right mouse buttons, and maps all the other remote buttons to - keypress events. + Say Y here if you want to use an ATI or X10 "Lola" USB remote control. + These are RF remotes with USB receivers. + The ATI remote comes with many of ATI's All-In-Wonder video cards. + The X10 "Lola" remote is available at: + http://www.x10.com/products/lola_sg1.htm + This driver provides mouse pointer, left and right mouse buttons, + and maps all the other remote buttons to keypress events. To compile this driver as a module, choose M here: the module will be called ati_remote. diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index 0ac83aa87..c1f1c1d20 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c @@ -16,6 +16,12 @@ * * Feb 2004: Torrey Hoffman * Version 2.2.0 + * Jun 2004: Torrey Hoffman + * Version 2.2.1 + * Added key repeat support contributed by: + * Vincent Vanackere + * Added support for the "Lola" remote contributed by: + * Seth Cohn * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -41,6 +47,11 @@ * "All-In-Wonder" video card packages. The receiver self-identifies as a * "USB Receiver" with manufacturer "X10 Wireless Technology Inc". * + * The "Lola" remote is available from X10. See: + * http://www.x10.com/products/lola_sg1.htm + * The Lola is similar to the ATI remote but has no mouse support, and slightly + * different keys. + * * It is possible to use multiple receivers and remotes on multiple computers * simultaneously by configuring them to use specific channels. * @@ -90,8 +101,9 @@ #define ATI_REMOTE_VENDOR_ID 0x0bc7 #define ATI_REMOTE_PRODUCT_ID 0x004 +#define LOLA_REMOTE_PRODUCT_ID 0x002 -#define DRIVER_VERSION "2.2.0" +#define DRIVER_VERSION "2.2.1" #define DRIVER_AUTHOR "Torrey Hoffman " #define DRIVER_DESC "ATI/X10 RF USB Remote Control" @@ -113,6 +125,7 @@ MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); static struct usb_device_id ati_remote_table[] = { { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) }, + { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) }, {} /* Terminating entry */ }; @@ -134,10 +147,13 @@ static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; /* Duplicate event filtering time. * Sequential, identical KIND_FILTERED inputs with less than - * FILTER_TIME jiffies between them are dropped. - * (HZ >> 4) == 1/16th of a second and works well for me. + * FILTER_TIME jiffies between them are considered as repeat + * events. The hardware generates 5 events for the first keypress + * and we have to take this into account for an accurate repeat + * behaviour. + * (HZ / 20) == 50 ms and works well for me. */ -#define FILTER_TIME (HZ >> 4) +#define FILTER_TIME (HZ / 20) static DECLARE_MUTEX(disconnect_sem); @@ -161,6 +177,7 @@ struct ati_remote { unsigned char old_data[2]; /* Detect duplicate events */ unsigned long old_jiffies; unsigned long acc_jiffies; /* handle acceleration */ + unsigned int repeat_count; char name[NAME_BUFSIZE]; char phys[NAME_BUFSIZE]; @@ -256,6 +273,12 @@ static struct {KIND_FILTERED, 0xeb, 0x26, EV_KEY, KEY_FORWARD, 1}, /* (>>) */ {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */ {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */ + {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */ + {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */ + {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */ + {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */ + {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */ + {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */ {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0} }; @@ -483,9 +506,20 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) if ((ati_remote->old_data[0] == data[1]) && (ati_remote->old_data[1] == data[2]) && ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { - ati_remote->old_jiffies = jiffies; + ati_remote->repeat_count++; + } + else { + ati_remote->repeat_count = 0; + } + + ati_remote->old_data[0] = data[1]; + ati_remote->old_data[1] = data[2]; + ati_remote->old_jiffies = jiffies; + + if ((ati_remote->repeat_count > 0) + && (ati_remote->repeat_count < 5)) return; - } + input_regs(dev, regs); input_event(dev, ati_remote_tbl[index].type, @@ -494,9 +528,6 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) ati_remote_tbl[index].code, 0); input_sync(dev); - ati_remote->old_data[0] = data[1]; - ati_remote->old_data[1] = data[2]; - ati_remote->old_jiffies = jiffies; return; } @@ -697,9 +728,9 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de /* See if the offered device matches what we can accept */ if ((udev->descriptor.idVendor != ATI_REMOTE_VENDOR_ID) || - (udev->descriptor.idProduct != ATI_REMOTE_PRODUCT_ID)) { + ( (udev->descriptor.idProduct != ATI_REMOTE_PRODUCT_ID) && + (udev->descriptor.idProduct != LOLA_REMOTE_PRODUCT_ID) )) return -ENODEV; - } /* Allocate and clear an ati_remote struct */ if (!(ati_remote = kmalloc(sizeof (struct ati_remote), GFP_KERNEL))) @@ -856,4 +887,3 @@ module_exit(ati_remote_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 663a6b764..ff0010d95 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1324,12 +1324,14 @@ void hid_init_reports(struct hid_device *hid) } err = 0; - while ((ret = hid_wait_io(hid))) { + ret = hid_wait_io(hid); + while (ret) { err |= ret; if (test_bit(HID_CTRL_RUNNING, &hid->iofl)) usb_unlink_urb(hid->urbctrl); if (test_bit(HID_OUT_RUNNING, &hid->iofl)) usb_unlink_urb(hid->urbout); + ret = hid_wait_io(hid); } if (err) diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index c995d93f6..159a0d23b 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c @@ -295,7 +295,7 @@ static int hiddev_open(struct inode * inode, struct file * file) { /* * "write" file op */ -static ssize_t hiddev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos) +static ssize_t hiddev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) { return -EINVAL; } @@ -303,7 +303,7 @@ static ssize_t hiddev_write(struct file * file, const char * buffer, size_t coun /* * "read" file op */ -static ssize_t hiddev_read(struct file * file, char * buffer, size_t count, loff_t *ppos) +static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) { DECLARE_WAITQUEUE(wait, current); struct hiddev_list *list = file->private_data; @@ -406,6 +406,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd struct hiddev_devinfo dinfo; struct hid_report *report; struct hid_field *field; + void __user *user_arg = (void __user *)arg; int i; if (!hiddev->exist) @@ -414,7 +415,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case HIDIOCGVERSION: - return put_user(HID_VERSION, (int *) arg); + return put_user(HID_VERSION, (int __user *)arg); case HIDIOCAPPLICATION: if (arg < 0 || arg >= hid->maxapplication) @@ -439,13 +440,13 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd dinfo.product = dev->descriptor.idProduct; dinfo.version = dev->descriptor.bcdDevice; dinfo.num_applications = hid->maxapplication; - if (copy_to_user((void *) arg, &dinfo, sizeof(dinfo))) + if (copy_to_user(user_arg, &dinfo, sizeof(dinfo))) return -EFAULT; return 0; case HIDIOCGFLAG: - if (put_user(list->flags, (int *) arg)) + if (put_user(list->flags, (int __user *)arg)) return -EFAULT; return 0; @@ -453,7 +454,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd case HIDIOCSFLAG: { int newflags; - if (get_user(newflags, (int *) arg)) + if (get_user(newflags, (int __user *)arg)) return -EFAULT; if ((newflags & ~HIDDEV_FLAGS) != 0 || @@ -471,7 +472,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd int idx, len; char *buf; - if (get_user(idx, (int *) arg)) + if (get_user(idx, (int __user *)arg)) return -EFAULT; if ((buf = kmalloc(HID_STRING_SIZE, GFP_KERNEL)) == NULL) @@ -482,7 +483,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return -EINVAL; } - if (copy_to_user((void *) (arg+sizeof(int)), buf, len+1)) { + if (copy_to_user(user_arg+sizeof(int), buf, len+1)) { kfree(buf); return -EFAULT; } @@ -498,7 +499,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case HIDIOCGREPORT: - if (copy_from_user(&rinfo, (void *) arg, sizeof(rinfo))) + if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) return -EFAULT; if (rinfo.report_type == HID_REPORT_TYPE_OUTPUT) @@ -513,7 +514,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case HIDIOCSREPORT: - if (copy_from_user(&rinfo, (void *) arg, sizeof(rinfo))) + if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) return -EFAULT; if (rinfo.report_type == HID_REPORT_TYPE_INPUT) @@ -527,7 +528,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case HIDIOCGREPORTINFO: - if (copy_from_user(&rinfo, (void *) arg, sizeof(rinfo))) + if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) return -EFAULT; if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) @@ -535,13 +536,13 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd rinfo.num_fields = report->maxfield; - if (copy_to_user((void *) arg, &rinfo, sizeof(rinfo))) + if (copy_to_user(user_arg, &rinfo, sizeof(rinfo))) return -EFAULT; return 0; case HIDIOCGFIELDINFO: - if (copy_from_user(&finfo, (void *) arg, sizeof(finfo))) + if (copy_from_user(&finfo, user_arg, sizeof(finfo))) return -EFAULT; rinfo.report_type = finfo.report_type; rinfo.report_id = finfo.report_id; @@ -568,7 +569,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd finfo.unit_exponent = field->unit_exponent; finfo.unit = field->unit; - if (copy_to_user((void *) arg, &finfo, sizeof(finfo))) + if (copy_to_user(user_arg, &finfo, sizeof(finfo))) return -EFAULT; return 0; @@ -578,7 +579,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (!uref_multi) return -ENOMEM; uref = &uref_multi->uref; - if (copy_from_user(uref, (void *) arg, sizeof(*uref))) + if (copy_from_user(uref, user_arg, sizeof(*uref))) goto fault; rinfo.report_type = uref->report_type; @@ -595,7 +596,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd uref->usage_code = field->usage[uref->usage_index].hid; - if (copy_to_user((void *) arg, uref, sizeof(*uref))) + if (copy_to_user(user_arg, uref, sizeof(*uref))) goto fault; kfree(uref_multi); @@ -611,11 +612,11 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return -ENOMEM; uref = &uref_multi->uref; if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { - if (copy_from_user(uref_multi, (void *) arg, + if (copy_from_user(uref_multi, user_arg, sizeof(*uref_multi))) goto fault; } else { - if (copy_from_user(uref, (void *) arg, sizeof(*uref))) + if (copy_from_user(uref, user_arg, sizeof(*uref))) goto fault; } @@ -652,7 +653,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case HIDIOCGUSAGE: uref->value = field->value[uref->usage_index]; - if (copy_to_user((void *) arg, uref, sizeof(*uref))) + if (copy_to_user(user_arg, uref, sizeof(*uref))) goto fault; goto goodreturn; @@ -667,7 +668,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd for (i = 0; i < uref_multi->num_values; i++) uref_multi->values[i] = field->value[uref->usage_index + i]; - if (copy_to_user((void *) arg, uref_multi, + if (copy_to_user(user_arg, uref_multi, sizeof(*uref_multi))) goto fault; goto goodreturn; @@ -689,7 +690,7 @@ inval: return -EINVAL; case HIDIOCGCOLLECTIONINFO: - if (copy_from_user(&cinfo, (void *) arg, sizeof(cinfo))) + if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) return -EFAULT; if (cinfo.index >= hid->maxcollection) @@ -699,7 +700,7 @@ inval: cinfo.usage = hid->collection[cinfo.index].usage; cinfo.level = hid->collection[cinfo.index].level; - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(user_arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -715,7 +716,7 @@ inval: len = strlen(hid->name) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); - return copy_to_user((char *) arg, hid->name, len) ? + return copy_to_user(user_arg, hid->name, len) ? -EFAULT : len; } @@ -726,7 +727,7 @@ inval: len = strlen(hid->phys) + 1; if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); - return copy_to_user((char *) arg, hid->phys, len) ? + return copy_to_user(user_arg, hid->phys, len) ? -EFAULT : len; } } diff --git a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig index eba7ef348..03947be69 100644 --- a/drivers/usb/media/Kconfig +++ b/drivers/usb/media/Kconfig @@ -108,7 +108,7 @@ config USB_OV511 config USB_PWC tristate "USB Philips Cameras" - depends on USB && VIDEO_DEV && BROKEN + depends on USB && VIDEO_DEV && CONFIG_BROKEN ---help--- Say Y or M here if you want to use one of these Philips & OEM webcams: diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c index 4510ace39..2c021bfec 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/usb/media/dabusb.c @@ -476,7 +476,7 @@ static int dabusb_startrek (pdabusb_t s) return 0; } -static ssize_t dabusb_read (struct file *file, char *buf, size_t count, loff_t * ppos) +static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, loff_t * ppos) { pdabusb_t s = (pdabusb_t) file->private_data; unsigned long flags; @@ -670,7 +670,7 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm break; } - if (copy_from_user (pbulk, (void *) arg, sizeof (bulk_transfer_t))) { + if (copy_from_user (pbulk, (void __user *) arg, sizeof (bulk_transfer_t))) { ret = -EFAULT; kfree (pbulk); break; @@ -678,18 +678,18 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm ret=dabusb_bulk (s, pbulk); if(ret==0) - if (copy_to_user((void *)arg, pbulk, + if (copy_to_user((void __user *)arg, pbulk, sizeof(bulk_transfer_t))) ret = -EFAULT; kfree (pbulk); break; case IOCTL_DAB_OVERRUNS: - ret = put_user (s->overruns, (unsigned int *) arg); + ret = put_user (s->overruns, (unsigned int __user *) arg); break; case IOCTL_DAB_VERSION: - ret = put_user (version, (unsigned int *) arg); + ret = put_user (version, (unsigned int __user *) arg); break; default: diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index c9cef9900..e1007b0b6 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c @@ -4593,7 +4593,7 @@ ov51x_v4l1_ioctl(struct inode *inode, struct file *file, } static ssize_t -ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) +ov51x_v4l1_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos) { struct video_device *vdev = file->private_data; int noblock = file->f_flags&O_NONBLOCK; diff --git a/drivers/usb/media/ov511.h b/drivers/usb/media/ov511.h index fafd7ecf2..086509a13 100644 --- a/drivers/usb/media/ov511.h +++ b/drivers/usb/media/ov511.h @@ -11,7 +11,7 @@ #ifdef OV511_DEBUG #define PDEBUG(level, fmt, args...) \ if (debug >= (level)) info("[%s:%d] " fmt, \ - __PRETTY_FUNCTION__, __LINE__ , ## args) + __FUNCTION__, __LINE__ , ## args) #else #define PDEBUG(level, fmt, args...) do {} while(0) #endif diff --git a/drivers/usb/media/pwc-if.c b/drivers/usb/media/pwc-if.c index 4d503a20b..480797464 100644 --- a/drivers/usb/media/pwc-if.c +++ b/drivers/usb/media/pwc-if.c @@ -129,8 +129,7 @@ static struct { static int pwc_video_open(struct inode *inode, struct file *file); static int pwc_video_close(struct inode *inode, struct file *file); -static int pwc_video_release(struct video_device *); -static ssize_t pwc_video_read(struct file *file, char *buf, +static ssize_t pwc_video_read(struct file *file, char __user *buf, size_t count, loff_t *ppos); static unsigned int pwc_video_poll(struct file *file, poll_table *wait); static int pwc_video_ioctl(struct inode *inode, struct file *file, @@ -1121,12 +1120,6 @@ static int pwc_video_close(struct inode *inode, struct file *file) return 0; } -static int pwc_video_release(struct video_device *vfd) -{ - Trace(TRACE_OPEN, "pwc_video_release() called. Now what?\n"); -} - - /* * FIXME: what about two parallel reads ???? * ANSWER: Not supported. You can't open the device more than once, @@ -1139,7 +1132,7 @@ static int pwc_video_release(struct video_device *vfd) device is tricky anyhow. */ -static ssize_t pwc_video_read(struct file *file, char *buf, +static ssize_t pwc_video_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct video_device *vdev = file->private_data; @@ -1855,7 +1848,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id } } - pdev->vdev.release = pwc_video_release; + pdev->vdev.release = video_device_release; i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr); if (i < 0) { Err("Failed to register as video device (%d).\n", i); diff --git a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c index ac19cfb5d..cea90d966 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/usb/media/se401.c @@ -1121,7 +1121,7 @@ static int se401_ioctl(struct inode *inode, struct file *file, return video_usercopy(inode, file, cmd, arg, se401_do_ioctl); } -static ssize_t se401_read(struct file *file, char *buf, +static ssize_t se401_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { int realcount=count, ret=0; diff --git a/drivers/usb/media/stv680.c b/drivers/usb/media/stv680.c index 10feeb7c1..af460298a 100644 --- a/drivers/usb/media/stv680.c +++ b/drivers/usb/media/stv680.c @@ -1309,7 +1309,7 @@ static int stv680_mmap (struct file *file, struct vm_area_struct *vma) return 0; } -static ssize_t stv680_read (struct file *file, char *buf, +static ssize_t stv680_read (struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct video_device *dev = file->private_data; diff --git a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c index 178a7b839..d46b136c9 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/usb/media/usbvideo.c @@ -46,7 +46,7 @@ static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); static int usbvideo_v4l_open(struct inode *inode, struct file *file); -static ssize_t usbvideo_v4l_read(struct file *file, char *buf, +static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, size_t count, loff_t *ppos); static int usbvideo_v4l_close(struct inode *inode, struct file *file); @@ -1587,7 +1587,7 @@ static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, * 20-Oct-2000 Created. * 01-Nov-2000 Added mutex (uvd->lock). */ -static ssize_t usbvideo_v4l_read(struct file *file, char *buf, +static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct uvd *uvd = file->private_data; diff --git a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c index 79629c370..1e416c1de 100644 --- a/drivers/usb/media/vicam.c +++ b/drivers/usb/media/vicam.c @@ -523,9 +523,9 @@ set_camera_power(struct vicam_camera *cam, int state) } static int -vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long ul_arg) +vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long arg) { - void *arg = (void *)ul_arg; + void __user *user_arg = (void __user *)arg; struct vicam_camera *cam = file->private_data; int retval = 0; @@ -549,7 +549,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign b.minwidth = 320; /* VIDEOSIZE_48_48 */ b.minheight = 240; - if (copy_to_user(arg, &b, sizeof (b))) + if (copy_to_user(user_arg, &b, sizeof(b))) retval = -EFAULT; break; @@ -560,7 +560,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_channel v; DBG("VIDIOCGCHAN\n"); - if (copy_from_user(&v, arg, sizeof (v))) { + if (copy_from_user(&v, user_arg, sizeof(v))) { retval = -EFAULT; break; } @@ -576,7 +576,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign v.type = VIDEO_TYPE_CAMERA; v.norm = 0; - if (copy_to_user(arg, &v, sizeof (v))) + if (copy_to_user(user_arg, &v, sizeof(v))) retval = -EFAULT; break; } @@ -585,7 +585,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { int v; - if (copy_from_user(&v, arg, sizeof (v))) + if (copy_from_user(&v, user_arg, sizeof(v))) retval = -EFAULT; DBG("VIDIOCSCHAN %d\n", v); @@ -604,8 +604,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign vp.brightness = cam->gain << 8; vp.depth = 24; vp.palette = VIDEO_PALETTE_RGB24; - if (copy_to_user - (arg, &vp, sizeof (struct video_picture))) + if (copy_to_user(user_arg, &vp, sizeof (struct video_picture))) retval = -EFAULT; break; } @@ -614,7 +613,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { struct video_picture vp; - if (copy_from_user(&vp, arg, sizeof(vp))) { + if (copy_from_user(&vp, user_arg, sizeof(vp))) { retval = -EFAULT; break; } @@ -646,8 +645,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign DBG("VIDIOCGWIN\n"); - if (copy_to_user - ((void *) arg, (void *) &vw, sizeof (vw))) + if (copy_to_user(user_arg, (void *)&vw, sizeof(vw))) retval = -EFAULT; // I'm not sure what the deal with a capture window is, it is very poorly described @@ -660,7 +658,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_window vw; - if (copy_from_user(&vw, arg, sizeof(vw))) { + if (copy_from_user(&vw, user_arg, sizeof(vw))) { retval = -EFAULT; break; } @@ -687,8 +685,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign for (i = 0; i < VICAM_FRAMES; i++) vm.offsets[i] = VICAM_MAX_FRAME_SIZE * i; - if (copy_to_user - ((void *) arg, (void *) &vm, sizeof (vm))) + if (copy_to_user(user_arg, (void *)&vm, sizeof(vm))) retval = -EFAULT; break; @@ -699,8 +696,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_mmap vm; // int video_size; - if (copy_from_user - ((void *) &vm, (void *) arg, sizeof (vm))) { + if (copy_from_user((void *)&vm, user_arg, sizeof(vm))) { retval = -EFAULT; break; } @@ -723,7 +719,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { int frame; - if (copy_from_user((void *) &frame, arg, sizeof (int))) { + if (copy_from_user((void *)&frame, user_arg, sizeof(int))) { retval = -EFAULT; break; } @@ -1003,7 +999,7 @@ read_frame(struct vicam_camera *cam, int framenum) } static ssize_t -vicam_read( struct file *file, char *buf, size_t count, loff_t *ppos ) +vicam_read( struct file *file, char __user *buf, size_t count, loff_t *ppos ) { struct vicam_camera *cam = file->private_data; diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index eb257e55a..fccd94e8c 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c @@ -388,7 +388,7 @@ MODULE_PARM_DESC(specific_debug, static struct file_operations w9968cf_fops; static int w9968cf_open(struct inode*, struct file*); static int w9968cf_release(struct inode*, struct file*); -static ssize_t w9968cf_read(struct file*, char*, size_t, loff_t*); +static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); static int w9968cf_mmap(struct file*, struct vm_area_struct*); static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, void*); @@ -444,8 +444,8 @@ static inline unsigned long w9968cf_get_max_bufsize(struct w9968cf_device*); /* High-level CMOS sensor control functions */ static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); -static inline int w9968cf_sensor_cmd(struct w9968cf_device*, - unsigned int cmd, void *arg); +static int w9968cf_sensor_cmd(struct w9968cf_device*, + unsigned int cmd, void *arg); static int w9968cf_sensor_init(struct w9968cf_device*); static int w9968cf_sensor_update_settings(struct w9968cf_device*); static int w9968cf_sensor_get_picture(struct w9968cf_device*); @@ -461,7 +461,7 @@ static int w9968cf_init_chip(struct w9968cf_device*); static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); static int w9968cf_set_window(struct w9968cf_device*, struct video_window); static inline u16 w9968cf_valid_palette(u16 palette); -static inline u16 w9968cf_valid_depth(u16 palette); +static u16 w9968cf_valid_depth(u16 palette); static inline u8 w9968cf_need_decompression(u16 palette); static int w9968cf_postprocess_frame(struct w9968cf_device*, struct w9968cf_frame_t*); @@ -1959,7 +1959,7 @@ static inline u16 w9968cf_valid_palette(u16 palette) Return the depth corresponding to the given palette. Palette _must_ be supported ! --------------------------------------------------------------------------*/ -static inline u16 w9968cf_valid_depth(u16 palette) +static u16 w9968cf_valid_depth(u16 palette) { u8 i=0; while (w9968cf_formatlist[i].palette != palette) @@ -2178,7 +2178,7 @@ w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) } -static inline int +static int w9968cf_sensor_cmd(struct w9968cf_device* cam, unsigned int cmd, void* arg) { struct i2c_client* c = cam->sensor_client; @@ -2770,7 +2770,7 @@ static int w9968cf_release(struct inode* inode, struct file* filp) static ssize_t -w9968cf_read(struct file* filp, char* buf, size_t count, loff_t* f_pos) +w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) { struct w9968cf_device* cam; struct w9968cf_frame_t* fr; @@ -2915,7 +2915,8 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, unsigned int cmd, void* arg) { struct w9968cf_device* cam; - static const char* v4l1_ioctls[] = { + void __user *user_arg = (void __user *)arg; + const char* v4l1_ioctls[] = { "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", @@ -2923,8 +2924,6 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", "GVBIFMT", "SVBIFMT" }; - struct video_tuner tuner; - struct video_channel chan; #define V4L1_IOCTL(cmd) \ ((_IOC_NR((cmd)) < sizeof(v4l1_ioctls)/sizeof(char*)) ? \ @@ -2950,7 +2949,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, cap.maxheight = (cam->upscaling && w9968cf_vppmod_present) ? W9968CF_MAX_HEIGHT : cam->maxheight; - if (copy_to_user(arg, &cap, sizeof(cap))) + if (copy_to_user(user_arg, &cap, sizeof(cap))) return -EFAULT; DBG(5, "VIDIOCGCAP successfully called.") @@ -2959,7 +2958,8 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCGCHAN: /* get video channel informations */ { - if (copy_from_user(&chan, arg, sizeof(chan))) + struct video_channel chan; + if (copy_from_user(&chan, user_arg, sizeof(chan))) return -EFAULT; if (chan.channel != 0) @@ -2971,7 +2971,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, chan.type = VIDEO_TYPE_CAMERA; chan.norm = VIDEO_MODE_AUTO; - if (copy_to_user(arg, &chan, sizeof(chan))) + if (copy_to_user(user_arg, &chan, sizeof(chan))) return -EFAULT; DBG(5, "VIDIOCGCHAN successfully called.") @@ -2980,7 +2980,9 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCSCHAN: /* set active channel */ { - if (copy_from_user(&chan, arg, sizeof(chan))) + struct video_channel chan; + + if (copy_from_user(&chan, user_arg, sizeof(chan))) return -EFAULT; if (chan.channel != 0) @@ -2995,7 +2997,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, if (w9968cf_sensor_get_picture(cam)) return -EIO; - if (copy_to_user(arg, &cam->picture, sizeof(cam->picture))) + if (copy_to_user(user_arg, &cam->picture, sizeof(cam->picture))) return -EFAULT; DBG(5, "VIDIOCGPICT successfully called.") @@ -3007,7 +3009,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, struct video_picture pict; int err = 0; - if (copy_from_user(&pict, arg, sizeof(pict))) + if (copy_from_user(&pict, user_arg, sizeof(pict))) return -EFAULT; if ( (cam->force_palette || !w9968cf_vppmod_present) @@ -3086,7 +3088,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, struct video_window win; int err = 0; - if (copy_from_user(&win, arg, sizeof(win))) + if (copy_from_user(&win, user_arg, sizeof(win))) return -EFAULT; DBG(6, "VIDIOCSWIN called: clipcount=%d, flags=%d, " @@ -3140,7 +3142,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCGWIN: /* get current window properties */ { - if (copy_to_user(arg,&cam->window,sizeof(struct video_window))) + if (copy_to_user(user_arg, &cam->window, sizeof(struct video_window))) return -EFAULT; DBG(5, "VIDIOCGWIN successfully called.") @@ -3158,7 +3160,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - (unsigned long)cam->frame[0].buffer; - if (copy_to_user(arg, &mbuf, sizeof(mbuf))) + if (copy_to_user(user_arg, &mbuf, sizeof(mbuf))) return -EFAULT; DBG(5, "VIDIOCGMBUF successfully called.") @@ -3171,7 +3173,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, struct w9968cf_frame_t* fr; int err = 0; - if (copy_from_user(&mmap, arg, sizeof(mmap))) + if (copy_from_user(&mmap, user_arg, sizeof(mmap))) return -EFAULT; DBG(6, "VIDIOCMCAPTURE called: frame #%d, format=%s, %dx%d", @@ -3294,7 +3296,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, struct w9968cf_frame_t* fr; int err = 0; - if (copy_from_user(&f_num, arg, sizeof(f_num))) + if (copy_from_user(&f_num, user_arg, sizeof(f_num))) return -EFAULT; if (f_num >= cam->nbuffers) { @@ -3347,7 +3349,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, .teletext = VIDEO_NO_UNIT, }; - if (copy_to_user(arg, &unit, sizeof(unit))) + if (copy_to_user(user_arg, &unit, sizeof(unit))) return -EFAULT; DBG(5, "VIDIOCGUNIT successfully called.") @@ -3359,7 +3361,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCGFBUF: { - if (clear_user(arg, sizeof(struct video_buffer))) + if (clear_user(user_arg, sizeof(struct video_buffer))) return -EFAULT; DBG(5, "VIDIOCGFBUF successfully called.") @@ -3368,7 +3370,8 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCGTUNER: { - if (copy_from_user(&tuner, arg, sizeof(tuner))) + struct video_tuner tuner; + if (copy_from_user(&tuner, user_arg, sizeof(tuner))) return -EFAULT; if (tuner.tuner != 0) @@ -3381,7 +3384,7 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, tuner.mode = VIDEO_MODE_AUTO; tuner.signal = 0xffff; - if (copy_to_user(arg, &tuner, sizeof(tuner))) + if (copy_to_user(user_arg, &tuner, sizeof(tuner))) return -EFAULT; DBG(5, "VIDIOCGTUNER successfully called.") @@ -3390,7 +3393,8 @@ w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, case VIDIOCSTUNER: { - if (copy_from_user(&tuner, arg, sizeof(tuner))) + struct video_tuner tuner; + if (copy_from_user(&tuner, user_arg, sizeof(tuner))) return -EFAULT; if (tuner.tuner != 0) diff --git a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h index 3076d87da..ca9140139 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/usb/media/w9968cf.h @@ -293,7 +293,7 @@ if ( ((specific_debug) && (debug == (level))) || \ warn(fmt, ## args); \ else if ((level) >= 5) \ info("[%s:%d] " fmt, \ - __PRETTY_FUNCTION__, __LINE__ , ## args); \ + __FUNCTION__, __LINE__ , ## args); \ } \ } #else diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index b137da951..e3c4226ce 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -1452,6 +1452,8 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int audevinfo_t devinfo; pauerswald_t cp = NULL; unsigned int u; + unsigned int __user *user_arg = (unsigned int __user *)arg; + dbg ("ioctl"); /* get the mutexes */ @@ -1483,14 +1485,14 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int u = ccp->auerdev && (ccp->scontext.id != AUH_UNASSIGNED) && !list_empty (&cp->bufctl.free_buff_list); - ret = put_user (u, (unsigned int *) arg); + ret = put_user (u, user_arg); break; /* return != 0 if connected to a service channel */ case IOCTL_AU_CONNECT: dbg ("IOCTL_AU_CONNECT"); u = (ccp->scontext.id != AUH_UNASSIGNED); - ret = put_user (u, (unsigned int *) arg); + ret = put_user (u, user_arg); break; /* return != 0 if Receive Data available */ @@ -1511,14 +1513,14 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int u = 1; } } - ret = put_user (u, (unsigned int *) arg); + ret = put_user (u, user_arg); break; /* return the max. buffer length for the device */ case IOCTL_AU_BUFLEN: dbg ("IOCTL_AU_BUFLEN"); u = cp->maxControlLength; - ret = put_user (u, (unsigned int *) arg); + ret = put_user (u, user_arg); break; /* requesting a service channel */ @@ -1527,7 +1529,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int /* requesting a service means: release the previous one first */ auerswald_removeservice (cp, &ccp->scontext); /* get the channel number */ - ret = get_user (u, (unsigned int *) arg); + ret = get_user (u, user_arg); if (ret) { break; } @@ -1564,7 +1566,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int case IOCTL_AU_SLEN: dbg ("IOCTL_AU_SLEN"); u = AUSI_DLEN; - ret = put_user (u, (unsigned int *) arg); + ret = put_user (u, user_arg); break; default: diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index c44f65a0b..8e266eba0 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -236,8 +236,8 @@ struct lego_usb_tower { /* local function prototypes */ -static ssize_t tower_read (struct file *file, char *buffer, size_t count, loff_t *ppos); -static ssize_t tower_write (struct file *file, const char *buffer, size_t count, loff_t *ppos); +static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, loff_t *ppos); +static ssize_t tower_write (struct file *file, const char __user *buffer, size_t count, loff_t *ppos); static inline void tower_delete (struct lego_usb_tower *dev); static int tower_open (struct inode *inode, struct file *file); static int tower_release (struct inode *inode, struct file *file); @@ -560,7 +560,7 @@ static loff_t tower_llseek (struct file *file, loff_t off, int whence) /** * tower_read */ -static ssize_t tower_read (struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct lego_usb_tower *dev; size_t bytes_to_read; @@ -651,7 +651,7 @@ exit: /** * tower_write */ -static ssize_t tower_write (struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t tower_write (struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct lego_usb_tower *dev; size_t bytes_to_write; diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 9018774ae..b89b53401 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -17,6 +17,10 @@ * * CAUTION: Generally you should use 0 < degrees < 180 as anything else * is probably beyond the range of your servo and may damage it. + * + * Jun 16, 2004: Sean Young + * - cleanups + * - was using memory after kfree() */ #include @@ -33,19 +37,36 @@ #define DRIVER_AUTHOR "Sean Young " #define DRIVER_DESC "USB PhidgetServo Driver" -#define VENDOR_ID_GLAB 0x06c2 -#define DEVICE_ID_4MOTOR_SERVO_30 0x0038 -#define DEVICE_ID_1MOTOR_SERVO_30 0x0039 +#define VENDOR_ID_GLAB 0x06c2 +#define DEVICE_ID_GLAB_PHIDGETSERVO_QUAD 0x0038 +#define DEVICE_ID_GLAB_PHIDGETSERVO_UNI 0x0039 + +#define VENDOR_ID_WISEGROUP 0x0925 +#define VENDOR_ID_WISEGROUP_PHIDGETSERVO_QUAD 0x8101 +#define VENDOR_ID_WISEGROUP_PHIDGETSERVO_UNI 0x8104 -#define VENDOR_ID_WISEGROUP 0x0925 -#define DEVICE_ID_1MOTOR_SERVO_20 0x8101 -#define DEVICE_ID_4MOTOR_SERVO_20 0x8104 +#define SERVO_VERSION_30 0x01 +#define SERVO_COUNT_QUAD 0x02 static struct usb_device_id id_table[] = { - {USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_4MOTOR_SERVO_30)}, - {USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_1MOTOR_SERVO_30)}, - {USB_DEVICE(VENDOR_ID_WISEGROUP, DEVICE_ID_4MOTOR_SERVO_20)}, - {USB_DEVICE(VENDOR_ID_WISEGROUP, DEVICE_ID_1MOTOR_SERVO_20)}, + { + USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_GLAB_PHIDGETSERVO_QUAD), + .driver_info = SERVO_VERSION_30 | SERVO_COUNT_QUAD + }, + { + USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_GLAB_PHIDGETSERVO_UNI), + .driver_info = SERVO_VERSION_30 + }, + { + USB_DEVICE(VENDOR_ID_WISEGROUP, + VENDOR_ID_WISEGROUP_PHIDGETSERVO_QUAD), + .driver_info = SERVO_COUNT_QUAD + }, + { + USB_DEVICE(VENDOR_ID_WISEGROUP, + VENDOR_ID_WISEGROUP_PHIDGETSERVO_UNI), + .driver_info = 0 + }, {} }; @@ -53,14 +74,13 @@ MODULE_DEVICE_TABLE(usb, id_table); struct phidget_servo { struct usb_device *udev; - int version; - int quad_servo; + ulong type; int pulse[4]; int degrees[4]; int minutes[4]; }; -static void +static int change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, int minutes) { @@ -71,7 +91,7 @@ change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", __FUNCTION__); - return; + return -ENOMEM; } /* @@ -124,12 +144,13 @@ change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, retval = usb_control_msg(servo->udev, usb_sndctrlpipe(servo->udev, 0), 0x09, 0x21, 0x0200, 0x0000, buffer, 6, 2 * HZ); - if (retval != 6) - dev_err(&servo->udev->dev, "retval = %d\n", retval); + kfree(buffer); + + return retval; } -static void +static int change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, int minutes) { @@ -140,7 +161,7 @@ change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", __FUNCTION__); - return; + return -ENOMEM; } /* @@ -171,16 +192,17 @@ change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, retval = usb_control_msg(servo->udev, usb_sndctrlpipe(servo->udev, 0), 0x09, 0x21, 0x0200, 0x0000, buffer, 2, 2 * HZ); - if (retval != 2) - dev_err(&servo->udev->dev, "retval = %d\n", retval); + kfree(buffer); + + return retval; } #define show_set(value) \ static ssize_t set_servo##value (struct device *dev, \ const char *buf, size_t count) \ { \ - int degrees, minutes; \ + int degrees, minutes, retval; \ struct usb_interface *intf = to_usb_interface (dev); \ struct phidget_servo *servo = usb_get_intfdata (intf); \ \ @@ -195,12 +217,14 @@ static ssize_t set_servo##value (struct device *dev, \ return -EINVAL; \ } \ \ - if (servo->version >= 3) \ - change_position_v30 (servo, value, degrees, minutes); \ + if (servo->type & SERVO_VERSION_30) \ + retval = change_position_v30 (servo, value, degrees, \ + minutes); \ else \ - change_position_v20 (servo, value, degrees, minutes); \ + retval = change_position_v20 (servo, value, degrees, \ + minutes); \ \ - return count; \ + return retval < 0 ? retval : count; \ } \ \ static ssize_t show_servo##value (struct device *dev, char *buf) \ @@ -223,7 +247,7 @@ static int servo_probe(struct usb_interface *interface, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(interface); - struct phidget_servo *dev = NULL; + struct phidget_servo *dev; dev = kmalloc(sizeof (struct phidget_servo), GFP_KERNEL); if (dev == NULL) { @@ -233,37 +257,21 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) memset(dev, 0x00, sizeof (*dev)); dev->udev = usb_get_dev(udev); - switch (udev->descriptor.idVendor) { - case VENDOR_ID_WISEGROUP: - dev->version = 2; - break; - case VENDOR_ID_GLAB: - dev->version = 3; - break; - } - switch (udev->descriptor.idProduct) { - case DEVICE_ID_4MOTOR_SERVO_20: - case DEVICE_ID_4MOTOR_SERVO_30: - dev->quad_servo = 1; - break; - case DEVICE_ID_1MOTOR_SERVO_20: - case DEVICE_ID_1MOTOR_SERVO_30: - dev->quad_servo = 0; - break; - } - + dev->type = id->driver_info; usb_set_intfdata(interface, dev); device_create_file(&interface->dev, &dev_attr_servo0); - if (dev->quad_servo) { + if (dev->type & SERVO_COUNT_QUAD) { device_create_file(&interface->dev, &dev_attr_servo1); device_create_file(&interface->dev, &dev_attr_servo2); device_create_file(&interface->dev, &dev_attr_servo3); } dev_info(&interface->dev, "USB %d-Motor PhidgetServo v%d.0 attached\n", - dev->quad_servo ? 4 : 1, dev->version); - if (dev->version == 2) + dev->type & SERVO_COUNT_QUAD ? 4 : 1, + dev->type & SERVO_VERSION_30 ? 3 : 2); + + if(!(dev->type & SERVO_VERSION_30)) dev_info(&interface->dev, "WARNING: v2.0 not tested! Please report if it works.\n"); @@ -279,7 +287,7 @@ servo_disconnect(struct usb_interface *interface) usb_set_intfdata(interface, NULL); device_remove_file(&interface->dev, &dev_attr_servo0); - if (dev->quad_servo) { + if (dev->type & SERVO_COUNT_QUAD) { device_remove_file(&interface->dev, &dev_attr_servo1); device_remove_file(&interface->dev, &dev_attr_servo2); device_remove_file(&interface->dev, &dev_attr_servo3); @@ -287,10 +295,11 @@ servo_disconnect(struct usb_interface *interface) usb_put_dev(dev->udev); - kfree(dev); - dev_info(&interface->dev, "USB %d-Motor PhidgetServo v%d.0 detached\n", - dev->quad_servo ? 4 : 1, dev->version); + dev->type & SERVO_COUNT_QUAD ? 4 : 1, + dev->type & SERVO_VERSION_30 ? 3 : 2); + + kfree(dev); } static struct usb_driver servo_driver = { @@ -304,7 +313,7 @@ static struct usb_driver servo_driver = { static int __init phidget_servo_init(void) { - int retval = 0; + int retval; retval = usb_register(&servo_driver); if (retval) diff --git a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c index f9609d060..d6e195820 100644 --- a/drivers/usb/misc/speedtch.c +++ b/drivers/usb/misc/speedtch.c @@ -269,7 +269,7 @@ struct udsl_instance_data { static void udsl_atm_dev_close (struct atm_dev *dev); static int udsl_atm_open (struct atm_vcc *vcc); static void udsl_atm_close (struct atm_vcc *vcc); -static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg); +static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg); static int udsl_atm_send (struct atm_vcc *vcc, struct sk_buff *skb); static int udsl_atm_proc_read (struct atm_dev *atm_dev, loff_t *pos, char *page); @@ -991,11 +991,11 @@ static void udsl_atm_close (struct atm_vcc *vcc) dbg ("udsl_atm_close successful"); } -static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg) +static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg) { switch (cmd) { case ATM_QUERYLOOP: - return put_user (ATM_LM_NONE, (int *) arg) ? -EFAULT : 0; + return put_user (ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0; default: return -ENOIOCTLCMD; } diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 2fb1fae8c..404f39763 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -459,8 +459,8 @@ static int perform_sglist ( * or remote wakeup (which needs human interaction). */ -static int realworld = 1; -MODULE_PARM (realworld, "i"); +static unsigned realworld = 1; +module_param (realworld, uint, 0); MODULE_PARM_DESC (realworld, "clear to demand stricter ch9 compliance"); static int get_altsetting (struct usbtest_dev *dev) @@ -1808,17 +1808,17 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf) /*-------------------------------------------------------------------------*/ -static int force_interrupt = 0; -MODULE_PARM (force_interrupt, "i"); +static unsigned force_interrupt = 0; +module_param (force_interrupt, uint, 0); MODULE_PARM_DESC (force_interrupt, "0 = test default; else interrupt"); #ifdef GENERIC -static int vendor; -MODULE_PARM (vendor, "h"); +static unsigned short vendor; +module_param(vendor, ushort, 0); MODULE_PARM_DESC (vendor, "vendor code (from usb-if)"); -static int product; -MODULE_PARM (product, "h"); +static unsigned short product; +module_param(product, ushort, 0); MODULE_PARM_DESC (product, "product code (from vendor)"); #endif diff --git a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c index d705e815a..de9bf863e 100644 --- a/drivers/usb/net/catc.c +++ b/drivers/usb/net/catc.c @@ -672,7 +672,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) struct catc *catc = dev->priv; u32 cmd; - if (get_user(cmd, (u32 *)useraddr)) + if (get_user(cmd, (u32 __user *)useraddr)) return -EFAULT; switch (cmd) { @@ -726,7 +726,7 @@ static int catc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { switch(cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(dev, (void __user *)rq->ifr_data); + return netdev_ethtool_ioctl(dev, rq->ifr_data); default: return -EOPNOTSUPP; } diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index d61d7d7de..42a248f8f 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c @@ -737,7 +737,7 @@ static int kaweth_ioctl(struct net_device *net, struct ifreq *rq, int cmd) { switch (cmd) { case SIOCETHTOOL: - return netdev_ethtool_ioctl(net, (void __user *)rq->ifr_data); + return netdev_ethtool_ioctl(net, rq->ifr_data); } return -EOPNOTSUPP; } diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 917482501..5142d8a07 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c @@ -1030,7 +1030,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr) int cmd; pegasus = net->priv; - if (get_user(cmd, (int *) uaddr)) + if (get_user(cmd, (int __user *) uaddr)) return -EFAULT; switch (cmd) { case ETHTOOL_GDRVINFO:{ @@ -1107,13 +1107,13 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr) #endif static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) { - __u16 *data = (__u16 *) & rq->ifr_data; + __u16 *data = (__u16 *) & rq->ifr_ifru; pegasus_t *pegasus = net->priv; int res; switch (cmd) { case SIOCETHTOOL: - res = pegasus_ethtool_ioctl(net, (void __user *)rq->ifr_data); + res = pegasus_ethtool_ioctl(net, rq->ifr_data); break; case SIOCDEVPRIVATE: data[0] = pegasus->phy; diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h index 411758b7d..7bc24d93f 100644 --- a/drivers/usb/net/pegasus.h +++ b/drivers/usb/net/pegasus.h @@ -121,6 +121,7 @@ struct usb_eth_dev { #define VENDOR_ADMTEK 0x07a6 #define VENDOR_AEILAB 0x3334 #define VENDOR_ALLIEDTEL 0x07c9 +#define VENDOR_ATEN 0x0557 #define VENDOR_BELKIN 0x050d #define VENDOR_BILLIONTON 0x08dd #define VENDOR_COMPAQ 0x049f @@ -150,6 +151,8 @@ struct usb_eth_dev { PEGASUS_DEV( "3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601, DEFAULT_GPIO_RESET | PEGASUS_II ) +PEGASUS_DEV( "ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007, + DEFAULT_GPIO_RESET | PEGASUS_II ) PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c, DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104, diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 52592ef1d..d9d09e984 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c @@ -398,6 +398,21 @@ static void unlink_all_urbs(rtl8150_t * dev) usb_unlink_urb(dev->ctrl_urb); } +static inline struct sk_buff *pull_skb(rtl8150_t *dev) +{ + struct sk_buff *skb; + int i; + + for (i = 0; i < RX_SKB_POOL_SIZE; i++) { + if (dev->rx_skb_pool[i]) { + skb = dev->rx_skb_pool[i]; + dev->rx_skb_pool[i] = NULL; + return skb; + } + } + return NULL; +} + static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) { rtl8150_t *dev; @@ -603,21 +618,6 @@ static void free_skb_pool(rtl8150_t *dev) dev_kfree_skb(dev->rx_skb_pool[i]); } -static inline struct sk_buff *pull_skb(rtl8150_t *dev) -{ - struct sk_buff *skb; - int i; - - for (i = 0; i < RX_SKB_POOL_SIZE; i++) { - if (dev->rx_skb_pool[i]) { - skb = dev->rx_skb_pool[i]; - dev->rx_skb_pool[i] = NULL; - return skb; - } - } - return NULL; -} - static int enable_net_traffic(rtl8150_t * dev) { u8 cr, tcr, rcr, msr; @@ -776,13 +776,13 @@ static int rtl8150_close(struct net_device *netdev) return res; } -static int rtl8150_ethtool_ioctl(struct net_device *netdev, void *uaddr) +static int rtl8150_ethtool_ioctl(struct net_device *netdev, void __user *uaddr) { rtl8150_t *dev; int cmd; dev = netdev->priv; - if (get_user(cmd, (int *) uaddr)) + if (get_user(cmd, (int __user *) uaddr)) return -EFAULT; switch (cmd) { @@ -856,7 +856,7 @@ static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) int res; dev = netdev->priv; - data = (u16 *) & rq->ifr_data; + data = (u16 *) & rq->ifr_ifru; res = 0; switch (cmd) { diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index e2e328f33..db96e3bab 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c @@ -104,6 +104,8 @@ * disconnect; other cleanups. (db) Flush net1080 fifos * after several sequential framing errors. (Johannes Erdfelt) * 22-aug-2003 AX8817X support (Dave Hollis). + * 14-jun-2004 Trivial patch for AX8817X based Buffalo LUA-U2-KTX in Japan + * (Neil Bortnak) * *-------------------------------------------------------------------------*/ @@ -1157,6 +1159,7 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf) status = get_ethernet_addr (dev, info->ether); if (status < 0) { + usb_set_intfdata(info->data, NULL); usb_driver_release_interface (&usbnet_driver, info->data); return status; } @@ -2668,9 +2671,7 @@ static int usbnet_ioctl (struct net_device *net, struct ifreq *rq, int cmd) struct usbnet *dev = (struct usbnet *)net->priv; if (dev->mii.mdio_read != NULL && dev->mii.mdio_write != NULL) - return generic_mii_ioctl(&dev->mii, - (struct mii_ioctl_data *) &rq->ifr_data, - cmd, NULL); + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); } #endif return -EOPNOTSUPP; @@ -3206,6 +3207,10 @@ static const struct usb_device_id products [] = { // ATEN UC210T USB_DEVICE (0x0557, 0x2009), .driver_info = (unsigned long) &ax8817x_info, +}, { + // Buffalo LUA-U2-KTX + USB_DEVICE (0x0411, 0x003d), + .driver_info = (unsigned long) &ax8817x_info, }, #endif diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 003e10158..991d37d53 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -78,8 +78,8 @@ static int usb_serial_device_probe (struct device *dev) minor = port->number; tty_register_device (usb_serial_tty_driver, minor, dev); dev_info(&port->serial->dev->dev, - "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n", - driver->name, minor, minor); + "%s converter now attached to ttyUSB%d\n", + driver->name, minor); exit: return retval; diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 299daca1f..9ca40acd3 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -109,7 +109,7 @@ struct cyberjack_private { short rdtodo; /* Bytes still to read */ unsigned char wrbuf[5*64]; /* Buffer for collecting data to write */ short wrfilled; /* Overall data size we already got */ - short wrsent; /* Data akready sent */ + short wrsent; /* Data already sent */ }; /* do some startup allocations not currently performed by usb_serial_probe() */ @@ -159,8 +159,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) dbg("%s - usb_clear_halt", __FUNCTION__ ); usb_clear_halt(port->serial->dev, port->write_urb->pipe); - usb_clear_halt(port->serial->dev, port->read_urb->pipe); - usb_clear_halt(port->serial->dev, port->interrupt_in_urb->pipe); /* force low_latency on so that our tty_push actually forces * the data through, otherwise it is scheduled, and with high @@ -212,7 +210,6 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u unsigned long flags; int result; int wrexpected; - unsigned char localbuf[CYBERJACK_LOCAL_BUF_SIZE]; /* Buffer for collecting data to write */ dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - from_user %d", __FUNCTION__, from_user); @@ -229,29 +226,23 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u spin_lock_irqsave(&priv->lock, flags); - if( (count+priv->wrfilled)>sizeof(priv->wrbuf) || - (count>sizeof(localbuf)) ) { - /* To much data for buffer. Reset buffer. */ + if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) { + /* To much data for buffer. Reset buffer. */ priv->wrfilled=0; spin_unlock_irqrestore(&priv->lock, flags); return (0); } - spin_unlock_irqrestore(&priv->lock, flags); - /* Copy data */ if (from_user) { - if (copy_from_user(localbuf, buf, count)) { + if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count)) { + spin_unlock_irqrestore(&priv->lock, flags); return -EFAULT; } } else { - memcpy (localbuf, buf, count); + memcpy (priv->wrbuf+priv->wrfilled, buf, count); } - spin_lock_irqsave(&priv->lock, flags); - - memcpy (priv->wrbuf+priv->wrfilled, localbuf, count); - usb_serial_debug_data (__FILE__, __FUNCTION__, count, priv->wrbuf+priv->wrfilled); priv->wrfilled += count; diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c15f3e57c..43bc3dc13 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1022,7 +1022,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) } -static int get_serial_info(struct usb_serial_port * port, struct serial_struct * retinfo) +static int get_serial_info(struct usb_serial_port * port, struct serial_struct __user * retinfo) { struct ftdi_private *priv = usb_get_serial_port_data(port); struct serial_struct tmp; @@ -1039,7 +1039,7 @@ static int get_serial_info(struct usb_serial_port * port, struct serial_struct * } /* get_serial_info */ -static int set_serial_info(struct usb_serial_port * port, struct serial_struct * newinfo) +static int set_serial_info(struct usb_serial_port * port, struct serial_struct __user * newinfo) { /* set_serial_info */ struct ftdi_private *priv = usb_get_serial_port_data(port); struct serial_struct new_serial; @@ -1504,6 +1504,7 @@ static int ftdi_write (struct usb_serial_port *port, int from_user, if (status) { err("%s - failed submitting write urb, error %d", __FUNCTION__, status); count = status; + kfree (buffer); } /* we are done with this urb, so let the host driver @@ -2042,7 +2043,7 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */ dbg("%s TIOCMBIS", __FUNCTION__); - if (get_user(mask, (unsigned long *) arg)) + if (get_user(mask, (unsigned long __user *) arg)) return -EFAULT; if (mask & TIOCM_DTR){ if ((ret = set_dtr(port, HIGH)) < 0) { @@ -2061,7 +2062,7 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */ dbg("%s TIOCMBIC", __FUNCTION__); - if (get_user(mask, (unsigned long *) arg)) + if (get_user(mask, (unsigned long __user *) arg)) return -EFAULT; if (mask & TIOCM_DTR){ if ((ret = set_dtr(port, LOW)) < 0){ @@ -2088,10 +2089,10 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne */ case TIOCGSERIAL: /* gets serial port data */ - return get_serial_info(port, (struct serial_struct *) arg); + return get_serial_info(port, (struct serial_struct __user *) arg); case TIOCSSERIAL: /* sets serial port data */ - return set_serial_info(port, (struct serial_struct *) arg); + return set_serial_info(port, (struct serial_struct __user *) arg); /* * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 5b2249bc9..2baac7920 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -1705,7 +1705,7 @@ static void edge_set_termios (struct usb_serial_port *port, struct termios *old_ * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. *****************************************************************************/ -static int get_lsr_info(struct edgeport_port *edge_port, unsigned int *value) +static int get_lsr_info(struct edgeport_port *edge_port, unsigned int __user *value) { unsigned int result = 0; @@ -1720,7 +1720,7 @@ static int get_lsr_info(struct edgeport_port *edge_port, unsigned int *value) return 0; } -static int get_number_bytes_avail(struct edgeport_port *edge_port, unsigned int *value) +static int get_number_bytes_avail(struct edgeport_port *edge_port, unsigned int __user *value) { unsigned int result = 0; struct tty_struct *tty = edge_port->port->tty; @@ -1790,7 +1790,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) return result; } -static int get_serial_info(struct edgeport_port *edge_port, struct serial_struct * retinfo) +static int get_serial_info(struct edgeport_port *edge_port, struct serial_struct __user *retinfo) { struct serial_struct tmp; @@ -1812,7 +1812,6 @@ static int get_serial_info(struct edgeport_port *edge_port, struct serial_struct // tmp.hub6 = state->hub6; // tmp.io_type = state->io_type; - if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) return -EFAULT; return 0; @@ -1838,17 +1837,17 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned // return number of bytes available case TIOCINQ: dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number); - return get_number_bytes_avail(edge_port, (unsigned int *) arg); + return get_number_bytes_avail(edge_port, (unsigned int __user *) arg); break; case TIOCSERGETLSR: dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); - return get_lsr_info(edge_port, (unsigned int *) arg); + return get_lsr_info(edge_port, (unsigned int __user *) arg); return 0; case TIOCGSERIAL: dbg("%s (%d) TIOCGSERIAL", __FUNCTION__, port->number); - return get_serial_info(edge_port, (struct serial_struct *) arg); + return get_serial_info(edge_port, (struct serial_struct __user *) arg); case TIOCSSERIAL: dbg("%s (%d) TIOCSSERIAL", __FUNCTION__, port->number); @@ -1893,7 +1892,7 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned icount.buf_overrun = cnow.buf_overrun; dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, port->number, icount.rx, icount.tx ); - if (copy_to_user((void *)arg, &icount, sizeof(icount))) + if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) return -EFAULT; return 0; } diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 853cf1700..793d40da5 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2428,7 +2428,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file) return result; } -static int get_serial_info (struct edgeport_port *edge_port, struct serial_struct * retinfo) +static int get_serial_info (struct edgeport_port *edge_port, struct serial_struct __user *retinfo) { struct serial_struct tmp; @@ -2477,7 +2477,7 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned case TIOCGSERIAL: dbg("%s - (%d) TIOCGSERIAL", __FUNCTION__, port->number); - return get_serial_info(edge_port, (struct serial_struct *) arg); + return get_serial_info(edge_port, (struct serial_struct __user *) arg); break; case TIOCSSERIAL: @@ -2510,7 +2510,7 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned case TIOCGICOUNT: dbg ("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __FUNCTION__, port->number, edge_port->icount.rx, edge_port->icount.tx); - if (copy_to_user((void *)arg, &edge_port->icount, sizeof(edge_port->icount))) + if (copy_to_user((void __user *)arg, &edge_port->icount, sizeof(edge_port->icount))) return -EFAULT; return 0; } diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index c9b5af2b8..99fb54079 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -926,6 +926,7 @@ static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) { struct klsi_105_private *priv = usb_get_serial_port_data(port); + void __user *user_arg = (void __user *)arg; dbg("%scmd=0x%x", __FUNCTION__, cmd); @@ -948,13 +949,12 @@ static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file, dbg("%s - TCGETS data faked/incomplete", __FUNCTION__); - retval = verify_area(VERIFY_WRITE, (void *)arg, + retval = verify_area(VERIFY_WRITE, user_arg, sizeof(struct termios)); - if (retval) - return(retval); + return retval; - if (kernel_termios_to_user_termios((struct termios *)arg, + if (kernel_termios_to_user_termios((struct termios __user *)arg, &priv->termios)) return -EFAULT; return(0); @@ -965,14 +965,13 @@ static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file, dbg("%s - TCSETS not handled", __FUNCTION__); - retval = verify_area(VERIFY_READ, (void *)arg, + retval = verify_area(VERIFY_READ, user_arg, sizeof(struct termios)); - if (retval) - return(retval); + return retval; if (user_termios_to_kernel_termios(&priv->termios, - (struct termios *)arg)) + (struct termios __user *)arg)) return -EFAULT; klsi_105_set_termios(port, &priv->termios); return(0); diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 79cb22e31..13c951502 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -643,6 +643,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, unsigned char *transfer_buffer; int transfer_buffer_length = 8; char *settings; + void __user *user_arg = (void __user *)arg; priv = usb_get_serial_port_data(port); if ((priv->device_type == KOBIL_USBTWIN_PRODUCT_ID) || (priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)) { @@ -652,12 +653,12 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, switch (cmd) { case TCGETS: // 0x5401 - result = verify_area(VERIFY_WRITE, (void *)arg, sizeof(struct termios)); + result = verify_area(VERIFY_WRITE, user_arg, sizeof(struct termios)); if (result) { dbg("%s - port %d Error in verify_area", __FUNCTION__, port->number); return(result); } - if (kernel_termios_to_user_termios((struct termios *)arg, + if (kernel_termios_to_user_termios((struct termios __user *)arg, &priv->internal_termios)) return -EFAULT; return 0; @@ -667,13 +668,13 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number); return -ENOTTY; } - result = verify_area(VERIFY_READ, (void *)arg, sizeof(struct termios)); + result = verify_area(VERIFY_READ, user_arg, sizeof(struct termios)); if (result) { dbg("%s - port %d Error in verify_area", __FUNCTION__, port->number); return result; } if (user_termios_to_kernel_termios(&priv->internal_termios, - (struct termios *)arg)) + (struct termios __user *)arg)) return -EFAULT; settings = (unsigned char *) kmalloc(50, GFP_KERNEL); diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 377a18479..29b64a49e 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -247,6 +247,8 @@ static struct usb_device_id id_table [] = { .driver_info = (kernel_ulong_t)&palm_os_4_probe }, { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID), .driver_info = (kernel_ulong_t)&palm_os_4_probe }, + { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID), + .driver_info = (kernel_ulong_t)&palm_os_4_probe }, { }, /* optional parameter entry */ { } /* Terminating entry */ }; @@ -290,6 +292,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) }, { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) }, { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, + { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, { }, /* optional parameter entry */ { } /* Terminating entry */ }; @@ -515,6 +518,7 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __FUNCTION__, status); count = status; + kfree (buffer); } else { bytes_out += count; } @@ -795,7 +799,7 @@ static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_i dev_err(dev, "%s - error %d getting connection info\n", __FUNCTION__, retval); else - usb_serial_debug_data (__FILE__, __FUNCTION__, 0x14, transfer_buffer); + usb_serial_debug_data (__FILE__, __FUNCTION__, retval, transfer_buffer); kfree (transfer_buffer); return 0; @@ -881,18 +885,19 @@ static int treo_attach (struct usb_serial *serial) /* Only do this endpoint hack for the Handspring devices with * interrupt in endpoints, which for now are the Treo devices. */ - if ((serial->dev->descriptor.idVendor != HANDSPRING_VENDOR_ID) || + if (!((serial->dev->descriptor.idVendor == HANDSPRING_VENDOR_ID) || + (serial->dev->descriptor.idVendor == KYOCERA_VENDOR_ID)) || (serial->num_interrupt_in == 0)) return 0; dbg("%s", __FUNCTION__); /* - * It appears that Treos want to use the 1st interrupt endpoint to - * communicate with the 2nd bulk out endpoint, so let's swap the 1st - * and 2nd bulk in and interrupt endpoints. Note that swapping the - * bulk out endpoints would break lots of apps that want to communicate - * on the second port. + * It appears that Treos and Kyoceras want to use the + * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint, + * so let's swap the 1st and 2nd bulk in and interrupt endpoints. + * Note that swapping the bulk out endpoints would break lots of + * apps that want to communicate on the second port. */ #define COPY_PORT(dest, src) \ dest->read_urb = src->read_urb; \ diff --git a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h index 6062273ab..55185b398 100644 --- a/drivers/usb/serial/visor.h +++ b/drivers/usb/serial/visor.h @@ -55,6 +55,9 @@ #define ACEECA_VENDOR_ID 0x4766 #define ACEECA_MEZ1000_ID 0x0001 +#define KYOCERA_VENDOR_ID 0x0C88 +#define KYOCERA_7135_ID 0x0021 + /**************************************************************************** * Handspring Visor Vendor specific request codes (bRequest values) * A big thank you to Handspring for providing the following information. diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index e79afadc3..231c7b9c1 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -835,6 +835,7 @@ static int whiteheat_tiocmset (struct usb_serial_port *port, struct file *file, static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) { struct serial_struct serstruct; + void __user *user_arg = (void __user *)arg; dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); @@ -851,13 +852,13 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un serstruct.close_delay = CLOSING_DELAY; serstruct.closing_wait = CLOSING_DELAY; - if (copy_to_user((void *)arg, &serstruct, sizeof(serstruct))) + if (copy_to_user(user_arg, &serstruct, sizeof(serstruct))) return -EFAULT; break; case TIOCSSERIAL: - if (copy_from_user(&serstruct, (void *)arg, sizeof(serstruct))) + if (copy_from_user(&serstruct, user_arg, sizeof(serstruct))) return -EFAULT; /* diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 9e49d5477..7e8d1212d 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -23,6 +23,28 @@ config USB_STORAGE_DEBUG Say Y here in order to have the USB Mass Storage code generate verbose debugging messages. +config USB_STORAGE_RW_DETECT + bool "USB Mass Storage Write-Protected Media Detection (EXPERIMENTAL)" + depends on USB_STORAGE && EXPERIMENTAL + help + Say Y here in order to have the USB Mass Storage code indicate to + the SCSI layer that using MODE SENSE(6) and MODE SENSE(10) to + determine if the media is write-protected is a good thing to do. + + Many devices have historically had trouble with these commands, + hence the default 2.6.x behavior has been to suppress their use. + 2.4.x used these commands with (at best) mixed results, often + crashing the firmware of the device. However, the SCSI layer now + issues these commands in a manner more consistent with other + "popular" OSes, in an attempt to improve compatibility. + + Saying Y here allows these commands to be sent to a USB device. + If you find a device this doesn't work for, switch to N and let + us know at usb-storage@lists.one-eyed-alien.net + + If you say N here, the kernel will assume that all disk-like USB + devices are write-enabled. + config USB_STORAGE_DATAFAB bool "Datafab Compact Flash Reader support (EXPERIMENTAL)" depends on USB_STORAGE && EXPERIMENTAL diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 39b24e59f..ac9c908c4 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -471,7 +471,7 @@ int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us) // build the reply // - ((u32 *) ptr)[0] = cpu_to_be32(info->sectors); + ((u32 *) ptr)[0] = cpu_to_be32(info->sectors - 1); ((u32 *) ptr)[1] = cpu_to_be32(info->ssize); usb_stor_set_xfer_buf(ptr, 8, srb); diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index f903d3969..43cb90d0d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -48,13 +48,13 @@ #include "usb.h" #include "debug.h" #include "transport.h" +#include "protocol.h" #include #include #include #include - /*********************************************************************** * Host functions ***********************************************************************/ @@ -68,10 +68,13 @@ static int slave_alloc (struct scsi_device *sdev) { /* * Set default bflags. These can be overridden for individual - * models and vendors via the scsi devinfo mechanism. + * models and vendors via the scsi devinfo mechanism. The only + * flag we need is to force 36-byte INQUIRYs; we don't use any + * of the extra data and many devices choke if asked for more or + * less than 36 bytes. */ - sdev->sdev_bflags = (BLIST_MS_SKIP_PAGE_08 | BLIST_MS_SKIP_PAGE_3F | - BLIST_USE_10_BYTE_MS); + sdev->sdev_bflags = BLIST_INQUIRY_36; + return 0; } @@ -95,11 +98,48 @@ static int slave_configure(struct scsi_device *sdev) * reduce the maximum transfer size to 64 KB = 128 sectors. */ #define USB_VENDOR_ID_GENESYS 0x05e3 // Needs a standard location + if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS && - us->pusb_dev->speed == USB_SPEED_HIGH) + us->pusb_dev->speed == USB_SPEED_HIGH && + sdev->request_queue->max_sectors > 128) blk_queue_max_sectors(sdev->request_queue, 128); - /* this is to satisify the compiler, tho I don't think the + /* We can't put these settings in slave_alloc() because that gets + * called before the device type is known. Consequently these + * settings can't be overridden via the scsi devinfo mechanism. */ + if (sdev->type == TYPE_DISK) { + + /* Disk-type devices use MODE SENSE(6) if the protocol + * (SubClass) is Transparent SCSI, otherwise they use + * MODE SENSE(10). */ + if (us->subclass != US_SC_SCSI) + sdev->use_10_for_ms = 1; + + /* Many disks only accept MODE SENSE transfer lengths of + * 192 bytes (that's what Windows uses). */ + sdev->use_192_bytes_for_3f = 1; + + /* A number of devices have problems with MODE SENSE for + * page x08, so we will skip it. */ + sdev->skip_ms_page_8 = 1; + +#ifndef CONFIG_USB_STORAGE_RW_DETECT + /* Some devices may not like MODE SENSE with page=0x3f. + * Now that we're using 192-byte transfers this may no + * longer be a problem. So this will be a configuration + * option. */ + sdev->skip_ms_page_3f = 1; +#endif + + } else { + + /* Non-disk-type devices don't need to blacklist any pages + * or to force 192-byte transfer lengths for MODE SENSE. + * But they do need to use MODE SENSE(10). */ + sdev->use_10_for_ms = 1; + } + + /* this is to satisfy the compiler, tho I don't think the * return code is ever checked anywhere. */ return 0; } @@ -409,6 +449,9 @@ struct scsi_host_template usb_stor_host_template = { /* emulated HBA */ .emulated = TRUE, + /* we do our own delay after a device or bus reset */ + .skip_settle_delay = 1, + /* sysfs device attributes */ .sdev_attrs = sysfs_device_attr_list, diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index e42c59a1b..b24c4c795 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -908,26 +908,29 @@ int usb_stor_Bulk_max_lun(struct us_data *us) USB_RECIP_INTERFACE, 0, us->ifnum, us->iobuf, 1, HZ); + US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", + result, us->iobuf[0]); + + /* if we have a successful request, return the result */ + if (result == 1) + return us->iobuf[0]; + /* * Some devices (i.e. Iomega Zip100) need this -- apparently * the bulk pipes get STALLed when the GetMaxLUN request is * processed. This is, in theory, harmless to all other devices * (regardless of if they stall or not). */ - if (result < 0) { + if (result == -EPIPE) { usb_stor_clear_halt(us, us->recv_bulk_pipe); usb_stor_clear_halt(us, us->send_bulk_pipe); + /* return the default -- no LUNs */ + return 0; } - US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", - result, us->iobuf[0]); - - /* if we have a successful request, return the result */ - if (result == 1) - return us->iobuf[0]; - - /* return the default -- no LUNs */ - return 0; + /* An answer or a STALL are the only valid responses. If we get + * something else, return an indication of error */ + return -1; } int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us) @@ -1110,10 +1113,11 @@ static int usb_stor_reset_common(struct us_data *us, goto Done; } - /* long wait for reset, so unlock to allow disconnects */ - up(&us->dev_semaphore); - msleep(6000); - down(&us->dev_semaphore); + /* Give the device some time to recover from the reset, + * but don't delay disconnect processing. */ + wait_event_interruptible_timeout(us->dev_reset_wait, + test_bit(US_FLIDX_DISCONNECTING, &us->flags), + HZ*6); if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { US_DEBUGP("Reset interrupted by disconnect\n"); goto Done; diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 56de0bdf2..ef13259ed 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -207,7 +207,7 @@ UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208, UNUSUAL_DEV( 0x04e6, 0x0006, 0x0100, 0x0205, "Shuttle", "eUSB MMC Adapter", - US_SC_SCSI, US_PR_CB, NULL, + US_SC_SCSI, US_PR_DEVICE, NULL, US_FL_SINGLE_LUN), UNUSUAL_DEV( 0x04e6, 0x0007, 0x0100, 0x0200, @@ -359,13 +359,19 @@ UNUSUAL_DEV( 0x057b, 0x0000, 0x0300, 0x9999, UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, "Fujifilm", "Digital Camera EX-20 DSC", - US_SC_8070, US_PR_CBI, NULL, 0 ), + US_SC_8070, US_PR_DEVICE, NULL, 0 ), UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200, "LaCie", "USB Hard Disk", US_SC_RBC, US_PR_CB, NULL, 0 ), +/* Submitted by Jol Bourquard */ +UNUSUAL_DEV( 0x05ab, 0x0060, 0x1104, 0x1110, + "In-System", + "PyroGate External CD-ROM Enclosure (FCD-523)", + US_SC_SCSI, US_PR_BULK, NULL, 0 ), + #ifdef CONFIG_USB_STORAGE_ISD200 UNUSUAL_DEV( 0x05ab, 0x0031, 0x0100, 0x0110, "In-System", @@ -396,8 +402,8 @@ UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x0110, UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001, "Lexar", "Jumpshot USB CF Reader", - US_SC_DEVICE, US_PR_JUMPSHOT, NULL, - US_FL_MODE_XLATE ), + US_SC_SCSI, US_PR_JUMPSHOT, NULL, + US_FL_NEED_OVERRIDE | US_FL_MODE_XLATE ), #endif /* Reported by Blake Matheny */ @@ -628,20 +634,14 @@ UNUSUAL_DEV( 0x07c4, 0xa400, 0x0000, 0xffff, * - Some cameras with idProduct=0x1001 and bcdDevice=0x1000 have * bInterfaceProtocol=0x00 (US_PR_CBI) while others have 0x01 (US_PR_CB). * So don't remove the US_PR_CB override! + * - Cameras with bcdDevice=0x9009 require the US_SC_8070 override. */ -UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009, +UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999, "Casio", "QV DigitalCamera", - US_SC_DEVICE, US_PR_CB, NULL, + US_SC_8070, US_PR_CB, NULL, US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), -/* Later Casio cameras apparently tell the truth */ -UNUSUAL_DEV( 0x07cf, 0x1001, 0x9010, 0x9999, - "Casio", - "QV DigitalCamera", - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_FIX_INQUIRY ), - /* Submitted by Hartmut Wahl */ UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, "Samsung", diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 634282265..c2ccdabd0 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -266,6 +266,7 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data, static int usb_stor_control_thread(void * __us) { struct us_data *us = (struct us_data *)__us; + struct Scsi_Host *host = us->host; lock_kernel(); @@ -283,19 +284,21 @@ static int usb_stor_control_thread(void * __us) complete(&(us->notify)); for(;;) { - struct Scsi_Host *host; US_DEBUGP("*** thread sleeping.\n"); if(down_interruptible(&us->sema)) break; US_DEBUGP("*** thread awakened.\n"); + /* lock the device pointers */ + down(&(us->dev_semaphore)); + /* if us->srb is NULL, we are being asked to exit */ if (us->srb == NULL) { US_DEBUGP("-- exit command received\n"); + up(&(us->dev_semaphore)); break; } - host = us->srb->device->host; /* lock access to the state */ scsi_lock(host); @@ -306,23 +309,20 @@ static int usb_stor_control_thread(void * __us) goto SkipForAbort; } - /* set the state and release the lock */ - us->sm_state = US_STATE_RUNNING; - scsi_unlock(host); - - /* lock the device pointers */ - down(&(us->dev_semaphore)); - /* don't do anything if we are disconnecting */ if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { US_DEBUGP("No command during disconnect\n"); - us->srb->result = DID_BAD_TARGET << 16; + goto SkipForDisconnect; } + /* set the state and release the lock */ + us->sm_state = US_STATE_RUNNING; + scsi_unlock(host); + /* reject the command if the direction indicator * is UNKNOWN */ - else if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) { + if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) { US_DEBUGP("UNKNOWN data direction\n"); us->srb->result = DID_ERROR << 16; } @@ -362,9 +362,6 @@ static int usb_stor_control_thread(void * __us) us->proto_handler(us->srb, us); } - /* unlock the device pointers */ - up(&(us->dev_semaphore)); - /* lock access to the state */ scsi_lock(host); @@ -374,7 +371,7 @@ static int usb_stor_control_thread(void * __us) us->srb->result); us->srb->scsi_done(us->srb); } else { - SkipForAbort: +SkipForAbort: US_DEBUGP("scsi command aborted\n"); } @@ -387,9 +384,13 @@ static int usb_stor_control_thread(void * __us) complete(&(us->notify)); /* empty the queue, reset the state, and release the lock */ +SkipForDisconnect: us->srb = NULL; us->sm_state = US_STATE_IDLE; scsi_unlock(host); + + /* unlock the device pointers */ + up(&(us->dev_semaphore)); } /* for (;;) */ /* notify the exit routine that we're actually exiting now @@ -423,10 +424,8 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) us->pusb_intf = intf; us->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - /* Store our private data in the interface and increment the - * device's reference count */ + /* Store our private data in the interface */ usb_set_intfdata(intf, us); - usb_get_dev(us->pusb_dev); /* Allocate the device-related DMA-mapped buffers */ us->cr = usb_buffer_alloc(us->pusb_dev, sizeof(*us->cr), @@ -754,8 +753,14 @@ static int usb_stor_acquire_resources(struct us_data *us) down(&us->dev_semaphore); /* For bulk-only devices, determine the max LUN value */ - if (us->protocol == US_PR_BULK) - us->max_lun = usb_stor_Bulk_max_lun(us); + if (us->protocol == US_PR_BULK) { + p = usb_stor_Bulk_max_lun(us); + if (p < 0) { + up(&us->dev_semaphore); + return p; + } + us->max_lun = p; + } /* Just before we start our control thread, initialize * the device if it needs initialization */ @@ -764,19 +769,6 @@ static int usb_stor_acquire_resources(struct us_data *us) up(&us->dev_semaphore); - /* Start up our control thread */ - us->sm_state = US_STATE_IDLE; - p = kernel_thread(usb_stor_control_thread, us, CLONE_VM); - if (p < 0) { - printk(KERN_WARNING USB_STORAGE - "Unable to start control thread\n"); - return p; - } - us->pid = p; - - /* Wait for the thread to start */ - wait_for_completion(&(us->notify)); - /* * Since this is a new device, we need to register a SCSI * host definition with the higher SCSI layers. @@ -784,69 +776,61 @@ static int usb_stor_acquire_resources(struct us_data *us) us->host = scsi_host_alloc(&usb_stor_host_template, sizeof(us)); if (!us->host) { printk(KERN_WARNING USB_STORAGE - "Unable to register the scsi host\n"); + "Unable to allocate the scsi host\n"); return -EBUSY; } /* Set the hostdata to prepare for scanning */ us->host->hostdata[0] = (unsigned long) us; - return 0; -} - -/* Dissociate from the USB device */ -static void dissociate_dev(struct us_data *us) -{ - US_DEBUGP("-- %s\n", __FUNCTION__); - down(&us->dev_semaphore); - - /* Free the device-related DMA-mapped buffers */ - if (us->cr) { - usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, - us->cr_dma); - us->cr = NULL; - } - if (us->iobuf) { - usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, - us->iobuf_dma); - us->iobuf = NULL; + /* Start up our control thread */ + us->sm_state = US_STATE_IDLE; + p = kernel_thread(usb_stor_control_thread, us, CLONE_VM); + if (p < 0) { + printk(KERN_WARNING USB_STORAGE + "Unable to start control thread\n"); + return p; } + us->pid = p; - /* Remove our private data from the interface and decrement the - * device's reference count */ - usb_set_intfdata(us->pusb_intf, NULL); - usb_put_dev(us->pusb_dev); + /* Wait for the thread to start */ + wait_for_completion(&(us->notify)); - us->pusb_dev = NULL; - us->pusb_intf = NULL; - up(&us->dev_semaphore); + return 0; } -/* Release all our static and dynamic resources */ +/* Release all our dynamic resources */ void usb_stor_release_resources(struct us_data *us) { - /* - * The host must already have been removed - * and dissociate_dev() must have been called. - */ - - /* Finish the SCSI host removal sequence */ - if (us->host) { - us->host->hostdata[0] = 0; - scsi_host_put(us->host); - } + US_DEBUGP("-- %s\n", __FUNCTION__); - /* Kill the control thread - * - * Enqueue the command, wake up the thread, and wait for - * notification that it has exited. + /* Kill the control thread. The SCSI host must already have been + * removed so it won't try to queue any more commands. */ if (us->pid) { + + /* Wait for the thread to be idle */ + down(&us->dev_semaphore); US_DEBUGP("-- sending exit command to thread\n"); BUG_ON(us->sm_state != US_STATE_IDLE); + + /* If the SCSI midlayer queued a final command just before + * scsi_remove_host() was called, us->srb might not be + * NULL. We can overwrite it safely, because the midlayer + * will not wait for the command to finish. Also the + * control thread will already have been awakened. + * That's okay, an extra up() on us->sema won't hurt. + * + * Enqueue the command, wake up the thread, and wait for + * notification that it has exited. + */ + scsi_lock(us->host); us->srb = NULL; - up(&(us->sema)); - wait_for_completion(&(us->notify)); + scsi_unlock(us->host); + up(&us->dev_semaphore); + + up(&us->sema); + wait_for_completion(&us->notify); } /* Call the destructor routine, if it exists */ @@ -855,15 +839,36 @@ void usb_stor_release_resources(struct us_data *us) us->extra_destructor(us->extra); } + /* Finish the host removal sequence */ + if (us->host) + scsi_host_put(us->host); + /* Free the extra data and the URB */ if (us->extra) kfree(us->extra); if (us->current_urb) usb_free_urb(us->current_urb); +} + +/* Dissociate from the USB device */ +static void dissociate_dev(struct us_data *us) +{ + US_DEBUGP("-- %s\n", __FUNCTION__); + + /* Free the device-related DMA-mapped buffers */ + if (us->cr) + usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, + us->cr_dma); + if (us->iobuf) + usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, + us->iobuf_dma); + + /* Remove our private data from the interface */ + usb_set_intfdata(us->pusb_intf, NULL); + /* Free the structure itself */ kfree(us); - US_DEBUGP("-- %s finished\n", __FUNCTION__); } /* Probe to see if we can drive a newly-connected USB device */ @@ -889,6 +894,7 @@ static int storage_probe(struct usb_interface *intf, init_MUTEX(&(us->dev_semaphore)); init_MUTEX_LOCKED(&(us->sema)); init_completion(&(us->notify)); + init_waitqueue_head(&us->dev_reset_wait); /* Associate the us_data structure with the USB device */ result = associate_dev(us, intf); @@ -959,8 +965,8 @@ static int storage_probe(struct usb_interface *intf, /* We come here if there are any problems */ BadDevice: US_DEBUGP("storage_probe() failed\n"); - dissociate_dev(us); usb_stor_release_resources(us); + dissociate_dev(us); return result; } @@ -971,20 +977,20 @@ static void storage_disconnect(struct usb_interface *intf) US_DEBUGP("storage_disconnect() called\n"); - /* Prevent new USB transfers and stop the current command */ + /* Prevent new USB transfers, stop the current command, and + * interrupt a device-reset delay */ set_bit(US_FLIDX_DISCONNECTING, &us->flags); usb_stor_stop_transport(us); + wake_up(&us->dev_reset_wait); - /* Dissociate from the USB device */ - dissociate_dev(us); - + /* Wait for the current command to finish, then remove the host */ + down(&us->dev_semaphore); + up(&us->dev_semaphore); scsi_remove_host(us->host); - /* TODO: somehow, wait for the device to - * be 'idle' (tasklet completion) */ - - /* Release all our other resources */ + /* Wait for everything to become idle and release all our resources */ usb_stor_release_resources(us); + dissociate_dev(us); } /*********************************************************************** @@ -1017,47 +1023,6 @@ static void __exit usb_stor_exit(void) */ US_DEBUGP("-- calling usb_deregister()\n"); usb_deregister(&usb_storage_driver) ; - -#if 0 - /* While there are still virtual hosts, unregister them - * Note that it's important to do this completely before removing - * the structures because of possible races with the /proc - * interface - */ - for (next = us_list; next; next = next->next) { - US_DEBUGP("-- calling scsi_unregister_host()\n"); - scsi_unregister_host(&usb_stor_host_template); - } - - /* While there are still structures, free them. Note that we are - * now race-free, since these structures can no longer be accessed - * from either the SCSI command layer or the /proc interface - */ - while (us_list) { - /* keep track of where the next one is */ - next = us_list->next; - - /* If there's extra data in the us_data structure then - * free that first */ - if (us_list->extra) { - /* call the destructor routine, if it exists */ - if (us_list->extra_destructor) { - US_DEBUGP("-- calling extra_destructor()\n"); - us_list->extra_destructor(us_list->extra); - } - - /* destroy the extra data */ - US_DEBUGP("-- freeing the data structure\n"); - kfree(us_list->extra); - } - - /* free the structure itself */ - kfree (us_list); - - /* advance the list pointer */ - us_list = next; - } -#endif } module_init(usb_stor_init); diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 7ef571a17..35d01444a 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -158,9 +158,10 @@ struct us_data { dma_addr_t cr_dma; /* buffer DMA addresses */ dma_addr_t iobuf_dma; - /* mutual exclusion structures */ + /* mutual exclusion and synchronization structures */ struct semaphore sema; /* to sleep thread on */ - struct completion notify; /* thread begin/end */ + struct completion notify; /* thread begin/end */ + wait_queue_head_t dev_reset_wait; /* wait during reset */ /* subdriver information */ void *extra; /* Any extra data */ diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 4d58fc501..7c551a2c2 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -432,6 +432,11 @@ config FB_RIVA To compile this driver as a module, choose M here: the module will be called rivafb. +config FB_RIVA_I2C + bool "Enable DDC Support" + depends on FB_RIVA && I2C + help + config FB_I810 tristate "Intel 810/815 support (EXPERIMENTAL)" depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI diff --git a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c index 82614b4b4..a98130cff 100644 --- a/drivers/video/aty/radeon_accel.c +++ b/drivers/video/aty/radeon_accel.c @@ -38,8 +38,8 @@ void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) return; } - vxres = info->var.xres; - vyres = info->var.yres; + vxres = info->var.xres_virtual; + vyres = info->var.yres_virtual; memcpy(&modded, region, sizeof(struct fb_fillrect)); @@ -104,8 +104,8 @@ void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) return; } - vxres = info->var.xres; - vyres = info->var.yres; + vxres = info->var.xres_virtual; + vyres = info->var.yres_virtual; if(!modded.width || !modded.height || modded.sx >= vxres || modded.sy >= vyres || diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 7ec775681..c227e7ad9 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -858,6 +858,7 @@ static int radeonfb_pan_display (struct fb_var_screeninfo *var, if (rinfo->asleep) return 0; + radeon_fifo_wait(2); OUTREG(CRTC_OFFSET, ((var->yoffset * var->xres_virtual + var->xoffset) * var->bits_per_pixel / 8) & ~7); return 0; @@ -882,11 +883,12 @@ static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int if (!rinfo->is_mobility) return -EINVAL; - rc = get_user(value, (__u32*)arg); + rc = get_user(value, (__u32 __user *)arg); if (rc) return rc; + radeon_fifo_wait(2); if (value & 0x01) { tmp = INREG(LVDS_GEN_CNTL); @@ -926,7 +928,7 @@ static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int if (CRTC_CRT_ON & tmp) value |= 0x02; - return put_user(value, (__u32*)arg); + return put_user(value, (__u32 __user *)arg); default: return -EINVAL; } @@ -963,6 +965,7 @@ static int radeon_screen_blank (struct radeonfb_info *rinfo, int blank) break; } + radeon_fifo_wait(1); switch (rinfo->mon1_type) { case MT_LCD: OUTREG(LVDS_GEN_CNTL, val2); @@ -1021,6 +1024,7 @@ static int radeonfb_setcolreg (unsigned regno, unsigned red, unsigned green, if (!rinfo->asleep) { u32 dac_cntl2, vclk_cntl = 0; + radeon_fifo_wait(9); if (rinfo->is_mobility) { vclk_cntl = INPLL(VCLK_ECP_CNTL); OUTPLL(VCLK_ECP_CNTL, vclk_cntl & ~PIXCLK_DAC_ALWAYS_ONb); @@ -1112,6 +1116,8 @@ static void radeon_write_pll_regs(struct radeonfb_info *rinfo, struct radeon_reg { int i; + radeon_fifo_wait(20); + /* Workaround from XFree */ if (rinfo->is_mobility) { /* A temporal workaround for the occational blanking on certain laptop panels. @@ -1198,6 +1204,8 @@ static void radeon_lvds_timer_func(unsigned long data) { struct radeonfb_info *rinfo = (struct radeonfb_info *)data; + radeon_fifo_wait(3); + OUTREG(LVDS_GEN_CNTL, rinfo->pending_lvds_gen_cntl); if (rinfo->pending_pixclks_cntl) { OUTPLL(PIXCLKS_CNTL, rinfo->pending_pixclks_cntl); @@ -1222,6 +1230,7 @@ static void radeon_write_mode (struct radeonfb_info *rinfo, radeon_screen_blank(rinfo, VESA_POWERDOWN); + radeon_fifo_wait(31); for (i=0; i<10; i++) OUTREG(common_regs[i].reg, common_regs[i].val); @@ -1249,6 +1258,7 @@ static void radeon_write_mode (struct radeonfb_info *rinfo, radeon_write_pll_regs(rinfo, mode); if ((primary_mon == MT_DFP) || (primary_mon == MT_LCD)) { + radeon_fifo_wait(10); OUTREG(FP_CRTC_H_TOTAL_DISP, mode->fp_crtc_h_total_disp); OUTREG(FP_CRTC_V_TOTAL_DISP, mode->fp_crtc_v_total_disp); OUTREG(FP_H_SYNC_STRT_WID, mode->fp_h_sync_strt_wid); @@ -1288,6 +1298,7 @@ static void radeon_write_mode (struct radeonfb_info *rinfo, radeon_screen_blank(rinfo, VESA_NO_BLANKING); + radeon_fifo_wait(2); OUTPLL(VCLK_ECP_CNTL, mode->vclk_ecp_cntl); return; @@ -1701,7 +1712,7 @@ int radeonfb_set_par(struct fb_info *info) -static ssize_t radeonfb_read(struct file *file, char *buf, size_t count, loff_t *ppos) +static ssize_t radeonfb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; struct inode *inode = file->f_dentry->d_inode; @@ -1728,7 +1739,7 @@ static ssize_t radeonfb_read(struct file *file, char *buf, size_t count, loff_t return count; } -static ssize_t radeonfb_write(struct file *file, const char *buf, size_t count, +static ssize_t radeonfb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; @@ -1869,6 +1880,7 @@ static int radeon_set_backlight_enable(int on, int level, void *data) del_timer_sync(&rinfo->lvds_timer); lvds_gen_cntl |= (LVDS_BL_MOD_EN | LVDS_BLON); + radeon_fifo_wait(3); if (on && (level > BACKLIGHT_OFF)) { lvds_gen_cntl |= LVDS_DIGON; if (!(lvds_gen_cntl & LVDS_ON)) { @@ -2141,6 +2153,7 @@ static int radeonfb_pci_register (struct pci_dev *pdev, u32 tom = INREG(NB_TOM); tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024); + radeon_fifo_wait(6); OUTREG(MC_FB_LOCATION, tom); OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16); diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index d0f9920c2..e928f4ed6 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -601,8 +601,9 @@ static void fbcon_init(struct vc_data *vc, int init) int display_fg = (*default_mode)->vc_num; int logo = 1, rows, cols, charcnt = 256; unsigned short *save = NULL, *r, *q; + int cap = info->flags; - if (vc->vc_num != display_fg || (info->flags & FBINFO_FLAG_MODULE) || + if (vc->vc_num != display_fg || (info->flags & FBINFO_MODULE) || (info->fix.type == FB_TYPE_TEXT)) logo = 0; @@ -635,10 +636,10 @@ static void fbcon_init(struct vc_data *vc, int init) rows = info->var.yres / vc->vc_font.height; vc_resize(vc->vc_num, cols, rows); - if (info->var.accel_flags) - p->scrollmode = SCROLL_YNOMOVE; - else - p->scrollmode = SCROLL_YREDRAW; + if ((cap & FBINFO_HWACCEL_COPYAREA) && !(cap & FBINFO_HWACCEL_DISABLED)) + p->scrollmode = SCROLL_ACCEL; + else /* default to something safe */ + p->scrollmode = SCROLL_REDRAW; /* * ++guenther: console.c:vc_allocate() relies on initializing @@ -1245,7 +1246,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, { struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]]; struct display *p = &fb_display[vc->vc_num]; - int scroll_partial = !(p->scrollmode & __SCROLL_YNOPARTIAL); + int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; if (!info->fbops->fb_blank && console_blanked) return 0; @@ -1269,15 +1270,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, fbcon_softback_note(vc, t, count); if (logo_shown >= 0) goto redraw_up; - switch (p->scrollmode & __SCROLL_YMASK) { - case __SCROLL_YMOVE: + switch (p->scrollmode) { + case SCROLL_ACCEL: accel_bmove(vc, info, t + count, 0, t, 0, b - t - count, vc->vc_cols); accel_clear(vc, info, b - count, 0, count, vc->vc_cols); break; - case __SCROLL_YWRAP: + case SCROLL_WRAP: if (b - t - count > 3 * vc->vc_rows >> 2) { if (t > 0) fbcon_bmove(vc, 0, 0, count, 0, t, @@ -1287,15 +1288,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, fbcon_bmove(vc, b - count, 0, b, 0, vc->vc_rows - b, vc->vc_cols); - } else if (p->scrollmode & __SCROLL_YPANREDRAW) - goto redraw_up; - else + } else if (info->flags & FBINFO_READS_FAST) fbcon_bmove(vc, t + count, 0, t, 0, b - t - count, vc->vc_cols); + else + goto redraw_up; fbcon_clear(vc, b - count, 0, count, vc->vc_cols); break; - case __SCROLL_YPAN: + case SCROLL_PAN: if ((p->yscroll + count <= 2 * (p->vrows - vc->vc_rows)) && ((!scroll_partial && (b - t == vc->vc_rows)) @@ -1310,15 +1311,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, fbcon_bmove(vc, b - count, 0, b, 0, vc->vc_rows - b, vc->vc_cols); - } else if (p->scrollmode & __SCROLL_YPANREDRAW) - goto redraw_up; - else + } else if (info->flags & FBINFO_READS_FAST) fbcon_bmove(vc, t + count, 0, t, 0, b - t - count, vc->vc_cols); + else + goto redraw_up; fbcon_clear(vc, b - count, 0, count, vc->vc_cols); break; - case __SCROLL_YREDRAW: + case SCROLL_REDRAW: redraw_up: fbcon_redraw(vc, p, t, b - t - count, count * vc->vc_cols); @@ -1336,14 +1337,14 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, case SM_DOWN: if (count > vc->vc_rows) /* Maximum realistic size */ count = vc->vc_rows; - switch (p->scrollmode & __SCROLL_YMASK) { - case __SCROLL_YMOVE: + switch (p->scrollmode) { + case SCROLL_ACCEL: accel_bmove(vc, info, t, 0, t + count, 0, b - t - count, vc->vc_cols); accel_clear(vc, info, t, 0, count, vc->vc_cols); break; - case __SCROLL_YWRAP: + case SCROLL_WRAP: if (b - t - count > 3 * vc->vc_rows >> 2) { if (vc->vc_rows - b > 0) fbcon_bmove(vc, b, 0, b - count, 0, @@ -1353,15 +1354,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, if (t > 0) fbcon_bmove(vc, count, 0, 0, 0, t, vc->vc_cols); - } else if (p->scrollmode & __SCROLL_YPANREDRAW) - goto redraw_down; - else + } else if (info->flags & FBINFO_READS_FAST) fbcon_bmove(vc, t, 0, t + count, 0, b - t - count, vc->vc_cols); + else + goto redraw_down; fbcon_clear(vc, t, 0, count, vc->vc_cols); break; - case __SCROLL_YPAN: + case SCROLL_PAN: if ((count - p->yscroll <= p->vrows - vc->vc_rows) && ((!scroll_partial && (b - t == vc->vc_rows)) || (scroll_partial @@ -1375,15 +1376,15 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, if (t > 0) fbcon_bmove(vc, count, 0, 0, 0, t, vc->vc_cols); - } else if (p->scrollmode & __SCROLL_YPANREDRAW) - goto redraw_down; - else + } else if (info->flags & FBINFO_READS_FAST) fbcon_bmove(vc, t, 0, t + count, 0, b - t - count, vc->vc_cols); + else + goto redraw_down; fbcon_clear(vc, t, 0, count, vc->vc_cols); break; - case __SCROLL_YREDRAW: + case SCROLL_REDRAW: redraw_down: fbcon_redraw(vc, p, b - 1, b - t - count, -count * vc->vc_cols); @@ -1467,21 +1468,27 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s static __inline__ void updatescrollmode(struct display *p, struct fb_info *info, struct vc_data *vc) { - int m; - - if (p->scrollmode & __SCROLL_YFIXED) - return; - if (divides(info->fix.ywrapstep, vc->vc_font.height) && - divides(vc->vc_font.height, info->var.yres_virtual)) - m = __SCROLL_YWRAP; - else if (divides(info->fix.ypanstep, vc->vc_font.height) && - info->var.yres_virtual >= info->var.yres + vc->vc_font.height) - m = __SCROLL_YPAN; - else if (p->scrollmode & __SCROLL_YNOMOVE) - m = __SCROLL_YREDRAW; - else - m = __SCROLL_YMOVE; - p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m; + int cap = info->flags; + int good_pan = (cap & FBINFO_HWACCEL_YPAN) + && divides(info->fix.ypanstep, vc->vc_font.height) + && info->var.yres_virtual >= 2*info->var.yres; + int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) + && divides(info->fix.ywrapstep, vc->vc_font.height) + && divides(vc->vc_font.height, info->var.yres_virtual); + int reading_fast = cap & FBINFO_READS_FAST; + int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && !(cap & FBINFO_HWACCEL_DISABLED); + + if (good_wrap || good_pan) { + if (reading_fast || fast_copyarea) + p->scrollmode = good_wrap ? SCROLL_WRAP : SCROLL_PAN; + else + p->scrollmode = SCROLL_REDRAW; + } else { + if (reading_fast || fast_copyarea) + p->scrollmode = SCROLL_ACCEL; + else + p->scrollmode = SCROLL_REDRAW; + } } static int fbcon_resize(struct vc_data *vc, unsigned int width, @@ -1505,9 +1512,10 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, if (!info->fbops->fb_set_par) return -EINVAL; - sprintf(mode, "%dx%d", var.xres, var.yres); - err = fb_find_mode(&var, info, mode, NULL, 0, NULL, - info->var.bits_per_pixel); + snprintf(mode, 40, "%ix%i", var.xres, var.yres); + err = fb_find_mode(&var, info, mode, info->monspecs.modedb, + info->monspecs.modedb_len, NULL, + info->var.bits_per_pixel); if (!err || width > var.xres/fw || height > var.yres/fh) return -EINVAL; DPRINTK("resize now %ix%i\n", var.xres, var.yres); @@ -1555,12 +1563,12 @@ static int fbcon_switch(struct vc_data *vc) } if (info) info->var.yoffset = p->yscroll = 0; - fbcon_resize(vc, vc->vc_cols, vc->vc_rows); - switch (p->scrollmode & __SCROLL_YMASK) { - case __SCROLL_YWRAP: + fbcon_resize(vc, vc->vc_cols, vc->vc_rows); + switch (p->scrollmode) { + case SCROLL_WRAP: scrollback_phys_max = p->vrows - vc->vc_rows; break; - case __SCROLL_YPAN: + case SCROLL_PAN: scrollback_phys_max = p->vrows - 2 * vc->vc_rows; if (scrollback_phys_max < 0) scrollback_phys_max = 0; @@ -2133,11 +2141,11 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines) offset = p->yscroll - scrollback_current; limit = p->vrows; - switch (p->scrollmode && __SCROLL_YMASK) { - case __SCROLL_YWRAP: + switch (p->scrollmode) { + case SCROLL_WRAP: info->var.vmode |= FB_VMODE_YWRAP; break; - case __SCROLL_YPAN: + case SCROLL_PAN: limit -= vc->vc_rows; info->var.vmode &= ~FB_VMODE_YWRAP; break; diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index a9d036b0a..6764dbc26 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -67,40 +67,27 @@ extern int set_con2fb_map(int unit, int newidx); * Scroll Method */ -/* Internal flags */ -#define __SCROLL_YPAN 0x001 -#define __SCROLL_YWRAP 0x002 -#define __SCROLL_YMOVE 0x003 -#define __SCROLL_YREDRAW 0x004 -#define __SCROLL_YMASK 0x00f -#define __SCROLL_YFIXED 0x010 -#define __SCROLL_YNOMOVE 0x020 -#define __SCROLL_YPANREDRAW 0x040 -#define __SCROLL_YNOPARTIAL 0x080 - -/* Only these should be used by the drivers */ -/* Which one should you use? If you have a fast card and slow bus, - then probably just 0 to indicate fbcon should choose between - YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus - and even better if your card can do fonting (1->8/32bit painting), - you should consider either SCROLL_YREDRAW (if your card is - able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE. - The best is to test it with some real life scrolling (usually, not - all lines on the screen are filled completely with non-space characters, - and REDRAW performs much better on such lines, so don't cat a file - with every line covering all screen columns, it would not be the right - benchmark). +/* There are several methods fbcon can use to move text around the screen: + * + * + use the hardware engine to move the text + * (hw-accelerated copyarea() and fillrect()) + * + use hardware-supported panning on a large virtual screen + * + amifb can not only pan, but also wrap the display by N lines + * (i.e. visible line i = physical line (i+N) % yres). + * + read what's already rendered on the screen and + * write it in a different place (this is cfb_copyarea()) + * + re-render the text to the screen + * + * Whether to use wrapping or panning can only be figured out at + * runtime (when we know whether our font height is a multiple + * of the pan/wrap step) + * */ -#define SCROLL_YREDRAW (__SCROLL_YFIXED|__SCROLL_YREDRAW) -#define SCROLL_YNOMOVE (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW) -/* SCROLL_YNOPARTIAL, used in combination with the above, is for video - cards which can not handle using panning to scroll a portion of the - screen without excessive flicker. Panning will only be used for - whole screens. - */ -/* Namespace consistency */ -#define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL +#define SCROLL_ACCEL 0x001 +#define SCROLL_PAN 0x002 +#define SCROLL_WRAP 0x003 +#define SCROLL_REDRAW 0x004 extern int fb_console_init(void); diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index 5d9a6e84c..7cf956e4a 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index b75ab0df6..23e1e7e5d 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -963,6 +963,8 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) p = (c->vc_visible_origin - vga_vram_base - ul + we) % we + lines * c->vc_size_row; st = (c->vc_origin - vga_vram_base - ul + we) % we; + if (st < 2 * margin) + margin = 0; if (p < margin) p = 0; if (p > st - margin) diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 80d81e398..65a4021ce 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -172,6 +172,7 @@ extern int kyrofb_init(void); extern int kyrofb_setup(char*); extern int mc68x328fb_init(void); extern int mc68x328fb_setup(char *); +extern int asiliantfb_init(void); static struct { const char *name; @@ -385,6 +386,9 @@ static struct { #ifdef CONFIG_FB_68328 { "68328fb", mc68x328fb_init, mc68x328fb_setup }, #endif +#ifdef CONFIG_FB_ASILIANT + { "asiliantfb", asiliantfb_init, NULL }, +#endif /* * Generic drivers that don't use resource management (yet) @@ -802,7 +806,7 @@ static int fbmem_read_proc(char *buf, char **start, off_t offset, } static ssize_t -fb_read(struct file *file, char *buf, size_t count, loff_t *ppos) +fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; struct inode *inode = file->f_dentry->d_inode; @@ -839,7 +843,7 @@ fb_read(struct file *file, char *buf, size_t count, loff_t *ppos) } static ssize_t -fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; struct inode *inode = file->f_dentry->d_inode; @@ -916,26 +920,30 @@ fb_cursor(struct fb_info *info, struct fb_cursor *sprite) if (cursor.set & FB_CUR_SETSHAPE) { int size = ((cursor.image.width + 7) >> 3) * cursor.image.height; + char *data, *mask; + if ((cursor.image.height != info->cursor.image.height) || (cursor.image.width != info->cursor.image.width)) cursor.set |= FB_CUR_SETSIZE; - cursor.image.data = kmalloc(size, GFP_KERNEL); - if (!cursor.image.data) + data = kmalloc(size, GFP_KERNEL); + if (!data) return -ENOMEM; - cursor.mask = kmalloc(size, GFP_KERNEL); - if (!cursor.mask) { - kfree(cursor.image.data); + mask = kmalloc(size, GFP_KERNEL); + if (!mask) { + kfree(data); return -ENOMEM; } - if (copy_from_user(cursor.image.data, sprite->image.data, size) || - copy_from_user(cursor.mask, sprite->mask, size)) { - kfree(cursor.image.data); - kfree(cursor.mask); + if (copy_from_user(data, sprite->image.data, size) || + copy_from_user(mask, sprite->mask, size)) { + kfree(data); + kfree(mask); return -EFAULT; } + cursor.image.data = data; + cursor.mask = mask; } info->cursor.set = cursor.set; info->cursor.rop = cursor.rop; diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 6b1635c4c..c4a5dbd26 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c @@ -1267,48 +1267,49 @@ imsttfb_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg, struct fb_info *info) { struct imstt_par *par = (struct imstt_par *) info->par; + void __user *argp = (void __user *)arg; __u32 reg[2]; __u8 idx[2]; switch (cmd) { case FBIMSTT_SETREG: - if (copy_from_user(reg, (void *)arg, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) + if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) return -EFAULT; write_reg_le32(par->dc_regs, reg[0], reg[1]); return 0; case FBIMSTT_GETREG: - if (copy_from_user(reg, (void *)arg, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) + if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) return -EFAULT; reg[1] = read_reg_le32(par->dc_regs, reg[0]); - if (copy_to_user((void *)(arg + 4), ®[1], 4)) + if (copy_to_user((void __user *)(arg + 4), ®[1], 4)) return -EFAULT; return 0; case FBIMSTT_SETCMAPREG: - if (copy_from_user(reg, (void *)arg, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) + if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) return -EFAULT; write_reg_le32(((u_int *)par->cmap_regs), reg[0], reg[1]); return 0; case FBIMSTT_GETCMAPREG: - if (copy_from_user(reg, (void *)arg, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) + if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) return -EFAULT; reg[1] = read_reg_le32(((u_int *)par->cmap_regs), reg[0]); - if (copy_to_user((void *)(arg + 4), ®[1], 4)) + if (copy_to_user((void __user *)(arg + 4), ®[1], 4)) return -EFAULT; return 0; case FBIMSTT_SETIDXREG: - if (copy_from_user(idx, (void *)arg, 2)) + if (copy_from_user(idx, argp, 2)) return -EFAULT; par->cmap_regs[PIDXHI] = 0; eieio(); par->cmap_regs[PIDXLO] = idx[0]; eieio(); par->cmap_regs[PIDXDATA] = idx[1]; eieio(); return 0; case FBIMSTT_GETIDXREG: - if (copy_from_user(idx, (void *)arg, 1)) + if (copy_from_user(idx, argp, 1)) return -EFAULT; par->cmap_regs[PIDXHI] = 0; eieio(); par->cmap_regs[PIDXLO] = idx[0]; eieio(); idx[1] = par->cmap_regs[PIDXDATA]; - if (copy_to_user((void *)(arg + 1), &idx[1], 1)) + if (copy_to_user((void __user *)(arg + 1), &idx[1], 1)) return -EFAULT; return 0; default: diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index aad0ab3ff..8639b25f3 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c @@ -592,11 +592,11 @@ static int kyrofb_ioctl(struct inode *inode, struct file *file, { overlay_create ol_create; overlay_viewport_set ol_viewport_set; + void __user *argp = (void __user *)arg; switch (cmd) { case KYRO_IOCTL_OVERLAY_CREATE: - copy_from_user((void *) &ol_create, (void *) arg, - sizeof(overlay_create)); + copy_from_user(&ol_create, argp, sizeof(overlay_create)); if (kyro_dev_overlay_create(ol_create.ulWidth, ol_create.ulHeight, 0) < 0) { @@ -606,7 +606,7 @@ static int kyrofb_ioctl(struct inode *inode, struct file *file, } break; case KYRO_IOCTL_OVERLAY_VIEWPORT_SET: - copy_from_user((void *) &ol_viewport_set, (void *) arg, + copy_from_user(&ol_viewport_set, argp, sizeof(overlay_viewport_set)); if (kyro_dev_overlay_viewport_set(ol_viewport_set.xOrgin, @@ -627,13 +627,13 @@ static int kyrofb_ioctl(struct inode *inode, struct file *file, } break; case KYRO_IOCTL_UVSTRIDE: - copy_to_user((void *)arg, (void *)&deviceInfo.ulOverlayUVStride, sizeof(unsigned long)); + copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long)); break; case KYRO_IOCTL_STRIDE: - copy_to_user((void *)arg, (void *)&deviceInfo.ulOverlayStride, sizeof(unsigned long)); + copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long)); break; case KYRO_IOCTL_OVERLAY_OFFSET: - copy_to_user((void *)arg, (void *)&deviceInfo.ulOverlayOffset, sizeof(unsigned long)); + copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long)); break; } diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 88c0aea0a..8074e858c 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c @@ -874,6 +874,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg, struct fb_info *info) { + void __user *argp = (void __user *)arg; MINFO_FROM_INFO(info); DBG(__FUNCTION__) @@ -891,7 +892,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, err = matroxfb_get_vblank(PMINFO &vblank); if (err) return err; - if (copy_to_user((struct fb_vblank*)arg, &vblank, sizeof(vblank))) + if (copy_to_user(argp, &vblank, sizeof(vblank))) return -EFAULT; return 0; } @@ -899,7 +900,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, { u_int32_t crt; - if (get_user(crt, (u_int32_t *)arg)) + if (get_user(crt, (u_int32_t __user *)arg)) return -EFAULT; return matroxfb_wait_for_sync(PMINFO crt); @@ -910,7 +911,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, struct matrox_altout *oproc; int val; - if (copy_from_user(&mom, (struct matroxioc_output_mode*)arg, sizeof(mom))) + if (copy_from_user(&mom, argp, sizeof(mom))) return -EFAULT; if (mom.output >= MATROXFB_MAX_OUTPUTS) return -ENXIO; @@ -960,7 +961,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, struct matrox_altout *oproc; int val; - if (copy_from_user(&mom, (struct matroxioc_output_mode*)arg, sizeof(mom))) + if (copy_from_user(&mom, argp, sizeof(mom))) return -EFAULT; if (mom.output >= MATROXFB_MAX_OUTPUTS) return -ENXIO; @@ -975,7 +976,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, up_read(&ACCESS_FBINFO(altout.lock)); if (val) return val; - if (copy_to_user((struct matroxioc_output_mode*)arg, &mom, sizeof(mom))) + if (copy_to_user(argp, &mom, sizeof(mom))) return -EFAULT; return 0; } @@ -985,7 +986,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, int i; int changes; - if (copy_from_user(&tmp, (u_int32_t*)arg, sizeof(tmp))) + if (copy_from_user(&tmp, argp, sizeof(tmp))) return -EFAULT; for (i = 0; i < 32; i++) { if (tmp & (1 << i)) { @@ -1040,7 +1041,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, conn |= 1 << i; } } - if (put_user(conn, (u_int32_t*)arg)) + if (put_user(conn, (u_int32_t __user *)arg)) return -EFAULT; return 0; } @@ -1065,7 +1066,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, if (conn & MATROXFB_OUTPUT_CONN_SECONDARY) conn &= ~MATROXFB_OUTPUT_CONN_DFP; } - if (put_user(conn, (u_int32_t*)arg)) + if (put_user(conn, (u_int32_t __user *)arg)) return -EFAULT; return 0; } @@ -1079,7 +1080,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, conn |= 1 << i; } } - if (put_user(conn, (u_int32_t*)arg)) + if (put_user(conn, (u_int32_t __user *)arg)) return -EFAULT; return 0; } @@ -1093,7 +1094,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, sprintf(r.bus_info, "PCI:%s", pci_name(ACCESS_FBINFO(pcidev))); r.version = KERNEL_VERSION(1,0,0); r.capabilities = V4L2_CAP_VIDEO_OUTPUT; - if (copy_to_user((void*)arg, &r, sizeof(r))) + if (copy_to_user(argp, &r, sizeof(r))) return -EFAULT; return 0; @@ -1103,7 +1104,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, struct v4l2_queryctrl qctrl; int err; - if (copy_from_user(&qctrl, (struct v4l2_queryctrl*)arg, sizeof(qctrl))) + if (copy_from_user(&qctrl, argp, sizeof(qctrl))) return -EFAULT; down_read(&ACCESS_FBINFO(altout).lock); @@ -1116,7 +1117,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, } up_read(&ACCESS_FBINFO(altout).lock); if (err >= 0 && - copy_to_user((struct v4l2_queryctrl*)arg, &qctrl, sizeof(qctrl))) + copy_to_user(argp, &qctrl, sizeof(qctrl))) return -EFAULT; return err; } @@ -1125,7 +1126,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, struct v4l2_control ctrl; int err; - if (copy_from_user(&ctrl, (struct v4l2_control*)arg, sizeof(ctrl))) + if (copy_from_user(&ctrl, argp, sizeof(ctrl))) return -EFAULT; down_read(&ACCESS_FBINFO(altout).lock); @@ -1138,7 +1139,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, } up_read(&ACCESS_FBINFO(altout).lock); if (err >= 0 && - copy_to_user((struct v4l2_control*)arg, &ctrl, sizeof(ctrl))) + copy_to_user(argp, &ctrl, sizeof(ctrl))) return -EFAULT; return err; } @@ -1147,7 +1148,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, struct v4l2_control ctrl; int err; - if (copy_from_user(&ctrl, (struct v4l2_control*)arg, sizeof(ctrl))) + if (copy_from_user(&ctrl, argp, sizeof(ctrl))) return -EFAULT; down_read(&ACCESS_FBINFO(altout).lock); diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index d6f393593..0d7e067fe 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c @@ -437,7 +437,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, err = matroxfb_dh_get_vblank(m2info, &vblank); if (err) return err; - if (copy_to_user((struct fb_vblank*)arg, &vblank, sizeof(vblank))) + if (copy_to_user((void __user *)arg, &vblank, sizeof(vblank))) return -EFAULT; return 0; } @@ -445,7 +445,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, { u_int32_t crt; - if (get_user(crt, (u_int32_t *)arg)) + if (get_user(crt, (u_int32_t __user *)arg)) return -EFAULT; if (crt != 0) @@ -464,7 +464,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, int out; int changes; - if (get_user(tmp, (u_int32_t*)arg)) + if (get_user(tmp, (u_int32_t __user *)arg)) return -EFAULT; for (out = 0; out < 32; out++) { if (tmp & (1 << out)) { @@ -514,7 +514,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, conn |= 1 << out; } } - if (put_user(conn, (u_int32_t*)arg)) + if (put_user(conn, (u_int32_t __user *)arg)) return -EFAULT; return 0; } @@ -539,7 +539,7 @@ static int matroxfb_dh_ioctl(struct inode* inode, tmp = 0; } } - if (put_user(tmp, (u_int32_t*)arg)) + if (put_user(tmp, (u_int32_t __user *)arg)) return -EFAULT; return 0; } diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index cd157349c..d046edf1e 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -490,6 +490,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, int res_specified = 0, bpp_specified = 0, refresh_specified = 0; unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; int yres_specified = 0; + u32 best = -1, diff = -1; for (i = namelen-1; i >= 0; i--) { switch (name[i]) { @@ -529,8 +530,8 @@ int fb_find_mode(struct fb_var_screeninfo *var, } done: for (i = refresh_specified; i >= 0; i--) { - DPRINTK("Trying specified video mode%s\n", - i ? "" : " (ignoring refresh rate)"); + DPRINTK("Trying specified video mode%s %ix%i\n", + i ? "" : " (ignoring refresh rate)", xres, yres); for (j = 0; j < dbsize; j++) if ((name_matches(db[j], name, namelen) || (res_specified && res_matches(db[j], xres, yres))) && @@ -538,6 +539,22 @@ done: !fb_try_mode(var, info, &db[j], bpp)) return 2-i; } + DPRINTK("Trying best-fit modes\n"); + for (i = 0; i < dbsize; i++) { + if (xres <= db[i].xres && yres <= db[i].yres) { + DPRINTK("Trying %ix%i\n", db[i].xres, db[i].yres); + if (!fb_try_mode(var, info, &db[i], bpp)) { + if (diff > (db[i].xres - xres) + (db[i].yres - yres)) { + diff = (db[i].xres - xres) + (db[i].yres - yres); + best = i; + } + } + } + } + if (best != -1) { + fb_try_mode(var, info, &db[best], bpp); + return 5; + } } DPRINTK("Trying default video mode\n"); diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index bfa3f8b58..7ded3f7c9 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -109,10 +108,13 @@ pxafb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, u_int val, ret = 1; if (regno < fbi->palette_size) { - val = ((red >> 0) & 0xf800); - val |= ((green >> 5) & 0x07e0); - val |= ((blue >> 11) & 0x001f); - + if (fbi->fb.var.grayscale) { + val = ((blue >> 8) & 0x00ff); + } else { + val = ((red >> 0) & 0xf800); + val |= ((green >> 5) & 0x07e0); + val |= ((blue >> 11) & 0x001f); + } fbi->palette_cpu[regno] = val; ret = 0; } @@ -150,7 +152,7 @@ pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, switch (fbi->fb.fix.visual) { case FB_VISUAL_TRUECOLOR: /* - * 12 or 16-bit True Colour. We encode the RGB value + * 16-bit True Colour. We encode the RGB value * according to the RGB bitfield information. */ if (regno < 16) { @@ -242,7 +244,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) * The pixel packing format is described on page 7-11 of the * PXA2XX Developer's Manual. */ - if ( var->bits_per_pixel == 16 ) { + if (var->bits_per_pixel == 16) { var->red.offset = 11; var->red.length = 5; var->green.offset = 5; var->green.length = 6; var->blue.offset = 0; var->blue.length = 5; @@ -297,7 +299,10 @@ static int pxafb_set_par(struct fb_info *info) fbi->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; - fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16; + if (var->bits_per_pixel == 16) + fbi->palette_size = 0; + else + fbi->palette_size = var->bits_per_pixel == 1 ? 4 : 1 << var->bits_per_pixel; palette_mem_size = fbi->palette_size * sizeof(u16); @@ -311,6 +316,11 @@ static int pxafb_set_par(struct fb_info *info) */ pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); + if (fbi->fb.var.bits_per_pixel == 16) + fb_dealloc_cmap(&fbi->fb.cmap); + else + fb_alloc_cmap(&fbi->fb.cmap, 1<fb.var.bits_per_pixel, 0); + pxafb_activate_var(var, fbi); return 0; @@ -349,7 +359,7 @@ static int pxafb_set_par(struct fb_info *info) /* * pxafb_blank(): * Blank the display by setting all palette values to zero. Note, the - * 12 and 16 bpp modes don't really use the palette, so this will not + * 16 bpp mode does not really use the palette, so this will not * blank the display in all modes. */ static int pxafb_blank(int blank, struct fb_info *info) @@ -514,7 +524,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * * the YRES parameter. */ lines_per_panel = var->yres; - if (fbi->lccr0 & LCCR0_SDS) + if ((fbi->lccr0 & LCCR0_SDS) == LCCR0_Dual) lines_per_panel /= 2; new_regs.lccr2 = @@ -566,20 +576,16 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * fbi->dmadesc_palette_cpu->fidr = 0; fbi->dmadesc_palette_cpu->ldcmd = (fbi->palette_size * 2) | LDCMD_PAL; - if( var->bits_per_pixel < 12) - { - /* assume any mode with <12 bpp is palette driven */ - fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_fbhigh_dma; - fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_palette_dma; - fbi->fdadr0 = fbi->dmadesc_palette_dma; /* flips back and forth between pal and fbhigh */ - } - else - { + if (var->bits_per_pixel == 16) { /* palette shouldn't be loaded in true-color mode */ fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_fbhigh_dma; fbi->fdadr0 = fbi->dmadesc_fbhigh_dma; /* no pal just fbhigh */ /* init it to something, even though we won't be using it */ fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_palette_dma; + } else { + fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_fbhigh_dma; + fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_palette_dma; + fbi->fdadr0 = fbi->dmadesc_palette_dma; /* flips back and forth between pal and fbhigh */ } #if 0 @@ -696,7 +702,7 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi) } else { - printk( KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n"); + printk(KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n"); } } @@ -1123,11 +1129,11 @@ static int __init pxafb_parse_options(struct device *dev, char *options) res_specified = 1; } done: - if ( res_specified ) { - dev_info(dev, "overriding resolution: %dx%x\n", xres, yres); + if (res_specified) { + dev_info(dev, "overriding resolution: %dx%d\n", xres, yres); inf->xres = xres; inf->yres = yres; } - if ( bpp_specified ) + if (bpp_specified) switch (bpp) { case 1: case 2: @@ -1142,7 +1148,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) } } else if (!strncmp(this_opt, "pixclock:", 9)) { inf->pixclock = simple_strtoul(this_opt+9, NULL, 0); - dev_info(dev, "override pixclock: %u\n", inf->pixclock); + dev_info(dev, "override pixclock: %ld\n", inf->pixclock); } else if (!strncmp(this_opt, "left:", 5)) { inf->left_margin = simple_strtoul(this_opt+5, NULL, 0); dev_info(dev, "override left: %u\n", inf->left_margin); @@ -1162,7 +1168,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) inf->vsync_len = simple_strtoul(this_opt+9, NULL, 0); dev_info(dev, "override vsynclen: %u\n", inf->vsync_len); } else if (!strncmp(this_opt, "hsync:", 6)) { - if ( simple_strtoul(this_opt+6, NULL, 0) == 0 ) { + if (simple_strtoul(this_opt+6, NULL, 0) == 0) { dev_info(dev, "override hsync: Active Low\n"); inf->sync &= ~FB_SYNC_HOR_HIGH_ACT; } else { @@ -1170,7 +1176,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) inf->sync |= FB_SYNC_HOR_HIGH_ACT; } } else if (!strncmp(this_opt, "vsync:", 6)) { - if ( simple_strtoul(this_opt+6, NULL, 0) == 0 ) { + if (simple_strtoul(this_opt+6, NULL, 0) == 0) { dev_info(dev, "override vsync: Active Low\n"); inf->sync &= ~FB_SYNC_VERT_HIGH_ACT; } else { @@ -1178,7 +1184,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) inf->sync |= FB_SYNC_VERT_HIGH_ACT; } } else if (!strncmp(this_opt, "dpc:", 4)) { - if ( simple_strtoul(this_opt+4, NULL, 0) == 0 ) { + if (simple_strtoul(this_opt+4, NULL, 0) == 0) { dev_info(dev, "override double pixel clock: false\n"); inf->lccr3 &= ~LCCR3_DPC; } else { @@ -1186,20 +1192,20 @@ static int __init pxafb_parse_options(struct device *dev, char *options) inf->lccr3 |= LCCR3_DPC; } } else if (!strncmp(this_opt, "outputen:", 9)) { - if ( simple_strtoul(this_opt+9, NULL, 0) == 0 ) { + if (simple_strtoul(this_opt+9, NULL, 0) == 0) { dev_info(dev, "override output enable: active low\n"); - inf->lccr3 = ( inf->lccr3 & ~LCCR3_OEP ) | LCCR3_OutEnL; + inf->lccr3 = (inf->lccr3 & ~LCCR3_OEP) | LCCR3_OutEnL; } else { dev_info(dev, "override output enable: active high\n"); - inf->lccr3 = ( inf->lccr3 & ~LCCR3_OEP ) | LCCR3_OutEnH; + inf->lccr3 = (inf->lccr3 & ~LCCR3_OEP) | LCCR3_OutEnH; } } else if (!strncmp(this_opt, "pixclockpol:", 12)) { - if ( simple_strtoul(this_opt+12, NULL, 0) == 0 ) { + if (simple_strtoul(this_opt+12, NULL, 0) == 0) { dev_info(dev, "override pixel clock polarity: falling edge\n"); - inf->lccr3 = ( inf->lccr3 & ~LCCR3_PCP ) | LCCR3_PixFlEdg; + inf->lccr3 = (inf->lccr3 & ~LCCR3_PCP) | LCCR3_PixFlEdg; } else { dev_info(dev, "override pixel clock polarity: rising edge\n"); - inf->lccr3 = ( inf->lccr3 & ~LCCR3_PCP ) | LCCR3_PixRsEdg; + inf->lccr3 = (inf->lccr3 & ~LCCR3_PCP) | LCCR3_PixRsEdg; } } else if (!strncmp(this_opt, "color", 5)) { inf->lccr0 = (inf->lccr0 & ~LCCR0_CMS) | LCCR0_Color; @@ -1244,7 +1250,7 @@ int __init pxafb_probe(struct device *dev) #ifdef CONFIG_FB_PXA_PARAMETERS ret = pxafb_parse_options(dev, g_options); - if ( ret < 0 ) + if (ret < 0) goto failed; #endif @@ -1252,23 +1258,23 @@ int __init pxafb_probe(struct device *dev) /* Check for various illegal bit-combinations. Currently only * a warning is given. */ - if ( inf->lccr0 & LCCR0_INVALID_CONFIG_MASK ) + if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); - if ( inf->lccr3 & LCCR3_INVALID_CONFIG_MASK ) + if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); - if ( inf->lccr0 & LCCR0_DPD && - ( ( inf->lccr0 & LCCR0_PAS ) != LCCR0_Pas || - ( inf->lccr0 & LCCR0_SDS ) != LCCR0_Sngl || - ( inf->lccr0 & LCCR0_CMS ) != LCCR0_Mono ) ) + if (inf->lccr0 & LCCR0_DPD && + ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || + (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || + (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" " single panel mode\n"); - if ( (inf->lccr0 & LCCR0_PAS) == LCCR0_Act && - ( inf->lccr0 & LCCR0_SDS ) == LCCR0_Dual ) + if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && + (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) dev_warn(dev, "Dual panel only valid in passive mode\n"); - if ( (inf->lccr0 & LCCR0_PAS ) == LCCR0_Pas && - (inf->upper_margin || inf->lower_margin) ) + if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && + (inf->upper_margin || inf->lower_margin)) dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); #endif diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c index 9f258b07d..50235d74d 100644 --- a/drivers/video/radeonfb.c +++ b/drivers/video/radeonfb.c @@ -1544,7 +1544,7 @@ static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int break; } - rc = get_user(value, (__u32*)arg); + rc = get_user(value, (__u32 __user *)arg); if (rc) return rc; @@ -1598,7 +1598,7 @@ static int radeonfb_ioctl (struct inode *inode, struct file *file, unsigned int if (CRTC_CRT_ON & tmp) value |= 0x02; - return put_user(value, (__u32*)arg); + return put_user(value, (__u32 __user *)arg); default: return -EINVAL; } diff --git a/drivers/video/riva/Makefile b/drivers/video/riva/Makefile index f5a4db78f..8898c9915 100644 --- a/drivers/video/riva/Makefile +++ b/drivers/video/riva/Makefile @@ -2,6 +2,10 @@ # Makefile for the Riva framebuffer driver # -obj-$(CONFIG_FB_RIVA) += rivafb.o +obj-$(CONFIG_FB_RIVA) += rivafb.o -rivafb-objs := fbdev.o riva_hw.o nv_driver.o +rivafb-objs := fbdev.o riva_hw.o nv_driver.o + +ifdef CONFIG_FB_RIVA_I2C + rivafb-objs += rivafb-i2c.o +endif diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 1dc6e9555..316e461ab 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c @@ -296,9 +296,8 @@ static int forceCRTC __initdata = -1; static int nomtrr __initdata = 0; #endif -#ifndef MODULE static char *mode_option __initdata = NULL; -#endif +static int strictmode = 0; static struct fb_fix_screeninfo rivafb_fix = { .id = "nVidia", @@ -493,54 +492,30 @@ static inline void reverse_order(u32 *l) * rivafb_cursor() */ static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8, - u8 *mask8, u16 bg, u16 fg, u32 w, u32 h) + u16 bg, u16 fg, u32 w, u32 h) { int i, j, k = 0; - u32 b, m, tmp; + u32 b, tmp; u32 *data = (u32 *)data8; - u32 *mask = (u32 *)mask8; for (i = 0; i < h; i++) { b = *data++; - m = *mask++; reverse_order(&b); for (j = 0; j < w/2; j++) { tmp = 0; #if defined (__BIG_ENDIAN) - if (m & (1 << 31)) { - fg |= 1 << 15; - bg |= 1 << 15; - } tmp = (b & (1 << 31)) ? fg << 16 : bg << 16; b <<= 1; - m <<= 1; - - if (m & (1 << 31)) { - fg |= 1 << 15; - bg |= 1 << 15; - } tmp |= (b & (1 << 31)) ? fg : bg; b <<= 1; - m <<= 1; #else - if (m & 1) { - fg |= 1 << 15; - bg |= 1 << 15; - } tmp = (b & 1) ? fg : bg; b >>= 1; - m >>= 1; - - if (m & 1) { - fg |= 1 << 15; - bg |= 1 << 15; - } tmp |= (b & 1) ? fg << 16 : bg << 16; b >>= 1; - m >>= 1; #endif - writel(tmp, par->riva.CURSOR + k++); + writel(tmp, &par->riva.CURSOR[k++]); } k += (MAX_CURS - w)/2; } @@ -833,6 +808,24 @@ static void riva_load_video_mode(struct fb_info *info) rivafb_blank(0, info); } +static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb) +{ + var->xres = var->xres_virtual = modedb->xres; + var->yres = modedb->yres; + if (var->yres_virtual < var->yres) + var->yres_virtual = var->yres; + var->xoffset = var->yoffset = 0; + var->pixclock = modedb->pixclock; + var->left_margin = modedb->left_margin; + var->right_margin = modedb->right_margin; + var->upper_margin = modedb->upper_margin; + var->lower_margin = modedb->lower_margin; + var->hsync_len = modedb->hsync_len; + var->vsync_len = modedb->vsync_len; + var->sync = modedb->sync; + var->vmode = modedb->vmode; +} + /** * rivafb_do_maximize - * @info: pointer to fb_info object containing info for current riva board @@ -872,7 +865,7 @@ static int rivafb_do_maximize(struct fb_info *info, "using maximum available virtual resolution\n"); for (i = 0; modes[i].xres != -1; i++) { if (modes[i].xres * nom / den * modes[i].yres < - info->fix.smem_len / 2) + info->fix.smem_len) break; } if (modes[i].xres == -1) { @@ -927,35 +920,47 @@ static int rivafb_do_maximize(struct fb_info *info, "virtual Y resolution (%d) is smaller than real\n", var->yres_virtual); return -EINVAL; } + if (var->xres_virtual > 0x7fff) + var->xres_virtual = 0x7fff; + if (var->yres_virtual > 0x7fff) + var->yres_virtual = 0x7fff; return 0; } +static void +riva_set_pattern(struct riva_par *par, int clr0, int clr1, int pat0, int pat1) +{ + RIVA_FIFO_FREE(par->riva, Patt, 4); + par->riva.Patt->Color0 = clr0; + par->riva.Patt->Color1 = clr1; + par->riva.Patt->Monochrome[0] = pat0; + par->riva.Patt->Monochrome[1] = pat1; +} + /* acceleration routines */ inline void wait_for_idle(struct riva_par *par) { while (par->riva.Busy(&par->riva)); } -/* set copy ROP, no mask */ -static void riva_setup_ROP(struct riva_par *par) +/* + * Set ROP. Translate X rop into ROP3. Internal routine. + */ +static void +riva_set_rop_solid(struct riva_par *par, int rop) { - RIVA_FIFO_FREE(par->riva, Patt, 5); - par->riva.Patt->Shape = 0; - par->riva.Patt->Color0 = 0xffffffff; - par->riva.Patt->Color1 = 0xffffffff; - par->riva.Patt->Monochrome[0] = 0xffffffff; - par->riva.Patt->Monochrome[1] = 0xffffffff; - - RIVA_FIFO_FREE(par->riva, Rop, 1); - par->riva.Rop->Rop3 = 0xCC; + riva_set_pattern(par, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); + RIVA_FIFO_FREE(par->riva, Rop, 1); + par->riva.Rop->Rop3 = rop; + } void riva_setup_accel(struct riva_par *par) { RIVA_FIFO_FREE(par->riva, Clip, 2); par->riva.Clip->TopLeft = 0x0; - par->riva.Clip->WidthHeight = 0x80008000; - riva_setup_ROP(par); + par->riva.Clip->WidthHeight = 0x7fff7fff; + riva_set_rop_solid(par, 0xcc); wait_for_idle(par); } @@ -1043,7 +1048,9 @@ static int rivafb_release(struct fb_info *info, int user) static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { + struct fb_monspecs *specs = &info->monspecs; int nom, den; /* translating from pixels->bytes */ + int mode_valid = 0; switch (var->bits_per_pixel) { case 1 ... 8: @@ -1094,6 +1101,73 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) return -EINVAL; } + if (!strictmode) { + if (!fb_validate_mode(var, info)) + mode_valid = 1; + } + + /* find best mode from modedb */ + if (!mode_valid && specs->modedb_len) { + int i, best, best_refresh, best_x, best_y, diff_x, diff_y; + + best_refresh = best = best_x = best_y = 0; + diff_x = diff_y = -1; + + for (i = 0; i < specs->modedb_len; i++) { + if (var->xres <= specs->modedb[i].xres && + !(specs->modedb[i].flag & FB_MODE_IS_CALCULATED) && + specs->modedb[i].xres - var->xres < diff_x) { + best_x = specs->modedb[i].xres; + diff_x = best_x - var->xres; + } + if (!diff_x) break; + } + + if (diff_x != -1) { + for (i = 0; i < specs->modedb_len; i++) { + if (best_x == specs->modedb[i].xres && + var->yres <= specs->modedb[i].yres && + !(specs->modedb[i].flag & + FB_MODE_IS_CALCULATED) && + specs->modedb[i].yres-var->yres < diff_y) { + best_y = specs->modedb[i].yres; + diff_y = best_y - var->yres; + } + if (!diff_y) break; + } + } + + if (diff_y != -1) { + for (i = 0; i < specs->modedb_len; i++) { + if (best_x == specs->modedb[i].xres && + best_y == specs->modedb[i].yres && + !(specs->modedb[i].flag & + FB_MODE_IS_CALCULATED) && + specs->modedb[i].refresh > best_refresh) { + best_refresh=specs->modedb[i].refresh; + best = i; + } + } + } + + if (best_refresh) { + riva_update_var(var, &specs->modedb[best]); + mode_valid = 1; + } + } + + /* calculate modeline if supported by monitor */ + if (!mode_valid && info->monspecs.gtf) { + if (!fb_get_mode(FB_MAXTIMINGS, 0, var, info)) + mode_valid = 1; + } + if (!mode_valid && info->monspecs.modedb_len) + return -EINVAL; + + if (var->xres_virtual < var->xres) + var->xres_virtual = var->xres; + if (var->yres_virtual <= var->yres) + var->yres_virtual = -1; if (rivafb_do_maximize(info, var, nom, den) < 0) return -EINVAL; @@ -1329,8 +1403,7 @@ static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect break; } - RIVA_FIFO_FREE(par->riva, Rop, 1); - par->riva.Rop->Rop3 = rop; + riva_set_rop_solid(par, rop); RIVA_FIFO_FREE(par->riva, Bitmap, 1); par->riva.Bitmap->Color1A = color; @@ -1338,10 +1411,12 @@ static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect RIVA_FIFO_FREE(par->riva, Bitmap, 2); par->riva.Bitmap->UnclippedRectangle[0].TopLeft = (rect->dx << 16) | rect->dy; + mb(); par->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (rect->width << 16) | rect->height; - RIVA_FIFO_FREE(par->riva, Rop, 1); - par->riva.Rop->Rop3 = 0xCC; // back to COPY + mb(); + riva_set_rop_solid(par, 0xcc); + } /** @@ -1362,8 +1437,9 @@ static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *regi RIVA_FIFO_FREE(par->riva, Blt, 3); par->riva.Blt->TopLeftSrc = (region->sy << 16) | region->sx; par->riva.Blt->TopLeftDst = (region->dy << 16) | region->dx; + mb(); par->riva.Blt->WidthHeight = (region->height << 16) | region->width; - wait_for_idle(par); + mb(); } static inline void convert_bgcolor_16(u32 *col) @@ -1372,6 +1448,7 @@ static inline void convert_bgcolor_16(u32 *col) | ((*col & 0x000003E0) << 6) | ((*col & 0x0000001F) << 3) | 0xFF000000; + mb(); } /** @@ -1478,7 +1555,6 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) { struct riva_par *par = (struct riva_par *) info->par; u8 data[MAX_CURS * MAX_CURS/8]; - u8 mask[MAX_CURS * MAX_CURS/8]; u16 fg, bg; int i; @@ -1508,7 +1584,7 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) info->cursor.image.fg_color = cursor->image.fg_color; } - if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP)) { + if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETCUR)) { u32 bg_idx = info->cursor.image.bg_color; u32 fg_idx = info->cursor.image.fg_color; u32 s_pitch = (info->cursor.image.width+7) >> 3; @@ -1517,34 +1593,35 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) u8 *msk = (u8 *) info->cursor.mask; u8 src[64]; + info->cursor.image.data = cursor->image.data; switch (info->cursor.rop) { case ROP_XOR: - for (i = 0; i < s_pitch * info->cursor.image.height; i++) - src[i] = dat[i] ^ msk[i]; + for (i = 0; i < s_pitch * info->cursor.image.height; + i++) + src[i] = dat[i] ^ msk[i]; break; case ROP_COPY: default: - for (i = 0; i < s_pitch * info->cursor.image.height; i++) - - src[i] = dat[i] & msk[i]; + for (i = 0; i < s_pitch * info->cursor.image.height; + i++) + src[i] = dat[i] & msk[i]; break; } - fb_move_buf_aligned(info, &info->sprite, data, d_pitch, src, s_pitch, info->cursor.image.height); - - fb_move_buf_aligned(info, &info->sprite, mask, d_pitch, msk, s_pitch, info->cursor.image.height); + fb_move_buf_aligned(info, &info->sprite, data, d_pitch, src, + s_pitch, info->cursor.image.height); bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | ((info->cmap.green[bg_idx] & 0xf8) << 2) | - ((info->cmap.blue[bg_idx] & 0xf8) >> 3); + ((info->cmap.blue[bg_idx] & 0xf8) >> 3) | 1 << 15; fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) | ((info->cmap.green[fg_idx] & 0xf8) << 2) | - ((info->cmap.blue[fg_idx] & 0xf8) >> 3); + ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15; par->riva.LockUnlock(&par->riva, 0); - rivafb_load_cursor_image(par, data, mask, bg, fg, + rivafb_load_cursor_image(par, data, bg, fg, info->cursor.image.width, info->cursor.image.height); } @@ -1586,24 +1663,19 @@ static struct fb_ops riva_fb_ops = { static int __devinit riva_set_fbinfo(struct fb_info *info) { - struct riva_par *par = (struct riva_par *) info->par; unsigned int cmap_len; - info->flags = FBINFO_FLAG_DEFAULT; + info->flags = FBINFO_DEFAULT + | FBINFO_HWACCEL_XPAN + | FBINFO_HWACCEL_YPAN + | FBINFO_HWACCEL_COPYAREA + | FBINFO_HWACCEL_FILLRECT + | FBINFO_HWACCEL_IMAGEBLIT; info->var = rivafb_default_var; - info->fix = rivafb_fix; - info->fbops = &riva_fb_ops; + info->fix.visual = (info->var.bits_per_pixel == 8) ? + FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; info->pseudo_palette = pseudo_palette; -#ifndef MODULE - if (mode_option) - fb_find_mode(&info->var, info, mode_option, - NULL, 0, NULL, 8); -#endif - if (par->use_default_var) - /* We will use the modified default var */ - info->var = rivafb_default_var; - cmap_len = riva_get_cmap_len(&info->var); fb_alloc_cmap(&info->cmap, cmap_len, 0); @@ -1611,7 +1683,8 @@ static int __devinit riva_set_fbinfo(struct fb_info *info) info->pixmap.buf_align = 4; info->pixmap.scan_align = 4; info->pixmap.flags = FB_PIXMAP_SYSTEM; - return 0; + info->var.yres_virtual = -1; + return (rivafb_check_var(&info->var, info)); } #ifdef CONFIG_PPC_OF @@ -1620,89 +1693,60 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) struct riva_par *par = (struct riva_par *) info->par; struct device_node *dp; unsigned char *pedid = NULL; + unsigned char *disptype = NULL; + static char *propnames[] = { + "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL }; + int i; dp = pci_device_to_OF_node(pd); - pedid = (unsigned char *)get_property(dp, "EDID,B", 0); - - if (pedid) { + for (; dp != NULL; dp = dp->child) { + disptype = (unsigned char *)get_property(dp, "display-type", NULL); + if (disptype == NULL) + continue; + if (strncmp(disptype, "LCD", 3) != 0) + continue; + for (i = 0; propnames[i] != NULL; ++i) { + pedid = (unsigned char *) + get_property(dp, propnames[i], NULL); + if (pedid != NULL) { par->EDID = pedid; return 1; - } else + } + } + } return 0; } #endif /* CONFIG_PPC_OF */ -static int riva_dfp_parse_EDID(struct riva_par *par) +static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_info *info) { - unsigned char *block = par->EDID; - - if (!block) - return 0; - - /* jump to detailed timing block section */ - block += 54; - - par->clock = (block[0] + (block[1] << 8)); - par->panel_xres = (block[2] + ((block[4] & 0xf0) << 4)); - par->hblank = (block[3] + ((block[4] & 0x0f) << 8)); - par->panel_yres = (block[5] + ((block[7] & 0xf0) << 4)); - par->vblank = (block[6] + ((block[7] & 0x0f) << 8)); - par->hOver_plus = (block[8] + ((block[11] & 0xc0) << 2)); - par->hSync_width = (block[9] + ((block[11] & 0x30) << 4)); - par->vOver_plus = ((block[10] >> 4) + ((block[11] & 0x0c) << 2)); - par->vSync_width = ((block[10] & 0x0f) + ((block[11] & 0x03) << 4)); - par->interlaced = ((block[17] & 0x80) >> 7); - par->synct = ((block[17] & 0x18) >> 3); - par->misc = ((block[17] & 0x06) >> 1); - par->hAct_high = par->vAct_high = 0; - if (par->synct == 3) { - if (par->misc & 2) - par->hAct_high = 1; - if (par->misc & 1) - par->vAct_high = 1; + struct fb_monspecs *specs = &info->monspecs; + struct fb_videomode modedb; + + /* respect mode options */ + if (mode_option) { + fb_find_mode(var, info, mode_option, + specs->modedb, specs->modedb_len, + NULL, 8); + } else if (specs->modedb != NULL) { + /* get preferred timing */ + if (info->monspecs.misc & FB_MISC_1ST_DETAIL) { + int i; + + for (i = 0; i < specs->modedb_len; i++) { + if (specs->modedb[i].flag & FB_MODE_IS_FIRST) { + modedb = specs->modedb[i]; + break; + } + } + } else { + /* otherwise, get first mode in database */ + modedb = specs->modedb[0]; + } + var->bits_per_pixel = 8; + riva_update_var(var, &modedb); } - - printk(KERN_INFO PFX - "detected DFP panel size from EDID: %dx%d\n", - par->panel_xres, par->panel_yres); - par->got_dfpinfo = 1; - return 1; -} - -static void riva_update_default_var(struct fb_info *info) -{ - struct fb_var_screeninfo *var = &rivafb_default_var; - struct riva_par *par = (struct riva_par *) info->par; - - var->xres = par->panel_xres; - var->yres = par->panel_yres; - var->xres_virtual = par->panel_xres; - var->yres_virtual = par->panel_yres; - var->xoffset = var->yoffset = 0; - var->bits_per_pixel = 8; - var->pixclock = 100000000 / par->clock; - var->left_margin = (par->hblank - par->hOver_plus - par->hSync_width); - var->right_margin = par->hOver_plus; - var->upper_margin = (par->vblank - par->vOver_plus - par->vSync_width); - var->lower_margin = par->vOver_plus; - var->hsync_len = par->hSync_width; - var->vsync_len = par->vSync_width; - var->sync = 0; - - if (par->synct == 3) { - if (par->hAct_high) - var->sync |= FB_SYNC_HOR_HIGH_ACT; - if (par->vAct_high) - var->sync |= FB_SYNC_VERT_HIGH_ACT; - } - - var->vmode = 0; - if (par->interlaced) - var->vmode |= FB_VMODE_INTERLACED; - var->accel_flags |= FB_ACCELF_TEXT; - - par->use_default_var = 1; } @@ -1713,19 +1757,27 @@ static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) printk("rivafb: could not retrieve EDID from OF\n"); #else /* XXX use other methods later */ +#ifdef CONFIG_FB_RIVA_I2C + struct riva_par *par = (struct riva_par *) info->par; + + riva_create_i2c_busses(par); + riva_probe_i2c_connector(par, 1, &par->EDID); + riva_delete_i2c_busses(par); +#endif #endif } -static void riva_get_dfpinfo(struct fb_info *info) +static void riva_get_edidinfo(struct fb_info *info) { + struct fb_var_screeninfo *var = &rivafb_default_var; struct riva_par *par = (struct riva_par *) info->par; - if (riva_dfp_parse_EDID(par)) - riva_update_default_var(info); + fb_edid_to_monspecs(par->EDID, &info->monspecs); + riva_update_default_var(var, info); /* if user specified flatpanel, we respect that */ - if (par->got_dfpinfo == 1) + if (info->monspecs.input & FB_DISP_DDI) par->FlatPanel = 1; } @@ -1755,6 +1807,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, memset(info, 0, sizeof(struct fb_info)); memset(default_par, 0, sizeof(struct riva_par)); + default_par->pdev = pd; info->pixmap.addr = kmalloc(64 * 1024, GFP_KERNEL); if (info->pixmap.addr == NULL) @@ -1802,10 +1855,6 @@ static int __devinit rivafb_probe(struct pci_dev *pd, info->par = default_par; - riva_get_EDID(info, pd); - - riva_get_dfpinfo(info); - switch (default_par->riva.Architecture) { case NV_ARCH_03: /* Riva128's PRAMIN is in the "framebuffer" space @@ -1870,6 +1919,11 @@ static int __devinit rivafb_probe(struct pci_dev *pd, } #endif /* CONFIG_MTRR */ + info->fbops = &riva_fb_ops; + info->fix = rivafb_fix; + riva_get_EDID(info, pd); + riva_get_edidinfo(info); + if (riva_set_fbinfo(info) < 0) { printk(KERN_ERR PFX "error setting initial video mode\n"); goto err_out_iounmap_fb; @@ -1978,6 +2032,8 @@ int __init rivafb_setup(char *options) } else if (!strncmp(this_opt, "nomtrr", 6)) { nomtrr = 1; #endif + } else if (!strncmp(this_opt, "strictmode", 10)) { + strictmode = 1; } else mode_option = this_opt; } @@ -2026,6 +2082,8 @@ MODULE_PARM_DESC(forceCRTC, "Forces usage of a particular CRTC in case autodetec #ifdef CONFIG_MTRR MODULE_PARM(nomtrr, "i"); MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) (default=0)"); +MODULE_PARM(strictmode, "i"); +MODULE_PARM_DESC(strictmode, "Only use video modes from EDID"); #endif #endif /* MODULE */ diff --git a/drivers/video/riva/rivafb.h b/drivers/video/riva/rivafb.h index 863142e6c..beb2df6c5 100644 --- a/drivers/video/riva/rivafb.h +++ b/drivers/video/riva/rivafb.h @@ -4,6 +4,10 @@ #include #include #include &U7>be9@ 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 diff --git a/scripts/kconfig/conf.o b/scripts/kconfig/conf.o index c191a8a72cd7dc86b00872d436f45203e92698f7..efffb8b00a8706b73834c3161f3621397c362b88 100644 GIT binary patch literal 9872 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 TdDmmUC4$QYR|xX$k@fu#Ga3Eo literal 10348 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%0AkQ?_iX4!<+od{Mr9pcoCP$Ho?Tws{Zp0GCyfjDK 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 literal 92510 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 Z;dKg^DHQvx7iduQI)zON!wR=3{NJk;-O>O6 diff --git a/scripts/kconfig/zconf.tab.o b/scripts/kconfig/zconf.tab.o index 3d1d070f08e892bfbf6ad208776f231e4c1108b7..9691ac24ace5358646fe7d4e2d8803abc0b87b47 100644 GIT binary patch literal 92684 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 literal 95696 zcmeFa3z!te)i8W!w%Hx%ksff>RaY6YRWPV5qB0HY?z%e*$fal58=zn=8neM0_5db; zU{5Q(=Nvb|s; z|MUFM^JNNls_Rspsy=n<)TvXaYHn{{5Dx?b;C=#70fi@k$6phWne;UUs$qhgl|F2N zDzP>-)Dvvn5@<+el7s06zB|1J(vP2m8FuH7+gki-xBt@Fv1Ids+A#oWt819^0nE01 z^X>`&u&pWo2&NHKha%?ytQjX-fN}OH;U;KckUfEA?Slax*k?Zx#`vTA4`Dqp(cFJ< zYOno`mk)8SGkWVz_5?k34jks3o4pZc;jYLqEcoZi*bXEu@T~Qo8Aq;n*JK&NmbQ zMif68G#TBWYPXIqWv zErhT%{tZ00nePRFwG-+xJ*i3iD*N5d=y1md2{k>~u9Eo_R;QWyl=5M!D;0Y+A}(7Xk?Up6^$7JpRf0F#r}X9g-4=IzGkv9LCC@2!26BJW+q^`VM0JY?w6IFjdO?q()U-qc4d4|}J-IlntC{W>kq@6|YGO!!RQ*Xq40y&@}dA=(baKtvt0J<*N zL1#3)^?}#lp*PG{qCge`8byBo8g@U5wHPt3l3FhVurzX*7?Q+~nJR$J&JKOxd+*@; zlE^0hH(v>wImu!A-iTmpF*KAN7Yj}; z#<^q5%t&H9IgBo*6R?B1e+sS;bj`hhvl0Ioj{B~MTvn2ckiH@`>OUPGN ze^|7MC`NyB2^!)!Md(CLU=2fFKXywcw2cs5CLgUaL+^0jDhN|dm->*)7cUKy;((Q2 zUxj3-L^6OraOyaZ43EDvk_->wC@dmF`Q($^_zvfZ1agLGx2~E`M{HfSC6yA)-Y^2Y z$N0R~m1W3BaPt{Bd<&F9andlPvxYbI?vR7MM(?ijL49zjwA~|6_YIW{ly1PGLWq_v z)w?TwP(FAxl(!;EB5{K0hg(_wklUNN^M*@agf$H1KH>~>Kf=s7T2&#+5cXx3x86R= ztN(&Bgv&;;;I!>WD}2w}C3GVJBUm;osi<@LQ0~J=LmES*zLd*KDyoS2|8~YSu=)s2 z8N0^-Wa~pXBNSCggXOKkqrLy2_X^nW^A8J!$`eQ~>xwFc3Z|sKh^2@ZanPCv!c?!> z8y?A9-CkCzVBUMH;8H9_L_nc�tjJD?0OsK2TMK>NHNQC>eAAcnb;OL35P=xjz-B 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

U>mUa3M_ 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

}TW2J6TcgPX|H4c3!c zgAL>?gN0)nGmOV}lJ!UXP~TJ>+f1U6&4RFnE~yc7sQikCAs6cfC4vr@>RycN#oHZZLRW z^%ioY!E5AQ25&02l0Px-`gZ7UgLkO!HrP&XG}uAjW3W^8F7jT3FUb20c9ZuT_j16{ zCWGLy{JqSeR9Q~mYtVyy(4Y_bkih`*VS|Cn2>DZkLFCU2hAKyr4;fUFj~K+sM-6Jo zpBqdhe_`Bp_s}m5rc*y=FiSa`eAHkr`749@suz-v8!RH9Fz)-gq0I&j)K3~Tk-s)b zk-sr$As;u$lTR76kxv_}B!6qLiu|3y1>`dZtI1~#E?2H0pEFoX{@!36`MkkRGt z$rlYakS`f*B)1scL%wXViG0Q2Ve(ajN6FU=9wT2j*i8Px;3@JAgJ;M$4W1|eXt0I+ zlfi4`pAFt5w;F6!ZX^F<@DBM`gYD#720N5HmAlA48+@VMt>nkGnI2T~_YUfEWe;T^ zC4c{5{y_3AgNW)u%Av}U%1UKiS)-h&oT8kroTZ$toU5F#T&P^6T&!$RHYro&TLvx4 zyr#D)S1S3vW%lO+lpoRRvAWwd1(576eT&27~xmtO-lE1sL+*&1nf1|#M{D;AM)fmG>w&DfxRH z%RQ=mOu1S4l=2zn^U5ts{;tRJZz{Jcw<+IIZddLgw;SvvKQP#(>0c;!E5YCCJ~Rj_ zOO@ry9?Cw-0m^~oKMW$|4ue7DKMjT|N0R?Cs3bo!h%0Nz9R?H0od#3Lj}4}ipBT&{ zKQ)+5?lPE5er7PA{I|hE@^gblBtPiRZ_o4DU?o4FN6k-*kbLhf$yXnfd>1vz&mNI{ zpFTNAIaJASA~3yD8CUXiKuqU5dr7{Zn4GTU=WM8FE9WZbEBWqS<}Xt6^Ci>`N`8Bu znxFL`Tat5rTjv^B@h|4D15x0dnEyPhF QZVKzQupSHJTo~8?5570G1^@s6 diff --git a/scripts/reference_init.pl b/scripts/reference_init.pl index b4e37dc3a..5f33311c5 100644 --- a/scripts/reference_init.pl +++ b/scripts/reference_init.pl @@ -90,6 +90,7 @@ foreach $object (sort(keys(%object))) { if (($line =~ /\.init$/ || $line =~ /\.init\./) && ($from !~ /\.init$/ && $from !~ /\.init\./ && + $from !~ /\.eh_frame$/ && $from !~ /\.stab$/ && $from !~ /\.rodata$/ && $from !~ /\.text\.lock$/ && diff --git a/security/dummy.c b/security/dummy.c index 27fa13b5e..05d988588 100644 --- a/security/dummy.c +++ b/security/dummy.c @@ -688,7 +688,7 @@ static int dummy_shm_shmctl (struct shmid_kernel *shp, int cmd) return 0; } -static int dummy_shm_shmat (struct shmid_kernel *shp, char *shmaddr, +static int dummy_shm_shmat (struct shmid_kernel *shp, char __user *shmaddr, int shmflg) { return 0; @@ -720,7 +720,7 @@ static int dummy_sem_semop (struct sem_array *sma, return 0; } -static int dummy_netlink_send (struct sk_buff *skb) +static int dummy_netlink_send (struct sock *sk, struct sk_buff *skb) { if (current->euid == 0) cap_raise (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN); diff --git a/security/selinux/Makefile b/security/selinux/Makefile index 890404ed2..b038cd0fa 100644 --- a/security/selinux/Makefile +++ b/security/selinux/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_SECURITY_SELINUX) := selinux.o ss/ -selinux-y := avc.o hooks.o selinuxfs.o netlink.o +selinux-y := avc.o hooks.o selinuxfs.o netlink.o nlmsgtab.o selinux-$(CONFIG_SECURITY_NETWORK) += netif.o diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 35d779a21..b2a1418ac 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -71,6 +71,9 @@ #define XATTR_SELINUX_SUFFIX "selinux" #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX +extern int policydb_loaded_version; +extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); + #ifdef CONFIG_SECURITY_SELINUX_DEVELOP int selinux_enforcing = 0; @@ -627,7 +630,7 @@ static inline u16 inode_mode_to_security_class(umode_t mode) return SECCLASS_FILE; } -static inline u16 socket_type_to_security_class(int family, int type) +static inline u16 socket_type_to_security_class(int family, int type, int protocol) { switch (family) { case PF_UNIX: @@ -648,7 +651,28 @@ static inline u16 socket_type_to_security_class(int family, int type) return SECCLASS_RAWIP_SOCKET; } case PF_NETLINK: - return SECCLASS_NETLINK_SOCKET; + switch (protocol) { + case NETLINK_ROUTE: + return SECCLASS_NETLINK_ROUTE_SOCKET; + case NETLINK_FIREWALL: + return SECCLASS_NETLINK_FIREWALL_SOCKET; + case NETLINK_TCPDIAG: + return SECCLASS_NETLINK_TCPDIAG_SOCKET; + case NETLINK_NFLOG: + return SECCLASS_NETLINK_NFLOG_SOCKET; + case NETLINK_XFRM: + return SECCLASS_NETLINK_XFRM_SOCKET; + case NETLINK_SELINUX: + return SECCLASS_NETLINK_SELINUX_SOCKET; + case NETLINK_AUDIT: + return SECCLASS_NETLINK_AUDIT_SOCKET; + case NETLINK_IP6_FW: + return SECCLASS_NETLINK_IP6FW_SOCKET; + case NETLINK_DNRTMSG: + return SECCLASS_NETLINK_DNRT_SOCKET; + default: + return SECCLASS_NETLINK_SOCKET; + } case PF_PACKET: return SECCLASS_PACKET_SOCKET; case PF_KEY: @@ -853,7 +877,8 @@ out: struct socket *sock = SOCKET_I(inode); if (sock->sk) { isec->sclass = socket_type_to_security_class(sock->sk->sk_family, - sock->sk->sk_type); + sock->sk->sk_type, + sock->sk->sk_protocol); } else { isec->sclass = SECCLASS_SOCKET; } @@ -1380,7 +1405,7 @@ static void selinux_capset_set(struct task_struct *target, kernel_cap_t *effecti if (error) return; - return secondary_ops->capset_set(target, effective, inheritable, permitted); + secondary_ops->capset_set(target, effective, inheritable, permitted); } static int selinux_capable(struct task_struct *tsk, int cap) @@ -1567,22 +1592,6 @@ static int selinux_vm_enough_memory(long pages) return -ENOMEM; } -static int selinux_netlink_send(struct sk_buff *skb) -{ - if (capable(CAP_NET_ADMIN)) - cap_raise (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN); - else - NETLINK_CB(skb).eff_cap = 0; - return 0; -} - -static int selinux_netlink_recv(struct sk_buff *skb) -{ - if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) - return -EPERM; - return 0; -} - /* binprm security operations */ static int selinux_bprm_alloc_security(struct linux_binprm *bprm) @@ -2918,8 +2927,8 @@ static int selinux_socket_create(int family, int type, tsec = current->security; err = avc_has_perm(tsec->sid, tsec->sid, - socket_type_to_security_class(family, type), - SOCKET__CREATE, NULL, NULL); + socket_type_to_security_class(family, type, + protocol), SOCKET__CREATE, NULL, NULL); out: return err; @@ -2938,7 +2947,7 @@ static void selinux_socket_post_create(struct socket *sock, int family, isec = SOCK_INODE(sock)->i_security; tsec = current->security; - isec->sclass = socket_type_to_security_class(family, type); + isec->sclass = socket_type_to_security_class(family, type, protocol); isec->sid = kern ? SECINITSID_KERNEL : tsec->sid; return; @@ -3327,6 +3336,55 @@ static void selinux_sk_free_security(struct sock *sk) sk_free_security(sk); } +static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb) +{ + int err = 0; + u32 perm; + struct nlmsghdr *nlh; + struct socket *sock = sk->sk_socket; + struct inode_security_struct *isec = SOCK_INODE(sock)->i_security; + + if (skb->len < NLMSG_SPACE(0)) { + err = -EINVAL; + goto out; + } + nlh = (struct nlmsghdr *)skb->data; + + err = selinux_nlmsg_lookup(isec->sclass, nlh->nlmsg_type, &perm); + if (err) { + /* Ignore */ + if (err == -ENOENT) + err = 0; + goto out; + } + + err = socket_has_perm(current, sock, perm); +out: + return err; +} + +static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb) +{ + int err = 0; + + if (capable(CAP_NET_ADMIN)) + cap_raise (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN); + else + NETLINK_CB(skb).eff_cap = 0; + + if (policydb_loaded_version >= POLICYDB_VERSION_NLCLASS) + err = selinux_nlmsg_perm(sk, skb); + + return err; +} + +static int selinux_netlink_recv(struct sk_buff *skb) +{ + if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) + return -EPERM; + return 0; +} + #ifdef CONFIG_NETFILTER static unsigned int selinux_ip_postroute_last(unsigned int hooknum, @@ -3550,7 +3608,7 @@ static int selinux_msg_msg_alloc_security(struct msg_msg *msg) static void selinux_msg_msg_free_security(struct msg_msg *msg) { - return msg_msg_free_security(msg); + msg_msg_free_security(msg); } /* message queue security operations */ @@ -3786,7 +3844,7 @@ static int selinux_shm_shmctl(struct shmid_kernel *shp, int cmd) } static int selinux_shm_shmat(struct shmid_kernel *shp, - char *shmaddr, int shmflg) + char __user *shmaddr, int shmflg) { u32 perms; diff --git a/security/selinux/include/av_inherit.h b/security/selinux/include/av_inherit.h index eb3f4e141..c05e2ee6f 100644 --- a/security/selinux/include/av_inherit.h +++ b/security/selinux/include/av_inherit.h @@ -29,6 +29,15 @@ static struct av_inherit av_inherit[] = { { SECCLASS_SEM, common_ipc_perm_to_string, 0x00000200UL }, { SECCLASS_MSGQ, common_ipc_perm_to_string, 0x00000200UL }, { SECCLASS_SHM, common_ipc_perm_to_string, 0x00000200UL }, + { SECCLASS_NETLINK_ROUTE_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_FIREWALL_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_TCPDIAG_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_NFLOG_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_XFRM_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_SELINUX_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_AUDIT_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_IP6FW_SOCKET, common_socket_perm_to_string, 0x00400000UL }, + { SECCLASS_NETLINK_DNRT_SOCKET, common_socket_perm_to_string, 0x00400000UL }, }; diff --git a/security/selinux/include/av_perm_to_string.h b/security/selinux/include/av_perm_to_string.h index 6891745ec..e8e2a41cf 100644 --- a/security/selinux/include/av_perm_to_string.h +++ b/security/selinux/include/av_perm_to_string.h @@ -30,6 +30,9 @@ static struct av_perm_to_string av_perm_to_string[] = { { SECCLASS_TCP_SOCKET, TCP_SOCKET__CONNECTTO, "connectto" }, { SECCLASS_TCP_SOCKET, TCP_SOCKET__NEWCONN, "newconn" }, { SECCLASS_TCP_SOCKET, TCP_SOCKET__ACCEPTFROM, "acceptfrom" }, + { SECCLASS_TCP_SOCKET, TCP_SOCKET__NODE_BIND, "node_bind" }, + { SECCLASS_UDP_SOCKET, UDP_SOCKET__NODE_BIND, "node_bind" }, + { SECCLASS_RAWIP_SOCKET, RAWIP_SOCKET__NODE_BIND, "node_bind" }, { SECCLASS_NODE, NODE__TCP_RECV, "tcp_recv" }, { SECCLASS_NODE, NODE__TCP_SEND, "tcp_send" }, { SECCLASS_NODE, NODE__UDP_RECV, "udp_recv" }, @@ -46,9 +49,6 @@ static struct av_perm_to_string av_perm_to_string[] = { { SECCLASS_UNIX_STREAM_SOCKET, UNIX_STREAM_SOCKET__CONNECTTO, "connectto" }, { SECCLASS_UNIX_STREAM_SOCKET, UNIX_STREAM_SOCKET__NEWCONN, "newconn" }, { SECCLASS_UNIX_STREAM_SOCKET, UNIX_STREAM_SOCKET__ACCEPTFROM, "acceptfrom" }, - { SECCLASS_TCP_SOCKET, TCP_SOCKET__NODE_BIND, "node_bind" }, - { SECCLASS_UDP_SOCKET, UDP_SOCKET__NODE_BIND, "node_bind" }, - { SECCLASS_RAWIP_SOCKET, RAWIP_SOCKET__NODE_BIND, "node_bind" }, { SECCLASS_PROCESS, PROCESS__FORK, "fork" }, { SECCLASS_PROCESS, PROCESS__TRANSITION, "transition" }, { SECCLASS_PROCESS, PROCESS__SIGCHLD, "sigchld" }, @@ -121,6 +121,104 @@ static struct av_perm_to_string av_perm_to_string[] = { { SECCLASS_PASSWD, PASSWD__PASSWD, "passwd" }, { SECCLASS_PASSWD, PASSWD__CHFN, "chfn" }, { SECCLASS_PASSWD, PASSWD__CHSH, "chsh" }, + { SECCLASS_PASSWD, PASSWD__ROOTOK, "rootok" }, + { SECCLASS_DRAWABLE, DRAWABLE__CREATE, "create" }, + { SECCLASS_DRAWABLE, DRAWABLE__DESTROY, "destroy" }, + { SECCLASS_DRAWABLE, DRAWABLE__DRAW, "draw" }, + { SECCLASS_DRAWABLE, DRAWABLE__COPY, "copy" }, + { SECCLASS_DRAWABLE, DRAWABLE__GETATTR, "getattr" }, + { SECCLASS_GC, GC__CREATE, "create" }, + { SECCLASS_GC, GC__FREE, "free" }, + { SECCLASS_GC, GC__GETATTR, "getattr" }, + { SECCLASS_GC, GC__SETATTR, "setattr" }, + { SECCLASS_WINDOW, WINDOW__ADDCHILD, "addchild" }, + { SECCLASS_WINDOW, WINDOW__CREATE, "create" }, + { SECCLASS_WINDOW, WINDOW__DESTROY, "destroy" }, + { SECCLASS_WINDOW, WINDOW__MAP, "map" }, + { SECCLASS_WINDOW, WINDOW__UNMAP, "unmap" }, + { SECCLASS_WINDOW, WINDOW__CHSTACK, "chstack" }, + { SECCLASS_WINDOW, WINDOW__CHPROPLIST, "chproplist" }, + { SECCLASS_WINDOW, WINDOW__CHPROP, "chprop" }, + { SECCLASS_WINDOW, WINDOW__LISTPROP, "listprop" }, + { SECCLASS_WINDOW, WINDOW__GETATTR, "getattr" }, + { SECCLASS_WINDOW, WINDOW__SETATTR, "setattr" }, + { SECCLASS_WINDOW, WINDOW__SETFOCUS, "setfocus" }, + { SECCLASS_WINDOW, WINDOW__MOVE, "move" }, + { SECCLASS_WINDOW, WINDOW__CHSELECTION, "chselection" }, + { SECCLASS_WINDOW, WINDOW__CHPARENT, "chparent" }, + { SECCLASS_WINDOW, WINDOW__CTRLLIFE, "ctrllife" }, + { SECCLASS_WINDOW, WINDOW__ENUMERATE, "enumerate" }, + { SECCLASS_WINDOW, WINDOW__TRANSPARENT, "transparent" }, + { SECCLASS_WINDOW, WINDOW__MOUSEMOTION, "mousemotion" }, + { SECCLASS_WINDOW, WINDOW__CLIENTCOMEVENT, "clientcomevent" }, + { SECCLASS_WINDOW, WINDOW__INPUTEVENT, "inputevent" }, + { SECCLASS_WINDOW, WINDOW__DRAWEVENT, "drawevent" }, + { SECCLASS_WINDOW, WINDOW__WINDOWCHANGEEVENT, "windowchangeevent" }, + { SECCLASS_WINDOW, WINDOW__WINDOWCHANGEREQUEST, "windowchangerequest" }, + { SECCLASS_WINDOW, WINDOW__SERVERCHANGEEVENT, "serverchangeevent" }, + { SECCLASS_WINDOW, WINDOW__EXTENSIONEVENT, "extensionevent" }, + { SECCLASS_FONT, FONT__LOAD, "load" }, + { SECCLASS_FONT, FONT__FREE, "free" }, + { SECCLASS_FONT, FONT__GETATTR, "getattr" }, + { SECCLASS_FONT, FONT__USE, "use" }, + { SECCLASS_COLORMAP, COLORMAP__CREATE, "create" }, + { SECCLASS_COLORMAP, COLORMAP__FREE, "free" }, + { SECCLASS_COLORMAP, COLORMAP__INSTALL, "install" }, + { SECCLASS_COLORMAP, COLORMAP__UNINSTALL, "uninstall" }, + { SECCLASS_COLORMAP, COLORMAP__LIST, "list" }, + { SECCLASS_COLORMAP, COLORMAP__READ, "read" }, + { SECCLASS_COLORMAP, COLORMAP__STORE, "store" }, + { SECCLASS_COLORMAP, COLORMAP__GETATTR, "getattr" }, + { SECCLASS_COLORMAP, COLORMAP__SETATTR, "setattr" }, + { SECCLASS_PROPERTY, PROPERTY__CREATE, "create" }, + { SECCLASS_PROPERTY, PROPERTY__FREE, "free" }, + { SECCLASS_PROPERTY, PROPERTY__READ, "read" }, + { SECCLASS_PROPERTY, PROPERTY__WRITE, "write" }, + { SECCLASS_CURSOR, CURSOR__CREATE, "create" }, + { SECCLASS_CURSOR, CURSOR__CREATEGLYPH, "createglyph" }, + { SECCLASS_CURSOR, CURSOR__FREE, "free" }, + { SECCLASS_CURSOR, CURSOR__ASSIGN, "assign" }, + { SECCLASS_CURSOR, CURSOR__SETATTR, "setattr" }, + { SECCLASS_XCLIENT, XCLIENT__KILL, "kill" }, + { SECCLASS_XINPUT, XINPUT__LOOKUP, "lookup" }, + { SECCLASS_XINPUT, XINPUT__GETATTR, "getattr" }, + { SECCLASS_XINPUT, XINPUT__SETATTR, "setattr" }, + { SECCLASS_XINPUT, XINPUT__SETFOCUS, "setfocus" }, + { SECCLASS_XINPUT, XINPUT__WARPPOINTER, "warppointer" }, + { SECCLASS_XINPUT, XINPUT__ACTIVEGRAB, "activegrab" }, + { SECCLASS_XINPUT, XINPUT__PASSIVEGRAB, "passivegrab" }, + { SECCLASS_XINPUT, XINPUT__UNGRAB, "ungrab" }, + { SECCLASS_XINPUT, XINPUT__BELL, "bell" }, + { SECCLASS_XINPUT, XINPUT__MOUSEMOTION, "mousemotion" }, + { SECCLASS_XINPUT, XINPUT__RELABELINPUT, "relabelinput" }, + { SECCLASS_XSERVER, XSERVER__SCREENSAVER, "screensaver" }, + { SECCLASS_XSERVER, XSERVER__GETHOSTLIST, "gethostlist" }, + { SECCLASS_XSERVER, XSERVER__SETHOSTLIST, "sethostlist" }, + { SECCLASS_XSERVER, XSERVER__GETFONTPATH, "getfontpath" }, + { SECCLASS_XSERVER, XSERVER__SETFONTPATH, "setfontpath" }, + { SECCLASS_XSERVER, XSERVER__GETATTR, "getattr" }, + { SECCLASS_XSERVER, XSERVER__GRAB, "grab" }, + { SECCLASS_XSERVER, XSERVER__UNGRAB, "ungrab" }, + { SECCLASS_XEXTENSION, XEXTENSION__QUERY, "query" }, + { SECCLASS_XEXTENSION, XEXTENSION__USE, "use" }, + { SECCLASS_PAX, PAX__PAGEEXEC, "pageexec" }, + { SECCLASS_PAX, PAX__EMUTRAMP, "emutramp" }, + { SECCLASS_PAX, PAX__MPROTECT, "mprotect" }, + { SECCLASS_PAX, PAX__RANDMMAP, "randmmap" }, + { SECCLASS_PAX, PAX__RANDEXEC, "randexec" }, + { SECCLASS_PAX, PAX__SEGMEXEC, "segmexec" }, + { SECCLASS_NETLINK_ROUTE_SOCKET, NETLINK_ROUTE_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_ROUTE_SOCKET, NETLINK_ROUTE_SOCKET__NLMSG_WRITE, "nlmsg_write" }, + { SECCLASS_NETLINK_FIREWALL_SOCKET, NETLINK_FIREWALL_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_FIREWALL_SOCKET, NETLINK_FIREWALL_SOCKET__NLMSG_WRITE, "nlmsg_write" }, + { SECCLASS_NETLINK_TCPDIAG_SOCKET, NETLINK_TCPDIAG_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_TCPDIAG_SOCKET, NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE, "nlmsg_write" }, + { SECCLASS_NETLINK_XFRM_SOCKET, NETLINK_XFRM_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_XFRM_SOCKET, NETLINK_XFRM_SOCKET__NLMSG_WRITE, "nlmsg_write" }, + { SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE, "nlmsg_write" }, + { SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_READ, "nlmsg_read" }, + { SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_WRITE, "nlmsg_write" }, }; diff --git a/security/selinux/include/av_permissions.h b/security/selinux/include/av_permissions.h index 4d77e0c83..0a4c6e08f 100644 --- a/security/selinux/include/av_permissions.h +++ b/security/selinux/include/av_permissions.h @@ -63,23 +63,23 @@ #define FILESYSTEM__QUOTAMOD 0x00000100UL #define FILESYSTEM__QUOTAGET 0x00000200UL -#define DIR__EXECUTE 0x00002000UL -#define DIR__UNLINK 0x00000400UL +#define DIR__IOCTL 0x00000001UL +#define DIR__READ 0x00000002UL +#define DIR__WRITE 0x00000004UL +#define DIR__CREATE 0x00000008UL +#define DIR__GETATTR 0x00000010UL #define DIR__SETATTR 0x00000020UL -#define DIR__QUOTAON 0x00008000UL +#define DIR__LOCK 0x00000040UL #define DIR__RELABELFROM 0x00000080UL -#define DIR__LINK 0x00000800UL -#define DIR__WRITE 0x00000004UL -#define DIR__IOCTL 0x00000001UL #define DIR__RELABELTO 0x00000100UL -#define DIR__READ 0x00000002UL -#define DIR__RENAME 0x00001000UL #define DIR__APPEND 0x00000200UL -#define DIR__LOCK 0x00000040UL +#define DIR__UNLINK 0x00000400UL +#define DIR__LINK 0x00000800UL +#define DIR__RENAME 0x00001000UL +#define DIR__EXECUTE 0x00002000UL #define DIR__SWAPON 0x00004000UL -#define DIR__GETATTR 0x00000010UL +#define DIR__QUOTAON 0x00008000UL #define DIR__MOUNTON 0x00010000UL -#define DIR__CREATE 0x00000008UL #define DIR__ADD_NAME 0x00020000UL #define DIR__REMOVE_NAME 0x00040000UL @@ -87,216 +87,218 @@ #define DIR__SEARCH 0x00100000UL #define DIR__RMDIR 0x00200000UL -#define FILE__EXECUTE 0x00002000UL -#define FILE__UNLINK 0x00000400UL +#define FILE__IOCTL 0x00000001UL +#define FILE__READ 0x00000002UL +#define FILE__WRITE 0x00000004UL +#define FILE__CREATE 0x00000008UL +#define FILE__GETATTR 0x00000010UL #define FILE__SETATTR 0x00000020UL -#define FILE__QUOTAON 0x00008000UL +#define FILE__LOCK 0x00000040UL #define FILE__RELABELFROM 0x00000080UL -#define FILE__LINK 0x00000800UL -#define FILE__WRITE 0x00000004UL -#define FILE__IOCTL 0x00000001UL #define FILE__RELABELTO 0x00000100UL -#define FILE__READ 0x00000002UL -#define FILE__RENAME 0x00001000UL #define FILE__APPEND 0x00000200UL -#define FILE__LOCK 0x00000040UL +#define FILE__UNLINK 0x00000400UL +#define FILE__LINK 0x00000800UL +#define FILE__RENAME 0x00001000UL +#define FILE__EXECUTE 0x00002000UL #define FILE__SWAPON 0x00004000UL -#define FILE__GETATTR 0x00000010UL +#define FILE__QUOTAON 0x00008000UL #define FILE__MOUNTON 0x00010000UL -#define FILE__CREATE 0x00000008UL #define FILE__EXECUTE_NO_TRANS 0x00020000UL #define FILE__ENTRYPOINT 0x00040000UL -#define LNK_FILE__EXECUTE 0x00002000UL -#define LNK_FILE__UNLINK 0x00000400UL +#define LNK_FILE__IOCTL 0x00000001UL +#define LNK_FILE__READ 0x00000002UL +#define LNK_FILE__WRITE 0x00000004UL +#define LNK_FILE__CREATE 0x00000008UL +#define LNK_FILE__GETATTR 0x00000010UL #define LNK_FILE__SETATTR 0x00000020UL -#define LNK_FILE__QUOTAON 0x00008000UL +#define LNK_FILE__LOCK 0x00000040UL #define LNK_FILE__RELABELFROM 0x00000080UL -#define LNK_FILE__LINK 0x00000800UL -#define LNK_FILE__WRITE 0x00000004UL -#define LNK_FILE__IOCTL 0x00000001UL #define LNK_FILE__RELABELTO 0x00000100UL -#define LNK_FILE__READ 0x00000002UL -#define LNK_FILE__RENAME 0x00001000UL #define LNK_FILE__APPEND 0x00000200UL -#define LNK_FILE__LOCK 0x00000040UL +#define LNK_FILE__UNLINK 0x00000400UL +#define LNK_FILE__LINK 0x00000800UL +#define LNK_FILE__RENAME 0x00001000UL +#define LNK_FILE__EXECUTE 0x00002000UL #define LNK_FILE__SWAPON 0x00004000UL -#define LNK_FILE__GETATTR 0x00000010UL +#define LNK_FILE__QUOTAON 0x00008000UL #define LNK_FILE__MOUNTON 0x00010000UL -#define LNK_FILE__CREATE 0x00000008UL -#define CHR_FILE__EXECUTE 0x00002000UL -#define CHR_FILE__UNLINK 0x00000400UL +#define CHR_FILE__IOCTL 0x00000001UL +#define CHR_FILE__READ 0x00000002UL +#define CHR_FILE__WRITE 0x00000004UL +#define CHR_FILE__CREATE 0x00000008UL +#define CHR_FILE__GETATTR 0x00000010UL #define CHR_FILE__SETATTR 0x00000020UL -#define CHR_FILE__QUOTAON 0x00008000UL +#define CHR_FILE__LOCK 0x00000040UL #define CHR_FILE__RELABELFROM 0x00000080UL -#define CHR_FILE__LINK 0x00000800UL -#define CHR_FILE__WRITE 0x00000004UL -#define CHR_FILE__IOCTL 0x00000001UL #define CHR_FILE__RELABELTO 0x00000100UL -#define CHR_FILE__READ 0x00000002UL -#define CHR_FILE__RENAME 0x00001000UL #define CHR_FILE__APPEND 0x00000200UL -#define CHR_FILE__LOCK 0x00000040UL +#define CHR_FILE__UNLINK 0x00000400UL +#define CHR_FILE__LINK 0x00000800UL +#define CHR_FILE__RENAME 0x00001000UL +#define CHR_FILE__EXECUTE 0x00002000UL #define CHR_FILE__SWAPON 0x00004000UL -#define CHR_FILE__GETATTR 0x00000010UL +#define CHR_FILE__QUOTAON 0x00008000UL #define CHR_FILE__MOUNTON 0x00010000UL -#define CHR_FILE__CREATE 0x00000008UL -#define BLK_FILE__EXECUTE 0x00002000UL -#define BLK_FILE__UNLINK 0x00000400UL +#define BLK_FILE__IOCTL 0x00000001UL +#define BLK_FILE__READ 0x00000002UL +#define BLK_FILE__WRITE 0x00000004UL +#define BLK_FILE__CREATE 0x00000008UL +#define BLK_FILE__GETATTR 0x00000010UL #define BLK_FILE__SETATTR 0x00000020UL -#define BLK_FILE__QUOTAON 0x00008000UL +#define BLK_FILE__LOCK 0x00000040UL #define BLK_FILE__RELABELFROM 0x00000080UL -#define BLK_FILE__LINK 0x00000800UL -#define BLK_FILE__WRITE 0x00000004UL -#define BLK_FILE__IOCTL 0x00000001UL #define BLK_FILE__RELABELTO 0x00000100UL -#define BLK_FILE__READ 0x00000002UL -#define BLK_FILE__RENAME 0x00001000UL #define BLK_FILE__APPEND 0x00000200UL -#define BLK_FILE__LOCK 0x00000040UL +#define BLK_FILE__UNLINK 0x00000400UL +#define BLK_FILE__LINK 0x00000800UL +#define BLK_FILE__RENAME 0x00001000UL +#define BLK_FILE__EXECUTE 0x00002000UL #define BLK_FILE__SWAPON 0x00004000UL -#define BLK_FILE__GETATTR 0x00000010UL +#define BLK_FILE__QUOTAON 0x00008000UL #define BLK_FILE__MOUNTON 0x00010000UL -#define BLK_FILE__CREATE 0x00000008UL -#define SOCK_FILE__EXECUTE 0x00002000UL -#define SOCK_FILE__UNLINK 0x00000400UL +#define SOCK_FILE__IOCTL 0x00000001UL +#define SOCK_FILE__READ 0x00000002UL +#define SOCK_FILE__WRITE 0x00000004UL +#define SOCK_FILE__CREATE 0x00000008UL +#define SOCK_FILE__GETATTR 0x00000010UL #define SOCK_FILE__SETATTR 0x00000020UL -#define SOCK_FILE__QUOTAON 0x00008000UL +#define SOCK_FILE__LOCK 0x00000040UL #define SOCK_FILE__RELABELFROM 0x00000080UL -#define SOCK_FILE__LINK 0x00000800UL -#define SOCK_FILE__WRITE 0x00000004UL -#define SOCK_FILE__IOCTL 0x00000001UL #define SOCK_FILE__RELABELTO 0x00000100UL -#define SOCK_FILE__READ 0x00000002UL -#define SOCK_FILE__RENAME 0x00001000UL #define SOCK_FILE__APPEND 0x00000200UL -#define SOCK_FILE__LOCK 0x00000040UL +#define SOCK_FILE__UNLINK 0x00000400UL +#define SOCK_FILE__LINK 0x00000800UL +#define SOCK_FILE__RENAME 0x00001000UL +#define SOCK_FILE__EXECUTE 0x00002000UL #define SOCK_FILE__SWAPON 0x00004000UL -#define SOCK_FILE__GETATTR 0x00000010UL +#define SOCK_FILE__QUOTAON 0x00008000UL #define SOCK_FILE__MOUNTON 0x00010000UL -#define SOCK_FILE__CREATE 0x00000008UL -#define FIFO_FILE__EXECUTE 0x00002000UL -#define FIFO_FILE__UNLINK 0x00000400UL +#define FIFO_FILE__IOCTL 0x00000001UL +#define FIFO_FILE__READ 0x00000002UL +#define FIFO_FILE__WRITE 0x00000004UL +#define FIFO_FILE__CREATE 0x00000008UL +#define FIFO_FILE__GETATTR 0x00000010UL #define FIFO_FILE__SETATTR 0x00000020UL -#define FIFO_FILE__QUOTAON 0x00008000UL +#define FIFO_FILE__LOCK 0x00000040UL #define FIFO_FILE__RELABELFROM 0x00000080UL -#define FIFO_FILE__LINK 0x00000800UL -#define FIFO_FILE__WRITE 0x00000004UL -#define FIFO_FILE__IOCTL 0x00000001UL #define FIFO_FILE__RELABELTO 0x00000100UL -#define FIFO_FILE__READ 0x00000002UL -#define FIFO_FILE__RENAME 0x00001000UL #define FIFO_FILE__APPEND 0x00000200UL -#define FIFO_FILE__LOCK 0x00000040UL +#define FIFO_FILE__UNLINK 0x00000400UL +#define FIFO_FILE__LINK 0x00000800UL +#define FIFO_FILE__RENAME 0x00001000UL +#define FIFO_FILE__EXECUTE 0x00002000UL #define FIFO_FILE__SWAPON 0x00004000UL -#define FIFO_FILE__GETATTR 0x00000010UL +#define FIFO_FILE__QUOTAON 0x00008000UL #define FIFO_FILE__MOUNTON 0x00010000UL -#define FIFO_FILE__CREATE 0x00000008UL #define FD__USE 0x00000001UL -#define SOCKET__RELABELTO 0x00000100UL -#define SOCKET__RECV_MSG 0x00080000UL +#define SOCKET__IOCTL 0x00000001UL +#define SOCKET__READ 0x00000002UL +#define SOCKET__WRITE 0x00000004UL +#define SOCKET__CREATE 0x00000008UL +#define SOCKET__GETATTR 0x00000010UL +#define SOCKET__SETATTR 0x00000020UL +#define SOCKET__LOCK 0x00000040UL #define SOCKET__RELABELFROM 0x00000080UL -#define SOCKET__SETOPT 0x00008000UL +#define SOCKET__RELABELTO 0x00000100UL #define SOCKET__APPEND 0x00000200UL -#define SOCKET__SETATTR 0x00000020UL -#define SOCKET__SENDTO 0x00040000UL -#define SOCKET__GETOPT 0x00004000UL -#define SOCKET__READ 0x00000002UL -#define SOCKET__SHUTDOWN 0x00010000UL -#define SOCKET__LISTEN 0x00001000UL #define SOCKET__BIND 0x00000400UL -#define SOCKET__WRITE 0x00000004UL -#define SOCKET__ACCEPT 0x00002000UL #define SOCKET__CONNECT 0x00000800UL -#define SOCKET__LOCK 0x00000040UL -#define SOCKET__IOCTL 0x00000001UL -#define SOCKET__CREATE 0x00000008UL -#define SOCKET__NAME_BIND 0x00200000UL -#define SOCKET__SEND_MSG 0x00100000UL +#define SOCKET__LISTEN 0x00001000UL +#define SOCKET__ACCEPT 0x00002000UL +#define SOCKET__GETOPT 0x00004000UL +#define SOCKET__SETOPT 0x00008000UL +#define SOCKET__SHUTDOWN 0x00010000UL #define SOCKET__RECVFROM 0x00020000UL -#define SOCKET__GETATTR 0x00000010UL +#define SOCKET__SENDTO 0x00040000UL +#define SOCKET__RECV_MSG 0x00080000UL +#define SOCKET__SEND_MSG 0x00100000UL +#define SOCKET__NAME_BIND 0x00200000UL -#define TCP_SOCKET__RELABELTO 0x00000100UL -#define TCP_SOCKET__RECV_MSG 0x00080000UL +#define TCP_SOCKET__IOCTL 0x00000001UL +#define TCP_SOCKET__READ 0x00000002UL +#define TCP_SOCKET__WRITE 0x00000004UL +#define TCP_SOCKET__CREATE 0x00000008UL +#define TCP_SOCKET__GETATTR 0x00000010UL +#define TCP_SOCKET__SETATTR 0x00000020UL +#define TCP_SOCKET__LOCK 0x00000040UL #define TCP_SOCKET__RELABELFROM 0x00000080UL -#define TCP_SOCKET__SETOPT 0x00008000UL +#define TCP_SOCKET__RELABELTO 0x00000100UL #define TCP_SOCKET__APPEND 0x00000200UL -#define TCP_SOCKET__SETATTR 0x00000020UL -#define TCP_SOCKET__SENDTO 0x00040000UL -#define TCP_SOCKET__GETOPT 0x00004000UL -#define TCP_SOCKET__READ 0x00000002UL -#define TCP_SOCKET__SHUTDOWN 0x00010000UL -#define TCP_SOCKET__LISTEN 0x00001000UL #define TCP_SOCKET__BIND 0x00000400UL -#define TCP_SOCKET__WRITE 0x00000004UL -#define TCP_SOCKET__ACCEPT 0x00002000UL #define TCP_SOCKET__CONNECT 0x00000800UL -#define TCP_SOCKET__LOCK 0x00000040UL -#define TCP_SOCKET__IOCTL 0x00000001UL -#define TCP_SOCKET__CREATE 0x00000008UL -#define TCP_SOCKET__NAME_BIND 0x00200000UL -#define TCP_SOCKET__SEND_MSG 0x00100000UL +#define TCP_SOCKET__LISTEN 0x00001000UL +#define TCP_SOCKET__ACCEPT 0x00002000UL +#define TCP_SOCKET__GETOPT 0x00004000UL +#define TCP_SOCKET__SETOPT 0x00008000UL +#define TCP_SOCKET__SHUTDOWN 0x00010000UL #define TCP_SOCKET__RECVFROM 0x00020000UL -#define TCP_SOCKET__GETATTR 0x00000010UL +#define TCP_SOCKET__SENDTO 0x00040000UL +#define TCP_SOCKET__RECV_MSG 0x00080000UL +#define TCP_SOCKET__SEND_MSG 0x00100000UL +#define TCP_SOCKET__NAME_BIND 0x00200000UL #define TCP_SOCKET__CONNECTTO 0x00400000UL #define TCP_SOCKET__NEWCONN 0x00800000UL #define TCP_SOCKET__ACCEPTFROM 0x01000000UL #define TCP_SOCKET__NODE_BIND 0x02000000UL -#define UDP_SOCKET__RELABELTO 0x00000100UL -#define UDP_SOCKET__RECV_MSG 0x00080000UL +#define UDP_SOCKET__IOCTL 0x00000001UL +#define UDP_SOCKET__READ 0x00000002UL +#define UDP_SOCKET__WRITE 0x00000004UL +#define UDP_SOCKET__CREATE 0x00000008UL +#define UDP_SOCKET__GETATTR 0x00000010UL +#define UDP_SOCKET__SETATTR 0x00000020UL +#define UDP_SOCKET__LOCK 0x00000040UL #define UDP_SOCKET__RELABELFROM 0x00000080UL -#define UDP_SOCKET__SETOPT 0x00008000UL +#define UDP_SOCKET__RELABELTO 0x00000100UL #define UDP_SOCKET__APPEND 0x00000200UL -#define UDP_SOCKET__SETATTR 0x00000020UL -#define UDP_SOCKET__SENDTO 0x00040000UL -#define UDP_SOCKET__GETOPT 0x00004000UL -#define UDP_SOCKET__READ 0x00000002UL -#define UDP_SOCKET__SHUTDOWN 0x00010000UL -#define UDP_SOCKET__LISTEN 0x00001000UL #define UDP_SOCKET__BIND 0x00000400UL -#define UDP_SOCKET__WRITE 0x00000004UL -#define UDP_SOCKET__ACCEPT 0x00002000UL #define UDP_SOCKET__CONNECT 0x00000800UL -#define UDP_SOCKET__LOCK 0x00000040UL -#define UDP_SOCKET__IOCTL 0x00000001UL -#define UDP_SOCKET__CREATE 0x00000008UL -#define UDP_SOCKET__NAME_BIND 0x00200000UL -#define UDP_SOCKET__SEND_MSG 0x00100000UL +#define UDP_SOCKET__LISTEN 0x00001000UL +#define UDP_SOCKET__ACCEPT 0x00002000UL +#define UDP_SOCKET__GETOPT 0x00004000UL +#define UDP_SOCKET__SETOPT 0x00008000UL +#define UDP_SOCKET__SHUTDOWN 0x00010000UL #define UDP_SOCKET__RECVFROM 0x00020000UL -#define UDP_SOCKET__GETATTR 0x00000010UL +#define UDP_SOCKET__SENDTO 0x00040000UL +#define UDP_SOCKET__RECV_MSG 0x00080000UL +#define UDP_SOCKET__SEND_MSG 0x00100000UL +#define UDP_SOCKET__NAME_BIND 0x00200000UL + #define UDP_SOCKET__NODE_BIND 0x00400000UL -#define RAWIP_SOCKET__RELABELTO 0x00000100UL -#define RAWIP_SOCKET__RECV_MSG 0x00080000UL +#define RAWIP_SOCKET__IOCTL 0x00000001UL +#define RAWIP_SOCKET__READ 0x00000002UL +#define RAWIP_SOCKET__WRITE 0x00000004UL +#define RAWIP_SOCKET__CREATE 0x00000008UL +#define RAWIP_SOCKET__GETATTR 0x00000010UL +#define RAWIP_SOCKET__SETATTR 0x00000020UL +#define RAWIP_SOCKET__LOCK 0x00000040UL #define RAWIP_SOCKET__RELABELFROM 0x00000080UL -#define RAWIP_SOCKET__SETOPT 0x00008000UL +#define RAWIP_SOCKET__RELABELTO 0x00000100UL #define RAWIP_SOCKET__APPEND 0x00000200UL -#define RAWIP_SOCKET__SETATTR 0x00000020UL -#define RAWIP_SOCKET__SENDTO 0x00040000UL -#define RAWIP_SOCKET__GETOPT 0x00004000UL -#define RAWIP_SOCKET__READ 0x00000002UL -#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL -#define RAWIP_SOCKET__LISTEN 0x00001000UL #define RAWIP_SOCKET__BIND 0x00000400UL -#define RAWIP_SOCKET__WRITE 0x00000004UL -#define RAWIP_SOCKET__ACCEPT 0x00002000UL #define RAWIP_SOCKET__CONNECT 0x00000800UL -#define RAWIP_SOCKET__LOCK 0x00000040UL -#define RAWIP_SOCKET__IOCTL 0x00000001UL -#define RAWIP_SOCKET__CREATE 0x00000008UL -#define RAWIP_SOCKET__NAME_BIND 0x00200000UL -#define RAWIP_SOCKET__SEND_MSG 0x00100000UL +#define RAWIP_SOCKET__LISTEN 0x00001000UL +#define RAWIP_SOCKET__ACCEPT 0x00002000UL +#define RAWIP_SOCKET__GETOPT 0x00004000UL +#define RAWIP_SOCKET__SETOPT 0x00008000UL +#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL #define RAWIP_SOCKET__RECVFROM 0x00020000UL -#define RAWIP_SOCKET__GETATTR 0x00000010UL +#define RAWIP_SOCKET__SENDTO 0x00040000UL +#define RAWIP_SOCKET__RECV_MSG 0x00080000UL +#define RAWIP_SOCKET__SEND_MSG 0x00100000UL +#define RAWIP_SOCKET__NAME_BIND 0x00200000UL + #define RAWIP_SOCKET__NODE_BIND 0x00400000UL #define NODE__TCP_RECV 0x00000001UL @@ -314,124 +316,124 @@ #define NETIF__RAWIP_RECV 0x00000010UL #define NETIF__RAWIP_SEND 0x00000020UL -#define NETLINK_SOCKET__RELABELTO 0x00000100UL -#define NETLINK_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_SOCKET__IOCTL 0x00000001UL +#define NETLINK_SOCKET__READ 0x00000002UL +#define NETLINK_SOCKET__WRITE 0x00000004UL +#define NETLINK_SOCKET__CREATE 0x00000008UL +#define NETLINK_SOCKET__GETATTR 0x00000010UL +#define NETLINK_SOCKET__SETATTR 0x00000020UL +#define NETLINK_SOCKET__LOCK 0x00000040UL #define NETLINK_SOCKET__RELABELFROM 0x00000080UL -#define NETLINK_SOCKET__SETOPT 0x00008000UL +#define NETLINK_SOCKET__RELABELTO 0x00000100UL #define NETLINK_SOCKET__APPEND 0x00000200UL -#define NETLINK_SOCKET__SETATTR 0x00000020UL -#define NETLINK_SOCKET__SENDTO 0x00040000UL -#define NETLINK_SOCKET__GETOPT 0x00004000UL -#define NETLINK_SOCKET__READ 0x00000002UL -#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL -#define NETLINK_SOCKET__LISTEN 0x00001000UL #define NETLINK_SOCKET__BIND 0x00000400UL -#define NETLINK_SOCKET__WRITE 0x00000004UL -#define NETLINK_SOCKET__ACCEPT 0x00002000UL #define NETLINK_SOCKET__CONNECT 0x00000800UL -#define NETLINK_SOCKET__LOCK 0x00000040UL -#define NETLINK_SOCKET__IOCTL 0x00000001UL -#define NETLINK_SOCKET__CREATE 0x00000008UL -#define NETLINK_SOCKET__NAME_BIND 0x00200000UL -#define NETLINK_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_SOCKET__LISTEN 0x00001000UL +#define NETLINK_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_SOCKET__GETOPT 0x00004000UL +#define NETLINK_SOCKET__SETOPT 0x00008000UL +#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL #define NETLINK_SOCKET__RECVFROM 0x00020000UL -#define NETLINK_SOCKET__GETATTR 0x00000010UL +#define NETLINK_SOCKET__SENDTO 0x00040000UL +#define NETLINK_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_SOCKET__NAME_BIND 0x00200000UL -#define PACKET_SOCKET__RELABELTO 0x00000100UL -#define PACKET_SOCKET__RECV_MSG 0x00080000UL +#define PACKET_SOCKET__IOCTL 0x00000001UL +#define PACKET_SOCKET__READ 0x00000002UL +#define PACKET_SOCKET__WRITE 0x00000004UL +#define PACKET_SOCKET__CREATE 0x00000008UL +#define PACKET_SOCKET__GETATTR 0x00000010UL +#define PACKET_SOCKET__SETATTR 0x00000020UL +#define PACKET_SOCKET__LOCK 0x00000040UL #define PACKET_SOCKET__RELABELFROM 0x00000080UL -#define PACKET_SOCKET__SETOPT 0x00008000UL +#define PACKET_SOCKET__RELABELTO 0x00000100UL #define PACKET_SOCKET__APPEND 0x00000200UL -#define PACKET_SOCKET__SETATTR 0x00000020UL -#define PACKET_SOCKET__SENDTO 0x00040000UL -#define PACKET_SOCKET__GETOPT 0x00004000UL -#define PACKET_SOCKET__READ 0x00000002UL -#define PACKET_SOCKET__SHUTDOWN 0x00010000UL -#define PACKET_SOCKET__LISTEN 0x00001000UL #define PACKET_SOCKET__BIND 0x00000400UL -#define PACKET_SOCKET__WRITE 0x00000004UL -#define PACKET_SOCKET__ACCEPT 0x00002000UL #define PACKET_SOCKET__CONNECT 0x00000800UL -#define PACKET_SOCKET__LOCK 0x00000040UL -#define PACKET_SOCKET__IOCTL 0x00000001UL -#define PACKET_SOCKET__CREATE 0x00000008UL -#define PACKET_SOCKET__NAME_BIND 0x00200000UL -#define PACKET_SOCKET__SEND_MSG 0x00100000UL +#define PACKET_SOCKET__LISTEN 0x00001000UL +#define PACKET_SOCKET__ACCEPT 0x00002000UL +#define PACKET_SOCKET__GETOPT 0x00004000UL +#define PACKET_SOCKET__SETOPT 0x00008000UL +#define PACKET_SOCKET__SHUTDOWN 0x00010000UL #define PACKET_SOCKET__RECVFROM 0x00020000UL -#define PACKET_SOCKET__GETATTR 0x00000010UL +#define PACKET_SOCKET__SENDTO 0x00040000UL +#define PACKET_SOCKET__RECV_MSG 0x00080000UL +#define PACKET_SOCKET__SEND_MSG 0x00100000UL +#define PACKET_SOCKET__NAME_BIND 0x00200000UL -#define KEY_SOCKET__RELABELTO 0x00000100UL -#define KEY_SOCKET__RECV_MSG 0x00080000UL +#define KEY_SOCKET__IOCTL 0x00000001UL +#define KEY_SOCKET__READ 0x00000002UL +#define KEY_SOCKET__WRITE 0x00000004UL +#define KEY_SOCKET__CREATE 0x00000008UL +#define KEY_SOCKET__GETATTR 0x00000010UL +#define KEY_SOCKET__SETATTR 0x00000020UL +#define KEY_SOCKET__LOCK 0x00000040UL #define KEY_SOCKET__RELABELFROM 0x00000080UL -#define KEY_SOCKET__SETOPT 0x00008000UL +#define KEY_SOCKET__RELABELTO 0x00000100UL #define KEY_SOCKET__APPEND 0x00000200UL -#define KEY_SOCKET__SETATTR 0x00000020UL -#define KEY_SOCKET__SENDTO 0x00040000UL -#define KEY_SOCKET__GETOPT 0x00004000UL -#define KEY_SOCKET__READ 0x00000002UL -#define KEY_SOCKET__SHUTDOWN 0x00010000UL -#define KEY_SOCKET__LISTEN 0x00001000UL #define KEY_SOCKET__BIND 0x00000400UL -#define KEY_SOCKET__WRITE 0x00000004UL -#define KEY_SOCKET__ACCEPT 0x00002000UL #define KEY_SOCKET__CONNECT 0x00000800UL -#define KEY_SOCKET__LOCK 0x00000040UL -#define KEY_SOCKET__IOCTL 0x00000001UL -#define KEY_SOCKET__CREATE 0x00000008UL -#define KEY_SOCKET__NAME_BIND 0x00200000UL -#define KEY_SOCKET__SEND_MSG 0x00100000UL +#define KEY_SOCKET__LISTEN 0x00001000UL +#define KEY_SOCKET__ACCEPT 0x00002000UL +#define KEY_SOCKET__GETOPT 0x00004000UL +#define KEY_SOCKET__SETOPT 0x00008000UL +#define KEY_SOCKET__SHUTDOWN 0x00010000UL #define KEY_SOCKET__RECVFROM 0x00020000UL -#define KEY_SOCKET__GETATTR 0x00000010UL +#define KEY_SOCKET__SENDTO 0x00040000UL +#define KEY_SOCKET__RECV_MSG 0x00080000UL +#define KEY_SOCKET__SEND_MSG 0x00100000UL +#define KEY_SOCKET__NAME_BIND 0x00200000UL -#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL -#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL +#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL +#define UNIX_STREAM_SOCKET__READ 0x00000002UL +#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL +#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL +#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL +#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL +#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL #define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL -#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL +#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_STREAM_SOCKET__APPEND 0x00000200UL -#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL -#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL -#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL -#define UNIX_STREAM_SOCKET__READ 0x00000002UL -#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL -#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL #define UNIX_STREAM_SOCKET__BIND 0x00000400UL -#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL -#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL -#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL -#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL -#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL -#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL -#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL +#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL +#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL +#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL +#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL +#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL -#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL +#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL +#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL +#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL +#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL #define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL #define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL #define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL -#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL -#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL +#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL +#define UNIX_DGRAM_SOCKET__READ 0x00000002UL +#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL +#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL +#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL +#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL +#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL #define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL -#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL +#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL #define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL -#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL -#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL -#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL -#define UNIX_DGRAM_SOCKET__READ 0x00000002UL -#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL -#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL #define UNIX_DGRAM_SOCKET__BIND 0x00000400UL -#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL -#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL #define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL -#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL -#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL -#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL -#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL -#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL +#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL +#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL +#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL +#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL +#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL #define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL -#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL +#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL +#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL +#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL +#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL #define PROCESS__FORK 0x00000001UL #define PROCESS__TRANSITION 0x00000002UL @@ -457,50 +459,50 @@ #define PROCESS__SETRLIMIT 0x00200000UL #define PROCESS__RLIMITINH 0x00400000UL +#define IPC__CREATE 0x00000001UL +#define IPC__DESTROY 0x00000002UL +#define IPC__GETATTR 0x00000004UL #define IPC__SETATTR 0x00000008UL #define IPC__READ 0x00000010UL +#define IPC__WRITE 0x00000020UL #define IPC__ASSOCIATE 0x00000040UL -#define IPC__DESTROY 0x00000002UL -#define IPC__UNIX_WRITE 0x00000100UL -#define IPC__CREATE 0x00000001UL #define IPC__UNIX_READ 0x00000080UL -#define IPC__GETATTR 0x00000004UL -#define IPC__WRITE 0x00000020UL +#define IPC__UNIX_WRITE 0x00000100UL +#define SEM__CREATE 0x00000001UL +#define SEM__DESTROY 0x00000002UL +#define SEM__GETATTR 0x00000004UL #define SEM__SETATTR 0x00000008UL #define SEM__READ 0x00000010UL +#define SEM__WRITE 0x00000020UL #define SEM__ASSOCIATE 0x00000040UL -#define SEM__DESTROY 0x00000002UL -#define SEM__UNIX_WRITE 0x00000100UL -#define SEM__CREATE 0x00000001UL #define SEM__UNIX_READ 0x00000080UL -#define SEM__GETATTR 0x00000004UL -#define SEM__WRITE 0x00000020UL +#define SEM__UNIX_WRITE 0x00000100UL +#define MSGQ__CREATE 0x00000001UL +#define MSGQ__DESTROY 0x00000002UL +#define MSGQ__GETATTR 0x00000004UL #define MSGQ__SETATTR 0x00000008UL #define MSGQ__READ 0x00000010UL +#define MSGQ__WRITE 0x00000020UL #define MSGQ__ASSOCIATE 0x00000040UL -#define MSGQ__DESTROY 0x00000002UL -#define MSGQ__UNIX_WRITE 0x00000100UL -#define MSGQ__CREATE 0x00000001UL #define MSGQ__UNIX_READ 0x00000080UL -#define MSGQ__GETATTR 0x00000004UL -#define MSGQ__WRITE 0x00000020UL +#define MSGQ__UNIX_WRITE 0x00000100UL #define MSGQ__ENQUEUE 0x00000200UL #define MSG__SEND 0x00000001UL #define MSG__RECEIVE 0x00000002UL +#define SHM__CREATE 0x00000001UL +#define SHM__DESTROY 0x00000002UL +#define SHM__GETATTR 0x00000004UL #define SHM__SETATTR 0x00000008UL #define SHM__READ 0x00000010UL +#define SHM__WRITE 0x00000020UL #define SHM__ASSOCIATE 0x00000040UL -#define SHM__DESTROY 0x00000002UL -#define SHM__UNIX_WRITE 0x00000100UL -#define SHM__CREATE 0x00000001UL #define SHM__UNIX_READ 0x00000080UL -#define SHM__GETATTR 0x00000004UL -#define SHM__WRITE 0x00000020UL +#define SHM__UNIX_WRITE 0x00000100UL #define SHM__LOCK 0x00000200UL @@ -552,6 +554,327 @@ #define PASSWD__PASSWD 0x00000001UL #define PASSWD__CHFN 0x00000002UL #define PASSWD__CHSH 0x00000004UL - +#define PASSWD__ROOTOK 0x00000008UL + +#define DRAWABLE__CREATE 0x00000001UL +#define DRAWABLE__DESTROY 0x00000002UL +#define DRAWABLE__DRAW 0x00000004UL +#define DRAWABLE__COPY 0x00000008UL +#define DRAWABLE__GETATTR 0x00000010UL + +#define GC__CREATE 0x00000001UL +#define GC__FREE 0x00000002UL +#define GC__GETATTR 0x00000004UL +#define GC__SETATTR 0x00000008UL + +#define WINDOW__ADDCHILD 0x00000001UL +#define WINDOW__CREATE 0x00000002UL +#define WINDOW__DESTROY 0x00000004UL +#define WINDOW__MAP 0x00000008UL +#define WINDOW__UNMAP 0x00000010UL +#define WINDOW__CHSTACK 0x00000020UL +#define WINDOW__CHPROPLIST 0x00000040UL +#define WINDOW__CHPROP 0x00000080UL +#define WINDOW__LISTPROP 0x00000100UL +#define WINDOW__GETATTR 0x00000200UL +#define WINDOW__SETATTR 0x00000400UL +#define WINDOW__SETFOCUS 0x00000800UL +#define WINDOW__MOVE 0x00001000UL +#define WINDOW__CHSELECTION 0x00002000UL +#define WINDOW__CHPARENT 0x00004000UL +#define WINDOW__CTRLLIFE 0x00008000UL +#define WINDOW__ENUMERATE 0x00010000UL +#define WINDOW__TRANSPARENT 0x00020000UL +#define WINDOW__MOUSEMOTION 0x00040000UL +#define WINDOW__CLIENTCOMEVENT 0x00080000UL +#define WINDOW__INPUTEVENT 0x00100000UL +#define WINDOW__DRAWEVENT 0x00200000UL +#define WINDOW__WINDOWCHANGEEVENT 0x00400000UL +#define WINDOW__WINDOWCHANGEREQUEST 0x00800000UL +#define WINDOW__SERVERCHANGEEVENT 0x01000000UL +#define WINDOW__EXTENSIONEVENT 0x02000000UL + +#define FONT__LOAD 0x00000001UL +#define FONT__FREE 0x00000002UL +#define FONT__GETATTR 0x00000004UL +#define FONT__USE 0x00000008UL + +#define COLORMAP__CREATE 0x00000001UL +#define COLORMAP__FREE 0x00000002UL +#define COLORMAP__INSTALL 0x00000004UL +#define COLORMAP__UNINSTALL 0x00000008UL +#define COLORMAP__LIST 0x00000010UL +#define COLORMAP__READ 0x00000020UL +#define COLORMAP__STORE 0x00000040UL +#define COLORMAP__GETATTR 0x00000080UL +#define COLORMAP__SETATTR 0x00000100UL + +#define PROPERTY__CREATE 0x00000001UL +#define PROPERTY__FREE 0x00000002UL +#define PROPERTY__READ 0x00000004UL +#define PROPERTY__WRITE 0x00000008UL + +#define CURSOR__CREATE 0x00000001UL +#define CURSOR__CREATEGLYPH 0x00000002UL +#define CURSOR__FREE 0x00000004UL +#define CURSOR__ASSIGN 0x00000008UL +#define CURSOR__SETATTR 0x00000010UL + +#define XCLIENT__KILL 0x00000001UL + +#define XINPUT__LOOKUP 0x00000001UL +#define XINPUT__GETATTR 0x00000002UL +#define XINPUT__SETATTR 0x00000004UL +#define XINPUT__SETFOCUS 0x00000008UL +#define XINPUT__WARPPOINTER 0x00000010UL +#define XINPUT__ACTIVEGRAB 0x00000020UL +#define XINPUT__PASSIVEGRAB 0x00000040UL +#define XINPUT__UNGRAB 0x00000080UL +#define XINPUT__BELL 0x00000100UL +#define XINPUT__MOUSEMOTION 0x00000200UL +#define XINPUT__RELABELINPUT 0x00000400UL + +#define XSERVER__SCREENSAVER 0x00000001UL +#define XSERVER__GETHOSTLIST 0x00000002UL +#define XSERVER__SETHOSTLIST 0x00000004UL +#define XSERVER__GETFONTPATH 0x00000008UL +#define XSERVER__SETFONTPATH 0x00000010UL +#define XSERVER__GETATTR 0x00000020UL +#define XSERVER__GRAB 0x00000040UL +#define XSERVER__UNGRAB 0x00000080UL + +#define XEXTENSION__QUERY 0x00000001UL +#define XEXTENSION__USE 0x00000002UL + +#define PAX__PAGEEXEC 0x00000001UL +#define PAX__EMUTRAMP 0x00000002UL +#define PAX__MPROTECT 0x00000004UL +#define PAX__RANDMMAP 0x00000008UL +#define PAX__RANDEXEC 0x00000010UL +#define PAX__SEGMEXEC 0x00000020UL + +#define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL +#define NETLINK_ROUTE_SOCKET__READ 0x00000002UL +#define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL +#define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL +#define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL +#define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL +#define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL +#define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL +#define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL +#define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL +#define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL +#define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL +#define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL +#define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL +#define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL +#define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL +#define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL +#define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL +#define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL +#define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL +#define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL +#define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL +#define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL +#define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL +#define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL +#define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL +#define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL +#define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL +#define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL +#define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL +#define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL +#define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL +#define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL +#define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL +#define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL +#define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL +#define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL +#define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL +#define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL +#define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL +#define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL +#define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL +#define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL +#define NETLINK_NFLOG_SOCKET__READ 0x00000002UL +#define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL +#define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL +#define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL +#define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL +#define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL +#define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL +#define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL +#define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL +#define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL +#define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL +#define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL +#define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL +#define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL +#define NETLINK_XFRM_SOCKET__READ 0x00000002UL +#define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL +#define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL +#define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL +#define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL +#define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL +#define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL +#define NETLINK_XFRM_SOCKET__BIND 0x00000400UL +#define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL +#define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL +#define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL +#define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL +#define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL +#define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL +#define NETLINK_SELINUX_SOCKET__READ 0x00000002UL +#define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL +#define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL +#define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL +#define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL +#define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL +#define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL +#define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL +#define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL +#define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL +#define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL +#define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL +#define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL +#define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL +#define NETLINK_AUDIT_SOCKET__READ 0x00000002UL +#define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL +#define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL +#define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL +#define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL +#define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL +#define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL +#define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL +#define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL +#define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL +#define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL +#define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL +#define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL +#define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL +#define NETLINK_IP6FW_SOCKET__READ 0x00000002UL +#define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL +#define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL +#define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL +#define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL +#define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL +#define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL +#define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL +#define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL +#define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL +#define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL +#define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL +#define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL +#define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL +#define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL + +#define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL +#define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL + +#define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL +#define NETLINK_DNRT_SOCKET__READ 0x00000002UL +#define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL +#define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL +#define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL +#define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL +#define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL +#define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL +#define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL +#define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL +#define NETLINK_DNRT_SOCKET__BIND 0x00000400UL +#define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL +#define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL +#define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL +#define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL +#define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL +#define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL +#define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL +#define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL +#define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL +#define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL /* FLASK */ diff --git a/security/selinux/include/class_to_string.h b/security/selinux/include/class_to_string.h index ce33ff3e6..a65e25eb6 100644 --- a/security/selinux/include/class_to_string.h +++ b/security/selinux/include/class_to_string.h @@ -35,5 +35,26 @@ static char *class_to_string[] = "shm", "ipc", "passwd", + "drawable", + "window", + "gc", + "font", + "colormap", + "property", + "cursor", + "xclient", + "xinput", + "xserver", + "xextension", + "pax", + "netlink_route_socket", + "netlink_firewall_socket", + "netlink_tcpdiag_socket", + "netlink_nflog_socket", + "netlink_xfrm_socket", + "netlink_selinux_socket", + "netlink_audit_socket", + "netlink_ip6fw_socket", + "netlink_dnrt_socket", }; diff --git a/security/selinux/include/flask.h b/security/selinux/include/flask.h index 6425c7869..a392a3d06 100644 --- a/security/selinux/include/flask.h +++ b/security/selinux/include/flask.h @@ -35,6 +35,27 @@ #define SECCLASS_SHM 28 #define SECCLASS_IPC 29 #define SECCLASS_PASSWD 30 +#define SECCLASS_DRAWABLE 31 +#define SECCLASS_WINDOW 32 +#define SECCLASS_GC 33 +#define SECCLASS_FONT 34 +#define SECCLASS_COLORMAP 35 +#define SECCLASS_PROPERTY 36 +#define SECCLASS_CURSOR 37 +#define SECCLASS_XCLIENT 38 +#define SECCLASS_XINPUT 39 +#define SECCLASS_XSERVER 40 +#define SECCLASS_XEXTENSION 41 +#define SECCLASS_PAX 42 +#define SECCLASS_NETLINK_ROUTE_SOCKET 43 +#define SECCLASS_NETLINK_FIREWALL_SOCKET 44 +#define SECCLASS_NETLINK_TCPDIAG_SOCKET 45 +#define SECCLASS_NETLINK_NFLOG_SOCKET 46 +#define SECCLASS_NETLINK_XFRM_SOCKET 47 +#define SECCLASS_NETLINK_SELINUX_SOCKET 48 +#define SECCLASS_NETLINK_AUDIT_SOCKET 49 +#define SECCLASS_NETLINK_IP6FW_SOCKET 50 +#define SECCLASS_NETLINK_DNRT_SOCKET 51 /* * Security identifier indices for initial entities diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 0413683ac..5931e46d4 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h @@ -17,13 +17,14 @@ #define SELINUX_MAGIC 0xf97cff8c /* Identify specific policy version changes */ -#define POLICYDB_VERSION_BASE 15 -#define POLICYDB_VERSION_BOOL 16 -#define POLICYDB_VERSION_IPV6 17 +#define POLICYDB_VERSION_BASE 15 +#define POLICYDB_VERSION_BOOL 16 +#define POLICYDB_VERSION_IPV6 17 +#define POLICYDB_VERSION_NLCLASS 18 /* Range of policy versions we understand*/ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE -#define POLICYDB_VERSION_MAX POLICYDB_VERSION_IPV6 +#define POLICYDB_VERSION_MAX POLICYDB_VERSION_NLCLASS #ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM extern int selinux_enabled; diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 274275a61..975a17708 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -68,7 +68,7 @@ enum sel_inos { SEL_DISABLE /* disable SELinux until next reboot */ }; -static ssize_t sel_read_enforce(struct file *filp, char *buf, +static ssize_t sel_read_enforce(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -105,7 +105,7 @@ out: } #ifdef CONFIG_SECURITY_SELINUX_DEVELOP -static ssize_t sel_write_enforce(struct file * file, const char * buf, +static ssize_t sel_write_enforce(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -155,7 +155,7 @@ static struct file_operations sel_enforce_ops = { }; #ifdef CONFIG_SECURITY_SELINUX_DISABLE -static ssize_t sel_write_disable(struct file * file, const char * buf, +static ssize_t sel_write_disable(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -201,7 +201,7 @@ static struct file_operations sel_disable_ops = { .write = sel_write_disable, }; -static ssize_t sel_read_policyvers(struct file *filp, char *buf, +static ssize_t sel_read_policyvers(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -244,7 +244,7 @@ static struct file_operations sel_policyvers_ops = { /* declaration for sel_write_load */ static int sel_make_bools(void); -static ssize_t sel_read_mls(struct file *filp, char *buf, +static ssize_t sel_read_mls(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { char *page; @@ -284,7 +284,7 @@ static struct file_operations sel_mls_ops = { .read = sel_read_mls, }; -static ssize_t sel_write_load(struct file * file, const char * buf, +static ssize_t sel_write_load(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -334,7 +334,7 @@ static struct file_operations sel_load_ops = { }; -static ssize_t sel_write_context(struct file * file, const char * buf, +static ssize_t sel_write_context(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { @@ -406,7 +406,7 @@ struct argresp { * possibly a read which collects the result - which is stored in a * file-local buffer. */ -static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t *pos) +static ssize_t TA_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { ino_t ino = file->f_dentry->d_inode->i_ino; struct argresp *ar; @@ -445,7 +445,7 @@ static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t return rv; } -static ssize_t TA_read(struct file *file, char *buf, size_t size, loff_t *pos) +static ssize_t TA_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { struct argresp *ar; ssize_t rv = 0; @@ -744,7 +744,7 @@ static struct inode *sel_make_inode(struct super_block *sb, int mode) #define BOOL_INO_OFFSET 30 -static ssize_t sel_read_bool(struct file *filep, char *buf, +static ssize_t sel_read_bool(struct file *filep, char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; @@ -806,7 +806,7 @@ out: return ret; } -static ssize_t sel_write_bool(struct file *filep, const char *buf, +static ssize_t sel_write_bool(struct file *filep, const char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; @@ -865,7 +865,8 @@ static struct file_operations sel_bool_ops = { .write = sel_write_bool, }; -static ssize_t sel_commit_bools_write(struct file *filep, const char *buf, +static ssize_t sel_commit_bools_write(struct file *filep, + const char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index aa1b54c47..f54ad88d4 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c @@ -290,7 +290,7 @@ int mls_context_to_sid(char oldc, if (rc) goto out; } - *scontext = p; + *scontext = ++p; rc = 0; out: return rc; diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index d98bb8dfe..ec1409342 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -38,6 +38,8 @@ static char *symtab_name[SYM_NUM] = { }; #endif +int policydb_loaded_version; + static unsigned int symtab_sizes[SYM_NUM] = { 2, 32, @@ -71,6 +73,11 @@ static struct policydb_compat_info policydb_compat[] = { .sym_num = SYM_NUM, .ocon_num = OCON_NUM, }, + { + .version = POLICYDB_VERSION_NLCLASS, + .sym_num = SYM_NUM, + .ocon_num = OCON_NUM, + }, }; static struct policydb_compat_info *policydb_lookup_compat(int version) @@ -1125,7 +1132,7 @@ int policydb_read(struct policydb *p, void *fp) struct role_trans *tr, *ltr; struct ocontext *l, *c, *newc; struct genfs *genfs_p, *genfs, *newgenfs; - int i, j, rc, r_policyvers; + int i, j, rc, r_policyvers = 0; u32 *buf, len, len2, config, nprim, nel, nel2; char *policydb_str; struct policydb_compat_info *info; @@ -1546,6 +1553,7 @@ int policydb_read(struct policydb *p, void *fp) if (rc) goto bad; out: + policydb_loaded_version = r_policyvers; return rc; bad_newc: ocontext_destroy(newc,OCON_FSUSE); diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 7d0fedf04..2e857b785 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -40,6 +40,7 @@ #include "mls.h" extern void selnl_notify_policyload(u32 seqno); +extern int policydb_loaded_version; static rwlock_t policy_rwlock = RW_LOCK_UNLOCKED; #define POLICY_RDLOCK read_lock(&policy_rwlock) @@ -203,6 +204,17 @@ static int context_struct_compute_av(struct context *scontext, struct avtab_datum *avdatum; struct class_datum *tclass_datum; + /* + * Remap extended Netlink classes for old policy versions. + * Do this here rather than socket_type_to_security_class() + * in case a newer policy version is loaded, allowing sockets + * to remain in the correct class. + */ + if (policydb_loaded_version < POLICYDB_VERSION_NLCLASS) + if (tclass >= SECCLASS_NETLINK_ROUTE_SOCKET && + tclass <= SECCLASS_NETLINK_DNRT_SOCKET) + tclass = SECCLASS_NETLINK_SOCKET; + if (!tclass || tclass > policydb.p_classes.nprim) { printk(KERN_ERR "security_compute_av: unrecognized class %d\n", tclass); @@ -532,6 +544,11 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid) if (rc) goto out_unlock; + if ((p - scontext2) < scontext_len) { + rc = -EINVAL; + goto out_unlock; + } + /* Check the validity of the new context. */ if (!policydb_context_isvalid(&policydb, &context)) { rc = -EINVAL; diff --git a/sound/core/control.c b/sound/core/control.c index 95e84dfe1..7cc19394d 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -512,7 +512,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) } static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, - unsigned int cmd, unsigned long arg) + unsigned int cmd, void __user *arg) { snd_ctl_card_info_t info; @@ -526,12 +526,12 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, strlcpy(info.mixername, card->mixername, sizeof(info.mixername)); strlcpy(info.components, card->components, sizeof(info.components)); up_read(&snd_ioctl_rwsem); - if (copy_to_user((void *) arg, &info, sizeof(snd_ctl_card_info_t))) + if (copy_to_user(arg, &info, sizeof(snd_ctl_card_info_t))) return -EFAULT; return 0; } -static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list) +static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list) { struct list_head *plist; snd_ctl_elem_list_t list; @@ -593,7 +593,7 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list) return 0; } -static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info) +static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __user *_info) { snd_card_t *card = ctl->card; snd_ctl_elem_info_t info; @@ -636,7 +636,7 @@ static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info) return result; } -static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t __user *_control) { snd_ctl_elem_value_t *control; snd_kcontrol_t *kctl; @@ -676,7 +676,7 @@ static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control) return result; } -static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_control) +static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t __user *_control) { snd_card_t *card = file->card; snd_ctl_elem_value_t *control; @@ -726,7 +726,7 @@ static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_contr return result; } -static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -754,7 +754,7 @@ static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) return result; } -static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_card_t *card = file->card; snd_ctl_elem_id_t id; @@ -840,7 +840,7 @@ static void snd_ctl_elem_user_free(snd_kcontrol_t * kcontrol) kfree(kcontrol->private_data); } -static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, int replace) +static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t __user *_info, int replace) { snd_card_t *card = file->card; snd_ctl_elem_info_t info; @@ -965,7 +965,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, in return 0; } -static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) +static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) { snd_ctl_elem_id_t id; @@ -974,7 +974,7 @@ static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id) return snd_ctl_remove_unlocked_id(file, &id); } -static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int *ptr) +static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr) { int subscribe; if (get_user(subscribe, ptr)) @@ -1029,6 +1029,8 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, snd_card_t *card; struct list_head *list; snd_kctl_ioctl_t *p; + void __user *argp = (void __user *)arg; + int __user *ip = argp; int err; ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO); @@ -1036,31 +1038,31 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, snd_assert(card != NULL, return -ENXIO); switch (cmd) { case SNDRV_CTL_IOCTL_PVERSION: - return put_user(SNDRV_CTL_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0; case SNDRV_CTL_IOCTL_CARD_INFO: - return snd_ctl_card_info(card, ctl, cmd, arg); + return snd_ctl_card_info(card, ctl, cmd, argp); case SNDRV_CTL_IOCTL_ELEM_LIST: - return snd_ctl_elem_list(ctl->card, (snd_ctl_elem_list_t *) arg); + return snd_ctl_elem_list(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_INFO: - return snd_ctl_elem_info(ctl, (snd_ctl_elem_info_t *) arg); + return snd_ctl_elem_info(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_READ: - return snd_ctl_elem_read(ctl->card, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_read(ctl->card, argp); case SNDRV_CTL_IOCTL_ELEM_WRITE: - return snd_ctl_elem_write(ctl, (snd_ctl_elem_value_t *) arg); + return snd_ctl_elem_write(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_LOCK: - return snd_ctl_elem_lock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_lock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_UNLOCK: - return snd_ctl_elem_unlock(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_unlock(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_ADD: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 0); + return snd_ctl_elem_add(ctl, argp, 0); case SNDRV_CTL_IOCTL_ELEM_REPLACE: - return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 1); + return snd_ctl_elem_add(ctl, argp, 1); case SNDRV_CTL_IOCTL_ELEM_REMOVE: - return snd_ctl_elem_remove(ctl, (snd_ctl_elem_id_t *) arg); + return snd_ctl_elem_remove(ctl, argp); case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: - return snd_ctl_subscribe_events(ctl, (int *) arg); + return snd_ctl_subscribe_events(ctl, ip); case SNDRV_CTL_IOCTL_POWER: - if (get_user(err, (int *)arg)) + if (get_user(err, ip)) return -EFAULT; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1075,9 +1077,9 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, return err; case SNDRV_CTL_IOCTL_POWER_STATE: #ifdef CONFIG_PM - return put_user(card->power_state, (int *)arg) ? -EFAULT : 0; + return put_user(card->power_state, ip) ? -EFAULT : 0; #else - return put_user(SNDRV_CTL_POWER_D0, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_CTL_POWER_D0, ip) ? -EFAULT : 0; #endif } down_read(&snd_ioctl_rwsem); @@ -1094,7 +1096,7 @@ static int snd_ctl_ioctl(struct inode *inode, struct file *file, return -ENOTTY; } -static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_t * offset) +static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_ctl_file_t *ctl; int err = 0; diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 33d7603f9..d18e4769d 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -55,7 +55,7 @@ static loff_t snd_hwdep_llseek(struct file * file, loff_t offset, int orig) return -ENXIO; } -static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_read(struct file * file, char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.read) @@ -63,7 +63,7 @@ static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_ return -ENXIO; } -static ssize_t snd_hwdep_write(struct file * file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, size_t count, loff_t *offset) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); if (hw->ops.write) @@ -179,7 +179,7 @@ static unsigned int snd_hwdep_poll(struct file * file, poll_table * wait) return 0; } -static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info) +static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info) { snd_hwdep_info_t info; @@ -193,7 +193,7 @@ static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info) return 0; } -static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) +static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *_info) { snd_hwdep_dsp_status_t info; int err; @@ -209,7 +209,7 @@ static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info) return 0; } -static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *_info) +static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_info) { snd_hwdep_dsp_image_t info; int err; @@ -235,15 +235,16 @@ static int snd_hwdep_ioctl(struct inode *inode, struct file * file, unsigned int cmd, unsigned long arg) { snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO); + void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HWDEP_IOCTL_PVERSION: - return put_user(SNDRV_HWDEP_VERSION, (int *)arg); + return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp); case SNDRV_HWDEP_IOCTL_INFO: - return snd_hwdep_info(hw, (snd_hwdep_info_t *)arg); + return snd_hwdep_info(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_STATUS: - return snd_hwdep_dsp_status(hw, (snd_hwdep_dsp_status_t *)arg); + return snd_hwdep_dsp_status(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_LOAD: - return snd_hwdep_dsp_load(hw, (snd_hwdep_dsp_image_t *)arg); + return snd_hwdep_dsp_load(hw, argp); } if (hw->ops.ioctl) return hw->ops.ioctl(hw, file, cmd, arg); @@ -269,7 +270,7 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_MINOR_HWDEPS) { @@ -279,13 +280,13 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, } if (device >= SNDRV_MINOR_HWDEPS) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_HWDEP_INFO: { - snd_hwdep_info_t *info = (snd_hwdep_info_t *)arg; + snd_hwdep_info_t __user *info = (snd_hwdep_info_t __user *)arg; int device; snd_hwdep_t *hwdep; diff --git a/sound/core/info.c b/sound/core/info.c index fadd47112..0b08203d5 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -174,7 +174,7 @@ out: return ret; } -static ssize_t snd_info_entry_read(struct file *file, char *buffer, +static ssize_t snd_info_entry_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; @@ -208,7 +208,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer, return size; } -static ssize_t snd_info_entry_write(struct file *file, const char *buffer, +static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t * offset) { snd_info_private_data_t *data; diff --git a/sound/core/memory.c b/sound/core/memory.c index 1f8c8d934..cf4f75cec 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -307,7 +307,7 @@ char *snd_kmalloc_strdup(const char *string, int flags) * * Returns zero if successful, or non-zero on failure. */ -int copy_to_user_fromio(void *dst, unsigned long src, size_t count) +int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; @@ -338,7 +338,7 @@ int copy_to_user_fromio(void *dst, unsigned long src, size_t count) * * Returns zero if successful, or non-zero on failure. */ -int copy_from_user_toio(unsigned long dst, const void *src, size_t count) +int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 8e7efafee..d8359d301 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -81,7 +81,7 @@ static int snd_mixer_oss_release(struct inode *inode, struct file *file) } static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer, - mixer_info *_info) + mixer_info __user *_info) { snd_card_t *card = fmixer->card; snd_mixer_oss_t *mixer = fmixer->mixer; @@ -97,7 +97,7 @@ static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer, } static int snd_mixer_oss_info_obsolete(snd_mixer_oss_file_t *fmixer, - _old_mixer_info *_info) + _old_mixer_info __user *_info) { snd_card_t *card = fmixer->card; snd_mixer_oss_t *mixer = fmixer->mixer; @@ -293,65 +293,67 @@ static int snd_mixer_oss_set_volume(snd_mixer_oss_file_t *fmixer, static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int tmp; snd_assert(fmixer != NULL, return -ENXIO); if (((cmd >> 8) & 0xff) == 'M') { switch (cmd) { case SOUND_MIXER_INFO: - return snd_mixer_oss_info(fmixer, (mixer_info *)arg); + return snd_mixer_oss_info(fmixer, argp); case SOUND_OLD_MIXER_INFO: - return snd_mixer_oss_info_obsolete(fmixer, (_old_mixer_info *)arg); + return snd_mixer_oss_info_obsolete(fmixer, argp); case SOUND_MIXER_WRITE_RECSRC: - if (get_user(tmp, (int *)arg)) + if (get_user(tmp, p)) return -EFAULT; tmp = snd_mixer_oss_set_recsrc(fmixer, tmp); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case OSS_GETVERSION: - return put_user(SNDRV_OSS_VERSION, (int *) arg); + return put_user(SNDRV_OSS_VERSION, p); case OSS_ALSAEMULVER: - return put_user(1, (int *) arg); + return put_user(1, p); case SOUND_MIXER_READ_DEVMASK: tmp = snd_mixer_oss_devmask(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_STEREODEVS: tmp = snd_mixer_oss_stereodevs(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_RECMASK: tmp = snd_mixer_oss_recmask(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_CAPS: tmp = snd_mixer_oss_caps(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); case SOUND_MIXER_READ_RECSRC: tmp = snd_mixer_oss_get_recsrc(fmixer); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } } if (cmd & SIOC_IN) { - if (get_user(tmp, (int *)arg)) + if (get_user(tmp, p)) return -EFAULT; tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } else if (cmd & SIOC_OUT) { tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff); if (tmp < 0) return tmp; - return put_user(tmp, (int *)arg); + return put_user(tmp, p); } return -ENXIO; } diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 75cea7e24..65b5017e4 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -806,7 +806,7 @@ static ssize_t snd_pcm_oss_write2(snd_pcm_substream_t *substream, const char *bu return bytes; } -static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *buf, size_t bytes) +static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __user *buf, size_t bytes) { size_t xfer = 0; ssize_t tmp; @@ -883,7 +883,7 @@ static ssize_t snd_pcm_oss_read2(snd_pcm_substream_t *substream, char *buf, size return bytes; } -static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size_t bytes) +static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *buf, size_t bytes) { size_t xfer = 0; ssize_t tmp; @@ -1067,9 +1067,9 @@ static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file) snd_pcm_lib_write(substream, runtime->oss.buffer, size1); } } else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) { - void *buffers[runtime->channels]; + void __user *buffers[runtime->channels]; memset(buffers, 0, runtime->channels * sizeof(void *)); - snd_pcm_lib_writev(substream, (void **)buffers, size); + snd_pcm_lib_writev(substream, buffers, size); } } /* @@ -1468,7 +1468,7 @@ static int snd_pcm_oss_get_odelay(snd_pcm_oss_file_t *pcm_oss_file) return snd_pcm_oss_bytes(substream, delay); } -static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info * _info) +static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info __user * _info) { snd_pcm_substream_t *substream; snd_pcm_runtime_t *runtime; @@ -1530,7 +1530,7 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str return 0; } -static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info *_info) +static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info __user *_info) { snd_pcm_substream_t *substream; snd_pcm_runtime_t *runtime; @@ -1589,7 +1589,7 @@ static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, s return 0; } -static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc * _info) +static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc __user * _info) { // it won't be probably implemented // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n"); @@ -1912,13 +1912,14 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { snd_pcm_oss_file_t *pcm_oss_file; + int __user *p = (int __user *)arg; int res; pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return -ENXIO); if (cmd == OSS_GETVERSION) - return put_user(SNDRV_OSS_VERSION, (int *)arg); + return put_user(SNDRV_OSS_VERSION, p); if (cmd == OSS_ALSAEMULVER) - return put_user(1, (int *)arg); + return put_user(1, p); #if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE)) if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */ snd_pcm_substream_t *substream; @@ -1943,93 +1944,93 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_SYNC: return snd_pcm_oss_sync(pcm_oss_file); case SNDCTL_DSP_SPEED: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; if ((res = snd_pcm_oss_set_rate(pcm_oss_file, res))<0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_RATE: res = snd_pcm_oss_get_rate(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_STEREO: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = res > 0 ? 2 : 1; if ((res = snd_pcm_oss_set_channels(pcm_oss_file, res)) < 0) return res; - return put_user(--res, (int *)arg); + return put_user(--res, p); case SNDCTL_DSP_GETBLKSIZE: res = snd_pcm_oss_get_block_size(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETFMT: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_format(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_BITS: res = snd_pcm_oss_get_format(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_CHANNELS: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_channels(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_READ_CHANNELS: res = snd_pcm_oss_get_channels(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_READ_FILTER: return -EIO; case SNDCTL_DSP_POST: return snd_pcm_oss_post(pcm_oss_file); case SNDCTL_DSP_SUBDIVIDE: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; res = snd_pcm_oss_set_subdivide(pcm_oss_file, res); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; return snd_pcm_oss_set_fragment(pcm_oss_file, res); case SNDCTL_DSP_GETFMTS: res = snd_pcm_oss_get_formats(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_GETOSPACE: case SNDCTL_DSP_GETISPACE: return snd_pcm_oss_get_space(pcm_oss_file, cmd == SNDCTL_DSP_GETISPACE ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct audio_buf_info *) arg); + (struct audio_buf_info __user *) arg); case SNDCTL_DSP_NONBLOCK: return snd_pcm_oss_nonblock(file); case SNDCTL_DSP_GETCAPS: res = snd_pcm_oss_get_caps(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_GETTRIGGER: res = snd_pcm_oss_get_trigger(pcm_oss_file); if (res < 0) return res; - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(res, (int *)arg)) + if (get_user(res, p)) return -EFAULT; return snd_pcm_oss_set_trigger(pcm_oss_file, res); case SNDCTL_DSP_GETIPTR: @@ -2037,13 +2038,13 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, return snd_pcm_oss_get_ptr(pcm_oss_file, cmd == SNDCTL_DSP_GETIPTR ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct count_info *) arg); + (struct count_info __user *) arg); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: return snd_pcm_oss_get_mapbuf(pcm_oss_file, cmd == SNDCTL_DSP_MAPINBUF ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK, - (struct buffmem_desc *) arg); + (struct buffmem_desc __user *) arg); case SNDCTL_DSP_SETSYNCRO: /* stop DMA now.. */ return 0; @@ -2055,10 +2056,10 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, res = snd_pcm_oss_get_odelay(pcm_oss_file); if (res < 0) { /* it's for sure, some broken apps don't check for error codes */ - put_user(0, (int *)arg); + put_user(0, p); return res; } - return put_user(res, (int *)arg); + return put_user(res, p); case SNDCTL_DSP_PROFILE: return 0; /* silently ignore */ default: @@ -2067,7 +2068,7 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file, return -EINVAL; } -static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { snd_pcm_oss_file_t *pcm_oss_file; snd_pcm_substream_t *substream; @@ -2087,7 +2088,7 @@ static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff #endif } -static ssize_t snd_pcm_oss_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { snd_pcm_oss_file_t *pcm_oss_file; snd_pcm_substream_t *substream; diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 4f879747d..7f1bf94e0 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -55,7 +55,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)arg)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_PCM_DEVICES) { @@ -65,18 +65,19 @@ static int snd_pcm_control_ioctl(snd_card_t * card, } if (device == SNDRV_PCM_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; } case SNDRV_CTL_IOCTL_PCM_INFO: { - snd_pcm_info_t *info = (snd_pcm_info_t *)arg; + snd_pcm_info_t __user *info; unsigned int device, subdevice; snd_pcm_stream_t stream; snd_pcm_t *pcm; snd_pcm_str_t *pstr; snd_pcm_substream_t *substream; + info = (snd_pcm_info_t __user *)arg; if (get_user(device, &info->device)) return -EFAULT; if (device >= SNDRV_PCM_DEVICES) @@ -106,7 +107,7 @@ static int snd_pcm_control_ioctl(snd_card_t * card, { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; control->prefer_pcm_subdevice = val; return 0; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 49ab38418..61d1c38fb 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -2049,12 +2049,12 @@ void snd_pcm_period_elapsed(snd_pcm_substream_t *substream) static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - char *buf = (char *) data + frames_to_bytes(runtime, off); + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); if (substream->ops->copy) { if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) return err; @@ -2068,10 +2068,12 @@ static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream, } typedef int (*transfer_f)(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, snd_pcm_uframes_t size); + unsigned long data, unsigned int off, + snd_pcm_uframes_t size); static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, - const void *data, snd_pcm_uframes_t size, + unsigned long data, + snd_pcm_uframes_t size, int nonblock, transfer_f transfer) { @@ -2186,7 +2188,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, appl_ptr = runtime->control->appl_ptr; appl_ofs = appl_ptr % runtime->buffer_size; snd_pcm_stream_unlock_irq(substream); - if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0) + if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0) goto _end; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -2227,7 +2229,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; } -snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size) +snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void __user *buf, snd_pcm_uframes_t size) { snd_pcm_runtime_t *runtime; int nonblock; @@ -2256,18 +2258,18 @@ snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void * if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED && runtime->channels > 1) return -EINVAL; - return snd_pcm_lib_write1(substream, buf, size, nonblock, + return snd_pcm_lib_write1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_write_transfer); } static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - void **bufs = data; + void __user **bufs = (void __user **)data; int channels = runtime->channels; int c; if (substream->ops->copy) { @@ -2277,7 +2279,7 @@ static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, if ((err = substream->ops->silence(substream, c, hwoff, frames)) < 0) return err; } else { - char *buf = *bufs + samples_to_bytes(runtime, off); + char __user *buf = *bufs + samples_to_bytes(runtime, off); if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0) return err; } @@ -2291,7 +2293,7 @@ static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, if (*bufs == NULL) { snd_pcm_format_set_silence(runtime->format, hwbuf, frames); } else { - char *buf = *bufs + samples_to_bytes(runtime, off); + char __user *buf = *bufs + samples_to_bytes(runtime, off); if (copy_from_user(hwbuf, buf, samples_to_bytes(runtime, frames))) return -EFAULT; } @@ -2300,7 +2302,8 @@ static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, return 0; } -snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, void **bufs, +snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, + void __user **bufs, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime; @@ -2329,18 +2332,18 @@ snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, void **bufs if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; - return snd_pcm_lib_write1(substream, bufs, frames, nonblock, - snd_pcm_lib_writev_transfer); + return snd_pcm_lib_write1(substream, (unsigned long)bufs, frames, + nonblock, snd_pcm_lib_writev_transfer); } static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - char *buf = (char *) data + frames_to_bytes(runtime, off); + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); if (substream->ops->copy) { if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) return err; @@ -2353,7 +2356,10 @@ static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, return 0; } -static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void *data, snd_pcm_uframes_t size, int nonblock, +static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, + unsigned long data, + snd_pcm_uframes_t size, + int nonblock, transfer_f transfer) { snd_pcm_runtime_t *runtime = substream->runtime; @@ -2481,7 +2487,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void appl_ptr = runtime->control->appl_ptr; appl_ofs = appl_ptr % runtime->buffer_size; snd_pcm_stream_unlock_irq(substream); - if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0) + if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0) goto _end; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { @@ -2516,7 +2522,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; } -snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, snd_pcm_uframes_t size) +snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *buf, snd_pcm_uframes_t size) { snd_pcm_runtime_t *runtime; int nonblock; @@ -2543,22 +2549,22 @@ snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, sn #endif if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED) return -EINVAL; - return snd_pcm_lib_read1(substream, buf, size, nonblock, snd_pcm_lib_read_transfer); + return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer); } static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, unsigned int hwoff, - void *data, unsigned int off, + unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime = substream->runtime; int err; - void **bufs = data; + void __user **bufs = (void __user **)data; int channels = runtime->channels; int c; if (substream->ops->copy) { for (c = 0; c < channels; ++c, ++bufs) { - char *buf; + char __user *buf; if (*bufs == NULL) continue; buf = *bufs + samples_to_bytes(runtime, off); @@ -2569,7 +2575,8 @@ static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels; snd_assert(runtime->dma_area, return -EFAULT); for (c = 0; c < channels; ++c, ++bufs) { - char *hwbuf, *buf; + char *hwbuf; + char __user *buf; if (*bufs == NULL) continue; @@ -2582,7 +2589,8 @@ static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, return 0; } -snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, void **bufs, +snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, + void __user **bufs, snd_pcm_uframes_t frames) { snd_pcm_runtime_t *runtime; @@ -2611,7 +2619,7 @@ snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, void **bufs, if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; - return snd_pcm_lib_read1(substream, bufs, frames, nonblock, snd_pcm_lib_readv_transfer); + return snd_pcm_lib_read1(substream, (unsigned long)bufs, frames, nonblock, snd_pcm_lib_readv_transfer); } /* diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 38d564186..15ed2b9b3 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -56,8 +56,8 @@ struct sndrv_pcm_hw_params_old { #define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old) #define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old) -static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams); -static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams); +static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); +static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); /* * @@ -108,7 +108,7 @@ int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info) return 0; } -int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t * _info) +int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info) { snd_pcm_info_t info; int err = snd_pcm_info(substream, &info); @@ -302,7 +302,7 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream, return 0; } -static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params) +static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) { snd_pcm_hw_params_t params; int err; @@ -406,7 +406,7 @@ static int snd_pcm_hw_params(snd_pcm_substream_t *substream, return err; } -static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params) +static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) { snd_pcm_hw_params_t params; int err; @@ -494,7 +494,7 @@ static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_ return 0; } -static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t * _params) +static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params) { snd_pcm_sw_params_t params; int err; @@ -550,7 +550,7 @@ int snd_pcm_status(snd_pcm_substream_t *substream, return 0; } -static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t * _status) +static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status) { snd_pcm_status_t status; snd_pcm_runtime_t *runtime; @@ -567,7 +567,7 @@ static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t return 0; } -static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * _info) +static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info) { snd_pcm_channel_info_t info; snd_pcm_runtime_t *runtime; @@ -2297,7 +2297,7 @@ static int snd_pcm_hwsync(snd_pcm_substream_t *substream) return err; } -static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t *res) +static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res) { snd_pcm_runtime_t *runtime = substream->runtime; int err; @@ -2335,7 +2335,7 @@ static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t *res) return err; } -static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr *_sync_ptr) +static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr) { snd_pcm_runtime_t *runtime = substream->runtime; struct sndrv_pcm_sync_ptr sync_ptr; @@ -2344,7 +2344,7 @@ static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_syn int err; memset(&sync_ptr, 0, sizeof(sync_ptr)); - if (get_user(sync_ptr.flags, (unsigned int *) &(_sync_ptr->flags))) + if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) return -EFAULT; if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control))) return -EFAULT; @@ -2375,40 +2375,40 @@ static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_syn } static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg); + unsigned int cmd, void __user *arg); static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg); + unsigned int cmd, void __user *arg); static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); switch (cmd) { case SNDRV_PCM_IOCTL_PVERSION: - return put_user(SNDRV_PCM_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_PCM_IOCTL_INFO: - return snd_pcm_info_user(substream, (snd_pcm_info_t *) arg); + return snd_pcm_info_user(substream, arg); case SNDRV_PCM_IOCTL_TSTAMP: { int xarg; - if (get_user(xarg, (int *) arg)) + if (get_user(xarg, (int __user *)arg)) return -EFAULT; substream->runtime->tstamp_timespec = xarg ? 1 : 0; return 0; } case SNDRV_PCM_IOCTL_HW_REFINE: - return snd_pcm_hw_refine_user(substream, (snd_pcm_hw_params_t *) arg); + return snd_pcm_hw_refine_user(substream, arg); case SNDRV_PCM_IOCTL_HW_PARAMS: - return snd_pcm_hw_params_user(substream, (snd_pcm_hw_params_t *) arg); + return snd_pcm_hw_params_user(substream, arg); case SNDRV_PCM_IOCTL_HW_FREE: return snd_pcm_hw_free(substream); case SNDRV_PCM_IOCTL_SW_PARAMS: - return snd_pcm_sw_params_user(substream, (snd_pcm_sw_params_t *) arg); + return snd_pcm_sw_params_user(substream, arg); case SNDRV_PCM_IOCTL_STATUS: - return snd_pcm_status_user(substream, (snd_pcm_status_t *) arg); + return snd_pcm_status_user(substream, arg); case SNDRV_PCM_IOCTL_CHANNEL_INFO: - return snd_pcm_channel_info(substream, (snd_pcm_channel_info_t *) arg); + return snd_pcm_channel_info(substream, arg); case SNDRV_PCM_IOCTL_PREPARE: return snd_pcm_prepare(substream); case SNDRV_PCM_IOCTL_RESET: @@ -2416,7 +2416,7 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, case SNDRV_PCM_IOCTL_START: return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, 0, 0); case SNDRV_PCM_IOCTL_LINK: - return snd_pcm_link(substream, (long) arg); + return snd_pcm_link(substream, (int)(unsigned long) arg); case SNDRV_PCM_IOCTL_UNLINK: return snd_pcm_unlink(substream); case SNDRV_PCM_IOCTL_RESUME: @@ -2426,27 +2426,28 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, case SNDRV_PCM_IOCTL_HWSYNC: return snd_pcm_hwsync(substream); case SNDRV_PCM_IOCTL_DELAY: - return snd_pcm_delay(substream, (snd_pcm_sframes_t *) arg); + return snd_pcm_delay(substream, arg); case SNDRV_PCM_IOCTL_SYNC_PTR: - return snd_pcm_sync_ptr(substream, (struct sndrv_pcm_sync_ptr *) arg); + return snd_pcm_sync_ptr(substream, arg); case SNDRV_PCM_IOCTL_HW_REFINE_OLD: - return snd_pcm_hw_refine_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg); + return snd_pcm_hw_refine_old_user(substream, arg); case SNDRV_PCM_IOCTL_HW_PARAMS_OLD: - return snd_pcm_hw_params_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg); + return snd_pcm_hw_params_old_user(substream, arg); } snd_printd("unknown ioctl = 0x%x\n", cmd); return -ENOTTY; } static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); snd_assert(substream->stream == SNDRV_PCM_STREAM_PLAYBACK, return -EINVAL); switch (cmd) { case SNDRV_PCM_IOCTL_WRITEI_FRAMES: { - snd_xferi_t xferi, *_xferi = arg; + snd_xferi_t xferi; + snd_xferi_t __user *_xferi = arg; snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) @@ -2461,9 +2462,10 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_WRITEN_FRAMES: { - snd_xfern_t xfern, *_xfern = arg; + snd_xfern_t xfern; + snd_xfern_t __user *_xfern = arg; snd_pcm_runtime_t *runtime = substream->runtime; - void *bufs; + void __user **bufs; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) return -EBADFD; @@ -2487,7 +2489,8 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_REWIND: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2499,7 +2502,8 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_FORWARD: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2513,7 +2517,7 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, { int res; snd_pcm_stream_lock_irq(substream); - res = snd_pcm_pause(substream, (long) arg); + res = snd_pcm_pause(substream, (int)(unsigned long)arg); snd_pcm_stream_unlock_irq(substream); return res; } @@ -2526,14 +2530,15 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, } static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, - unsigned int cmd, void *arg) + unsigned int cmd, void __user *arg) { snd_assert(substream != NULL, return -ENXIO); snd_assert(substream->stream == SNDRV_PCM_STREAM_CAPTURE, return -EINVAL); switch (cmd) { case SNDRV_PCM_IOCTL_READI_FRAMES: { - snd_xferi_t xferi, *_xferi = arg; + snd_xferi_t xferi; + snd_xferi_t __user *_xferi = arg; snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_sframes_t result; if (runtime->status->state == SNDRV_PCM_STATE_OPEN) @@ -2548,7 +2553,8 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_READN_FRAMES: { - snd_xfern_t xfern, *_xfern = arg; + snd_xfern_t xfern; + snd_xfern_t __user *_xfern = arg; snd_pcm_runtime_t *runtime = substream->runtime; void *bufs; snd_pcm_sframes_t result; @@ -2574,7 +2580,8 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_REWIND: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2586,7 +2593,8 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, } case SNDRV_PCM_IOCTL_FORWARD: { - snd_pcm_uframes_t frames, *_frames = arg; + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; snd_pcm_sframes_t result; if (get_user(frames, _frames)) return -EFAULT; @@ -2614,7 +2622,7 @@ static int snd_pcm_playback_ioctl(struct inode *inode, struct file *file, if (((cmd >> 8) & 0xff) != 'A') return -ENOTTY; - return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void *) arg); + return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg); } static int snd_pcm_capture_ioctl(struct inode *inode, struct file *file, @@ -2627,7 +2635,7 @@ static int snd_pcm_capture_ioctl(struct inode *inode, struct file *file, if (((cmd >> 8) & 0xff) != 'A') return -ENOTTY; - return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void *) arg); + return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); } int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, @@ -2667,7 +2675,7 @@ int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, } } -static ssize_t snd_pcm_read(struct file *file, char *buf, size_t count, loff_t * offset) +static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset) { snd_pcm_file_t *pcm_file; snd_pcm_substream_t *substream; @@ -2689,7 +2697,7 @@ static ssize_t snd_pcm_read(struct file *file, char *buf, size_t count, loff_t * return result; } -static ssize_t snd_pcm_write(struct file *file, const char *buf, size_t count, loff_t * offset) +static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset) { snd_pcm_file_t *pcm_file; snd_pcm_substream_t *substream; @@ -2725,7 +2733,7 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, snd_pcm_runtime_t *runtime; snd_pcm_sframes_t result; unsigned long i; - void **bufs; + void __user **bufs; snd_pcm_uframes_t frames; pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, return -ENXIO); @@ -2759,7 +2767,7 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, snd_pcm_runtime_t *runtime; snd_pcm_sframes_t result; unsigned long i; - void **bufs; + void __user **bufs; snd_pcm_uframes_t frames; pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, result = -ENXIO; goto end); @@ -3123,7 +3131,7 @@ static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *opa oparams->fifo_size = params->fifo_size; } -static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams) +static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) { snd_pcm_hw_params_t params; struct sndrv_pcm_hw_params_old oparams; @@ -3138,7 +3146,7 @@ static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sn return err; } -static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams) +static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) { snd_pcm_hw_params_t params; struct sndrv_pcm_hw_params_old oparams; diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index abc2221d7..df904d18d 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -543,7 +543,7 @@ int snd_rawmidi_info(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t *inf return 0; } -static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t * _info) +static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info) { snd_rawmidi_info_t info; int err; @@ -579,7 +579,7 @@ int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info) } static int snd_rawmidi_info_select_user(snd_card_t *card, - snd_rawmidi_info_t *_info) + snd_rawmidi_info_t __user *_info) { int err; snd_rawmidi_info_t info; @@ -679,17 +679,18 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { snd_rawmidi_file_t *rfile; + void __user *argp = (void __user *)arg; rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO); if (((cmd >> 8) & 0xff) != 'W') return -ENOTTY; switch (cmd) { case SNDRV_RAWMIDI_IOCTL_PVERSION: - return put_user(SNDRV_RAWMIDI_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0; case SNDRV_RAWMIDI_IOCTL_INFO: { snd_rawmidi_stream_t stream; - snd_rawmidi_info_t *info = (snd_rawmidi_info_t *) arg; + snd_rawmidi_info_t __user *info = argp; if (get_user(stream, &info->stream)) return -EFAULT; switch (stream) { @@ -704,7 +705,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, case SNDRV_RAWMIDI_IOCTL_PARAMS: { snd_rawmidi_params_t params; - if (copy_from_user(¶ms, (snd_rawmidi_params_t *) arg, sizeof(snd_rawmidi_params_t))) + if (copy_from_user(¶ms, argp, sizeof(snd_rawmidi_params_t))) return -EFAULT; switch (params.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -723,7 +724,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, { int err = 0; snd_rawmidi_status_t status; - if (copy_from_user(&status, (snd_rawmidi_status_t *) arg, sizeof(snd_rawmidi_status_t))) + if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t))) return -EFAULT; switch (status.stream) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -741,14 +742,14 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, } if (err < 0) return err; - if (copy_to_user((snd_rawmidi_status_t *) arg, &status, sizeof(snd_rawmidi_status_t))) + if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t))) return -EFAULT; return 0; } case SNDRV_RAWMIDI_IOCTL_DROP: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -762,7 +763,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, case SNDRV_RAWMIDI_IOCTL_DRAIN: { int val; - if (get_user(val, (long *) arg)) + if (get_user(val, (long __user *) argp)) return -EFAULT; switch (val) { case SNDRV_RAWMIDI_STREAM_OUTPUT: @@ -788,6 +789,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; unsigned int tmp; tmp = card->number * SNDRV_RAWMIDI_DEVICES; @@ -796,7 +798,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int device; - if (get_user(device, (int *)arg)) + if (get_user(device, (int __user *)argp)) return -EFAULT; device = device < 0 ? 0 : device + 1; while (device < SNDRV_RAWMIDI_DEVICES) { @@ -806,7 +808,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, } if (device == SNDRV_RAWMIDI_DEVICES) device = -1; - if (put_user(device, (int *)arg)) + if (put_user(device, (int __user *)argp)) return -EFAULT; return 0; } @@ -814,13 +816,13 @@ int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control, { int val; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; control->prefer_rawmidi_subdevice = val; return 0; } case SNDRV_CTL_IOCTL_RAWMIDI_INFO: - return snd_rawmidi_info_select_user(card, (snd_rawmidi_info_t *)arg); + return snd_rawmidi_info_select_user(card, argp); } return -ENOIOCTLCMD; } @@ -934,7 +936,7 @@ long snd_rawmidi_kernel_read(snd_rawmidi_substream_t *substream, unsigned char * return snd_rawmidi_kernel_read1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { long result; int count1; @@ -1166,7 +1168,7 @@ long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigne return snd_rawmidi_kernel_write1(substream, buf, count, 1); } -static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t count, loff_t *offset) +static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { long result, timeout; int count1; diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile index 1c4d10d47..e731cdc2e 100644 --- a/sound/core/seq/Makefile +++ b/sound/core/seq/Makefile @@ -51,7 +51,6 @@ obj-$(call sequencer,$(CONFIG_SND_AD1816A)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) obj-$(call sequencer,$(CONFIG_SND_CS4231)) += $(RAWMIDI_OBJS) obj-$(call sequencer,$(CONFIG_SND_CS4232)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) obj-$(call sequencer,$(CONFIG_SND_CS4236)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) -obj-$(call sequencer,$(CONFIG_SND_PC98_CS4232)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) obj-$(call sequencer,$(CONFIG_SND_ES1688)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) obj-$(call sequencer,$(CONFIG_SND_GUSCLASSIC)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) obj-$(call sequencer,$(CONFIG_SND_GUSMAX)) += $(RAWMIDI_OBJS) $(OPL3_OBJS) diff --git a/sound/core/seq/instr/Makefile b/sound/core/seq/instr/Makefile index 8db86fe18..5ae3552af 100644 --- a/sound/core/seq/instr/Makefile +++ b/sound/core/seq/instr/Makefile @@ -26,7 +26,6 @@ obj-$(call sequencer,$(CONFIG_SND_OPL3SA2)) += snd-ainstr-fm.o obj-$(call sequencer,$(CONFIG_SND_AD1816A)) += snd-ainstr-fm.o obj-$(call sequencer,$(CONFIG_SND_CS4232)) += snd-ainstr-fm.o obj-$(call sequencer,$(CONFIG_SND_CS4236)) += snd-ainstr-fm.o -obj-$(call sequencer,$(CONFIG_SND_PC98_CS4232)) += snd-ainstr-fm.o obj-$(call sequencer,$(CONFIG_SND_ES1688)) += snd-ainstr-fm.o obj-$(call sequencer,$(CONFIG_SND_GUSCLASSIC)) += snd-ainstr-iw.o snd-ainstr-gf1.o snd-ainstr-simple.o obj-$(call sequencer,$(CONFIG_SND_GUSMAX)) += snd-ainstr-iw.o snd-ainstr-gf1.o snd-ainstr-simple.o diff --git a/sound/core/seq/instr/ainstr_fm.c b/sound/core/seq/instr/ainstr_fm.c index aabb0c2bb..648a7b89c 100644 --- a/sound/core/seq/instr/ainstr_fm.c +++ b/sound/core/seq/instr/ainstr_fm.c @@ -35,7 +35,7 @@ MODULE_SUPPORTED_DEVICE("sound"); char *snd_seq_fm_id = SNDRV_SEQ_INSTR_ID_OPL2_3; static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, int cmd) { fm_instrument_t *ip; fm_xinstrument_t ix; @@ -77,7 +77,8 @@ static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr, } static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { fm_instrument_t *ip; fm_xinstrument_t ix; diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c index d1029dfdd..13b46beff 100644 --- a/sound/core/seq/instr/ainstr_gf1.c +++ b/sound/core/seq/instr/ainstr_gf1.c @@ -48,7 +48,7 @@ static unsigned int snd_seq_gf1_size(unsigned int size, unsigned int format) static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, gf1_instrument_t *ip, - char **data, + char __user **data, long *len, int atomic) { @@ -141,7 +141,8 @@ static void snd_seq_gf1_instr_free(snd_gf1_ops_t *ops, } static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; gf1_instrument_t *ip; @@ -192,7 +193,7 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops, gf1_instrument_t *ip, - char **data, + char __user **data, long *len, int atomic) { @@ -253,7 +254,8 @@ static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops, } static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; gf1_instrument_t *ip; diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c index 121e09cde..cd9ea5545 100644 --- a/sound/core/seq/instr/ainstr_iw.c +++ b/sound/core/seq/instr/ainstr_iw.c @@ -60,7 +60,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, iwffff_layer_t *lp, iwffff_env_t *ep, iwffff_xenv_t *ex, - char **data, + char __user **data, long *len, int gfp_mask) { @@ -126,7 +126,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, iwffff_layer_t *lp, - char **data, + char __user **data, long *len, int atomic) { @@ -230,7 +230,8 @@ static void snd_seq_iwffff_instr_free(snd_iwffff_ops_t *ops, } static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, + int cmd) { snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; iwffff_instrument_t *ip; @@ -350,7 +351,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, iwffff_layer_t *lp, iwffff_xenv_t *ex, iwffff_env_t *ep, - char **data, + char __user **data, long *len) { iwffff_env_record_t *rp; @@ -395,7 +396,7 @@ static int snd_seq_iwffff_copy_env_to_stream(__u32 req_stype, static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops, iwffff_layer_t *lp, - char **data, + char __user **data, long *len, int atomic) { @@ -449,14 +450,14 @@ static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops, } static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, int atomic, int cmd) { snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data; iwffff_instrument_t *ip; iwffff_xinstrument_t ix; iwffff_layer_t *lp; iwffff_xlayer_t lx; - char *layer_instr_data; + char __user *layer_instr_data; int err; if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL) diff --git a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c index 575b1e86b..0f8117838 100644 --- a/sound/core/seq/instr/ainstr_simple.c +++ b/sound/core/seq/instr/ainstr_simple.c @@ -55,7 +55,8 @@ static void snd_seq_simple_instr_free(snd_simple_ops_t *ops, } static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, + int atomic, int cmd) { snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; simple_instrument_t *ip; @@ -103,7 +104,8 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, } static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr, - char *instr_data, long len, int atomic, int cmd) + char __user *instr_data, long len, + int atomic, int cmd) { snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; simple_instrument_t *ip; diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 50a3740bf..5681563fa 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -57,8 +57,8 @@ static void unregister_proc(void); static int odev_open(struct inode *inode, struct file *file); static int odev_release(struct inode *inode, struct file *file); -static ssize_t odev_read(struct file *file, char *buf, size_t count, loff_t *offset); -static ssize_t odev_write(struct file *file, const char *buf, size_t count, loff_t *offset); +static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset); +static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset); static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); static unsigned int odev_poll(struct file *file, poll_table * wait); #ifdef CONFIG_PROC_FS @@ -155,7 +155,7 @@ odev_release(struct inode *inode, struct file *file) } static ssize_t -odev_read(struct file *file, char *buf, size_t count, loff_t *offset) +odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; @@ -165,7 +165,7 @@ odev_read(struct file *file, char *buf, size_t count, loff_t *offset) static ssize_t -odev_write(struct file *file, const char *buf, size_t count, loff_t *offset) +odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { seq_oss_devinfo_t *dp; dp = file->private_data; diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c index d5973a837..6d783cd14 100644 --- a/sound/core/seq/oss/seq_oss_ioctl.c +++ b/sound/core/seq/oss/seq_oss_ioctl.c @@ -36,6 +36,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) struct midi_info minf; unsigned char ev[8]; void __user *arg = (void __user *)carg; + int __user *p = arg; snd_seq_event_t tmpev; switch (cmd) { @@ -72,7 +73,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) case SNDCTL_SEQ_TESTMIDI: debug_printk(("test midi\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_midi_open(dp, dev, dp->file_mode); @@ -80,42 +81,42 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("get in count\n")); if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) return 0; - return put_user(dp->readq->qlen, (int *)arg) ? -EFAULT : 0; + return put_user(dp->readq->qlen, p) ? -EFAULT : 0; case SNDCTL_SEQ_GETOUTCOUNT: debug_printk(("get out count\n")); if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) return 0; - return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0; case SNDCTL_SEQ_GETTIME: debug_printk(("get time\n")); - return put_user(snd_seq_oss_timer_cur_tick(dp->timer), (int *)arg) ? -EFAULT : 0; + return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0; case SNDCTL_SEQ_RESETSAMPLES: debug_printk(("reset samples\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); case SNDCTL_SEQ_NRSYNTHS: debug_printk(("nr synths\n")); - return put_user(dp->max_synthdev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_synthdev, p) ? -EFAULT : 0; case SNDCTL_SEQ_NRMIDIS: debug_printk(("nr midis\n")); - return put_user(dp->max_mididev, (int *)arg) ? -EFAULT : 0; + return put_user(dp->max_mididev, p) ? -EFAULT : 0; case SNDCTL_SYNTH_MEMAVL: debug_printk(("mem avail\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; case SNDCTL_FM_4OP_ENABLE: debug_printk(("4op\n")); - if (get_user(dev, (int *)arg)) + if (get_user(dev, p)) return -EFAULT; snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); return 0; @@ -157,7 +158,7 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("threshold\n")); if (! is_write_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 1) val = 1; @@ -170,14 +171,14 @@ snd_seq_oss_ioctl(seq_oss_devinfo_t *dp, unsigned int cmd, unsigned long carg) debug_printk(("pretime\n")); if (dp->readq == NULL || !is_read_mode(dp->file_mode)) return 0; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val <= 0) val = -1; else val = (HZ * val) / 10; dp->readq->pre_event_timeout = val; - return put_user(val, (int *)arg) ? -EFAULT : 0; + return put_user(val, p) ? -EFAULT : 0; default: debug_printk(("others\n")); diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 40fef22f5..9e67d06da 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -2154,17 +2154,17 @@ static int snd_seq_do_ioctl(client_t *client, unsigned int cmd, void __user *arg switch (cmd) { case SNDRV_SEQ_IOCTL_PVERSION: /* return sequencer version number */ - return put_user(SNDRV_SEQ_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0; case SNDRV_SEQ_IOCTL_CLIENT_ID: /* return the id of this client */ - return put_user(client->number, (int *)arg) ? -EFAULT : 0; + return put_user(client->number, (int __user *)arg) ? -EFAULT : 0; } if (! arg) return -EFAULT; for (p = ioctl_tables; p->cmd; p++) { if (p->cmd == cmd) - return p->func(client, (void __user *) arg); + return p->func(client, arg); } snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%2x)\n", cmd, _IOC_TYPE(cmd), _IOC_NR(cmd)); @@ -2348,7 +2348,7 @@ int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t * ev, * exported, called by kernel clients to perform same functions as with * userland ioctl() */ -int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void __user *arg) +int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) { client_t *client; mm_segment_t fs; diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 298cfd317..fbcfd3c8a 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -90,7 +90,7 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { char buf[32]; - char *curptr = event->data.ext.ptr; + char __user *curptr = event->data.ext.ptr; while (len > 0) { int size = sizeof(buf); if (len < size) diff --git a/sound/core/timer.c b/sound/core/timer.c index 956ea2a16..6f6d89c43 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1253,7 +1253,7 @@ static void snd_timer_user_copy_id(snd_timer_id_t *id, snd_timer_t *timer) id->subdevice = timer->tmr_subdevice; } -static int snd_timer_user_next_device(snd_timer_id_t *_tid) +static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) { snd_timer_id_t id; snd_timer_t *timer; @@ -1344,7 +1344,7 @@ static int snd_timer_user_next_device(snd_timer_id_t *_tid) return 0; } -static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) +static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_ginfo) { snd_timer_ginfo_t ginfo; snd_timer_id_t tid; @@ -1382,7 +1382,7 @@ static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo) return err; } -static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gparams) +static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user *_gparams) { snd_timer_gparams_t gparams; snd_timer_t *t; @@ -1408,7 +1408,7 @@ static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gpara return err; } -static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstatus) +static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user *_gstatus) { snd_timer_gstatus_t gstatus; snd_timer_id_t tid; @@ -1437,12 +1437,12 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstat err = -ENODEV; } up(®ister_mutex); - if (err >= 0 && copy_from_user(_gstatus, &gstatus, sizeof(gstatus))) + if (err >= 0 && copy_to_user(_gstatus, &gstatus, sizeof(gstatus))) err = -EFAULT; return err; } -static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselect) +static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *_tselect) { snd_timer_user_t *tu; snd_timer_select_t tselect; @@ -1489,7 +1489,7 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselec return 0; } -static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info) +static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info) { snd_timer_user_t *tu; snd_timer_info_t info; @@ -1511,7 +1511,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info) return 0; } -static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params) +static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_params) { snd_timer_user_t *tu; snd_timer_params_t params; @@ -1603,7 +1603,7 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params) return err; } -static int snd_timer_user_status(struct file *file, snd_timer_status_t *_status) +static int snd_timer_user_status(struct file *file, snd_timer_status_t __user *_status) { snd_timer_user_t *tu; snd_timer_status_t status; @@ -1661,38 +1661,40 @@ static int snd_timer_user_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { snd_timer_user_t *tu; + void __user *argp = (void __user *)arg; + int __user *p = argp; tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO); switch (cmd) { case SNDRV_TIMER_IOCTL_PVERSION: - return put_user(SNDRV_TIMER_VERSION, (int *)arg) ? -EFAULT : 0; + return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0; case SNDRV_TIMER_IOCTL_NEXT_DEVICE: - return snd_timer_user_next_device((snd_timer_id_t *)arg); + return snd_timer_user_next_device(argp); case SNDRV_TIMER_IOCTL_TREAD: { int xarg; if (tu->timeri) /* too late */ return -EBUSY; - if (get_user(xarg, (int *) arg)) + if (get_user(xarg, p)) return -EFAULT; tu->tread = xarg ? 1 : 0; return 0; } case SNDRV_TIMER_IOCTL_GINFO: - return snd_timer_user_ginfo(file, (snd_timer_ginfo_t *)arg); + return snd_timer_user_ginfo(file, argp); case SNDRV_TIMER_IOCTL_GPARAMS: - return snd_timer_user_gparams(file, (snd_timer_gparams_t *)arg); + return snd_timer_user_gparams(file, argp); case SNDRV_TIMER_IOCTL_GSTATUS: - return snd_timer_user_gstatus(file, (snd_timer_gstatus_t *)arg); + return snd_timer_user_gstatus(file, argp); case SNDRV_TIMER_IOCTL_SELECT: - return snd_timer_user_tselect(file, (snd_timer_select_t *)arg); + return snd_timer_user_tselect(file, argp); case SNDRV_TIMER_IOCTL_INFO: - return snd_timer_user_info(file, (snd_timer_info_t *)arg); + return snd_timer_user_info(file, argp); case SNDRV_TIMER_IOCTL_PARAMS: - return snd_timer_user_params(file, (snd_timer_params_t *)arg); + return snd_timer_user_params(file, argp); case SNDRV_TIMER_IOCTL_STATUS: - return snd_timer_user_status(file, (snd_timer_status_t *)arg); + return snd_timer_user_status(file, argp); case SNDRV_TIMER_IOCTL_START: return snd_timer_user_start(file); case SNDRV_TIMER_IOCTL_STOP: @@ -1715,7 +1717,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on) return 0; } -static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count, loff_t *offset) +static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) { snd_timer_user_t *tu; long result = 0, unit; diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index dac8fb1d7..4b0025030 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -52,9 +52,6 @@ static int acpipnp[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 }; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ -#ifdef CONFIG_X86_PC9800 -static int pc98ii[SNDRV_CARDS]; /* PC98-II dauther board */ -#endif static int boot_devs; module_param_array(index, int, boot_devs, 0444); @@ -77,11 +74,6 @@ MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC); module_param_array(irq, int, boot_devs, 0444); MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC); -#ifdef CONFIG_X86_PC9800 -module_param_array(pc98ii, bool, boot_devs, 0444); -MODULE_PARM_DESC(pc98ii, "Roland MPU-PC98II support."); -MODULE_PARM_SYNTAX(pc98ii, SNDRV_BOOLEAN_FALSE_DESC); -#endif #ifndef CONFIG_ACPI_BUS struct acpi_device; @@ -188,9 +180,6 @@ static int __devinit snd_card_mpu401_probe(int dev, struct acpi_device *device) } #endif if (snd_mpu401_uart_new(card, 0, -#ifdef CONFIG_X86_PC9800 - pc98ii[dev] ? MPU401_HW_PC98II : -#endif MPU401_HW_MPU401, port[dev], 0, irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) { diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index e3fa31d4d..965ffd050 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c @@ -415,26 +415,6 @@ int snd_opl3_create(snd_card_t * card, case OPL3_HW_OPL3_CS: case OPL3_HW_OPL3_FM801: opl3->command = &snd_opl3_command; - break; - case OPL3_HW_OPL3_PC98: - opl3->command = &snd_opl3_command; - - /* Initialize? */ - opl3->command(opl3, OPL3_RIGHT | 0x05, 0x05); - opl3->command(opl3, OPL3_RIGHT | 0x08, 0x04); - opl3->command(opl3, OPL3_RIGHT | 0x08, 0x00); - opl3->command(opl3, OPL3_LEFT | 0xf7, 0x00); - opl3->command(opl3, OPL3_LEFT | 0x04, 0x60); - opl3->command(opl3, OPL3_LEFT | 0x04, 0x80); - inb(opl3->l_port); - - opl3->command(opl3, OPL3_LEFT | 0x02, 0xff); - opl3->command(opl3, OPL3_LEFT | 0x04, 0x21); - inb(opl3->l_port); - - opl3->command(opl3, OPL3_LEFT | 0x04, 0x60); - opl3->command(opl3, OPL3_LEFT | 0x04, 0x80); - break; case OPL3_HW_OPL3_CS4281: opl3->command = &snd_opl3_cs4281_command; diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index bd39864db..1e6472e3b 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c @@ -94,6 +94,7 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsigned long arg) { opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO); + void __user *argp = (void __user *)arg; snd_assert(opl3 != NULL, return -EINVAL); @@ -105,7 +106,7 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, info.fm_mode = opl3->fm_mode; info.rhythm = opl3->rhythm; - if (copy_to_user((snd_dm_fm_info_t *) arg, &info, sizeof(snd_dm_fm_info_t))) + if (copy_to_user(argp, &info, sizeof(snd_dm_fm_info_t))) return -EFAULT; return 0; } @@ -123,7 +124,7 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, #endif { snd_dm_fm_note_t note; - if (copy_from_user(¬e, (snd_dm_fm_note_t *) arg, sizeof(snd_dm_fm_note_t))) + if (copy_from_user(¬e, argp, sizeof(snd_dm_fm_note_t))) return -EFAULT; return snd_opl3_play_note(opl3, ¬e); } @@ -134,7 +135,7 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, #endif { snd_dm_fm_voice_t voice; - if (copy_from_user(&voice, (snd_dm_fm_voice_t *) arg, sizeof(snd_dm_fm_voice_t))) + if (copy_from_user(&voice, argp, sizeof(snd_dm_fm_voice_t))) return -EFAULT; return snd_opl3_set_voice(opl3, &voice); } @@ -145,7 +146,7 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, #endif { snd_dm_fm_params_t params; - if (copy_from_user(¶ms, (snd_dm_fm_params_t *) arg, sizeof(snd_dm_fm_params_t))) + if (copy_from_user(¶ms, argp, sizeof(snd_dm_fm_params_t))) return -EFAULT; return snd_opl3_set_params(opl3, ¶ms); } diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c index 2b346d600..f2f364d15 100644 --- a/sound/drivers/opl4/opl4_proc.c +++ b/sound/drivers/opl4/opl4_proc.c @@ -50,7 +50,7 @@ static int snd_opl4_mem_proc_release(snd_info_entry_t *entry, } static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *_buf, long count) + struct file *file, char __user *_buf, long count) { opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); long size; @@ -76,7 +76,7 @@ static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_d } static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data, - struct file *file, const char *_buf, long count) + struct file *file, const char __user *_buf, long count) { opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); long size; diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 1f954b67a..04b2c3a13 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -51,16 +51,6 @@ config SND_CS4236 Say 'Y' or 'M' to include support for CS4235,CS4236,CS4237B,CS4238B,CS4239 chips from Cirrus Logic - Crystal Semiconductors. -config SND_PC98_CS4232 - tristate "NEC PC9800 CS4232 driver" - depends on SND && X86_PC9800 - select SND_OPL3_LIB - select SND_MPU401_UART - select SND_PCM - help - Say 'Y' or 'M' to include support for NEC PC-9801/PC-9821 on-board - soundchip based on CS4232. - config SND_ES968 tristate "Generic ESS ES968 driver" depends on SND && ISAPNP diff --git a/sound/isa/cs423x/Makefile b/sound/isa/cs423x/Makefile index cfc32c602..d2afaea30 100644 --- a/sound/isa/cs423x/Makefile +++ b/sound/isa/cs423x/Makefile @@ -8,7 +8,6 @@ snd-cs4236-lib-objs := cs4236_lib.o snd-cs4231-objs := cs4231.o snd-cs4232-objs := cs4232.o snd-cs4236-objs := cs4236.o -snd-pc98-cs4232-objs := pc98.o # Toplevel Module Dependency obj-$(CONFIG_SND_AZT2320) += snd-cs4231-lib.o @@ -22,6 +21,5 @@ obj-$(CONFIG_SND_INTERWAVE_STB) += snd-cs4231-lib.o obj-$(CONFIG_SND_OPTI92X_CS4231) += snd-cs4231-lib.o obj-$(CONFIG_SND_WAVEFRONT) += snd-cs4231-lib.o obj-$(CONFIG_SND_SSCAPE) += snd-cs4231-lib.o -obj-$(CONFIG_SND_PC98_CS4232) += snd-pc98-cs4232.o snd-cs4231-lib.o obj-m := $(sort $(obj-m)) diff --git a/sound/isa/gus/gus_dram.c b/sound/isa/gus/gus_dram.c index 44895d34f..0b73d4c5f 100644 --- a/sound/isa/gus/gus_dram.c +++ b/sound/isa/gus/gus_dram.c @@ -26,7 +26,7 @@ #include -static int snd_gus_dram_poke(snd_gus_card_t *gus, char *_buffer, +static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer, unsigned int address, unsigned int size) { unsigned long flags; @@ -57,13 +57,13 @@ static int snd_gus_dram_poke(snd_gus_card_t *gus, char *_buffer, } -int snd_gus_dram_write(snd_gus_card_t *gus, char *buffer, +int snd_gus_dram_write(snd_gus_card_t *gus, char __user *buffer, unsigned int address, unsigned int size) { return snd_gus_dram_poke(gus, buffer, address, size); } -static int snd_gus_dram_peek(snd_gus_card_t *gus, char *_buffer, +static int snd_gus_dram_peek(snd_gus_card_t *gus, char __user *_buffer, unsigned int address, unsigned int size, int rom) { @@ -95,7 +95,7 @@ static int snd_gus_dram_peek(snd_gus_card_t *gus, char *_buffer, return 0; } -int snd_gus_dram_read(snd_gus_card_t *gus, char *buffer, +int snd_gus_dram_read(snd_gus_card_t *gus, char __user *buffer, unsigned int address, unsigned int size, int rom) { diff --git a/sound/isa/gus/gus_instr.c b/sound/isa/gus/gus_instr.c index 031a77978..e819e907b 100644 --- a/sound/isa/gus/gus_instr.c +++ b/sound/isa/gus/gus_instr.c @@ -29,7 +29,7 @@ */ int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -59,7 +59,7 @@ int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, } int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); @@ -82,7 +82,7 @@ int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, */ int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -110,7 +110,7 @@ int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, } int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); @@ -130,7 +130,7 @@ int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, */ int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); snd_gf1_mem_block_t *block; @@ -157,7 +157,7 @@ int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, } int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO); diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index 32f02ad50..95071a084 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c @@ -33,7 +33,7 @@ typedef struct gus_proc_private { } gus_proc_private_t; static long snd_gf1_mem_proc_dump(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; gus_proc_private_t *priv = snd_magic_cast(gus_proc_private_t, entry->private_data, return -ENXIO); diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index a0f96cd02..040804ca8 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -346,7 +346,7 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf, static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream, int voice, snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; diff --git a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c index 2590ababc..9ecd53c21 100644 --- a/sound/isa/sb/emu8000_patch.c +++ b/sound/isa/sb/emu8000_patch.c @@ -87,14 +87,14 @@ read_word(const void __user *buf, int offset, int mode) unsigned short c; if (mode & SNDRV_SFNT_SAMPLE_8BITS) { unsigned char cc; - get_user(cc, (unsigned char*)buf + offset); + get_user(cc, (unsigned char __user *)buf + offset); c = cc << 8; /* convert 8bit -> 16bit */ } else { #ifdef SNDRV_LITTLE_ENDIAN - get_user(c, (unsigned short*)buf + offset); + get_user(c, (unsigned short __user *)buf + offset); #else unsigned short cc; - get_user(cc, (unsigned short*)buf + offset); + get_user(cc, (unsigned short __user *)buf + offset); c = swab16(cc); #endif } diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index 51e4f20a1..4d84f2519 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c @@ -515,12 +515,12 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs, static int emu8k_pcm_copy(snd_pcm_substream_t *subs, int voice, snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { emu8k_pcm_t *rec = subs->runtime->private_data; emu8000_t *emu = rec->emu; - unsigned short *buf = src; + unsigned short __user *buf = src; snd_emu8000_write_wait(emu, 1); EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]); diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 80d576a68..6cbef4688 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -89,9 +89,9 @@ static int read_register(sb_t *chip, unsigned char reg); static int set_mode_register(sb_t *chip, unsigned char mode); static int get_version(sb_t *chip); -static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * code); +static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * code); static int snd_sb_csp_unload(snd_sb_csp_t * p); -static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size, int load_flags); +static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags); static int snd_sb_csp_autoload(snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); static int snd_sb_csp_check_version(snd_sb_csp_t * p); @@ -213,7 +213,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm info.run_width = p->run_width; info.version = p->version; info.state = p->running; - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) err = -EFAULT; else err = 0; @@ -222,7 +222,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm /* load CSP microcode */ case SNDRV_SB_CSP_IOCTL_LOAD_CODE: err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? - -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t *) arg)); + -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t __user *) arg)); break; case SNDRV_SB_CSP_IOCTL_UNLOAD_CODE: err = (p->running & SNDRV_SB_CSP_ST_RUNNING ? @@ -231,7 +231,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm /* change CSP running state */ case SNDRV_SB_CSP_IOCTL_START: - if (copy_from_user(&start_info, (void *) arg, sizeof(start_info))) + if (copy_from_user(&start_info, (void __user *) arg, sizeof(start_info))) err = -EFAULT; else err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels); @@ -297,11 +297,12 @@ static int snd_sb_csp_unuse(snd_sb_csp_t * p) * load microcode via ioctl: * code is user-space pointer */ -static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode) +static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * mcode) { snd_sb_csp_mc_header_t info; - unsigned char *data_ptr, *data_end; + unsigned char __user *data_ptr; + unsigned char __user *data_end; unsigned short func_nr = 0; riff_header_t file_h, item_h, code_h; @@ -372,8 +373,8 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode if (code_h.name != INIT_HEADER) break; data_ptr += sizeof(code_h); - err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len), - SNDRV_SB_CSP_LOAD_INITBLOCK | SNDRV_SB_CSP_LOAD_FROMUSER); + err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), + SNDRV_SB_CSP_LOAD_INITBLOCK); if (err) return err; data_ptr += LE_INT(code_h.len); @@ -387,8 +388,8 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode return -EINVAL; } data_ptr += sizeof(code_h); - err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len), - SNDRV_SB_CSP_LOAD_FROMUSER); + err = snd_sb_csp_load_user(p, data_ptr, + LE_INT(code_h.len), 0); if (err) return err; @@ -627,28 +628,10 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size, /* Send high byte */ snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8)); /* send microcode sequence */ - if (load_flags & SNDRV_SB_CSP_LOAD_FROMUSER) { - /* copy microcode from user space */ - unsigned char *kbuf, *_kbuf; - _kbuf = kbuf = kmalloc (size, GFP_KERNEL); - if (copy_from_user(kbuf, buf, size)) { - result = -EFAULT; - kfree (_kbuf); + /* load from kernel space */ + while (size--) { + if (!snd_sbdsp_command(p->chip, *buf++)) goto __fail; - } - while (size--) { - if (!snd_sbdsp_command(p->chip, *kbuf++)) { - kfree (_kbuf); - goto __fail; - } - } - kfree (_kbuf); - } else { - /* load from kernel space */ - while (size--) { - if (!snd_sbdsp_command(p->chip, *buf++)) - goto __fail; - } } if (snd_sbdsp_get_byte(p->chip)) goto __fail; @@ -692,6 +675,20 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size, spin_unlock_irqrestore(&p->chip->reg_lock, flags); return result; } + +static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags) +{ + int err = -ENOMEM; + unsigned char *kbuf = kmalloc(size, GFP_KERNEL); + if (kbuf) { + if (copy_from_user(kbuf, buf, size)) + err = -EFAULT; + else + err = snd_sb_csp_load(p, kbuf, size, load_flags); + kfree(kbuf); + } + return err; +} #include "sb16_csp_codecs.h" diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 29e9df772..c45061308 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -455,7 +455,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) * Upload a byte-stream into the SoundScape using DMA channel A. */ static int upload_dma_data(struct soundscape *s, - const unsigned char *data, + const unsigned char __user *data, size_t size) { unsigned long flags; @@ -569,7 +569,7 @@ static int upload_dma_data(struct soundscape *s, * However, we have already verified its memory * addresses by the time we get here. */ -static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock *bb) +static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock __user *bb) { unsigned long flags; int data = 0; @@ -604,10 +604,10 @@ static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_boot * SPACE, and save ourselves from copying it at all. */ static int sscape_upload_microcode(struct soundscape *sscape, - const struct sscape_microcode *mc) + const struct sscape_microcode __user *mc) { unsigned long flags; - char *code; + char __user *code; int err, ret; /* @@ -683,7 +683,7 @@ static int sscape_hw_ioctl(snd_hwdep_t * hw, struct file *file, switch (cmd) { case SND_SSCAPE_LOAD_BOOTB: { - register struct sscape_bootblock *bb = (struct sscape_bootblock *) arg; + register struct sscape_bootblock __user *bb = (struct sscape_bootblock __user *) arg; /* * We are going to have to copy this data into a special @@ -705,7 +705,7 @@ static int sscape_hw_ioctl(snd_hwdep_t * hw, struct file *file, case SND_SSCAPE_LOAD_MCODE: { - register const struct sscape_microcode *mc = (const struct sscape_microcode *) arg; + register const struct sscape_microcode __user *mc = (const struct sscape_microcode __user *) arg; err = sscape_upload_microcode(sscape, mc); } diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 01d6647c1..92d9c85a4 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -179,7 +179,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file, acard = card->private_data; dev = &acard->wavefront; - if (copy_from_user (&r, (unsigned char *) arg, sizeof (wavefront_fx_info))) + if (copy_from_user (&r, (void __user *)arg, sizeof (wavefront_fx_info))) return -EFAULT; switch (r.request) { @@ -201,7 +201,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file, return -EIO; } if (copy_from_user (page_data, - (unsigned char *) r.data[3], + (unsigned char __user *) r.data[3], r.data[2])) return -EFAULT; pd = page_data; diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index af561df2a..9b65db0b1 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -861,7 +861,7 @@ wavefront_freemem (snd_wavefront_t *dev) static int wavefront_send_sample (snd_wavefront_t *dev, wavefront_patch_info *header, - u16 *dataptr, + u16 __user *dataptr, int data_is_unsigned) { @@ -876,7 +876,7 @@ wavefront_send_sample (snd_wavefront_t *dev, u16 sample_short; u32 length; - u16 *data_end = 0; + u16 __user *data_end = 0; unsigned int i; const unsigned int max_blksize = 4096/2; unsigned int written; @@ -1355,7 +1355,7 @@ wavefront_find_free_patch (snd_wavefront_t *dev) #endif static int -wavefront_load_patch (snd_wavefront_t *dev, const char *addr) +wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr) { wavefront_patch_info header; @@ -1377,8 +1377,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr) switch (header.subkey) { case WF_ST_SAMPLE: /* sample or sample_header, based on patch->size */ - if (copy_from_user ((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.s, header.hdrptr, sizeof (wavefront_sample))) return -EFAULT; @@ -1386,8 +1385,7 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr) case WF_ST_MULTISAMPLE: - if (copy_from_user ((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.s, header.hdrptr, sizeof (wavefront_multisample))) return -EFAULT; @@ -1396,32 +1394,28 @@ wavefront_load_patch (snd_wavefront_t *dev, const char *addr) case WF_ST_ALIAS: - if (copy_from_user ((unsigned char *) &header.hdr.a, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.a, header.hdrptr, sizeof (wavefront_alias))) return -EFAULT; return wavefront_send_alias (dev, &header); case WF_ST_DRUM: - if (copy_from_user ((unsigned char *) &header.hdr.d, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.d, header.hdrptr, sizeof (wavefront_drum))) return -EFAULT; return wavefront_send_drum (dev, &header); case WF_ST_PATCH: - if (copy_from_user ((unsigned char *) &header.hdr.p, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.p, header.hdrptr, sizeof (wavefront_patch))) return -EFAULT; return wavefront_send_patch (dev, &header); case WF_ST_PROGRAM: - if (copy_from_user ((unsigned char *) &header.hdr.pr, - (unsigned char *) header.hdrptr, + if (copy_from_user (&header.hdr.pr, header.hdrptr, sizeof (wavefront_program))) return -EFAULT; @@ -1627,6 +1621,7 @@ snd_wavefront_synth_ioctl (snd_hwdep_t *hw, struct file *file, snd_wavefront_t *dev; snd_wavefront_card_t *acard; wavefront_control wc; + void __user *argp = (void __user *)arg; card = (snd_card_t *) hw->card; @@ -1639,18 +1634,18 @@ snd_wavefront_synth_ioctl (snd_hwdep_t *hw, struct file *file, switch (cmd) { case WFCTL_LOAD_SPP: - if (wavefront_load_patch (dev, (char *) arg) != 0) { + if (wavefront_load_patch (dev, argp) != 0) { return -EIO; } break; case WFCTL_WFCMD: - if (copy_from_user (&wc, (void *) arg, sizeof (wc))) + if (copy_from_user (&wc, argp, sizeof (wc))) return -EFAULT; if (wavefront_synth_control (acard, &wc) < 0) { return -EIO; } - if (copy_to_user ((void *) arg, &wc, sizeof (wc))) + if (copy_to_user (argp, &wc, sizeof (wc))) return -EFAULT; break; diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c index 98515fee5..89543f3a3 100644 --- a/sound/oss/ad1889.c +++ b/sound/oss/ad1889.c @@ -437,13 +437,13 @@ XXX /************************* /dev/dsp interfaces ************************* */ -static ssize_t ad1889_read(struct file *file, char *buffer, size_t count, +static ssize_t ad1889_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { return 0; } -static ssize_t ad1889_write(struct file *file, const char *buffer, size_t count, +static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; @@ -617,11 +617,12 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; struct dmabuf *dmabuf; audio_buf_info abinfo; + int __user *p = (int __user *)arg; switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: break; @@ -631,7 +632,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd case SNDCTL_DSP_SPEED: /* set sampling rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val > 5400 && val < 48000) { @@ -643,7 +644,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_STEREO: /* undocumented? */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { val = AD1889_READW(ad1889_dev, AD_DSWSMC); @@ -667,13 +668,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_GETBLKSIZE: - return put_user(DMA_SIZE, (int *)arg); + return put_user(DMA_SIZE, p); case SNDCTL_DSP_GETFMTS: - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) @@ -682,7 +683,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (file->f_mode & FMODE_WRITE) ad1889_set_wav_fmt(dev, val); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_CHANNELS: break; @@ -696,7 +697,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd case SNDCTL_DSP_SETFRAGMENT: /* not supported; uses fixed fragment sizes */ - return put_user(DMA_SIZE, (int *)arg); + return put_user(DMA_SIZE, p); case SNDCTL_DSP_GETOSPACE: case SNDCTL_DSP_GETISPACE: @@ -709,13 +710,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd abinfo.fragstotal = 1; abinfo.fragsize = DMA_SIZE; abinfo.bytes = DMA_SIZE; - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; return 0; case SNDCTL_DSP_GETCAPS: - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_GETTRIGGER: case SNDCTL_DSP_SETTRIGGER: @@ -732,7 +733,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd break; case SOUND_PCM_READ_RATE: - return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), (int *)arg); + return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), p); case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_BITS: diff --git a/sound/oss/ali5455.c b/sound/oss/ali5455.c index 8a905b3a7..3f3a456b3 100644 --- a/sound/oss/ali5455.c +++ b/sound/oss/ali5455.c @@ -1579,7 +1579,7 @@ static irqreturn_t ali_interrupt(int irq, void *dev_id, struct pt_regs *regs) waiting to be copied to the user's buffer. It is filled by the dma machine and drained by this loop. */ -static ssize_t ali_read(struct file *file, char *buffer, +static ssize_t ali_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct ali_state *state = (struct ali_state *) file->private_data; @@ -1721,7 +1721,7 @@ done: /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ static ssize_t ali_write(struct file *file, - const char *buffer, size_t count, loff_t * ppos) + const char __user *buffer, size_t count, loff_t * ppos) { struct ali_state *state = (struct ali_state *) file->private_data; struct ali_card *card = state ? state->card : 0; @@ -1981,16 +1981,19 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u unsigned int i_scr; int val = 0, ret; struct ac97_codec *codec = state->card->ac97_codec[0]; + void __user *argp = (void __user *)arg; + int __user *p = argp; + #ifdef DEBUG printk("ali_audio: ali_ioctl, arg=0x%x, cmd=", - arg ? *(int *) arg : 0); + arg ? *p : 0); #endif switch (cmd) { case OSS_GETVERSION: #ifdef DEBUG printk("OSS_GETVERSION\n"); #endif - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: #ifdef DEBUG printk("SNDCTL_DSP_RESET\n"); @@ -2058,7 +2061,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u #ifdef DEBUG printk("SNDCTL_DSP_SPEED\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_WRITE) { @@ -2136,7 +2139,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u spin_unlock_irqrestore(&state->card->lock, flags); } } - return put_user(dmabuf->rate, (int *) arg); + return put_user(dmabuf->rate, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ #ifdef DEBUG printk("SNDCTL_DSP_STEREO\n"); @@ -2153,7 +2156,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING) { stop_spdifout(state); } - return put_user(1, (int *) arg); + return put_user(1, p); case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { if (codec_independent_spdif_locked > 0) { @@ -2177,22 +2180,22 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u #ifdef DEBUG printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize); #endif - return put_user(dmabuf->userfragsize, (int *) arg); + return put_user(dmabuf->userfragsize, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format */ #ifdef DEBUG printk("SNDCTL_DSP_GETFMTS\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ #ifdef DEBUG printk("SNDCTL_DSP_SETFMT\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_CHANNELS: // add support 4,6 channel #ifdef DEBUG printk("SNDCTL_DSP_CHANNELS\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val > 0) { if (dmabuf->enable & DAC_RUNNING) { @@ -2208,7 +2211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u stop_adc(state); } } else { - return put_user(state->card->channels, (int *) arg); + return put_user(state->card->channels, p); } i_scr = inl(state->card->iobase + ALI_SCR); @@ -2243,7 +2246,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u val = ret; break; } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_POST: /* the user has sent all data and is notifying us */ /* we update the swptr to the end of the last sg segment then return */ #ifdef DEBUG @@ -2270,7 +2273,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u case SNDCTL_DSP_SUBDIVIDE: if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2281,7 +2284,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u dmabuf->ready = 0; return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; dmabuf->ossfragsize = 1 << (val & 0xffff); dmabuf->ossmaxfrags = (val >> 16) & 0xffff; @@ -2360,7 +2363,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2408,7 +2411,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) return -EINVAL; @@ -2425,7 +2428,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2447,7 +2450,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT: 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT: 0; case SNDCTL_DSP_NONBLOCK: #ifdef DEBUG printk("SNDCTL_DSP_NONBLOCK\n"); @@ -2459,15 +2462,15 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u printk("SNDCTL_DSP_GETCAPS\n"); #endif return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | - DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg); + DSP_CAP_MMAP | DSP_CAP_BIND, p); case SNDCTL_DSP_GETTRIGGER: val = 0; #ifdef DEBUG printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger); #endif - return put_user(dmabuf->trigger, (int *) arg); + return put_user(dmabuf->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; #if defined(DEBUG) || defined(DEBUG_MMAP) printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val); @@ -2586,27 +2589,27 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u #ifdef DEBUG printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count); #endif - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: #ifdef DEBUG printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate); #endif - return put_user(dmabuf->rate, (int *) arg); + return put_user(dmabuf->rate, p); case SOUND_PCM_READ_CHANNELS: #ifdef DEBUG printk("SOUND_PCM_READ_CHANNELS\n"); #endif - return put_user(2, (int *) arg); + return put_user(2, p); case SOUND_PCM_READ_BITS: #ifdef DEBUG printk("SOUND_PCM_READ_BITS\n"); #endif - return put_user(AFMT_S16_LE, (int *) arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETSPDIF: /* Set S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_SETSPDIF\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ if ((state->card->ac97_features & 4)) { @@ -2625,12 +2628,12 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u else printk(KERN_WARNING "ali_audio: S/PDIF transmitter not avalible.\n"); #endif - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETSPDIF: /* Get S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_GETSPDIF\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ if (!(state->card->ac97_features & 4)) { @@ -2642,14 +2645,14 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u val = ali_ac97_get(codec, AC97_SPDIF_CONTROL); } - return put_user(val, (int *) arg); + return put_user(val, p); //end add support spdif out //add support 4,6 channel case SNDCTL_DSP_GETCHANNELMASK: #ifdef DEBUG printk("SNDCTL_DSP_GETCHANNELMASK\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; /* Based on AC'97 DAC support, not ICH hardware */ val = DSP_BIND_FRONT; @@ -2659,12 +2662,12 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u val |= DSP_BIND_SURR; if (state->card->ac97_features & 0x0140) val |= DSP_BIND_CENTER_LFE; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_BIND_CHANNEL: #ifdef DEBUG printk("SNDCTL_DSP_BIND_CHANNEL\n"); #endif - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val == DSP_BIND_QUERY) { val = DSP_BIND_FRONT; /* Always report this as being enabled */ @@ -2749,7 +2752,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u val &= ~DSP_BIND_CENTER_LFE; } } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: case SNDCTL_DSP_SETSYNCRO: diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index e53bd2629..f49a2dee4 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c @@ -3344,10 +3344,10 @@ readbuf_word(int pos) /* read from user buffer */ if (readbuf_flags & AWE_SAMPLE_8BITS) { unsigned char cc; - get_user(cc, (unsigned __user char*)(readbuf_addr + readbuf_offs + pos)); + get_user(cc, (unsigned char __user *)(readbuf_addr + readbuf_offs + pos)); c = (unsigned short)cc << 8; /* convert 8bit -> 16bit */ } else { - get_user(c, (unsigned __user short*)(readbuf_addr + readbuf_offs + pos * 2)); + get_user(c, (unsigned short __user *)(readbuf_addr + readbuf_offs + pos * 2)); } if (readbuf_flags & AWE_SAMPLE_UNSIGNED) c ^= 0x8000; /* unsigned -> signed */ diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index c8866da61..2a7ea80c5 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c @@ -327,6 +327,7 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file, { struct btaudio *bta = file->private_data; int ret,val=0,i=0; + void __user *argp = (void __user *)arg; if (cmd == SOUND_MIXER_INFO) { mixer_info info; @@ -334,7 +335,7 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file, strlcpy(info.id,"bt878",sizeof(info.id)); strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name)); info.modify_counter = bta->mixcount; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -343,16 +344,16 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file, memset(&info,0,sizeof(info)); strlcpy(info.id,"bt878",sizeof(info.id)-1); strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, (int __user *)argp); /* read */ if (_SIOC_DIR(cmd) & _SIOC_WRITE) - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; switch (cmd) { @@ -421,7 +422,7 @@ static int btaudio_mixer_ioctl(struct inode *inode, struct file *file, default: return -EINVAL; } - if (put_user(ret, (int *)arg)) + if (put_user(ret, (int __user *)argp)) return -EFAULT; return 0; } @@ -503,7 +504,7 @@ static int btaudio_dsp_release(struct inode *inode, struct file *file) return 0; } -static ssize_t btaudio_dsp_read(struct file *file, char *buffer, +static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer, size_t swcount, loff_t *ppos) { struct btaudio *bta = file->private_data; @@ -554,7 +555,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char *buffer, } else if (!bta->analog) { /* stereo => mono (digital audio) */ __s16 *src = (__s16*)(bta->buf_cpu + bta->read_offset); - __s16 *dst = (__s16*)(buffer + ret); + __s16 __user *dst = (__s16 __user *)(buffer + ret); __s16 avg; int n = ndst>>1; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { @@ -565,13 +566,13 @@ static ssize_t btaudio_dsp_read(struct file *file, char *buffer, for (; n; n--, dst++) { avg = (__s16)le16_to_cpu(*src) / 2; src++; avg += (__s16)le16_to_cpu(*src) / 2; src++; - __put_user(cpu_to_le16(avg),(__u16*)(dst)); + __put_user(cpu_to_le16(avg),dst); } } else if (8 == bta->bits) { /* copy + byte downsampling (audio A/D) */ __u8 *src = bta->buf_cpu + bta->read_offset; - __u8 *dst = buffer + ret; + __u8 __user *dst = buffer + ret; int n = ndst; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { if (0 == ret) @@ -579,12 +580,12 @@ static ssize_t btaudio_dsp_read(struct file *file, char *buffer, break; } for (; n; n--, src += (1 << bta->sampleshift), dst++) - __put_user(*src,(__u8*)(dst)); + __put_user(*src, dst); } else { /* copy + word downsampling (audio A/D) */ __u16 *src = (__u16*)(bta->buf_cpu + bta->read_offset); - __u16 *dst = (__u16*)(buffer + ret); + __u16 __user *dst = (__u16 __user *)(buffer + ret); int n = ndst>>1; if (0 != verify_area(VERIFY_WRITE,dst,ndst)) { if (0 == ret) @@ -592,7 +593,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char *buffer, break; } for (; n; n--, src += (1 << bta->sampleshift), dst++) - __put_user(*src,(__u16*)(dst)); + __put_user(*src, dst); } ret += ndst; @@ -609,7 +610,7 @@ static ssize_t btaudio_dsp_read(struct file *file, char *buffer, return ret; } -static ssize_t btaudio_dsp_write(struct file *file, const char *buffer, +static ssize_t btaudio_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { return -EINVAL; @@ -620,15 +621,17 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, { struct btaudio *bta = file->private_data; int s, i, ret, val = 0; + void __user *argp = (void __user *)arg; + int __user *p = argp; switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_GETCAPS: return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; if (bta->analog) { for (s = 0; s < 16; s++) @@ -656,14 +659,14 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, /* fall through */ case SOUND_PCM_READ_RATE: if (bta->analog) { - return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, (int*)arg); + return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, p); } else { - return put_user(bta->rate, (int*)arg); + return put_user(bta->rate, p); } case SNDCTL_DSP_STEREO: if (!bta->analog) { - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; bta->channels = (val > 0) ? 2 : 1; bta->sampleshift = (bta->channels == 2) ? 0 : 1; @@ -681,11 +684,11 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, "btaudio: stereo=0 channels=1\n"); } } - return put_user((bta->channels)-1, (int *)arg); + return put_user((bta->channels)-1, p); case SNDCTL_DSP_CHANNELS: if (!bta->analog) { - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; bta->channels = (val > 1) ? 2 : 1; bta->sampleshift = (bta->channels == 2) ? 0 : 1; @@ -696,16 +699,16 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, } /* fall through */ case SOUND_PCM_READ_CHANNELS: - return put_user(bta->channels, (int *)arg); + return put_user(bta->channels, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ if (bta->analog) - return put_user(AFMT_S16_LE|AFMT_S8, (int*)arg); + return put_user(AFMT_S16_LE|AFMT_S8, p); else - return put_user(AFMT_S16_LE, (int*)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int*)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (bta->analog) @@ -722,10 +725,10 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, if (debug) printk(KERN_DEBUG "btaudio: fmt: bits=%d\n",bta->bits); return put_user((bta->bits==16) ? AFMT_S16_LE : AFMT_S8, - (int*)arg); + p); break; case SOUND_PCM_READ_BITS: - return put_user(bta->bits, (int*)arg); + return put_user(bta->bits, p); case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -745,7 +748,7 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, if (0 != (ret = make_risc(bta))) return ret; } - return put_user(bta->block_bytes>>bta->sampleshift,(int*)arg); + return put_user(bta->block_bytes>>bta->sampleshift,p); case SNDCTL_DSP_SYNC: /* NOP */ @@ -764,7 +767,7 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file, "returns %d/%d/%d/%d\n", info.fragsize, info.fragstotal, info.bytes, info.fragments); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c index 42c904136..c0da38bcd 100644 --- a/sound/oss/cmpci.c +++ b/sound/oss/cmpci.c @@ -980,13 +980,13 @@ static void set_ac3(struct cm_state *s, unsigned rate) spin_unlock_irqrestore(&s->lock, flags); } -static int trans_ac3(struct cm_state *s, void *dest, const char *source, int size) +static int trans_ac3(struct cm_state *s, void *dest, const char __user *source, int size) { int i = size / 2; unsigned long data; unsigned short data16; unsigned long *dst = (unsigned long *) dest; - unsigned short *src = (unsigned short *)source; + unsigned short __user *src = (unsigned short __user *)source; int err; do { @@ -1639,6 +1639,8 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) unsigned long flags; int i, val, j; unsigned char l, r, rl, rr; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_INFO) { @@ -1647,7 +1649,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) strlcpy(info.id, "cmpci", sizeof(info.id)); strlcpy(info.name, "C-Media PCI", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -1656,50 +1658,50 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) memset(&info, 0, sizeof(info)); strlcpy(info.id, "cmpci", sizeof(info.id)); strlcpy(info.name, "C-Media cmpci", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ val = mixer_recmask(s); - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */ val = mixer_outmask(s); - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].rec) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_OUTMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].play) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(0, (int *)arg); + return put_user(0, p); default: i = _IOC_NR(cmd); @@ -1707,7 +1709,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) return -EINVAL; if (!volidx[i]) return -EINVAL; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -1715,7 +1717,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) s->mix.modcnt++; switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = generic_hweight32(val); for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { @@ -1734,7 +1736,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) return 0; case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (!(val & (1 << i))) @@ -1754,7 +1756,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; r = (val >> 8) & 0xff; @@ -1829,7 +1831,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) if (!volidx[i]) return -EINVAL; s->mix.vol[volidx[i]-1] = val; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); } } @@ -1914,7 +1916,7 @@ static int drain_dac(struct cm_state *s, int nonblock) /* --------------------------------------------------------------------- */ -static ssize_t cm_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cm_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cm_state *s = (struct cm_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1975,11 +1977,11 @@ static ssize_t cm_read(struct file *file, char *buffer, size_t count, loff_t *pp } if (s->status & DO_BIGENDIAN_R) { int i, err; - unsigned char *src, *dst; + unsigned char *src; + char __user *dst = buffer; unsigned char data[2]; src = (unsigned char *) (s->dma_adc.rawbuf + swptr); - dst = (unsigned char *) buffer; // copy left/right sample at one time for (i = 0; i < cnt / 2; i++) { data[0] = src[1]; @@ -2016,7 +2018,7 @@ out: return ret; } -static ssize_t cm_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cm_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cm_state *s = (struct cm_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2116,10 +2118,10 @@ static ssize_t cm_write(struct file *file, const char *buffer, size_t count, lof swptr = (swptr + 2 * cnt) % s->dma_dac.dmasize; } else if ((s->status & DO_DUAL_DAC) && (s->status & DO_BIGENDIAN_W)) { int i, err; - unsigned char *src, *dst0, *dst1; + const char __user *src = buffer; + unsigned char *dst0, *dst1; unsigned char data[8]; - src = (unsigned char *) buffer; dst0 = (unsigned char *) (s->dma_dac.rawbuf + swptr); dst1 = (unsigned char *) (s->dma_adc.rawbuf + swptr); // copy left/right sample at one time @@ -2170,9 +2172,9 @@ static ssize_t cm_write(struct file *file, const char *buffer, size_t count, lof swptr = (swptr + cnt) % s->dma_dac.dmasize; } else if (s->status & DO_DUAL_DAC) { int i, err; - unsigned long *src, *dst0, *dst1; + unsigned long __user *src = (unsigned long __user *) buffer; + unsigned long *dst0, *dst1; - src = (unsigned long *) buffer; dst0 = (unsigned long *) (s->dma_dac.rawbuf + swptr); dst1 = (unsigned long *) (s->dma_adc.rawbuf + swptr); // copy left/right sample at one time @@ -2189,10 +2191,10 @@ static ssize_t cm_write(struct file *file, const char *buffer, size_t count, lof swptr = (swptr + cnt) % s->dma_dac.dmasize; } else if (s->status & DO_BIGENDIAN_W) { int i, err; - unsigned char *src, *dst; + const char __user *src = buffer; + unsigned char *dst; unsigned char data[2]; - src = (unsigned char *) buffer; dst = (unsigned char *) (s->dma_dac.rawbuf + swptr); // swap hi/lo bytes for each sample for (i = 0; i < cnt / 2; i++) { @@ -2330,13 +2332,15 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -2347,7 +2351,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -2365,7 +2369,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2383,10 +2387,10 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -2417,7 +2421,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -2449,18 +2453,18 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if ((s->capability & CAN_MULTI_CH) && (file->f_mode & FMODE_WRITE)) { val = set_dac_channels(s, val); - return put_user(val, (int *)arg); + return put_user(val, p); } } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) - : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg); + : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ return put_user(AFMT_S16_BE|AFMT_S16_LE|AFMT_U8| - ((s->capability & CAN_AC3) ? AFMT_AC3 : 0), (int *)arg); + ((s->capability & CAN_AC3) ? AFMT_AC3 : 0), p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -2503,9 +2507,9 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } set_fmt(s, fmtm, fmtd); } - if (s->status & DO_AC3) return put_user(AFMT_AC3, (int *)arg); + if (s->status & DO_AC3) return put_user(AFMT_AC3, p); return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) - : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? val : AFMT_U8, (int *)arg); + : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? val : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -2517,16 +2521,16 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un (s->enable & ENDAC) && (s->enable & ENADC)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); } if (file->f_mode & FMODE_READ && s->enable & ENADC) val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->enable & ENDAC) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -2568,7 +2572,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2582,7 +2586,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2595,7 +2599,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un cm_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2608,7 +2612,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2625,7 +2629,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un s->dma_adc.count &= s->dma_adc.fragsize-1; } spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { @@ -2634,16 +2638,16 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->status & DO_DUAL_DAC) { if ((val = prog_dmabuf(s, 1))) return val; - return put_user(2 * s->dma_dac.fragsize, (int *)arg); + return put_user(2 * s->dma_dac.fragsize, p); } - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -2675,7 +2679,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2689,22 +2693,22 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg); + return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, (int *)arg); + return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, p); case SOUND_PCM_READ_FILTER: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_GETCHANNELMASK: - return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, (int *)arg); + return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, p); case SNDCTL_DSP_BIND_CHANNEL: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val == DSP_BIND_QUERY) { val = DSP_BIND_FRONT; @@ -2757,7 +2761,7 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } } } - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_MAPINBUF: @@ -2765,47 +2769,47 @@ static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un case SNDCTL_DSP_SETSYNCRO: return -EINVAL; case SNDCTL_SPDIF_COPYRIGHT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_copyright(s, val); return 0; case SNDCTL_SPDIF_LOOP: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_loop(s, val); return 0; case SNDCTL_SPDIF_MONITOR: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdif_monitor(s, val); return 0; case SNDCTL_SPDIF_LEVEL: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifout_level(s, val); return 0; case SNDCTL_SPDIF_INV: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_inverse(s, val); return 0; case SNDCTL_SPDIF_SEL2: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_channel2(s, val); return 0; case SNDCTL_SPDIF_VALID: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin_valid(s, val); return 0; case SNDCTL_SPDIFOUT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifout(s, val ? s->ratedac : 0); return 0; case SNDCTL_SPDIFIN: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_spdifin(s, val ? s->rateadc : 0); return 0; @@ -3276,7 +3280,7 @@ MODULE_AUTHOR("ChenLi Tien, cltien@cmedia.com.tw"); MODULE_DESCRIPTION("CM8x38 Audio Driver"); MODULE_LICENSE("GPL"); -static void __devinit cm_remove(struct pci_dev *dev) +static void __devexit cm_remove(struct pci_dev *dev) { struct cm_state *s = pci_get_drvdata(dev); @@ -3333,7 +3337,7 @@ static struct pci_driver cm_driver = { .name = "cmpci", .id_table = id_table, .probe = cm_probe, - .remove = cm_remove + .remove = __devexit_p(cm_remove) }; static int __init init_cmpci(void) diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c index 2f38ae7c8..c2b496e34 100644 --- a/sound/oss/cs4281/cs4281m.c +++ b/sound/oss/cs4281/cs4281m.c @@ -1694,7 +1694,7 @@ static void start_adc(struct cs4281_state *s) #define DMABUF_MINORDER 1 // ==> min buffer size = 8K. -extern void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db) +void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db) { struct page *map, *mapend; @@ -2148,6 +2148,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, SOUND_MASK_MIC, SOUND_MASK_CD, 0, SOUND_MASK_LINE1, SOUND_MASK_LINE, SOUND_MASK_VOLUME, 0, 0 }; + void __user *argp = (void __user *)arg; // Index of mixtable1[] member is Device ID // and must be <= SOUND_MIXER_NRDEVICES. @@ -2195,26 +2196,26 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, case SOUND_MIXER_CS_GETDBGMASK: return put_user(cs_debugmask, - (unsigned long *) arg); + (unsigned long __user *) argp); case SOUND_MIXER_CS_GETDBGLEVEL: return put_user(cs_debuglevel, - (unsigned long *) arg); + (unsigned long __user *) argp); case SOUND_MIXER_CS_SETDBGMASK: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; cs_debugmask = val; return 0; case SOUND_MIXER_CS_SETDBGLEVEL: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; cs_debuglevel = val; return 0; #ifndef NOT_CS4281_PM case SOUND_MIXER_CS_APM: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, (unsigned long __user *) argp)) return -EFAULT; if(val == CS_IOCTL_CMD_SUSPEND) cs4281_suspend(s); @@ -2238,7 +2239,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, if (cmd == SOUND_MIXER_PRIVATE1) { // enable/disable/query mixer preamp - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *) argp)) return -EFAULT; if (val != -1) { cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1); @@ -2247,11 +2248,11 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, } cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1); val = (temp1 & 0x40) ? 1 : 0; - return put_user(val, (int *) arg); + return put_user(val, (int __user *) argp); } if (cmd == SOUND_MIXER_PRIVATE2) { // enable/disable/query spatializer - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; if (val != -1) { temp1 = (val & 0x3f) >> 2; @@ -2262,14 +2263,14 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, temp1 | 0x2000); } cs4281_read_ac97(s, BA0_AC97_3D_CONTROL, &temp1); - return put_user((temp1 << 2) | 3, (int *) arg); + return put_user((temp1 << 2) | 3, (int __user *)argp); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strlcpy(info.id, "CS4281", sizeof(info.id)); strlcpy(info.name, "Crystal CS4281", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -2277,12 +2278,12 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, _old_mixer_info info; strlcpy(info.id, "CS4281", sizeof(info.id)); strlcpy(info.name, "Crystal CS4281", sizeof(info.name)); - if (copy_to_user((void *) arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, (int __user *) argp); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; @@ -2292,9 +2293,8 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source - cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, - &temp1); - return put_user(mixer_src[temp1 & 7], (int *) arg); + cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, &temp1); + return put_user(mixer_src[temp1&7], (int __user *)argp); case SOUND_MIXER_DEVMASK: // Arg contains a bit for each supported device return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | @@ -2302,29 +2302,29 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | SOUND_MASK_RECLEV | - SOUND_MASK_SPEAKER, (int *) arg); + SOUND_MASK_SPEAKER, (int __user *)argp); case SOUND_MIXER_RECMASK: // Arg contains a bit for each supported recording source return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME | - SOUND_MASK_LINE1, (int *) arg); + SOUND_MASK_LINE1, (int __user *) argp); case SOUND_MIXER_STEREODEVS: // Mixer channels supporting stereo return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | - SOUND_MASK_RECLEV, (int *) arg); + SOUND_MASK_RECLEV, (int __user *)argp); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *) arg); + return put_user(SOUND_CAP_EXCL_INPUT, (int __user *)argp); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - return put_user(s->mix.vol[vidx - 1], (int *) arg); + return put_user(s->mix.vol[vidx - 1], (int __user *)argp); } } // If ioctl doesn't have both the SIOC_READ and @@ -2339,7 +2339,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; i = hweight32(val); // i = # bits on in val. if (i != 1) // One & only 1 bit must be on. @@ -2356,7 +2356,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, return 0; case SOUND_MIXER_VOLUME: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2391,10 +2391,10 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, #else s->mix.vol[8] = val; #endif - return put_user(s->mix.vol[8], (int *) arg); + return put_user(s->mix.vol[8], (int __user *)argp); case SOUND_MIXER_SPEAKER: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2421,10 +2421,10 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, #else s->mix.vol[6] = val; #endif - return put_user(s->mix.vol[6], (int *) arg); + return put_user(s->mix.vol[6], (int __user *)argp); case SOUND_MIXER_RECLEV: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2447,10 +2447,10 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, #else s->mix.vol[7] = val; #endif - return put_user(s->mix.vol[7], (int *) arg); + return put_user(s->mix.vol[7], (int __user *)argp); case SOUND_MIXER_MIC: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2477,16 +2477,16 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, #else s->mix.vol[5] = val; #endif - return put_user(s->mix.vol[5], (int *) arg); + return put_user(s->mix.vol[5], (int __user *)argp); case SOUND_MIXER_SYNTH: - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) l = 100; - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; r = (val >> 8) & 0xff; if (r > 100) @@ -2512,7 +2512,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, #else s->mix.vol[4] = val; #endif - return put_user(s->mix.vol[4], (int *) arg); + return put_user(s->mix.vol[4], (int __user *)argp); default: @@ -2522,7 +2522,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, (int __user *)argp)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -2558,7 +2558,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, "write ac97 mixreg[%d]=0x%x mix.vol[]=0x%x\n", vidx-1,temp1,s->mix.vol[vidx-1])); #endif - return put_user(s->mix.vol[vidx - 1], (int *) arg); + return put_user(s->mix.vol[vidx - 1], (int __user *)argp); } } @@ -2817,7 +2817,7 @@ static void CopySamples(char *dst, char *src, int count, int iChannels, // issues with 8 bit capture, so the driver always captures data in 16 bit // and then if the user requested 8 bit, converts from 16 to 8 bit. // -static unsigned cs_copy_to_user(struct cs4281_state *s, void *dest, +static unsigned cs_copy_to_user(struct cs4281_state *s, void __user *dest, unsigned *hwsrc, unsigned cnt, unsigned *copied) { @@ -2859,7 +2859,7 @@ static unsigned cs_copy_to_user(struct cs4281_state *s, void *dest, // --------------------------------------------------------------------- -static ssize_t cs4281_read(struct file *file, char *buffer, size_t count, +static ssize_t cs4281_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -2975,7 +2975,7 @@ static ssize_t cs4281_read(struct file *file, char *buffer, size_t count, } -static ssize_t cs4281_write(struct file *file, const char *buffer, +static ssize_t cs4281_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -3161,6 +3161,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, audio_buf_info abinfo; count_info cinfo; int val, mapped, ret; + int __user *p = (int __user *)arg; CS_DBGOUT(CS_FUNCTION, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): file=%p cmd=0x%.8x\n", file, cmd)); @@ -3175,7 +3176,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): SOUND_VERSION=0x%.8x\n", SOUND_VERSION)); - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3192,7 +3193,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_GETCAPS: return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, - (int *) arg); + p); case SNDCTL_DSP_RESET: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3216,7 +3217,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SPEED val=%d\n", val)); @@ -3257,10 +3258,10 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, else if (file->f_mode & FMODE_READ) val = s->prop_adc.rate; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_STEREO val=%d\n", val)); @@ -3279,7 +3280,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_CHANNELS val=%d\n", @@ -3310,7 +3311,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, else if (file->f_mode & FMODE_READ) val = s->prop_adc.channels; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETFMTS: // Returns a mask CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO @@ -3318,10 +3319,10 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | AFMT_U8)); return put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | - AFMT_U8, (int *) arg); + AFMT_U8, p); case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SETFMT val=0x%.8x\n", @@ -3358,7 +3359,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO "cs4281: cs4281_ioctl(): DSP_SETFMT return val=0x%.8x\n", val)); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_POST: CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO @@ -3371,10 +3372,10 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, val |= PCM_ENABLE_INPUT; if (file->f_mode & s->ena & FMODE_WRITE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -3416,7 +3417,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, abinfo.fragsize,abinfo.bytes,abinfo.fragstotal, abinfo.fragments)); spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: @@ -3440,7 +3441,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, abinfo.bytes >> s->dma_adc.fragshift; } spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *) arg, &abinfo, + return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: @@ -3456,7 +3457,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, cs4281_update_ptr(s,CS_FALSE); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -3489,7 +3490,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize - 1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -3515,7 +3516,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize - 1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -3523,18 +3524,17 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac(s))) return val; - return put_user(s->dma_dac.fragsize, (int *) arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; if (s->conversion) - return put_user(s->dma_adc.fragsize / 2, - (int *) arg); + return put_user(s->dma_adc.fragsize / 2, p); else - return put_user(s->dma_adc.fragsize, (int *) arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; return 0; // Say OK, but do nothing. @@ -3542,7 +3542,7 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -3554,15 +3554,15 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, case SOUND_PCM_READ_RATE: if (file->f_mode & FMODE_READ) - return put_user(s->prop_adc.rate, (int *) arg); + return put_user(s->prop_adc.rate, p); else if (file->f_mode & FMODE_WRITE) - return put_user(s->prop_dac.rate, (int *) arg); + return put_user(s->prop_dac.rate, p); case SOUND_PCM_READ_CHANNELS: if (file->f_mode & FMODE_READ) - return put_user(s->prop_adc.channels, (int *) arg); + return put_user(s->prop_adc.channels, p); else if (file->f_mode & FMODE_WRITE) - return put_user(s->prop_dac.channels, (int *) arg); + return put_user(s->prop_dac.channels, p); case SOUND_PCM_READ_BITS: if (file->f_mode & FMODE_READ) @@ -3570,13 +3570,13 @@ static int cs4281_ioctl(struct inode *inode, struct file *file, put_user( (s->prop_adc. fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16, - (int *) arg); + p); else if (file->f_mode & FMODE_WRITE) return put_user( (s->prop_dac. fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16, - (int *) arg); + p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -3831,7 +3831,7 @@ static void cs4281_midi_timer(unsigned long data) // --------------------------------------------------------------------- -static ssize_t cs4281_midi_read(struct file *file, char *buffer, +static ssize_t cs4281_midi_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = @@ -3879,7 +3879,7 @@ static ssize_t cs4281_midi_read(struct file *file, char *buffer, } -static ssize_t cs4281_midi_write(struct file *file, const char *buffer, +static ssize_t cs4281_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct cs4281_state *s = diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c index c50e45e58..60fc6c69f 100644 --- a/sound/oss/cs46xx.c +++ b/sound/oss/cs46xx.c @@ -1717,7 +1717,7 @@ static irqreturn_t cs_interrupt(int irq, void *dev_id, struct pt_regs *regs) /**********************************************************************/ -static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *)file->private_data; ssize_t ret; @@ -1762,7 +1762,7 @@ static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_ } -static ssize_t cs_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *)file->private_data; ssize_t ret; @@ -2037,7 +2037,7 @@ static void CopySamples(char *dst, char *src, int count, unsigned fmt, */ static unsigned cs_copy_to_user( struct cs_state *s, - void *dest, + void __user *dest, void *hwsrc, unsigned cnt, unsigned *copied) @@ -2046,8 +2046,8 @@ static unsigned cs_copy_to_user( void *src = hwsrc; /* default to the standard destination buffer addr */ CS_DBGOUT(CS_FUNCTION, 6, printk(KERN_INFO - "cs_copy_to_user()+ fmt=0x%x cnt=%d dest=0x%.8x\n", - dmabuf->fmt,(unsigned)cnt,(unsigned)dest) ); + "cs_copy_to_user()+ fmt=0x%x cnt=%d dest=%p\n", + dmabuf->fmt,(unsigned)cnt,dest) ); if(cnt > dmabuf->dmasize) { @@ -2074,8 +2074,8 @@ static unsigned cs_copy_to_user( if (copy_to_user(dest, src, cnt)) { CS_DBGOUT(CS_FUNCTION, 2, printk(KERN_ERR - "cs46xx: cs_copy_to_user()- fault dest=0x%x src=0x%x cnt=%d\n", - (unsigned)dest,(unsigned)src,cnt) ); + "cs46xx: cs_copy_to_user()- fault dest=%p src=%p cnt=%d\n", + dest,src,cnt) ); *copied = 0; return -EFAULT; } @@ -2087,7 +2087,7 @@ static unsigned cs_copy_to_user( /* in this loop, dmabuf.count signifies the amount of data that is waiting to be copied to the user's buffer. it is filled by the dma machine and drained by this loop. */ -static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *) file->private_data; struct cs_state *state; @@ -2165,8 +2165,8 @@ static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *pp CS_DBGOUT(CS_WAVE_READ, 2, printk(KERN_INFO "_read() copy_to cnt=%d count=%d ", cnt,count) ); CS_DBGOUT(CS_WAVE_READ, 8, printk(KERN_INFO - " .dmasize=%d .count=%d buffer=0x%.8x ret=%d\n", - dmabuf->dmasize,dmabuf->count,(unsigned)buffer,ret) ); + " .dmasize=%d .count=%d buffer=%p ret=%d\n", + dmabuf->dmasize,dmabuf->count,buffer,ret) ); if (cs_copy_to_user(state, buffer, (void *)((unsigned)dmabuf->rawbuf + swptr), cnt, &copied)) @@ -2196,7 +2196,7 @@ out2: /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ -static ssize_t cs_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t cs_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct cs_card *card = (struct cs_card *) file->private_data; struct cs_state *state; @@ -2486,6 +2486,8 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un audio_buf_info abinfo; count_info cinfo; int val, valsave, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; state = (struct cs_state *)card->states[0]; if(state) @@ -2507,7 +2509,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: /* FIXME: spin_lock ? */ @@ -2550,7 +2552,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_SPEED: /* set sample rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2582,12 +2584,12 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un file->f_mode & FMODE_WRITE ? "DAC" : "", file->f_mode & FMODE_READ ? "ADC" : "", dmabuf->rate ) ); - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { state = (struct cs_state *)card->states[1]; @@ -2637,7 +2639,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un dmabuf = &state->dmabuf; if ((val = prog_dmabuf(state))) return val; - return put_user(dmabuf->fragsize, (int *)arg); + return put_user(dmabuf->fragsize, p); } } if (file->f_mode & FMODE_READ) { @@ -2648,16 +2650,16 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if ((val = prog_dmabuf(state))) return val; return put_user(dmabuf->fragsize/dmabuf->divisor, - (int *)arg); + p); } } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ - return put_user(AFMT_S16_LE | AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE | AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk( "cs46xx: cs_ioctl() DSP_SETFMT %s %s %s %s\n", @@ -2730,14 +2732,14 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if(dmabuf) { if(dmabuf->fmt & CS_FMT_16BIT) - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); else - return put_user(AFMT_U8, (int *)arg); + return put_user(AFMT_U8, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_WRITE) { @@ -2776,7 +2778,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } } return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1, - (int *)arg); + p); case SNDCTL_DSP_POST: /* @@ -2793,7 +2795,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un dmabuf = &state->dmabuf; if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) return -EINVAL; @@ -2807,7 +2809,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un dmabuf = &state->dmabuf; if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) return -EINVAL; @@ -2817,7 +2819,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -2861,7 +2863,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; } return -ENODEV; @@ -2879,7 +2881,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; } return -ENODEV; @@ -2889,7 +2891,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un case SNDCTL_DSP_GETCAPS: return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP, - (int *)arg); + p); case SNDCTL_DSP_GETTRIGGER: val = 0; @@ -2915,10 +2917,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } } CS_DBGOUT(CS_IOCTL, 2, printk("cs46xx: DSP_GETTRIGGER()- val=0x%x\n",val) ); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { state = (struct cs_state *)card->states[0]; @@ -2961,7 +2963,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un cinfo.blocks = dmabuf->count/dmabuf->divisor >> dmabuf->fragshift; cinfo.ptr = dmabuf->hwptr/dmabuf->divisor; spin_unlock_irqrestore(&state->card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; } @@ -2996,7 +2998,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un "cs46xx: GETOPTR bytes=%d blocks=%d ptr=%d\n", cinfo.bytes,cinfo.blocks,cinfo.ptr) ); spin_unlock_irqrestore(&state->card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; } @@ -3019,7 +3021,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } else val = 0; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: if(file->f_mode & FMODE_READ) @@ -3029,9 +3031,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if(state) { dmabuf = &state->dmabuf; - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_PCM_READ_CHANNELS: @@ -3043,9 +3045,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un { dmabuf = &state->dmabuf; return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1, - (int *)arg); + p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_PCM_READ_BITS: if(file->f_mode & FMODE_READ) @@ -3056,10 +3058,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un { dmabuf = &state->dmabuf; return put_user((dmabuf->fmt & CS_FMT_16BIT) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); } - return put_user(0, (int *)arg); + return put_user(0, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: @@ -4164,6 +4166,7 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int struct ac97_codec *codec = (struct ac97_codec *)file->private_data; struct cs_card *card=NULL; struct list_head *entry; + unsigned long __user *p = (long __user *)arg; #if CSDEBUG_INTERFACE int val; @@ -4178,25 +4181,25 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int { case SOUND_MIXER_CS_GETDBGMASK: - return put_user(cs_debugmask, (unsigned long *)arg); + return put_user(cs_debugmask, p); case SOUND_MIXER_CS_GETDBGLEVEL: - return put_user(cs_debuglevel, (unsigned long *)arg); + return put_user(cs_debuglevel, p); case SOUND_MIXER_CS_SETDBGMASK: - if (get_user(val, (unsigned long *)arg)) + if (get_user(val, p)) return -EFAULT; cs_debugmask = val; return 0; case SOUND_MIXER_CS_SETDBGLEVEL: - if (get_user(val, (unsigned long *)arg)) + if (get_user(val, p)) return -EFAULT; cs_debuglevel = val; return 0; case SOUND_MIXER_CS_APM: - if (get_user(val, (unsigned long *) arg)) + if (get_user(val, p)) return -EFAULT; if(val == CS_IOCTL_CMD_SUSPEND) { diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index da681713e..fc19d664b 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index 42fae03b1..1aac3655d 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -50,7 +50,7 @@ static void calculate_ofrag(struct woinst *); static void calculate_ifrag(struct wiinst *); /* Audio file operations */ -static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos) +static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct wiinst *wiinst = wave_dev->wiinst; @@ -112,7 +112,7 @@ static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, || (bytestocopy >= count)) { bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy); + emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy); count -= bytestocopy; buffer += bytestocopy; @@ -137,7 +137,7 @@ static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, return ret; } -static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) +static ssize_t emu10k1_audio_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct woinst *woinst = wave_dev->woinst; @@ -212,7 +212,7 @@ static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy); + emu10k1_waveout_xferdata(woinst, (u8 __user *) buffer, &bytestocopy); count -= bytestocopy; buffer += bytestocopy * woinst->num_voices; @@ -254,6 +254,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned int val = 0; u32 bytestocopy; unsigned long flags; + int __user *p = (int __user *)arg; DPF(4, "emu10k1_audio_ioctl()\n"); @@ -266,7 +267,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned switch (cmd) { case OSS_GETVERSION: DPF(2, "OSS_GETVERSION:\n"); - return put_user(SOUND_VERSION, (int *) arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: DPF(2, "SNDCTL_DSP_RESET:\n"); @@ -352,11 +353,11 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned DPF(2, "SNDCTL_DSP_GETCAPS:\n"); return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | - DSP_CAP_COPROC| DSP_CAP_MULTI, (int *) arg); + DSP_CAP_COPROC| DSP_CAP_MULTI, p); case SNDCTL_DSP_SPEED: DPF(2, "SNDCTL_DSP_SPEED:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, "val is %d\n", val); @@ -402,21 +403,21 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned DPD(2, "set playback sampling rate -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.samplingrate; else if (file->f_mode & FMODE_WRITE) val = woinst->format.samplingrate; - return put_user(val, (int *) arg); + return put_user(val, p); } break; case SNDCTL_DSP_STEREO: DPF(2, "SNDCTL_DSP_STEREO:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -460,14 +461,14 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned DPD(2, "set playback stereo -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); break; case SNDCTL_DSP_CHANNELS: DPF(2, "SNDCTL_DSP_CHANNELS:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -510,14 +511,14 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned DPD(2, "set playback number of channels -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.channels; else if (file->f_mode & FMODE_WRITE) val = woinst->format.channels; - return put_user(val, (int *) arg); + return put_user(val, p); } break; @@ -533,12 +534,12 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned wave_dev->card->pt.enable_gpr_name) >= 0) val |= AFMT_AC3; } - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETFMT: /* Same as SNDCTL_DSP_SAMPLESIZE */ DPF(2, "SNDCTL_DSP_SETFMT:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, " val is %d\n", val); @@ -582,14 +583,14 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned DPD(2, "set playback format -> %d\n", val); } - return put_user(val, (int *) arg); + return put_user(val, p); } else { if (file->f_mode & FMODE_READ) val = wiinst->format.id; else if (file->f_mode & FMODE_WRITE) val = woinst->format.id; - return put_user(val, (int *) arg); + return put_user(val, p); } break; @@ -600,7 +601,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned else if (file->f_mode & FMODE_WRITE) val = woinst->format.bitsperchannel; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: @@ -609,7 +610,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned else if (file->f_mode & FMODE_WRITE) val = woinst->format.samplingrate; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_READ_CHANNELS: @@ -618,7 +619,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned else if (file->f_mode & FMODE_WRITE) val = woinst->format.channels; - return put_user(val, (int *) arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: DPF(2, "SOUND_PCM_WRITE_FILTER: not implemented\n"); @@ -641,12 +642,12 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned if (file->f_mode & FMODE_READ && (wave_dev->enablebits & PCM_ENABLE_INPUT)) val |= PCM_ENABLE_INPUT; - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: DPF(2, "SNDCTL_DSP_SETTRIGGER:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -708,7 +709,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned info.fragstotal = woinst->buffer.numfrags * woinst->num_voices; info.fragments = info.bytes / info.fragsize; - if (copy_to_user((int *) arg, &info, sizeof(info))) + if (copy_to_user(p, &info, sizeof(info))) return -EFAULT; } break; @@ -737,7 +738,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned info.fragments = info.bytes / wiinst->buffer.fragment_size; info.fragsize = wiinst->buffer.fragment_size; - if (copy_to_user((int *) arg, &info, sizeof(info))) + if (copy_to_user(p, &info, sizeof(info))) return -EFAULT; } break; @@ -765,7 +766,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned val *= woinst->num_voices; spin_unlock_irqrestore(&woinst->lock, flags); - return put_user(val, (int *) arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: { @@ -795,7 +796,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned spin_unlock_irqrestore(&wiinst->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; } break; @@ -841,7 +842,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned spin_unlock_irqrestore(&woinst->lock, flags); - if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(p, &cinfo, sizeof(cinfo))) return -EFAULT; } break; @@ -867,7 +868,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned spin_unlock_irqrestore(&wiinst->lock, flags); } - return put_user(val, (int *) arg); + return put_user(val, p); break; @@ -892,7 +893,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned case SNDCTL_DSP_SETFRAGMENT: DPF(2, "SNDCTL_DSP_SETFRAGMENT:\n"); - if (get_user(val, (int *) arg)) + if (get_user(val, p)) return -EFAULT; DPD(2, "val is %#x\n", val); @@ -930,7 +931,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned if (!buf) return -ENOMEM; - if (copy_from_user(buf, (copr_buffer *) arg, sizeof(copr_buffer))) { + if (copy_from_user(buf, p, sizeof(copr_buffer))) { kfree (buf); return -EFAULT; } @@ -969,7 +970,7 @@ static int emu10k1_audio_ioctl(struct inode *inode, struct file *file, unsigned for (i = 0; i < buf->len; i++) ((u32 *) buf->data)[i] = sblive_readptr(wave_dev->card, buf->offs + i, buf->flags); - if (copy_to_user((copr_buffer *) arg, buf, sizeof(copr_buffer))) { + if (copy_to_user(p, buf, sizeof(copr_buffer))) { kfree(buf); return -EFAULT; } diff --git a/sound/oss/emu10k1/cardwi.c b/sound/oss/emu10k1/cardwi.c index ce6f698f8..a6b0495eb 100644 --- a/sound/oss/emu10k1/cardwi.c +++ b/sound/oss/emu10k1/cardwi.c @@ -304,7 +304,7 @@ void emu10k1_wavein_getxfersize(struct wiinst *wiinst, u32 * size) } } -static void copy_block(u8 *dst, u8 * src, u32 str, u32 len, u8 cov) +static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) { if (cov == 1) __copy_to_user(dst, src + str, len); @@ -321,7 +321,7 @@ static void copy_block(u8 *dst, u8 * src, u32 str, u32 len, u8 cov) } } -void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size) +void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) { struct wavein_buffer *buffer = &wiinst->buffer; u32 sizetocopy, sizetocopy_now, start; diff --git a/sound/oss/emu10k1/cardwi.h b/sound/oss/emu10k1/cardwi.h index c08e53b0e..15cfb9b35 100644 --- a/sound/oss/emu10k1/cardwi.h +++ b/sound/oss/emu10k1/cardwi.h @@ -83,7 +83,7 @@ void emu10k1_wavein_close(struct emu10k1_wavedevice *); void emu10k1_wavein_start(struct emu10k1_wavedevice *); void emu10k1_wavein_stop(struct emu10k1_wavedevice *); void emu10k1_wavein_getxfersize(struct wiinst *, u32 *); -void emu10k1_wavein_xferdata(struct wiinst *, u8 *, u32 *); +void emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *); int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *); void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *); diff --git a/sound/oss/emu10k1/cardwo.c b/sound/oss/emu10k1/cardwo.c index 5cc3afa43..54daca4f5 100644 --- a/sound/oss/emu10k1/cardwo.c +++ b/sound/oss/emu10k1/cardwo.c @@ -417,7 +417,7 @@ void emu10k1_waveout_getxfersize(struct woinst *woinst, u32 *total_free_bytes) * Notice that the voice buffer is actually a set of disjointed memory pages. * */ -static void copy_block(void **dst, u32 str, u8 *src, u32 len) +static void copy_block(void **dst, u32 str, u8 __user *src, u32 len) { unsigned int pg; unsigned int pgoff; @@ -451,7 +451,7 @@ static void copy_block(void **dst, u32 str, u8 *src, u32 len) * Notice that the voice buffer is actually a set of disjointed memory pages. * */ -static void copy_ilv_block(struct woinst *woinst, u32 str, u8 *src, u32 len) +static void copy_ilv_block(struct woinst *woinst, u32 str, u8 __user *src, u32 len) { unsigned int pg; unsigned int pgoff; @@ -524,7 +524,7 @@ static void fill_block(struct woinst *woinst, u32 str, u8 data, u32 len) * previously added to the buffer are overwritten. * */ -void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size) +void emu10k1_waveout_xferdata(struct woinst *woinst, u8 __user *data, u32 *size) { struct waveout_buffer *buffer = &woinst->buffer; struct voice_mem *mem = &woinst->voice[0].mem; diff --git a/sound/oss/emu10k1/cardwo.h b/sound/oss/emu10k1/cardwo.h index 70eb9a3f7..1dece8853 100644 --- a/sound/oss/emu10k1/cardwo.h +++ b/sound/oss/emu10k1/cardwo.h @@ -82,7 +82,7 @@ void emu10k1_waveout_close(struct emu10k1_wavedevice *); void emu10k1_waveout_start(struct emu10k1_wavedevice *); void emu10k1_waveout_stop(struct emu10k1_wavedevice *); void emu10k1_waveout_getxfersize(struct woinst*, u32 *); -void emu10k1_waveout_xferdata(struct woinst*, u8*, u32 *); +void emu10k1_waveout_xferdata(struct woinst*, u8 __user *, u32 *); void emu10k1_waveout_fillsilence(struct woinst*); int emu10k1_waveout_setformat(struct emu10k1_wavedevice*, struct wave_format*); void emu10k1_waveout_update(struct woinst*); diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index 06a78997d..1aa768f2e 100644 --- a/sound/oss/emu10k1/midi.c +++ b/sound/oss/emu10k1/midi.c @@ -244,7 +244,7 @@ static int emu10k1_midi_release(struct inode *inode, struct file *file) return 0; } -static ssize_t emu10k1_midi_read(struct file *file, char *buffer, size_t count, loff_t * pos) +static ssize_t emu10k1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t * pos) { struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data; ssize_t ret = 0; @@ -319,7 +319,7 @@ static ssize_t emu10k1_midi_read(struct file *file, char *buffer, size_t count, return ret; } -static ssize_t emu10k1_midi_write(struct file *file, const char *buffer, size_t count, loff_t * pos) +static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t * pos) { struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data; struct midi_hdr *midihdr; diff --git a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c index bc252de3c..cbcaaa341 100644 --- a/sound/oss/emu10k1/mixer.c +++ b/sound/oss/emu10k1/mixer.c @@ -188,6 +188,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un u32 size, page; int addr, size_reg, i, ret; unsigned int id, ch; + void __user *argp = (void __user *)arg; switch (cmd) { @@ -197,7 +198,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un if (ctl == NULL) return -ENOMEM; - if (copy_from_user(ctl, (void *) arg, sizeof(struct mixer_private_ioctl))) { + if (copy_from_user(ctl, argp, sizeof(struct mixer_private_ioctl))) { kfree(ctl); return -EFAULT; } @@ -228,7 +229,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un case CMD_READFN0: ctl->val[2] = emu10k1_readfn0(card, ctl->val[0]); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -244,7 +245,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un ctl->val[2] = sblive_readptr(card, ctl->val[0], ctl->val[1]); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -282,7 +283,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un case CMD_GETRECSRC: ctl->val[0] = card->wavein.recsrc; ctl->val[1] = card->wavein.fxwc; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -297,7 +298,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un ctl->val[4] = card->waveout.send_routing[2]; ctl->val[5] = card->waveout.send_dcba[2]; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -320,7 +321,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un case CMD_GETPATCH: if (ctl->val[0] == 0) { - if (copy_to_user((void *) arg, &card->mgr.rpatch, sizeof(struct dsp_rpatch))) + if (copy_to_user(argp, &card->mgr.rpatch, sizeof(struct dsp_rpatch))) ret = -EFAULT; } else { if ((ctl->val[0] - 1) / PATCHES_PER_PAGE >= card->mgr.current_pages) { @@ -328,7 +329,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un break; } - if (copy_to_user((void *) arg, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch))) + if (copy_to_user(argp, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch))) ret = -EFAULT; } @@ -342,7 +343,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un break; } - if (copy_to_user((void *) arg, &card->mgr.gpr[id], sizeof(struct dsp_gpr))) + if (copy_to_user(argp, &card->mgr.gpr[id], sizeof(struct dsp_gpr))) ret = -EFAULT; break; @@ -351,7 +352,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un addr = emu10k1_find_control_gpr(&card->mgr, (char *) ctl->val, &((char *) ctl->val)[PATCH_NAME_SIZE]); ctl->val[0] = sblive_readptr(card, addr, 0); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -430,7 +431,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un ctl->val[2] = card->mgr.ctrl_gpr[id][ch]; - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -496,7 +497,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un if (card->is_audigy) ctl->val[4]=emu10k1_readfn0(card, 0x18); - if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl))) + if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl))) ret = -EFAULT; break; @@ -517,7 +518,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un case SOUND_MIXER_PRIVATE4: - if (copy_from_user(&size, (void *) arg, sizeof(size))) + if (copy_from_user(&size, argp, sizeof(size))) return -EFAULT; DPD(2, "External tram size %#x\n", size); @@ -581,7 +582,7 @@ static int emu10k1_dsp_mixer(struct emu10k1_card *card, unsigned int oss_mixer, card->ac97->modcnt++; - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; /* cleanse input a little */ @@ -634,7 +635,7 @@ static int emu10k1_mixer_ioctl(struct inode *inode, struct file *file, unsigned info.modify_counter = card->ac97->modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; diff --git a/sound/oss/emu10k1/passthrough.c b/sound/oss/emu10k1/passthrough.c index 805840eb1..4094be55f 100644 --- a/sound/oss/emu10k1/passthrough.c +++ b/sound/oss/emu10k1/passthrough.c @@ -131,7 +131,7 @@ int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev) return 0; } -ssize_t emu10k1_pt_write(struct file *file, const char *buffer, size_t count) +ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t count) { struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data; struct emu10k1_card *card = wave_dev->card; @@ -177,10 +177,9 @@ ssize_t emu10k1_pt_write(struct file *file, const char *buffer, size_t count) blocks = (count-bytes_copied)/PT_BLOCKSIZE; blocks_copied = 0; while (blocks > 0) { - u16 *bufptr = (u16 *) buffer + (bytes_copied/2); + u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); - bufptr = (u16 *) pt->buf; - r = pt_putblock(wave_dev, bufptr, nonblock); + r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); if (r) { if (bytes_copied) return bytes_copied; diff --git a/sound/oss/emu10k1/passthrough.h b/sound/oss/emu10k1/passthrough.h index 3c7855320..420cc9784 100644 --- a/sound/oss/emu10k1/passthrough.h +++ b/sound/oss/emu10k1/passthrough.h @@ -90,7 +90,7 @@ struct pt_data #define USE_PT_METHOD2 (card->is_audigy) #define USE_PT_METHOD1 !USE_PT_METHOD2 -ssize_t emu10k1_pt_write(struct file *file, const char *buf, size_t count); +ssize_t emu10k1_pt_write(struct file *file, const char __user *buf, size_t count); int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev); void emu10k1_pt_stop(struct emu10k1_card *card); diff --git a/sound/oss/es1370.c b/sound/oss/es1370.c index 4478d7dee..68189853a 100644 --- a/sound/oss/es1370.c +++ b/sound/oss/es1370.c @@ -845,21 +845,22 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a unsigned long flags; int i, val; unsigned char l, r, rl, rr; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { /* enable/disable/query mixer preamp */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { s->mix.micpreamp = !!val; wrcodec(s, 0x19, s->mix.micpreamp); } - return put_user(s->mix.micpreamp, (int *)arg); + return put_user(s->mix.micpreamp, p); } if (cmd == SOUND_MIXER_PRIVATE2) { /* enable/disable/query use of linein as second lineout */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { spin_lock_irqsave(&s->lock, flags); @@ -870,11 +871,11 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, (int *)arg); + return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, p); } if (cmd == SOUND_MIXER_PRIVATE3) { /* enable/disable/query microphone impedance setting */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { spin_lock_irqsave(&s->lock, flags); @@ -885,14 +886,14 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, (int *)arg); + return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, p); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strncpy(info.id, "ES1370", sizeof(info.id)); strncpy(info.name, "Ensoniq ES1370", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -900,49 +901,49 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a _old_mixer_info info; strncpy(info.id, "ES1370", sizeof(info.id)); strncpy(info.name, "Ensoniq ES1370", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(s->mix.recsrc, (int *)arg); + return put_user(s->mix.recsrc, p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ val = SOUND_MASK_IMIX; for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].avail) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].recmask) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].stereo) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(0, (int *)arg); + return put_user(0, p); case SOUND_MIXER_IMIX: - return put_user(s->mix.imix, (int *)arg); + return put_user(s->mix.imix, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail) return -EINVAL; - return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg); + return put_user(s->mix.vol[mixtable[i].volidx], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -951,13 +952,13 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a switch (_IOC_NR(cmd)) { case SOUND_MIXER_IMIX: - if (get_user(s->mix.imix, (int *)arg)) + if (get_user(s->mix.imix, p)) return -EFAULT; set_recsrc(s, s->mix.recsrc); return 0; case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; set_recsrc(s, val); return 0; @@ -966,7 +967,7 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -1015,7 +1016,7 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a #else s->mix.vol[mixtable[i].volidx] = val; #endif - return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg); + return put_user(s->mix.vol[mixtable[i].volidx], p); } } @@ -1136,7 +1137,7 @@ static int drain_dac2(struct es1370_state *s, int nonblock) /* --------------------------------------------------------------------- */ -static ssize_t es1370_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1214,7 +1215,7 @@ out: return ret; } -static ssize_t es1370_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1386,13 +1387,15 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd count_info cinfo; int count; int val, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1403,7 +1406,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1419,7 +1422,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (s->open_mode & (~file->f_mode) & (FMODE_READ|FMODE_WRITE)) @@ -1436,10 +1439,10 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg); + return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { stop_adc(s); @@ -1466,7 +1469,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_READ) { @@ -1492,13 +1495,13 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd spin_unlock_irqrestore(&s->lock, flags); } } - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (file->f_mode & FMODE_READ) { @@ -1525,7 +1528,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd } } return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1536,10 +1539,10 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1580,7 +1583,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd abinfo.fragstotal = s->dma_dac2.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1597,7 +1600,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1614,7 +1617,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1632,7 +1635,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1652,7 +1655,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1660,14 +1663,14 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac2(s))) return val; - return put_user(s->dma_dac2.fragsize, (int *)arg); + return put_user(s->dma_dac2.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1695,7 +1698,7 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1706,15 +1709,15 @@ static int es1370_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SOUND_PCM_READ_RATE: - return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg); + return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p); case SOUND_PCM_READ_CHANNELS: return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? - 2 : 1, (int *)arg); + 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - 16 : 8, (int *)arg); + 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1828,7 +1831,7 @@ static /*const*/ struct file_operations es1370_audio_fops = { /* --------------------------------------------------------------------- */ -static ssize_t es1370_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1961,11 +1964,12 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int int count; unsigned ctrl; int val, ret; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/); @@ -1974,7 +1978,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int return -EINVAL; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: stop_dac1(s); @@ -1983,7 +1987,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_dac1(s); @@ -1996,10 +2000,10 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int outl(s->ctrl, s->io+ES1370_REG_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg); + return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_dac1(s); s->dma_dac1.ready = 0; @@ -2013,7 +2017,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (s->dma_dac1.mapped) @@ -2028,13 +2032,13 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_dac1(s); @@ -2047,16 +2051,16 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; case SNDCTL_DSP_GETTRIGGER: - return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg); + return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val & PCM_ENABLE_OUTPUT) { if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s))) @@ -2082,7 +2086,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int abinfo.fragstotal = s->dma_dac1.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2097,7 +2101,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETOPTR: if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0) @@ -2113,17 +2117,17 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: if ((val = prog_dmabuf_dac1(s))) return val; - return put_user(s->dma_dac1.fragsize, (int *)arg); + return put_user(s->dma_dac1.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; s->dma_dac1.ossfragshift = val & 0xffff; s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff; @@ -2138,7 +2142,7 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int case SNDCTL_DSP_SUBDIVIDE: if (s->dma_dac1.subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2146,13 +2150,13 @@ static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SOUND_PCM_READ_RATE: - return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg); + return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2251,7 +2255,7 @@ static /*const*/ struct file_operations es1370_dac_fops = { /* --------------------------------------------------------------------- */ -static ssize_t es1370_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2314,7 +2318,7 @@ static ssize_t es1370_midi_read(struct file *file, char *buffer, size_t count, l return ret; } -static ssize_t es1370_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1370_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1370_state *s = (struct es1370_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c index 3cc4fb2e7..7d1a108dd 100644 --- a/sound/oss/es1371.c +++ b/sound/oss/es1371.c @@ -1170,7 +1170,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon return 0; case SOUND_MIXER_WRITE_PCM: /* use SRC for PCM volume */ - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; right = ((val >> 8) & 0xff); left = (val & 0xff); @@ -1186,7 +1186,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon return 0; case SOUND_MIXER_READ_PCM: - return put_user(s->spdif_volume, (int *)arg); + return put_user(s->spdif_volume, (int __user *)arg); } return codec->mixer_ioctl(codec, cmd, arg); } @@ -1324,7 +1324,7 @@ static int drain_dac2(struct es1371_state *s, int nonblock) /* --------------------------------------------------------------------- */ -static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1403,7 +1403,7 @@ out2: return ret; } -static ssize_t es1371_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1578,13 +1578,15 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd count_info cinfo; int count; int val, mapped, ret; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1595,7 +1597,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1611,7 +1613,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1625,10 +1627,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd set_dac2_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { stop_adc(s); @@ -1655,7 +1657,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { if (file->f_mode & FMODE_READ) { @@ -1681,13 +1683,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd spin_unlock_irqrestore(&s->lock, flags); } } - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (file->f_mode & FMODE_READ) { @@ -1714,7 +1716,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd } } return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? - AFMT_S16_LE : AFMT_U8, (int *)arg); + AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1725,10 +1727,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1769,7 +1771,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd abinfo.fragstotal = s->dma_dac2.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1786,7 +1788,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1803,7 +1805,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1821,7 +1823,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1841,7 +1843,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1849,14 +1851,14 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac2(s))) return val; - return put_user(s->dma_dac2.fragsize, (int *)arg); + return put_user(s->dma_dac2.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1884,7 +1886,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1895,13 +1897,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2017,7 +2019,7 @@ static /*const*/ struct file_operations es1371_audio_fops = { /* --------------------------------------------------------------------- */ -static ssize_t es1371_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2149,11 +2151,12 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int count_info cinfo; int count; int val, ret; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/); @@ -2162,7 +2165,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int return -EINVAL; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: stop_dac1(s); @@ -2171,17 +2174,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_dac1(s); s->dma_dac1.ready = 0; set_dac1_rate(s, val); } - return put_user(s->dac1rate, (int *)arg); + return put_user(s->dac1rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_dac1(s); s->dma_dac1.ready = 0; @@ -2195,7 +2198,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { stop_dac1(s); @@ -2208,13 +2211,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_dac1(s); @@ -2227,16 +2230,16 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); spin_unlock_irqrestore(&s->lock, flags); } - return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; case SNDCTL_DSP_GETTRIGGER: - return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg); + return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val & PCM_ENABLE_OUTPUT) { if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s))) @@ -2262,7 +2265,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int abinfo.fragstotal = s->dma_dac1.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2277,7 +2280,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETOPTR: if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0) @@ -2293,17 +2296,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: if ((val = prog_dmabuf_dac1(s))) return val; - return put_user(s->dma_dac1.fragsize, (int *)arg); + return put_user(s->dma_dac1.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; s->dma_dac1.ossfragshift = val & 0xffff; s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff; @@ -2318,7 +2321,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int case SNDCTL_DSP_SUBDIVIDE: if (s->dma_dac1.subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2326,13 +2329,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int return 0; case SOUND_PCM_READ_RATE: - return put_user(s->dac1rate, (int *)arg); + return put_user(s->dac1rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p); case SOUND_PCM_READ_BITS: - return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg); + return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -2430,7 +2433,7 @@ static /*const*/ struct file_operations es1371_dac_fops = { /* --------------------------------------------------------------------- */ -static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2493,7 +2496,7 @@ static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, l return ret; } -static ssize_t es1371_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t es1371_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct es1371_state *s = (struct es1371_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c index cbd78ed95..b5096b5a4 100644 --- a/sound/oss/esssolo1.c +++ b/sound/oss/esssolo1.c @@ -694,37 +694,38 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar }; unsigned char l, r, rl, rr, vidx; int i, val; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { /* enable/disable/query mixer preamp */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { val = val ? 0xff : 0xf7; write_mixer(s, 0x7d, (read_mixer(s, 0x7d) | 0x08) & val); } val = (read_mixer(s, 0x7d) & 0x08) ? 1 : 0; - return put_user(val, (int *)arg); + return put_user(val, p); } if (cmd == SOUND_MIXER_PRIVATE2) { /* enable/disable/query spatializer */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != -1) { val &= 0x3f; write_mixer(s, 0x52, val); write_mixer(s, 0x50, val ? 0x08 : 0); } - return put_user(read_mixer(s, 0x52), (int *)arg); + return put_user(read_mixer(s, 0x52), p); } if (cmd == SOUND_MIXER_INFO) { mixer_info info; strncpy(info.id, "Solo1", sizeof(info.id)); strncpy(info.name, "ESS Solo1", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -732,41 +733,41 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar _old_mixer_info info; strncpy(info.id, "Solo1", sizeof(info.id)); strncpy(info.name, "ESS Solo1", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg); + return put_user(mixer_src[read_mixer(s, 0x1c) & 7], p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV | - SOUND_MASK_SPEAKER, (int *)arg); + SOUND_MASK_SPEAKER, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ - return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, (int *)arg); + return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC | - SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, (int *)arg); + SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, p); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); + return put_user(SOUND_CAP_EXCL_INPUT, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - return put_user(s->mix.vol[vidx-1], (int *)arg); + return put_user(s->mix.vol[vidx-1], p); } } if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) @@ -788,7 +789,7 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar 0xb4, read_ctrl(s, 0xb4)); } #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = hweight32(val); if (i == 0) @@ -805,7 +806,7 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar return 0; case SOUND_MIXER_VOLUME: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -834,10 +835,10 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar #else s->mix.vol[9] = val; #endif - return put_user(s->mix.vol[9], (int *)arg); + return put_user(s->mix.vol[9], p); case SOUND_MIXER_SPEAKER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; if (l > 100) @@ -852,10 +853,10 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar #else s->mix.vol[7] = val; #endif - return put_user(s->mix.vol[7], (int *)arg); + return put_user(s->mix.vol[7], p); case SOUND_MIXER_RECLEV: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = (val << 1) & 0x1fe; if (l > 200) @@ -877,13 +878,13 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar #else s->mix.vol[8] = val; #endif - return put_user(s->mix.vol[8], (int *)arg); + return put_user(s->mix.vol[8], p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = (val << 1) & 0x1fe; if (l > 200) @@ -905,7 +906,7 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar #else s->mix.vol[vidx-1] = val; #endif - return put_user(s->mix.vol[vidx-1], (int *)arg); + return put_user(s->mix.vol[vidx-1], p); } } @@ -999,7 +1000,7 @@ static int drain_dac(struct solo1_state *s, int nonblock) /* --------------------------------------------------------------------- */ -static ssize_t solo1_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1095,7 +1096,7 @@ static ssize_t solo1_read(struct file *file, char *buffer, size_t count, loff_t return ret; } -static ssize_t solo1_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1263,13 +1264,15 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, int val, mapped, ret, count; int div1, div2; unsigned rate1, rate2; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1280,7 +1283,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1297,7 +1300,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { stop_adc(s); @@ -1322,10 +1325,10 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, s->clkdiv = div1; prog_codec(s); } - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; stop_adc(s); stop_dac(s); @@ -1336,7 +1339,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { stop_adc(s); @@ -1346,13 +1349,13 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, s->channels = (val >= 2) ? 2 : 1; prog_codec(s); } - return put_user(s->channels, (int *)arg); + return put_user(s->channels, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { stop_adc(s); @@ -1365,7 +1368,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, s->fmt = val; prog_codec(s); } - return put_user(s->fmt, (int *)arg); + return put_user(s->fmt, p); case SNDCTL_DSP_POST: return 0; @@ -1376,10 +1379,10 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, val |= PCM_ENABLE_INPUT; if (file->f_mode & s->ena & FMODE_WRITE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1422,7 +1425,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1436,7 +1439,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1453,7 +1456,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1468,7 +1471,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1494,7 +1497,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, cinfo.bytes, cinfo.blocks, cinfo.ptr, s->dma_dac.buforder, s->dma_dac.numfrag, s->dma_dac.fragshift, s->dma_dac.swptr, s->dma_dac.count, s->dma_dac.fragsize, s->dma_dac.dmasize, s->dma_dac.fragsamples); #endif - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1502,14 +1505,14 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac(s))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf_adc(s))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1537,7 +1540,7 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1548,13 +1551,13 @@ static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return 0; case SOUND_PCM_READ_RATE: - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user(s->channels, (int *)arg); + return put_user(s->channels, p); case SOUND_PCM_READ_BITS: - return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, (int *)arg); + return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1727,7 +1730,7 @@ static void solo1_midi_timer(unsigned long data) /* --------------------------------------------------------------------- */ -static ssize_t solo1_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1790,7 +1793,7 @@ static ssize_t solo1_midi_read(struct file *file, char *buffer, size_t count, lo return ret; } -static ssize_t solo1_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t solo1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct solo1_state *s = (struct solo1_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2032,7 +2035,7 @@ static int solo1_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case FM_IOCTL_PLAY_NOTE: - if (copy_from_user(&n, (void *)arg, sizeof(n))) + if (copy_from_user(&n, (void __user *)arg, sizeof(n))) return -EFAULT; if (n.voice >= 18) return -EINVAL; @@ -2050,7 +2053,7 @@ static int solo1_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case FM_IOCTL_SET_VOICE: - if (copy_from_user(&v, (void *)arg, sizeof(v))) + if (copy_from_user(&v, (void __user *)arg, sizeof(v))) return -EFAULT; if (v.voice >= 18) return -EINVAL; @@ -2080,7 +2083,7 @@ static int solo1_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int return 0; case FM_IOCTL_SET_PARAMS: - if (copy_from_user(&p, (void *)arg, sizeof(p))) + if (copy_from_user(&p, (void __user *)arg, sizeof(p))) return -EFAULT; outb(0x08, s->sbbase); outb((p.kbd_split & 1) << 6, s->sbbase+1); diff --git a/sound/oss/forte.c b/sound/oss/forte.c index 06a31b765..c7e23fc3c 100644 --- a/sound/oss/forte.c +++ b/sound/oss/forte.c @@ -849,6 +849,8 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, struct forte_chip *chip; struct audio_buf_info abi; struct count_info cinfo; + void __user *argp = (void __user *)arg; + int __user *p = argp; chip = file->private_data; @@ -865,24 +867,24 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, switch (cmd) { case OSS_GETVERSION: - return put_user (SOUND_VERSION, (int *) arg); + return put_user (SOUND_VERSION, p); case SNDCTL_DSP_GETCAPS: DPRINTK ("%s: GETCAPS\n", __FUNCTION__); ival = FORTE_CAPS; /* DUPLEX */ - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_GETFMTS: DPRINTK ("%s: GETFMTS\n", __FUNCTION__); ival = FORTE_FMTS; /* U8, 16LE */ - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_SETFMT: /* U8, 16LE */ DPRINTK ("%s: SETFMT\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -899,12 +901,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_STEREO: /* 0 - mono, 1 - stereo */ DPRINTK ("%s: STEREO\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -921,12 +923,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_CHANNELS: /* 1 - mono, 2 - stereo */ DPRINTK ("%s: CHANNELS\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -943,12 +945,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (rval, (int *) arg); + return put_user (rval, p); case SNDCTL_DSP_SPEED: DPRINTK ("%s: SPEED\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -965,7 +967,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user(rval, (int*) arg); + return put_user(rval, p); case SNDCTL_DSP_GETBLKSIZE: DPRINTK ("%s: GETBLKSIZE\n", __FUNCTION__); @@ -980,7 +982,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_RESET: DPRINTK ("%s: RESET\n", __FUNCTION__); @@ -1022,7 +1024,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, case SNDCTL_DSP_SETFRAGMENT: DPRINTK ("%s: SETFRAGMENT\n", __FUNCTION__); - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; spin_lock_irq (&chip->lock); @@ -1041,7 +1043,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_GETISPACE: DPRINTK ("%s: GETISPACE\n", __FUNCTION__); @@ -1065,7 +1067,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0; + return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: DPRINTK ("%s: GETIPTR\n", __FUNCTION__); @@ -1086,7 +1088,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; + return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOSPACE: if (!wr) @@ -1114,7 +1116,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0; + return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!wr) @@ -1133,7 +1135,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; + return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETODELAY: if (!wr) @@ -1157,7 +1159,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irq (&chip->lock); - return put_user (ival, (int *) arg); + return put_user (ival, p); case SNDCTL_DSP_SETDUPLEX: DPRINTK ("%s: SETDUPLEX\n", __FUNCTION__); @@ -1167,11 +1169,11 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, case SNDCTL_DSP_GETTRIGGER: DPRINTK ("%s: GETTRIGGER\n", __FUNCTION__); - return put_user (chip->trigger, (int *) arg); + return put_user (chip->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user (ival, (int *) arg)) + if (get_user (ival, p)) return -EFAULT; DPRINTK ("%s: SETTRIGGER %d\n", __FUNCTION__, ival); @@ -1207,15 +1209,15 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, case SOUND_PCM_READ_RATE: DPRINTK ("%s: PCM_READ_RATE\n", __FUNCTION__); - return put_user (chip->play.rate, (int *) arg); + return put_user (chip->play.rate, p); case SOUND_PCM_READ_CHANNELS: DPRINTK ("%s: PCM_READ_CHANNELS\n", __FUNCTION__); - return put_user (chip->play.stereo, (int *) arg); + return put_user (chip->play.stereo, p); case SOUND_PCM_READ_BITS: DPRINTK ("%s: PCM_READ_BITS\n", __FUNCTION__); - return put_user (chip->play.format, (int *) arg); + return put_user (chip->play.format, p); case SNDCTL_DSP_NONBLOCK: DPRINTK ("%s: DSP_NONBLOCK\n", __FUNCTION__); @@ -1223,7 +1225,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, return 0; default: - DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, (void *) arg); + DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, argp); break; } @@ -1428,7 +1430,7 @@ forte_dsp_mmap (struct file *file, struct vm_area_struct *vma) */ static ssize_t -forte_dsp_write (struct file *file, const char *buffer, size_t bytes, +forte_dsp_write (struct file *file, const char __user *buffer, size_t bytes, loff_t *ppos) { struct forte_chip *chip; @@ -1536,7 +1538,7 @@ forte_dsp_write (struct file *file, const char *buffer, size_t bytes, */ static ssize_t -forte_dsp_read (struct file *file, char *buffer, size_t bytes, +forte_dsp_read (struct file *file, char __user *buffer, size_t bytes, loff_t *ppos) { struct forte_chip *chip; diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index c817b39ea..e4f8542b3 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c @@ -1393,7 +1393,7 @@ static irqreturn_t i810_interrupt(int irq, void *dev_id, struct pt_regs *regs) waiting to be copied to the user's buffer. It is filled by the dma machine and drained by this loop. */ -static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct i810_state *state = (struct i810_state *)file->private_data; struct i810_card *card=state ? state->card : 0; @@ -1533,7 +1533,7 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t * /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to the soundcard. it is drained by the dma machine and filled by this loop. */ -static ssize_t i810_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t i810_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct i810_state *state = (struct i810_state *)file->private_data; struct i810_card *card=state ? state->card : 0; @@ -1755,9 +1755,11 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned int i_glob_cnt; int val = 0, ret; struct ac97_codec *codec = state->card->ac97_codec[0]; + void __user *argp = (void __user *)arg; + int __user *p = argp; #ifdef DEBUG - printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *(int *)arg : 0); + printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *p : 0); #endif switch (cmd) @@ -1766,7 +1768,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, #ifdef DEBUG printk("OSS_GETVERSION\n"); #endif - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: #ifdef DEBUG @@ -1813,7 +1815,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, #ifdef DEBUG printk("SNDCTL_DSP_SPEED\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_WRITE) { @@ -1851,7 +1853,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, spin_unlock_irqrestore(&state->card->lock, flags); } } - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ #ifdef DEBUG @@ -1863,7 +1865,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (dmabuf->enable & ADC_RUNNING) { stop_adc(state); } - return put_user(1, (int *)arg); + return put_user(1, p); case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { @@ -1877,25 +1879,25 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, #ifdef DEBUG printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize); #endif - return put_user(dmabuf->userfragsize, (int *)arg); + return put_user(dmabuf->userfragsize, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ #ifdef DEBUG printk("SNDCTL_DSP_GETFMTS\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ #ifdef DEBUG printk("SNDCTL_DSP_SETFMT\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_CHANNELS: #ifdef DEBUG printk("SNDCTL_DSP_CHANNELS\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val > 0) { @@ -1906,13 +1908,13 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, stop_adc(state); } } else { - return put_user(state->card->channels, (int *)arg); + return put_user(state->card->channels, p); } /* ICH and ICH0 only support 2 channels */ if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AA_5 || state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AB_5) - return put_user(2, (int *)arg); + return put_user(2, p); /* Multi-channel support was added with ICH2. Bits in */ /* Global Status and Global Control register are now */ @@ -1957,7 +1959,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, break; } - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_POST: /* the user has sent all data and is notifying us */ /* we update the swptr to the end of the last sg segment then return */ @@ -1976,7 +1978,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, case SNDCTL_DSP_SUBDIVIDE: if (dmabuf->subdivision) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1988,7 +1990,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; dmabuf->ossfragsize = 1<<(val & 0xffff); @@ -2061,7 +2063,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, printk("SNDCTL_DSP_GETOSPACE %d, %d, %d, %d\n", abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: if (!(file->f_mode & FMODE_WRITE)) @@ -2083,7 +2085,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2100,7 +2102,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, printk("SNDCTL_DSP_GETISPACE %d, %d, %d, %d\n", abinfo.bytes, abinfo.fragsize, abinfo.fragments, abinfo.fragstotal); #endif - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2122,7 +2124,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes, cinfo.blocks, cinfo.ptr, dmabuf->count); #endif - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: #ifdef DEBUG @@ -2136,17 +2138,17 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, printk("SNDCTL_DSP_GETCAPS\n"); #endif return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP|DSP_CAP_BIND, - (int *)arg); + p); case SNDCTL_DSP_GETTRIGGER: val = 0; #ifdef DEBUG printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger); #endif - return put_user(dmabuf->trigger, (int *)arg); + return put_user(dmabuf->trigger, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; #if defined(DEBUG) || defined(DEBUG_MMAP) printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val); @@ -2223,31 +2225,31 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, #ifdef DEBUG printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count); #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_READ_RATE: #ifdef DEBUG printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate); #endif - return put_user(dmabuf->rate, (int *)arg); + return put_user(dmabuf->rate, p); case SOUND_PCM_READ_CHANNELS: #ifdef DEBUG printk("SOUND_PCM_READ_CHANNELS\n"); #endif - return put_user(2, (int *)arg); + return put_user(2, p); case SOUND_PCM_READ_BITS: #ifdef DEBUG printk("SOUND_PCM_READ_BITS\n"); #endif - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_SETSPDIF: /* Set S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_SETSPDIF\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ @@ -2270,13 +2272,13 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, else printk(KERN_WARNING "i810_audio: S/PDIF transmitter not avalible.\n"); #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETSPDIF: /* Get S/PDIF Control register */ #ifdef DEBUG printk("SNDCTL_DSP_GETSPDIF\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Check to make sure the codec supports S/PDIF transmitter */ @@ -2289,14 +2291,14 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, } else { val = i810_ac97_get(codec, AC97_SPDIF_CONTROL); } - //return put_user((val & 0xcfff), (int *)arg); - return put_user(val, (int *)arg); + //return put_user((val & 0xcfff), p); + return put_user(val, p); case SNDCTL_DSP_GETCHANNELMASK: #ifdef DEBUG printk("SNDCTL_DSP_GETCHANNELMASK\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; /* Based on AC'97 DAC support, not ICH hardware */ @@ -2309,13 +2311,13 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if ( state->card->ac97_features & 0x0140 ) val |= DSP_BIND_CENTER_LFE; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_BIND_CHANNEL: #ifdef DEBUG printk("SNDCTL_DSP_BIND_CHANNEL\n"); #endif - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if ( val == DSP_BIND_QUERY ) { val = DSP_BIND_FRONT; /* Always report this as being enabled */ @@ -2383,7 +2385,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, val &= ~DSP_BIND_CENTER_LFE; } } - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c index c09ea8827..2c0722525 100644 --- a/sound/oss/kahlua.c +++ b/sound/oss/kahlua.c @@ -218,7 +218,7 @@ static int __init kahlua_init_module(void) static void __devexit kahlua_cleanup_module(void) { - return pci_unregister_driver(&kahlua_driver); + pci_unregister_driver(&kahlua_driver); } diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c index 2b17c06f7..4a670f4e4 100644 --- a/sound/oss/maestro.c +++ b/sound/oss/maestro.c @@ -2025,7 +2025,9 @@ mixer_push_state(struct ess_card *card) static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long arg) { int i, val=0; - unsigned long flags; + unsigned long flags; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_CARD(card); if (cmd == SOUND_MIXER_INFO) { @@ -2034,7 +2036,7 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar strlcpy(info.id, card_names[card->card_type], sizeof(info.id)); strlcpy(info.name, card_names[card->card_type], sizeof(info.name)); info.modify_counter = card->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } @@ -2043,12 +2045,12 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar memset(&info, 0, sizeof(info)); strlcpy(info.id, card_names[card->card_type], sizeof(info.id)); strlcpy(info.name, card_names[card->card_type], sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) return -EINVAL; @@ -2098,7 +2100,7 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar break; } - return put_user(val,(int *)arg); + return put_user(val, p); } if (_IOC_DIR(cmd) != (_IOC_WRITE|_IOC_READ)) @@ -2106,7 +2108,7 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar card->mix.modcnt++; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; switch (_IOC_NR(cmd)) { @@ -2262,7 +2264,7 @@ comb_stereo(unsigned char *real_buffer,unsigned char *tmp_buffer, int offset, to be copied to the user's buffer. it is filled by the interrupt handler and drained by this loop. */ static ssize_t -ess_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +ess_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2361,7 +2363,7 @@ rec_return_free: } static ssize_t -ess_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +ess_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct ess_state *s = (struct ess_state *)file->private_data; ssize_t ret; @@ -2539,6 +2541,8 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; /* printk("maestro: ess_ioctl: cmd %d\n", cmd);*/ @@ -2547,7 +2551,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -2559,7 +2563,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -2575,7 +2579,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -2589,10 +2593,10 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -2616,7 +2620,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -2640,13 +2644,13 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg); + return put_user(AFMT_U8|AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -2678,7 +2682,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? AFMT_S16_LE : AFMT_U8, - (int *)arg); + p); case SNDCTL_DSP_POST: return 0; @@ -2689,10 +2693,10 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -2724,7 +2728,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -2738,7 +2742,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -2753,7 +2757,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ess_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&s->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -2768,7 +2772,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2785,7 +2789,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2793,14 +2797,14 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; M_printk("maestro: SETFRAGMENT: %0x\n",val); if (file->f_mode & FMODE_READ) { @@ -2829,7 +2833,7 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -2840,15 +2844,15 @@ static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) - : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg); + : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c index 137cb1166..2830f7f1e 100644 --- a/sound/oss/maestro3.c +++ b/sound/oss/maestro3.c @@ -1324,7 +1324,7 @@ static int drain_dac(struct m3_state *s, int nonblock) return 0; } -static ssize_t m3_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t m3_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct m3_state *s = (struct m3_state *)file->private_data; ssize_t ret; @@ -1405,7 +1405,7 @@ out: return ret; } -static ssize_t m3_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t m3_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct m3_state *s = (struct m3_state *)file->private_data; ssize_t ret; @@ -1584,6 +1584,8 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un count_info cinfo; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); @@ -1594,7 +1596,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1606,7 +1608,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: spin_lock_irqsave(&card->lock, flags); @@ -1624,7 +1626,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_SPEED: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1639,10 +1641,10 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } } spin_unlock_irqrestore(&card->lock, flags); - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); fmtd = 0; fmtm = ~0; @@ -1667,7 +1669,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_CHANNELS: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val != 0) { fmtd = 0; @@ -1692,13 +1694,13 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un } spin_unlock_irqrestore(&card->lock, flags); return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg); + return put_user(AFMT_U8|AFMT_S16_LE, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (val != AFMT_QUERY) { fmtd = 0; @@ -1727,7 +1729,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? AFMT_S16_LE : AFMT_U8, - (int *)arg); + p); case SNDCTL_DSP_POST: return 0; @@ -1738,10 +1740,10 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1))) @@ -1772,7 +1774,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1786,7 +1788,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&card->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1799,7 +1801,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un m3_update_ptr(s); val = s->dma_dac.count; spin_unlock_irqrestore(&card->lock, flags); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1812,7 +1814,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1827,7 +1829,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1835,14 +1837,14 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); spin_lock_irqsave(&card->lock, flags); if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1871,7 +1873,7 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - get_user_ret(val, (int *)arg, -EFAULT); + get_user_ret(val, p, -EFAULT); if (val != 1 && val != 2 && val != 4) return -EINVAL; if (file->f_mode & FMODE_READ) @@ -1881,15 +1883,15 @@ static int m3_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) - : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg); + : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) - : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg); + : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c index 3fdbaf5f2..6ccdd096f 100644 --- a/sound/oss/msnd.c +++ b/sound/oss/msnd.c @@ -139,13 +139,10 @@ void msnd_fifo_make_empty(msnd_fifo *f) f->len = f->tail = f->head = 0; } -int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user) +int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) { int count = 0; - if (f->len == f->n) - return 0; - while ((count < len) && (f->len != f->n)) { int nwritten; @@ -161,11 +158,7 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user) nwritten = len - count; } - if (user) { - if (copy_from_user(f->data + f->tail, buf, nwritten)) - return -EFAULT; - } else - isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); + isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); count += nwritten; buf += nwritten; @@ -177,13 +170,10 @@ int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user) return count; } -int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user) +int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) { int count = 0; - if (f->len == 0) - return f->len; - while ((count < len) && (f->len > 0)) { int nread; @@ -199,11 +189,7 @@ int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user) nread = len - count; } - if (user) { - if (copy_to_user(buf, f->data + f->head, nread)) - return -EFAULT; - } else - isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); + isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); count += nread; buf += nread; diff --git a/sound/oss/msnd.h b/sound/oss/msnd.h index 7b361921e..73148d2ee 100644 --- a/sound/oss/msnd.h +++ b/sound/oss/msnd.h @@ -266,8 +266,8 @@ void msnd_fifo_init(msnd_fifo *f); void msnd_fifo_free(msnd_fifo *f); int msnd_fifo_alloc(msnd_fifo *f, size_t n); void msnd_fifo_make_empty(msnd_fifo *f); -int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user); -int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user); +int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len); +int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len); int msnd_wait_TXDE(multisound_dev_t *dev); int msnd_wait_HC0(multisound_dev_t *dev); diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index aea4a65f7..a130ba4c0 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c @@ -212,6 +212,7 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) LPDAQD lpDAQ, lpDARQ; audio_buf_info abinfo; unsigned long flags; + int __user *p = (int __user *)arg; lpDAQ = dev.base + DAPQ_DATA_BUFF; lpDARQ = dev.base + DARQ_DATA_BUFF; @@ -238,7 +239,7 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) abinfo.fragstotal = dev.DAPF.n / abinfo.fragsize; abinfo.fragments = abinfo.bytes / abinfo.fragsize; spin_unlock_irqrestore(&dev.lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -249,7 +250,7 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) abinfo.fragstotal = dev.DARF.n / abinfo.fragsize; abinfo.fragments = abinfo.bytes / abinfo.fragsize; spin_unlock_irqrestore(&dev.lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_RESET: dev.nresets = 0; @@ -262,18 +263,18 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case SNDCTL_DSP_GETBLKSIZE: tmp = dsp_get_frag_size(); - if (put_user(tmp, (int *)arg)) + if (put_user(tmp, p)) return -EFAULT; return 0; case SNDCTL_DSP_GETFMTS: val = AFMT_S16_LE | AFMT_U8; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; case SNDCTL_DSP_SETFMT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) @@ -285,7 +286,7 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ? dev.rec_sample_size : dsp_set_format(file, val); - if (put_user(data, (int *)arg)) + if (put_user(data, p)) return -EFAULT; return 0; @@ -299,12 +300,12 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case SNDCTL_DSP_GETCAPS: val = DSP_CAP_DUPLEX | DSP_CAP_BATCH; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val < 8000) @@ -326,13 +327,13 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (file->f_mode & FMODE_READ) dev.rec_sample_rate = data; - if (put_user(data, (int *)arg)) + if (put_user(data, p)) return -EFAULT; return 0; case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (cmd == SNDCTL_DSP_CHANNELS) { @@ -369,7 +370,7 @@ static int dsp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (file->f_mode & FMODE_READ) dev.rec_channels = data; - if (put_user(val, (int *)arg)) + if (put_user(val, p)) return -EFAULT; return 0; } @@ -565,13 +566,13 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg) mixer_info info; set_mixer_info(); info.modify_counter = dev.mixer_mod_count; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } else if (cmd == SOUND_OLD_MIXER_INFO) { _old_mixer_info info; set_mixer_info(); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } else if (cmd == SOUND_MIXER_PRIVATE1) { @@ -584,19 +585,19 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg) if (_SIOC_DIR(cmd) & _SIOC_WRITE) { switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = set_recsrc(val); break; default: - if (get_user(val, (int *)arg)) + if (get_user(val, (int __user *)arg)) return -EFAULT; val = mixer_set(cmd & 0xff, val); break; } ++dev.mixer_mod_count; - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } else { switch (cmd & 0xff) { case SOUND_MIXER_RECSRC: @@ -638,7 +639,7 @@ static int mixer_ioctl(unsigned int cmd, unsigned long arg) } } - return put_user(val, (int *)arg); + return put_user(val, (int __user *)arg); } return -EINVAL; @@ -650,7 +651,7 @@ static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u if (cmd == OSS_GETVERSION) { int sound_version = SOUND_VERSION; - return put_user(sound_version, (int *)arg); + return put_user(sound_version, (int __user *)arg); } if (minor == dev.dsp_minor) @@ -809,7 +810,7 @@ static int dev_release(struct inode *inode, struct file *file) static __inline__ int pack_DARQ_to_DARF(register int bank) { - register int size, n, timeout = 3; + register int size, timeout = 3; register WORD wTmp; LPDAQD DAQD; @@ -830,13 +831,10 @@ static __inline__ int pack_DARQ_to_DARF(register int bank) /* Read data from the head (unprotected bank 1 access okay since this is only called inside an interrupt) */ outb(HPBLKSEL_1, dev.io + HP_BLKS); - if ((n = msnd_fifo_write( + msnd_fifo_write( &dev.DARF, (char *)(dev.base + bank * DAR_BUFF_SIZE), - size, 0)) <= 0) { - outb(HPBLKSEL_0, dev.io + HP_BLKS); - return n; - } + size); outb(HPBLKSEL_0, dev.io + HP_BLKS); return 1; @@ -858,21 +856,16 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start) if (protect) { /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_read( + n = msnd_fifo_read( &dev.DAPF, (char *)(dev.base + bank_num * DAP_BUFF_SIZE), - DAP_BUFF_SIZE, 0)) < 0) { - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + DAP_BUFF_SIZE); spin_unlock_irqrestore(&dev.lock, flags); } else { - if ((n = msnd_fifo_read( + n = msnd_fifo_read( &dev.DAPF, (char *)(dev.base + bank_num * DAP_BUFF_SIZE), - DAP_BUFF_SIZE, 0)) < 0) { - return n; - } + DAP_BUFF_SIZE); } if (!n) break; @@ -896,33 +889,46 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start) return nbanks; } -static int dsp_read(char *buf, size_t len) +static int dsp_read(char __user *buf, size_t len) { int count = len; + char *page = (char *)__get_free_page(PAGE_SIZE); + + if (!page) + return -ENOMEM; while (count > 0) { - int n; + int n, k; unsigned long flags; + k = PAGE_SIZE; + if (k > count) + k = count; + /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_read(&dev.DARF, buf, count, 1)) < 0) { - printk(KERN_WARNING LOGNAME ": FIFO read error\n"); - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + n = msnd_fifo_read(&dev.DARF, page, k); spin_unlock_irqrestore(&dev.lock, flags); + if (copy_to_user(buf, page, n)) { + free_page((unsigned long)page); + return -EFAULT; + } buf += n; count -= n; + if (n == k && count) + continue; + if (!test_bit(F_READING, &dev.flags) && dev.mode & FMODE_READ) { dev.last_recbank = -1; if (chk_send_dsp_cmd(&dev, HDEX_RECORD_START) == 0) set_bit(F_READING, &dev.flags); } - if (dev.rec_ndelay) + if (dev.rec_ndelay) { + free_page((unsigned long)page); return count == len ? -EAGAIN : len - count; + } if (count > 0) { set_bit(F_READBLOCK, &dev.flags); @@ -931,41 +937,57 @@ static int dsp_read(char *buf, size_t len) get_rec_delay_jiffies(DAR_BUFF_SIZE))) clear_bit(F_READING, &dev.flags); clear_bit(F_READBLOCK, &dev.flags); - if (signal_pending(current)) + if (signal_pending(current)) { + free_page((unsigned long)page); return -EINTR; + } } } - + free_page((unsigned long)page); return len - count; } -static int dsp_write(const char *buf, size_t len) +static int dsp_write(const char __user *buf, size_t len) { int count = len; + char *page = (char *)__get_free_page(GFP_KERNEL); + + if (!page) + return -ENOMEM; while (count > 0) { - int n; + int n, k; unsigned long flags; + k = PAGE_SIZE; + if (k > count) + k = count; + + if (copy_from_user(page, buf, k)) { + free_page((unsigned long)page); + return -EFAULT; + } + /* Critical section: protect fifo in non-interrupt */ spin_lock_irqsave(&dev.lock, flags); - if ((n = msnd_fifo_write(&dev.DAPF, buf, count, 1)) < 0) { - printk(KERN_WARNING LOGNAME ": FIFO write error\n"); - spin_unlock_irqrestore(&dev.lock, flags); - return n; - } + n = msnd_fifo_write(&dev.DAPF, page, k); spin_unlock_irqrestore(&dev.lock, flags); buf += n; count -= n; + if (count && n == k) + continue; + if (!test_bit(F_WRITING, &dev.flags) && (dev.mode & FMODE_WRITE)) { dev.last_playbank = -1; if (pack_DAPF_to_DAPQ(1) > 0) set_bit(F_WRITING, &dev.flags); } - if (dev.play_ndelay) + if (dev.play_ndelay) { + free_page((unsigned long)page); return count == len ? -EAGAIN : len - count; + } if (count > 0) { set_bit(F_WRITEBLOCK, &dev.flags); @@ -973,15 +995,18 @@ static int dsp_write(const char *buf, size_t len) &dev.writeblock, get_play_delay_jiffies(DAP_BUFF_SIZE)); clear_bit(F_WRITEBLOCK, &dev.flags); - if (signal_pending(current)) + if (signal_pending(current)) { + free_page((unsigned long)page); return -EINTR; + } } } + free_page((unsigned long)page); return len - count; } -static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off) +static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) { int minor = iminor(file->f_dentry->d_inode); if (minor == dev.dsp_minor) @@ -990,7 +1015,7 @@ static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off) return -EINVAL; } -static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off) +static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) { int minor = iminor(file->f_dentry->d_inode); if (minor == dev.dsp_minor) diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index c69c135a9..9789c5ab2 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c @@ -822,7 +822,7 @@ static void opl3_hw_control(int dev, unsigned char *event) { } -static int opl3_load_patch(int dev, int format, const char *addr, +static int opl3_load_patch(int dev, int format, const char __user *addr, int offs, int count, int pmgr_flag) { struct sbi_instrument ins; @@ -833,7 +833,11 @@ static int opl3_load_patch(int dev, int format, const char *addr, return -EINVAL; } - if(copy_from_user(&((char *) &ins)[offs], &(addr)[offs], sizeof(ins) - offs)) + /* + * What the fuck is going on here? We leave junk in the beginning + * of ins and then check the field pretty close to that beginning? + */ + if(copy_from_user(&((char *) &ins)[offs], addr + offs, sizeof(ins) - offs)) return -EFAULT; if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c index 9e9669320..404ba23b1 100644 --- a/sound/oss/rme96xx.c +++ b/sound/oss/rme96xx.c @@ -661,13 +661,13 @@ inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp) } -inline int rme96xx_copyfromuser(struct dmabuf* dma,const char* buffer,int count,int hop) +inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop) { int swptr = dma->writeptr; switch (dma->format) { case AFMT_S32_BLOCKED: { - char* buf = (char*)buffer; + char __user * buf = (char __user *)buffer; int cnt = count/dma->outchannels; int i; for (i=0;i < dma->outchannels;i++) { @@ -686,7 +686,7 @@ inline int rme96xx_copyfromuser(struct dmabuf* dma,const char* buffer,int count, int i,j; int cnt = count/dma->outchannels; for (i=0;i < dma->outchannels + dma->mono;i++) { - short* sbuf = (short*)buffer + i*(!dma->mono); + short __user * sbuf = (short __user *)buffer + i*(!dma->mono); short* hwbuf =(short*) &dma->s->playbuf[(dma->outoffset + i)*RME96xx_DMA_MAX_SAMPLES]; hwbuf+=(swptr>>1); for (j=0;j<(cnt>>1);j++) { @@ -710,13 +710,13 @@ inline int rme96xx_copyfromuser(struct dmabuf* dma,const char* buffer,int count, } /* The count argument is the number of bytes */ -inline int rme96xx_copytouser(struct dmabuf* dma,const char* buffer,int count,int hop) +inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop) { int swptr = dma->readptr; switch (dma->format) { case AFMT_S32_BLOCKED: { - char* buf = (char*)buffer; + char __user * buf = (char __user *)buffer; int cnt = count/dma->inchannels; int i; @@ -736,7 +736,7 @@ inline int rme96xx_copytouser(struct dmabuf* dma,const char* buffer,int count,in int i,j; int cnt = count/dma->inchannels; for (i=0;i < dma->inchannels;i++) { - short* sbuf = (short*)buffer + i; + short __user * sbuf = (short __user *)buffer + i; short* hwbuf =(short*) &dma->s->recbuf[(dma->inoffset + i)*RME96xx_DMA_MAX_SAMPLES]; hwbuf+=(swptr>>1); for (j=0;j<(cnt>>1);j++) { @@ -1121,7 +1121,6 @@ module_exit(cleanup_rme96xx); static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, unsigned long arg) { - struct dmabuf * dma = (struct dmabuf *)file->private_data; rme96xx_info *s = dma->s; unsigned long flags; @@ -1129,6 +1128,8 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, count_info cinfo; int count; int val = 0; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); @@ -1136,7 +1137,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: #if 0 @@ -1149,14 +1150,14 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: // rme96xx_clearbufs(dma); return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { /* generally it's not a problem if we change the speed @@ -1195,10 +1196,10 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, spin_unlock_irqrestore(&s->lock, flags); } DBG(printk("speed set to %d\n",val)); - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_STEREO: /* this plays a mono file on two channels */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (!val) { @@ -1216,7 +1217,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, return 0; case SNDCTL_DSP_CHANNELS: /* remember to check for resonable offset/channel pairs here */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_WRITE) { @@ -1236,14 +1237,14 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, dma->mono=0; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(RME96xx_FMT, (int *)arg); + return put_user(RME96xx_FMT, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ DBG(printk("setting to format %x\n",val)); - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { if (val & RME96xx_FMT) @@ -1257,7 +1258,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, break; } } - return put_user(dma->format, (int *)arg); + return put_user(dma->format, p); case SNDCTL_DSP_POST: return 0; @@ -1270,10 +1271,10 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) val |= PCM_ENABLE_OUTPUT; #endif - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; #if 0 if (file->f_mode & FMODE_READ) { @@ -1309,7 +1310,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, abinfo.fragstotal = 2; abinfo.fragments = (count > s->fragsize); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1323,7 +1324,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, abinfo.bytes = (count*dma->inchannels)>>dma->formatshift; abinfo.fragstotal = 2; abinfo.fragments = count > s->fragsize; - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1339,7 +1340,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, if (count < 0) count += s->fragsize<<1; - return put_user(count, (int *)arg); + return put_user(count, p); /* check out how to use mmaped mode (can only be blocked !!!) */ @@ -1359,7 +1360,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, dma->readptr &= s->fragsize<<1; spin_unlock_irqrestore(&s->lock,flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1378,14 +1379,14 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, if (dma->mmapped) dma->writeptr &= s->fragsize<<1; spin_unlock_irqrestore(&s->lock,flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; case SNDCTL_DSP_GETBLKSIZE: - return put_user(s->fragsize, (int *)arg); + return put_user(s->fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; val&=0xffff; val -= 7; @@ -1399,7 +1400,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1413,10 +1414,10 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, case SOUND_PCM_READ_RATE: /* HP20020201 */ s->rate = rme96xx_get_sample_rate_status(s); - return put_user(s->rate, (int *)arg); + return put_user(s->rate, p); case SOUND_PCM_READ_CHANNELS: - return put_user(dma->outchannels, (int *)arg); + return put_user(dma->outchannels, p); case SOUND_PCM_READ_BITS: switch (dma->format) { @@ -1427,7 +1428,7 @@ static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, val = 16; break; } - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1529,7 +1530,7 @@ static int rme96xx_release(struct inode *in, struct file *file) } -static ssize_t rme96xx_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t rme96xx_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; @@ -1597,7 +1598,7 @@ static ssize_t rme96xx_write(struct file *file, const char *buffer, size_t count return ret; } -static ssize_t rme96xx_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t rme96xx_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; @@ -1793,6 +1794,8 @@ static int rme96xx_mixer_ioctl(struct inode *inode, struct file *file, unsigned rme96xx_info *s = (rme96xx_info *)file->private_data; u32 status; int spdifrate; + void __user *argp = (void __user *)arg; + int __user *p = argp; status = readl(s->iobase + RME96xx_status_register); /* hack to convert rev 1.5 SPDIF rate to "crystalrate" format HP 20020201 */ @@ -1802,7 +1805,7 @@ static int rme96xx_mixer_ioctl(struct inode *inode, struct file *file, unsigned VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { rme_mixer mixer; - if (copy_from_user(&mixer,(void*)arg,sizeof(mixer))) + if (copy_from_user(&mixer,argp,sizeof(mixer))) return -EFAULT; mixer.devnr &= RME96xx_MASK_DEVS; @@ -1825,14 +1828,14 @@ static int rme96xx_mixer_ioctl(struct inode *inode, struct file *file, unsigned mixer.o_offset = s->dma[mixer.devnr].outoffset; mixer.i_offset = s->dma[mixer.devnr].inoffset; - return copy_to_user((void *)arg, &mixer, sizeof(mixer)) ? -EFAULT : 0; + return copy_to_user(argp, &mixer, sizeof(mixer)) ? -EFAULT : 0; } if (cmd == SOUND_MIXER_PRIVATE2) { - return put_user(status, (int *)arg); + return put_user(status, p); } if (cmd == SOUND_MIXER_PRIVATE3) { u32 control; - if (copy_from_user(&control,(void*)arg,sizeof(control))) + if (copy_from_user(&control,argp,sizeof(control))) return -EFAULT; if (file->f_mode & FMODE_WRITE) { s->control_register &= ~RME96xx_mixer_allowed; @@ -1840,7 +1843,7 @@ static int rme96xx_mixer_ioctl(struct inode *inode, struct file *file, unsigned writel(control,s->iobase + RME96xx_control_register); } - return put_user(s->control_register, (int *)arg); + return put_user(s->control_register, p); } return -1; } diff --git a/sound/oss/sb_audio.c b/sound/oss/sb_audio.c index 7f7b1c11c..40914dd0c 100644 --- a/sound/oss/sb_audio.c +++ b/sound/oss/sb_audio.c @@ -836,7 +836,7 @@ static signed short *lbuf16 = (signed short *)lbuf8; static void sb16_copy_from_user(int dev, char *localbuf, int localoffs, - const char *userbuf, int useroffs, + const char __user *userbuf, int useroffs, int max_in, int max_out, int *used, int *returned, int len) diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index b5f5ecbf2..012f6d2d8 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c @@ -309,7 +309,13 @@ static int __init sb_init(void) /* If either PnP or Legacy registered a card then return * success */ - return (pres > 0 || lres > 0) ? 0 : -ENODEV; + if (pres <= 0 && lres <= 0) { +#ifdef CONFIG_PNP + pnp_unregister_card_driver(&sb_pnp_driver); +#endif + return -ENODEV; + } + return 0; } static void __exit sb_exit(void) diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index 3639a53c7..249d69cbb 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c @@ -943,7 +943,10 @@ void sb_setmixer(sb_devc * devc, unsigned int port, unsigned int value) { unsigned long flags; - if (devc->model == MDL_ESS) return ess_setmixer (devc, port, value); + if (devc->model == MDL_ESS) { + ess_setmixer (devc, port, value); + return; + } spin_lock_irqsave(&devc->lock, flags); diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c index 9bb3596c7..e231cf0a7 100644 --- a/sound/oss/sonicvibes.c +++ b/sound/oss/sonicvibes.c @@ -1042,6 +1042,7 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) unsigned long flags; int i, val; unsigned char l, r, rl, rr; + int __user *p = (int __user *)arg; VALIDATE_STATE(s); if (cmd == SOUND_MIXER_INFO) { @@ -1050,7 +1051,7 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) strlcpy(info.id, "SonicVibes", sizeof(info.id)); strlcpy(info.name, "S3 SonicVibes", sizeof(info.name)); info.modify_counter = s->mix.modcnt; - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } @@ -1059,14 +1060,14 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) memset(&info, 0, sizeof(info)); strlcpy(info.id, "SonicVibes", sizeof(info.id)); strlcpy(info.name, "S3 SonicVibes", sizeof(info.name)); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user((void __user *)arg, &info, sizeof(info))) return -EFAULT; return 0; } if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); if (cmd == SOUND_MIXER_PRIVATE1) { /* SRS settings */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; spin_lock_irqsave(&s->lock, flags); if (val & 1) { @@ -1086,47 +1087,47 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) r = rdindir(s, SV_CISRSCENTER); spin_unlock_irqrestore(&s->lock, flags); if (l & 0x80) - return put_user(0, (int *)arg); - return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg); + return put_user(0, p); + return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, p); } if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - return put_user(mixer_recmask(s), (int *)arg); + return put_user(mixer_recmask(s), p); case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].rec) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */ for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO) val |= 1 << i; - return put_user(val, (int *)arg); + return put_user(val, p); case SOUND_MIXER_CAPS: - return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg); + return put_user(SOUND_CAP_EXCL_INPUT, p); default: i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS - return return_mixval(s, i, (int *)arg); + return return_mixval(s, i, p); #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */ if (!volidx[i]) return -EINVAL; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } @@ -1135,7 +1136,7 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) s->mix.modcnt++; switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; i = hweight32(val); if (i == 0) @@ -1160,7 +1161,7 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) i = _IOC_NR(cmd); if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; l = val & 0xff; r = (val >> 8) & 0xff; @@ -1224,12 +1225,12 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) } spin_unlock_irqrestore(&s->lock, flags); #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS - return return_mixval(s, i, (int *)arg); + return return_mixval(s, i, p); #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */ if (!volidx[i]) return -EINVAL; s->mix.vol[volidx[i]-1] = val; - return put_user(s->mix.vol[volidx[i]-1], (int *)arg); + return put_user(s->mix.vol[volidx[i]-1], p); #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } @@ -1314,7 +1315,7 @@ static int drain_dac(struct sv_state *s, int nonblock) /* --------------------------------------------------------------------- */ -static ssize_t sv_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1399,7 +1400,7 @@ static ssize_t sv_read(struct file *file, char *buffer, size_t count, loff_t *pp return ret; } -static ssize_t sv_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -1570,13 +1571,15 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un int count; int val, mapped, ret; unsigned char fmtm, fmtd; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(s); mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) || ((file->f_mode & FMODE_READ) && s->dma_adc.mapped); switch (cmd) { case OSS_GETVERSION: - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_SYNC: if (file->f_mode & FMODE_WRITE) @@ -1587,7 +1590,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_GETCAPS: - return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); + return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p); case SNDCTL_DSP_RESET: if (file->f_mode & FMODE_WRITE) { @@ -1603,7 +1606,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_SPEED: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val >= 0) { if (file->f_mode & FMODE_READ) { @@ -1617,10 +1620,10 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un set_dac_rate(s, val); } } - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SNDCTL_DSP_STEREO: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; fmtd = 0; fmtm = ~0; @@ -1644,7 +1647,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 0) { fmtd = 0; @@ -1668,13 +1671,13 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) - : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg); + : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != AFMT_QUERY) { fmtd = 0; @@ -1698,7 +1701,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un set_fmt(s, fmtm, fmtd); } return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) - : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, (int *)arg); + : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, p); case SNDCTL_DSP_POST: return 0; @@ -1709,10 +1712,10 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un val |= PCM_ENABLE_INPUT; if (file->f_mode & FMODE_WRITE && s->enable & SV_CENABLE_PE) val |= PCM_ENABLE_OUTPUT; - return put_user(val, (int *)arg); + return put_user(val, p); case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { if (val & PCM_ENABLE_INPUT) { @@ -1753,7 +1756,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_dac.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: if (!(file->f_mode & FMODE_READ)) @@ -1770,7 +1773,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; spin_unlock_irqrestore(&s->lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: file->f_flags |= O_NONBLOCK; @@ -1787,7 +1790,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un spin_unlock_irqrestore(&s->lock, flags); if (count < 0) count = 0; - return put_user(count, (int *)arg); + return put_user(count, p); case SNDCTL_DSP_GETIPTR: if (!(file->f_mode & FMODE_READ)) @@ -1805,7 +1808,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1825,7 +1828,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user(argp, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1833,14 +1836,14 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf(s, 0))) return val; - return put_user(s->dma_dac.fragsize, (int *)arg); + return put_user(s->dma_dac.fragsize, p); } if ((val = prog_dmabuf(s, 1))) return val; - return put_user(s->dma_adc.fragsize, (int *)arg); + return put_user(s->dma_adc.fragsize, p); case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { s->dma_adc.ossfragshift = val & 0xffff; @@ -1868,7 +1871,7 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision)) return -EINVAL; - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2 && val != 4) return -EINVAL; @@ -1879,15 +1882,15 @@ static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un return 0; case SOUND_PCM_READ_RATE: - return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg); + return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p); case SOUND_PCM_READ_CHANNELS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) - : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg); + : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p); case SOUND_PCM_READ_BITS: return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) - : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, (int *)arg); + : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, p); case SOUND_PCM_WRITE_FILTER: case SNDCTL_DSP_SETSYNCRO: @@ -1992,7 +1995,7 @@ static /*const*/ struct file_operations sv_audio_fops = { /* --------------------------------------------------------------------- */ -static ssize_t sv_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2055,7 +2058,7 @@ static ssize_t sv_midi_read(struct file *file, char *buffer, size_t count, loff_ return ret; } -static ssize_t sv_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +static ssize_t sv_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct sv_state *s = (struct sv_state *)file->private_data; DECLARE_WAITQUEUE(wait, current); @@ -2297,7 +2300,7 @@ static int sv_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int cm return 0; case FM_IOCTL_PLAY_NOTE: - if (copy_from_user(&n, (void *)arg, sizeof(n))) + if (copy_from_user(&n, (void __user *)arg, sizeof(n))) return -EFAULT; if (n.voice >= 18) return -EINVAL; @@ -2315,7 +2318,7 @@ static int sv_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int cm return 0; case FM_IOCTL_SET_VOICE: - if (copy_from_user(&v, (void *)arg, sizeof(v))) + if (copy_from_user(&v, (void __user *)arg, sizeof(v))) return -EFAULT; if (v.voice >= 18) return -EINVAL; @@ -2345,7 +2348,7 @@ static int sv_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int cm return 0; case FM_IOCTL_SET_PARAMS: - if (copy_from_user(&p, (void *)arg, sizeof(p))) + if (copy_from_user(&p, (void *__user )arg, sizeof(p))) return -EFAULT; outb(0x08, s->iosynth); outb((p.kbd_split & 1) << 6, s->iosynth+1); diff --git a/sound/oss/trident.c b/sound/oss/trident.c index e5e14cf5c..ed04f4007 100644 --- a/sound/oss/trident.c +++ b/sound/oss/trident.c @@ -497,7 +497,8 @@ static void ali_setup_spdif_in(struct trident_card *card); static void ali_disable_spdif_in(struct trident_card *card); static void ali_disable_special_channel(struct trident_card *card, int ch); static void ali_setup_spdif_out(struct trident_card *card, int flag); -static int ali_write_5_1(struct trident_state *state, const char *buffer, +static int ali_write_5_1(struct trident_state *state, + const char __user *buffer, int cnt_for_multi_channel, unsigned int *copy_count, unsigned int *state_cnt); static int ali_allocate_other_states_resources(struct trident_state *state, @@ -1861,7 +1862,7 @@ trident_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* to be copied to the user's buffer. it is filled by the dma machine and */ /* drained by this loop. */ static ssize_t -trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos) +trident_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos) { struct trident_state *state = (struct trident_state *)file->private_data; struct dmabuf *dmabuf = &state->dmabuf; @@ -1976,7 +1977,7 @@ out: the soundcard. it is drained by the dma machine and filled by this loop. */ static ssize_t -trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) +trident_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos) { struct trident_state *state = (struct trident_state *)file->private_data; struct dmabuf *dmabuf = &state->dmabuf; @@ -2247,8 +2248,9 @@ trident_ioctl(struct inode *inode, struct file *file, audio_buf_info abinfo; count_info cinfo; int val, mapped, ret = 0; - struct trident_card *card = state->card; + void __user *argp = (void __user *)arg; + int __user *p = argp; VALIDATE_STATE(state); @@ -2256,11 +2258,11 @@ trident_ioctl(struct inode *inode, struct file *file, mapped = ((file->f_mode & (FMODE_WRITE | FMODE_READ)) && dmabuf->mapped); pr_debug("trident: trident_ioctl, command = %2d, arg = 0x%08x\n", - _IOC_NR(cmd), arg ? *(int *) arg : 0); + _IOC_NR(cmd), arg ? *p : 0); switch (cmd) { case OSS_GETVERSION: - ret = put_user(SOUND_VERSION, (int *) arg); + ret = put_user(SOUND_VERSION, p); break; case SNDCTL_DSP_RESET: @@ -2287,7 +2289,7 @@ trident_ioctl(struct inode *inode, struct file *file, break; case SNDCTL_DSP_SPEED: /* set smaple rate */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2307,11 +2309,11 @@ trident_ioctl(struct inode *inode, struct file *file, spin_unlock_irqrestore(&state->card->lock, flags); } } - ret = put_user(dmabuf->rate, (int *) arg); + ret = put_user(dmabuf->rate, p); break; case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2342,14 +2344,14 @@ trident_ioctl(struct inode *inode, struct file *file, if ((val = prog_dmabuf_playback(state))) ret = val; else - ret = put_user(dmabuf->fragsize, (int *) arg); + ret = put_user(dmabuf->fragsize, p); break; } if (file->f_mode & FMODE_READ) { if ((val = prog_dmabuf_record(state))) ret = val; else - ret = put_user(dmabuf->fragsize, (int *) arg); + ret = put_user(dmabuf->fragsize, p); break; } /* neither READ nor WRITE? is this even possible? */ @@ -2359,11 +2361,11 @@ trident_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format */ ret = put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2390,11 +2392,11 @@ trident_ioctl(struct inode *inode, struct file *file, } unlock_set_fmt(state); ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2458,7 +2460,7 @@ trident_ioctl(struct inode *inode, struct file *file, } unlock_set_fmt(state); } - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_POST: @@ -2470,7 +2472,7 @@ trident_ioctl(struct inode *inode, struct file *file, ret = -EINVAL; break; } - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2482,7 +2484,7 @@ trident_ioctl(struct inode *inode, struct file *file, break; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2514,7 +2516,7 @@ trident_ioctl(struct inode *inode, struct file *file, abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? + ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? -EFAULT : 0; break; @@ -2534,7 +2536,7 @@ trident_ioctl(struct inode *inode, struct file *file, abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? + ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? -EFAULT : 0; break; @@ -2544,7 +2546,7 @@ trident_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_GETCAPS: ret = put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | - DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg); + DSP_CAP_MMAP | DSP_CAP_BIND, p); break; case SNDCTL_DSP_GETTRIGGER: @@ -2553,11 +2555,11 @@ trident_ioctl(struct inode *inode, struct file *file, val |= PCM_ENABLE_INPUT; if ((file->f_mode & FMODE_WRITE) && dmabuf->enable) val |= PCM_ENABLE_OUTPUT; - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_SETTRIGGER: - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2599,7 +2601,7 @@ trident_ioctl(struct inode *inode, struct file *file, if (dmabuf->mapped) dmabuf->count &= dmabuf->fragsize - 1; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? + ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; break; @@ -2622,7 +2624,7 @@ trident_ioctl(struct inode *inode, struct file *file, if (dmabuf->mapped) dmabuf->count &= dmabuf->fragsize - 1; spin_unlock_irqrestore(&state->card->lock, flags); - ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? + ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0; break; @@ -2643,26 +2645,26 @@ trident_ioctl(struct inode *inode, struct file *file, trident_update_ptr(state); val = dmabuf->count; spin_unlock_irqrestore(&state->card->lock, flags); - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SOUND_PCM_READ_RATE: - ret = put_user(dmabuf->rate, (int *) arg); + ret = put_user(dmabuf->rate, p); break; case SOUND_PCM_READ_CHANNELS: ret = put_user((dmabuf->fmt & TRIDENT_FMT_STEREO) ? 2 : 1, - (int *) arg); + p); break; case SOUND_PCM_READ_BITS: ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : - AFMT_U8, (int *) arg); + AFMT_U8, p); break; case SNDCTL_DSP_GETCHANNELMASK: ret = put_user(DSP_BIND_FRONT | DSP_BIND_SURR | - DSP_BIND_CENTER_LFE, (int *) arg); + DSP_BIND_CENTER_LFE, p); break; case SNDCTL_DSP_BIND_CHANNEL: @@ -2671,7 +2673,7 @@ trident_ioctl(struct inode *inode, struct file *file, break; } - if (get_user(val, (int *) arg)) { + if (get_user(val, p)) { ret = -EFAULT; break; } @@ -2688,7 +2690,7 @@ trident_ioctl(struct inode *inode, struct file *file, SRC_ENABLE); dmabuf->channel->attribute |= mask2attr[ffs(val)]; } - ret = put_user(val, (int *) arg); + ret = put_user(val, p); break; case SNDCTL_DSP_MAPINBUF: @@ -3878,14 +3880,14 @@ depend on a master state's DMA, and changing the counters of the master state DMA is protected by a spinlock. */ static int -ali_write_5_1(struct trident_state *state, const char *buf, +ali_write_5_1(struct trident_state *state, const char __user *buf, int cnt_for_multi_channel, unsigned int *copy_count, unsigned int *state_cnt) { struct dmabuf *dmabuf = &state->dmabuf; struct dmabuf *dmabuf_temp; - const char *buffer = buf; + const char __user *buffer = buf; unsigned swptr, other_dma_nums, sample_s; unsigned int i, loop; @@ -4018,7 +4020,7 @@ ali_free_other_states_resources(struct trident_state *state) struct proc_dir_entry *res; static int -ali_write_proc(struct file *file, const char *buffer, unsigned long count, void *data) +ali_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct trident_card *card = (struct trident_card *) data; unsigned long flags; diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c index df6ff556a..e7932229e 100644 --- a/sound/oss/wavfront.c +++ b/sound/oss/wavfront.c @@ -1011,7 +1011,7 @@ wavefront_send_sample (wavefront_patch_info *header, UINT16 sample_short; UINT32 length; - UINT16 *data_end = 0; + UINT16 __user *data_end = 0; unsigned int i; const int max_blksize = 4096/2; unsigned int written; @@ -1024,11 +1024,11 @@ wavefront_send_sample (wavefront_patch_info *header, int initial_skip = 0; DPRINT (WF_DEBUG_LOAD_PATCH, "sample %sdownload for slot %d, " - "type %d, %d bytes from 0x%x\n", + "type %d, %d bytes from %p\n", header->size ? "" : "header ", header->number, header->subkey, header->size, - (int) header->dataptr); + header->dataptr); if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) { int x; @@ -1688,8 +1688,7 @@ wavefront_load_patch (const char __user *addr) case WF_ST_MULTISAMPLE: - if (copy_from_user((unsigned char *) &header.hdr.s, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.s, header.hdrptr, sizeof(wavefront_multisample))) return -EFAULT; @@ -1698,32 +1697,28 @@ wavefront_load_patch (const char __user *addr) case WF_ST_ALIAS: - if (copy_from_user((unsigned char *) &header.hdr.a, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.a, header.hdrptr, sizeof (wavefront_alias))) return -EFAULT; return wavefront_send_alias (&header); case WF_ST_DRUM: - if (copy_from_user((unsigned char *) &header.hdr.d, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.d, header.hdrptr, sizeof (wavefront_drum))) return -EFAULT; return wavefront_send_drum (&header); case WF_ST_PATCH: - if (copy_from_user((unsigned char *) &header.hdr.p, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.p, header.hdrptr, sizeof (wavefront_patch))) return -EFAULT; return wavefront_send_patch (&header); case WF_ST_PROGRAM: - if (copy_from_user((unsigned char *) &header.hdr.pr, - (unsigned char *) header.hdrptr, + if (copy_from_user(&header.hdr.pr, header.hdrptr, sizeof (wavefront_program))) return -EFAULT; @@ -3002,7 +2997,7 @@ wffx_ioctl (wavefront_fx_info *r) return -(EINVAL); } if (copy_from_user(page_data, - (unsigned char *)r->data[3], + (unsigned char __user *)r->data[3], r->data[2])) return -EFAULT; pd = page_data; diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c index c6183e770..7b3236fed 100644 --- a/sound/oss/ymfpci.c +++ b/sound/oss/ymfpci.c @@ -1220,7 +1220,7 @@ out0: * machine and drained by this loop. */ static ssize_t -ymf_read(struct file *file, char *buffer, size_t count, loff_t *ppos) +ymf_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct ymf_state *state = (struct ymf_state *)file->private_data; struct ymf_dmabuf *dmabuf = &state->rpcm.dmabuf; @@ -1335,7 +1335,7 @@ ymf_read(struct file *file, char *buffer, size_t count, loff_t *ppos) } static ssize_t -ymf_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) +ymf_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct ymf_state *state = (struct ymf_state *)file->private_data; struct ymf_dmabuf *dmabuf = &state->wpcm.dmabuf; @@ -1568,11 +1568,13 @@ static int ymf_ioctl(struct inode *inode, struct file *file, count_info cinfo; int redzone; int val; + void __user *argp = (void __user *)arg; + int __user *p = argp; switch (cmd) { case OSS_GETVERSION: YMFDBGX("ymf_ioctl: cmd 0x%x(GETVER) arg 0x%lx\n", cmd, arg); - return put_user(SOUND_VERSION, (int *)arg); + return put_user(SOUND_VERSION, p); case SNDCTL_DSP_RESET: YMFDBGX("ymf_ioctl: cmd 0x%x(RESET)\n", cmd); @@ -1614,7 +1616,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, return 0; case SNDCTL_DSP_SPEED: /* set smaple rate */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SPEED) sp %d\n", cmd, val); if (val >= 8000 && val <= 48000) { @@ -1637,7 +1639,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, spin_unlock_irqrestore(&state->unit->reg_lock, flags); } } - return put_user(state->format.rate, (int *)arg); + return put_user(state->format.rate, p); /* * OSS manual does not mention SNDCTL_DSP_STEREO at all. @@ -1646,7 +1648,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, * However, mpg123 calls it. I wonder, why Michael Hipp used it. */ case SNDCTL_DSP_STEREO: /* set stereo or mono channel */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(STEREO) st %d\n", cmd, val); if (file->f_mode & FMODE_WRITE) { @@ -1676,23 +1678,23 @@ static int ymf_ioctl(struct inode *inode, struct file *file, return val; val = state->wpcm.dmabuf.fragsize; YMFDBGX("ymf_ioctl: GETBLK w %d\n", val); - return put_user(val, (int *)arg); + return put_user(val, p); } if (file->f_mode & FMODE_READ) { if ((val = prog_dmabuf(state, 1))) return val; val = state->rpcm.dmabuf.fragsize; YMFDBGX("ymf_ioctl: GETBLK r %d\n", val); - return put_user(val, (int *)arg); + return put_user(val, p); } return -EINVAL; case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/ YMFDBGX("ymf_ioctl: cmd 0x%x(GETFMTS)\n", cmd); - return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); + return put_user(AFMT_S16_LE|AFMT_U8, p); case SNDCTL_DSP_SETFMT: /* Select sample format */ - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SETFMT) fmt %d\n", cmd, val); if (val == AFMT_S16_LE || val == AFMT_U8) { @@ -1715,10 +1717,10 @@ static int ymf_ioctl(struct inode *inode, struct file *file, spin_unlock_irqrestore(&state->unit->reg_lock, flags); } } - return put_user(state->format.format, (int *)arg); + return put_user(state->format.format, p); case SNDCTL_DSP_CHANNELS: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(CHAN) ch %d\n", cmd, val); if (val != 0) { @@ -1745,7 +1747,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, } } } - return put_user(state->format.voices, (int *)arg); + return put_user(state->format.voices, p); case SNDCTL_DSP_POST: YMFDBGX("ymf_ioctl: cmd 0x%x(POST)\n", cmd); @@ -1768,7 +1770,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, return 0; case SNDCTL_DSP_SETFRAGMENT: - if (get_user(val, (int *)arg)) + if (get_user(val, p)) return -EFAULT; YMFDBGX("ymf_ioctl: cmd 0x%x(SETFRAG) fr 0x%04x:%04x(%d:%d)\n", cmd, @@ -1799,7 +1801,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->unit->reg_lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETISPACE: YMFDBGX("ymf_ioctl: cmd 0x%x(GETISPACE)\n", cmd); @@ -1814,7 +1816,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, abinfo.fragstotal = dmabuf->numfrag; abinfo.fragments = abinfo.bytes >> dmabuf->fragshift; spin_unlock_irqrestore(&state->unit->reg_lock, flags); - return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; case SNDCTL_DSP_NONBLOCK: YMFDBGX("ymf_ioctl: cmd 0x%x(NONBLOCK)\n", cmd); @@ -1824,8 +1826,8 @@ static int ymf_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_GETCAPS: YMFDBGX("ymf_ioctl: cmd 0x%x(GETCAPS)\n", cmd); /* return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP, - (int *)arg); */ - return put_user(0, (int *)arg); + p); */ + return put_user(0, p); case SNDCTL_DSP_GETIPTR: YMFDBGX("ymf_ioctl: cmd 0x%x(GETIPTR)\n", cmd); @@ -1839,7 +1841,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, spin_unlock_irqrestore(&state->unit->reg_lock, flags); YMFDBGX("ymf_ioctl: GETIPTR ptr %d bytes %d\n", cinfo.ptr, cinfo.bytes); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_GETOPTR: YMFDBGX("ymf_ioctl: cmd 0x%x(GETOPTR)\n", cmd); @@ -1853,7 +1855,7 @@ static int ymf_ioctl(struct inode *inode, struct file *file, spin_unlock_irqrestore(&state->unit->reg_lock, flags); YMFDBGX("ymf_ioctl: GETOPTR ptr %d bytes %d\n", cinfo.ptr, cinfo.bytes); - return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; + return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0; case SNDCTL_DSP_SETDUPLEX: YMFDBGX("ymf_ioctl: cmd 0x%x(SETDUPLEX)\n", cmd); @@ -1861,15 +1863,15 @@ static int ymf_ioctl(struct inode *inode, struct file *file, case SOUND_PCM_READ_RATE: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_RATE)\n", cmd); - return put_user(state->format.rate, (int *)arg); + return put_user(state->format.rate, p); case SOUND_PCM_READ_CHANNELS: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_CH)\n", cmd); - return put_user(state->format.voices, (int *)arg); + return put_user(state->format.voices, p); case SOUND_PCM_READ_BITS: YMFDBGX("ymf_ioctl: cmd 0x%x(READ_BITS)\n", cmd); - return put_user(AFMT_S16_LE, (int *)arg); + return put_user(AFMT_S16_LE, p); case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 287b7d4e9..91a60417e 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1185,7 +1185,7 @@ static void snd_cs4281_proc_read(snd_info_entry_t *entry, } static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO); @@ -1202,7 +1202,7 @@ static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data } static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO); diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 29861bb0e..9a1758396 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2866,7 +2866,7 @@ void __devinit snd_cs46xx_gameport(cs46xx_t *chip) */ static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; snd_cs46xx_region_t *region = (snd_cs46xx_region_t *)entry->private_data; diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 3100d003d..c02a9497c 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -246,6 +246,12 @@ void cs46xx_dsp_proc_register_scb_desc (cs46xx_t *chip,dsp_scb_descriptor_t * sc if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, ins->proc_dsp_dir)) != NULL) { scb_info = kmalloc(sizeof(proc_scb_info_t), GFP_KERNEL); + if (!scb_info) { + snd_info_free_entry(entry); + entry = NULL; + goto out; + } + scb_info->chip = chip; scb_info->scb_desc = scb; @@ -262,7 +268,7 @@ void cs46xx_dsp_proc_register_scb_desc (cs46xx_t *chip,dsp_scb_descriptor_t * sc entry = NULL; } } - +out: scb->proc_info = entry; } } diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 22eb444a0..c4f763000 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -898,8 +898,10 @@ static snd_emu10k1_fx8010_ctl_t *snd_emu10k1_look_for_ctl(emu10k1_t *emu, snd_ct static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i; - snd_ctl_elem_id_t *_id, id; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + snd_ctl_elem_id_t __user *_id; + snd_ctl_elem_id_t id; + emu10k1_fx8010_control_gpr_t __user *_gctl; + emu10k1_fx8010_control_gpr_t gctl; for (i = 0, _id = icode->gpr_del_controls; i < icode->gpr_del_control_count; i++, _id++) { @@ -946,7 +948,8 @@ static void snd_emu10k1_ctl_private_free(snd_kcontrol_t *kctl) static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i, j; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + emu10k1_fx8010_control_gpr_t __user *_gctl; + emu10k1_fx8010_control_gpr_t gctl; snd_emu10k1_fx8010_ctl_t *ctl, nctl; snd_kcontrol_new_t knew; snd_kcontrol_t *kctl; @@ -1012,7 +1015,8 @@ static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) { unsigned int i; - snd_ctl_elem_id_t *_id, id; + snd_ctl_elem_id_t id; + snd_ctl_elem_id_t __user *_id; snd_emu10k1_fx8010_ctl_t *ctl; snd_card_t *card = emu->card; @@ -1031,7 +1035,8 @@ static int snd_emu10k1_list_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod { unsigned int i = 0, j; unsigned int total = 0; - emu10k1_fx8010_control_gpr_t *_gctl, gctl; + emu10k1_fx8010_control_gpr_t gctl; + emu10k1_fx8010_control_gpr_t __user *_gctl; snd_emu10k1_fx8010_ctl_t *ctl; snd_ctl_elem_id_t *id; struct list_head *list; @@ -2297,6 +2302,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne emu10k1_fx8010_code_t *icode; emu10k1_fx8010_pcm_t *ipcm; unsigned int addr; + void __user *argp = (void __user *)arg; int res; switch (cmd) { @@ -2308,7 +2314,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne kfree(info); return res; } - if (copy_to_user((void *)arg, info, sizeof(*info))) { + if (copy_to_user(argp, info, sizeof(*info))) { kfree(info); return -EFAULT; } @@ -2320,7 +2326,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); if (icode == NULL) return -ENOMEM; - if (copy_from_user(icode, (void *)arg, sizeof(*icode))) { + if (copy_from_user(icode, argp, sizeof(*icode))) { kfree(icode); return -EFAULT; } @@ -2331,12 +2337,12 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); if (icode == NULL) return -ENOMEM; - if (copy_from_user(icode, (void *)arg, sizeof(*icode))) { + if (copy_from_user(icode, argp, sizeof(*icode))) { kfree(icode); return -EFAULT; } res = snd_emu10k1_icode_peek(emu, icode); - if (res == 0 && copy_to_user((void *)arg, icode, sizeof(*icode))) { + if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) { kfree(icode); return -EFAULT; } @@ -2348,7 +2354,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne ipcm = (emu10k1_fx8010_pcm_t *)kmalloc(sizeof(*ipcm), GFP_KERNEL); if (ipcm == NULL) return -ENOMEM; - if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) { + if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } @@ -2361,12 +2367,12 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne ipcm = (emu10k1_fx8010_pcm_t *)snd_kcalloc(sizeof(*ipcm), GFP_KERNEL); if (ipcm == NULL) return -ENOMEM; - if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) { + if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } res = snd_emu10k1_ipcm_peek(emu, ipcm); - if (res == 0 && copy_to_user((void *)arg, ipcm, sizeof(*ipcm))) { + if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) { kfree(ipcm); return -EFAULT; } @@ -2377,7 +2383,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(addr, (unsigned int *)arg)) + if (get_user(addr, (unsigned int __user *)argp)) return -EFAULT; down(&emu->fx8010.lock); res = snd_emu10k1_fx8010_tram_setup(emu, addr); @@ -2415,7 +2421,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne case SNDRV_EMU10K1_IOCTL_SINGLE_STEP: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if (get_user(addr, (unsigned int *)arg)) + if (get_user(addr, (unsigned int __user *)argp)) return -EFAULT; if (addr > 0x1ff) return -EINVAL; @@ -2434,7 +2440,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne addr = snd_emu10k1_ptr_read(emu, A_DBG, 0); else addr = snd_emu10k1_ptr_read(emu, DBG, 0); - if (put_user(addr, (unsigned int *)arg)) + if (put_user(addr, (unsigned int __user *)argp)) return -EFAULT; return 0; } diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 918bc688a..39f5307e2 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -191,7 +191,7 @@ static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, #define TOTAL_SIZE_CODE (0x200*8) static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { long size; emu10k1_t *emu = snd_magic_cast(emu10k1_t, entry->private_data, return -ENXIO); diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 7924508ac..87afa49a0 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -822,7 +822,7 @@ static snd_pcm_uframes_t snd_es1938_playback_pointer(snd_pcm_substream_t *substr static int snd_es1938_capture_copy(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; @@ -836,7 +836,7 @@ static int snd_es1938_capture_copy(snd_pcm_substream_t *substream, } else { if (copy_to_user(dst, runtime->dma_area + pos + 1, count - 1)) return -EFAULT; - if (put_user(runtime->dma_area[0], ((unsigned char *)dst) + count - 1)) + if (put_user(runtime->dma_area[0], ((unsigned char __user *)dst) + count - 1)) return -EFAULT; } return 0; diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index c2fc6e339..edd226021 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -1328,7 +1328,7 @@ static int snd_korg1212_silence(korg1212_t *korg1212, int pos, int count, int of return 0; } -static int snd_korg1212_copy_to(korg1212_t *korg1212, void *dst, int pos, int count, int offset, int size) +static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos, int count, int offset, int size) { KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos; int i, rc; @@ -1346,7 +1346,7 @@ static int snd_korg1212_copy_to(korg1212_t *korg1212, void *dst, int pos, int co return -EFAULT; } #endif - rc = copy_to_user((void*) dst + offset, src, size); + rc = copy_to_user(dst + offset, src, size); if (rc) { #if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i); @@ -1360,7 +1360,7 @@ static int snd_korg1212_copy_to(korg1212_t *korg1212, void *dst, int pos, int co return 0; } -static int snd_korg1212_copy_from(korg1212_t *korg1212, void *src, int pos, int count, int offset, int size) +static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int pos, int count, int offset, int size) { KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; int i, rc; @@ -1671,7 +1671,7 @@ static snd_pcm_uframes_t snd_korg1212_capture_pointer(snd_pcm_substream_t *subst static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { korg1212_t *korg1212 = _snd_pcm_substream_chip(substream); @@ -1701,7 +1701,7 @@ static int snd_korg1212_playback_silence(snd_pcm_substream_t *substream, static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { korg1212_t *korg1212 = _snd_pcm_substream_chip(substream); diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 4b1a5b20f..2b918cc7f 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1154,7 +1154,7 @@ static long long snd_mixart_BA1_llseek(snd_info_entry_t *entry, mixart_BA0 proc interface for BAR 0 - read callback */ static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO); @@ -1173,7 +1173,7 @@ static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data mixart_BA1 proc interface for BAR 1 - read callback */ static long snd_mixart_BA1_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *buf, long count) + struct file *file, char __user *buf, long count) { mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO); diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 8a2fa86aa..ee3b246bb 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -684,7 +684,7 @@ static int snd_nm256_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { snd_pcm_runtime_t *runtime = substream->runtime; diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 1d19e7e08..2f209664d 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -298,7 +298,7 @@ static int snd_rme32_playback_silence(snd_pcm_substream_t * substream, int chann static int snd_rme32_playback_copy(snd_pcm_substream_t * substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, snd_pcm_uframes_t count) + void __user *src, snd_pcm_uframes_t count) { rme32_t *rme32 = _snd_pcm_substream_chip(substream); count <<= rme32->playback_frlog; @@ -311,7 +311,7 @@ static int snd_rme32_playback_copy(snd_pcm_substream_t * substream, int channel, static int snd_rme32_capture_copy(snd_pcm_substream_t * substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, snd_pcm_uframes_t count) + void __user *dst, snd_pcm_uframes_t count) { rme32_t *rme32 = _snd_pcm_substream_chip(substream); count <<= rme32->capture_frlog; diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index cf1776b08..0e04ae457 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -361,7 +361,7 @@ static int snd_rme96_playback_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *src, + void __user *src, snd_pcm_uframes_t count) { rme96_t *rme96 = _snd_pcm_substream_chip(substream); @@ -376,7 +376,7 @@ static int snd_rme96_capture_copy(snd_pcm_substream_t *substream, int channel, /* not used (interleaved data) */ snd_pcm_uframes_t pos, - void *dst, + void __user *dst, snd_pcm_uframes_t count) { rme96_t *rme96 = _snd_pcm_substream_chip(substream); diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 88eb35272..c91602c12 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -1250,9 +1250,9 @@ static inline void snd_hdsp_midi_write_byte (hdsp_t *hdsp, int id, int val) { /* the hardware already does the relevant bit-mask with 0xff */ if (id) { - return hdsp_write(hdsp, HDSP_midiDataOut1, val); + hdsp_write(hdsp, HDSP_midiDataOut1, val); } else { - return hdsp_write(hdsp, HDSP_midiDataOut0, val); + hdsp_write(hdsp, HDSP_midiDataOut0, val); } } @@ -3834,7 +3834,7 @@ static char *hdsp_channel_buffer_location(hdsp_t *hdsp, } static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { hdsp_t *hdsp = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -3849,7 +3849,7 @@ static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, } static int snd_hdsp_capture_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count) { hdsp_t *hdsp = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -4531,10 +4531,11 @@ static int snd_hdsp_hwdep_dummy_op(snd_hwdep_t *hw, struct file *file) static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int cmd, unsigned long arg) { hdsp_t *hdsp = (hdsp_t *)hw->private_data; + void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { - hdsp_peak_rms_t *peak_rms; + hdsp_peak_rms_t __user *peak_rms; int i; if (hdsp->io_type == H9652) { @@ -4542,38 +4543,38 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int int doublespeed = 0; if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus) doublespeed = 1; - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0; i < 26; ++i) { if (!(doublespeed && (i & 4))) { - if (copy_to_user_fromio((void *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0) return -EFAULT; - if (copy_to_user_fromio((void *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0) return -EFAULT; - if (copy_to_user_fromio((void *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0) + if (copy_to_user_fromio((void __user *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->input_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00; rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00; rms_high += (rms_low >> 24); rms_low <<= 8; - if (copy_to_user((void *)peak_rms->output_rms+i*8, &rms_low, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &rms_low, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0) return -EFAULT; } } @@ -4586,25 +4587,25 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus) doublespeed = 1; m = (hdsp_9632_meters_t *)(hdsp->iobase+HDSP_9632_metersBase); - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0, j = 0; i < 16; ++i, ++j) { - if (copy_to_user((void *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0) return -EFAULT; if (doublespeed && i == 3) i += 4; } @@ -4614,25 +4615,25 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int snd_printk("firmware needs to be uploaded to the card.\n"); return -EINVAL; } - peak_rms = (hdsp_peak_rms_t *)arg; + peak_rms = (hdsp_peak_rms_t __user *)arg; for (i = 0; i < 26; ++i) { - if (copy_to_user((void *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0) return -EFAULT; } for (i = 0; i < 26; ++i) { - if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0) return -EFAULT; - if (copy_to_user((void *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0) return -EFAULT; } for (i = 0; i < 28; ++i) { - if (copy_to_user((void *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0) + if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0) return -EFAULT; } break; @@ -4680,7 +4681,7 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); } spin_unlock_irqrestore(&hdsp->lock, flags); - if (copy_to_user((void *)arg, &info, sizeof(info))) + if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; break; } @@ -4690,7 +4691,7 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int if (hdsp->io_type != H9632) return -EINVAL; h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; - if (copy_to_user((void *)arg, &h9632_aeb, sizeof(h9632_aeb))) + if (copy_to_user(argp, &h9632_aeb, sizeof(h9632_aeb))) return -EFAULT; break; } @@ -4706,14 +4707,14 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int } hdsp_version.io_type = hdsp->io_type; hdsp_version.firmware_rev = hdsp->firmware_rev; - if ((err = copy_to_user((void *)arg, &hdsp_version, sizeof(hdsp_version)))) { + if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))) { return -EFAULT; } break; } case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: { - hdsp_firmware_t *firmware; - unsigned long *firmware_data; + hdsp_firmware_t __user *firmware; + unsigned long __user *firmware_data; int err; if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; @@ -4721,7 +4722,7 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int if (hdsp->io_type == Undefined) return -EINVAL; snd_printk("initializing firmware upload\n"); - firmware = (hdsp_firmware_t *)arg; + firmware = (hdsp_firmware_t __user *)argp; if (get_user(firmware_data, &firmware->firmware_data)) { return -EFAULT; @@ -4754,9 +4755,7 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int break; } case SNDRV_HDSP_IOCTL_GET_MIXER: { - hdsp_mixer_t *mixer; - - mixer = (hdsp_mixer_t *)arg; + hdsp_mixer_t __user *mixer = (hdsp_mixer_t __user *)argp; if (copy_to_user(mixer->matrix, hdsp->mixer_matrix, sizeof(unsigned short)*HDSP_MATRIX_MIXER_SIZE)) return -EFAULT; break; diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 155d72a73..e1abd9813 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -2011,7 +2011,7 @@ static char *rme9652_channel_buffer_location(rme9652_t *rme9652, } static int snd_rme9652_playback_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count) { rme9652_t *rme9652 = _snd_pcm_substream_chip(substream); char *channel_buf; @@ -2028,7 +2028,7 @@ static int snd_rme9652_playback_copy(snd_pcm_substream_t *substream, int channel } static int snd_rme9652_capture_copy(snd_pcm_substream_t *substream, int channel, - snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count) + snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count) { rme9652_t *rme9652 = _snd_pcm_substream_chip(substream); char *channel_buf; diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index fdffd3884..3c79110b5 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c @@ -471,7 +471,7 @@ int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offs /* * copy_from_user(blk + offset, data, size) */ -int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size) +int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size) { int page, nextofs, end_offset, temp, temp1; diff --git a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c index a2098eab1..8f9797d79 100644 --- a/sound/pci/trident/trident_synth.c +++ b/sound/pci/trident/trident_synth.c @@ -504,7 +504,7 @@ static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, un */ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t * instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO); int size = instr->size; @@ -557,7 +557,7 @@ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t } static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t * instr, - char *data, long len, int atomic) + char __user *data, long len, int atomic) { //trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO); int size = instr->size; diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 6f73d05e3..c9dfb2bc1 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c @@ -357,7 +357,8 @@ static int vx2_load_xilinx_binary(vx_core_t *chip, const snd_hwdep_dsp_image_t * { unsigned int i; unsigned int port; - unsigned char *image, data; + unsigned char data; + unsigned char __user *image; /* XILINX reset (wait at least 1 milisecond between reset on and off). */ vx_outl(chip, CNTRL, VX_CNTRL_REGISTER_VALUE | VX_XILINX_RESET_MASK); diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index a23eb4d19..c0e1fd0a8 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c @@ -152,7 +152,8 @@ static int vxp_load_xilinx_binary(vx_core_t *_chip, const snd_hwdep_dsp_image_t unsigned int i; int c; int regCSUER, regRUER; - unsigned char *image, data; + unsigned char __user *image; + unsigned char data; /* Switch to programmation mode */ chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK; diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index a536d9f05..8db2e2db5 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -34,7 +34,7 @@ /* Prototypes for static functions */ -static int open_patch(snd_sf_list_t *sflist, const char *data, int count, int client); +static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client); static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name); static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name); static int close_patch(snd_sf_list_t *sflist); -- 2.47.0