From e686509282835a634ee3285c39a1b5b04ee2a88f Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Fri, 16 Jul 2004 15:17:07 +0000 Subject: [PATCH] Merge to Fedora kernel-2.6.7-1.441 --- configs/kernel-2.6.6-i586.config => .config | 166 +- .config.cmd | 170 + .../kernel-2.6.6-i686.config => .config.old | 74 +- CREDITS | 21 +- Documentation/binfmt_misc.txt | 30 +- Documentation/filesystems/ntfs.txt | 15 + Documentation/filesystems/proc.txt | 5 +- Documentation/ioctl-number.txt | 2 + Documentation/networking/00-INDEX | 2 - Documentation/networking/ip-sysctl.txt | 64 +- MAINTAINERS | 29 +- Makefile | 5 +- 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/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/mach-integrator/Makefile | 2 +- arch/arm/mach-integrator/impd1.c | 41 +- arch/arm/mach-integrator/integrator_cp.c | 62 + arch/arm/mach-lh7a40x/Kconfig | 31 + 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/dma.c | 230 +- arch/arm/mach-omap/gpio.c | 87 +- arch/arm/mach-omap/irq.c | 22 +- arch/arm/mach-pxa/Kconfig | 3 +- arch/arm/mach-pxa/leds-lubbock.c | 1 + arch/arm/mach-pxa/lubbock.c | 1 + arch/arm/mach-pxa/pm.c | 1 + arch/arm/mach-s3c2410/Kconfig | 8 +- 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/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/boot98/Makefile | 102 - arch/i386/boot98/bootsect.S | 397 - arch/i386/boot98/install.sh | 40 - arch/i386/boot98/mtools.conf.in | 17 - arch/i386/boot98/setup.S | 876 -- arch/i386/boot98/video.S | 262 - 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-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/std_resources.c | 204 - arch/i386/kernel/sys_i386.c | 1 + arch/i386/kernel/time_hpet.c | 46 + 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-pc9800/Makefile | 5 - arch/i386/mach-pc9800/setup.c | 117 - arch/i386/mach-pc9800/std_resources.c | 195 - arch/i386/mach-pc9800/topology.c | 44 - 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/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/pci/pci.c | 16 +- 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/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 | 4 +- arch/ppc/kernel/misc.S | 40 +- 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/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/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/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/defconfig | 9 +- arch/s390/kernel/compat_wrapper.S | 2 + arch/s390/kernel/entry.S | 93 +- arch/s390/kernel/entry64.S | 97 +- arch/s390/kernel/init_task.c | 1 + arch/s390/kernel/process.c | 13 +- arch/s390/kernel/ptrace.c | 28 +- arch/s390/kernel/sys_s390.c | 46 +- arch/s390/lib/memset.S | 30 - arch/s390/lib/memset64.S | 30 - arch/s390/lib/strcmp.S | 27 - arch/s390/lib/strcmp64.S | 27 - arch/s390/lib/strcpy.S | 20 - arch/s390/lib/strcpy64.S | 20 - arch/s390/lib/strncpy.S | 35 - arch/s390/lib/strncpy64.S | 35 - arch/sh/kernel/init_task.c | 1 + arch/sparc/kernel/init_task.c | 1 + arch/sparc/kernel/unaligned.c | 8 +- arch/sparc/mm/fault.c | 27 +- arch/sparc64/defconfig | 10 +- 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/mm/init.c | 19 +- arch/um/kernel/init_task.c | 2 + 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/Makefile-HEAD | 38 + 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/init.c | 4 +- arch/x86_64/mm/ioremap.c | 1 + arch/x86_64/mm/numa.c | 2 +- arch/x86_64/mm/pageattr.c | 39 +- configs/kernel-2.6.6-i586-smp.config | 2361 ----- configs/kernel-2.6.6-i686-smp.config | 2364 ----- 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/fore200e.c | 39 +- drivers/atm/fore200e.h | 26 +- drivers/base/cpu.c | 4 +- drivers/base/node.c | 7 +- drivers/block/DAC960.c | 22 +- drivers/block/Kconfig | 9 +- drivers/block/carmel.c | 2 +- drivers/block/cciss.c | 144 + 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/floppy98.c | 4682 ---------- drivers/block/ll_rw_blk.c | 11 +- drivers/block/loop.c | 4 +- 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/bluetooth/hci_ldisc.c | 4 +- drivers/cdrom/aztcd.c | 45 +- drivers/cdrom/cdrom.c | 62 +- 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_state.c | 2 + drivers/char/drm/sis_mm.c | 4 +- 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 | 31 +- drivers/char/ipmi/ipmi_si_intf.c | 61 +- 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/lp_old98.c | 537 -- 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/ppdev.c | 51 +- drivers/char/rtc.c | 5 + drivers/char/synclinkmp.c | 43 +- drivers/char/tty_io.c | 83 +- drivers/char/upd4990a.c | 432 - 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_pci.c | 20 +- drivers/char/watchdog/pcwd_usb.c | 20 +- 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/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-io.c | 23 +- 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-tcq.c | 808 -- drivers/ide/ide.c | 52 +- drivers/ide/legacy/hd98.c | 883 -- drivers/ide/legacy/pc9800.c | 84 - drivers/ide/legacy/pdc4030.c | 6 - drivers/ide/pci/aec62xx.c | 10 +- drivers/ide/pci/alim15x3.h | 27 - drivers/ide/pci/cmd64x.c | 6 +- drivers/ide/pci/cs5520.c | 21 +- drivers/ide/pci/cs5520.h | 40 - drivers/ide/pci/cs5530.c | 14 +- drivers/ide/pci/cs5530.h | 25 - drivers/ide/pci/hpt366.c | 16 +- drivers/ide/pci/ns87415.c | 12 +- drivers/ide/pci/ns87415.h | 20 - 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/rz1000.h | 26 - drivers/ide/pci/sc1200.c | 13 +- drivers/ide/pci/sc1200.h | 24 - drivers/ide/pci/siimage.c | 38 +- drivers/ide/pci/siimage.h | 53 - drivers/ide/pci/sis5513.c | 15 +- drivers/ide/pci/sis5513.h | 25 - drivers/ide/pci/sl82c105.c | 15 +- drivers/ide/pci/sl82c105.h | 25 - drivers/ide/pci/slc90e66.c | 14 +- drivers/ide/pci/slc90e66.h | 27 - drivers/ide/pci/triflex.c | 21 +- drivers/ide/pci/triflex.h | 37 - drivers/ide/pci/trm290.c | 14 +- drivers/ide/pci/trm290.h | 20 - drivers/ide/pci/via82cxxx.c | 15 +- drivers/ide/pci/via82cxxx.h | 25 - drivers/ieee1394/csr1212.c | 6 +- drivers/ieee1394/eth1394.c | 5 +- drivers/ieee1394/hosts.c | 22 +- drivers/ieee1394/ieee1394_core.c | 6 + drivers/ieee1394/nodemgr.c | 14 +- drivers/ieee1394/sbp2.c | 4 +- drivers/input/Kconfig | 7 + drivers/input/evdev.c | 8 +- drivers/input/gameport/ns558.c | 14 +- drivers/input/gameport/vortex.c | 6 +- drivers/input/joydev.c | 41 +- drivers/input/joystick/adi.c | 30 +- drivers/input/joystick/analog.c | 42 +- drivers/input/joystick/gf2k.c | 12 +- drivers/input/keyboard/98kbd.c | 391 - drivers/input/keyboard/Kconfig | 12 - drivers/input/keyboard/atkbd.c | 2 +- drivers/input/misc/98spkr.c | 96 - drivers/input/misc/Kconfig | 4 - drivers/input/misc/pcspkr.c | 4 +- drivers/input/misc/uinput.c | 6 +- drivers/input/mouse/98busmouse.c | 197 - drivers/input/mouse/Kconfig | 11 - drivers/input/mouse/Makefile | 1 - drivers/input/mousedev.c | 290 +- drivers/input/serio/98kbd-io.c | 179 - drivers/input/serio/Kconfig | 10 - drivers/input/serio/ambakmi.c | 38 +- drivers/input/serio/serport.c | 10 +- drivers/input/tsdev.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/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/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 | 45 +- drivers/net/3c523.c | 4 +- drivers/net/3c527.c | 4 +- drivers/net/3c59x.c | 26 +- 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/apne.c | 6 +- drivers/net/arm/Kconfig | 17 + drivers/net/arm/Makefile | 1 + drivers/net/at1700.c | 94 +- drivers/net/b44.c | 2 +- drivers/net/cs89x0.c | 8 +- drivers/net/defxx.c | 6 +- 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 | 5 - drivers/net/eql.c | 6 +- drivers/net/es3210.c | 2 + drivers/net/eth16i.c | 10 +- drivers/net/ewrk3.c | 6 +- drivers/net/fc/iph5526.c | 2 +- drivers/net/fealnx.c | 8 +- drivers/net/fmv18x.c | 6 +- drivers/net/forcedeth.c | 3 +- drivers/net/hp-plus.c | 6 +- drivers/net/hp.c | 10 +- drivers/net/hp100.c | 2 + drivers/net/ibmlana.c | 6 +- drivers/net/ibmveth.c | 4 +- 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 | 7 +- drivers/net/ne.c | 6 +- drivers/net/ne2.c | 8 +- drivers/net/ne2k_cbus.c | 887 -- drivers/net/ne2k_cbus.h | 481 -- drivers/net/ne3210.c | 10 +- drivers/net/ni52.c | 4 +- drivers/net/ns83820.c | 4 +- drivers/net/oaknet.c | 2 +- drivers/net/pcmcia/axnet_cs.c | 2 +- drivers/net/pcnet32.c | 3 +- drivers/net/plip.c | 2 +- drivers/net/r8169.c | 2 +- drivers/net/s2io.c | 82 +- drivers/net/s2io.h | 1 - drivers/net/sb1000.c | 4 +- drivers/net/sis900.c | 2 +- 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 | 2 +- drivers/net/stnic.c | 4 +- drivers/net/sun3_82586.c | 4 +- drivers/net/sun3lance.c | 1 - drivers/net/sungem.c | 2 +- drivers/net/sunhme.c | 4 +- drivers/net/tg3.c | 27 +- drivers/net/tlan.c | 2 +- drivers/net/tulip/Kconfig | 15 +- drivers/net/tulip/tulip_core.c | 6 +- drivers/net/tulip/winbond-840.c | 10 +- drivers/net/via-rhine.c | 311 +- 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/yellowfin.c | 7 +- 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/i82365.c | 14 +- drivers/pnp/isapnp/core.c | 5 - drivers/s390/block/dasd.c | 6 +- drivers/s390/block/dasd_eckd.c | 10 +- drivers/s390/cio/css.c | 75 +- drivers/s390/cio/device.c | 18 +- drivers/s390/cio/device_fsm.c | 174 +- 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/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/lasi700.c | 3 +- drivers/scsi/megaraid.c | 50 +- drivers/scsi/osst.c | 14 +- drivers/scsi/pc980155.c | 299 - drivers/scsi/pc980155.h | 52 - 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_pc98.c | 69 - 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 | 3 - drivers/serial/Kconfig | 13 - drivers/serial/Makefile | 1 - drivers/serial/amba-pl011.c | 81 +- drivers/serial/serial98.c | 1120 --- 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/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/usbtest.c | 16 +- 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/radeonfb.c | 4 +- drivers/video/riva/Makefile | 8 +- drivers/video/riva/fbdev.c | 368 +- drivers/video/riva/rivafb.h | 33 +- 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/aio.c | 44 +- fs/autofs/root.c | 13 +- fs/binfmt_aout.c | 26 +- fs/binfmt_elf.c | 2 +- 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/compat.c | 255 + fs/compat_ioctl.c | 21 +- fs/devfs/base.c | 12 +- fs/devpts/inode.c | 2 +- fs/direct-io.c | 15 +- fs/dquot.c | 30 +- fs/eventpoll.c | 283 +- fs/exec.c | 10 +- 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 | 76 +- fs/ext3/namei.c | 4 +- fs/ext3/resize.c | 956 --- fs/ext3/super.c | 64 +- fs/ext3/xattr.c | 2 +- fs/fcntl.c | 1 + fs/file_table.c | 1 + fs/fs-writeback.c | 23 +- 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/journal.c | 12 +- 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/namei.c | 2 + fs/namespace.c | 2 + fs/ncpfs/dir.c | 10 +- fs/ncpfs/ioctl.c | 317 +- fs/ncpfs/ncplib_kernel.c | 42 +- fs/ncpfs/ncplib_kernel.h | 8 +- fs/nfs/direct.c | 4 +- fs/nfs/idmap.c | 11 +- fs/nfs/write.c | 5 +- fs/nfsd/nfs3xdr.c | 39 +- 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/open.c | 3 + fs/partitions/Kconfig | 7 - fs/partitions/check.c | 1 - fs/partitions/msdos.c | 17 +- fs/partitions/nec98.c | 188 - fs/partitions/nec98.h | 10 - fs/proc/array.c | 5 +- fs/proc/base.c | 9 +- fs/proc/generic.c | 12 +- fs/proc/proc_misc.c | 5 +- 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/stat.c | 4 + fs/super.c | 15 +- fs/sysfs/file.c | 1 + fs/udf/crc.c | 2 +- fs/udf/misc.c | 12 +- include/acpi/acpi_drivers.h | 2 +- include/asm-alpha/resource.h | 12 +- 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/dma.h | 149 +- include/asm-arm/arch-omap/hardware.h | 222 +- include/asm-arm/arch-omap/mux.h | 12 +- include/asm-arm/arch-omap/omap-h2.h | 35 - include/asm-arm/arch-omap/omap-innovator.h | 214 - include/asm-arm/arch-omap/omap-perseus2.h | 152 - include/asm-arm/arch-omap/uncompress.h | 2 +- include/asm-arm/arch-pxa/hardware.h | 9 - 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/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 | 3 +- 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/genapic.h | 2 - include/asm-i386/hpet.h | 3 + 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-pc9800/apm.h | 82 - include/asm-i386/mach-pc9800/bios_ebda.h | 14 - include/asm-i386/mach-pc9800/do_timer.h | 82 - include/asm-i386/mach-pc9800/io_ports.h | 30 - include/asm-i386/mach-pc9800/irq_vectors.h | 99 - include/asm-i386/mach-pc9800/mach_reboot.h | 21 - include/asm-i386/mach-pc9800/mach_time.h | 100 - include/asm-i386/mach-pc9800/mach_timer.h | 31 - include/asm-i386/mach-pc9800/mach_traps.h | 27 - include/asm-i386/mach-pc9800/mach_wakecpu.h | 45 - include/asm-i386/mach-pc9800/pci-functions.h | 20 - .../asm-i386/mach-pc9800/setup_arch_post.h | 29 - include/asm-i386/mach-pc9800/setup_arch_pre.h | 36 - include/asm-i386/mach-pc9800/smpboot_hooks.h | 52 - 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/pc9800.h | 27 - include/asm-i386/pc9800_sca.h | 25 - 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/std_resources.h | 14 - include/asm-i386/timex.h | 4 - include/asm-i386/unistd.h | 1 + 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/elf.h | 1 + include/asm-ppc/io.h | 2 + include/asm-ppc/mmu.h | 68 + include/asm-ppc/mmu_context.h | 5 + 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 | 22 + include/asm-ppc/unistd.h | 1 + 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/unistd.h | 1 + include/asm-s390/atomic.h | 2 +- include/asm-s390/pgtable.h | 10 +- include/asm-s390/resource.h | 10 +- include/asm-s390/spinlock.h | 8 +- 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/pgtable.h | 31 +- include/asm-sparc/resource.h | 14 +- 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/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/802_11.h | 191 - include/linux/acct.h | 145 +- include/linux/acpi.h | 4 +- include/linux/acpi_serial.h | 107 - include/linux/adb_mouse.h | 23 - include/linux/aio.h | 11 +- include/linux/atapi.h | 370 - include/linux/atm.h | 1 + include/linux/autoconf.h | 2421 ++++++ include/linux/binfmts.h | 4 + include/linux/blkdev.h | 1 + include/linux/cciss_ioctl.h | 28 + include/linux/cdrom.h | 4 +- include/linux/compat_ioctl.h | 1 + include/linux/cpu.h | 1 + include/linux/cpumask.h | 1 + include/linux/ext3_fs.h | 48 +- include/linux/ext3_fs_i.h | 17 +- include/linux/ext3_fs_sb.h | 4 - include/linux/fb.h | 58 +- include/linux/filter.h | 4 +- include/linux/fsfilter.h | 134 - 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_bridge.h | 2 +- include/linux/in_systm.h | 32 - include/linux/ipmi.h | 14 +- include/linux/ipmi_msgdefs.h | 1 + include/linux/ipmi_smi.h | 4 + include/linux/isdn_lzscomp.h | 28 - include/linux/iso_fs.h | 60 + include/linux/iso_fs_i.h | 5 +- include/linux/ixjuser.h | 2 +- include/linux/mca.h | 2 + include/linux/miscdevice.h | 1 + include/linux/mm.h | 13 +- include/linux/mpp.h | 18 - include/linux/mqueue.h | 2 + include/linux/mroute.h | 2 +- include/linux/netbeui.h | 16 - include/linux/netdevice.h | 2 +- include/linux/netfilter.h | 6 + include/linux/netfilter_ddp.h | 14 - include/linux/netfilter_ipx.h | 14 - include/linux/netfilter_x25.h | 15 - 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/ninline.h | 44 +- 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/ptrace.h | 2 + include/linux/reiserfs_fs.h | 23 +- include/linux/reiserfs_fs_i.h | 1 + include/linux/sched.h | 34 +- include/linux/security.h | 19 +- include/linux/serial_core.h | 8 - include/linux/serio.h | 1 - include/linux/signal.h | 4 + include/linux/skbuff.h | 24 + include/linux/syscalls.h | 3 +- include/linux/tcp.h | 9 +- include/linux/time.h | 12 +- include/linux/usb.h | 1 + include/linux/vinline.h | 42 +- include/net/af_unix.h | 3 + include/net/bluetooth/hci_core.h | 12 +- include/net/bluetooth/rfcomm.h | 2 +- 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/route.h | 5 +- include/net/sock.h | 69 +- include/net/tcp.h | 41 +- 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/asound.h | 8 +- include/sound/core.h | 4 +- include/sound/emu10k1.h | 6 +- include/sound/trident.h | 2 +- include/video/sisfb.h | 251 +- init/Kconfig | 13 + init/main.c | 12 +- ipc/mqueue.c | 84 +- ipc/msg.c | 2 + ipc/sem.c | 2 + ipc/shm.c | 17 +- ipc/util.c | 8 +- kernel/acct.c | 105 +- kernel/compat.c | 63 +- kernel/exit.c | 13 +- kernel/fork.c | 29 +- kernel/futex.c | 3 +- kernel/kmod.c | 20 +- kernel/module.c | 3 +- kernel/pid.c | 1 + kernel/posix-timers.c | 86 +- kernel/power/pmdisk.c | 39 +- kernel/power/swsusp.c | 43 +- kernel/printk.c | 1 + kernel/sched.c | 27 +- kernel/signal.c | 54 +- kernel/sys.c | 69 +- kernel/sysctl.c | 54 +- kernel/timer.c | 5 +- kernel/uid16.c | 12 +- kernel/user.c | 7 +- kernel/workqueue.c | 69 +- lib/idr.c | 89 +- lib/string.c | 2 +- lib/vsprintf.c | 10 +- mm/filemap.c | 78 +- mm/fremap.c | 18 +- mm/highmem.c | 1 - mm/memory.c | 21 +- mm/mempool.c | 6 - mm/mincore.c | 1 - mm/mlock.c | 7 +- mm/mmap.c | 66 +- mm/mprotect.c | 1 - mm/mremap.c | 8 +- mm/msync.c | 1 - mm/nommu.c | 1 - mm/oom_kill.c | 1 - mm/page-writeback.c | 68 +- mm/page_alloc.c | 60 +- mm/rmap.c | 53 +- mm/shmem.c | 21 +- mm/swap_state.c | 7 +- mm/swapfile.c | 2 + mm/truncate.c | 10 +- mm/vmalloc.c | 1 - mm/vmscan.c | 361 +- net/appletalk/ddp.c | 19 +- net/atm/ioctl.c | 10 +- net/ax25/af_ax25.c | 28 +- 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/sco.c | 8 +- net/bridge/br.c | 3 - net/bridge/br_if.c | 2 +- net/bridge/br_ioctl.c | 18 +- net/bridge/br_private.h | 7 +- net/core/Makefile | 2 +- net/core/dev.c | 51 +- net/core/dst.c | 62 +- net/core/iovec.c | 2 +- net/core/net-sysfs.c | 2 +- net/core/netfilter.c | 8 - net/core/sock.c | 43 + net/decnet/af_decnet.c | 10 +- net/decnet/dn_dev.c | 20 +- net/econet/af_econet.c | 37 +- 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_ctl.c | 4 +- net/ipv4/netfilter/arp_tables.c | 24 +- net/ipv4/netfilter/ip_conntrack_core.c | 11 +- net/ipv4/netfilter/ip_fw_compat.c | 3 +- net/ipv4/netfilter/ip_tables.c | 22 +- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 16 +- net/ipv4/tcp.c | 134 +- net/ipv4/tcp_input.c | 14 +- net/ipv4/tcp_ipv4.c | 6 +- net/ipv4/tcp_minisocks.c | 3 +- net/ipv4/tcp_output.c | 8 +- net/ipv4/tcp_timer.c | 29 +- net/ipv4/udp.c | 2 +- net/ipv6/ah6.c | 87 +- net/ipv6/exthdrs.c | 10 +- net/ipv6/ip6_input.c | 2 +- net/ipv6/ip6_output.c | 27 +- 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/irda/af_irda.c | 10 +- net/irda/irda_device.c | 4 +- net/key/af_key.c | 2 +- net/netlink/af_netlink.c | 8 +- net/netrom/af_netrom.c | 13 +- net/packet/af_packet.c | 2 +- net/rose/af_rose.c | 21 +- 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/socket.c | 17 +- net/socket.c | 31 +- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/auth_gss/svcauth_gss.c | 18 +- net/sunrpc/svcsock.c | 2 +- net/sunrpc/xprt.c | 4 +- net/wanrouter/af_wanpipe.c | 2 +- net/x25/af_x25.c | 27 +- scripts/basic/.docproc.cmd | 66 + scripts/basic/.fixdep.cmd | 74 + scripts/basic/.split-include.cmd | 55 + scripts/basic/docproc | Bin 0 -> 13331 bytes scripts/basic/fixdep | Bin 0 -> 8820 bytes scripts/basic/split-include | Bin 0 -> 7905 bytes scripts/kconfig/.conf.cmd | 1 + scripts/kconfig/.conf.o.cmd | 53 + scripts/kconfig/.libkconfig.so.cmd | 1 + scripts/kconfig/.mconf.o.cmd | 86 + scripts/kconfig/.zconf.tab.o.cmd | 71 + scripts/kconfig/conf | Bin 0 -> 13640 bytes scripts/kconfig/conf.o | Bin 0 -> 9872 bytes scripts/kconfig/lex.zconf.c | 3688 ++++++++ scripts/kconfig/libkconfig.so | Bin 0 -> 87324 bytes scripts/kconfig/mconf.o | Bin 0 -> 19968 bytes scripts/kconfig/zconf.tab.c | 2127 +++++ scripts/kconfig/zconf.tab.h | 125 + scripts/kconfig/zconf.tab.o | Bin 0 -> 92684 bytes 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/policydb.c | 10 +- security/selinux/ss/services.c | 12 + sound/core/control.c | 56 +- sound/core/oss/pcm_oss.c | 71 +- 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/oss/seq_oss.c | 8 +- sound/core/timer.c | 42 +- sound/drivers/mpu401/mpu401.c | 11 - sound/drivers/opl3/opl3_lib.c | 20 - sound/isa/Kconfig | 10 - sound/isa/cs423x/Makefile | 2 - sound/isa/cs423x/pc98.c | 438 - sound/isa/cs423x/pc9801_118_magic.h | 411 - sound/isa/cs423x/sound_pc9800.h | 23 - sound/isa/sb/emu8000_patch.c | 6 +- sound/isa/sscape.c | 12 +- sound/isa/wavefront/wavefront_synth.c | 31 +- sound/oss/awe_wave.c | 4 +- sound/oss/cmpci.c | 144 +- sound/oss/dmasound/dmasound_atari.c | 1 - sound/oss/i810_audio.c | 74 +- sound/oss/msnd.c | 22 +- sound/oss/opl3.c | 8 +- sound/oss/sb_card.c | 8 +- sound/oss/trident.c | 72 +- sound/oss/wavfront.c | 23 +- 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/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 +- 1319 files changed, 40874 insertions(+), 50832 deletions(-) rename configs/kernel-2.6.6-i586.config => .config (95%) create mode 100644 .config.cmd rename configs/kernel-2.6.6-i686.config => .config.old (97%) delete mode 100644 arch/i386/boot98/Makefile delete mode 100644 arch/i386/boot98/bootsect.S delete mode 100644 arch/i386/boot98/install.sh delete mode 100644 arch/i386/boot98/mtools.conf.in delete mode 100644 arch/i386/boot98/setup.S delete mode 100644 arch/i386/boot98/video.S delete mode 100644 arch/i386/kernel/std_resources.c delete mode 100644 arch/i386/mach-pc9800/Makefile delete mode 100644 arch/i386/mach-pc9800/setup.c delete mode 100644 arch/i386/mach-pc9800/std_resources.c delete mode 100644 arch/i386/mach-pc9800/topology.c delete mode 100644 arch/s390/lib/memset.S delete mode 100644 arch/s390/lib/memset64.S delete mode 100644 arch/s390/lib/strcmp.S delete mode 100644 arch/s390/lib/strcmp64.S delete mode 100644 arch/s390/lib/strcpy.S delete mode 100644 arch/s390/lib/strcpy64.S delete mode 100644 arch/s390/lib/strncpy.S delete mode 100644 arch/s390/lib/strncpy64.S create mode 100644 arch/x86_64/kernel/Makefile-HEAD delete mode 100644 configs/kernel-2.6.6-i586-smp.config delete mode 100644 configs/kernel-2.6.6-i686-smp.config delete mode 100644 drivers/block/floppy98.c delete mode 100644 drivers/char/lp_old98.c delete mode 100644 drivers/char/upd4990a.c delete mode 100644 drivers/ide/ide-tcq.c delete mode 100644 drivers/ide/legacy/hd98.c delete mode 100644 drivers/ide/legacy/pc9800.c delete mode 100644 drivers/ide/pci/alim15x3.h delete mode 100644 drivers/ide/pci/cs5520.h delete mode 100644 drivers/ide/pci/cs5530.h delete mode 100644 drivers/ide/pci/ns87415.h delete mode 100644 drivers/ide/pci/rz1000.h delete mode 100644 drivers/ide/pci/sc1200.h delete mode 100644 drivers/ide/pci/siimage.h delete mode 100644 drivers/ide/pci/sis5513.h delete mode 100644 drivers/ide/pci/sl82c105.h delete mode 100644 drivers/ide/pci/slc90e66.h delete mode 100644 drivers/ide/pci/triflex.h delete mode 100644 drivers/ide/pci/trm290.h delete mode 100644 drivers/ide/pci/via82cxxx.h delete mode 100644 drivers/input/keyboard/98kbd.c delete mode 100644 drivers/input/misc/98spkr.c delete mode 100644 drivers/input/mouse/98busmouse.c delete mode 100644 drivers/input/serio/98kbd-io.c delete mode 100644 drivers/net/ne2k_cbus.c delete mode 100644 drivers/net/ne2k_cbus.h delete mode 100644 drivers/scsi/pc980155.c delete mode 100644 drivers/scsi/pc980155.h delete mode 100644 drivers/scsi/scsi_pc98.c delete mode 100644 drivers/serial/serial98.c delete mode 100644 fs/ext3/resize.c delete mode 100644 fs/partitions/nec98.c delete mode 100644 fs/partitions/nec98.h delete mode 100644 include/asm-arm/arch-omap/omap-h2.h delete mode 100644 include/asm-arm/arch-omap/omap-innovator.h delete mode 100644 include/asm-arm/arch-omap/omap-perseus2.h delete mode 100644 include/asm-i386/mach-pc9800/apm.h delete mode 100644 include/asm-i386/mach-pc9800/bios_ebda.h delete mode 100644 include/asm-i386/mach-pc9800/do_timer.h delete mode 100644 include/asm-i386/mach-pc9800/io_ports.h delete mode 100644 include/asm-i386/mach-pc9800/irq_vectors.h delete mode 100644 include/asm-i386/mach-pc9800/mach_reboot.h delete mode 100644 include/asm-i386/mach-pc9800/mach_time.h delete mode 100644 include/asm-i386/mach-pc9800/mach_timer.h delete mode 100644 include/asm-i386/mach-pc9800/mach_traps.h delete mode 100644 include/asm-i386/mach-pc9800/mach_wakecpu.h delete mode 100644 include/asm-i386/mach-pc9800/pci-functions.h delete mode 100644 include/asm-i386/mach-pc9800/setup_arch_post.h delete mode 100644 include/asm-i386/mach-pc9800/setup_arch_pre.h delete mode 100644 include/asm-i386/mach-pc9800/smpboot_hooks.h delete mode 100644 include/asm-i386/pc9800.h delete mode 100644 include/asm-i386/pc9800_sca.h delete mode 100644 include/asm-i386/std_resources.h delete mode 100644 include/linux/802_11.h delete mode 100644 include/linux/acpi_serial.h delete mode 100644 include/linux/adb_mouse.h delete mode 100644 include/linux/atapi.h create mode 100644 include/linux/autoconf.h delete mode 100644 include/linux/fsfilter.h delete mode 100644 include/linux/in_systm.h delete mode 100644 include/linux/isdn_lzscomp.h delete mode 100644 include/linux/mpp.h delete mode 100644 include/linux/netbeui.h delete mode 100644 include/linux/netfilter_ddp.h delete mode 100644 include/linux/netfilter_ipx.h delete mode 100644 include/linux/netfilter_x25.h create mode 100644 scripts/basic/.docproc.cmd create mode 100644 scripts/basic/.fixdep.cmd create mode 100644 scripts/basic/.split-include.cmd create mode 100755 scripts/basic/docproc create mode 100755 scripts/basic/fixdep create mode 100755 scripts/basic/split-include create mode 100644 scripts/kconfig/.conf.cmd create mode 100644 scripts/kconfig/.conf.o.cmd create mode 100644 scripts/kconfig/.libkconfig.so.cmd create mode 100644 scripts/kconfig/.mconf.o.cmd create mode 100644 scripts/kconfig/.zconf.tab.o.cmd create mode 100755 scripts/kconfig/conf create mode 100644 scripts/kconfig/conf.o create mode 100644 scripts/kconfig/lex.zconf.c create mode 100755 scripts/kconfig/libkconfig.so create mode 100644 scripts/kconfig/mconf.o create mode 100644 scripts/kconfig/zconf.tab.c create mode 100644 scripts/kconfig/zconf.tab.h create mode 100644 scripts/kconfig/zconf.tab.o delete mode 100644 sound/isa/cs423x/pc98.c delete mode 100644 sound/isa/cs423x/pc9801_118_magic.h delete mode 100644 sound/isa/cs423x/sound_pc9800.h diff --git a/configs/kernel-2.6.6-i586.config b/.config similarity index 95% rename from configs/kernel-2.6.6-i586.config rename to .config index 9b0f25868..6dd5c2337 100644 --- a/configs/kernel-2.6.6-i586.config +++ b/.config @@ -21,6 +21,17 @@ CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y CONFIG_BSD_PROCESS_ACCT=y + +# +# Class Based Kernel Resource Management +# +CONFIG_CKRM=y +CONFIG_RCFS_FS=y +CONFIG_CKRM_TYPE_TASKCLASS=y +CONFIG_CKRM_RES_NUMTASKS=y +CONFIG_CKRM_TYPE_SOCKETCLASS=y +CONFIG_CKRM_RES_LISTENAQ=m +# CONFIG_BSD_PROCESS_ACCT_V3 is not set CONFIG_SYSCTL=y CONFIG_AUDIT=y CONFIG_AUDITSYSCALL=y @@ -28,6 +39,7 @@ CONFIG_LOG_BUF_SHIFT=17 CONFIG_HOTPLUG=y # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set +CONFIG_DELAY_ACCT=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y @@ -62,10 +74,10 @@ CONFIG_X86_PC=y # CONFIG_X86_ES7000 is not set # CONFIG_M386 is not set # CONFIG_M486 is not set -CONFIG_M586=y +# CONFIG_M586 is not set # CONFIG_M586TSC is not set # CONFIG_M586MMX is not set -# CONFIG_M686 is not set +CONFIG_M686=y # CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set # CONFIG_MPENTIUMM is not set @@ -85,28 +97,29 @@ CONFIG_X86_XADD=y CONFIG_X86_L1_CACHE_SHIFT=7 CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_X86_PPRO_FENCE=y -CONFIG_X86_F00F_BUG=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y CONFIG_X86_POPAD_OK=y -CONFIG_X86_ALIGNMENT_16=y +CONFIG_X86_GOOD_APIC=y CONFIG_X86_INTEL_USERCOPY=y -# CONFIG_X86_4G is not set -# CONFIG_X86_SWITCH_PAGETABLES is not set -# CONFIG_X86_4G_VM_LAYOUT is not set -# CONFIG_X86_UACCESS_INDIRECT is not set -# CONFIG_X86_HIGH_ENTRY is not set +CONFIG_X86_USE_PPRO_CHECKSUM=y +CONFIG_X86_4G=y +CONFIG_X86_SWITCH_PAGETABLES=y +CONFIG_X86_4G_VM_LAYOUT=y +CONFIG_X86_UACCESS_INDIRECT=y +CONFIG_X86_HIGH_ENTRY=y CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y # CONFIG_SMP is not set # CONFIG_PREEMPT is not set # CONFIG_X86_UP_APIC is not set +CONFIG_X86_TSC=y CONFIG_X86_MCE=y # CONFIG_X86_MCE_NONFATAL is not set CONFIG_TOSHIBA=m CONFIG_I8K=m -# CONFIG_MICROCODE is not set +CONFIG_MICROCODE=m CONFIG_X86_MSR=m CONFIG_X86_CPUID=m @@ -187,7 +200,7 @@ CONFIG_X86_ACPI_CPUFREQ=m # CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set CONFIG_X86_POWERNOW_K6=m CONFIG_X86_POWERNOW_K7=y -CONFIG_X86_POWERNOW_K8=m +# CONFIG_X86_POWERNOW_K8 is not set # CONFIG_X86_GX_SUSPMOD is not set CONFIG_X86_SPEEDSTEP_CENTRINO=y CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y @@ -198,7 +211,7 @@ CONFIG_X86_P4_CLOCKMOD=m CONFIG_X86_SPEEDSTEP_LIB=y # CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set CONFIG_X86_LONGRUN=y -# CONFIG_X86_LONGHAUL is not set +CONFIG_X86_LONGHAUL=y # # Bus options (PCI, PCMCIA, EISA, MCA, ISA) @@ -402,7 +415,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 @@ -494,8 +506,9 @@ CONFIG_SCSI_FC_ATTRS=m # SCSI low-level drivers # CONFIG_BLK_DEV_3W_XXXX_RAID=m +# CONFIG_SCSI_3W_9XXX is not set # CONFIG_SCSI_7000FASST is not set -CONFIG_SCSI_ACARD=m +# CONFIG_SCSI_ACARD is not set CONFIG_SCSI_AHA152X=m CONFIG_SCSI_AHA1542=m CONFIG_SCSI_AACRAID=m @@ -523,14 +536,13 @@ CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_SVW=m CONFIG_SCSI_ATA_PIIX=m CONFIG_SCSI_SATA_PROMISE=m -CONFIG_SCSI_SATA_SX4=m +# CONFIG_SCSI_SATA_SX4 is not set CONFIG_SCSI_SATA_SIL=m CONFIG_SCSI_SATA_SIS=m 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 @@ -567,7 +579,7 @@ CONFIG_SCSI_QLA6312=m CONFIG_SCSI_QLA6322=m # CONFIG_SCSI_SYM53C416 is not set # CONFIG_SCSI_DC395x is not set -CONFIG_SCSI_DC390T=m +# CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_T128 is not set # CONFIG_SCSI_U14_34F is not set # CONFIG_SCSI_ULTRASTOR is not set @@ -581,7 +593,7 @@ CONFIG_PCMCIA_AHA152X=m CONFIG_PCMCIA_FDOMAIN=m CONFIG_PCMCIA_NINJA_SCSI=m CONFIG_PCMCIA_QLOGIC=m -CONFIG_PCMCIA_SYM53C500=m +# CONFIG_PCMCIA_SYM53C500 is not set # # Old CD-ROM drivers (not SCSI, not IDE) @@ -601,6 +613,9 @@ CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_BLK_DEV_DM=m CONFIG_DM_CRYPT=m +# CONFIG_DM_SNAPSHOT is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_ZERO is not set # # Fusion MPT device support @@ -614,32 +629,7 @@ CONFIG_FUSION_LAN=m # # IEEE 1394 (FireWire) support # -CONFIG_IEEE1394=m - -# -# Subsystem Options -# -# CONFIG_IEEE1394_VERBOSEDEBUG is not set -CONFIG_IEEE1394_OUI_DB=y -# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set - -# -# Device Drivers -# -# CONFIG_IEEE1394_PCILYNX is not set -CONFIG_IEEE1394_OHCI1394=m - -# -# Protocol Drivers -# -CONFIG_IEEE1394_VIDEO1394=m -CONFIG_IEEE1394_SBP2=m -# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set -# CONFIG_IEEE1394_ETH1394 is not set -CONFIG_IEEE1394_DV1394=m -CONFIG_IEEE1394_RAWIO=m -CONFIG_IEEE1394_CMP=m -CONFIG_IEEE1394_AMDTP=m +# CONFIG_IEEE1394 is not set # # I2O device support @@ -684,6 +674,7 @@ CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m CONFIG_INET_IPCOMP=m +CONFIG_ACCEPT_QUEUES=y # # IP: Virtual Server Configuration @@ -1033,7 +1024,7 @@ CONFIG_EL16=m CONFIG_EL3=m CONFIG_3C515=m CONFIG_VORTEX=m -# CONFIG_TYPHOON is not set +CONFIG_TYPHOON=m CONFIG_LANCE=m CONFIG_NET_VENDOR_SMC=y CONFIG_WD80x3=m @@ -1062,7 +1053,7 @@ CONFIG_PCMCIA_XIRCOM=m CONFIG_DEPCA=m CONFIG_HP100=m # CONFIG_NET_ISA is not set -CONFIG_NE2000=m +# CONFIG_NE2000 is not set CONFIG_NET_PCI=y CONFIG_PCNET32=m CONFIG_AMD8111_ETH=m @@ -1095,6 +1086,7 @@ CONFIG_SUNDANCE=m CONFIG_TLAN=m CONFIG_VIA_RHINE=m CONFIG_VIA_RHINE_MMIO=y +# CONFIG_VIA_VELOCITY is not set CONFIG_NET_POCKET=y CONFIG_ATP=m CONFIG_DE600=m @@ -1588,6 +1580,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 # @@ -1644,7 +1637,7 @@ CONFIG_SENSORS_LM80=m CONFIG_SENSORS_LM83=m CONFIG_SENSORS_LM85=m CONFIG_SENSORS_LM90=m -CONFIG_SENSORS_MAX1619=m +# CONFIG_SENSORS_MAX1619 is not set CONFIG_SENSORS_VIA686A=m CONFIG_SENSORS_W83781D=m CONFIG_SENSORS_W83L785TS=m @@ -1656,7 +1649,7 @@ CONFIG_SENSORS_W83627HF=m CONFIG_SENSORS_EEPROM=m CONFIG_SENSORS_PCF8574=m CONFIG_SENSORS_PCF8591=m -CONFIG_SENSORS_RTC8564=m +# CONFIG_SENSORS_RTC8564 is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set @@ -1727,7 +1720,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 @@ -1748,8 +1786,9 @@ CONFIG_FB_VGA16=m CONFIG_FB_VESA=y CONFIG_VIDEO_SELECT=y CONFIG_FB_HGA=m -CONFIG_FB_HGA_ACCEL=y +# CONFIG_FB_HGA_ACCEL is not set CONFIG_FB_RIVA=m +# CONFIG_FB_RIVA_I2C is not set CONFIG_FB_I810=m CONFIG_FB_I810_GTF=y CONFIG_FB_MATROX=m @@ -1773,10 +1812,10 @@ CONFIG_FB_ATY_GX=y CONFIG_FB_NEOMAGIC=m CONFIG_FB_KYRO=m CONFIG_FB_3DFX=m -CONFIG_FB_3DFX_ACCEL=y +# CONFIG_FB_3DFX_ACCEL is not set CONFIG_FB_VOODOO1=m CONFIG_FB_TRIDENT=m -CONFIG_FB_TRIDENT_ACCEL=y +# CONFIG_FB_TRIDENT_ACCEL is not set # CONFIG_FB_VIRTUAL is not set # @@ -1960,6 +1999,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 is not set CONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_ISD200=y @@ -1984,7 +2024,7 @@ CONFIG_USB_WACOM=m CONFIG_USB_KBTAB=m CONFIG_USB_POWERMATE=m CONFIG_USB_MTOUCH=m -CONFIG_USB_EGALAX=m +# CONFIG_USB_EGALAX is not set CONFIG_USB_XPAD=m CONFIG_USB_ATI_REMOTE=m @@ -2096,8 +2136,8 @@ CONFIG_USB_RIO500=m CONFIG_USB_LEGOTOWER=m CONFIG_USB_LCD=m CONFIG_USB_LED=m -# CONFIG_USB_CYTHERM is not set -CONFIG_USB_PHIDGETSERVO=m +CONFIG_USB_CYTHERM=m +# CONFIG_USB_PHIDGETSERVO is not set CONFIG_USB_TEST=m # @@ -2122,9 +2162,7 @@ CONFIG_FS_MBCACHE=y CONFIG_REISERFS_FS=m # CONFIG_REISERFS_CHECK is not set CONFIG_REISERFS_PROC_INFO=y -CONFIG_REISERFS_FS_XATTR=y -CONFIG_REISERFS_FS_POSIX_ACL=y -CONFIG_REISERFS_FS_SECURITY=y +# CONFIG_REISERFS_FS_XATTR is not set CONFIG_JFS_FS=m CONFIG_JFS_POSIX_ACL=y # CONFIG_JFS_DEBUG is not set @@ -2159,7 +2197,9 @@ CONFIG_UDF_FS=m CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m -# CONFIG_NTFS_FS is not set +CONFIG_NTFS_FS=y +# CONFIG_NTFS_DEBUG is not set +# CONFIG_NTFS_RW is not set # # Pseudo filesystems @@ -2174,6 +2214,10 @@ CONFIG_TMPFS=y CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_RAMFS=y +CONFIG_RELAYFS_FS=y +CONFIG_KLOG_CHANNEL=y +CONFIG_KLOG_CHANNEL_AUTOENABLE=y +CONFIG_KLOG_CHANNEL_SHIFT=21 # # Miscellaneous filesystems @@ -2247,7 +2291,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 @@ -2312,7 +2355,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y CONFIG_MAGIC_SYSRQ=y # CONFIG_DEBUG_SPINLOCK is not set # CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_HIGHMEM is not set +CONFIG_DEBUG_HIGHMEM=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SPINLOCK_SLEEP=y # CONFIG_FRAME_POINTER is not set @@ -2374,5 +2417,4 @@ CONFIG_LIBCRC32C=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m CONFIG_X86_BIOS_REBOOT=y -CONFIG_X86_STD_RESOURCES=y CONFIG_PC=y diff --git a/.config.cmd b/.config.cmd new file mode 100644 index 000000000..d5aa21909 --- /dev/null +++ b/.config.cmd @@ -0,0 +1,170 @@ +deps_config := \ + lib/Kconfig \ + crypto/Kconfig \ + security/selinux/Kconfig \ + security/Kconfig \ + kernel/vserver/Kconfig \ + arch/i386/oprofile/Kconfig \ + fs/nls/Kconfig \ + fs/partitions/Kconfig \ + fs/ncpfs/Kconfig \ + fs/Kconfig \ + drivers/usb/gadget/Kconfig \ + drivers/usb/misc/Kconfig \ + drivers/usb/serial/Kconfig \ + drivers/usb/net/Kconfig \ + drivers/usb/media/Kconfig \ + drivers/usb/image/Kconfig \ + drivers/usb/input/Kconfig \ + drivers/usb/storage/Kconfig \ + drivers/usb/class/Kconfig \ + drivers/usb/host/Kconfig \ + drivers/usb/core/Kconfig \ + drivers/usb/Kconfig \ + sound/oss/Kconfig \ + sound/parisc/Kconfig \ + sound/sparc/Kconfig \ + sound/pcmcia/Kconfig \ + sound/usb/Kconfig \ + sound/arm/Kconfig \ + sound/ppc/Kconfig \ + sound/pci/Kconfig \ + sound/isa/Kconfig \ + sound/drivers/Kconfig \ + sound/core/Kconfig \ + sound/oss/dmasound/Kconfig \ + sound/Kconfig \ + drivers/video/logo/Kconfig \ + drivers/video/console/Kconfig \ + drivers/video/Kconfig \ + drivers/media/common/Kconfig \ + drivers/media/dvb/bt8xx/Kconfig \ + drivers/media/dvb/b2c2/Kconfig \ + drivers/media/dvb/ttusb-dec/Kconfig \ + drivers/media/dvb/ttusb-budget/Kconfig \ + drivers/media/dvb/ttpci/Kconfig \ + drivers/media/dvb/frontends/Kconfig \ + drivers/media/dvb/dvb-core/Kconfig \ + drivers/media/dvb/Kconfig \ + drivers/media/radio/Kconfig \ + drivers/media/video/Kconfig \ + drivers/media/Kconfig \ + drivers/misc/Kconfig \ + drivers/i2c/chips/Kconfig \ + drivers/i2c/busses/Kconfig \ + drivers/i2c/algos/Kconfig \ + drivers/i2c/Kconfig \ + drivers/char/pcmcia/Kconfig \ + drivers/char/drm/Kconfig \ + drivers/char/agp/Kconfig \ + drivers/char/ftape/Kconfig \ + drivers/char/watchdog/Kconfig \ + drivers/char/ipmi/Kconfig \ + drivers/serial/Kconfig \ + drivers/char/Kconfig \ + drivers/input/misc/Kconfig \ + drivers/input/touchscreen/Kconfig \ + drivers/input/joystick/iforce/Kconfig \ + drivers/input/joystick/Kconfig \ + drivers/input/mouse/Kconfig \ + drivers/input/keyboard/Kconfig \ + drivers/input/serio/Kconfig \ + drivers/input/gameport/Kconfig \ + drivers/input/Kconfig \ + drivers/telephony/Kconfig \ + drivers/isdn/hardware/eicon/Kconfig \ + drivers/isdn/hardware/avm/Kconfig \ + drivers/isdn/hardware/Kconfig \ + drivers/isdn/capi/Kconfig \ + drivers/isdn/hysdn/Kconfig \ + drivers/isdn/tpam/Kconfig \ + drivers/isdn/act2000/Kconfig \ + drivers/isdn/sc/Kconfig \ + drivers/isdn/pcbit/Kconfig \ + drivers/isdn/icn/Kconfig \ + drivers/isdn/hisax/Kconfig \ + drivers/isdn/i4l/Kconfig \ + drivers/isdn/Kconfig \ + drivers/s390/net/Kconfig \ + drivers/atm/Kconfig \ + drivers/net/wan/Kconfig \ + drivers/net/pcmcia/Kconfig \ + drivers/net/wireless/Kconfig \ + drivers/net/tokenring/Kconfig \ + drivers/net/tulip/Kconfig \ + drivers/net/arm/Kconfig \ + drivers/net/arcnet/Kconfig \ + drivers/net/Kconfig \ + net/tux/Kconfig \ + drivers/bluetooth/Kconfig \ + net/bluetooth/cmtp/Kconfig \ + net/bluetooth/bnep/Kconfig \ + net/bluetooth/rfcomm/Kconfig \ + net/bluetooth/Kconfig \ + drivers/net/irda/Kconfig \ + net/irda/ircomm/Kconfig \ + net/irda/irnet/Kconfig \ + net/irda/irlan/Kconfig \ + net/irda/Kconfig \ + drivers/net/hamradio/Kconfig \ + net/ax25/Kconfig \ + net/sched/Kconfig \ + drivers/net/appletalk/Kconfig \ + net/ipx/Kconfig \ + net/llc/Kconfig \ + net/decnet/Kconfig \ + net/sctp/Kconfig \ + net/xfrm/Kconfig \ + net/bridge/netfilter/Kconfig \ + net/decnet/netfilter/Kconfig \ + net/ipv6/netfilter/Kconfig \ + net/ipv4/netfilter/Kconfig \ + net/ipv6/Kconfig \ + net/ipv4/ipvs/Kconfig \ + net/ipv4/Kconfig \ + net/Kconfig \ + drivers/macintosh/Kconfig \ + drivers/message/i2o/Kconfig \ + drivers/ieee1394/Kconfig \ + drivers/message/fusion/Kconfig \ + drivers/md/Kconfig \ + drivers/cdrom/Kconfig \ + drivers/scsi/pcmcia/Kconfig \ + drivers/scsi/arm/Kconfig \ + drivers/scsi/qla2xxx/Kconfig \ + drivers/scsi/aic7xxx/Kconfig.aic79xx \ + drivers/scsi/aic7xxx/Kconfig.aic7xxx \ + drivers/scsi/Kconfig \ + drivers/ide/Kconfig \ + drivers/s390/block/Kconfig \ + drivers/block/paride/Kconfig \ + drivers/block/Kconfig \ + drivers/pnp/pnpbios/Kconfig \ + drivers/pnp/isapnp/Kconfig \ + drivers/pnp/Kconfig \ + drivers/parport/Kconfig \ + drivers/mtd/nand/Kconfig \ + drivers/mtd/devices/Kconfig \ + drivers/mtd/maps/Kconfig \ + drivers/mtd/chips/Kconfig \ + drivers/mtd/Kconfig \ + drivers/base/Kconfig \ + drivers/Kconfig \ + fs/Kconfig.binfmt \ + drivers/pci/hotplug/Kconfig \ + drivers/pcmcia/Kconfig \ + drivers/mca/Kconfig \ + drivers/eisa/Kconfig \ + drivers/pci/Kconfig \ + drivers/cpufreq/Kconfig \ + arch/i386/kernel/cpu/cpufreq/Kconfig \ + drivers/acpi/Kconfig \ + kernel/power/Kconfig \ + drivers/firmware/Kconfig \ + drivers/block/Kconfig.iosched \ + init/Kconfig \ + arch/i386/Kconfig + +.config include/linux/autoconf.h: $(deps_config) + +$(deps_config): diff --git a/configs/kernel-2.6.6-i686.config b/.config.old similarity index 97% rename from configs/kernel-2.6.6-i686.config rename to .config.old index b7db2faad..7445bef55 100644 --- a/configs/kernel-2.6.6-i686.config +++ b/.config.old @@ -21,6 +21,7 @@ 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=y CONFIG_AUDITSYSCALL=y @@ -250,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 @@ -403,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 @@ -495,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 @@ -531,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 @@ -602,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 @@ -1096,6 +1099,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 @@ -1589,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 # @@ -1728,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 @@ -1751,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 @@ -1961,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 @@ -2248,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 @@ -2318,18 +2369,6 @@ CONFIG_DEBUG_INFO=y CONFIG_DEBUG_SPINLOCK_SLEEP=y # CONFIG_FRAME_POINTER is not set -# -# Linux VServer -# -CONFIG_VSERVER_LEGACY=y -CONFIG_PROC_SECURE=y -# CONFIG_VSERVER_HARDCPU is not set -# CONFIG_INOXID_NONE is not set -# CONFIG_INOXID_GID16 is not set -CONFIG_INOXID_GID24=y -# CONFIG_INOXID_GID32 is not set -# CONFIG_INOXID_MAGIC is not set - # # Security options # @@ -2375,5 +2414,4 @@ CONFIG_LIBCRC32C=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m CONFIG_X86_BIOS_REBOOT=y -CONFIG_X86_STD_RESOURCES=y CONFIG_PC=y 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/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/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/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/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/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 3a78846b9..211b4108c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 -SUBLEVEL = 6 -EXTRAVERSION = -1.422-vs1.9.1 +SUBLEVEL = 7 +EXTRAVERSION = -1.441-vs1.9.1 NAME=Zonked Quokka # *DOCUMENTATION* @@ -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 db1feb1b3..a65f4277a 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/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/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-lh7a40x/Kconfig b/arch/arm/mach-lh7a40x/Kconfig index b1934bfa4..8a17867a6 100644 --- a/arch/arm/mach-lh7a40x/Kconfig +++ b/arch/arm/mach-lh7a40x/Kconfig @@ -34,6 +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-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/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/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-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/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/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/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/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/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 093f3e64c..47356589a 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 cdbfe9e5c..51777001a 100644 --- a/arch/h8300/kernel/ptrace.c +++ b/arch/h8300/kernel/ptrace.c @@ -118,18 +118,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 75ee13720..d4c5d79ab 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. @@ -1373,12 +1377,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/boot98/Makefile b/arch/i386/boot98/Makefile deleted file mode 100644 index ccedae277..000000000 --- a/arch/i386/boot98/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -# -# arch/i386/boot/Makefile -# -# 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. -# -# Copyright (C) 1994 by Linus Torvalds -# - -# ROOT_DEV specifies the default root-device when making the image. -# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case -# the default of FLOPPY is used by 'build'. - -ROOT_DEV := CURRENT - -# If you want to preset the SVGA mode, uncomment the next line and -# set SVGA_MODE to whatever number you want. -# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. -# The number is the same as you would ordinarily press at bootup. - -SVGA_MODE := -DSVGA_MODE=NORMAL_VGA - -# If you want the RAM disk device, define this to be the size in blocks. - -#RAMDISK := -DRAMDISK=512 - -targets := vmlinux.bin bootsect bootsect.o setup setup.o \ - zImage bzImage -subdir- := compressed - -host-progs := tools/build - -# --------------------------------------------------------------------------- - -$(obj)/zImage: IMAGE_OFFSET := 0x1000 -$(obj)/zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -$(obj)/bzImage: IMAGE_OFFSET := 0x100000 -$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ -$(obj)/bzImage: BUILDFLAGS := -b - -quiet_cmd_image = BUILD $@ -cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \ - $(obj)/vmlinux.bin $(ROOT_DEV) > $@ - -$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ - $(obj)/vmlinux.bin $(obj)/tools/build FORCE - $(call if_changed,image) - @echo 'Kernel: $@ is ready' - -$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE - $(call if_changed,objcopy) - -LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary -LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext - -$(obj)/setup $(obj)/bootsect: %: %.o FORCE - $(call if_changed,ld) - -$(obj)/compressed/vmlinux: FORCE - $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ - -# Set this if you want to pass append arguments to the zdisk/fdimage kernel -FDARGS = - -$(obj)/mtools.conf: $(src)/mtools.conf.in - sed -e 's|@OBJ@|$(obj)|g' < $< > $@ - -# This requires write access to /dev/fd0 -zdisk: $(BOOTIMAGE) $(obj)/mtools.conf - MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync - syslinux /dev/fd0 ; sync - echo 'default linux $(FDARGS)' | \ - MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync - -# These require being root or having syslinux 2.02 or higher installed -fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 - MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync - syslinux $(obj)/fdimage ; sync - echo 'default linux $(FDARGS)' | \ - MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync - -fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf - dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 - MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync - syslinux $(obj)/fdimage ; sync - echo 'default linux $(FDARGS)' | \ - MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg - MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync - -zlilo: $(BOOTIMAGE) - if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi - if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi - cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz - cp System.map $(INSTALL_PATH)/ - if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi - -install: $(BOOTIMAGE) - sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" diff --git a/arch/i386/boot98/bootsect.S b/arch/i386/boot98/bootsect.S deleted file mode 100644 index dc7d86ced..000000000 --- a/arch/i386/boot98/bootsect.S +++ /dev/null @@ -1,397 +0,0 @@ -/* - * bootsect.S - boot sector for NEC PC-9800 series - * - * Linux/98 project at Kyoto University Microcomputer Club (KMC) - * FUJITA Norimasa, TAKAI Kousuke 1997-1998 - * rewritten by TAKAI Kousuke (as86 -> gas), Nov 1999 - * - * Based on: - * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds - * modified by Drew Eckhardt - * modified by Bruce Evans (bde) - * - * bootsect.S is loaded at 0x1FC00 or 0x1FE00 by the bios-startup routines, - * and moves itself out of the way to address 0x90000, and jumps there. - * - * It then loads 'setup' directly after itself (0x90200), and the system - * at 0x10000, using BIOS interrupts. - * - * NOTE! currently system is at most (8*65536-4096) bytes long. This should - * be no problem, even in the future. I want to keep it simple. This 508 kB - * kernel size should be enough, especially as this doesn't contain the - * buffer cache as in minix (and especially now that the kernel is - * compressed :-) - * - * The loader has been made as simple as possible, and continuous - * read errors will result in a unbreakable loop. Reboot by hand. It - * loads pretty fast by getting whole tracks at a time whenever possible. - */ - -#include /* for CONFIG_ROOT_RDONLY */ -#include - -SETUPSECTS = 4 /* default nr of setup-sectors */ -BOOTSEG = 0x1FC0 /* original address of boot-sector */ -INITSEG = DEF_INITSEG /* we move boot here - out of the way */ -SETUPSEG = DEF_SETUPSEG /* setup starts here */ -SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */ -SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ - /* to be loaded */ -ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ -SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ - -#ifndef SVGA_MODE -#define SVGA_MODE ASK_VGA -#endif - -#ifndef RAMDISK -#define RAMDISK 0 -#endif - -#ifndef ROOT_RDONLY -#define ROOT_RDONLY 1 -#endif - -/* normal/hireso text VRAM segments */ -#define NORMAL_TEXT 0xa000 -#define HIRESO_TEXT 0xe000 - -/* bios work area addresses */ -#define EXPMMSZ 0x0401 -#define BIOS_FLAG 0x0501 -#define DISK_BOOT 0x0584 - -.code16 -.text - -.global _start -_start: - -#if 0 /* hook for debugger, harmless unless BIOS is fussy (old HP) */ - int $0x3 -#endif - jmp real_start - .ascii "Linux 98" - .word 0 -real_start: - xorw %di, %di /* %di = 0 */ - movw %di, %ss /* %ss = 0 */ - movw $0x03F0, %sp - pushw %cx /* for hint */ - - movw $0x0A00, %ax /* normal mode defaults (80x25) */ - - testb $0x08, %ss:BIOS_FLAG /* check hi-reso bit */ - jnz set_crt_mode -/* - * Hi-Reso (high-resolution) machine. - * - * Some hi-reso machines have no RAMs on bank 8/A (0x080000 - 0x0BFFFF). - * On such machines we get two RAM banks from top of protect menory and - * map them on bank 8/A. - * These work-around must be done before moving myself on INITSEG (0x090000-). - */ - movw $(HIRESO_TEXT >> 8), %cs:(vram + 1) /* text VRAM segment */ - - /* set memory window */ - movb $0x08, %al - outb %al, $0x91 /* map native RAM (if any) */ - movb $0x0A, %al - outb %al, $0x93 - - /* check bank ram A */ - pushw $0xA500 - popw %ds - movw (%di), %cx /* %si == 0 from entry */ - notw %cx - movw %cx, (%di) - - movw $0x43F, %dx /* cache flush for 486 and up. */ - movb $0xA0, %al - outb %al, %dx - - cmpw %cx, (%di) - je hireso_done - - /* - * Write test failed; we have no native RAM on 080000h - 0BFFFFh. - * Take 256KB of RAM from top of protected memory. - */ - movb %ss:EXPMMSZ, %al - subb $2, %al /* reduce 2 x 128KB */ - movb %al, %ss:EXPMMSZ - addb %al, %al - addb $0x10, %al - outb %al, $0x91 - addb $2, %al - outb %al, $0x93 - -hireso_done: - movb $0x10, %al /* CRT mode 80x31, %ah still 0Ah */ - -set_crt_mode: - int $0x18 /* set CRT mode */ - - movb $0x0C, %ah /* turn on text displaying */ - int $0x18 - - xorw %dx, %dx /* position cursor to home */ - movb $0x13, %ah - int $0x18 - - movb $0x11, %ah /* turn cursor displaying on */ - int $0x18 - - /* move 1 kilobytes from [BOOTSEG:0000h] to [INITSEG:0000h] */ - cld - xorw %si, %si - pushw $INITSEG - popw %es - movw $512, %cx /* %di == 0 from entry */ - rep - cs - movsw - - ljmp $INITSEG, $go - -go: - pushw %cs - popw %ds /* %ds = %cs */ - - popw %dx /* %dh = saved %ch passed from BIOS */ - movb %ss:DISK_BOOT, %al - andb $0xf0, %al /* %al = Device Address */ - movb $18, %ch /* 18 secs/track, 512 b/sec (1440 KB) */ - cmpb $0x30, %al - je try512 - cmpb $0x90, %al /* 1 MB I/F, 1 MB floppy */ - je try1.2M - cmpb $0xf0, %al /* 640 KB I/F, 1 MB floppy */ - je try1.2M - movb $9, %ch /* 9 secs/track, 512 b/sec ( 720 KB) */ - cmpb $0x10, %al /* 1 MB I/F, 640 KB floppy */ - je try512 - cmpb $0x70, %al /* 640 KB I/F, 640 KB floppy */ - jne error /* unknown device? */ - - /* XXX: Does it make sense to support 8 secs/track, 512 b/sec - (640 KB) floppy? */ - -try512: movb $2, %cl /* 512 b/sec */ -lasttry:call tryload -/* - * Display error message and halt - */ -error: movw $error_msg, %si - call print -wait_reboot: - movb $0x0, %ah - int $0x18 /* wait keyboard input */ -1: movb $0, %al - outb %al, $0xF0 /* reset CPU */ - jmp 1b /* just in case... */ - -try1.2M:cmpb $2, %dh - je try2HC - movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */ - call tryload - movb $15, %ch /* 15 secs/track, 512 b/sec (1200 KB) */ - jmp try512 -try2HC: movw $0x0F02, %cx /* 15 secs/track, 512 b/sec (1200 KB) */ - call tryload - movw $0x0803, %cx /* 8 secs/track, 1024 b/sec (1232 KB) */ - jmp lasttry - -/* - * Try to load SETUP and SYSTEM provided geometry information in %cx. - * This routine *will not* return on successful load... - */ -tryload: - movw %cx, sectlen - movb %ss:DISK_BOOT, %al - movb $0x7, %ah /* recalibrate the drive */ - int $0x1b - jc error /* recalibration should succeed */ - - /* - * Load SETUP into memory. It is assumed that SETUP fits into - * first cylinder (2 tracks, 9KB on 2DD, 15-18KB on 2HD). - */ - movb $0, %bl - movb setup_sects, %bh - incb %bh - shlw %bx /* %bx = (setup_sects + 1) * 512 */ - movw $128, %bp - shlw %cl, %bp /* %bp = */ - subw %bp, %bx /* length to load */ - movw $0x0002, %dx /* head 0, sector 2 */ - movb %cl, %ch /* `N' for sector address */ - movb $0, %cl /* cylinder 0 */ - pushw %cs - popw %es /* %es = %cs (= INITSEG) */ - movb $0xd6, %ah /* read, multi-track, MFM */ - int $0x1b /* load it! */ - jc read_error - - movw $loading_msg, %si - call print - - movw $SYSSEG, %ax - movw %ax, %es /* %es = SYSSEG */ - -/* - * This routine loads the system at address 0x10000, making sure - * no 64kB boundaries are crossed. We try to load it as fast as - * possible, loading whole tracks whenever we can. - * - * in: es - starting address segment (normally 0x1000) - */ - movb %ch, %cl - addb $7, %cl /* %cl = log2 */ - shrw %cl, %bx /* %bx = # of phys. sectors in SETUP */ - addb %bl, %dl /* %dl = start sector # of SYSTEM */ - decb %dl /* %dl is 0-based in below loop */ - -rp_read_newseg: - xorw %bp, %bp /* = starting address within segment */ -#ifdef __BIG_KERNEL__ - bootsect_kludge = 0x220 /* 0x200 (size of bootsector) + 0x20 (offset */ - lcall *bootsect_kludge /* of bootsect_kludge in setup.S */ -#else - movw %es, %ax - subw $SYSSEG, %ax -#endif - cmpw syssize, %ax - ja boot /* done! */ - -rp_read: - movb sectors, %al - addb %al, %al - movb %al, %ch /* # of sectors on both surface */ - subb %dl, %al /* # of sectors left on this track */ - movb $0, %ah - shlw %cl, %ax /* # of bytes left on this track */ - movw %ax, %bx /* transfer length */ - addw %bp, %ax /* cross 64K boundary? */ - jnc 1f /* ok. */ - jz 1f /* also ok. */ - /* - * Oops, we are crossing 64K boundary... - * Adjust transfer length to make transfer fit in the boundary. - * - * Note: sector size is assumed to be a measure of 65536. - */ - xorw %bx, %bx - subw %bp, %bx -1: pushw %dx - movw $dot_msg, %si /* give progress message */ - call print - xchgw %ax, %dx - movb $0, %ah - divb sectors - xchgb %al, %ah - xchgw %ax, %dx /* %dh = head # / %dl = sector # */ - incb %dl /* fix %dl to 1-based */ - pushw %cx - movw cylinder, %cx - movb $0xd6, %ah /* read, multi-track, seek, MFM */ - movb %ss:DISK_BOOT, %al - int $0x1b - popw %cx - popw %dx - jc read_error - movw %bx, %ax /* # of bytes just read */ - shrw %cl, %ax /* %ax = # of sectors just read */ - addb %al, %dl /* advance sector # */ - cmpb %ch, %dl /* %ch = # of sectors/cylinder */ - jb 2f - incb cylinder /* next cylinder */ - xorb %dl, %dl /* sector 0 */ -2: addw %bx, %bp /* advance offset pointer */ - jnc rp_read - /* offset pointer wrapped; advance segment pointer. */ - movw %es, %ax - addw $0x1000, %ax - movw %ax, %es - jmp rp_read_newseg - -read_error: - ret - -boot: movw %cs, %ax /* = INITSEG */ - /* movw %ax, %ds */ - movw %ax, %ss - movw $0x4000, %sp /* 0x4000 is arbitrary value >= - * length of bootsect + length of - * setup + room for stack; - * PC-9800 never have BIOS workareas - * on high memory. - */ -/* - * After that we check which root-device to use. If the device is - * not defined, /dev/fd0 (2, 0) will be used. - */ - cmpw $0, root_dev - jne 3f - movb $2, root_dev+1 -3: - -/* - * After that (everything loaded), we jump to the setup-routine - * loaded directly after the bootblock: - */ - ljmp $SETUPSEG, $0 - -/* - * Subroutine for print string on console. - * %cs:%si - pointer to message - */ -print: - pushaw - pushw %ds - pushw %es - pushw %cs - popw %ds - lesw curpos, %di /* %es:%di = current text VRAM addr. */ -1: xorw %ax, %ax - lodsb - testb %al, %al - jz 2f /* end of string */ - stosw /* character code */ - movb $0xE1, %es:0x2000-2(%di) /* character attribute */ - jmp 1b -2: movw %di, %dx - movb $0x13, %ah - int $0x18 /* move cursor to current point */ - popw %es - popw %ds - popaw - ret - -loading_msg: - .string "Loading" -dot_msg: - .string "." -error_msg: - .string "Read Error!" - - .org 490 - -curpos: .word 160 /* current cursor position */ -vram: .word NORMAL_TEXT /* text VRAM segment */ - -cylinder: .byte 0 /* current cylinder (lower byte) */ -sectlen: .byte 0 /* (log2 of ) - 7 */ -sectors: .byte 0x0F /* default is 2HD (15 sector/track) */ - -# XXX: This is a fairly snug fit. - -.org 497 -setup_sects: .byte SETUPSECTS -root_flags: .word ROOT_RDONLY -syssize: .word SYSSIZE -swap_dev: .word SWAP_DEV -ram_size: .word RAMDISK -vid_mode: .word SVGA_MODE -root_dev: .word ROOT_DEV -boot_flag: .word 0xAA55 diff --git a/arch/i386/boot98/install.sh b/arch/i386/boot98/install.sh deleted file mode 100644 index 90f2452b3..000000000 --- a/arch/i386/boot98/install.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# arch/i386/boot/install.sh -# -# 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. -# -# Copyright (C) 1995 by Linus Torvalds -# -# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin -# -# "make install" script for i386 architecture -# -# Arguments: -# $1 - kernel version -# $2 - kernel image file -# $3 - kernel map file -# $4 - default install path (blank if root directory) -# - -# User may have a custom install script - -if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi -if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi - -# Default install - same as make zlilo - -if [ -f $4/vmlinuz ]; then - mv $4/vmlinuz $4/vmlinuz.old -fi - -if [ -f $4/System.map ]; then - mv $4/System.map $4/System.old -fi - -cat $2 > $4/vmlinuz -cp $3 $4/System.map - -if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi diff --git a/arch/i386/boot98/mtools.conf.in b/arch/i386/boot98/mtools.conf.in deleted file mode 100644 index efd6d2490..000000000 --- a/arch/i386/boot98/mtools.conf.in +++ /dev/null @@ -1,17 +0,0 @@ -# -# mtools configuration file for "make (b)zdisk" -# - -# Actual floppy drive -drive a: - file="/dev/fd0" - -# 1.44 MB floppy disk image -drive v: - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter - -# 2.88 MB floppy disk image (mostly for virtual uses) -drive w: - file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter - - diff --git a/arch/i386/boot98/setup.S b/arch/i386/boot98/setup.S deleted file mode 100644 index 4ed91417e..000000000 --- a/arch/i386/boot98/setup.S +++ /dev/null @@ -1,876 +0,0 @@ -/* - * setup.S Copyright (C) 1991, 1992 Linus Torvalds - * - * setup.s is responsible for getting the system data from the BIOS, - * and putting them into the appropriate places in system memory. - * both setup.s and system has been loaded by the bootblock. - * - * This code asks the bios for memory/disk/other parameters, and - * puts them in a "safe" place: 0x90000-0x901FF, ie where the - * boot-block used to be. It is then up to the protected mode - * system to read them from there before the area is overwritten - * for buffer-blocks. - * - * Move PS/2 aux init code to psaux.c - * (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92 - * - * some changes and additional features by Christoph Niemann, - * March 1993/June 1994 (Christoph.Niemann@linux.org) - * - * add APM BIOS checking by Stephen Rothwell, May 1994 - * (sfr@canb.auug.org.au) - * - * High load stuff, initrd support and position independency - * by Hans Lermen & Werner Almesberger, February 1996 - * , - * - * Video handling moved to video.S by Martin Mares, March 1996 - * - * - * Extended memory detection scheme retwiddled by orc@pell.chi.il.us (david - * parsons) to avoid loadlin confusion, July 1997 - * - * Transcribed from Intel (as86) -> AT&T (gas) by Chris Noe, May 1999. - * - * - * Fix to work around buggy BIOSes which dont use carry bit correctly - * and/or report extended memory in CX/DX for e801h memory size detection - * call. As a result the kernel got wrong figures. The int15/e801h docs - * from Ralf Brown interrupt list seem to indicate AX/BX should be used - * anyway. So to avoid breaking many machines (presumably there was a reason - * to orginally use CX/DX instead of AX/BX), we do a kludge to see - * if CX/DX have been changed in the e801 call and if so use AX/BX . - * Michael Miller, April 2001 - * - * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes - * by Robert Schwebel, December 2001 - * - * Heavily modified for NEC PC-9800 series by Kyoto University Microcomputer - * Club (KMC) Linux/98 project , 1997-1999 - */ - -#include -#include -#include -#include -#include -#include -#include - -/* Signature words to ensure LILO loaded us right */ -#define SIG1 0xAA55 -#define SIG2 0x5A5A - -#define HIRESO_TEXT 0xe000 -#define NORMAL_TEXT 0xa000 - -#define BIOS_FLAG2 0x0400 -#define BIOS_FLAG5 0x0458 -#define RDISK_EQUIP 0x0488 -#define BIOS_FLAG 0x0501 -#define KB_SHFT_STS 0x053a -#define DISK_EQUIP 0x055c - -INITSEG = DEF_INITSEG # 0x9000, we move boot here, out of the way -SYSSEG = DEF_SYSSEG # 0x1000, system loaded at 0x10000 (65536). -SETUPSEG = DEF_SETUPSEG # 0x9020, this is the current segment - # ... and the former contents of CS - -DELTA_INITSEG = SETUPSEG - INITSEG # 0x0020 - -.code16 -.globl begtext, begdata, begbss, endtext, enddata, endbss - -.text -begtext: -.data -begdata: -.bss -begbss: -.text - -start: - jmp trampoline - -# This is the setup header, and it must start at %cs:2 (old 0x9020:2) - - .ascii "HdrS" # header signature - .word 0x0203 # header version number (>= 0x0105) - # or else old loadlin-1.5 will fail) -realmode_swtch: .word 0, 0 # default_switch, SETUPSEG -start_sys_seg: .word SYSSEG - .word kernel_version # pointing to kernel version string - # above section of header is compatible - # with loadlin-1.5 (header v1.5). Don't - # change it. - -type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, - # Bootlin, SYSLX, bootsect...) - # See Documentation/i386/boot.txt for - # assigned ids - -# flags, unused bits must be zero (RFU) bit within loadflags -loadflags: -LOADED_HIGH = 1 # If set, the kernel is loaded high -CAN_USE_HEAP = 0x80 # If set, the loader also has set - # heap_end_ptr to tell how much - # space behind setup.S can be used for - # heap purposes. - # Only the loader knows what is free -#ifndef __BIG_KERNEL__ - .byte 0 -#else - .byte LOADED_HIGH -#endif - -setup_move_size: .word 0x8000 # size to move, when setup is not - # loaded at 0x90000. We will move setup - # to 0x90000 then just before jumping - # into the kernel. However, only the - # loader knows how much data behind - # us also needs to be loaded. - -code32_start: # here loaders can put a different - # start address for 32-bit code. -#ifndef __BIG_KERNEL__ - .long 0x1000 # 0x1000 = default for zImage -#else - .long 0x100000 # 0x100000 = default for big kernel -#endif - -ramdisk_image: .long 0 # address of loaded ramdisk image - # Here the loader puts the 32-bit - # address where it loaded the image. - # This only will be read by the kernel. - -ramdisk_size: .long 0 # its size in bytes - -bootsect_kludge: - .long 0 # obsolete - -heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later) - # space from here (exclusive) down to - # end of setup code can be used by setup - # for local heap purposes. - -pad1: .word 0 -cmd_line_ptr: .long 0 # (Header version 0x0202 or later) - # If nonzero, a 32-bit pointer - # to the kernel command line. - # The command line should be - # located between the start of - # setup and the end of low - # memory (0xa0000), or it may - # get overwritten before it - # gets read. If this field is - # used, there is no longer - # anything magical about the - # 0x90000 segment; the setup - # can be located anywhere in - # low memory 0x10000 or higher. - -ramdisk_max: .long MAXMEM-1 # (Header version 0x0203 or later) - # The highest safe address for - # the contents of an initrd - -trampoline: call start_of_setup - .space 1024 -# End of setup header ##################################################### - -start_of_setup: -# Set %ds = %cs, we know that SETUPSEG = %cs at this point - movw %cs, %ax # aka SETUPSEG - movw %ax, %ds -# Check signature at end of setup - cmpw $SIG1, setup_sig1 - jne bad_sig - - cmpw $SIG2, setup_sig2 - jne bad_sig - - jmp good_sig1 - -# Routine to print asciiz string at ds:si -prtstr: - lodsb - andb %al, %al - jz fin - - call prtchr - jmp prtstr - -fin: ret - -no_sig_mess: .string "No setup signature found ..." - -good_sig1: - jmp good_sig - -# We now have to find the rest of the setup code/data -bad_sig: - movw %cs, %ax # SETUPSEG - subw $DELTA_INITSEG, %ax # INITSEG - movw %ax, %ds - xorb %bh, %bh - movb (497), %bl # get setup sect from bootsect - subw $4, %bx # LILO loads 4 sectors of setup - shlw $8, %bx # convert to words (1sect=2^8 words) - movw %bx, %cx - shrw $3, %bx # convert to segment - addw $SYSSEG, %bx - movw %bx, %cs:start_sys_seg -# Move rest of setup code/data to here - movw $2048, %di # four sectors loaded by LILO - subw %si, %si - pushw %cs - popw %es - movw $SYSSEG, %ax - movw %ax, %ds - rep - movsw - movw %cs, %ax # aka SETUPSEG - movw %ax, %ds - cmpw $SIG1, setup_sig1 - jne no_sig - - cmpw $SIG2, setup_sig2 - jne no_sig - - jmp good_sig - -no_sig: - lea no_sig_mess, %si - call prtstr - -no_sig_loop: - hlt - jmp no_sig_loop - -good_sig: - movw %cs, %ax # aka SETUPSEG - subw $DELTA_INITSEG, %ax # aka INITSEG - movw %ax, %ds -# Check if an old loader tries to load a big-kernel - testb $LOADED_HIGH, %cs:loadflags # Do we have a big kernel? - jz loader_ok # No, no danger for old loaders. - - cmpb $0, %cs:type_of_loader # Do we have a loader that - # can deal with us? - jnz loader_ok # Yes, continue. - - pushw %cs # No, we have an old loader, - popw %ds # die. - lea loader_panic_mess, %si - call prtstr - - jmp no_sig_loop - -loader_panic_mess: .string "Wrong loader, giving up..." - -loader_ok: -# Get memory size (extended mem, kB) - -# On PC-9800, memory size detection is done completely in 32-bit -# kernel initialize code (kernel/setup.c). - pushw %es - xorl %eax, %eax - movw %ax, %es - movb %al, (E820NR) # PC-9800 has no E820 - movb %es:(0x401), %al - shll $7, %eax - addw $1024, %ax - movw %ax, (2) - movl %eax, (0x1e0) - movw %es:(0x594), %ax - shll $10, %eax - addl %eax, (0x1e0) - popw %es - -# Check for video adapter and its parameters and allow the -# user to browse video modes. - call video # NOTE: we need %ds pointing - # to bootsector - -# Get text video mode - movb $0x0B, %ah - int $0x18 # CRT mode sense - movw $(20 << 8) + 40, %cx - testb $0x10, %al - jnz 3f - movb $20, %ch - testb $0x01, %al - jnz 1f - movb $25, %ch - jmp 1f -3: # If bit 4 was 1, it means either 1) 31 lines for hi-reso mode, - # or 2) 30 lines for PC-9821. - movb $31, %ch # hireso mode value - pushw $0 - popw %es - testb $0x08, %es:BIOS_FLAG - jnz 1f - movb $30, %ch -1: # Now we got # of rows in %ch - movb %ch, (14) - - testb $0x02, %al - jnz 2f - movb $80, %cl -2: # Now we got # of columns in %cl - movb %cl, (7) - - # Next, get horizontal frequency if supported - movw $0x3100, %ax - int $0x18 # Call CRT bios - movb %al, (6) # If 31h is unsupported, %al remains 0 - -# Get hd0-3 data... - pushw %ds # aka INITSEG - popw %es - xorw %ax, %ax - movw %ax, %ds - cld - movw $0x0080, %di - movb DISK_EQUIP+1, %ah - movb $0x80, %al - -get_hd_info: - shrb %ah - pushw %ax - jnc 1f - movb $0x84, %ah - int $0x1b - jnc 2f # Success -1: xorw %cx, %cx # `0 cylinders' means no drive -2: # Attention! Work area (drive_info) is arranged for PC-9800. - movw %cx, %ax # # of cylinders - stosw - movw %dx, %ax # # of sectors / # of heads - stosw - movw %bx, %ax # sector size in bytes - stosw - popw %ax - incb %al - cmpb $0x84, %al - jb get_hd_info - -# Get fd data... - movw DISK_EQUIP, %ax - andw $0xf00f, %ax - orb %al, %ah - movb RDISK_EQUIP, %al - notb %al - andb %al, %ah # ignore all `RAM drive' - - movb $0x30, %al - -get_fd_info: - shrb %ah - pushw %ax - jnc 1f - movb $0xc4, %ah - int $0x1b - movb %ah, %al - andb $4, %al # 1.44MB support flag - shrb %al - addb $2, %al # %al = 2 (1.2MB) or 4 (1.44MB) - jmp 2f -1: movb $0, %al # no drive -2: stosb - popw %ax - incb %al - testb $0x04, %al - jz get_fd_info - - addb $(0xb0 - 0x34), %al - jnc get_fd_info # check FDs on 640KB I/F - - pushw %es - popw %ds # %ds got bootsector again -#if 0 - mov $0, (0x1ff) # default is no pointing device -#endif - -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) -# Then check for an APM BIOS... - # %ds points to the bootsector - movw $0, 0x40 # version = 0 means no APM BIOS - movw $0x09a00, %ax # APM BIOS installation check - xorw %bx, %bx - int $0x1f - jc done_apm_bios # Nope, no APM BIOS - - cmpw $0x0504d, %bx # Check for "PM" signature - jne done_apm_bios # No signature, no APM BIOS - - testb $0x02, %cl # Is 32 bit supported? - je done_apm_bios # No 32-bit, no (good) APM BIOS - - movw $0x09a04, %ax # Disconnect first just in case - xorw %bx, %bx - int $0x1f # ignore return code - movw $0x09a03, %ax # 32 bit connect - xorl %ebx, %ebx - int $0x1f - jc no_32_apm_bios # Ack, error. - - movw %ax, (66) # BIOS code segment - movl %ebx, (68) # BIOS entry point offset - movw %cx, (72) # BIOS 16 bit code segment - movw %dx, (74) # BIOS data segment - movl %esi, (78) # BIOS code segment length - movw %di, (82) # BIOS data segment length -# Redo the installation check as the 32 bit connect -# modifies the flags returned on some BIOSs - movw $0x09a00, %ax # APM BIOS installation check - xorw %bx, %bx - int $0x1f - jc apm_disconnect # error -> shouldn't happen - - cmpw $0x0504d, %bx # check for "PM" signature - jne apm_disconnect # no sig -> shouldn't happen - - movw %ax, (64) # record the APM BIOS version - movw %cx, (76) # and flags - jmp done_apm_bios - -apm_disconnect: # Tidy up - movw $0x09a04, %ax # Disconnect - xorw %bx, %bx - int $0x1f # ignore return code - - jmp done_apm_bios - -no_32_apm_bios: - andw $0xfffd, (76) # remove 32 bit support bit -done_apm_bios: -#endif - -# Pass cursor position to kernel... - movw %cs:cursor_address, %ax - shrw %ax # cursor_address is 2 bytes unit - movb $80, %cl - divb %cl - xchgb %al, %ah # (0) = %al = X, (1) = %ah = Y - movw %ax, (0) - -#if 0 - movw $msg_cpos, %si - call prtstr_cs - call prthex - call prtstr_cs - movw %ds, %ax - call prthex - call prtstr_cs - movb $0x11, %ah - int $0x18 - movb $0, %ah - int $0x18 - .section .rodata, "a" -msg_cpos: .string "Cursor position: 0x" - .string ", %ds:0x" - .string "\r\n" - .previous -#endif - -# Now we want to move to protected mode ... - cmpw $0, %cs:realmode_swtch - jz rmodeswtch_normal - - lcall *%cs:realmode_swtch - - jmp rmodeswtch_end - -rmodeswtch_normal: - pushw %cs - call default_switch - -rmodeswtch_end: -# we get the code32 start address and modify the below 'jmpi' -# (loader may have changed it) - movl %cs:code32_start, %eax - movl %eax, %cs:code32 - -# Now we move the system to its rightful place ... but we check if we have a -# big-kernel. In that case we *must* not move it ... - testb $LOADED_HIGH, %cs:loadflags - jz do_move0 # .. then we have a normal low - # loaded zImage - # .. or else we have a high - # loaded bzImage - jmp end_move # ... and we skip moving - -do_move0: - movw $0x100, %ax # start of destination segment - movw %cs, %bp # aka SETUPSEG - subw $DELTA_INITSEG, %bp # aka INITSEG - movw %cs:start_sys_seg, %bx # start of source segment - cld -do_move: - movw %ax, %es # destination segment - incb %ah # instead of add ax,#0x100 - movw %bx, %ds # source segment - addw $0x100, %bx - subw %di, %di - subw %si, %si - movw $0x800, %cx - rep - movsw - cmpw %bp, %bx # assume start_sys_seg > 0x200, - # so we will perhaps read one - # page more than needed, but - # never overwrite INITSEG - # because destination is a - # minimum one page below source - jb do_move - -end_move: -# then we load the segment descriptors - movw %cs, %ax # aka SETUPSEG - movw %ax, %ds - -# Check whether we need to be downward compatible with version <=201 - cmpl $0, cmd_line_ptr - jne end_move_self # loader uses version >=202 features - cmpb $0x20, type_of_loader - je end_move_self # bootsect loader, we know of it - -# Boot loader does not support boot protocol version 2.02. -# If we have our code not at 0x90000, we need to move it there now. -# We also then need to move the params behind it (commandline) -# Because we would overwrite the code on the current IP, we move -# it in two steps, jumping high after the first one. - movw %cs, %ax - cmpw $SETUPSEG, %ax - je end_move_self - - cli # make sure we really have - # interrupts disabled ! - # because after this the stack - # should not be used - subw $DELTA_INITSEG, %ax # aka INITSEG - movw %ss, %dx - cmpw %ax, %dx - jb move_self_1 - - addw $INITSEG, %dx - subw %ax, %dx # this will go into %ss after - # the move -move_self_1: - movw %ax, %ds - movw $INITSEG, %ax # real INITSEG - movw %ax, %es - movw %cs:setup_move_size, %cx - std # we have to move up, so we use - # direction down because the - # areas may overlap - movw %cx, %di - decw %di - movw %di, %si - subw $move_self_here+0x200, %cx - rep - movsb - ljmp $SETUPSEG, $move_self_here - -move_self_here: - movw $move_self_here+0x200, %cx - rep - movsb - movw $SETUPSEG, %ax - movw %ax, %ds - movw %dx, %ss - -end_move_self: # now we are at the right place - lidt idt_48 # load idt with 0,0 - xorl %eax, %eax # Compute gdt_base - movw %ds, %ax # (Convert %ds:gdt to a linear ptr) - shll $4, %eax - addl $gdt, %eax - movl %eax, (gdt_48+2) - lgdt gdt_48 # load gdt with whatever is - # appropriate - -# that was painless, now we enable A20 - - outb %al, $0xf2 # A20 on - movb $0x02, %al - outb %al, $0xf6 # also A20 on; making ITF's - # way our model - - # PC-9800 seems to enable A20 at the moment of `outb'; - # so we don't wait unlike IBM PCs (see ../setup.S). - -# enable DMA to access memory over 0x100000 (1MB). - - movw $0x439, %dx - inb %dx, %al - andb $(~4), %al - outb %al, %dx - -# Set DMA to increment its bank address automatically at 16MB boundary. -# Initial setting is 64KB boundary mode so that we can't run DMA crossing -# physical address 0xXXXXFFFF. - - movb $0x0c, %al - outb %al, $0x29 # ch. 0 - movb $0x0d, %al - outb %al, $0x29 # ch. 1 - movb $0x0e, %al - outb %al, $0x29 # ch. 2 - movb $0x0f, %al - outb %al, $0x29 # ch. 3 - movb $0x50, %al - outb %al, $0x11 # reinitialize DMAC - -# make sure any possible coprocessor is properly reset.. - movb $0, %al - outb %al, $0xf8 - outb %al, $0x5f # delay - -# well, that went ok, I hope. Now we mask all interrupts - the rest -# is done in init_IRQ(). - movb $0xFF, %al # mask all interrupts for now - outb %al, $0x0A - outb %al, $0x5f # delay - - movb $0x7F, %al # mask all irq's but irq7 which - outb %al, $0x02 # is cascaded - -# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't -# need no steenking BIOS anyway (except for the initial loading :-). -# The BIOS-routine wants lots of unnecessary data, and it's less -# "interesting" anyway. This is how REAL programmers do it. -# -# Well, now's the time to actually move into protected mode. To make -# things as simple as possible, we do no register set-up or anything, -# we let the gnu-compiled 32-bit programs do that. We just jump to -# absolute address 0x1000 (or the loader supplied one), -# in 32-bit protected mode. -# -# Note that the short jump isn't strictly needed, although there are -# reasons why it might be a good idea. It won't hurt in any case. - movw $1, %ax # protected mode (PE) bit - lmsw %ax # This is it! - jmp flush_instr - -flush_instr: - xorw %bx, %bx # Flag to indicate a boot - xorl %esi, %esi # Pointer to real-mode code - movw %cs, %si - subw $DELTA_INITSEG, %si - shll $4, %esi # Convert to 32-bit pointer -# NOTE: For high loaded big kernels we need a -# jmpi 0x100000,__BOOT_CS -# -# but we yet haven't reloaded the CS register, so the default size -# of the target offset still is 16 bit. -# However, using an operand prefix (0x66), the CPU will properly -# take our 48 bit far pointer. (INTeL 80386 Programmer's Reference -# Manual, Mixing 16-bit and 32-bit code, page 16-6) - - .byte 0x66, 0xea # prefix + jmpi-opcode -code32: .long 0x1000 # will be set to 0x100000 - # for big kernels - .word __BOOT_CS - -# Here's a bunch of information about your current kernel.. -kernel_version: .ascii UTS_RELEASE - .ascii " (" - .ascii LINUX_COMPILE_BY - .ascii "@" - .ascii LINUX_COMPILE_HOST - .ascii ") " - .ascii UTS_VERSION - .byte 0 - -# This is the default real mode switch routine. -# to be called just before protected mode transition -default_switch: - cli # no interrupts allowed ! - outb %al, $0x50 # disable NMI for bootup - # sequence - lret - - -# This routine prints one character (in %al) on console. -# PC-9800 doesn't have BIOS-function to do it like IBM PC's INT 10h - 0Eh, -# so we hardcode `prtchr' subroutine here. -prtchr: - pushaw - pushw %es - cmpb $0, %cs:prtchr_initialized - jnz prtchr_ok - xorw %cx, %cx - movw %cx, %es - testb $0x8, %es:BIOS_FLAG - jz 1f - movb $(HIRESO_TEXT >> 8), %cs:cursor_address+3 - movw $(80 * 31 * 2), %cs:max_cursor_offset -1: pushw %ax - call get_cursor_position - movw %ax, %cs:cursor_address - popw %ax - movb $1, %cs:prtchr_initialized -prtchr_ok: - lesw %cs:cursor_address, %di - movw $160, %bx - movb $0, %ah - cmpb $13, %al - je do_cr - cmpb $10, %al - je do_lf - - # normal (printable) character - stosw - movb $0xe1, %es:0x2000-2(%di) - jmp 1f - -do_cr: movw %di, %ax - divb %bl # %al = Y, %ah = X * 2 - mulb %bl - movw %ax, %dx - jmp 2f - -do_lf: addw %bx, %di -1: movw %cs:max_cursor_offset, %cx - cmpw %cx, %di - movw %di, %dx - jb 2f - # cursor reaches bottom of screen; scroll it - subw %bx, %dx - xorw %di, %di - movw %bx, %si - cld - subw %bx, %cx - shrw %cx - pushw %cx - rep; es; movsw - movb $32, %al # clear bottom line characters - movb $80, %cl - rep; stosw - movw $0x2000, %di - popw %cx - leaw (%bx,%di), %si - rep; es; movsw - movb $0xe1, %al # clear bottom line attributes - movb $80, %cl - rep; stosw -2: movw %dx, %cs:cursor_address - movb $0x13, %ah # move cursor to right position - int $0x18 - popw %es - popaw - ret - -cursor_address: - .word 0 - .word NORMAL_TEXT -max_cursor_offset: - .word 80 * 25 * 2 # for normal 80x25 mode - -# putstr may called without running through start_of_setup (via bootsect_panic) -# so we should initialize ourselves on demand. -prtchr_initialized: - .byte 0 - -# This routine queries GDC (graphic display controller) for current cursor -# position. Cursor position is returned in %ax (CPU offset address). -get_cursor_position: -1: inb $0x60, %al - outb %al, $0x5f # delay - outb %al, $0x5f # delay - testb $0x04, %al # Is FIFO empty? - jz 1b # no -> wait until empty - - movb $0xe0, %al # CSRR command - outb %al, $0x62 # command write - outb %al, $0x5f # delay - outb %al, $0x5f # delay - -2: inb $0x60, %al - outb %al, $0x5f # delay - outb %al, $0x5f # delay - testb $0x01, %al # Is DATA READY? - jz 2b # no -> wait until ready - - inb $0x62, %al # read xAD (L) - outb %al, $0x5f # delay - outb %al, $0x5f # delay - movb %al, %ah - inb $0x62, %al # read xAD (H) - outb %al, $0x5f # delay - outb %al, $0x5f # delay - xchgb %al, %ah # correct byte order - pushw %ax - inb $0x62, %al # read yAD (L) - outb %al, $0x5f # delay - outb %al, $0x5f # delay - inb $0x62, %al # read yAD (M) - outb %al, $0x5f # delay - outb %al, $0x5f # delay - inb $0x62, %al # read yAD (H) - # yAD is not our interest, - # so discard it. - popw %ax - addw %ax, %ax # convert to CPU address - ret - -# Descriptor tables -# -# NOTE: The intel manual says gdt should be sixteen bytes aligned for -# efficiency reasons. However, there are machines which are known not -# to boot with misaligned GDTs, so alter this at your peril! If you alter -# GDT_ENTRY_BOOT_CS (in asm/segment.h) remember to leave at least two -# empty GDT entries (one for NULL and one reserved). -# -# NOTE: On some CPUs, the GDT must be 8 byte aligned. This is -# true for the Voyager Quad CPU card which will not boot without -# This directive. 16 byte aligment is recommended by intel. -# - .align 16 -gdt: - .fill GDT_ENTRY_BOOT_CS,8,0 - - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) - .word 0 # base address = 0 - .word 0x9A00 # code read/exec - .word 0x00CF # granularity = 4096, 386 - # (+5th nibble of limit) - - .word 0xFFFF # 4Gb - (0x100000*0x1000 = 4Gb) - .word 0 # base address = 0 - .word 0x9200 # data read/write - .word 0x00CF # granularity = 4096, 386 - # (+5th nibble of limit) -gdt_end: - .align 4 - - .word 0 # alignment byte -idt_48: - .word 0 # idt limit = 0 - .word 0, 0 # idt base = 0L - - .word 0 # alignment byte -gdt_48: - .word gdt_end - gdt - 1 # gdt limit - .word 0, 0 # gdt base (filled in later) - -# Include video setup & detection code - -#include "video.S" - -# Setup signature -- must be last -setup_sig1: .word SIG1 -setup_sig2: .word SIG2 - -# After this point, there is some free space which is used by the video mode -# handling code to store the temporary mode table (not used by the kernel). - -modelist: - -.text -endtext: -.data -enddata: -.bss -endbss: diff --git a/arch/i386/boot98/video.S b/arch/i386/boot98/video.S deleted file mode 100644 index 1042619f2..000000000 --- a/arch/i386/boot98/video.S +++ /dev/null @@ -1,262 +0,0 @@ -/* video.S - * - * Video mode setup, etc. for NEC PC-9800 series. - * - * Copyright (C) 1997,98,99 Linux/98 project - * - * Based on the video.S for IBM PC: - * copyright (C) Martin Mares - */ - -/* Positions of various video parameters passed to the kernel */ -/* (see also include/linux/tty.h) */ -#define PARAM_CURSOR_POS 0x00 -#define PARAM_VIDEO_PAGE 0x04 -#define PARAM_VIDEO_MODE 0x06 -#define PARAM_VIDEO_COLS 0x07 -#define PARAM_VIDEO_EGA_BX 0x0a -#define PARAM_VIDEO_LINES 0x0e -#define PARAM_HAVE_VGA 0x0f -#define PARAM_FONT_POINTS 0x10 - -#define PARAM_VIDEO98_COMPAT 0x0a -#define PARAM_VIDEO98_HIRESO 0x0b -#define PARAM_VIDEO98_MACHTYPE 0x0c -#define PARAM_VIDEO98_LINES 0x0e -#define PARAM_VIDEO98_COLS 0x0f - -# PARAM_LFB_* and PARAM_VESAPM_* are unused on PC-9800. - -# This is the main entry point called by setup.S -# %ds *must* be pointing to the bootsector -video: xorw %ax, %ax - movw %ax, %es # %es = 0 - - movb %es:BIOS_FLAG, %al - movb %al, PARAM_VIDEO_MODE - - movb $0, PARAM_VIDEO98_HIRESO # 0 = normal - movw $NORMAL_TEXT, PARAM_VIDEO_PAGE - testb $0x8, %al - movw $(80 * 256 + 25), %ax - jz 1f - # hireso machine. - movb $1, PARAM_VIDEO98_HIRESO # !0 = hi-reso - movb $(HIRESO_TEXT >> 8), PARAM_VIDEO_PAGE + 1 - movw $(80 * 256 + 31), %ax -1: movw %ax, PARAM_VIDEO98_LINES # also sets VIDEO98_COLS - - movb $0xc0, %ch # 400-line graphic mode - movb $0x42, %ah - int $0x18 - - movw $80, PARAM_VIDEO_COLS - - movw $msg_probing, %si - call prtstr_cs - -# Check vendor from font pattern of `A'... - -1: inb $0x60, %al # wait V-sync - testb $0x20, %al - jnz 1b -2: inb $0x60, %al - testb $0x20, %al - jz 2b - - movb $0x00, %al # select font of `A' - outb %al, $0xa1 - movb $0x41, %al - outb %al, $0xa3 - - movw $8, %cx - movw PARAM_VIDEO_PAGE, %ax - cmpw $NORMAL_TEXT, %ax - je 3f - movb $24, %cl # for hi-reso machine -3: addw $0x400, %ax # %ax = CG window segment - pushw %ds - movw %ax, %ds - xorw %dx, %dx # get sum of `A' pattern... - xorw %si, %si -4: lodsw - addw %ax, %dx - loop 4b - popw %ds - - movw %dx, %ax - movw $msg_nec, %si - xorw %bx, %bx # vendor info will go into %bx - testb $8, %es:BIOS_FLAG - jnz check_hireso_vendor - cmpw $0xc7f8, %ax - je 5f - jmp 6f -check_hireso_vendor: - cmpw $0x9639, %ax # XXX: NOT VERIFIED!!! - je 5f -6: incw %bx # compatible machine - movw $msg_compat, %si -5: movb %bl, PARAM_VIDEO98_COMPAT - call prtstr_cs - - movw $msg_fontdata, %si - call prtstr_cs # " (CG sum of A = 0x" - movw %dx, %ax - call prthex - call prtstr_cs # ") PC-98" - - movb $'0', %al - pushw %ds - pushw $0xf8e8 - popw %ds - cmpw $0x2198, (0) - popw %ds - jne 7f - movb $'2', %al -7: call prtchr - call prtstr_cs # "1 " - - movb $0, PARAM_VIDEO98_MACHTYPE -#if 0 /* XXX - This check is bogus? [0000:BIOS_FLAG2]-bit7 does NOT - indicate whether it is a note machine, but merely indicates - whether it has ``RAM drive''. */ -# check note machine - testb $0x80, %es:BIOS_FLAG2 - jnz is_note - pushw %ds - pushw $0xfd80 - popw %ds - movb (4), %al - popw %ds - cmpb $0x20, %al # EPSON note A - je epson_note - cmpb $0x22, %al # EPSON note W - je epson_note - cmpb $0x27, %al # EPSON note AE - je epson_note - cmpb $0x2a, %al # EPSON note WR - jne note_done -epson_note: - movb $1, PARAM_VIDEO98_MACHTYPE - movw $msg_note, %si - call prtstr_cs -note_done: -#endif - -# print h98 ? (only NEC) - cmpb $0, PARAM_VIDEO98_COMPAT - jnz 8f # not NEC -> not H98 - - testb $0x80, %es:BIOS_FLAG5 - jz 8f # have NESA bus -> H98 - movw $msg_h98, %si - call prtstr_cs - orb $2, PARAM_VIDEO98_MACHTYPE -8: testb $0x40, %es:BIOS_FLAG5 - jz 9f - movw $msg_gs, %si - call prtstr_cs # only prints it :-) -9: - movw $msg_normal, %si # "normal" - testb $0x8, %es:BIOS_FLAG - jz 1f - movw $msg_hireso, %si -1: call prtstr_cs - - movw $msg_sysclk, %si - call prtstr_cs - movb $'5', %al - testb $0x80, %es:BIOS_FLAG - jz 2f - movb $'8', %al -2: call prtchr - call prtstr_cs - -#if 0 - testb $0x40, %es:(0x45c) - jz no_30line # no 30-line support - - movb %es:KB_SHFT_STS, %al - testb $0x01, %al # is SHIFT key pressed? - jz no_30line - - testb $0x10, %al # is CTRL key pressed? - jnz line40 - - # switch to 30-line mode - movb $30, PARAM_VIDEO98_LINES - movw $msg_30line, %si - jmp 3f - -line40: - movb $37, PARAM_VIDEO98_LINES - movw $40, PARAM_VIDEO_LINES - movw $msg_40line, %si -3: call prtstr_cs - - movb $0x32, %bh - movw $0x300c, %ax - int $0x18 # switch video mode - movb $0x0c, %ah - int $0x18 # turn on text plane - movw %cs:cursor_address, %dx - movb $0x13, %ah - int $0x18 # move cursor to correct place - mov $0x11, %ah - int $0x18 # turn on text plane - - call prtstr_cs # "Ok.\r\n" -no_30line: -#endif - ret - -prtstr_cs: - pushw %ds - pushw %cs - popw %ds - call prtstr - popw %ds - ret - -# prthex is for debugging purposes, and prints %ax in hexadecimal. -prthex: pushw %cx - movw $4, %cx -1: rolw $4, %ax - pushw %ax - andb $0xf, %al - cmpb $10, %al - sbbb $0x69, %al - das - call prtchr - popw %ax - loop 1b - popw %cx - ret - -msg_probing: .string "Probing machine: " - -msg_nec: .string "NEC" -msg_compat: .string "compatible" - -msg_fontdata: .string " (CG sum of A = 0x" - .string ") PC-98" - .string "1 " - -msg_gs: .string "(GS) " -msg_h98: .string "(H98) " - -msg_normal: .string "normal" -msg_hireso: .string "Hi-reso" - -msg_sysclk: .string " mode, system clock " - .string "MHz\r\n" - -#if 0 -msg_40line: # cpp will concat following lines, so the assembler can deal. - .ascii "\ -Video mode will be adjusted to 37-line (so-called ``40-line'') mode later.\r\n\ -THIS MODE MAY DAMAGE YOUR MONITOR PHYSICALLY. USE AT YOUR OWN RISK.\r\n" -msg_30line: .string "Switching video mode to 30-line (640x480) mode... " - .string "Ok.\r\n" -#endif 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-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/std_resources.c b/arch/i386/kernel/std_resources.c deleted file mode 100644 index 9b5647498..000000000 --- a/arch/i386/kernel/std_resources.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Machine specific resource allocation for generic. - */ - -#include -#include -#include - -#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) - -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 vram_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]) - -static int __init checksum(unsigned char *rom, unsigned long length) -{ - unsigned char *p, sum = 0; - - for (p = rom; p < rom + length; p++) - sum += *p; - return sum == 0; -} - -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 && checksum(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 (checksum(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 || !checksum(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; - } -} - -void __init request_graphics_resource(void) -{ - request_resource(&iomem_resource, &vram_resource); -} - -void __init request_standard_io_resources(void) -{ - int i; - - for (i = 0; i < STANDARD_IO_RESOURCES; i++) - request_resource(&ioport_resource, &standard_io_resources[i]); -} diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c index 4aadf9045..ce190ebc1 100644 --- a/arch/i386/kernel/sys_i386.c +++ b/arch/i386/kernel/sys_i386.c @@ -19,6 +19,7 @@ #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_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-pc9800/Makefile b/arch/i386/mach-pc9800/Makefile deleted file mode 100644 index 7fff76564..000000000 --- a/arch/i386/mach-pc9800/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for the linux kernel. -# - -obj-y := setup.o topology.o std_resources.o diff --git a/arch/i386/mach-pc9800/setup.c b/arch/i386/mach-pc9800/setup.c deleted file mode 100644 index d32fd17fe..000000000 --- a/arch/i386/mach-pc9800/setup.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Machine specific setup for pc9800 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct sys_desc_table_struct { - unsigned short length; - unsigned char table[0]; -}; - -/** - * pre_intr_init_hook - initialisation prior to setting up interrupt vectors - * - * Description: - * Perform any necessary interrupt initialisation prior to setting up - * the "ordinary" interrupt call gates. For legacy reasons, the ISA - * interrupts should be initialised here if the machine emulates a PC - * in any way. - **/ -void __init pre_intr_init_hook(void) -{ - init_ISA_irqs(); -} - -/* - * IRQ7 is cascade interrupt to second interrupt controller - */ -static struct irqaction irq7 = { no_action, 0, 0, "cascade", NULL, NULL}; - -/** - * intr_init_hook - post gate setup interrupt initialisation - * - * Description: - * Fill in any interrupts that may have been left out by the general - * init_IRQ() routine. interrupts having to do with the machine rather - * than the devices on the I/O bus (like APIC interrupts in intel MP - * systems) are started here. - **/ -void __init intr_init_hook(void) -{ -#ifdef CONFIG_X86_LOCAL_APIC - apic_intr_init(); -#endif - - setup_irq(7, &irq7); -} - -/** - * pre_setup_arch_hook - hook called prior to any setup_arch() execution - * - * Description: - * generally used to activate any machine specific identification - * routines that may be needed before setup_arch() runs. On VISWS - * this is used to get the board revision and type. - **/ -void __init pre_setup_arch_hook(void) -{ - SYS_DESC_TABLE.length = 0; - MCA_bus = 0; - /* In PC-9800, APM BIOS version is written in BCD...?? */ - APM_BIOS_INFO.version = (APM_BIOS_INFO.version & 0xff00) - | ((APM_BIOS_INFO.version & 0x00f0) >> 4); -} - -/** - * trap_init_hook - initialise system specific traps - * - * Description: - * Called as the final act of trap_init(). Used in VISWS to initialise - * the various board specific APIC traps. - **/ -void __init trap_init_hook(void) -{ -} - -static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL}; - -/** - * time_init_hook - do any specific initialisations for the system timer. - * - * Description: - * Must plug the system timer interrupt source at HZ into the IRQ listed - * in irq_vectors.h:TIMER_IRQ - **/ -void __init time_init_hook(void) -{ - setup_irq(0, &irq0); -} - -#ifdef CONFIG_MCA -/** - * mca_nmi_hook - hook into MCA specific NMI chain - * - * Description: - * The MCA (Microchannel Architecture) has an NMI chain for NMI sources - * along the MCA bus. Use this to hook into that chain if you will need - * it. - **/ -void __init mca_nmi_hook(void) -{ - /* If I recall correctly, there's a whole bunch of other things that - * we can do to check for NMI problems, but that's all I know about - * at the moment. - */ - - printk("NMI generated from unknown source!\n"); -} -#endif diff --git a/arch/i386/mach-pc9800/std_resources.c b/arch/i386/mach-pc9800/std_resources.c deleted file mode 100644 index 06290bf82..000000000 --- a/arch/i386/mach-pc9800/std_resources.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Machine specific resource allocation for PC-9800. - * Written by Osamu Tomita - */ - -#include -#include -#include - -static char str_pic1[] = "pic1"; -static char str_dma[] = "dma"; -static char str_pic2[] = "pic2"; -static char str_calender_clock[] = "calender clock"; -static char str_system[] = "system"; -static char str_nmi_control[] = "nmi control"; -static char str_kanji_rom[] = "kanji rom"; -static char str_keyboard[] = "keyboard"; -static char str_text_gdc[] = "text gdc"; -static char str_crtc[] = "crtc"; -static char str_timer[] = "timer"; -static char str_graphic_gdc[] = "graphic gdc"; -static char str_dma_ex_bank[] = "dma ex. bank"; -static char str_beep_freq[] = "beep freq."; -static char str_mouse_pio[] = "mouse pio"; -struct resource standard_io_resources[] = { - { str_pic1, 0x00, 0x00, IORESOURCE_BUSY }, - { str_dma, 0x01, 0x01, IORESOURCE_BUSY }, - { str_pic1, 0x02, 0x02, IORESOURCE_BUSY }, - { str_dma, 0x03, 0x03, IORESOURCE_BUSY }, - { str_dma, 0x05, 0x05, IORESOURCE_BUSY }, - { str_dma, 0x07, 0x07, IORESOURCE_BUSY }, - { str_pic2, 0x08, 0x08, IORESOURCE_BUSY }, - { str_dma, 0x09, 0x09, IORESOURCE_BUSY }, - { str_pic2, 0x0a, 0x0a, IORESOURCE_BUSY }, - { str_dma, 0x0b, 0x0b, IORESOURCE_BUSY }, - { str_dma, 0x0d, 0x0d, IORESOURCE_BUSY }, - { str_dma, 0x0f, 0x0f, IORESOURCE_BUSY }, - { str_dma, 0x11, 0x11, IORESOURCE_BUSY }, - { str_dma, 0x13, 0x13, IORESOURCE_BUSY }, - { str_dma, 0x15, 0x15, IORESOURCE_BUSY }, - { str_dma, 0x17, 0x17, IORESOURCE_BUSY }, - { str_dma, 0x19, 0x19, IORESOURCE_BUSY }, - { str_dma, 0x1b, 0x1b, IORESOURCE_BUSY }, - { str_dma, 0x1d, 0x1d, IORESOURCE_BUSY }, - { str_dma, 0x1f, 0x1f, IORESOURCE_BUSY }, - { str_calender_clock, 0x20, 0x20, 0 }, - { str_dma, 0x21, 0x21, IORESOURCE_BUSY }, - { str_calender_clock, 0x22, 0x22, 0 }, - { str_dma, 0x23, 0x23, IORESOURCE_BUSY }, - { str_dma, 0x25, 0x25, IORESOURCE_BUSY }, - { str_dma, 0x27, 0x27, IORESOURCE_BUSY }, - { str_dma, 0x29, 0x29, IORESOURCE_BUSY }, - { str_dma, 0x2b, 0x2b, IORESOURCE_BUSY }, - { str_dma, 0x2d, 0x2d, IORESOURCE_BUSY }, - { str_system, 0x31, 0x31, IORESOURCE_BUSY }, - { str_system, 0x33, 0x33, IORESOURCE_BUSY }, - { str_system, 0x35, 0x35, IORESOURCE_BUSY }, - { str_system, 0x37, 0x37, IORESOURCE_BUSY }, - { str_nmi_control, 0x50, 0x50, IORESOURCE_BUSY }, - { str_nmi_control, 0x52, 0x52, IORESOURCE_BUSY }, - { "time stamp", 0x5c, 0x5f, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa1, 0xa1, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa3, 0xa3, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa5, 0xa5, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa7, 0xa7, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa9, 0xa9, IORESOURCE_BUSY }, - { str_keyboard, 0x41, 0x41, IORESOURCE_BUSY }, - { str_keyboard, 0x43, 0x43, IORESOURCE_BUSY }, - { str_text_gdc, 0x60, 0x60, IORESOURCE_BUSY }, - { str_text_gdc, 0x62, 0x62, IORESOURCE_BUSY }, - { str_text_gdc, 0x64, 0x64, IORESOURCE_BUSY }, - { str_text_gdc, 0x66, 0x66, IORESOURCE_BUSY }, - { str_text_gdc, 0x68, 0x68, IORESOURCE_BUSY }, - { str_text_gdc, 0x6a, 0x6a, IORESOURCE_BUSY }, - { str_text_gdc, 0x6c, 0x6c, IORESOURCE_BUSY }, - { str_text_gdc, 0x6e, 0x6e, IORESOURCE_BUSY }, - { str_crtc, 0x70, 0x70, IORESOURCE_BUSY }, - { str_crtc, 0x72, 0x72, IORESOURCE_BUSY }, - { str_crtc, 0x74, 0x74, IORESOURCE_BUSY }, - { str_crtc, 0x74, 0x74, IORESOURCE_BUSY }, - { str_crtc, 0x76, 0x76, IORESOURCE_BUSY }, - { str_crtc, 0x78, 0x78, IORESOURCE_BUSY }, - { str_crtc, 0x7a, 0x7a, IORESOURCE_BUSY }, - { str_timer, 0x71, 0x71, IORESOURCE_BUSY }, - { str_timer, 0x73, 0x73, IORESOURCE_BUSY }, - { str_timer, 0x75, 0x75, IORESOURCE_BUSY }, - { str_timer, 0x77, 0x77, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa0, 0xa0, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa2, 0xa2, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa4, 0xa4, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa6, 0xa6, IORESOURCE_BUSY }, - { "cpu", 0xf0, 0xf7, IORESOURCE_BUSY }, - { "fpu", 0xf8, 0xff, IORESOURCE_BUSY }, - { str_dma_ex_bank, 0x0e05, 0x0e05, 0 }, - { str_dma_ex_bank, 0x0e07, 0x0e07, 0 }, - { str_dma_ex_bank, 0x0e09, 0x0e09, 0 }, - { str_dma_ex_bank, 0x0e0b, 0x0e0b, 0 }, - { str_beep_freq, 0x3fd9, 0x3fd9, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdb, 0x3fdb, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdd, 0x3fdd, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdf, 0x3fdf, IORESOURCE_BUSY }, - /* All PC-9800 have (exactly) one mouse interface. */ - { str_mouse_pio, 0x7fd9, 0x7fd9, 0 }, - { str_mouse_pio, 0x7fdb, 0x7fdb, 0 }, - { str_mouse_pio, 0x7fdd, 0x7fdd, 0 }, - { str_mouse_pio, 0x7fdf, 0x7fdf, 0 }, - { "mouse timer", 0xbfdb, 0xbfdb, 0 }, - { "mouse irq", 0x98d7, 0x98d7, 0 }, -}; - -#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) - -static struct resource tvram_resource = { "Text VRAM/CG window", 0xa0000, 0xa4fff, IORESOURCE_BUSY }; -static struct resource gvram_brg_resource = { "Graphic VRAM (B/R/G)", 0xa8000, 0xbffff, IORESOURCE_BUSY }; -static struct resource gvram_e_resource = { "Graphic VRAM (E)", 0xe0000, 0xe7fff, IORESOURCE_BUSY }; - -/* System ROM resources */ -#define MAXROMS 6 -static struct resource rom_resources[MAXROMS] = { - { "System ROM", 0xe8000, 0xfffff, IORESOURCE_BUSY } -}; - -void __init probe_roms(void) -{ - int i; - __u8 *xrom_id; - int roms = 1; - - request_resource(&iomem_resource, rom_resources+0); - - xrom_id = (__u8 *) isa_bus_to_virt(PC9800SCA_XROM_ID + 0x10); - - for (i = 0; i < 16; i++) { - if (xrom_id[i] & 0x80) { - int j; - - for (j = i + 1; j < 16 && (xrom_id[j] & 0x80); j++) - ; - rom_resources[roms].start = 0x0d0000 + i * 0x001000; - rom_resources[roms].end = 0x0d0000 + j * 0x001000 - 1; - rom_resources[roms].name = "Extension ROM"; - rom_resources[roms].flags = IORESOURCE_BUSY; - - request_resource(&iomem_resource, - rom_resources + roms); - if (++roms >= MAXROMS) - return; - } - } -} - -void __init request_graphics_resource(void) -{ - int i; - - if (PC9800_HIGHRESO_P()) { - tvram_resource.start = 0xe0000; - tvram_resource.end = 0xe4fff; - gvram_brg_resource.name = "Graphic VRAM"; - gvram_brg_resource.start = 0xc0000; - gvram_brg_resource.end = 0xdffff; - } - - request_resource(&iomem_resource, &tvram_resource); - request_resource(&iomem_resource, &gvram_brg_resource); - if (!PC9800_HIGHRESO_P()) - request_resource(&iomem_resource, &gvram_e_resource); - - if (PC9800_HIGHRESO_P() || PC9800_9821_P()) { - static char graphics[] = "graphics"; - static struct resource graphics_resources[] = { - { graphics, 0x9a0, 0x9a0, 0 }, - { graphics, 0x9a2, 0x9a2, 0 }, - { graphics, 0x9a4, 0x9a4, 0 }, - { graphics, 0x9a6, 0x9a6, 0 }, - { graphics, 0x9a8, 0x9a8, 0 }, - { graphics, 0x9aa, 0x9aa, 0 }, - { graphics, 0x9ac, 0x9ac, 0 }, - { graphics, 0x9ae, 0x9ae, 0 }, - }; - -#define GRAPHICS_RESOURCES (sizeof(graphics_resources)/sizeof(struct resource)) - - for (i = 0; i < GRAPHICS_RESOURCES; i++) - request_resource(&ioport_resource, graphics_resources + i); - } -} - -void __init request_standard_io_resources(void) -{ - int i; - - for (i = 0; i < STANDARD_IO_RESOURCES; i++) - request_resource(&ioport_resource, standard_io_resources+i); -} diff --git a/arch/i386/mach-pc9800/topology.c b/arch/i386/mach-pc9800/topology.c deleted file mode 100644 index de877f6a2..000000000 --- a/arch/i386/mach-pc9800/topology.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * arch/i386/mach-pc9800/topology.c - Populate driverfs with topology information - * - * Written by: Matthew Dobson, IBM Corporation - * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL - * - * Copyright (C) 2002, IBM Corp. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Modify for PC-9800 by Osamu Tomita - * - */ -#include -#include -#include - -struct i386_cpu cpu_devices[NR_CPUS]; - -static int __init topology_init(void) -{ - int i; - - for (i = 0; i < NR_CPUS; i++) - if (cpu_possible(i)) arch_register_cpu(i); - return 0; -} - -subsys_initcall(topology_init); 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 a8dbbc57b..a67a9be32 100644 --- a/arch/i386/mm/hugetlbpage.c +++ b/arch/i386/mm/hugetlbpage.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -248,8 +247,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 d51c192d0..b5eb7dd6d 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 1613474b1..e6525f678 100644 --- a/arch/ia64/ia32/binfmt_elf32.c +++ b/arch/ia64/ia32/binfmt_elf32.c @@ -223,3 +223,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/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/pci/pci.c b/arch/ia64/pci/pci.c index fdcc71a09..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; } 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/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 d5b49d26b..729f8b203 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 cc3b36c0d..f3c0d2cc2 100644 --- a/arch/ppc/kernel/irq.c +++ b/arch/ppc/kernel/irq.c @@ -628,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 bd006ca95..ac419602d 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/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 f9120785b..b3df45436 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; @@ -362,6 +426,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/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/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 8d5e077fd..bc79a2103 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 5a6064a2d..911126859 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/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 5ff2b1c90..9c3d2f55e 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c @@ -121,8 +121,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); @@ -154,8 +153,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; } @@ -247,8 +245,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); @@ -265,8 +262,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 ddd1cb7c6..1fdb3ff9c 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 9416e53df..403c79bea 100644 --- a/arch/ppc64/mm/hugetlbpage.c +++ b/arch/ppc64/mm/hugetlbpage.c @@ -377,6 +377,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; @@ -385,7 +386,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; @@ -408,6 +410,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, put_page(page); } + put_cpu(); // mm->rss -= (end - start) >> PAGE_SHIFT; vx_rsspages_sub(mm, (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/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/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/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/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/ptrace.c b/arch/s390/kernel/ptrace.c index fa7875fba..cada0f794 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/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/lib/memset.S b/arch/s390/lib/memset.S deleted file mode 100644 index 447af53f8..000000000 --- a/arch/s390/lib/memset.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * arch/s390/lib/memset.S - * S390 fast memset routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address to memory area - * R3 = byte to fill memory with - * R4 = number of bytes to fill - */ - .globl memset -memset: - LTR 4,4 - JZ memset_end - LR 0,2 # save pointer to memory area - LR 1,3 # move pad byte to R1 - LR 3,4 - SR 4,4 # no source for MVCLE, only a pad byte - SR 5,5 - MVCLE 2,4,0(1) # thats it, MVCLE is your friend - JO .-4 - LR 2,0 # return pointer to mem. -memset_end: - BR 14 - - diff --git a/arch/s390/lib/memset64.S b/arch/s390/lib/memset64.S deleted file mode 100644 index 1e4b035d2..000000000 --- a/arch/s390/lib/memset64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * arch/s390/lib/memset.S - * S390 fast memset routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address to memory area - * R3 = byte to fill memory with - * R4 = number of bytes to fill - */ - .globl memset -memset: - LTGR 4,4 - JZ memset_end - LGR 0,2 # save pointer to memory area - LGR 1,3 # move pad byte to R1 - LGR 3,4 - SGR 4,4 # no source for MVCLE, only a pad byte - SGR 5,5 - MVCLE 2,4,0(1) # thats it, MVCLE is your friend - JO .-4 - LGR 2,0 # return pointer to mem. -memset_end: - BR 14 - - diff --git a/arch/s390/lib/strcmp.S b/arch/s390/lib/strcmp.S deleted file mode 100644 index 340edffb5..000000000 --- a/arch/s390/lib/strcmp.S +++ /dev/null @@ -1,27 +0,0 @@ -/* - * arch/s390/lib/strcmp.S - * S390 strcmp routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of compare string - * R3 = address of test string - */ - .globl strcmp -strcmp: - SR 0,0 - SR 1,1 - CLST 2,3 - JO .-4 - JE strcmp_equal - IC 0,0(3) - IC 1,0(2) - SR 1,0 -strcmp_equal: - LR 2,1 - BR 14 - diff --git a/arch/s390/lib/strcmp64.S b/arch/s390/lib/strcmp64.S deleted file mode 100644 index 124f3df26..000000000 --- a/arch/s390/lib/strcmp64.S +++ /dev/null @@ -1,27 +0,0 @@ -/* - * arch/s390/lib/strcmp.S - * S390 strcmp routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of compare string - * R3 = address of test string - */ - .globl strcmp -strcmp: - SGR 0,0 - SGR 1,1 - CLST 2,3 - JO .-4 - JE strcmp_equal - IC 0,0(3) - IC 1,0(2) - SGR 1,0 -strcmp_equal: - LGR 2,1 - BR 14 - diff --git a/arch/s390/lib/strcpy.S b/arch/s390/lib/strcpy.S deleted file mode 100644 index 1d36b9cb8..000000000 --- a/arch/s390/lib/strcpy.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * arch/s390/kernel/strcpy.S - * S390 strcpy routine - * - * S390 version - * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of destination - * R3 = address of source string - */ - .globl strcpy -strcpy: - sr %r0,%r0 -0: mvst %r2,%r3 - jo 0b - br %r14 - diff --git a/arch/s390/lib/strcpy64.S b/arch/s390/lib/strcpy64.S deleted file mode 100644 index 06815dcd7..000000000 --- a/arch/s390/lib/strcpy64.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * arch/s390/kernel/strcpy.S - * S390 strcpy routine - * - * S390 version - * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of destination - * R3 = address of source string - */ - .globl strcpy -strcpy: - sgr %r0,%r0 -0: mvst %r2,%r3 - jo 0b - br %r14 - diff --git a/arch/s390/lib/strncpy.S b/arch/s390/lib/strncpy.S deleted file mode 100644 index a3285bd04..000000000 --- a/arch/s390/lib/strncpy.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - * arch/s390/kernel/strncpy.S - * S390 strncpy routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of destination - * R3 = address of source string - * R4 = max number of bytes to copy - */ - .globl strncpy -strncpy: - LR 1,2 # don't touch address in R2 - LTR 4,4 - JZ strncpy_exit # 0 bytes -> nothing to do - SR 0,0 -strncpy_loop: - ICM 0,1,0(3) # ICM sets the cc, IC does not - LA 3,1(3) - STC 0,0(1) - LA 1,1(1) - JZ strncpy_pad # ICM inserted a 0x00 - BRCT 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 -strncpy_exit: - BR 14 -strncpy_clear: - STC 0,0(1) - LA 1,1(1) -strncpy_pad: - BRCT 4,strncpy_clear - BR 14 diff --git a/arch/s390/lib/strncpy64.S b/arch/s390/lib/strncpy64.S deleted file mode 100644 index 1e455e52b..000000000 --- a/arch/s390/lib/strncpy64.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - * arch/s390/kernel/strncpy.S - * S390 strncpy routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of destination - * R3 = address of source string - * R4 = max number of bytes to copy - */ - .globl strncpy -strncpy: - LGR 1,2 # don't touch address in R2 - LTR 4,4 - JZ strncpy_exit # 0 bytes -> nothing to do - SGR 0,0 -strncpy_loop: - ICM 0,1,0(3) # ICM sets the cc, IC does not - LA 3,1(3) - STC 0,0(1) - LA 1,1(1) - JZ strncpy_pad # ICM inserted a 0x00 - BRCTG 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 -strncpy_exit: - BR 14 -strncpy_clear: - STC 0,0(1) - LA 1,1(1) -strncpy_pad: - BRCTG 4,strncpy_clear - BR 14 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 76f53648c..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 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/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/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/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 f805768ea..b9bc53221 100644 --- a/arch/um/kernel/init_task.c +++ b/arch/um/kernel/init_task.c @@ -8,6 +8,8 @@ #include "linux/module.h" #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 d59981b95..08a60e519 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; struct new_utsname *ptr; @@ -1092,7 +1092,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) @@ -1126,7 +1126,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; @@ -1145,8 +1145,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, @@ -1168,7 +1168,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; @@ -1183,7 +1183,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; @@ -1203,7 +1203,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/Makefile-HEAD b/arch/x86_64/kernel/Makefile-HEAD new file mode 100644 index 000000000..dc6f2695e --- /dev/null +++ b/arch/x86_64/kernel/Makefile-HEAD @@ -0,0 +1,38 @@ +# +# Makefile for the linux kernel. +# + +extra-y := head.o head64.o init_task.o vmlinux.lds.s +EXTRA_AFLAGS := -traditional +obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ + ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \ + x8664_ksyms.o i387.o syscall.o vsyscall.o \ + setup64.o bootflag.o e820.o reboot.o warmreboot.o +obj-y += mce.o + +obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ +obj-$(CONFIG_ACPI_BOOT) += acpi/ +obj-$(CONFIG_X86_MSR) += msr.o +obj-$(CONFIG_MICROCODE) += microcode.o +obj-$(CONFIG_X86_CPUID) += cpuid.o +obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o +obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o +obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o +obj-$(CONFIG_PM) += suspend.o +obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o +obj-$(CONFIG_CPU_FREQ) += cpufreq/ +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o +obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o +obj-$(CONFIG_SWIOTLB) += swiotlb.o +obj-$(CONFIG_SCHED_SMT) += domain.o + +obj-$(CONFIG_MODULES) += module.o + +obj-y += topology.o + +bootflag-y += ../../i386/kernel/bootflag.o +cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o +topology-y += ../../i386/mach-default/topology.o +swiotlb-$(CONFIG_SWIOTLB) += ../../ia64/lib/swiotlb.o +microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 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 87ab1e27f..d07a45b01 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -234,7 +234,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; } @@ -273,7 +273,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; } @@ -362,19 +362,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 @@ -430,12 +431,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; @@ -444,12 +445,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); } @@ -458,23 +459,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 752d84075..a2c5b038f 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/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 36743bf53..598a35c19 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c @@ -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/configs/kernel-2.6.6-i586-smp.config b/configs/kernel-2.6.6-i586-smp.config deleted file mode 100644 index f3dd73142..000000000 --- a/configs/kernel-2.6.6-i586-smp.config +++ /dev/null @@ -1,2361 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_X86=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_GENERIC_ISA_DMA=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_SYSCTL=y -CONFIG_AUDIT=y -CONFIG_AUDITSYSCALL=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_HOTPLUG=y -# CONFIG_IKCONFIG is not set -# CONFIG_EMBEDDED is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -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=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y -CONFIG_STOP_MACHINE=y - -# -# Processor type and features -# -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 is not set -# CONFIG_X86_ES7000 is not set -# CONFIG_M386 is not set -# CONFIG_M486 is not set -CONFIG_M586=y -# CONFIG_M586TSC is not set -# CONFIG_M586MMX is not set -# CONFIG_M686 is not set -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPENTIUM4 is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_MWINCHIP2 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MVIAC3_2 is not set -CONFIG_X86_GENERIC=y -CONFIG_X86_CMPXCHG=y -CONFIG_X86_XADD=y -CONFIG_X86_L1_CACHE_SHIFT=7 -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_X86_PPRO_FENCE=y -CONFIG_X86_F00F_BUG=y -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_INVLPG=y -CONFIG_X86_BSWAP=y -CONFIG_X86_POPAD_OK=y -CONFIG_X86_ALIGNMENT_16=y -CONFIG_X86_INTEL_USERCOPY=y -# CONFIG_X86_4G is not set -# CONFIG_X86_SWITCH_PAGETABLES is not set -# CONFIG_X86_4G_VM_LAYOUT is not set -# CONFIG_X86_UACCESS_INDIRECT is not set -# CONFIG_X86_HIGH_ENTRY is not set -CONFIG_HPET_TIMER=y -CONFIG_HPET_EMULATE_RTC=y -CONFIG_SMP=y -CONFIG_NR_CPUS=8 -CONFIG_SCHED_SMT=y -# CONFIG_PREEMPT is not set -CONFIG_X86_LOCAL_APIC=y -CONFIG_X86_IO_APIC=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 is not set -CONFIG_X86_MSR=m -CONFIG_X86_CPUID=m - -# -# Firmware Drivers -# -CONFIG_EDD=m -# CONFIG_NOHIGHMEM is not set -CONFIG_HIGHMEM4G=y -# CONFIG_HIGHMEM64G is not set -CONFIG_HIGHMEM=y -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 - -# -# Power management options (ACPI, APM) -# -CONFIG_PM=y -# CONFIG_SOFTWARE_SUSPEND is not set -# CONFIG_PM_DISK is not set - -# -# ACPI (Advanced Configuration and Power Interface) Support -# -CONFIG_ACPI=y -CONFIG_ACPI_BOOT=y -CONFIG_ACPI_INTERPRETER=y -CONFIG_ACPI_SLEEP=y -CONFIG_ACPI_SLEEP_PROC_FS=y -CONFIG_ACPI_AC=m -CONFIG_ACPI_BATTERY=m -CONFIG_ACPI_BUTTON=m -CONFIG_ACPI_FAN=y -CONFIG_ACPI_PROCESSOR=y -CONFIG_ACPI_THERMAL=y -CONFIG_ACPI_ASUS=m -CONFIG_ACPI_TOSHIBA=m -# CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y -CONFIG_ACPI_EC=y -CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y -CONFIG_ACPI_SYSTEM=y -CONFIG_X86_PM_TIMER=y - -# -# APM (Advanced Power Management) BIOS Support -# -CONFIG_APM=y -# CONFIG_APM_IGNORE_USER_SUSPEND is not set -# CONFIG_APM_DO_ENABLE is not set -CONFIG_APM_CPU_IDLE=y -# CONFIG_APM_DISPLAY_BLANK is not set -CONFIG_APM_RTC_IS_GMT=y -# CONFIG_APM_ALLOW_INTS is not set -# CONFIG_APM_REAL_MODE_POWER_OFF is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_PROC_INTF is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=m -CONFIG_CPU_FREQ_GOV_USERSPACE=y -# CONFIG_CPU_FREQ_24_API is not set -CONFIG_CPU_FREQ_TABLE=y - -# -# CPUFreq processor drivers -# -CONFIG_X86_ACPI_CPUFREQ=m -# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set -CONFIG_X86_POWERNOW_K6=m -CONFIG_X86_POWERNOW_K7=y -CONFIG_X86_POWERNOW_K8=m -# CONFIG_X86_GX_SUSPMOD is not set -CONFIG_X86_SPEEDSTEP_CENTRINO=y -CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y -CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y -CONFIG_X86_SPEEDSTEP_ICH=y -CONFIG_X86_SPEEDSTEP_SMI=m -CONFIG_X86_P4_CLOCKMOD=m -CONFIG_X86_SPEEDSTEP_LIB=y -# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set -CONFIG_X86_LONGRUN=y -# CONFIG_X86_LONGHAUL is not set - -# -# Bus options (PCI, PCMCIA, EISA, MCA, ISA) -# -CONFIG_PCI=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GODIRECT is not set -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 -# CONFIG_EISA is not set -# CONFIG_MCA is not set -# CONFIG_SCx200 is not set - -# -# PCMCIA/CardBus support -# -CONFIG_PCMCIA=m -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_YENTA=m -CONFIG_CARDBUS=y -CONFIG_I82092=m -CONFIG_I82365=m -CONFIG_TCIC=m -CONFIG_PCMCIA_PROBE=y - -# -# PCI Hotplug Support -# -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 -CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y -CONFIG_HOTPLUG_PCI_SHPC=m -CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y - -# -# Executable file formats -# -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=m - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_FW_LOADER=y -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=m -# CONFIG_MTD_DEBUG is not set -CONFIG_MTD_PARTITIONS=m -CONFIG_MTD_CONCAT=m -CONFIG_MTD_REDBOOT_PARTS=m -CONFIG_MTD_CMDLINE_PARTS=m - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=m -CONFIG_MTD_BLOCK=m -CONFIG_MTD_BLOCK_RO=m -CONFIG_FTL=m -CONFIG_NFTL=m -CONFIG_NFTL_RW=y -CONFIG_INFTL=m - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=m -CONFIG_MTD_JEDECPROBE=m -CONFIG_MTD_GEN_PROBE=m -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_INTELEXT=m -CONFIG_MTD_CFI_AMDSTD=m -CONFIG_MTD_CFI_STAA=m -CONFIG_MTD_RAM=m -CONFIG_MTD_ROM=m -CONFIG_MTD_ABSENT=m -# CONFIG_MTD_OBSOLETE_CHIPS is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PNC2000 is not set -CONFIG_MTD_SC520CDP=m -CONFIG_MTD_NETSC520=m -CONFIG_MTD_SBC_GXX=m -CONFIG_MTD_ELAN_104NC=m -CONFIG_MTD_SCx200_DOCFLASH=m -CONFIG_MTD_AMD76XROM=m -CONFIG_MTD_ICH2ROM=m -CONFIG_MTD_SCB2_FLASH=m -# CONFIG_MTD_NETtel is not set -# CONFIG_MTD_DILNETPC is not set -CONFIG_MTD_L440GX=m -CONFIG_MTD_PCI=m - -# -# Self-contained MTD device drivers -# -CONFIG_MTD_PMC551=m -# CONFIG_MTD_PMC551_BUGFIX is not set -# CONFIG_MTD_PMC551_DEBUG is not set -# CONFIG_MTD_SLRAM is not set -CONFIG_MTD_MTDRAM=m -CONFIG_MTDRAM_TOTAL_SIZE=4096 -CONFIG_MTDRAM_ERASE_SIZE=128 -# CONFIG_MTD_BLKMTD is not set - -# -# Disk-On-Chip Device Drivers -# -CONFIG_MTD_DOC2000=m -# CONFIG_MTD_DOC2001 is not set -CONFIG_MTD_DOC2001PLUS=m -CONFIG_MTD_DOCPROBE=m -# CONFIG_MTD_DOCPROBE_ADVANCED is not set -CONFIG_MTD_DOCPROBE_ADDRESS=0 - -# -# NAND Flash Device Drivers -# -CONFIG_MTD_NAND=m -# CONFIG_MTD_NAND_VERIFY_WRITE is not set -CONFIG_MTD_NAND_IDS=m - -# -# Parallel port support -# -CONFIG_PARPORT=m -CONFIG_PARPORT_PC=m -CONFIG_PARPORT_PC_CML1=m -CONFIG_PARPORT_SERIAL=m -# CONFIG_PARPORT_PC_FIFO is not set -# CONFIG_PARPORT_PC_SUPERIO is not set -CONFIG_PARPORT_PC_PCMCIA=m -# CONFIG_PARPORT_OTHER is not set -CONFIG_PARPORT_1284=y - -# -# Plug and Play support -# -CONFIG_PNP=y -# CONFIG_PNP_DEBUG is not set - -# -# Protocols -# -CONFIG_ISAPNP=y -# CONFIG_PNPBIOS is not set - -# -# Block devices -# -CONFIG_BLK_DEV_FD=m -# CONFIG_BLK_DEV_XD is not set -# CONFIG_PARIDE is not set -CONFIG_BLK_CPQ_DA=m -CONFIG_BLK_CPQ_CISS_DA=m -CONFIG_CISS_SCSI_TAPE=y -CONFIG_BLK_DEV_DAC960=m -CONFIG_BLK_DEV_UMEM=m -CONFIG_BLK_DEV_LOOP=m -CONFIG_BLK_DEV_CRYPTOLOOP=m -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_CARMEL=m -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=16384 -CONFIG_BLK_DEV_INITRD=y -CONFIG_LBD=y - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_HD_IDE is not set -CONFIG_BLK_DEV_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 -CONFIG_BLK_DEV_IDEFLOPPY=y -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IDE_TASKFILE_IO is not set - -# -# IDE chipset support/bugfixes -# -CONFIG_IDE_GENERIC=y -# CONFIG_BLK_DEV_CMD640 is not set -CONFIG_BLK_DEV_IDEPNP=y -CONFIG_BLK_DEV_IDEPCI=y -CONFIG_IDEPCI_SHARE_IRQ=y -# CONFIG_BLK_DEV_OFFBOARD is not set -CONFIG_BLK_DEV_GENERIC=y -# CONFIG_BLK_DEV_OPTI621 is not set -CONFIG_BLK_DEV_RZ1000=y -CONFIG_BLK_DEV_IDEDMA_PCI=y -# CONFIG_BLK_DEV_IDEDMA_FORCED is not set -CONFIG_IDEDMA_PCI_AUTO=y -# CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y -CONFIG_BLK_DEV_AEC62XX=y -CONFIG_BLK_DEV_ALI15X3=y -# CONFIG_WDC_ALI15X3 is not set -CONFIG_BLK_DEV_AMD74XX=y -CONFIG_BLK_DEV_ATIIXP=y -CONFIG_BLK_DEV_CMD64X=y -CONFIG_BLK_DEV_TRIFLEX=y -CONFIG_BLK_DEV_CY82C693=y -CONFIG_BLK_DEV_CS5520=y -CONFIG_BLK_DEV_CS5530=y -CONFIG_BLK_DEV_HPT34X=y -# CONFIG_HPT34X_AUTODMA is not set -CONFIG_BLK_DEV_HPT366=y -# CONFIG_BLK_DEV_SC1200 is not set -CONFIG_BLK_DEV_PIIX=y -# CONFIG_BLK_DEV_NS87415 is not set -CONFIG_BLK_DEV_PDC202XX_OLD=y -# CONFIG_PDC202XX_BURST is not set -CONFIG_BLK_DEV_PDC202XX_NEW=y -CONFIG_PDC202XX_FORCE=y -CONFIG_BLK_DEV_SVWKS=y -CONFIG_BLK_DEV_SIIMAGE=y -CONFIG_BLK_DEV_SIS5513=y -CONFIG_BLK_DEV_SLC90E66=y -# CONFIG_BLK_DEV_TRM290 is not set -CONFIG_BLK_DEV_VIA82CXXX=y -# CONFIG_IDE_ARM is not set -# CONFIG_IDE_CHIPSETS is not set -CONFIG_BLK_DEV_IDEDMA=y -# CONFIG_IDEDMA_IVB is not set -CONFIG_IDEDMA_AUTO=y -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -CONFIG_SCSI=m -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=m -CONFIG_CHR_DEV_ST=m -CONFIG_CHR_DEV_OSST=m -CONFIG_BLK_DEV_SR=m -CONFIG_BLK_DEV_SR_VENDOR=y -CONFIG_CHR_DEV_SG=m - -# -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -# -# CONFIG_SCSI_MULTI_LUN is not set -CONFIG_SCSI_CONSTANTS=y -CONFIG_SCSI_LOGGING=y - -# -# SCSI Transport Attributes -# -CONFIG_SCSI_SPI_ATTRS=m -CONFIG_SCSI_FC_ATTRS=m - -# -# SCSI low-level drivers -# -CONFIG_BLK_DEV_3W_XXXX_RAID=m -# CONFIG_SCSI_7000FASST is not set -CONFIG_SCSI_ACARD=m -CONFIG_SCSI_AHA152X=m -CONFIG_SCSI_AHA1542=m -CONFIG_SCSI_AACRAID=m -CONFIG_SCSI_AIC7XXX=m -CONFIG_AIC7XXX_CMDS_PER_DEVICE=4 -CONFIG_AIC7XXX_RESET_DELAY_MS=15000 -# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set -# CONFIG_AIC7XXX_DEBUG_ENABLE is not set -CONFIG_AIC7XXX_DEBUG_MASK=0 -# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set -CONFIG_SCSI_AIC7XXX_OLD=m -CONFIG_SCSI_AIC79XX=m -CONFIG_AIC79XX_CMDS_PER_DEVICE=4 -CONFIG_AIC79XX_RESET_DELAY_MS=15000 -# CONFIG_AIC79XX_BUILD_FIRMWARE is not set -# CONFIG_AIC79XX_ENABLE_RD_STRM is not set -# CONFIG_AIC79XX_DEBUG_ENABLE is not set -CONFIG_AIC79XX_DEBUG_MASK=0 -# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set -# CONFIG_SCSI_DPT_I2O is not set -CONFIG_SCSI_ADVANSYS=m -CONFIG_SCSI_IN2000=m -CONFIG_SCSI_MEGARAID=m -CONFIG_SCSI_SATA=y -CONFIG_SCSI_SATA_SVW=m -CONFIG_SCSI_ATA_PIIX=m -CONFIG_SCSI_SATA_PROMISE=m -CONFIG_SCSI_SATA_SX4=m -CONFIG_SCSI_SATA_SIL=m -CONFIG_SCSI_SATA_SIS=m -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 -# CONFIG_SCSI_EATA_PIO is not set -CONFIG_SCSI_FUTURE_DOMAIN=m -CONFIG_SCSI_GDTH=m -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -CONFIG_SCSI_IPS=m -CONFIG_SCSI_INIA100=m -CONFIG_SCSI_PPA=m -CONFIG_SCSI_IMM=m -# CONFIG_SCSI_IZIP_EPP16 is not set -# CONFIG_SCSI_IZIP_SLOW_CTR is not set -# CONFIG_SCSI_NCR53C406A is not set -CONFIG_SCSI_SYM53C8XX_2=m -CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 -CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 -CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 -# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PSI240I is not set -CONFIG_SCSI_QLOGIC_FAS=m -CONFIG_SCSI_QLOGIC_ISP=m -# CONFIG_SCSI_QLOGIC_FC is not set -CONFIG_SCSI_QLOGIC_1280=m -CONFIG_SCSI_QLA2XXX=m -CONFIG_SCSI_QLA21XX=m -CONFIG_SCSI_QLA22XX=m -CONFIG_SCSI_QLA2300=m -CONFIG_SCSI_QLA2322=m -CONFIG_SCSI_QLA6312=m -CONFIG_SCSI_QLA6322=m -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_DC395x is not set -CONFIG_SCSI_DC390T=m -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_DEBUG is not set - -# -# PCMCIA SCSI adapter support -# -CONFIG_PCMCIA_AHA152X=m -CONFIG_PCMCIA_FDOMAIN=m -CONFIG_PCMCIA_NINJA_SCSI=m -CONFIG_PCMCIA_QLOGIC=m -CONFIG_PCMCIA_SYM53C500=m - -# -# Old CD-ROM drivers (not SCSI, not IDE) -# -# CONFIG_CD_NO_IDESCSI is not set - -# -# Multi-device support (RAID and LVM) -# -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_LINEAR=m -CONFIG_MD_RAID0=m -CONFIG_MD_RAID1=m -CONFIG_MD_RAID5=m -CONFIG_MD_RAID6=m -CONFIG_MD_MULTIPATH=m -CONFIG_BLK_DEV_DM=m -CONFIG_DM_CRYPT=m - -# -# Fusion MPT device support -# -CONFIG_FUSION=m -CONFIG_FUSION_MAX_SGE=40 -# CONFIG_FUSION_ISENSE is not set -CONFIG_FUSION_CTL=m -CONFIG_FUSION_LAN=m - -# -# IEEE 1394 (FireWire) support -# -CONFIG_IEEE1394=m - -# -# Subsystem Options -# -# CONFIG_IEEE1394_VERBOSEDEBUG is not set -CONFIG_IEEE1394_OUI_DB=y -# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set - -# -# Device Drivers -# -# CONFIG_IEEE1394_PCILYNX is not set -CONFIG_IEEE1394_OHCI1394=m - -# -# Protocol Drivers -# -CONFIG_IEEE1394_VIDEO1394=m -CONFIG_IEEE1394_SBP2=m -# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set -# CONFIG_IEEE1394_ETH1394 is not set -CONFIG_IEEE1394_DV1394=m -CONFIG_IEEE1394_RAWIO=m -CONFIG_IEEE1394_CMP=m -CONFIG_IEEE1394_AMDTP=m - -# -# I2O device support -# -CONFIG_I2O=m -CONFIG_I2O_CONFIG=m -CONFIG_I2O_BLOCK=m -CONFIG_I2O_SCSI=m -CONFIG_I2O_PROC=m - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_NETLINK_DEV=y -CONFIG_UNIX=y -CONFIG_NET_KEY=m -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_IP_ROUTE_FWMARK=y -CONFIG_IP_ROUTE_NAT=y -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_PNP is not set -CONFIG_NET_IPIP=m -CONFIG_NET_IPGRE=m -CONFIG_NET_IPGRE_BROADCAST=y -CONFIG_IP_MROUTE=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -CONFIG_INET_AH=m -CONFIG_INET_ESP=m -CONFIG_INET_IPCOMP=m - -# -# IP: Virtual Server Configuration -# -CONFIG_IP_VS=m -# CONFIG_IP_VS_DEBUG is not set -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -CONFIG_IP_VS_PROTO_TCP=y -CONFIG_IP_VS_PROTO_UDP=y -CONFIG_IP_VS_PROTO_ESP=y -CONFIG_IP_VS_PROTO_AH=y - -# -# IPVS scheduler -# -CONFIG_IP_VS_RR=m -CONFIG_IP_VS_WRR=m -CONFIG_IP_VS_LC=m -CONFIG_IP_VS_WLC=m -CONFIG_IP_VS_LBLC=m -CONFIG_IP_VS_LBLCR=m -CONFIG_IP_VS_DH=m -CONFIG_IP_VS_SH=m -CONFIG_IP_VS_SED=m -CONFIG_IP_VS_NQ=m - -# -# IPVS application helper -# -CONFIG_IP_VS_FTP=m -CONFIG_IPV6=m -CONFIG_IPV6_PRIVACY=y -CONFIG_INET6_AH=m -CONFIG_INET6_ESP=m -CONFIG_INET6_IPCOMP=m -CONFIG_IPV6_TUNNEL=m -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_BRIDGE_NETFILTER=y - -# -# IP: Netfilter Configuration -# -CONFIG_IP_NF_CONNTRACK=m -CONFIG_IP_NF_FTP=m -CONFIG_IP_NF_IRC=m -CONFIG_IP_NF_TFTP=m -CONFIG_IP_NF_AMANDA=m -CONFIG_IP_NF_QUEUE=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_LIMIT=m -CONFIG_IP_NF_MATCH_IPRANGE=m -CONFIG_IP_NF_MATCH_MAC=m -CONFIG_IP_NF_MATCH_PKTTYPE=m -CONFIG_IP_NF_MATCH_MARK=m -CONFIG_IP_NF_MATCH_MULTIPORT=m -CONFIG_IP_NF_MATCH_TOS=m -CONFIG_IP_NF_MATCH_RECENT=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_DSCP=m -CONFIG_IP_NF_MATCH_AH_ESP=m -CONFIG_IP_NF_MATCH_LENGTH=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_MATCH_TCPMSS=m -CONFIG_IP_NF_MATCH_HELPER=m -CONFIG_IP_NF_MATCH_STATE=m -CONFIG_IP_NF_MATCH_CONNTRACK=m -CONFIG_IP_NF_MATCH_OWNER=m -CONFIG_IP_NF_MATCH_PHYSDEV=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_NAT_NEEDED=y -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_REDIRECT=m -CONFIG_IP_NF_TARGET_NETMAP=m -CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y -CONFIG_IP_NF_NAT_SNMP_BASIC=m -CONFIG_IP_NF_NAT_IRC=m -CONFIG_IP_NF_NAT_FTP=m -CONFIG_IP_NF_NAT_TFTP=m -CONFIG_IP_NF_NAT_AMANDA=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_TOS=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_DSCP=m -CONFIG_IP_NF_TARGET_MARK=m -CONFIG_IP_NF_TARGET_CLASSIFY=m -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m -# CONFIG_IP_NF_COMPAT_IPCHAINS is not set -# CONFIG_IP_NF_COMPAT_IPFWADM is not set -CONFIG_IP_NF_TARGET_NOTRACK=m -CONFIG_IP_NF_RAW=m - -# -# IPv6: Netfilter Configuration -# -# CONFIG_IP6_NF_QUEUE is not set -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_LIMIT=m -CONFIG_IP6_NF_MATCH_MAC=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_MULTIPORT=m -CONFIG_IP6_NF_MATCH_OWNER=m -CONFIG_IP6_NF_MATCH_MARK=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_AHESP=m -CONFIG_IP6_NF_MATCH_LENGTH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_LOG=m -CONFIG_IP6_NF_MANGLE=m -CONFIG_IP6_NF_TARGET_MARK=m -CONFIG_IP6_NF_RAW=m - -# -# Bridge: Netfilter Configuration -# -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_XFRM=y -CONFIG_XFRM_USER=y - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IP_SCTP=m -# CONFIG_SCTP_DBG_MSG is not set -# CONFIG_SCTP_DBG_OBJCNT is not set -# CONFIG_SCTP_HMAC_NONE is not set -# CONFIG_SCTP_HMAC_SHA1 is not set -CONFIG_SCTP_HMAC_MD5=y -# CONFIG_ATM is not set -CONFIG_BRIDGE=m -CONFIG_VLAN_8021Q=m -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -CONFIG_IPX=m -# CONFIG_IPX_INTERN is not set -CONFIG_ATALK=m -CONFIG_DEV_APPLETALK=y -CONFIG_LTPC=m -CONFIG_COPS=m -CONFIG_COPS_DAYNA=y -CONFIG_COPS_TANGENT=y -CONFIG_IPDDP=m -CONFIG_IPDDP_ENCAP=y -CONFIG_IPDDP_DECAP=y -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -CONFIG_NET_DIVERT=y -# CONFIG_ECONET is not set -CONFIG_WAN_ROUTER=m -# CONFIG_NET_FASTROUTE is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -CONFIG_NET_SCHED=y -CONFIG_NET_SCH_CBQ=m -CONFIG_NET_SCH_HTB=m -CONFIG_NET_SCH_HFSC=m -CONFIG_NET_SCH_CSZ=m -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_SCH_DELAY=m -CONFIG_NET_SCH_INGRESS=m -CONFIG_NET_QOS=y -CONFIG_NET_ESTIMATOR=y -CONFIG_NET_CLS=y -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_ROUTE=y -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_POLICE=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_RX is not set -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -# CONFIG_HAMRADIO is not set -CONFIG_IRDA=m - -# -# IrDA protocols -# -CONFIG_IRLAN=m -CONFIG_IRNET=m -CONFIG_IRCOMM=m -# CONFIG_IRDA_ULTRA is not set - -# -# IrDA options -# -CONFIG_IRDA_CACHE_LAST_LSAP=y -CONFIG_IRDA_FAST_RR=y -# CONFIG_IRDA_DEBUG is not set - -# -# Infrared-port device drivers -# - -# -# SIR device drivers -# -CONFIG_IRTTY_SIR=m - -# -# Dongle support -# -CONFIG_DONGLE=y -CONFIG_ESI_DONGLE=m -CONFIG_ACTISYS_DONGLE=m -CONFIG_TEKRAM_DONGLE=m -CONFIG_LITELINK_DONGLE=m -CONFIG_MA600_DONGLE=m -CONFIG_GIRBIL_DONGLE=m -CONFIG_MCP2120_DONGLE=m -CONFIG_OLD_BELKIN_DONGLE=m -CONFIG_ACT200L_DONGLE=m - -# -# Old SIR device drivers -# - -# -# Old Serial dongle support -# - -# -# FIR device drivers -# -CONFIG_USB_IRDA=m -CONFIG_SIGMATEL_FIR=m -CONFIG_NSC_FIR=m -# CONFIG_WINBOND_FIR is not set -# CONFIG_TOSHIBA_FIR is not set -# CONFIG_SMC_IRCC_FIR is not set -# CONFIG_ALI_FIR is not set -# CONFIG_VLSI_FIR is not set -# CONFIG_VIA_FIR is not set -CONFIG_BT=m -CONFIG_BT_L2CAP=m -CONFIG_BT_SCO=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_CMTP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIUSB=m -CONFIG_BT_HCIUSB_SCO=y -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_BCSP_TXCRC=y -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBFUSB=m -CONFIG_BT_HCIDTL1=m -CONFIG_BT_HCIBT3C=m -CONFIG_BT_HCIBLUECARD=m -CONFIG_BT_HCIBTUART=m -CONFIG_BT_HCIVHCI=m -CONFIG_TUX=m - -# -# TUX options -# -CONFIG_TUX_EXTCGI=y -# CONFIG_TUX_EXTENDED_LOG is not set -# CONFIG_TUX_DEBUG is not set -CONFIG_NETDEVICES=y -CONFIG_DUMMY=m -CONFIG_BONDING=m -CONFIG_EQUALIZER=m -CONFIG_TUN=m -CONFIG_ETHERTAP=m -CONFIG_NET_SB1000=m - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=m -CONFIG_HAPPYMEAL=m -CONFIG_SUNGEM=m -CONFIG_NET_VENDOR_3COM=y -CONFIG_EL1=m -CONFIG_EL2=m -CONFIG_ELPLUS=m -CONFIG_EL16=m -CONFIG_EL3=m -CONFIG_3C515=m -CONFIG_VORTEX=m -# CONFIG_TYPHOON is not set -CONFIG_LANCE=m -CONFIG_NET_VENDOR_SMC=y -CONFIG_WD80x3=m -CONFIG_ULTRA=m -CONFIG_SMC9194=m -CONFIG_NET_VENDOR_RACAL=y -CONFIG_NI52=m -CONFIG_NI65=m - -# -# Tulip family network device support -# -CONFIG_NET_TULIP=y -CONFIG_DE2104X=m -CONFIG_TULIP=m -# CONFIG_TULIP_MWI is not set -CONFIG_TULIP_MMIO=y -# CONFIG_TULIP_NAPI is not set -CONFIG_DE4X5=m -CONFIG_WINBOND_840=m -CONFIG_DM9102=m -CONFIG_PCMCIA_XIRCOM=m -# CONFIG_AT1700 is not set -CONFIG_DEPCA=m -CONFIG_HP100=m -# CONFIG_NET_ISA is not set -CONFIG_NE2000=m -CONFIG_NET_PCI=y -CONFIG_PCNET32=m -CONFIG_AMD8111_ETH=m -CONFIG_AMD8111E_NAPI=y -CONFIG_ADAPTEC_STARFIRE=m -CONFIG_ADAPTEC_STARFIRE_NAPI=y -CONFIG_AC3200=m -CONFIG_APRICOT=m -CONFIG_B44=m -CONFIG_FORCEDETH=m -CONFIG_CS89x0=m -CONFIG_DGRS=m -CONFIG_EEPRO100=m -# CONFIG_EEPRO100_PIO is not set -CONFIG_E100=m -CONFIG_E100_NAPI=y -CONFIG_FEALNX=m -CONFIG_NATSEMI=m -CONFIG_NE2K_PCI=m -CONFIG_8139CP=m -CONFIG_8139TOO=m -CONFIG_8139TOO_PIO=y -# CONFIG_8139TOO_TUNE_TWISTER is not set -CONFIG_8139TOO_8129=y -# CONFIG_8139_OLD_RX_RESET is not set -CONFIG_SIS900=m -CONFIG_EPIC100=m -CONFIG_SUNDANCE=m -# CONFIG_SUNDANCE_MMIO is not set -CONFIG_TLAN=m -CONFIG_VIA_RHINE=m -CONFIG_VIA_RHINE_MMIO=y -CONFIG_NET_POCKET=y -CONFIG_ATP=m -CONFIG_DE600=m -CONFIG_DE620=m - -# -# Ethernet (1000 Mbit) -# -CONFIG_ACENIC=m -# CONFIG_ACENIC_OMIT_TIGON_I is not set -CONFIG_DL2K=m -CONFIG_E1000=m -CONFIG_E1000_NAPI=y -CONFIG_NS83820=m -CONFIG_HAMACHI=m -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 -CONFIG_S2IO_NAPI=y - -# -# Token Ring devices -# -# CONFIG_TR is not set - -# -# Wireless LAN (non-hamradio) -# -CONFIG_NET_RADIO=y - -# -# Obsolete Wireless cards support (pre-802.11) -# -# CONFIG_STRIP is not set -# CONFIG_ARLAN is not set -CONFIG_WAVELAN=m -CONFIG_PCMCIA_WAVELAN=m -CONFIG_PCMCIA_NETWAVE=m - -# -# Wireless 802.11 Frequency Hopping cards support -# -# CONFIG_PCMCIA_RAYCS is not set - -# -# Wireless 802.11b ISA/PCI cards support -# -CONFIG_AIRO=m -CONFIG_HERMES=m -CONFIG_PLX_HERMES=m -CONFIG_TMD_HERMES=m -CONFIG_PCI_HERMES=m -CONFIG_ATMEL=m -CONFIG_PCI_ATMEL=m - -# -# Wireless 802.11b Pcmcia/Cardbus cards support -# -CONFIG_PCMCIA_HERMES=m -CONFIG_AIRO_CS=m -CONFIG_PCMCIA_ATMEL=m -CONFIG_PCMCIA_WL3501=m - -# -# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support -# -CONFIG_PRISM54=m -CONFIG_NET_WIRELESS=y - -# -# PCMCIA network device support -# -CONFIG_NET_PCMCIA=y -CONFIG_PCMCIA_3C589=m -CONFIG_PCMCIA_3C574=m -CONFIG_PCMCIA_FMVJ18X=m -CONFIG_PCMCIA_PCNET=m -CONFIG_PCMCIA_NMCLAN=m -CONFIG_PCMCIA_SMC91C92=m -CONFIG_PCMCIA_XIRC2PS=m -CONFIG_PCMCIA_AXNET=m - -# -# Wan interfaces -# -# CONFIG_WAN is not set -CONFIG_FDDI=y -# CONFIG_DEFXX is not set -CONFIG_SKFP=m -# CONFIG_HIPPI is not set -CONFIG_PLIP=m -CONFIG_PPP=m -CONFIG_PPP_MULTILINK=y -CONFIG_PPP_FILTER=y -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_BSDCOMP is not set -CONFIG_PPPOE=m -# CONFIG_SLIP is not set -CONFIG_NET_FC=y -# CONFIG_SHAPER is not set -CONFIG_NETCONSOLE=m - -# -# ISDN subsystem -# -CONFIG_ISDN=m - -# -# Old ISDN4Linux -# -CONFIG_ISDN_I4L=m -CONFIG_ISDN_PPP=y -CONFIG_ISDN_PPP_VJ=y -CONFIG_ISDN_MPP=y -CONFIG_IPPP_FILTER=y -# CONFIG_ISDN_PPP_BSDCOMP is not set -CONFIG_ISDN_AUDIO=y -CONFIG_ISDN_TTY_FAX=y - -# -# ISDN feature submodules -# - -# -# ISDN4Linux hardware drivers -# - -# -# Passive cards -# -CONFIG_ISDN_DRV_HISAX=m - -# -# D-channel protocol features -# -CONFIG_HISAX_EURO=y -CONFIG_DE_AOC=y -CONFIG_HISAX_NO_SENDCOMPLETE=y -CONFIG_HISAX_NO_LLC=y -CONFIG_HISAX_NO_KEYPAD=y -CONFIG_HISAX_1TR6=y -CONFIG_HISAX_NI1=y -CONFIG_HISAX_MAX_CARDS=8 - -# -# HiSax supported cards -# -CONFIG_HISAX_16_0=y -CONFIG_HISAX_16_3=y -CONFIG_HISAX_TELESPCI=y -CONFIG_HISAX_S0BOX=y -CONFIG_HISAX_AVM_A1=y -CONFIG_HISAX_FRITZPCI=y -CONFIG_HISAX_AVM_A1_PCMCIA=y -CONFIG_HISAX_ELSA=y -CONFIG_HISAX_IX1MICROR2=y -CONFIG_HISAX_DIEHLDIVA=y -CONFIG_HISAX_ASUSCOM=y -CONFIG_HISAX_TELEINT=y -CONFIG_HISAX_HFCS=y -CONFIG_HISAX_SEDLBAUER=y -CONFIG_HISAX_SPORTSTER=y -CONFIG_HISAX_MIC=y -CONFIG_HISAX_NETJET=y -CONFIG_HISAX_NETJET_U=y -CONFIG_HISAX_NICCY=y -CONFIG_HISAX_ISURF=y -CONFIG_HISAX_HSTSAPHIR=y -CONFIG_HISAX_BKM_A4T=y -CONFIG_HISAX_SCT_QUADRO=y -CONFIG_HISAX_GAZEL=y -CONFIG_HISAX_HFC_PCI=y -CONFIG_HISAX_W6692=y -CONFIG_HISAX_HFC_SX=y -CONFIG_HISAX_ENTERNOW_PCI=y -# CONFIG_HISAX_DEBUG is not set - -# -# HiSax PCMCIA card service modules -# -CONFIG_HISAX_SEDLBAUER_CS=m -CONFIG_HISAX_ELSA_CS=m -CONFIG_HISAX_AVM_A1_CS=m -CONFIG_HISAX_TELES_CS=m - -# -# HiSax sub driver modules -# -CONFIG_HISAX_ST5481=m -CONFIG_HISAX_HFCUSB=m -CONFIG_HISAX_FRITZ_PCIPNP=m -CONFIG_HISAX_HDLC=y - -# -# Active cards -# -CONFIG_ISDN_DRV_ICN=m -CONFIG_ISDN_DRV_PCBIT=m -CONFIG_ISDN_DRV_SC=m -CONFIG_ISDN_DRV_ACT2000=m -CONFIG_ISDN_DRV_TPAM=m - -# -# CAPI subsystem -# -CONFIG_ISDN_CAPI=m -CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y -CONFIG_ISDN_CAPI_MIDDLEWARE=y -CONFIG_ISDN_CAPI_CAPI20=m -CONFIG_ISDN_CAPI_CAPIFS_BOOL=y -CONFIG_ISDN_CAPI_CAPIFS=m -CONFIG_ISDN_CAPI_CAPIDRV=m - -# -# CAPI hardware drivers -# - -# -# Active AVM cards -# -CONFIG_CAPI_AVM=y - -# -# Active Eicon DIVA Server cards -# -CONFIG_CAPI_EICON=y -CONFIG_ISDN_DIVAS=m -CONFIG_ISDN_DIVAS_BRIPCI=y -CONFIG_ISDN_DIVAS_PRIPCI=y -CONFIG_ISDN_DIVAS_DIVACAPI=m -CONFIG_ISDN_DIVAS_USERIDI=m -CONFIG_ISDN_DIVAS_MAINT=m - -# -# Telephony Support -# -# CONFIG_PHONE is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=m -# CONFIG_INPUT_TSDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input I/O drivers -# -CONFIG_GAMEPORT=m -CONFIG_SOUND_GAMEPORT=m -CONFIG_GAMEPORT_NS558=m -CONFIG_GAMEPORT_L4=m -CONFIG_GAMEPORT_EMU10K1=m -CONFIG_GAMEPORT_VORTEX=m -CONFIG_GAMEPORT_FM801=m -CONFIG_GAMEPORT_CS461x=m -CONFIG_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_SERIAL=m -CONFIG_MOUSE_INPORT=m -CONFIG_MOUSE_ATIXL=y -CONFIG_MOUSE_LOGIBM=m -CONFIG_MOUSE_PC110PAD=m -CONFIG_MOUSE_VSXXXAA=m -CONFIG_INPUT_JOYSTICK=y -CONFIG_JOYSTICK_ANALOG=m -CONFIG_JOYSTICK_A3D=m -CONFIG_JOYSTICK_ADI=m -CONFIG_JOYSTICK_COBRA=m -CONFIG_JOYSTICK_GF2K=m -CONFIG_JOYSTICK_GRIP=m -CONFIG_JOYSTICK_GRIP_MP=m -CONFIG_JOYSTICK_GUILLEMOT=m -CONFIG_JOYSTICK_INTERACT=m -CONFIG_JOYSTICK_SIDEWINDER=m -CONFIG_JOYSTICK_TMDC=m -CONFIG_JOYSTICK_IFORCE=m -CONFIG_JOYSTICK_IFORCE_USB=y -CONFIG_JOYSTICK_IFORCE_232=y -CONFIG_JOYSTICK_WARRIOR=m -CONFIG_JOYSTICK_MAGELLAN=m -CONFIG_JOYSTICK_SPACEORB=m -CONFIG_JOYSTICK_SPACEBALL=m -CONFIG_JOYSTICK_STINGER=m -CONFIG_JOYSTICK_TWIDDLER=m -CONFIG_JOYSTICK_DB9=m -CONFIG_JOYSTICK_GAMECON=m -CONFIG_JOYSTICK_TURBOGRAFX=m -# CONFIG_INPUT_JOYDUMP is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_GUNZE=m -CONFIG_INPUT_MISC=y -CONFIG_INPUT_PCSPKR=m -# CONFIG_INPUT_UINPUT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -CONFIG_SERIAL_NONSTANDARD=y -CONFIG_ROCKETPORT=m -# CONFIG_CYCLADES is not set -CONFIG_SYNCLINK=m -CONFIG_SYNCLINKMP=m -CONFIG_N_HDLC=m -CONFIG_STALDRV=y - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_CS=m -# CONFIG_SERIAL_8250_ACPI is not set -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_EXTENDED=y -# CONFIG_SERIAL_8250_MANY_PORTS is not set -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_8250_DETECT_IRQ=y -CONFIG_SERIAL_8250_MULTIPORT=y -CONFIG_SERIAL_8250_RSA=y - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -CONFIG_CRASH=m -CONFIG_PRINTER=m -CONFIG_LP_CONSOLE=y -CONFIG_PPDEV=m -CONFIG_TIPAR=m -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -CONFIG_IPMI_HANDLER=m -# CONFIG_IPMI_PANIC_EVENT is not set -CONFIG_IPMI_DEVICE_INTERFACE=m -CONFIG_IPMI_SI=m -CONFIG_IPMI_WATCHDOG=m - -# -# Watchdog Cards -# -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -CONFIG_SOFT_WATCHDOG=m -CONFIG_ACQUIRE_WDT=m -CONFIG_ADVANTECH_WDT=m -CONFIG_ALIM1535_WDT=m -CONFIG_ALIM7101_WDT=m -CONFIG_SC520_WDT=m -CONFIG_EUROTECH_WDT=m -CONFIG_IB700_WDT=m -CONFIG_WAFER_WDT=m -CONFIG_I8XX_TCO=m -CONFIG_SC1200_WDT=m -# CONFIG_SCx200_WDT is not set -# CONFIG_60XX_WDT is not set -CONFIG_CPU5_WDT=m -CONFIG_W83627HF_WDT=m -CONFIG_W83877F_WDT=m -CONFIG_MACHZ_WDT=m - -# -# ISA-based Watchdog Cards -# -CONFIG_PCWATCHDOG=m -# CONFIG_MIXCOMWD is not set -CONFIG_WDT=m -# CONFIG_WDT_501 is not set - -# -# PCI-based Watchdog Cards -# -CONFIG_PCIPCWATCHDOG=m -CONFIG_WDTPCI=m -CONFIG_WDT_501_PCI=y - -# -# USB-based Watchdog Cards -# -CONFIG_USBPCWATCHDOG=m -CONFIG_HW_RANDOM=m -CONFIG_NVRAM=m -CONFIG_RTC=y -CONFIG_DTLK=m -CONFIG_R3964=m -# CONFIG_APPLICOM is not set -CONFIG_SONYPI=m - -# -# Ftape, the floppy tape device driver -# -CONFIG_AGP=y -CONFIG_AGP_ALI=y -CONFIG_AGP_ATI=y -CONFIG_AGP_AMD=y -CONFIG_AGP_AMD64=y -CONFIG_AGP_INTEL=y -CONFIG_AGP_INTEL_MCH=y -CONFIG_AGP_NVIDIA=y -CONFIG_AGP_SIS=y -CONFIG_AGP_SWORKS=y -CONFIG_AGP_VIA=y -CONFIG_AGP_EFFICEON=y -CONFIG_DRM=y -CONFIG_DRM_TDFX=m -CONFIG_DRM_GAMMA=m -CONFIG_DRM_R128=m -CONFIG_DRM_RADEON=m -CONFIG_DRM_I810=m -CONFIG_DRM_I830=m -CONFIG_DRM_MGA=m -CONFIG_DRM_SIS=m - -# -# PCMCIA character devices -# -CONFIG_SYNCLINK_CS=m -CONFIG_MWAVE=m -# CONFIG_RAW_DRIVER is not set -CONFIG_HANGCHECK_TIMER=m - -# -# I2C support -# -CONFIG_I2C=m -CONFIG_I2C_CHARDEV=m - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=m -CONFIG_I2C_ALGOPCF=m - -# -# I2C Hardware Bus support -# -CONFIG_I2C_ALI1535=m -CONFIG_I2C_ALI1563=m -CONFIG_I2C_ALI15X3=m -CONFIG_I2C_AMD756=m -CONFIG_I2C_AMD8111=m -CONFIG_I2C_I801=m -CONFIG_I2C_I810=m -CONFIG_I2C_ISA=m -CONFIG_I2C_NFORCE2=m -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -CONFIG_I2C_PIIX4=m -CONFIG_I2C_PROSAVAGE=m -CONFIG_I2C_SAVAGE4=m -# CONFIG_SCx200_ACB is not set -CONFIG_I2C_SIS5595=m -CONFIG_I2C_SIS630=m -CONFIG_I2C_SIS96X=m -CONFIG_I2C_VIA=m -CONFIG_I2C_VIAPRO=m -CONFIG_I2C_VOODOO3=m - -# -# Hardware Sensors Chip support -# -CONFIG_I2C_SENSOR=m -CONFIG_SENSORS_ADM1021=m -CONFIG_SENSORS_ASB100=m -CONFIG_SENSORS_DS1621=m -CONFIG_SENSORS_FSCHER=m -CONFIG_SENSORS_GL518SM=m -CONFIG_SENSORS_IT87=m -CONFIG_SENSORS_LM75=m -CONFIG_SENSORS_LM78=m -CONFIG_SENSORS_LM80=m -CONFIG_SENSORS_LM83=m -CONFIG_SENSORS_LM85=m -CONFIG_SENSORS_LM90=m -CONFIG_SENSORS_MAX1619=m -CONFIG_SENSORS_VIA686A=m -CONFIG_SENSORS_W83781D=m -CONFIG_SENSORS_W83L785TS=m -CONFIG_SENSORS_W83627HF=m - -# -# Other I2C Chip support -# -CONFIG_SENSORS_EEPROM=m -CONFIG_SENSORS_PCF8574=m -CONFIG_SENSORS_PCF8591=m -CONFIG_SENSORS_RTC8564=m -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Misc devices -# -CONFIG_IBM_ASM=m - -# -# Multimedia devices -# -CONFIG_VIDEO_DEV=m - -# -# Video For Linux -# - -# -# Video Adapters -# -CONFIG_VIDEO_BT848=m -CONFIG_VIDEO_PMS=m -CONFIG_VIDEO_BWQCAM=m -CONFIG_VIDEO_CQCAM=m -CONFIG_VIDEO_W9966=m -CONFIG_VIDEO_CPIA=m -CONFIG_VIDEO_CPIA_PP=m -CONFIG_VIDEO_CPIA_USB=m -CONFIG_VIDEO_SAA5246A=m -CONFIG_VIDEO_SAA5249=m -CONFIG_TUNER_3036=m -CONFIG_VIDEO_STRADIS=m -CONFIG_VIDEO_ZORAN=m -CONFIG_VIDEO_ZORAN_BUZ=m -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 -CONFIG_VIDEO_HEXIUM_ORION=m -CONFIG_VIDEO_HEXIUM_GEMINI=m -CONFIG_VIDEO_CX88=m - -# -# Radio Adapters -# -CONFIG_RADIO_CADET=m -CONFIG_RADIO_RTRACK=m -CONFIG_RADIO_RTRACK2=m -CONFIG_RADIO_AZTECH=m -CONFIG_RADIO_GEMTEK=m -CONFIG_RADIO_GEMTEK_PCI=m -CONFIG_RADIO_MAXIRADIO=m -CONFIG_RADIO_MAESTRO=m -CONFIG_RADIO_SF16FMI=m -CONFIG_RADIO_SF16FMR2=m -CONFIG_RADIO_TERRATEC=m -CONFIG_RADIO_TRUST=m -CONFIG_RADIO_TYPHOON=m -CONFIG_RADIO_TYPHOON_PROC_FS=y -CONFIG_RADIO_ZOLTRIX=m - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set -CONFIG_VIDEO_SAA7146=m -CONFIG_VIDEO_SAA7146_VV=m -CONFIG_VIDEO_VIDEOBUF=m -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEO_BUF=m -CONFIG_VIDEO_BTCX=m -CONFIG_VIDEO_IR=m - -# -# Graphics support -# -CONFIG_FB=y -# CONFIG_FB_PM2 is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -CONFIG_FB_VGA16=m -CONFIG_FB_VESA=y -CONFIG_VIDEO_SELECT=y -CONFIG_FB_HGA=m -CONFIG_FB_HGA_ACCEL=y -CONFIG_FB_RIVA=m -CONFIG_FB_I810=m -CONFIG_FB_I810_GTF=y -CONFIG_FB_MATROX=m -CONFIG_FB_MATROX_MILLENIUM=y -CONFIG_FB_MATROX_MYSTIQUE=y -CONFIG_FB_MATROX_G450=y -CONFIG_FB_MATROX_G100=y -CONFIG_FB_MATROX_I2C=m -CONFIG_FB_MATROX_MAVEN=m -CONFIG_FB_MATROX_MULTIHEAD=y -# CONFIG_FB_RADEON_OLD is not set -CONFIG_FB_RADEON=m -CONFIG_FB_RADEON_I2C=y -# CONFIG_FB_RADEON_DEBUG is not set -CONFIG_FB_ATY128=m -CONFIG_FB_ATY=m -CONFIG_FB_ATY_CT=y -CONFIG_FB_ATY_GX=y -# CONFIG_FB_ATY_XL_INIT is not set -# CONFIG_FB_SIS is not set -CONFIG_FB_NEOMAGIC=m -CONFIG_FB_KYRO=m -CONFIG_FB_3DFX=m -CONFIG_FB_3DFX_ACCEL=y -CONFIG_FB_VOODOO1=m -CONFIG_FB_TRIDENT=m -CONFIG_FB_TRIDENT_ACCEL=y -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -CONFIG_VGA_CONSOLE=y -CONFIG_MDA_CONSOLE=m -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_PCI_CONSOLE=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y - -# -# Logo configuration -# -CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_MONO is not set -# CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_LOGO_LINUX_CLUT224=y - -# -# Sound -# -CONFIG_SOUND=m - -# -# Advanced Linux Sound Architecture -# -CONFIG_SND=m -CONFIG_SND_TIMER=m -CONFIG_SND_PCM=m -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_SEQUENCER=m -CONFIG_SND_SEQ_DUMMY=m -CONFIG_SND_OSSEMUL=y -CONFIG_SND_MIXER_OSS=m -CONFIG_SND_PCM_OSS=m -CONFIG_SND_SEQUENCER_OSS=y -CONFIG_SND_RTCTIMER=m -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set - -# -# Generic devices -# -CONFIG_SND_MPU401_UART=m -CONFIG_SND_OPL3_LIB=m -CONFIG_SND_OPL4_LIB=m -CONFIG_SND_VX_LIB=m -CONFIG_SND_DUMMY=m -CONFIG_SND_VIRMIDI=m -CONFIG_SND_MTPAV=m -# CONFIG_SND_SERIAL_U16550 is not set -CONFIG_SND_MPU401=m - -# -# ISA devices -# -CONFIG_SND_AD1816A=m -CONFIG_SND_AD1848=m -CONFIG_SND_CS4231=m -CONFIG_SND_CS4232=m -CONFIG_SND_CS4236=m -CONFIG_SND_ES968=m -CONFIG_SND_ES1688=m -CONFIG_SND_ES18XX=m -CONFIG_SND_GUSCLASSIC=m -CONFIG_SND_GUSEXTREME=m -CONFIG_SND_GUSMAX=m -CONFIG_SND_INTERWAVE=m -CONFIG_SND_INTERWAVE_STB=m -CONFIG_SND_OPTI92X_AD1848=m -CONFIG_SND_OPTI92X_CS4231=m -CONFIG_SND_OPTI93X=m -CONFIG_SND_SB8=m -CONFIG_SND_SB16=m -CONFIG_SND_SBAWE=m -CONFIG_SND_SB16_CSP=y -# CONFIG_SND_WAVEFRONT is not set -CONFIG_SND_ALS100=m -CONFIG_SND_AZT2320=m -CONFIG_SND_CMI8330=m -CONFIG_SND_DT019X=m -CONFIG_SND_OPL3SA2=m -CONFIG_SND_SGALAXY=m -CONFIG_SND_SSCAPE=m - -# -# PCI devices -# -CONFIG_SND_AC97_CODEC=m -CONFIG_SND_ALI5451=m -CONFIG_SND_ATIIXP=m -CONFIG_SND_AU8810=m -CONFIG_SND_AU8820=m -CONFIG_SND_AU8830=m -CONFIG_SND_AZT3328=m -CONFIG_SND_BT87X=m -CONFIG_SND_CS46XX=m -CONFIG_SND_CS46XX_NEW_DSP=y -CONFIG_SND_CS4281=m -CONFIG_SND_EMU10K1=m -CONFIG_SND_KORG1212=m -CONFIG_SND_MIXART=m -CONFIG_SND_NM256=m -CONFIG_SND_RME32=m -CONFIG_SND_RME96=m -CONFIG_SND_RME9652=m -CONFIG_SND_HDSP=m -CONFIG_SND_TRIDENT=m -CONFIG_SND_YMFPCI=m -CONFIG_SND_ALS4000=m -CONFIG_SND_CMIPCI=m -CONFIG_SND_ENS1370=m -CONFIG_SND_ENS1371=m -CONFIG_SND_ES1938=m -CONFIG_SND_ES1968=m -CONFIG_SND_MAESTRO3=m -CONFIG_SND_FM801=m -CONFIG_SND_FM801_TEA575X=m -CONFIG_SND_ICE1712=m -CONFIG_SND_ICE1724=m -CONFIG_SND_INTEL8X0=m -CONFIG_SND_INTEL8X0M=m -CONFIG_SND_SONICVIBES=m -CONFIG_SND_VIA82XX=m -CONFIG_SND_VX222=m - -# -# ALSA USB devices -# -CONFIG_SND_USB_AUDIO=m - -# -# PCMCIA devices -# -# CONFIG_SND_VXPOCKET is not set -# CONFIG_SND_VXP440 is not set -CONFIG_SND_PDAUDIOCF=m - -# -# Open Sound System -# -# CONFIG_SOUND_PRIME is not set - -# -# USB support -# -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_BANDWIDTH is not set -# CONFIG_USB_DYNAMIC_MINORS is not set - -# -# USB Host Controller Drivers -# -CONFIG_USB_EHCI_HCD=m -CONFIG_USB_EHCI_SPLIT_ISO=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_OHCI_HCD=m -CONFIG_USB_UHCI_HCD=m - -# -# USB Device Class drivers -# -CONFIG_USB_AUDIO=m - -# -# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem -# -CONFIG_USB_MIDI=m -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m -CONFIG_USB_STORAGE=m -# CONFIG_USB_STORAGE_DEBUG is not set -CONFIG_USB_STORAGE_DATAFAB=y -CONFIG_USB_STORAGE_FREECOM=y -CONFIG_USB_STORAGE_ISD200=y -CONFIG_USB_STORAGE_DPCM=y -CONFIG_USB_STORAGE_HP8200e=y -CONFIG_USB_STORAGE_SDDR09=y -CONFIG_USB_STORAGE_SDDR55=y -CONFIG_USB_STORAGE_JUMPSHOT=y - -# -# USB Human Interface Devices (HID) -# -CONFIG_USB_HID=y -CONFIG_USB_HIDINPUT=y -CONFIG_HID_FF=y -CONFIG_HID_PID=y -CONFIG_LOGITECH_FF=y -CONFIG_THRUSTMASTER_FF=y -CONFIG_USB_HIDDEV=y -CONFIG_USB_AIPTEK=m -CONFIG_USB_WACOM=m -CONFIG_USB_KBTAB=m -CONFIG_USB_POWERMATE=m -CONFIG_USB_MTOUCH=m -CONFIG_USB_EGALAX=m -CONFIG_USB_XPAD=m -CONFIG_USB_ATI_REMOTE=m - -# -# USB Imaging devices -# -CONFIG_USB_MDC800=m -CONFIG_USB_MICROTEK=m -CONFIG_USB_HPUSBSCSI=m - -# -# USB Multimedia devices -# -CONFIG_USB_DABUSB=m -CONFIG_USB_VICAM=m -CONFIG_USB_DSBR=m -CONFIG_USB_IBMCAM=m -CONFIG_USB_KONICAWC=m -CONFIG_USB_OV511=m -CONFIG_USB_SE401=m -CONFIG_USB_STV680=m -CONFIG_USB_W9968CF=m - -# -# USB Network adaptors -# -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_USBNET=m - -# -# USB Host-to-Host Cables -# -CONFIG_USB_ALI_M5632=y -CONFIG_USB_AN2720=y -CONFIG_USB_BELKIN=y -CONFIG_USB_GENESYS=y -CONFIG_USB_NET1080=y -CONFIG_USB_PL2301=y - -# -# Intelligent USB Devices/Gadgets -# -CONFIG_USB_ARMLINUX=y -CONFIG_USB_EPSON2888=y -CONFIG_USB_ZAURUS=y -CONFIG_USB_CDCETHER=y - -# -# USB Network Adapters -# -CONFIG_USB_AX8817X=y - -# -# USB port drivers -# -CONFIG_USB_USS720=m - -# -# USB Serial Converter support -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -CONFIG_USB_SERIAL_BELKIN=m -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_PL2303=m -CONFIG_USB_SERIAL_SAFE=m -CONFIG_USB_SERIAL_SAFE_PADDED=y -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_EZUSB=y - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -# CONFIG_USB_EMI26 is not set -CONFIG_USB_TIGL=m -CONFIG_USB_AUERSWALD=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -# CONFIG_USB_CYTHERM is not set -CONFIG_USB_PHIDGETSERVO=m -CONFIG_USB_TEST=m - -# -# USB Gadget Support -# -# CONFIG_USB_GADGET is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS=m -CONFIG_EXT3_FS_XATTR=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_JBD=m -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -CONFIG_REISERFS_PROC_INFO=y -CONFIG_REISERFS_FS_XATTR=y -CONFIG_REISERFS_FS_POSIX_ACL=y -CONFIG_REISERFS_FS_SECURITY=y -CONFIG_JFS_FS=m -CONFIG_JFS_POSIX_ACL=y -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_XFS_FS=m -# CONFIG_XFS_RT is not set -CONFIG_XFS_QUOTA=y -CONFIG_XFS_SECURITY=y -CONFIG_XFS_POSIX_ACL=y -CONFIG_MINIX_FS=m -CONFIG_ROMFS_FS=m -CONFIG_QUOTA=y -# CONFIG_QFMT_V1 is not set -CONFIG_QFMT_V2=y -CONFIG_QUOTACTL=y -CONFIG_AUTOFS_FS=m -CONFIG_AUTOFS4_FS=m - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_ZISOFS_FS=y -CONFIG_UDF_FS=m - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_SYSFS=y -# CONFIG_DEVFS_FS is not set -CONFIG_DEVPTS_FS_XATTR=y -CONFIG_DEVPTS_FS_SECURITY=y -CONFIG_TMPFS=y -CONFIG_HUGETLBFS=y -CONFIG_HUGETLB_PAGE=y -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -CONFIG_AFFS_FS=m -CONFIG_HFS_FS=m -CONFIG_HFSPLUS_FS=m -CONFIG_BEFS_FS=m -# CONFIG_BEFS_DEBUG is not set -CONFIG_BFS_FS=m -CONFIG_EFS_FS=m -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=m -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_NAND=y -CONFIG_CRAMFS=m -CONFIG_VXFS_FS=m -# CONFIG_HPFS_FS is not set -CONFIG_QNX4FS_FS=m -# CONFIG_QNX4FS_RW is not set -CONFIG_SYSV_FS=m -CONFIG_UFS_FS=m -# CONFIG_UFS_FS_WRITE is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=m -CONFIG_NFS_V3=y -CONFIG_NFS_V4=y -CONFIG_NFS_DIRECTIO=y -CONFIG_NFSD=m -CONFIG_NFSD_V3=y -CONFIG_NFSD_V4=y -CONFIG_NFSD_TCP=y -CONFIG_LOCKD=m -CONFIG_LOCKD_V4=y -CONFIG_EXPORTFS=m -CONFIG_SUNRPC=m -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m -CONFIG_SMB_FS=m -# CONFIG_SMB_NLS_DEFAULT is not set -CONFIG_CIFS=m -# CONFIG_CIFS_STATS is not set -CONFIG_NCP_FS=m -CONFIG_NCPFS_PACKET_SIGNING=y -CONFIG_NCPFS_IOCTL_LOCKING=y -CONFIG_NCPFS_STRONG=y -CONFIG_NCPFS_NFS_NS=y -CONFIG_NCPFS_OS2_NS=y -CONFIG_NCPFS_SMALLDOS=y -CONFIG_NCPFS_NLS=y -CONFIG_NCPFS_EXTRAS=y -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -CONFIG_OSF_PARTITION=y -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -CONFIG_BSD_DISKLABEL=y -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 -CONFIG_EFI_PARTITION=y - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=m -CONFIG_NLS_CODEPAGE_737=m -CONFIG_NLS_CODEPAGE_775=m -CONFIG_NLS_CODEPAGE_850=m -CONFIG_NLS_CODEPAGE_852=m -CONFIG_NLS_CODEPAGE_855=m -CONFIG_NLS_CODEPAGE_857=m -CONFIG_NLS_CODEPAGE_860=m -CONFIG_NLS_CODEPAGE_861=m -CONFIG_NLS_CODEPAGE_862=m -CONFIG_NLS_CODEPAGE_863=m -CONFIG_NLS_CODEPAGE_864=m -CONFIG_NLS_CODEPAGE_865=m -CONFIG_NLS_CODEPAGE_866=m -CONFIG_NLS_CODEPAGE_869=m -CONFIG_NLS_CODEPAGE_936=m -CONFIG_NLS_CODEPAGE_950=m -CONFIG_NLS_CODEPAGE_932=m -CONFIG_NLS_CODEPAGE_949=m -CONFIG_NLS_CODEPAGE_874=m -CONFIG_NLS_ISO8859_8=m -CONFIG_NLS_CODEPAGE_1250=m -CONFIG_NLS_CODEPAGE_1251=m -CONFIG_NLS_ISO8859_1=m -CONFIG_NLS_ISO8859_2=m -CONFIG_NLS_ISO8859_3=m -CONFIG_NLS_ISO8859_4=m -CONFIG_NLS_ISO8859_5=m -CONFIG_NLS_ISO8859_6=m -CONFIG_NLS_ISO8859_7=m -CONFIG_NLS_ISO8859_9=m -CONFIG_NLS_ISO8859_13=m -CONFIG_NLS_ISO8859_14=m -CONFIG_NLS_ISO8859_15=m -CONFIG_NLS_KOI8_R=m -CONFIG_NLS_KOI8_U=m -CONFIG_NLS_UTF8=m - -# -# Profiling support -# -CONFIG_PROFILING=y -CONFIG_OPROFILE=m - -# -# Kernel hacking -# -CONFIG_DEBUG_KERNEL=y -CONFIG_EARLY_PRINTK=y -CONFIG_DEBUG_STACKOVERFLOW=y -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_MAGIC_SYSRQ=y -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_HIGHMEM is not set -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 - -# -# Linux VServer -# -CONFIG_VSERVER_LEGACY=y -CONFIG_PROC_SECURE=y -# CONFIG_VSERVER_HARDCPU is not set -# CONFIG_INOXID_NONE is not set -# CONFIG_INOXID_GID16 is not set -CONFIG_INOXID_GID24=y -# CONFIG_INOXID_GID32 is not set -# CONFIG_INOXID_MAGIC is not set - -# -# Security options -# -CONFIG_SECURITY=y -CONFIG_SECURITY_NETWORK=y -CONFIG_SECURITY_CAPABILITIES=y -# CONFIG_SECURITY_ROOTPLUG is not set -CONFIG_SECURITY_SELINUX=y -CONFIG_SECURITY_SELINUX_BOOTPARAM=y -CONFIG_SECURITY_SELINUX_DISABLE=y -CONFIG_SECURITY_SELINUX_DEVELOP=y -# CONFIG_SECURITY_SELINUX_MLS is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_TWOFISH=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_AES=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_DEFLATE=m -CONFIG_CRYPTO_MICHAEL_MIC=m -CONFIG_CRYPTO_CRC32C=m -# CONFIG_CRYPTO_TEST is not set - -# -# Library routines -# -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/configs/kernel-2.6.6-i686-smp.config b/configs/kernel-2.6.6-i686-smp.config deleted file mode 100644 index 62cca9891..000000000 --- a/configs/kernel-2.6.6-i686-smp.config +++ /dev/null @@ -1,2364 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_X86=y -CONFIG_MMU=y -CONFIG_UID16=y -CONFIG_GENERIC_ISA_DMA=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y -CONFIG_STANDALONE=y - -# -# General setup -# -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_SYSCTL=y -CONFIG_AUDIT=y -CONFIG_AUDITSYSCALL=y -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_HOTPLUG=y -# CONFIG_IKCONFIG is not set -# CONFIG_EMBEDDED is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -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=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -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_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_ES7000 is not set -CONFIG_X86_CYCLONE_TIMER=y -# CONFIG_M386 is not set -# CONFIG_M486 is not set -# CONFIG_M586 is not set -# CONFIG_M586TSC is not set -# CONFIG_M586MMX is not set -CONFIG_M686=y -# CONFIG_MPENTIUMII is not set -# CONFIG_MPENTIUMIII is not set -# CONFIG_MPENTIUMM is not set -# CONFIG_MPENTIUM4 is not set -# CONFIG_MK6 is not set -# CONFIG_MK7 is not set -# CONFIG_MK8 is not set -# CONFIG_MCRUSOE is not set -# CONFIG_MWINCHIPC6 is not set -# CONFIG_MWINCHIP2 is not set -# CONFIG_MWINCHIP3D is not set -# CONFIG_MCYRIXIII is not set -# CONFIG_MVIAC3_2 is not set -CONFIG_X86_GENERIC=y -CONFIG_X86_CMPXCHG=y -CONFIG_X86_XADD=y -CONFIG_X86_L1_CACHE_SHIFT=7 -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_X86_PPRO_FENCE=y -CONFIG_X86_WP_WORKS_OK=y -CONFIG_X86_INVLPG=y -CONFIG_X86_BSWAP=y -CONFIG_X86_POPAD_OK=y -CONFIG_X86_GOOD_APIC=y -CONFIG_X86_INTEL_USERCOPY=y -CONFIG_X86_USE_PPRO_CHECKSUM=y -CONFIG_X86_4G=y -CONFIG_X86_SWITCH_PAGETABLES=y -CONFIG_X86_4G_VM_LAYOUT=y -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_PREEMPT is not set -CONFIG_X86_LOCAL_APIC=y -CONFIG_X86_IO_APIC=y -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 -CONFIG_X86_MSR=m -CONFIG_X86_CPUID=m - -# -# Firmware Drivers -# -CONFIG_EDD=m -# CONFIG_NOHIGHMEM is not set -# CONFIG_HIGHMEM4G is not set -CONFIG_HIGHMEM64G=y -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 - -# -# Power management options (ACPI, APM) -# -CONFIG_PM=y -# CONFIG_SOFTWARE_SUSPEND is not set -# CONFIG_PM_DISK is not set - -# -# ACPI (Advanced Configuration and Power Interface) Support -# -CONFIG_ACPI=y -CONFIG_ACPI_BOOT=y -CONFIG_ACPI_INTERPRETER=y -CONFIG_ACPI_SLEEP=y -CONFIG_ACPI_SLEEP_PROC_FS=y -CONFIG_ACPI_AC=m -CONFIG_ACPI_BATTERY=m -CONFIG_ACPI_BUTTON=m -CONFIG_ACPI_FAN=y -CONFIG_ACPI_PROCESSOR=y -CONFIG_ACPI_THERMAL=y -CONFIG_ACPI_ASUS=m -CONFIG_ACPI_TOSHIBA=m -# CONFIG_ACPI_DEBUG is not set -CONFIG_ACPI_BUS=y -CONFIG_ACPI_EC=y -CONFIG_ACPI_POWER=y -CONFIG_ACPI_PCI=y -CONFIG_ACPI_SYSTEM=y -CONFIG_X86_PM_TIMER=y - -# -# APM (Advanced Power Management) BIOS Support -# -CONFIG_APM=y -# CONFIG_APM_IGNORE_USER_SUSPEND is not set -# CONFIG_APM_DO_ENABLE is not set -CONFIG_APM_CPU_IDLE=y -# CONFIG_APM_DISPLAY_BLANK is not set -CONFIG_APM_RTC_IS_GMT=y -# CONFIG_APM_ALLOW_INTS is not set -# CONFIG_APM_REAL_MODE_POWER_OFF is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_PROC_INTF is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=m -CONFIG_CPU_FREQ_GOV_USERSPACE=y -# CONFIG_CPU_FREQ_24_API is not set -CONFIG_CPU_FREQ_TABLE=y - -# -# CPUFreq processor drivers -# -CONFIG_X86_ACPI_CPUFREQ=m -# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set -CONFIG_X86_POWERNOW_K6=m -CONFIG_X86_POWERNOW_K7=y -CONFIG_X86_POWERNOW_K8=m -# CONFIG_X86_GX_SUSPMOD is not set -CONFIG_X86_SPEEDSTEP_CENTRINO=y -CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y -CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y -CONFIG_X86_SPEEDSTEP_ICH=y -CONFIG_X86_SPEEDSTEP_SMI=m -CONFIG_X86_P4_CLOCKMOD=m -CONFIG_X86_SPEEDSTEP_LIB=y -# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set -CONFIG_X86_LONGRUN=y -# CONFIG_X86_LONGHAUL is not set - -# -# Bus options (PCI, PCMCIA, EISA, MCA, ISA) -# -CONFIG_PCI=y -# CONFIG_PCI_GOBIOS is not set -# CONFIG_PCI_GOMMCONFIG is not set -# CONFIG_PCI_GODIRECT is not set -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 -# CONFIG_EISA is not set -# CONFIG_MCA is not set -# CONFIG_SCx200 is not set - -# -# PCMCIA/CardBus support -# -CONFIG_PCMCIA=m -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_YENTA=m -CONFIG_CARDBUS=y -CONFIG_I82092=m -CONFIG_I82365=m -CONFIG_TCIC=m -CONFIG_PCMCIA_PROBE=y - -# -# PCI Hotplug Support -# -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 -CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y -CONFIG_HOTPLUG_PCI_SHPC=m -CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y - -# -# Executable file formats -# -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_MISC=m - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_FW_LOADER=y -# CONFIG_DEBUG_DRIVER is not set - -# -# Memory Technology Devices (MTD) -# -CONFIG_MTD=m -# CONFIG_MTD_DEBUG is not set -CONFIG_MTD_PARTITIONS=m -CONFIG_MTD_CONCAT=m -CONFIG_MTD_REDBOOT_PARTS=m -CONFIG_MTD_CMDLINE_PARTS=m - -# -# User Modules And Translation Layers -# -CONFIG_MTD_CHAR=m -CONFIG_MTD_BLOCK=m -CONFIG_MTD_BLOCK_RO=m -CONFIG_FTL=m -CONFIG_NFTL=m -CONFIG_NFTL_RW=y -CONFIG_INFTL=m - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=m -CONFIG_MTD_JEDECPROBE=m -CONFIG_MTD_GEN_PROBE=m -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_INTELEXT=m -CONFIG_MTD_CFI_AMDSTD=m -CONFIG_MTD_CFI_STAA=m -CONFIG_MTD_RAM=m -CONFIG_MTD_ROM=m -CONFIG_MTD_ABSENT=m -# CONFIG_MTD_OBSOLETE_CHIPS is not set - -# -# Mapping drivers for chip access -# -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PNC2000 is not set -CONFIG_MTD_SC520CDP=m -CONFIG_MTD_NETSC520=m -CONFIG_MTD_SBC_GXX=m -CONFIG_MTD_ELAN_104NC=m -CONFIG_MTD_SCx200_DOCFLASH=m -CONFIG_MTD_AMD76XROM=m -CONFIG_MTD_ICH2ROM=m -CONFIG_MTD_SCB2_FLASH=m -# CONFIG_MTD_NETtel is not set -# CONFIG_MTD_DILNETPC is not set -CONFIG_MTD_L440GX=m -CONFIG_MTD_PCI=m - -# -# Self-contained MTD device drivers -# -CONFIG_MTD_PMC551=m -# CONFIG_MTD_PMC551_BUGFIX is not set -# CONFIG_MTD_PMC551_DEBUG is not set -# CONFIG_MTD_SLRAM is not set -CONFIG_MTD_MTDRAM=m -CONFIG_MTDRAM_TOTAL_SIZE=4096 -CONFIG_MTDRAM_ERASE_SIZE=128 -# CONFIG_MTD_BLKMTD is not set - -# -# Disk-On-Chip Device Drivers -# -CONFIG_MTD_DOC2000=m -# CONFIG_MTD_DOC2001 is not set -CONFIG_MTD_DOC2001PLUS=m -CONFIG_MTD_DOCPROBE=m -# CONFIG_MTD_DOCPROBE_ADVANCED is not set -CONFIG_MTD_DOCPROBE_ADDRESS=0 - -# -# NAND Flash Device Drivers -# -CONFIG_MTD_NAND=m -# CONFIG_MTD_NAND_VERIFY_WRITE is not set -CONFIG_MTD_NAND_IDS=m - -# -# Parallel port support -# -CONFIG_PARPORT=m -CONFIG_PARPORT_PC=m -CONFIG_PARPORT_PC_CML1=m -CONFIG_PARPORT_SERIAL=m -# CONFIG_PARPORT_PC_FIFO is not set -# CONFIG_PARPORT_PC_SUPERIO is not set -CONFIG_PARPORT_PC_PCMCIA=m -# CONFIG_PARPORT_OTHER is not set -CONFIG_PARPORT_1284=y - -# -# Plug and Play support -# -CONFIG_PNP=y -# CONFIG_PNP_DEBUG is not set - -# -# Protocols -# -CONFIG_ISAPNP=y -# CONFIG_PNPBIOS is not set - -# -# Block devices -# -CONFIG_BLK_DEV_FD=m -# CONFIG_BLK_DEV_XD is not set -# CONFIG_PARIDE is not set -CONFIG_BLK_CPQ_DA=m -CONFIG_BLK_CPQ_CISS_DA=m -CONFIG_CISS_SCSI_TAPE=y -CONFIG_BLK_DEV_DAC960=m -CONFIG_BLK_DEV_UMEM=m -CONFIG_BLK_DEV_LOOP=m -CONFIG_BLK_DEV_CRYPTOLOOP=m -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_CARMEL=m -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=16384 -CONFIG_BLK_DEV_INITRD=y -CONFIG_LBD=y - -# -# ATA/ATAPI/MFM/RLL support -# -CONFIG_IDE=y -CONFIG_BLK_DEV_IDE=y - -# -# Please see Documentation/ide.txt for help/info on IDE drives -# -# CONFIG_BLK_DEV_HD_IDE is not set -CONFIG_BLK_DEV_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 -CONFIG_BLK_DEV_IDEFLOPPY=y -# CONFIG_BLK_DEV_IDESCSI is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IDE_TASKFILE_IO is not set - -# -# IDE chipset support/bugfixes -# -CONFIG_IDE_GENERIC=y -# CONFIG_BLK_DEV_CMD640 is not set -CONFIG_BLK_DEV_IDEPNP=y -CONFIG_BLK_DEV_IDEPCI=y -CONFIG_IDEPCI_SHARE_IRQ=y -# CONFIG_BLK_DEV_OFFBOARD is not set -CONFIG_BLK_DEV_GENERIC=y -# CONFIG_BLK_DEV_OPTI621 is not set -CONFIG_BLK_DEV_RZ1000=y -CONFIG_BLK_DEV_IDEDMA_PCI=y -# CONFIG_BLK_DEV_IDEDMA_FORCED is not set -CONFIG_IDEDMA_PCI_AUTO=y -# CONFIG_IDEDMA_ONLYDISK is not set -CONFIG_BLK_DEV_ADMA=y -CONFIG_BLK_DEV_AEC62XX=y -CONFIG_BLK_DEV_ALI15X3=y -# CONFIG_WDC_ALI15X3 is not set -CONFIG_BLK_DEV_AMD74XX=y -CONFIG_BLK_DEV_ATIIXP=y -CONFIG_BLK_DEV_CMD64X=y -CONFIG_BLK_DEV_TRIFLEX=y -CONFIG_BLK_DEV_CY82C693=y -CONFIG_BLK_DEV_CS5520=y -CONFIG_BLK_DEV_CS5530=y -CONFIG_BLK_DEV_HPT34X=y -# CONFIG_HPT34X_AUTODMA is not set -CONFIG_BLK_DEV_HPT366=y -# CONFIG_BLK_DEV_SC1200 is not set -CONFIG_BLK_DEV_PIIX=y -# CONFIG_BLK_DEV_NS87415 is not set -CONFIG_BLK_DEV_PDC202XX_OLD=y -# CONFIG_PDC202XX_BURST is not set -CONFIG_BLK_DEV_PDC202XX_NEW=y -CONFIG_PDC202XX_FORCE=y -CONFIG_BLK_DEV_SVWKS=y -CONFIG_BLK_DEV_SIIMAGE=y -CONFIG_BLK_DEV_SIS5513=y -CONFIG_BLK_DEV_SLC90E66=y -# CONFIG_BLK_DEV_TRM290 is not set -CONFIG_BLK_DEV_VIA82CXXX=y -# CONFIG_IDE_ARM is not set -# CONFIG_IDE_CHIPSETS is not set -CONFIG_BLK_DEV_IDEDMA=y -# CONFIG_IDEDMA_IVB is not set -CONFIG_IDEDMA_AUTO=y -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI device support -# -CONFIG_SCSI=m -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=m -CONFIG_CHR_DEV_ST=m -CONFIG_CHR_DEV_OSST=m -CONFIG_BLK_DEV_SR=m -CONFIG_BLK_DEV_SR_VENDOR=y -CONFIG_CHR_DEV_SG=m - -# -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs -# -# CONFIG_SCSI_MULTI_LUN is not set -CONFIG_SCSI_CONSTANTS=y -CONFIG_SCSI_LOGGING=y - -# -# SCSI Transport Attributes -# -CONFIG_SCSI_SPI_ATTRS=m -CONFIG_SCSI_FC_ATTRS=m - -# -# SCSI low-level drivers -# -CONFIG_BLK_DEV_3W_XXXX_RAID=m -# CONFIG_SCSI_7000FASST is not set -CONFIG_SCSI_ACARD=m -CONFIG_SCSI_AHA152X=m -CONFIG_SCSI_AHA1542=m -CONFIG_SCSI_AACRAID=m -CONFIG_SCSI_AIC7XXX=m -CONFIG_AIC7XXX_CMDS_PER_DEVICE=4 -CONFIG_AIC7XXX_RESET_DELAY_MS=15000 -# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set -# CONFIG_AIC7XXX_DEBUG_ENABLE is not set -CONFIG_AIC7XXX_DEBUG_MASK=0 -# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set -CONFIG_SCSI_AIC7XXX_OLD=m -CONFIG_SCSI_AIC79XX=m -CONFIG_AIC79XX_CMDS_PER_DEVICE=4 -CONFIG_AIC79XX_RESET_DELAY_MS=15000 -# CONFIG_AIC79XX_BUILD_FIRMWARE is not set -# CONFIG_AIC79XX_ENABLE_RD_STRM is not set -# CONFIG_AIC79XX_DEBUG_ENABLE is not set -CONFIG_AIC79XX_DEBUG_MASK=0 -# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set -# CONFIG_SCSI_DPT_I2O is not set -CONFIG_SCSI_ADVANSYS=m -CONFIG_SCSI_IN2000=m -CONFIG_SCSI_MEGARAID=m -CONFIG_SCSI_SATA=y -CONFIG_SCSI_SATA_SVW=m -CONFIG_SCSI_ATA_PIIX=m -CONFIG_SCSI_SATA_PROMISE=m -CONFIG_SCSI_SATA_SX4=m -CONFIG_SCSI_SATA_SIL=m -CONFIG_SCSI_SATA_SIS=m -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 -# CONFIG_SCSI_EATA_PIO is not set -CONFIG_SCSI_FUTURE_DOMAIN=m -CONFIG_SCSI_GDTH=m -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -CONFIG_SCSI_IPS=m -CONFIG_SCSI_INIA100=m -CONFIG_SCSI_PPA=m -CONFIG_SCSI_IMM=m -# CONFIG_SCSI_IZIP_EPP16 is not set -# CONFIG_SCSI_IZIP_SLOW_CTR is not set -# CONFIG_SCSI_NCR53C406A is not set -CONFIG_SCSI_SYM53C8XX_2=m -CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 -CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 -CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 -# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PSI240I is not set -CONFIG_SCSI_QLOGIC_FAS=m -CONFIG_SCSI_QLOGIC_ISP=m -# CONFIG_SCSI_QLOGIC_FC is not set -CONFIG_SCSI_QLOGIC_1280=m -CONFIG_SCSI_QLA2XXX=m -CONFIG_SCSI_QLA21XX=m -CONFIG_SCSI_QLA22XX=m -CONFIG_SCSI_QLA2300=m -CONFIG_SCSI_QLA2322=m -CONFIG_SCSI_QLA6312=m -CONFIG_SCSI_QLA6322=m -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_DC395x is not set -CONFIG_SCSI_DC390T=m -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_DEBUG is not set - -# -# PCMCIA SCSI adapter support -# -CONFIG_PCMCIA_AHA152X=m -CONFIG_PCMCIA_FDOMAIN=m -CONFIG_PCMCIA_NINJA_SCSI=m -CONFIG_PCMCIA_QLOGIC=m -CONFIG_PCMCIA_SYM53C500=m - -# -# Old CD-ROM drivers (not SCSI, not IDE) -# -# CONFIG_CD_NO_IDESCSI is not set - -# -# Multi-device support (RAID and LVM) -# -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_LINEAR=m -CONFIG_MD_RAID0=m -CONFIG_MD_RAID1=m -CONFIG_MD_RAID5=m -CONFIG_MD_RAID6=m -CONFIG_MD_MULTIPATH=m -CONFIG_BLK_DEV_DM=m -CONFIG_DM_CRYPT=m - -# -# Fusion MPT device support -# -CONFIG_FUSION=m -CONFIG_FUSION_MAX_SGE=40 -# CONFIG_FUSION_ISENSE is not set -CONFIG_FUSION_CTL=m -CONFIG_FUSION_LAN=m - -# -# IEEE 1394 (FireWire) support -# -CONFIG_IEEE1394=m - -# -# Subsystem Options -# -# CONFIG_IEEE1394_VERBOSEDEBUG is not set -CONFIG_IEEE1394_OUI_DB=y -# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set - -# -# Device Drivers -# -# CONFIG_IEEE1394_PCILYNX is not set -CONFIG_IEEE1394_OHCI1394=m - -# -# Protocol Drivers -# -CONFIG_IEEE1394_VIDEO1394=m -CONFIG_IEEE1394_SBP2=m -# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set -# CONFIG_IEEE1394_ETH1394 is not set -CONFIG_IEEE1394_DV1394=m -CONFIG_IEEE1394_RAWIO=m -CONFIG_IEEE1394_CMP=m -CONFIG_IEEE1394_AMDTP=m - -# -# I2O device support -# -CONFIG_I2O=m -CONFIG_I2O_CONFIG=m -CONFIG_I2O_BLOCK=m -CONFIG_I2O_SCSI=m -CONFIG_I2O_PROC=m - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -CONFIG_PACKET_MMAP=y -CONFIG_NETLINK_DEV=y -CONFIG_UNIX=y -CONFIG_NET_KEY=m -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_IP_ROUTE_FWMARK=y -CONFIG_IP_ROUTE_NAT=y -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_TOS=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_PNP is not set -CONFIG_NET_IPIP=m -CONFIG_NET_IPGRE=m -CONFIG_NET_IPGRE_BROADCAST=y -CONFIG_IP_MROUTE=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -CONFIG_INET_AH=m -CONFIG_INET_ESP=m -CONFIG_INET_IPCOMP=m - -# -# IP: Virtual Server Configuration -# -CONFIG_IP_VS=m -# CONFIG_IP_VS_DEBUG is not set -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -CONFIG_IP_VS_PROTO_TCP=y -CONFIG_IP_VS_PROTO_UDP=y -CONFIG_IP_VS_PROTO_ESP=y -CONFIG_IP_VS_PROTO_AH=y - -# -# IPVS scheduler -# -CONFIG_IP_VS_RR=m -CONFIG_IP_VS_WRR=m -CONFIG_IP_VS_LC=m -CONFIG_IP_VS_WLC=m -CONFIG_IP_VS_LBLC=m -CONFIG_IP_VS_LBLCR=m -CONFIG_IP_VS_DH=m -CONFIG_IP_VS_SH=m -CONFIG_IP_VS_SED=m -CONFIG_IP_VS_NQ=m - -# -# IPVS application helper -# -CONFIG_IP_VS_FTP=m -CONFIG_IPV6=m -CONFIG_IPV6_PRIVACY=y -CONFIG_INET6_AH=m -CONFIG_INET6_ESP=m -CONFIG_INET6_IPCOMP=m -CONFIG_IPV6_TUNNEL=m -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_BRIDGE_NETFILTER=y - -# -# IP: Netfilter Configuration -# -CONFIG_IP_NF_CONNTRACK=m -CONFIG_IP_NF_FTP=m -CONFIG_IP_NF_IRC=m -CONFIG_IP_NF_TFTP=m -CONFIG_IP_NF_AMANDA=m -CONFIG_IP_NF_QUEUE=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_LIMIT=m -CONFIG_IP_NF_MATCH_IPRANGE=m -CONFIG_IP_NF_MATCH_MAC=m -CONFIG_IP_NF_MATCH_PKTTYPE=m -CONFIG_IP_NF_MATCH_MARK=m -CONFIG_IP_NF_MATCH_MULTIPORT=m -CONFIG_IP_NF_MATCH_TOS=m -CONFIG_IP_NF_MATCH_RECENT=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_DSCP=m -CONFIG_IP_NF_MATCH_AH_ESP=m -CONFIG_IP_NF_MATCH_LENGTH=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_MATCH_TCPMSS=m -CONFIG_IP_NF_MATCH_HELPER=m -CONFIG_IP_NF_MATCH_STATE=m -CONFIG_IP_NF_MATCH_CONNTRACK=m -CONFIG_IP_NF_MATCH_OWNER=m -CONFIG_IP_NF_MATCH_PHYSDEV=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_NAT_NEEDED=y -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_REDIRECT=m -CONFIG_IP_NF_TARGET_NETMAP=m -CONFIG_IP_NF_TARGET_SAME=m -CONFIG_IP_NF_NAT_LOCAL=y -CONFIG_IP_NF_NAT_SNMP_BASIC=m -CONFIG_IP_NF_NAT_IRC=m -CONFIG_IP_NF_NAT_FTP=m -CONFIG_IP_NF_NAT_TFTP=m -CONFIG_IP_NF_NAT_AMANDA=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_TOS=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_DSCP=m -CONFIG_IP_NF_TARGET_MARK=m -CONFIG_IP_NF_TARGET_CLASSIFY=m -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_IP_NF_TARGET_TCPMSS=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m -# CONFIG_IP_NF_COMPAT_IPCHAINS is not set -# CONFIG_IP_NF_COMPAT_IPFWADM is not set -CONFIG_IP_NF_TARGET_NOTRACK=m -CONFIG_IP_NF_RAW=m - -# -# IPv6: Netfilter Configuration -# -# CONFIG_IP6_NF_QUEUE is not set -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_LIMIT=m -CONFIG_IP6_NF_MATCH_MAC=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_MULTIPORT=m -CONFIG_IP6_NF_MATCH_OWNER=m -CONFIG_IP6_NF_MATCH_MARK=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_AHESP=m -CONFIG_IP6_NF_MATCH_LENGTH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_LOG=m -CONFIG_IP6_NF_MANGLE=m -CONFIG_IP6_NF_TARGET_MARK=m -CONFIG_IP6_NF_RAW=m - -# -# Bridge: Netfilter Configuration -# -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_XFRM=y -CONFIG_XFRM_USER=y - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IP_SCTP=m -# CONFIG_SCTP_DBG_MSG is not set -# CONFIG_SCTP_DBG_OBJCNT is not set -# CONFIG_SCTP_HMAC_NONE is not set -# CONFIG_SCTP_HMAC_SHA1 is not set -CONFIG_SCTP_HMAC_MD5=y -# CONFIG_ATM is not set -CONFIG_BRIDGE=m -CONFIG_VLAN_8021Q=m -# CONFIG_DECNET is not set -CONFIG_LLC=m -# CONFIG_LLC2 is not set -CONFIG_IPX=m -# CONFIG_IPX_INTERN is not set -CONFIG_ATALK=m -CONFIG_DEV_APPLETALK=y -CONFIG_LTPC=m -CONFIG_COPS=m -CONFIG_COPS_DAYNA=y -CONFIG_COPS_TANGENT=y -CONFIG_IPDDP=m -CONFIG_IPDDP_ENCAP=y -CONFIG_IPDDP_DECAP=y -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -CONFIG_NET_DIVERT=y -# CONFIG_ECONET is not set -CONFIG_WAN_ROUTER=m -# CONFIG_NET_FASTROUTE is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -CONFIG_NET_SCHED=y -CONFIG_NET_SCH_CBQ=m -CONFIG_NET_SCH_HTB=m -CONFIG_NET_SCH_HFSC=m -CONFIG_NET_SCH_CSZ=m -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_SCH_DELAY=m -CONFIG_NET_SCH_INGRESS=m -CONFIG_NET_QOS=y -CONFIG_NET_ESTIMATOR=y -CONFIG_NET_CLS=y -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_ROUTE=y -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_POLICE=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETPOLL=y -# CONFIG_NETPOLL_RX is not set -# CONFIG_NETPOLL_TRAP is not set -CONFIG_NET_POLL_CONTROLLER=y -# CONFIG_HAMRADIO is not set -CONFIG_IRDA=m - -# -# IrDA protocols -# -CONFIG_IRLAN=m -CONFIG_IRNET=m -CONFIG_IRCOMM=m -# CONFIG_IRDA_ULTRA is not set - -# -# IrDA options -# -CONFIG_IRDA_CACHE_LAST_LSAP=y -CONFIG_IRDA_FAST_RR=y -# CONFIG_IRDA_DEBUG is not set - -# -# Infrared-port device drivers -# - -# -# SIR device drivers -# -CONFIG_IRTTY_SIR=m - -# -# Dongle support -# -CONFIG_DONGLE=y -CONFIG_ESI_DONGLE=m -CONFIG_ACTISYS_DONGLE=m -CONFIG_TEKRAM_DONGLE=m -CONFIG_LITELINK_DONGLE=m -CONFIG_MA600_DONGLE=m -CONFIG_GIRBIL_DONGLE=m -CONFIG_MCP2120_DONGLE=m -CONFIG_OLD_BELKIN_DONGLE=m -CONFIG_ACT200L_DONGLE=m - -# -# Old SIR device drivers -# - -# -# Old Serial dongle support -# - -# -# FIR device drivers -# -CONFIG_USB_IRDA=m -CONFIG_SIGMATEL_FIR=m -CONFIG_NSC_FIR=m -# CONFIG_WINBOND_FIR is not set -# CONFIG_TOSHIBA_FIR is not set -# CONFIG_SMC_IRCC_FIR is not set -# CONFIG_ALI_FIR is not set -# CONFIG_VLSI_FIR is not set -# CONFIG_VIA_FIR is not set -CONFIG_BT=m -CONFIG_BT_L2CAP=m -CONFIG_BT_SCO=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_CMTP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIUSB=m -CONFIG_BT_HCIUSB_SCO=y -CONFIG_BT_HCIUART=m -CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_BCSP_TXCRC=y -CONFIG_BT_HCIBCM203X=m -CONFIG_BT_HCIBFUSB=m -CONFIG_BT_HCIDTL1=m -CONFIG_BT_HCIBT3C=m -CONFIG_BT_HCIBLUECARD=m -CONFIG_BT_HCIBTUART=m -CONFIG_BT_HCIVHCI=m -CONFIG_TUX=m - -# -# TUX options -# -CONFIG_TUX_EXTCGI=y -# CONFIG_TUX_EXTENDED_LOG is not set -# CONFIG_TUX_DEBUG is not set -CONFIG_NETDEVICES=y -CONFIG_DUMMY=m -CONFIG_BONDING=m -CONFIG_EQUALIZER=m -CONFIG_TUN=m -CONFIG_ETHERTAP=m -CONFIG_NET_SB1000=m - -# -# ARCnet devices -# -# CONFIG_ARCNET is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -CONFIG_MII=m -CONFIG_HAPPYMEAL=m -CONFIG_SUNGEM=m -CONFIG_NET_VENDOR_3COM=y -CONFIG_EL1=m -CONFIG_EL2=m -CONFIG_ELPLUS=m -CONFIG_EL16=m -CONFIG_EL3=m -CONFIG_3C515=m -CONFIG_VORTEX=m -CONFIG_TYPHOON=m -CONFIG_LANCE=m -CONFIG_NET_VENDOR_SMC=y -CONFIG_WD80x3=m -CONFIG_ULTRA=m -CONFIG_SMC9194=m -CONFIG_NET_VENDOR_RACAL=y -CONFIG_NI52=m -CONFIG_NI65=m - -# -# Tulip family network device support -# -CONFIG_NET_TULIP=y -CONFIG_DE2104X=m -CONFIG_TULIP=m -# CONFIG_TULIP_MWI is not set -CONFIG_TULIP_MMIO=y -# CONFIG_TULIP_NAPI is not set -CONFIG_DE4X5=m -CONFIG_WINBOND_840=m -CONFIG_DM9102=m -CONFIG_PCMCIA_XIRCOM=m -# CONFIG_AT1700 is not set -CONFIG_DEPCA=m -CONFIG_HP100=m -# CONFIG_NET_ISA is not set -CONFIG_NE2000=m -CONFIG_NET_PCI=y -CONFIG_PCNET32=m -CONFIG_AMD8111_ETH=m -CONFIG_AMD8111E_NAPI=y -CONFIG_ADAPTEC_STARFIRE=m -CONFIG_ADAPTEC_STARFIRE_NAPI=y -CONFIG_AC3200=m -CONFIG_APRICOT=m -CONFIG_B44=m -CONFIG_FORCEDETH=m -CONFIG_CS89x0=m -CONFIG_DGRS=m -CONFIG_EEPRO100=m -# CONFIG_EEPRO100_PIO is not set -CONFIG_E100=m -CONFIG_E100_NAPI=y -CONFIG_FEALNX=m -CONFIG_NATSEMI=m -CONFIG_NE2K_PCI=m -CONFIG_8139CP=m -CONFIG_8139TOO=m -CONFIG_8139TOO_PIO=y -# CONFIG_8139TOO_TUNE_TWISTER is not set -CONFIG_8139TOO_8129=y -# CONFIG_8139_OLD_RX_RESET is not set -CONFIG_SIS900=m -CONFIG_EPIC100=m -CONFIG_SUNDANCE=m -# CONFIG_SUNDANCE_MMIO is not set -CONFIG_TLAN=m -CONFIG_VIA_RHINE=m -CONFIG_VIA_RHINE_MMIO=y -CONFIG_NET_POCKET=y -CONFIG_ATP=m -CONFIG_DE600=m -CONFIG_DE620=m - -# -# Ethernet (1000 Mbit) -# -CONFIG_ACENIC=m -# CONFIG_ACENIC_OMIT_TIGON_I is not set -CONFIG_DL2K=m -CONFIG_E1000=m -CONFIG_E1000_NAPI=y -CONFIG_NS83820=m -CONFIG_HAMACHI=m -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 -CONFIG_S2IO_NAPI=y - -# -# Token Ring devices -# -# CONFIG_TR is not set - -# -# Wireless LAN (non-hamradio) -# -CONFIG_NET_RADIO=y - -# -# Obsolete Wireless cards support (pre-802.11) -# -# CONFIG_STRIP is not set -# CONFIG_ARLAN is not set -CONFIG_WAVELAN=m -CONFIG_PCMCIA_WAVELAN=m -CONFIG_PCMCIA_NETWAVE=m - -# -# Wireless 802.11 Frequency Hopping cards support -# -# CONFIG_PCMCIA_RAYCS is not set - -# -# Wireless 802.11b ISA/PCI cards support -# -CONFIG_AIRO=m -CONFIG_HERMES=m -CONFIG_PLX_HERMES=m -CONFIG_TMD_HERMES=m -CONFIG_PCI_HERMES=m -CONFIG_ATMEL=m -CONFIG_PCI_ATMEL=m - -# -# Wireless 802.11b Pcmcia/Cardbus cards support -# -CONFIG_PCMCIA_HERMES=m -CONFIG_AIRO_CS=m -CONFIG_PCMCIA_ATMEL=m -CONFIG_PCMCIA_WL3501=m - -# -# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support -# -CONFIG_PRISM54=m -CONFIG_NET_WIRELESS=y - -# -# PCMCIA network device support -# -CONFIG_NET_PCMCIA=y -CONFIG_PCMCIA_3C589=m -CONFIG_PCMCIA_3C574=m -CONFIG_PCMCIA_FMVJ18X=m -CONFIG_PCMCIA_PCNET=m -CONFIG_PCMCIA_NMCLAN=m -CONFIG_PCMCIA_SMC91C92=m -CONFIG_PCMCIA_XIRC2PS=m -CONFIG_PCMCIA_AXNET=m - -# -# Wan interfaces -# -# CONFIG_WAN is not set -CONFIG_FDDI=y -# CONFIG_DEFXX is not set -CONFIG_SKFP=m -# CONFIG_HIPPI is not set -CONFIG_PLIP=m -CONFIG_PPP=m -CONFIG_PPP_MULTILINK=y -CONFIG_PPP_FILTER=y -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_BSDCOMP is not set -CONFIG_PPPOE=m -# CONFIG_SLIP is not set -CONFIG_NET_FC=y -# CONFIG_SHAPER is not set -CONFIG_NETCONSOLE=m - -# -# ISDN subsystem -# -CONFIG_ISDN=m - -# -# Old ISDN4Linux -# -CONFIG_ISDN_I4L=m -CONFIG_ISDN_PPP=y -CONFIG_ISDN_PPP_VJ=y -CONFIG_ISDN_MPP=y -CONFIG_IPPP_FILTER=y -# CONFIG_ISDN_PPP_BSDCOMP is not set -CONFIG_ISDN_AUDIO=y -CONFIG_ISDN_TTY_FAX=y - -# -# ISDN feature submodules -# - -# -# ISDN4Linux hardware drivers -# - -# -# Passive cards -# -CONFIG_ISDN_DRV_HISAX=m - -# -# D-channel protocol features -# -CONFIG_HISAX_EURO=y -CONFIG_DE_AOC=y -CONFIG_HISAX_NO_SENDCOMPLETE=y -CONFIG_HISAX_NO_LLC=y -CONFIG_HISAX_NO_KEYPAD=y -CONFIG_HISAX_1TR6=y -CONFIG_HISAX_NI1=y -CONFIG_HISAX_MAX_CARDS=8 - -# -# HiSax supported cards -# -CONFIG_HISAX_16_0=y -CONFIG_HISAX_16_3=y -CONFIG_HISAX_TELESPCI=y -CONFIG_HISAX_S0BOX=y -CONFIG_HISAX_AVM_A1=y -CONFIG_HISAX_FRITZPCI=y -CONFIG_HISAX_AVM_A1_PCMCIA=y -CONFIG_HISAX_ELSA=y -CONFIG_HISAX_IX1MICROR2=y -CONFIG_HISAX_DIEHLDIVA=y -CONFIG_HISAX_ASUSCOM=y -CONFIG_HISAX_TELEINT=y -CONFIG_HISAX_HFCS=y -CONFIG_HISAX_SEDLBAUER=y -CONFIG_HISAX_SPORTSTER=y -CONFIG_HISAX_MIC=y -CONFIG_HISAX_NETJET=y -CONFIG_HISAX_NETJET_U=y -CONFIG_HISAX_NICCY=y -CONFIG_HISAX_ISURF=y -CONFIG_HISAX_HSTSAPHIR=y -CONFIG_HISAX_BKM_A4T=y -CONFIG_HISAX_SCT_QUADRO=y -CONFIG_HISAX_GAZEL=y -CONFIG_HISAX_HFC_PCI=y -CONFIG_HISAX_W6692=y -CONFIG_HISAX_HFC_SX=y -CONFIG_HISAX_ENTERNOW_PCI=y -# CONFIG_HISAX_DEBUG is not set - -# -# HiSax PCMCIA card service modules -# -CONFIG_HISAX_SEDLBAUER_CS=m -CONFIG_HISAX_ELSA_CS=m -CONFIG_HISAX_AVM_A1_CS=m -CONFIG_HISAX_TELES_CS=m - -# -# HiSax sub driver modules -# -CONFIG_HISAX_ST5481=m -CONFIG_HISAX_HFCUSB=m -CONFIG_HISAX_FRITZ_PCIPNP=m -CONFIG_HISAX_HDLC=y - -# -# Active cards -# -CONFIG_ISDN_DRV_ICN=m -CONFIG_ISDN_DRV_PCBIT=m -CONFIG_ISDN_DRV_SC=m -CONFIG_ISDN_DRV_ACT2000=m -CONFIG_ISDN_DRV_TPAM=m - -# -# CAPI subsystem -# -CONFIG_ISDN_CAPI=m -CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y -CONFIG_ISDN_CAPI_MIDDLEWARE=y -CONFIG_ISDN_CAPI_CAPI20=m -CONFIG_ISDN_CAPI_CAPIFS_BOOL=y -CONFIG_ISDN_CAPI_CAPIFS=m -CONFIG_ISDN_CAPI_CAPIDRV=m - -# -# CAPI hardware drivers -# - -# -# Active AVM cards -# -CONFIG_CAPI_AVM=y - -# -# Active Eicon DIVA Server cards -# -CONFIG_CAPI_EICON=y -CONFIG_ISDN_DIVAS=m -CONFIG_ISDN_DIVAS_BRIPCI=y -CONFIG_ISDN_DIVAS_PRIPCI=y -CONFIG_ISDN_DIVAS_DIVACAPI=m -CONFIG_ISDN_DIVAS_USERIDI=m -CONFIG_ISDN_DIVAS_MAINT=m - -# -# Telephony Support -# -# CONFIG_PHONE is not set - -# -# Input device support -# -CONFIG_INPUT=y - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_JOYDEV=m -# CONFIG_INPUT_TSDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input I/O drivers -# -CONFIG_GAMEPORT=m -CONFIG_SOUND_GAMEPORT=m -CONFIG_GAMEPORT_NS558=m -CONFIG_GAMEPORT_L4=m -CONFIG_GAMEPORT_EMU10K1=m -CONFIG_GAMEPORT_VORTEX=m -CONFIG_GAMEPORT_FM801=m -CONFIG_GAMEPORT_CS461x=m -CONFIG_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_NEWTON is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_SERIAL=m -CONFIG_MOUSE_INPORT=m -CONFIG_MOUSE_ATIXL=y -CONFIG_MOUSE_LOGIBM=m -CONFIG_MOUSE_PC110PAD=m -CONFIG_MOUSE_VSXXXAA=m -CONFIG_INPUT_JOYSTICK=y -CONFIG_JOYSTICK_ANALOG=m -CONFIG_JOYSTICK_A3D=m -CONFIG_JOYSTICK_ADI=m -CONFIG_JOYSTICK_COBRA=m -CONFIG_JOYSTICK_GF2K=m -CONFIG_JOYSTICK_GRIP=m -CONFIG_JOYSTICK_GRIP_MP=m -CONFIG_JOYSTICK_GUILLEMOT=m -CONFIG_JOYSTICK_INTERACT=m -CONFIG_JOYSTICK_SIDEWINDER=m -CONFIG_JOYSTICK_TMDC=m -CONFIG_JOYSTICK_IFORCE=m -CONFIG_JOYSTICK_IFORCE_USB=y -CONFIG_JOYSTICK_IFORCE_232=y -CONFIG_JOYSTICK_WARRIOR=m -CONFIG_JOYSTICK_MAGELLAN=m -CONFIG_JOYSTICK_SPACEORB=m -CONFIG_JOYSTICK_SPACEBALL=m -CONFIG_JOYSTICK_STINGER=m -CONFIG_JOYSTICK_TWIDDLER=m -CONFIG_JOYSTICK_DB9=m -CONFIG_JOYSTICK_GAMECON=m -CONFIG_JOYSTICK_TURBOGRAFX=m -# CONFIG_INPUT_JOYDUMP is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_GUNZE=m -CONFIG_INPUT_MISC=y -CONFIG_INPUT_PCSPKR=m -# CONFIG_INPUT_UINPUT is not set - -# -# Character devices -# -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_HW_CONSOLE=y -CONFIG_SERIAL_NONSTANDARD=y -CONFIG_ROCKETPORT=m -# CONFIG_CYCLADES is not set -CONFIG_SYNCLINK=m -CONFIG_SYNCLINKMP=m -CONFIG_N_HDLC=m -CONFIG_STALDRV=y - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_CS=m -# CONFIG_SERIAL_8250_ACPI is not set -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_EXTENDED=y -# CONFIG_SERIAL_8250_MANY_PORTS is not set -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_8250_DETECT_IRQ=y -CONFIG_SERIAL_8250_MULTIPORT=y -CONFIG_SERIAL_8250_RSA=y - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set -CONFIG_CRASH=m -CONFIG_PRINTER=m -CONFIG_LP_CONSOLE=y -CONFIG_PPDEV=m -CONFIG_TIPAR=m -# CONFIG_QIC02_TAPE is not set - -# -# IPMI -# -CONFIG_IPMI_HANDLER=m -# CONFIG_IPMI_PANIC_EVENT is not set -CONFIG_IPMI_DEVICE_INTERFACE=m -CONFIG_IPMI_SI=m -CONFIG_IPMI_WATCHDOG=m - -# -# Watchdog Cards -# -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -CONFIG_SOFT_WATCHDOG=m -CONFIG_ACQUIRE_WDT=m -CONFIG_ADVANTECH_WDT=m -CONFIG_ALIM1535_WDT=m -CONFIG_ALIM7101_WDT=m -CONFIG_SC520_WDT=m -CONFIG_EUROTECH_WDT=m -CONFIG_IB700_WDT=m -CONFIG_WAFER_WDT=m -CONFIG_I8XX_TCO=m -CONFIG_SC1200_WDT=m -# CONFIG_SCx200_WDT is not set -# CONFIG_60XX_WDT is not set -CONFIG_CPU5_WDT=m -CONFIG_W83627HF_WDT=m -CONFIG_W83877F_WDT=m -CONFIG_MACHZ_WDT=m - -# -# ISA-based Watchdog Cards -# -CONFIG_PCWATCHDOG=m -# CONFIG_MIXCOMWD is not set -CONFIG_WDT=m -# CONFIG_WDT_501 is not set - -# -# PCI-based Watchdog Cards -# -CONFIG_PCIPCWATCHDOG=m -CONFIG_WDTPCI=m -CONFIG_WDT_501_PCI=y - -# -# USB-based Watchdog Cards -# -CONFIG_USBPCWATCHDOG=m -CONFIG_HW_RANDOM=m -CONFIG_NVRAM=m -CONFIG_RTC=y -CONFIG_DTLK=m -CONFIG_R3964=m -# CONFIG_APPLICOM is not set -CONFIG_SONYPI=m - -# -# Ftape, the floppy tape device driver -# -CONFIG_AGP=y -CONFIG_AGP_ALI=y -CONFIG_AGP_ATI=y -CONFIG_AGP_AMD=y -CONFIG_AGP_AMD64=y -CONFIG_AGP_INTEL=y -CONFIG_AGP_INTEL_MCH=y -CONFIG_AGP_NVIDIA=y -CONFIG_AGP_SIS=y -CONFIG_AGP_SWORKS=y -CONFIG_AGP_VIA=y -CONFIG_AGP_EFFICEON=y -CONFIG_DRM=y -CONFIG_DRM_TDFX=m -CONFIG_DRM_GAMMA=m -CONFIG_DRM_R128=m -CONFIG_DRM_RADEON=m -CONFIG_DRM_I810=m -CONFIG_DRM_I830=m -CONFIG_DRM_MGA=m -CONFIG_DRM_SIS=m - -# -# PCMCIA character devices -# -CONFIG_SYNCLINK_CS=m -CONFIG_MWAVE=m -# CONFIG_RAW_DRIVER is not set -CONFIG_HANGCHECK_TIMER=m - -# -# I2C support -# -CONFIG_I2C=m -CONFIG_I2C_CHARDEV=m - -# -# I2C Algorithms -# -CONFIG_I2C_ALGOBIT=m -CONFIG_I2C_ALGOPCF=m - -# -# I2C Hardware Bus support -# -CONFIG_I2C_ALI1535=m -CONFIG_I2C_ALI1563=m -CONFIG_I2C_ALI15X3=m -CONFIG_I2C_AMD756=m -CONFIG_I2C_AMD8111=m -CONFIG_I2C_I801=m -CONFIG_I2C_I810=m -CONFIG_I2C_ISA=m -CONFIG_I2C_NFORCE2=m -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -CONFIG_I2C_PIIX4=m -CONFIG_I2C_PROSAVAGE=m -CONFIG_I2C_SAVAGE4=m -# CONFIG_SCx200_ACB is not set -CONFIG_I2C_SIS5595=m -CONFIG_I2C_SIS630=m -CONFIG_I2C_SIS96X=m -CONFIG_I2C_VIA=m -CONFIG_I2C_VIAPRO=m -CONFIG_I2C_VOODOO3=m - -# -# Hardware Sensors Chip support -# -CONFIG_I2C_SENSOR=m -CONFIG_SENSORS_ADM1021=m -CONFIG_SENSORS_ASB100=m -CONFIG_SENSORS_DS1621=m -CONFIG_SENSORS_FSCHER=m -CONFIG_SENSORS_GL518SM=m -CONFIG_SENSORS_IT87=m -CONFIG_SENSORS_LM75=m -CONFIG_SENSORS_LM78=m -CONFIG_SENSORS_LM80=m -CONFIG_SENSORS_LM83=m -CONFIG_SENSORS_LM85=m -CONFIG_SENSORS_LM90=m -CONFIG_SENSORS_MAX1619=m -CONFIG_SENSORS_VIA686A=m -CONFIG_SENSORS_W83781D=m -CONFIG_SENSORS_W83L785TS=m -CONFIG_SENSORS_W83627HF=m - -# -# Other I2C Chip support -# -CONFIG_SENSORS_EEPROM=m -CONFIG_SENSORS_PCF8574=m -CONFIG_SENSORS_PCF8591=m -CONFIG_SENSORS_RTC8564=m -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Misc devices -# -CONFIG_IBM_ASM=m - -# -# Multimedia devices -# -CONFIG_VIDEO_DEV=m - -# -# Video For Linux -# - -# -# Video Adapters -# -CONFIG_VIDEO_BT848=m -CONFIG_VIDEO_PMS=m -CONFIG_VIDEO_BWQCAM=m -CONFIG_VIDEO_CQCAM=m -CONFIG_VIDEO_W9966=m -CONFIG_VIDEO_CPIA=m -CONFIG_VIDEO_CPIA_PP=m -CONFIG_VIDEO_CPIA_USB=m -CONFIG_VIDEO_SAA5246A=m -CONFIG_VIDEO_SAA5249=m -CONFIG_TUNER_3036=m -CONFIG_VIDEO_STRADIS=m -CONFIG_VIDEO_ZORAN=m -CONFIG_VIDEO_ZORAN_BUZ=m -CONFIG_VIDEO_ZORAN_DC10=m -CONFIG_VIDEO_ZORAN_DC30=m -CONFIG_VIDEO_ZORAN_LML33=m -CONFIG_VIDEO_ZORAN_LML33R10=m -CONFIG_VIDEO_SAA7134=m -CONFIG_VIDEO_MXB=m -CONFIG_VIDEO_DPC=m -CONFIG_VIDEO_HEXIUM_ORION=m -CONFIG_VIDEO_HEXIUM_GEMINI=m -CONFIG_VIDEO_CX88=m - -# -# Radio Adapters -# -CONFIG_RADIO_CADET=m -CONFIG_RADIO_RTRACK=m -CONFIG_RADIO_RTRACK2=m -CONFIG_RADIO_AZTECH=m -CONFIG_RADIO_GEMTEK=m -CONFIG_RADIO_GEMTEK_PCI=m -CONFIG_RADIO_MAXIRADIO=m -CONFIG_RADIO_MAESTRO=m -CONFIG_RADIO_SF16FMI=m -CONFIG_RADIO_SF16FMR2=m -CONFIG_RADIO_TERRATEC=m -CONFIG_RADIO_TRUST=m -CONFIG_RADIO_TYPHOON=m -CONFIG_RADIO_TYPHOON_PROC_FS=y -CONFIG_RADIO_ZOLTRIX=m - -# -# Digital Video Broadcasting Devices -# -# CONFIG_DVB is not set -CONFIG_VIDEO_SAA7146=m -CONFIG_VIDEO_SAA7146_VV=m -CONFIG_VIDEO_VIDEOBUF=m -CONFIG_VIDEO_TUNER=m -CONFIG_VIDEO_BUF=m -CONFIG_VIDEO_BTCX=m -CONFIG_VIDEO_IR=m - -# -# Graphics support -# -CONFIG_FB=y -# CONFIG_FB_PM2 is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -CONFIG_FB_VGA16=m -CONFIG_FB_VESA=y -CONFIG_VIDEO_SELECT=y -CONFIG_FB_HGA=m -CONFIG_FB_HGA_ACCEL=y -CONFIG_FB_RIVA=m -CONFIG_FB_I810=m -CONFIG_FB_I810_GTF=y -CONFIG_FB_MATROX=m -CONFIG_FB_MATROX_MILLENIUM=y -CONFIG_FB_MATROX_MYSTIQUE=y -CONFIG_FB_MATROX_G450=y -CONFIG_FB_MATROX_G100=y -CONFIG_FB_MATROX_I2C=m -CONFIG_FB_MATROX_MAVEN=m -CONFIG_FB_MATROX_MULTIHEAD=y -# CONFIG_FB_RADEON_OLD is not set -CONFIG_FB_RADEON=m -CONFIG_FB_RADEON_I2C=y -# CONFIG_FB_RADEON_DEBUG is not set -CONFIG_FB_ATY128=m -CONFIG_FB_ATY=m -CONFIG_FB_ATY_CT=y -CONFIG_FB_ATY_GX=y -# CONFIG_FB_ATY_XL_INIT is not set -# CONFIG_FB_SIS is not set -CONFIG_FB_NEOMAGIC=m -CONFIG_FB_KYRO=m -CONFIG_FB_3DFX=m -CONFIG_FB_3DFX_ACCEL=y -CONFIG_FB_VOODOO1=m -CONFIG_FB_TRIDENT=m -CONFIG_FB_TRIDENT_ACCEL=y -# CONFIG_FB_VIRTUAL is not set - -# -# Console display driver support -# -CONFIG_VGA_CONSOLE=y -CONFIG_MDA_CONSOLE=m -CONFIG_DUMMY_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_PCI_CONSOLE=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y - -# -# Logo configuration -# -CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_MONO is not set -# CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_LOGO_LINUX_CLUT224=y - -# -# Sound -# -CONFIG_SOUND=m - -# -# Advanced Linux Sound Architecture -# -CONFIG_SND=m -CONFIG_SND_TIMER=m -CONFIG_SND_PCM=m -CONFIG_SND_HWDEP=m -CONFIG_SND_RAWMIDI=m -CONFIG_SND_SEQUENCER=m -CONFIG_SND_SEQ_DUMMY=m -CONFIG_SND_OSSEMUL=y -CONFIG_SND_MIXER_OSS=m -CONFIG_SND_PCM_OSS=m -CONFIG_SND_SEQUENCER_OSS=y -CONFIG_SND_RTCTIMER=m -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set - -# -# Generic devices -# -CONFIG_SND_MPU401_UART=m -CONFIG_SND_OPL3_LIB=m -CONFIG_SND_OPL4_LIB=m -CONFIG_SND_VX_LIB=m -CONFIG_SND_DUMMY=m -CONFIG_SND_VIRMIDI=m -CONFIG_SND_MTPAV=m -# CONFIG_SND_SERIAL_U16550 is not set -CONFIG_SND_MPU401=m - -# -# ISA devices -# -CONFIG_SND_AD1816A=m -CONFIG_SND_AD1848=m -CONFIG_SND_CS4231=m -CONFIG_SND_CS4232=m -CONFIG_SND_CS4236=m -CONFIG_SND_ES968=m -CONFIG_SND_ES1688=m -CONFIG_SND_ES18XX=m -CONFIG_SND_GUSCLASSIC=m -CONFIG_SND_GUSEXTREME=m -CONFIG_SND_GUSMAX=m -CONFIG_SND_INTERWAVE=m -CONFIG_SND_INTERWAVE_STB=m -CONFIG_SND_OPTI92X_AD1848=m -CONFIG_SND_OPTI92X_CS4231=m -CONFIG_SND_OPTI93X=m -CONFIG_SND_SB8=m -CONFIG_SND_SB16=m -CONFIG_SND_SBAWE=m -CONFIG_SND_SB16_CSP=y -# CONFIG_SND_WAVEFRONT is not set -CONFIG_SND_ALS100=m -CONFIG_SND_AZT2320=m -CONFIG_SND_CMI8330=m -CONFIG_SND_DT019X=m -CONFIG_SND_OPL3SA2=m -CONFIG_SND_SGALAXY=m -CONFIG_SND_SSCAPE=m - -# -# PCI devices -# -CONFIG_SND_AC97_CODEC=m -CONFIG_SND_ALI5451=m -CONFIG_SND_ATIIXP=m -CONFIG_SND_AU8810=m -CONFIG_SND_AU8820=m -CONFIG_SND_AU8830=m -CONFIG_SND_AZT3328=m -CONFIG_SND_BT87X=m -CONFIG_SND_CS46XX=m -CONFIG_SND_CS46XX_NEW_DSP=y -CONFIG_SND_CS4281=m -CONFIG_SND_EMU10K1=m -CONFIG_SND_KORG1212=m -CONFIG_SND_MIXART=m -CONFIG_SND_NM256=m -CONFIG_SND_RME32=m -CONFIG_SND_RME96=m -CONFIG_SND_RME9652=m -CONFIG_SND_HDSP=m -CONFIG_SND_TRIDENT=m -CONFIG_SND_YMFPCI=m -CONFIG_SND_ALS4000=m -CONFIG_SND_CMIPCI=m -CONFIG_SND_ENS1370=m -CONFIG_SND_ENS1371=m -CONFIG_SND_ES1938=m -CONFIG_SND_ES1968=m -CONFIG_SND_MAESTRO3=m -CONFIG_SND_FM801=m -CONFIG_SND_FM801_TEA575X=m -CONFIG_SND_ICE1712=m -CONFIG_SND_ICE1724=m -CONFIG_SND_INTEL8X0=m -CONFIG_SND_INTEL8X0M=m -CONFIG_SND_SONICVIBES=m -CONFIG_SND_VIA82XX=m -CONFIG_SND_VX222=m - -# -# ALSA USB devices -# -CONFIG_SND_USB_AUDIO=m - -# -# PCMCIA devices -# -# CONFIG_SND_VXPOCKET is not set -# CONFIG_SND_VXP440 is not set -CONFIG_SND_PDAUDIOCF=m - -# -# Open Sound System -# -# CONFIG_SOUND_PRIME is not set - -# -# USB support -# -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_BANDWIDTH is not set -# CONFIG_USB_DYNAMIC_MINORS is not set - -# -# USB Host Controller Drivers -# -CONFIG_USB_EHCI_HCD=m -CONFIG_USB_EHCI_SPLIT_ISO=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_OHCI_HCD=m -CONFIG_USB_UHCI_HCD=m - -# -# USB Device Class drivers -# -CONFIG_USB_AUDIO=m - -# -# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem -# -CONFIG_USB_MIDI=m -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m -CONFIG_USB_STORAGE=m -# CONFIG_USB_STORAGE_DEBUG is not set -CONFIG_USB_STORAGE_DATAFAB=y -CONFIG_USB_STORAGE_FREECOM=y -CONFIG_USB_STORAGE_ISD200=y -CONFIG_USB_STORAGE_DPCM=y -CONFIG_USB_STORAGE_HP8200e=y -CONFIG_USB_STORAGE_SDDR09=y -CONFIG_USB_STORAGE_SDDR55=y -CONFIG_USB_STORAGE_JUMPSHOT=y - -# -# USB Human Interface Devices (HID) -# -CONFIG_USB_HID=y -CONFIG_USB_HIDINPUT=y -CONFIG_HID_FF=y -CONFIG_HID_PID=y -CONFIG_LOGITECH_FF=y -CONFIG_THRUSTMASTER_FF=y -CONFIG_USB_HIDDEV=y -CONFIG_USB_AIPTEK=m -CONFIG_USB_WACOM=m -CONFIG_USB_KBTAB=m -CONFIG_USB_POWERMATE=m -CONFIG_USB_MTOUCH=m -CONFIG_USB_EGALAX=m -CONFIG_USB_XPAD=m -CONFIG_USB_ATI_REMOTE=m - -# -# USB Imaging devices -# -CONFIG_USB_MDC800=m -CONFIG_USB_MICROTEK=m -CONFIG_USB_HPUSBSCSI=m - -# -# USB Multimedia devices -# -CONFIG_USB_DABUSB=m -CONFIG_USB_VICAM=m -CONFIG_USB_DSBR=m -CONFIG_USB_IBMCAM=m -CONFIG_USB_KONICAWC=m -CONFIG_USB_OV511=m -CONFIG_USB_SE401=m -CONFIG_USB_STV680=m -CONFIG_USB_W9968CF=m - -# -# USB Network adaptors -# -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_USBNET=m - -# -# USB Host-to-Host Cables -# -CONFIG_USB_ALI_M5632=y -CONFIG_USB_AN2720=y -CONFIG_USB_BELKIN=y -CONFIG_USB_GENESYS=y -CONFIG_USB_NET1080=y -CONFIG_USB_PL2301=y - -# -# Intelligent USB Devices/Gadgets -# -CONFIG_USB_ARMLINUX=y -CONFIG_USB_EPSON2888=y -CONFIG_USB_ZAURUS=y -CONFIG_USB_CDCETHER=y - -# -# USB Network Adapters -# -CONFIG_USB_AX8817X=y - -# -# USB port drivers -# -CONFIG_USB_USS720=m - -# -# USB Serial Converter support -# -CONFIG_USB_SERIAL=m -CONFIG_USB_SERIAL_GENERIC=y -CONFIG_USB_SERIAL_BELKIN=m -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_PL2303=m -CONFIG_USB_SERIAL_SAFE=m -CONFIG_USB_SERIAL_SAFE_PADDED=y -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_EZUSB=y - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -# CONFIG_USB_EMI26 is not set -CONFIG_USB_TIGL=m -CONFIG_USB_AUERSWALD=m -CONFIG_USB_RIO500=m -CONFIG_USB_LEGOTOWER=m -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -# CONFIG_USB_CYTHERM is not set -CONFIG_USB_PHIDGETSERVO=m -CONFIG_USB_TEST=m - -# -# USB Gadget Support -# -# CONFIG_USB_GADGET is not set - -# -# File systems -# -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS=m -CONFIG_EXT3_FS_XATTR=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_JBD=m -# CONFIG_JBD_DEBUG is not set -CONFIG_FS_MBCACHE=y -CONFIG_REISERFS_FS=m -# CONFIG_REISERFS_CHECK is not set -CONFIG_REISERFS_PROC_INFO=y -CONFIG_REISERFS_FS_XATTR=y -CONFIG_REISERFS_FS_POSIX_ACL=y -CONFIG_REISERFS_FS_SECURITY=y -CONFIG_JFS_FS=m -CONFIG_JFS_POSIX_ACL=y -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_STATISTICS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_XFS_FS=m -# CONFIG_XFS_RT is not set -CONFIG_XFS_QUOTA=y -CONFIG_XFS_SECURITY=y -CONFIG_XFS_POSIX_ACL=y -CONFIG_MINIX_FS=m -CONFIG_ROMFS_FS=m -CONFIG_QUOTA=y -# CONFIG_QFMT_V1 is not set -CONFIG_QFMT_V2=y -CONFIG_QUOTACTL=y -CONFIG_AUTOFS_FS=m -CONFIG_AUTOFS4_FS=m - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_ZISOFS_FS=y -CONFIG_UDF_FS=m - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -# CONFIG_NTFS_FS is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_KCORE=y -CONFIG_SYSFS=y -# CONFIG_DEVFS_FS is not set -CONFIG_DEVPTS_FS_XATTR=y -CONFIG_DEVPTS_FS_SECURITY=y -CONFIG_TMPFS=y -CONFIG_HUGETLBFS=y -CONFIG_HUGETLB_PAGE=y -CONFIG_RAMFS=y - -# -# Miscellaneous filesystems -# -# CONFIG_ADFS_FS is not set -CONFIG_AFFS_FS=m -CONFIG_HFS_FS=m -CONFIG_HFSPLUS_FS=m -CONFIG_BEFS_FS=m -# CONFIG_BEFS_DEBUG is not set -CONFIG_BFS_FS=m -CONFIG_EFS_FS=m -# CONFIG_JFFS_FS is not set -CONFIG_JFFS2_FS=m -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_NAND=y -CONFIG_CRAMFS=m -CONFIG_VXFS_FS=m -# CONFIG_HPFS_FS is not set -CONFIG_QNX4FS_FS=m -# CONFIG_QNX4FS_RW is not set -CONFIG_SYSV_FS=m -CONFIG_UFS_FS=m -# CONFIG_UFS_FS_WRITE is not set - -# -# Network File Systems -# -CONFIG_NFS_FS=m -CONFIG_NFS_V3=y -CONFIG_NFS_V4=y -CONFIG_NFS_DIRECTIO=y -CONFIG_NFSD=m -CONFIG_NFSD_V3=y -CONFIG_NFSD_V4=y -CONFIG_NFSD_TCP=y -CONFIG_LOCKD=m -CONFIG_LOCKD_V4=y -CONFIG_EXPORTFS=m -CONFIG_SUNRPC=m -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m -CONFIG_SMB_FS=m -# CONFIG_SMB_NLS_DEFAULT is not set -CONFIG_CIFS=m -# CONFIG_CIFS_STATS is not set -CONFIG_NCP_FS=m -CONFIG_NCPFS_PACKET_SIGNING=y -CONFIG_NCPFS_IOCTL_LOCKING=y -CONFIG_NCPFS_STRONG=y -CONFIG_NCPFS_NFS_NS=y -CONFIG_NCPFS_OS2_NS=y -CONFIG_NCPFS_SMALLDOS=y -CONFIG_NCPFS_NLS=y -CONFIG_NCPFS_EXTRAS=y -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -CONFIG_OSF_PARTITION=y -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -CONFIG_BSD_DISKLABEL=y -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 -CONFIG_EFI_PARTITION=y - -# -# Native Language Support -# -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=m -CONFIG_NLS_CODEPAGE_737=m -CONFIG_NLS_CODEPAGE_775=m -CONFIG_NLS_CODEPAGE_850=m -CONFIG_NLS_CODEPAGE_852=m -CONFIG_NLS_CODEPAGE_855=m -CONFIG_NLS_CODEPAGE_857=m -CONFIG_NLS_CODEPAGE_860=m -CONFIG_NLS_CODEPAGE_861=m -CONFIG_NLS_CODEPAGE_862=m -CONFIG_NLS_CODEPAGE_863=m -CONFIG_NLS_CODEPAGE_864=m -CONFIG_NLS_CODEPAGE_865=m -CONFIG_NLS_CODEPAGE_866=m -CONFIG_NLS_CODEPAGE_869=m -CONFIG_NLS_CODEPAGE_936=m -CONFIG_NLS_CODEPAGE_950=m -CONFIG_NLS_CODEPAGE_932=m -CONFIG_NLS_CODEPAGE_949=m -CONFIG_NLS_CODEPAGE_874=m -CONFIG_NLS_ISO8859_8=m -CONFIG_NLS_CODEPAGE_1250=m -CONFIG_NLS_CODEPAGE_1251=m -CONFIG_NLS_ISO8859_1=m -CONFIG_NLS_ISO8859_2=m -CONFIG_NLS_ISO8859_3=m -CONFIG_NLS_ISO8859_4=m -CONFIG_NLS_ISO8859_5=m -CONFIG_NLS_ISO8859_6=m -CONFIG_NLS_ISO8859_7=m -CONFIG_NLS_ISO8859_9=m -CONFIG_NLS_ISO8859_13=m -CONFIG_NLS_ISO8859_14=m -CONFIG_NLS_ISO8859_15=m -CONFIG_NLS_KOI8_R=m -CONFIG_NLS_KOI8_U=m -CONFIG_NLS_UTF8=m - -# -# Profiling support -# -CONFIG_PROFILING=y -CONFIG_OPROFILE=m - -# -# Kernel hacking -# -CONFIG_DEBUG_KERNEL=y -CONFIG_EARLY_PRINTK=y -CONFIG_DEBUG_STACKOVERFLOW=y -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_MAGIC_SYSRQ=y -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_HIGHMEM is not set -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 - -# -# Linux VServer -# -CONFIG_VSERVER_LEGACY=y -CONFIG_PROC_SECURE=y -# CONFIG_VSERVER_HARDCPU is not set -# CONFIG_INOXID_NONE is not set -# CONFIG_INOXID_GID16 is not set -CONFIG_INOXID_GID24=y -# CONFIG_INOXID_GID32 is not set -# CONFIG_INOXID_MAGIC is not set - -# -# Security options -# -CONFIG_SECURITY=y -CONFIG_SECURITY_NETWORK=y -CONFIG_SECURITY_CAPABILITIES=y -# CONFIG_SECURITY_ROOTPLUG is not set -CONFIG_SECURITY_SELINUX=y -CONFIG_SECURITY_SELINUX_BOOTPARAM=y -CONFIG_SECURITY_SELINUX_DISABLE=y -CONFIG_SECURITY_SELINUX_DEVELOP=y -# CONFIG_SECURITY_SELINUX_MLS is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_TWOFISH=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_AES=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_ARC4=m -CONFIG_CRYPTO_DEFLATE=m -CONFIG_CRYPTO_MICHAEL_MIC=m -CONFIG_CRYPTO_CRC32C=m -# CONFIG_CRYPTO_TEST is not set - -# -# Library routines -# -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/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/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/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/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 0d45b81e1..24d72c79a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -479,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 */ @@ -2728,6 +2870,7 @@ int __init cciss_init(void) static int __init init_cciss_module(void) { + register_cciss_ioctl32(); return ( cciss_init()); } @@ -2735,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/floppy98.c b/drivers/block/floppy98.c deleted file mode 100644 index 95031f1e8..000000000 --- a/drivers/block/floppy98.c +++ /dev/null @@ -1,4682 +0,0 @@ -/* - * linux/drivers/block/floppy.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright (C) 1993, 1994 Alain Knaff - * Copyright (C) 1998 Alan Cox - */ -/* - * 02.12.91 - Changed to static variables to indicate need for reset - * and recalibrate. This makes some things easier (output_byte reset - * checking etc), and means less interrupt jumping in case of errors, - * so the code is hopefully easier to understand. - */ - -/* - * This file is certainly a mess. I've tried my best to get it working, - * but I don't like programming floppies, and I have only one anyway. - * Urgel. I should check for more errors, and do more graceful error - * recovery. Seems there are problems with several drives. I've tried to - * correct them. No promises. - */ - -/* - * As with hd.c, all routines within this file can (and will) be called - * by interrupts, so extreme caution is needed. A hardware interrupt - * handler may not sleep, or a kernel panic will happen. Thus I cannot - * call "floppy-on" directly, but have to set a special timer interrupt - * etc. - */ - -/* - * 28.02.92 - made track-buffering routines, based on the routines written - * by entropy@wintermute.wpi.edu (Lawrence Foard). Linus. - */ - -/* - * Automatic floppy-detection and formatting written by Werner Almesberger - * (almesber@nessie.cs.id.ethz.ch), who also corrected some problems with - * the floppy-change signal detection. - */ - -/* - * 1992/7/22 -- Hennus Bergman: Added better error reporting, fixed - * FDC data overrun bug, added some preliminary stuff for vertical - * recording support. - * - * 1992/9/17: Added DMA allocation & DMA functions. -- hhb. - * - * TODO: Errors are still not counted properly. - */ - -/* 1992/9/20 - * Modifications for ``Sector Shifting'' by Rob Hooft (hooft@chem.ruu.nl) - * modeled after the freeware MS-DOS program fdformat/88 V1.8 by - * Christoph H. Hochst\"atter. - * I have fixed the shift values to the ones I always use. Maybe a new - * ioctl() should be created to be able to modify them. - * There is a bug in the driver that makes it impossible to format a - * floppy as the first thing after bootup. - */ - -/* - * 1993/4/29 -- Linus -- cleaned up the timer handling in the kernel, and - * this helped the floppy driver as well. Much cleaner, and still seems to - * work. - */ - -/* 1994/6/24 --bbroad-- added the floppy table entries and made - * minor modifications to allow 2.88 floppies to be run. - */ - -/* 1994/7/13 -- Paul Vojta -- modified the probing code to allow three or more - * disk types. - */ - -/* - * 1994/8/8 -- Alain Knaff -- Switched to fdpatch driver: Support for bigger - * format bug fixes, but unfortunately some new bugs too... - */ - -/* 1994/9/17 -- Koen Holtman -- added logging of physical floppy write - * errors to allow safe writing by specialized programs. - */ - -/* 1995/4/24 -- Dan Fandrich -- added support for Commodore 1581 3.5" disks - * by defining bit 1 of the "stretch" parameter to mean put sectors on the - * opposite side of the disk, leaving the sector IDs alone (i.e. Commodore's - * drives are "upside-down"). - */ - -/* - * 1995/8/26 -- Andreas Busse -- added Mips support. - */ - -/* - * 1995/10/18 -- Ralf Baechle -- Portability cleanup; move machine dependent - * features to asm/floppy.h. - */ - -/* - * 1998/05/07 -- Russell King -- More portability cleanups; moved definition of - * interrupt and dma channel to asm/floppy.h. Cleaned up some formatting & - * use of '0' for NULL. - */ - -/* - * 1998/06/07 -- Alan Cox -- Merged the 2.0.34 fixes for resource allocation - * failures. - */ - -/* - * 1998/09/20 -- David Weinehall -- Added slow-down code for buggy PS/2-drives. - */ - -/* - * 1999/01/19 -- N.Fujita & Linux/98 Project -- Added code for NEC PC-9800 - * series. - */ - -/* - * 1999/08/13 -- Paul Slootman -- floppy stopped working on Alpha after 24 - * days, 6 hours, 32 minutes and 32 seconds (i.e. MAXINT jiffies; ints were - * being used to store jiffies, which are unsigned longs). - */ - -/* - * 2000/08/28 -- Arnaldo Carvalho de Melo - * - get rid of check_region - * - s/suser/capable/ - */ - -/* - * 2001/08/26 -- Paul Gortmaker - fix insmod oops on machines with no - * floppy controller (lingering task on list after module is gone... boom.) - */ - -/* - * 2002/02/07 -- Anton Altaparmakov - Fix io ports reservation to correct range - * (0x3f2-0x3f5, 0x3f7). This fix is a bit of a hack but the proper fix - * requires many non-obvious changes in arch dependent code. - */ - -/* - * 2002/10/12 -- Osamu Tomita - * split code from floppy.c - * support NEC PC-9800 only - */ - -#define FLOPPY_SANITY_CHECK -#undef FLOPPY_SILENT_DCL_CLEAR - -/* -#define PC9800_DEBUG_FLOPPY -#define PC9800_DEBUG_FLOPPY2 -*/ - -#define REALLY_SLOW_IO - -#define DEBUGT 2 -#define DCL_DEBUG /* debug disk change line */ - -/* do print messages for unexpected interrupts */ -static int print_unex=1; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for the compatibility eject ioctl */ -#include - -/* - * 1998/1/21 -- Richard Gooch -- devfs support - */ - - -#include -#define FLOPPY98_MOTOR_MASK 0x08 - -#include -#define FD98_STATUS (0 + FD_IOPORT ) -#define FD98_DATA (2 + FD_IOPORT ) -#define FD_MODE (4 + FD_IOPORT ) -#define FD_MODE_CHANGE 0xbe -#define FD_EMODE_CHANGE 0x4be - -#include -#include -#include -#include -#include -#include -#include -#include /* CMOS defines */ -#include -#include -#include -#include -#include -#include /* for invalidate_buffers() */ - -/* - * PS/2 floppies have much slower step rates than regular floppies. - * It's been recommended that take about 1/4 of the default speed - * in some more extreme cases. - */ -static int slow_floppy; - -#include -#include -#include -#include -#include - -#ifndef DEFAULT_FLOPPY_IRQ -# define DEFAULT_FLOPPY_IRQ 11 -#endif -#ifndef DEFAULT_FLOPPY_DMA -# define DEFAULT_FLOPPY_DMA 2 -#endif - -static int FLOPPY_IRQ=DEFAULT_FLOPPY_IRQ; -static int FLOPPY_DMA=DEFAULT_FLOPPY_DMA; -static int can_use_virtual_dma=2; -static int auto_detect_mode = 0; -static int retry_auto_detect = 0; -#define FD_AFTER_RESET_DELAY 1000 - -/* ======= - * can use virtual DMA: - * 0 = use of virtual DMA disallowed by config - * 1 = use of virtual DMA prescribed by config - * 2 = no virtual DMA preference configured. By default try hard DMA, - * but fall back on virtual DMA when not enough memory available - */ - -static int use_virtual_dma; -/* ======= - * use virtual DMA - * 0 using hard DMA - * 1 using virtual DMA - * This variable is set to virtual when a DMA mem problem arises, and - * reset back in floppy_grab_irq_and_dma. - * It is not safe to reset it in other circumstances, because the floppy - * driver may have several buffers in use at once, and we do currently not - * record each buffers capabilities - */ - -static spinlock_t floppy_lock = SPIN_LOCK_UNLOCKED; -static struct completion device_release; - -static unsigned short virtual_dma_port=0x3f0; -irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs); -static int set_mode(char mask, char data); -static void register_devfs_entries (int drive) __init; - -#define K_64 0x10000 /* 64KB */ - -/* the following is the mask of allowed drives. By default units 2 and - * 3 of both floppy controllers are disabled, because switching on the - * motor of these drives causes system hangs on some PCI computers. drive - * 0 is the low bit (0x1), and drive 7 is the high bit (0x80). Bits are on if - * a drive is allowed. - * - * NOTE: This must come before we include the arch floppy header because - * some ports reference this variable from there. -DaveM - */ - -static int allowed_drive_mask = 0x0f; - -#include - -static int irqdma_allocated; - -#define LOCAL_END_REQUEST -#define DEVICE_NAME "floppy" - -#include -#include /* for the compatibility eject ioctl */ -#include - -static struct request *current_req; -static struct request_queue *floppy_queue; - -#ifndef fd_get_dma_residue -#define fd_get_dma_residue() get_dma_residue(FLOPPY_DMA) -#endif - -/* Dma Memory related stuff */ - -#ifndef fd_dma_mem_free -#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size)) -#endif - -#ifndef fd_dma_mem_alloc -#define fd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL,get_order(size)) -#endif - -static inline void fallback_on_nodma_alloc(char **addr, size_t l) -{ -#ifdef FLOPPY_CAN_FALLBACK_ON_NODMA - if (*addr) - return; /* we have the memory */ - if (can_use_virtual_dma != 2) - return; /* no fallback allowed */ - printk("DMA memory shortage. Temporarily falling back on virtual DMA\n"); - *addr = (char *) nodma_mem_alloc(l); -#else - return; -#endif -} - -/* End dma memory related stuff */ - -static unsigned long fake_change; -static int initialising=1; - -#define ITYPE(x) (((x)>>2) & 0x1f) -#define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) -#define UNIT(x) ((x) & 0x03) /* drive on fdc */ -#define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ -#define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) - /* reverse mapping from unit and fdc to drive */ -#define DP (&drive_params[current_drive]) -#define DRS (&drive_state[current_drive]) -#define DRWE (&write_errors[current_drive]) -#define FDCS (&fdc_state[fdc]) -#define CLEARF(x) (clear_bit(x##_BIT, &DRS->flags)) -#define SETF(x) (set_bit(x##_BIT, &DRS->flags)) -#define TESTF(x) (test_bit(x##_BIT, &DRS->flags)) - -#define UDP (&drive_params[drive]) -#define UDRS (&drive_state[drive]) -#define UDRWE (&write_errors[drive]) -#define UFDCS (&fdc_state[FDC(drive)]) -#define UCLEARF(x) (clear_bit(x##_BIT, &UDRS->flags)) -#define USETF(x) (set_bit(x##_BIT, &UDRS->flags)) -#define UTESTF(x) (test_bit(x##_BIT, &UDRS->flags)) - -#define DPRINT(format, args...) printk(DEVICE_NAME "%d: " format, current_drive , ## args) - -#define PH_HEAD(floppy,head) (((((floppy)->stretch & 2) >>1) ^ head) << 2) -#define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) - -#define CLEARSTRUCT(x) memset((x), 0, sizeof(*(x))) - -/* read/write */ -#define COMMAND raw_cmd->cmd[0] -#define DR_SELECT raw_cmd->cmd[1] -#define TRACK raw_cmd->cmd[2] -#define HEAD raw_cmd->cmd[3] -#define SECTOR raw_cmd->cmd[4] -#define SIZECODE raw_cmd->cmd[5] -#define SECT_PER_TRACK raw_cmd->cmd[6] -#define GAP raw_cmd->cmd[7] -#define SIZECODE2 raw_cmd->cmd[8] -#define NR_RW 9 - -/* format */ -#define F_SIZECODE raw_cmd->cmd[2] -#define F_SECT_PER_TRACK raw_cmd->cmd[3] -#define F_GAP raw_cmd->cmd[4] -#define F_FILL raw_cmd->cmd[5] -#define NR_F 6 - -/* - * Maximum disk size (in kilobytes). This default is used whenever the - * current disk size is unknown. - * [Now it is rather a minimum] - */ -#define MAX_DISK_SIZE 4 /* 3984*/ - - -/* - * globals used by 'result()' - */ -#define MAX_REPLIES 16 -static unsigned char reply_buffer[MAX_REPLIES]; -static int inr; /* size of reply buffer, when called from interrupt */ -#define ST0 (reply_buffer[0]) -#define ST1 (reply_buffer[1]) -#define ST2 (reply_buffer[2]) -#define ST3 (reply_buffer[0]) /* result of GETSTATUS */ -#define R_TRACK (reply_buffer[3]) -#define R_HEAD (reply_buffer[4]) -#define R_SECTOR (reply_buffer[5]) -#define R_SIZECODE (reply_buffer[6]) - -#define SEL_DLY (2*HZ/100) - -/* - * this struct defines the different floppy drive types. - */ -static struct { - struct floppy_drive_params params; - const char *name; /* name printed while booting */ -} default_drive_params[]= { -/* NOTE: the time values in jiffies should be in msec! - CMOS drive type - | Maximum data rate supported by drive type - | | Head load time, msec - | | | Head unload time, msec (not used) - | | | | Step rate interval, usec - | | | | | Time needed for spinup time (jiffies) - | | | | | | Timeout for spinning down (jiffies) - | | | | | | | Spindown offset (where disk stops) - | | | | | | | | Select delay - | | | | | | | | | RPS - | | | | | | | | | | Max number of tracks - | | | | | | | | | | | Interrupt timeout - | | | | | | | | | | | | Max nonintlv. sectors - | | | | | | | | | | | | | -Max Errors- flags */ -{{0, 500, 16, 16, 8000, 1*HZ, 3*HZ, 0, SEL_DLY, 5, 80, 3*HZ, 20, {3,1,2,0,2}, 0, - 0, { 7, 4, 8, 2, 1, 5, 3,10}, 3*HZ/2, 0 }, "unknown" }, - -{{1, 300, 16, 16, 8000, 1*HZ, 3*HZ, 0, SEL_DLY, 5, 40, 3*HZ, 17, {3,1,2,0,2}, 0, - 0, { 1, 0, 0, 0, 0, 0, 0, 0}, 3*HZ/2, 1 }, "360K PC" }, /*5 1/4 360 KB PC*/ - -{{2, 500, 16, 16, 6000, 4*HZ/10, 3*HZ, 14, SEL_DLY, 6, 83, 3*HZ, 17, {3,1,2,0,2}, 0, - 0, { 2, 6, 4, 0, 0, 0, 0, 0}, 3*HZ/2, 2 }, "1.2M" }, /*5 1/4 HD AT*/ - -{{3, 250, 16, 16, 3000, 1*HZ, 3*HZ, 0, SEL_DLY, 5, 83, 3*HZ, 20, {3,1,2,0,2}, 0, - 0, { 4, 6, 0, 0, 0, 0, 0, 0}, 3*HZ/2, 4 }, "720k" }, /*3 1/2 DD*/ - -{{4, 500, 16, 16, 4000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 20, {3,1,2,0,2}, 0, - 0, { 7,10, 2, 4, 6, 0, 0, 0}, 3*HZ/2, 7 }, "1.44M" }, /*3 1/2 HD*/ - -{{5, 1000, 15, 8, 3000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0, - 0, { 7, 8, 4,25,28,22,31,21}, 3*HZ/2, 8 }, "2.88M AMI BIOS" }, /*3 1/2 ED*/ - -{{6, 1000, 15, 8, 3000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0, - 0, { 7, 8, 4,25,28,22,31,21}, 3*HZ/2, 8 }, "2.88M" } /*3 1/2 ED*/ -/* | --autodetected formats--- | | | - * read_track | | Name printed when booting - * | Native format - * Frequency of disk change checks */ -}; - -static struct floppy_drive_params drive_params[N_DRIVE]; -static struct floppy_drive_struct drive_state[N_DRIVE]; -static struct floppy_write_errors write_errors[N_DRIVE]; -static struct timer_list motor_off_timer[N_DRIVE]; -static struct gendisk *disks[N_DRIVE]; -static struct block_device *opened_bdev[N_DRIVE]; -static DECLARE_MUTEX(open_lock); -static struct floppy_raw_cmd *raw_cmd, default_raw_cmd; - -/* - * This struct defines the different floppy types. - * - * Bit 0 of 'stretch' tells if the tracks need to be doubled for some - * types (e.g. 360kB diskette in 1.2MB drive, etc.). Bit 1 of 'stretch' - * tells if the disk is in Commodore 1581 format, which means side 0 sectors - * are located on side 1 of the disk but with a side 0 ID, and vice-versa. - * This is the same as the Sharp MZ-80 5.25" CP/M disk format, except that the - * 1581's logical side 0 is on physical side 1, whereas the Sharp's logical - * side 0 is on physical side 0 (but with the misnamed sector IDs). - * 'stretch' should probably be renamed to something more general, like - * 'options'. Other parameters should be self-explanatory (see also - * setfdprm(8)). - */ -/* - Size - | Sectors per track - | | Head - | | | Tracks - | | | | Stretch - | | | | | Gap 1 size - | | | | | | Data rate, | 0x40 for perp - | | | | | | | Spec1 (stepping rate, head unload - | | | | | | | | /fmt gap (gap2) */ -static struct floppy_struct floppy_type[32] = { - { 0, 0,0, 0,0,0x00,0x00,0x00,0x00,NULL }, /* 0 no testing */ -#if 0 - { 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"d360" }, /* 1 360KB PC */ -#else - { 2464,16,2,77,0,0x35,0x48,0xDF,0x74,"d360" }, /* 1 1.25MB 98 */ -#endif - { 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"h1200" }, /* 2 1.2MB AT */ - { 720, 9,1,80,0,0x2A,0x02,0xDF,0x50,"D360" }, /* 3 360KB SS 3.5" */ - { 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"D720" }, /* 4 720KB 3.5" */ - { 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"h360" }, /* 5 360KB AT */ - { 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,"h720" }, /* 6 720KB AT */ - { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"H1440" }, /* 7 1.44MB 3.5" */ - { 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"E2880" }, /* 8 2.88MB 3.5" */ - { 6240,39,2,80,0,0x1B,0x43,0xAF,0x28,"E3120" }, /* 9 3.12MB 3.5" */ - - { 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, /* 10 1.44MB 5.25" */ - { 3360,21,2,80,0,0x1C,0x00,0xCF,0x0C,"H1680" }, /* 11 1.68MB 3.5" */ - { 820,10,2,41,1,0x25,0x01,0xDF,0x2E,"h410" }, /* 12 410KB 5.25" */ - { 1640,10,2,82,0,0x25,0x02,0xDF,0x2E,"H820" }, /* 13 820KB 3.5" */ - { 2952,18,2,82,0,0x25,0x00,0xDF,0x02,"h1476" }, /* 14 1.48MB 5.25" */ - { 3444,21,2,82,0,0x25,0x00,0xDF,0x0C,"H1722" }, /* 15 1.72MB 3.5" */ - { 840,10,2,42,1,0x25,0x01,0xDF,0x2E,"h420" }, /* 16 420KB 5.25" */ - { 1660,10,2,83,0,0x25,0x02,0xDF,0x2E,"H830" }, /* 17 830KB 3.5" */ - { 2988,18,2,83,0,0x25,0x00,0xDF,0x02,"h1494" }, /* 18 1.49MB 5.25" */ - { 3486,21,2,83,0,0x25,0x00,0xDF,0x0C,"H1743" }, /* 19 1.74 MB 3.5" */ - - { 1760,11,2,80,0,0x1C,0x09,0xCF,0x00,"h880" }, /* 20 880KB 5.25" */ - { 2080,13,2,80,0,0x1C,0x01,0xCF,0x00,"D1040" }, /* 21 1.04MB 3.5" */ - { 2240,14,2,80,0,0x1C,0x19,0xCF,0x00,"D1120" }, /* 22 1.12MB 3.5" */ - { 3200,20,2,80,0,0x1C,0x20,0xCF,0x2C,"h1600" }, /* 23 1.6MB 5.25" */ - { 3520,22,2,80,0,0x1C,0x08,0xCF,0x2e,"H1760" }, /* 24 1.76MB 3.5" */ - { 3840,24,2,80,0,0x1C,0x20,0xCF,0x00,"H1920" }, /* 25 1.92MB 3.5" */ - { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ - { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ - { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ - - { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ - { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ - { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ -}; - -#define NUMBER(x) (sizeof(x) / sizeof(*(x))) -#define SECTSIZE (_FD_SECTSIZE(*floppy)) - -/* Auto-detection: Disk type used until the next media change occurs. */ -static struct floppy_struct *current_type[N_DRIVE]; - -/* - * User-provided type information. current_type points to - * the respective entry of this array. - */ -static struct floppy_struct user_params[N_DRIVE]; - -static sector_t floppy_sizes[256]; - -/* - * The driver is trying to determine the correct media format - * while probing is set. rw_interrupt() clears it after a - * successful access. - */ -static int probing; - -/* Synchronization of FDC access. */ -#define FD_COMMAND_NONE -1 -#define FD_COMMAND_ERROR 2 -#define FD_COMMAND_OKAY 3 - -static volatile int command_status = FD_COMMAND_NONE; -static unsigned long fdc_busy; -static DECLARE_WAIT_QUEUE_HEAD(fdc_wait); -static DECLARE_WAIT_QUEUE_HEAD(command_done); - -#define NO_SIGNAL (!interruptible || !signal_pending(current)) -#define CALL(x) if ((x) == -EINTR) return -EINTR -#define ECALL(x) if ((ret = (x))) return ret; -#define _WAIT(x,i) CALL(ret=wait_til_done((x),i)) -#define WAIT(x) _WAIT((x),interruptible) -#define IWAIT(x) _WAIT((x),1) - -/* Errors during formatting are counted here. */ -static int format_errors; - -/* Format request descriptor. */ -static struct format_descr format_req; - -/* - * Rate is 0 for 500kb/s, 1 for 300kbps, 2 for 250kbps - * Spec1 is 0xSH, where S is stepping rate (F=1ms, E=2ms, D=3ms etc), - * H is head unload time (1=16ms, 2=32ms, etc) - */ - -/* - * Track buffer - * Because these are written to by the DMA controller, they must - * not contain a 64k byte boundary crossing, or data will be - * corrupted/lost. - */ -static char *floppy_track_buffer; -static int max_buffer_sectors; - -static int *errors; -typedef void (*done_f)(int); -static struct cont_t { - void (*interrupt)(void); /* this is called after the interrupt of the - * main command */ - void (*redo)(void); /* this is called to retry the operation */ - void (*error)(void); /* this is called to tally an error */ - done_f done; /* this is called to say if the operation has - * succeeded/failed */ -} *cont; - -static void floppy_ready(void); -static void floppy_start(void); -static void process_fd_request(void); -static void recalibrate_floppy(void); -static void floppy_shutdown(unsigned long); - -static int floppy_grab_irq_and_dma(void); -static void floppy_release_irq_and_dma(void); - -/* - * The "reset" variable should be tested whenever an interrupt is scheduled, - * after the commands have been sent. This is to ensure that the driver doesn't - * get wedged when the interrupt doesn't come because of a failed command. - * reset doesn't need to be tested before sending commands, because - * output_byte is automatically disabled when reset is set. - */ -#define CHECK_RESET { if (FDCS->reset){ reset_fdc(); return; } } -static void reset_fdc(void); - -/* - * These are global variables, as that's the easiest way to give - * information to interrupts. They are the data used for the current - * request. - */ -#define NO_TRACK -1 -#define NEED_1_RECAL -2 -#define NEED_2_RECAL -3 - -static int usage_count; - -/* buffer related variables */ -static int buffer_track = -1; -static int buffer_drive = -1; -static int buffer_min = -1; -static int buffer_max = -1; - -/* fdc related variables, should end up in a struct */ -static struct floppy_fdc_state fdc_state[N_FDC]; -static int fdc; /* current fdc */ - -static struct floppy_struct *_floppy = floppy_type; -static unsigned char current_drive; -static long current_count_sectors; -static unsigned char fsector_t; /* sector in track */ -static unsigned char in_sector_offset; /* offset within physical sector, - * expressed in units of 512 bytes */ - -#ifndef fd_eject -static inline int fd_eject(int drive) -{ - return -EINVAL; -} -#endif - -#ifdef DEBUGT -static long unsigned debugtimer; -#endif - -/* - * Debugging - * ========= - */ -static inline void set_debugt(void) -{ -#ifdef DEBUGT - debugtimer = jiffies; -#endif -} - -static inline void debugt(const char *message) -{ -#ifdef DEBUGT - if (DP->flags & DEBUGT) - printk("%s dtime=%lu\n", message, jiffies-debugtimer); -#endif -} - -typedef void (*timeout_fn)(unsigned long); -static struct timer_list fd_timeout = TIMER_INITIALIZER(floppy_shutdown, 0, 0); - -static const char *timeout_message; - -#ifdef FLOPPY_SANITY_CHECK -static void is_alive(const char *message) -{ - /* this routine checks whether the floppy driver is "alive" */ - if (fdc_busy && command_status < 2 && !timer_pending(&fd_timeout)){ - DPRINT("timeout handler died: %s\n",message); - } -} -#endif - -static void (*do_floppy)(void) = NULL; - -#ifdef FLOPPY_SANITY_CHECK - -#define OLOGSIZE 20 - -static void (*lasthandler)(void); -static unsigned long interruptjiffies; -static unsigned long resultjiffies; -static int resultsize; -static unsigned long lastredo; - -static struct output_log { - unsigned char data; - unsigned char status; - unsigned long jiffies; -} output_log[OLOGSIZE]; - -static int output_log_pos; -#endif - -#define current_reqD -1 -#define MAXTIMEOUT -2 - -static void reschedule_timeout(int drive, const char *message, int marg) -{ - unsigned long delay; - - if (drive == current_reqD) - drive = current_drive; - if (drive < 0 || drive > N_DRIVE) { - delay = 20UL*HZ; - drive=0; - } else - delay = UDP->timeout; - mod_timer(&fd_timeout, delay + jiffies); - if (UDP->flags & FD_DEBUG){ - DPRINT("reschedule timeout "); - printk(message, marg); - printk("\n"); - } - timeout_message = message; -} - -static int maximum(int a, int b) -{ - if (a > b) - return a; - else - return b; -} -#define INFBOUND(a,b) (a)=maximum((a),(b)); - -static int minimum(int a, int b) -{ - if (a < b) - return a; - else - return b; -} -#define SUPBOUND(a,b) (a)=minimum((a),(b)); - - -/* - * Bottom half floppy driver. - * ========================== - * - * This part of the file contains the code talking directly to the hardware, - * and also the main service loop (seek-configure-spinup-command) - */ - -/* - * disk change. - * This routine is responsible for maintaining the FD_DISK_CHANGE flag, - * and the last_checked date. - * - * last_checked is the date of the last check which showed 'no disk change' - * FD_DISK_CHANGE is set under two conditions: - * 1. The floppy has been changed after some i/o to that floppy already - * took place. - * 2. No floppy disk is in the drive. This is done in order to ensure that - * requests are quickly flushed in case there is no disk in the drive. It - * follows that FD_DISK_CHANGE can only be cleared if there is a disk in - * the drive. - * - * For 1., maxblock is observed. Maxblock is 0 if no i/o has taken place yet. - * For 2., FD_DISK_NEWCHANGE is watched. FD_DISK_NEWCHANGE is cleared on - * each seek. If a disk is present, the disk change line should also be - * cleared on each seek. Thus, if FD_DISK_NEWCHANGE is clear, but the disk - * change line is set, this means either that no disk is in the drive, or - * that it has been removed since the last seek. - * - * This means that we really have a third possibility too: - * The floppy has been changed after the last seek. - */ - -static int disk_change(int drive) -{ - return UTESTF(FD_DISK_CHANGED); -} - -static int set_mode(char mask, char data) -{ - register unsigned char newdor, olddor; - - olddor = FDCS->dor; - newdor = (olddor & mask) | data; - if (newdor != olddor) { - FDCS->dor = newdor; - fd_outb(newdor, FD_MODE); - } - - if (newdor & FLOPPY98_MOTOR_MASK) - floppy_grab_irq_and_dma(); - - if (olddor & FLOPPY98_MOTOR_MASK) - floppy_release_irq_and_dma(); - - return olddor; -} - -static void twaddle(void) -{ - if (DP->select_delay) - return; - - fd_outb(FDCS->dor & 0xf7, FD_MODE); - fd_outb(FDCS->dor, FD_MODE); - DRS->select_date = jiffies; -} - -/* reset all driver information about the current fdc. This is needed after - * a reset, and after a raw command. */ -static void reset_fdc_info(int mode) -{ - int drive; - - FDCS->spec1 = FDCS->spec2 = -1; - FDCS->need_configure = 1; - FDCS->perp_mode = 1; - FDCS->rawcmd = 0; - for (drive = 0; drive < N_DRIVE; drive++) - if (FDC(drive) == fdc && - (mode || UDRS->track != NEED_1_RECAL)) - UDRS->track = NEED_2_RECAL; -} - -/* selects the fdc and drive, and enables the fdc's input/dma. */ -static void set_fdc(int drive) -{ - fdc = 0; - current_drive = drive; - set_mode(~0, 0x10); - if (FDCS->rawcmd == 2) - reset_fdc_info(1); - - if (fd_inb(FD98_STATUS) != STATUS_READY) - FDCS->reset = 1; -} - -/* locks the driver */ -static int _lock_fdc(int drive, int interruptible, int line) -{ - if (!usage_count){ - printk(KERN_ERR "Trying to lock fdc while usage count=0 at line %d\n", line); - return -1; - } - if(floppy_grab_irq_and_dma()==-1) - return -EBUSY; - - if (test_and_set_bit(0, &fdc_busy)) { - DECLARE_WAITQUEUE(wait, current); - add_wait_queue(&fdc_wait, &wait); - - for (;;) { - set_current_state(TASK_INTERRUPTIBLE); - - if (!test_and_set_bit(0, &fdc_busy)) - break; - - schedule(); - - if (!NO_SIGNAL) { - remove_wait_queue(&fdc_wait, &wait); - return -EINTR; - } - } - - set_current_state(TASK_RUNNING); - remove_wait_queue(&fdc_wait, &wait); - } - command_status = FD_COMMAND_NONE; - - reschedule_timeout(drive, "lock fdc", 0); - set_fdc(drive); - return 0; -} - -#define lock_fdc(drive,interruptible) _lock_fdc(drive,interruptible, __LINE__) - -#define LOCK_FDC(drive,interruptible) \ -if (lock_fdc(drive,interruptible)) return -EINTR; - - -/* unlocks the driver */ -static inline void unlock_fdc(void) -{ - raw_cmd = 0; - if (!fdc_busy) - DPRINT("FDC access conflict!\n"); - - if (do_floppy) - DPRINT("device interrupt still active at FDC release: %p!\n", - do_floppy); - command_status = FD_COMMAND_NONE; - del_timer(&fd_timeout); - cont = NULL; - clear_bit(0, &fdc_busy); - floppy_release_irq_and_dma(); - wake_up(&fdc_wait); -} - -#ifndef CONFIG_PC9800_MOTOR_OFF /* tomita */ - -/* switches the motor off after a given timeout */ -static void motor_off_callback(unsigned long nr) -{ - printk(KERN_DEBUG "fdc%lu: turn off motor\n", nr); -} - -/* schedules motor off */ -static void floppy_off(unsigned int drive) -{ -} - -#else /* CONFIG_PC9800_MOTOR_OFF */ - -/* switches the motor off after a given timeout */ -static void motor_off_callback(unsigned long fdc) -{ - printk(KERN_DEBUG "fdc%u: turn off motor\n", (unsigned int) fdc); - - fd_outb(0, FD_MODE); /* MTON = 0 */ -} - -static struct timer_list motor_off_timer[N_FDC] = { - { data: 0, function: motor_off_callback }, -#if N_FDC > 1 - { data: 1, function: motor_off_callback }, -#endif -#if N_FDC > 2 -# error "N_FDC > 2; please fix initializer for motor_off_timer[]" -#endif -}; - -/* schedules motor off */ -static void floppy_off(unsigned int drive) -{ - unsigned long volatile delta; - register int fdc = FDC(drive); - - if (!(FDCS->dor & (0x10 << UNIT(drive)))) - return; - - del_timer(motor_off_timer + fdc); - -#if 0 - /* make spindle stop in a position which minimizes spinup time - * next time */ - if (UDP->rps){ - delta = jiffies - UDRS->first_read_date + HZ - - UDP->spindown_offset; - delta = ((delta * UDP->rps) % HZ) / UDP->rps; - motor_off_timer[drive].expires = jiffies + UDP->spindown - delta; - } -#else - if (UDP->rps) - motor_off_timer[drive].expires = jiffies + UDP->spindown; -#endif - - add_timer(motor_off_timer + fdc); -} - -#endif /* CONFIG_PC9800_MOTOR_OFF */ - -/* - * cycle through all N_DRIVE floppy drives, for disk change testing. - * stopping at current drive. This is done before any long operation, to - * be sure to have up to date disk change information. - */ -static void scandrives(void) -{ - int i, drive, saved_drive; - - if (DP->select_delay) - return; - - saved_drive = current_drive; - for (i=0; i < N_DRIVE; i++){ - drive = (saved_drive + i + 1) % N_DRIVE; - if (UDRS->fd_ref == 0 || UDP->select_delay != 0) - continue; /* skip closed drives */ - set_fdc(drive); - } - set_fdc(saved_drive); -} - -static void empty(void) -{ -} - -static DECLARE_WORK(floppy_work, NULL, NULL); - -static void schedule_bh(void (*handler) (void)) -{ - PREPARE_WORK(&floppy_work, (void (*)(void *))handler, NULL); - schedule_work(&floppy_work); -} - -static struct timer_list fd_timer = TIMER_INITIALIZER(NULL, 0, 0); - -static void cancel_activity(void) -{ - do_floppy = NULL; - PREPARE_WORK(&floppy_work, (void*)(void*)empty, NULL); - del_timer(&fd_timer); -} - -/* this function makes sure that the disk stays in the drive during the - * transfer */ -static void fd_watchdog(void) -{ -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("calling disk change from watchdog\n"); - } -#endif - - if (disk_change(current_drive)){ - DPRINT("disk removed during i/o\n"); - cancel_activity(); - cont->done(0); - reset_fdc(); - } else { - del_timer(&fd_timer); - fd_timer.function = (timeout_fn) fd_watchdog; - fd_timer.expires = jiffies + HZ / 10; - add_timer(&fd_timer); - } -} - -static void main_command_interrupt(void) -{ - del_timer(&fd_timer); - cont->interrupt(); -} - -/* waits for a delay (spinup or select) to pass */ -static int fd_wait_for_completion(unsigned long delay, timeout_fn function) -{ - if (FDCS->reset){ - reset_fdc(); /* do the reset during sleep to win time - * if we don't need to sleep, it's a good - * occasion anyways */ - return 1; - } - - if ((signed) (jiffies - delay) < 0){ - del_timer(&fd_timer); - fd_timer.function = function; - fd_timer.expires = delay; - add_timer(&fd_timer); - return 1; - } - return 0; -} - -static spinlock_t floppy_hlt_lock = SPIN_LOCK_UNLOCKED; -static int hlt_disabled; -static void floppy_disable_hlt(void) -{ - unsigned long flags; - - spin_lock_irqsave(&floppy_hlt_lock, flags); - if (!hlt_disabled) { - hlt_disabled=1; -#ifdef HAVE_DISABLE_HLT - disable_hlt(); -#endif - } - spin_unlock_irqrestore(&floppy_hlt_lock, flags); -} - -static void floppy_enable_hlt(void) -{ - unsigned long flags; - - spin_lock_irqsave(&floppy_hlt_lock, flags); - if (hlt_disabled){ - hlt_disabled=0; -#ifdef HAVE_DISABLE_HLT - enable_hlt(); -#endif - } - spin_unlock_irqrestore(&floppy_hlt_lock, flags); -} - - -static void setup_DMA(void) -{ - unsigned long f; - -#ifdef FLOPPY_SANITY_CHECK - if (raw_cmd->length == 0){ - int i; - - printk("zero dma transfer size:"); - for (i=0; i < raw_cmd->cmd_count; i++) - printk("%x,", raw_cmd->cmd[i]); - printk("\n"); - cont->done(0); - FDCS->reset = 1; - return; - } - if (((unsigned long) raw_cmd->kernel_data) % 512){ - printk("non aligned address: %p\n", raw_cmd->kernel_data); - cont->done(0); - FDCS->reset=1; - return; - } -#endif - f=claim_dma_lock(); - fd_disable_dma(); -#ifdef fd_dma_setup - if (fd_dma_setup(raw_cmd->kernel_data, raw_cmd->length, - (raw_cmd->flags & FD_RAW_READ)? - DMA_MODE_READ : DMA_MODE_WRITE, - FDCS->address) < 0) { - release_dma_lock(f); - cont->done(0); - FDCS->reset=1; - return; - } - release_dma_lock(f); -#else - fd_clear_dma_ff(); - fd_cacheflush(raw_cmd->kernel_data, raw_cmd->length); - fd_set_dma_mode((raw_cmd->flags & FD_RAW_READ)? - DMA_MODE_READ : DMA_MODE_WRITE); - fd_set_dma_addr(raw_cmd->kernel_data); - fd_set_dma_count(raw_cmd->length); - virtual_dma_port = FDCS->address; - fd_enable_dma(); - release_dma_lock(f); -#endif - floppy_disable_hlt(); -} - -static void show_floppy(void); - -/* waits until the fdc becomes ready */ - -#ifdef PC9800_DEBUG_FLOPPY -#define READY_DELAY 10000000 -#else -#define READY_DELAY 100000 -#endif - -static int wait_til_ready(void) -{ - int counter, status; - if (FDCS->reset) - return -1; - for (counter = 0; counter < READY_DELAY; counter++) { - status = fd_inb(FD98_STATUS); - if (status & STATUS_READY) - return status; - } - if (!initialising) { - DPRINT("Getstatus times out (%x) on fdc %d\n", - status, fdc); - show_floppy(); - } - FDCS->reset = 1; - return -1; -} - -/* sends a command byte to the fdc */ -static int output_byte(char byte) -{ - int status; - - if ((status = wait_til_ready()) < 0) - return -1; - if ((status & (STATUS_READY|STATUS_DIR|STATUS_DMA)) == STATUS_READY){ - fd_outb(byte,FD98_DATA); -#ifdef FLOPPY_SANITY_CHECK - output_log[output_log_pos].data = byte; - output_log[output_log_pos].status = status; - output_log[output_log_pos].jiffies = jiffies; - output_log_pos = (output_log_pos + 1) % OLOGSIZE; -#endif - return 0; - } - FDCS->reset = 1; - if (!initialising) { - DPRINT("Unable to send byte %x to FDC. Fdc=%x Status=%x\n", - byte, fdc, status); - show_floppy(); - } - return -1; -} -#define LAST_OUT(x) if (output_byte(x)<0){ reset_fdc();return;} - -/* gets the response from the fdc */ -static int result(void) -{ - int i, status=0; - - for(i=0; i < MAX_REPLIES; i++) { - if ((status = wait_til_ready()) < 0) - break; - status &= STATUS_DIR|STATUS_READY|STATUS_BUSY|STATUS_DMA; - if ((status & ~STATUS_BUSY) == STATUS_READY){ -#ifdef FLOPPY_SANITY_CHECK - resultjiffies = jiffies; - resultsize = i; -#endif - return i; - } - if (status == (STATUS_DIR|STATUS_READY|STATUS_BUSY)) - reply_buffer[i] = fd_inb(FD98_DATA); - else - break; - } - if (!initialising) { - DPRINT("get result error. Fdc=%d Last status=%x Read bytes=%d\n", - fdc, status, i); - show_floppy(); - } - FDCS->reset = 1; - return -1; -} - -static int fifo_depth = 0xa; -static int no_fifo; - -#define NOMINAL_DTR 500 - -/* Issue a "SPECIFY" command to set the step rate time, head unload time, - * head load time, and DMA disable flag to values needed by floppy. - * - * The value "dtr" is the data transfer rate in Kbps. It is needed - * to account for the data rate-based scaling done by the 82072 and 82077 - * FDC types. This parameter is ignored for other types of FDCs (i.e. - * 8272a). - * - * Note that changing the data transfer rate has a (probably deleterious) - * effect on the parameters subject to scaling for 82072/82077 FDCs, so - * fdc_specify is called again after each data transfer rate - * change. - * - * srt: 1000 to 16000 in microseconds - * hut: 16 to 240 milliseconds - * hlt: 2 to 254 milliseconds - * - * These values are rounded up to the next highest available delay time. - */ -static void fdc_specify(void) -{ - output_byte(FD_SPECIFY); - output_byte(FDCS->spec1 = 0xdf); - output_byte(FDCS->spec2 = 0x24); -} - -static void tell_sector(void) -{ - printk(": track %d, head %d, sector %d, size %d", - R_TRACK, R_HEAD, R_SECTOR, R_SIZECODE); -} /* tell_sector */ - -static int auto_detect_mode_pc9800(void) -{ -#ifdef PC9800_DEBUG_FLOPPY - printk("auto_detect_mode_pc9800: retry_auto_detect=%d\n", - retry_auto_detect); -#endif - if (retry_auto_detect > 4) { - retry_auto_detect = 0; - return 1; - } - - switch ((int)(_floppy - floppy_type)) { - case 2: - _floppy = floppy_type + 4; - break; - - case 4: - case 6: - _floppy = floppy_type + 7; - break; - - case 7: - case 10: - _floppy = floppy_type + 2; - break; - - default: - _floppy = floppy_type + 7; - } - - retry_auto_detect++; - return 0; -} - -static void access_mode_change_pc9800(void); - -/* - * OK, this error interpreting routine is called after a - * DMA read/write has succeeded - * or failed, so we check the results, and copy any buffers. - * hhb: Added better error reporting. - * ak: Made this into a separate routine. - */ -static int interpret_errors(void) -{ - char bad; - - if (inr!=7) { - DPRINT("-- FDC reply error"); - FDCS->reset = 1; - return 1; - } - - /* check IC to find cause of interrupt */ - switch (ST0 & ST0_INTR) { - case 0x40: /* error occurred during command execution */ - if (ST1 & ST1_EOC) - return 0; /* occurs with pseudo-DMA */ - bad = 1; - if (ST1 & ST1_WP) { - DPRINT("Drive is write protected\n"); - CLEARF(FD_DISK_WRITABLE); - cont->done(0); - bad = 2; - } else if (ST1 & ST1_ND) { - SETF(FD_NEED_TWADDLE); - } else if (ST1 & ST1_OR) { - if (DP->flags & FTD_MSG) - DPRINT("Over/Underrun - retrying\n"); - bad = 0; - }else if (*errors >= DP->max_errors.reporting){ - if (ST0 & ST0_ECE) { - printk("Recalibrate failed!"); - } else if (ST2 & ST2_CRC) { - printk("data CRC error"); - tell_sector(); - } else if (ST1 & ST1_CRC) { - printk("CRC error"); - tell_sector(); - } else if ((ST1 & (ST1_MAM|ST1_ND)) || (ST2 & ST2_MAM)) { - if (auto_detect_mode) { - bad = (char)auto_detect_mode_pc9800(); - access_mode_change_pc9800(); - } - - if (bad) { - printk("floppy error: MA: _floppy - floppy_type=%d\n", (int)(_floppy - floppy_type)); - printk("bad=%d\n", (int)bad); - if (!probing) { - printk("sector not found"); - tell_sector(); - } else - printk("probe failed..."); - } - } else if (ST2 & ST2_WC) { /* seek error */ - printk("wrong cylinder"); - } else if (ST2 & ST2_BC) { /* cylinder marked as bad */ - printk("bad cylinder"); - } else { - printk("unknown error. ST[0..2] are: 0x%x 0x%x 0x%x", ST0, ST1, ST2); - tell_sector(); - } - printk("\n"); - - } - if (ST2 & ST2_WC || ST2 & ST2_BC) - /* wrong cylinder => recal */ - DRS->track = NEED_2_RECAL; - return bad; - case 0x80: /* invalid command given */ - DPRINT("Invalid FDC command given!\n"); - cont->done(0); - return 2; - case 0xc0: - SETF(FD_DISK_CHANGED); - SETF(FD_DISK_WRITABLE); - DPRINT("Abnormal termination caused by polling\n"); - cont->error(); - return 2; - default: /* (0) Normal command termination */ - auto_detect_mode = 0; - return 0; - } -} - -/* - * This routine is called when everything should be correctly set up - * for the transfer (i.e. floppy motor is on, the correct floppy is - * selected, and the head is sitting on the right track). - */ -static void setup_rw_floppy(void) -{ - int i,r, flags,dflags; - unsigned long ready_date; - timeout_fn function; - - access_mode_change_pc9800(); - flags = raw_cmd->flags; - if (flags & (FD_RAW_READ | FD_RAW_WRITE)) - flags |= FD_RAW_INTR; - - if ((flags & FD_RAW_SPIN) && !(flags & FD_RAW_NO_MOTOR)){ - ready_date = DRS->spinup_date + DP->spinup; - /* If spinup will take a long time, rerun scandrives - * again just before spinup completion. Beware that - * after scandrives, we must again wait for selection. - */ - if ((signed) (ready_date - jiffies) > DP->select_delay){ - ready_date -= DP->select_delay; - function = (timeout_fn) floppy_start; - } else - function = (timeout_fn) setup_rw_floppy; - - /* wait until the floppy is spinning fast enough */ - if (fd_wait_for_completion(ready_date,function)) - return; - } - dflags = DRS->flags; - - if ((flags & FD_RAW_READ) || (flags & FD_RAW_WRITE)) - setup_DMA(); - - if (flags & FD_RAW_INTR) - do_floppy = main_command_interrupt; - - r=0; - for (i=0; i< raw_cmd->cmd_count; i++) - r|=output_byte(raw_cmd->cmd[i]); - -#ifdef DEBUGT - debugt("rw_command: "); -#endif - if (r){ - cont->error(); - reset_fdc(); - return; - } - - if (!(flags & FD_RAW_INTR)){ - inr = result(); - cont->interrupt(); - } else if (flags & FD_RAW_NEED_DISK) - fd_watchdog(); -} - -static int blind_seek; - -/* - * This is the routine called after every seek (or recalibrate) interrupt - * from the floppy controller. - */ -static void seek_interrupt(void) -{ -#ifdef DEBUGT - debugt("seek interrupt:"); -#endif - if (inr != 2 || (ST0 & 0xF8) != 0x20) { - DRS->track = NEED_2_RECAL; - cont->error(); - cont->redo(); - return; - } - if (DRS->track >= 0 && DRS->track != ST1 && !blind_seek){ -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("clearing NEWCHANGE flag because of effective seek\n"); - DPRINT("jiffies=%lu\n", jiffies); - } -#endif - CLEARF(FD_DISK_NEWCHANGE); /* effective seek */ - CLEARF(FD_DISK_CHANGED); /* effective seek */ - DRS->select_date = jiffies; - } - DRS->track = ST1; - floppy_ready(); -} - -static void check_wp(void) -{ - if (TESTF(FD_VERIFY)) { - /* check write protection */ - output_byte(FD_GETSTATUS); - output_byte(UNIT(current_drive)); - if (result() != 1){ - FDCS->reset = 1; - return; - } - CLEARF(FD_VERIFY); - CLEARF(FD_NEED_TWADDLE); -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("checking whether disk is write protected\n"); - DPRINT("wp=%x\n",ST3 & 0x40); - } -#endif - if (!(ST3 & 0x40)) - SETF(FD_DISK_WRITABLE); - else - CLEARF(FD_DISK_WRITABLE); - } -} - -static void seek_floppy(void) -{ - int track; - - blind_seek=0; - -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("calling disk change from seek\n"); - } -#endif - - if (!TESTF(FD_DISK_NEWCHANGE) && - disk_change(current_drive) && - (raw_cmd->flags & FD_RAW_NEED_DISK)){ - /* the media changed flag should be cleared after the seek. - * If it isn't, this means that there is really no disk in - * the drive. - */ - SETF(FD_DISK_CHANGED); - cont->done(0); - cont->redo(); - return; - } - if (DRS->track <= NEED_1_RECAL){ - recalibrate_floppy(); - return; - } else if (TESTF(FD_DISK_NEWCHANGE) && - (raw_cmd->flags & FD_RAW_NEED_DISK) && - (DRS->track <= NO_TRACK || DRS->track == raw_cmd->track)) { - /* we seek to clear the media-changed condition. Does anybody - * know a more elegant way, which works on all drives? */ - if (raw_cmd->track) - track = raw_cmd->track - 1; - else { - if (DP->flags & FD_SILENT_DCL_CLEAR){ - blind_seek = 1; - raw_cmd->flags |= FD_RAW_NEED_SEEK; - } - track = 1; - } - } else { - check_wp(); - if (raw_cmd->track != DRS->track && - (raw_cmd->flags & FD_RAW_NEED_SEEK)) - track = raw_cmd->track; - else { - setup_rw_floppy(); - return; - } - } - - do_floppy = seek_interrupt; - output_byte(FD_SEEK); - output_byte(UNIT(current_drive)); - LAST_OUT(track); -#ifdef DEBUGT - debugt("seek command:"); -#endif -} - -static void recal_interrupt(void) -{ -#ifdef DEBUGT - debugt("recal interrupt:"); -#endif - if (inr !=2) - FDCS->reset = 1; - else if (ST0 & ST0_ECE) { - switch(DRS->track){ - case NEED_1_RECAL: -#ifdef DEBUGT - debugt("recal interrupt need 1 recal:"); -#endif - /* after a second recalibrate, we still haven't - * reached track 0. Probably no drive. Raise an - * error, as failing immediately might upset - * computers possessed by the Devil :-) */ - cont->error(); - cont->redo(); - return; - case NEED_2_RECAL: -#ifdef DEBUGT - debugt("recal interrupt need 2 recal:"); -#endif - /* If we already did a recalibrate, - * and we are not at track 0, this - * means we have moved. (The only way - * not to move at recalibration is to - * be already at track 0.) Clear the - * new change flag */ -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("clearing NEWCHANGE flag because of second recalibrate\n"); - } -#endif - - CLEARF(FD_DISK_NEWCHANGE); - DRS->select_date = jiffies; - /* fall through */ - default: -#ifdef DEBUGT - debugt("recal interrupt default:"); -#endif - /* Recalibrate moves the head by at - * most 80 steps. If after one - * recalibrate we don't have reached - * track 0, this might mean that we - * started beyond track 80. Try - * again. */ - DRS->track = NEED_1_RECAL; - break; - } - } else - DRS->track = ST1; - floppy_ready(); -} - -static void print_result(char *message, int inr) -{ - int i; - - DPRINT("%s ", message); - if (inr >= 0) - for (i=0; i= N_FDC || FDCS->address == -1){ - /* we don't even know which FDC is the culprit */ - printk("DOR0=%x\n", fdc_state[0].dor); - printk("floppy interrupt on bizarre fdc %d\n",fdc); - printk("handler=%p\n", handler); - is_alive("bizarre fdc"); - return IRQ_NONE; - } - - FDCS->reset = 0; - /* We have to clear the reset flag here, because apparently on boxes - * with level triggered interrupts (PS/2, Sparc, ...), it is needed to - * emit SENSEI's to clear the interrupt line. And FDCS->reset blocks the - * emission of the SENSEI's. - * It is OK to emit floppy commands because we are in an interrupt - * handler here, and thus we have to fear no interference of other - * activity. - */ - - do_print = !handler && print_unex && !initialising; - - inr = result(); - if (inr && do_print) - print_result("unexpected interrupt", inr); - if (inr == 0){ - do { - output_byte(FD_SENSEI); - inr = result(); - if ((ST0 & ST0_INTR) == 0xC0) { - int drive = ST0 & ST0_DS; - - /* Attention Interrupt. */ - if (ST0 & ST0_NR) { -#ifdef PC9800_DEBUG_FLOPPY - if (do_print) - printk(KERN_DEBUG - "floppy debug: floppy ejected (drive %d)\n", - drive); -#endif - USETF(FD_DISK_CHANGED); - USETF(FD_VERIFY); - } else { -#ifdef PC9800_DEBUG_FLOPPY - if (do_print) - printk(KERN_DEBUG - "floppy debug: floppy inserted (drive %d)\n", - drive); -#endif - } - } /* Attention Interrupt */ -#ifdef PC9800_DEBUG_FLOPPY - else { - printk(KERN_DEBUG - "floppy debug : unknown interrupt\n"); - } -#endif - } while ((ST0 & 0x83) != UNIT(current_drive) && inr == 2); - } - if (handler) { - schedule_bh(handler); - } else { -#if 0 - FDCS->reset = 1; -#endif - } - is_alive("normal interrupt end"); - - /* FIXME! Was it really for us? */ - return IRQ_HANDLED; -} - -static void recalibrate_floppy(void) -{ -#ifdef DEBUGT - debugt("recalibrate floppy:"); -#endif - do_floppy = recal_interrupt; - output_byte(FD_RECALIBRATE); - LAST_OUT(UNIT(current_drive)); -} - -/* - * Must do 4 FD_SENSEIs after reset because of ``drive polling''. - */ -static void reset_interrupt(void) -{ -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy debug: reset interrupt\n"); -#endif -#ifdef DEBUGT - debugt("reset interrupt:"); -#endif - result(); /* get the status ready for set_fdc */ - if (FDCS->reset) { - printk("reset set in interrupt, calling %p\n", cont->error); - cont->error(); /* a reset just after a reset. BAD! */ - } - cont->redo(); -} - -/* - * reset is done by pulling bit 2 of DOR low for a while (old FDCs), - * or by setting the self clearing bit 7 of STATUS (newer FDCs) - */ -static void reset_fdc(void) -{ - unsigned long flags; - -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy debug: reset_fdc\n"); -#endif - - do_floppy = reset_interrupt; - FDCS->reset = 0; - reset_fdc_info(0); - - /* Pseudo-DMA may intercept 'reset finished' interrupt. */ - /* Irrelevant for systems with true DMA (i386). */ - - flags=claim_dma_lock(); - fd_disable_dma(); - release_dma_lock(flags); - - fd_outb(FDCS->dor | 0x80, FD_MODE); - udelay(FD_RESET_DELAY); - fd_outb(FDCS->dor, FD_MODE); - udelay(FD_AFTER_RESET_DELAY); -} - -static void show_floppy(void) -{ - int i; - - printk("\n"); - printk("floppy driver state\n"); - printk("-------------------\n"); - printk("now=%lu last interrupt=%lu diff=%lu last called handler=%p\n", - jiffies, interruptjiffies, jiffies-interruptjiffies, lasthandler); - - -#ifdef FLOPPY_SANITY_CHECK - printk("timeout_message=%s\n", timeout_message); - printk("last output bytes:\n"); - for (i=0; i < OLOGSIZE; i++) - printk("%2x %2x %lu\n", - output_log[(i+output_log_pos) % OLOGSIZE].data, - output_log[(i+output_log_pos) % OLOGSIZE].status, - output_log[(i+output_log_pos) % OLOGSIZE].jiffies); - printk("last result at %lu\n", resultjiffies); - printk("last redo_fd_request at %lu\n", lastredo); - for (i=0; ireset = 1; - if (cont){ - cont->done(0); - cont->redo(); /* this will recall reset when needed */ - } else { - printk("no cont in shutdown!\n"); - process_fd_request(); - } - is_alive("floppy shutdown"); -} -/*typedef void (*timeout_fn)(unsigned long);*/ - -static void access_mode_change_pc9800(void) -{ - static int access_mode, mode_change_now, old_mode, new_set = 1; -#ifdef PC9800_DEBUG_FLOPPY2 - printk("enter access_mode_change\n"); -#endif - access_mode = mode_change_now = 0; - if (DP->cmos==4) { - switch ((int)(_floppy - &floppy_type[0])) { - case 1: - case 2: - new_set = 1; - access_mode = 2; - break; - - case 4: - case 6: - new_set = 1; - access_mode = 3; - break; - - case 7: - case 10: - new_set = 1; - access_mode = 1; - break; - - default: - access_mode = 1; - break; - } - - old_mode = fd_inb(FD_MODE_CHANGE) & 3; - - switch (access_mode) { - case 1: - if ((old_mode & 2) == 0) { - fd_outb(old_mode | 2, FD_MODE_CHANGE); - mode_change_now = 1; - } else { - fd_outb(current_drive << 5, FD_EMODE_CHANGE); - if (fd_inb(FD_EMODE_CHANGE) == 0xff) - return; - } - - fd_outb((current_drive << 5) | 0x11, FD_EMODE_CHANGE); - mode_change_now = 1; - break; - - case 2: - if ((old_mode & 2) == 0) { - fd_outb(old_mode | 2, FD_MODE_CHANGE); - mode_change_now = 1; - } else { - fd_outb(current_drive << 5, FD_EMODE_CHANGE); - if ((fd_inb(FD_EMODE_CHANGE) & 1) == 0) - return; - fd_outb((current_drive << 5) | 0x10, FD_EMODE_CHANGE); - mode_change_now = 1; - } - - break; - - case 3: - if ((old_mode & 2) == 0) - return; - fd_outb(current_drive << 5, FD_EMODE_CHANGE); - if (fd_inb(FD_EMODE_CHANGE) & 1) - fd_outb((current_drive << 5) | 0x10, FD_EMODE_CHANGE); - fd_outb(old_mode & 0xfd, FD_MODE_CHANGE); - mode_change_now = 1; - break; - - default: - break; - } - } else { - switch ((int)(_floppy - &floppy_type[0])) { - case 1: - case 2: - new_set = 1; - access_mode = 2; - break; - - case 4: - case 6: - new_set = 1; - access_mode = 3; - break; - - default: - switch (DP->cmos) { - case 2: - access_mode = 2; - break; - - case 3: - access_mode = 3; - break; - - default: - break; - } - - break; - } - - old_mode = fd_inb(FD_MODE_CHANGE) & 3; - - switch (access_mode) { - case 2: - if ((old_mode & 2) == 0) { - fd_outb(old_mode | 2, FD_MODE_CHANGE); - mode_change_now = 1; - } - - break; - - case 3: - if (old_mode & 2) { - fd_outb(old_mode & 0xfd, FD_MODE_CHANGE); - mode_change_now = 1; - } - - break; - - default: - break; - } - } -#ifdef PC9800_DEBUG_FLOPPY2 - printk("floppy debug: DP->cmos=%d\n", DP->cmos); - printk("floppy debug: mode_change_now=%d\n", mode_change_now); - printk("floppy debug: access_mode=%d\n", access_mode); - printk("floppy debug: old_mode=%d\n", old_mode); - printk("floppy debug: _floppy - &floppy_type[0]=%d\n", (int)(_floppy - &floppy_type[0])); -#endif /* PC9800_DEBUG_FLOPPY2 */ - if(mode_change_now) - reset_fdc(); -} - -/* start motor, check media-changed condition and write protection */ -static int start_motor(void (*function)(void) ) -{ - access_mode_change_pc9800(); - set_mode(~0, 0x8); - - /* wait_for_completion also schedules reset if needed. */ - return(fd_wait_for_completion(DRS->select_date+DP->select_delay, - (timeout_fn) function)); -} - -static void floppy_ready(void) -{ - CHECK_RESET; - if (start_motor(floppy_ready)) return; - -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("calling disk change from floppy_ready\n"); - } -#endif - if (!(raw_cmd->flags & FD_RAW_NO_MOTOR) && - disk_change(current_drive) && - !DP->select_delay) - twaddle(); /* this clears the dcl on certain drive/controller - * combinations */ - -#ifdef fd_chose_dma_mode - if ((raw_cmd->flags & FD_RAW_READ) || - (raw_cmd->flags & FD_RAW_WRITE)) - { - unsigned long flags = claim_dma_lock(); - fd_chose_dma_mode(raw_cmd->kernel_data, - raw_cmd->length); - release_dma_lock(flags); - } -#endif - -#if 0 - access_mode_change_pc9800(); -#endif - if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)){ - fdc_specify(); /* must be done here because of hut, hlt ... */ - seek_floppy(); - } else { - if ((raw_cmd->flags & FD_RAW_READ) || - (raw_cmd->flags & FD_RAW_WRITE)) - fdc_specify(); - setup_rw_floppy(); - } -} - -static void floppy_start(void) -{ - reschedule_timeout(current_reqD, "floppy start", 0); - - scandrives(); -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("setting NEWCHANGE in floppy_start\n"); - } -#endif - SETF(FD_DISK_NEWCHANGE); - floppy_ready(); -} - -/* - * ======================================================================== - * here ends the bottom half. Exported routines are: - * floppy_start, floppy_off, floppy_ready, lock_fdc, unlock_fdc, set_fdc, - * start_motor, reset_fdc, reset_fdc_info, interpret_errors. - * Initialization also uses output_byte, result, set_dor, floppy_interrupt - * and set_dor. - * ======================================================================== - */ -/* - * General purpose continuations. - * ============================== - */ - -static void do_wakeup(void) -{ - reschedule_timeout(MAXTIMEOUT, "do wakeup", 0); - cont = 0; - command_status += 2; - wake_up(&command_done); -} - -static struct cont_t wakeup_cont={ - empty, - do_wakeup, - empty, - (done_f)empty -}; - - -static struct cont_t intr_cont={ - empty, - process_fd_request, - empty, - (done_f) empty -}; - -static int wait_til_done(void (*handler)(void), int interruptible) -{ - int ret; - - schedule_bh((void *)(void *)handler); - - if (command_status < 2 && NO_SIGNAL) { - DECLARE_WAITQUEUE(wait, current); - - add_wait_queue(&command_done, &wait); - for (;;) { - set_current_state(interruptible? - TASK_INTERRUPTIBLE: - TASK_UNINTERRUPTIBLE); - - if (command_status >= 2 || !NO_SIGNAL) - break; - - is_alive("wait_til_done"); - - schedule(); - } - - set_current_state(TASK_RUNNING); - remove_wait_queue(&command_done, &wait); - } - - if (command_status < 2){ - cancel_activity(); - cont = &intr_cont; - reset_fdc(); - return -EINTR; - } - -#ifdef PC9800_DEBUG_FLOPPY - if (command_status != FD_COMMAND_OKAY) - printk("floppy check: wait_til_done out:%d\n", command_status); -#endif - if (FDCS->reset) - command_status = FD_COMMAND_ERROR; - if (command_status == FD_COMMAND_OKAY) - ret=0; - else - ret=-EIO; - command_status = FD_COMMAND_NONE; - return ret; -} - -static void generic_done(int result) -{ - command_status = result; - cont = &wakeup_cont; -} - -static void generic_success(void) -{ - cont->done(1); -} - -static void generic_failure(void) -{ - cont->done(0); -} - -static void success_and_wakeup(void) -{ - generic_success(); - cont->redo(); -} - - -/* - * formatting and rw support. - * ========================== - */ - -static int next_valid_format(void) -{ - int probed_format; - - probed_format = DRS->probed_format; - while(1){ - if (probed_format >= 8 || - !DP->autodetect[probed_format]){ - DRS->probed_format = 0; - return 1; - } - if (floppy_type[DP->autodetect[probed_format]].sect){ - DRS->probed_format = probed_format; - return 0; - } - probed_format++; - } -} - -static void bad_flp_intr(void) -{ - if (probing){ - DRS->probed_format++; - if (!next_valid_format()) - return; - } - (*errors)++; - INFBOUND(DRWE->badness, *errors); - if (*errors > DP->max_errors.abort) - cont->done(0); - if (*errors > DP->max_errors.reset) - FDCS->reset = 1; - else if (*errors > DP->max_errors.recal) - DRS->track = NEED_2_RECAL; -} - -static void set_floppy(int drive) -{ - int type = ITYPE(UDRS->fd_device); - if (type) { - auto_detect_mode = 0; - _floppy = floppy_type + type; - } else if (auto_detect_mode == 0) { - auto_detect_mode = 1; - retry_auto_detect = 0; - _floppy = current_type[drive]; - } -#ifdef PC9800_DEBUG_FLOPPY2 - printk("set_floppy: set floppy type=%d\n", (int)(_floppy - floppy_type)); -#endif -} - -/* - * formatting support. - * =================== - */ -static void format_interrupt(void) -{ - switch (interpret_errors()){ - case 1: - cont->error(); - case 2: - break; - case 0: - cont->done(1); - } - cont->redo(); -} - -#define CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2) -#define FM_MODE(x,y) ((y) & ~(((x)->rate & 0x80) >>1)) -#define CT(x) ((x) | 0xc0) -static void setup_format_params(int track) -{ - struct fparm { - unsigned char track,head,sect,size; - } *here = (struct fparm *)floppy_track_buffer; - int il,n; - int count,head_shift,track_shift; - - raw_cmd = &default_raw_cmd; - raw_cmd->track = track; - - raw_cmd->flags = FD_RAW_WRITE | FD_RAW_INTR | FD_RAW_SPIN | - FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK; - raw_cmd->rate = _floppy->rate & 0x43; - raw_cmd->cmd_count = NR_F; - COMMAND = FM_MODE(_floppy,FD_FORMAT); - DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy,format_req.head); - F_SIZECODE = FD_SIZECODE(_floppy); - F_SECT_PER_TRACK = _floppy->sect << 2 >> F_SIZECODE; - F_GAP = _floppy->fmt_gap; - F_FILL = FD_FILL_BYTE; - - raw_cmd->kernel_data = floppy_track_buffer; - raw_cmd->length = 4 * F_SECT_PER_TRACK; - - /* allow for about 30ms for data transport per track */ - head_shift = (F_SECT_PER_TRACK + 5) / 6; - - /* a ``cylinder'' is two tracks plus a little stepping time */ - track_shift = 2 * head_shift + 3; - - /* position of logical sector 1 on this track */ - n = (track_shift * format_req.track + head_shift * format_req.head) - % F_SECT_PER_TRACK; - - /* determine interleave */ - il = 1; - if (_floppy->fmt_gap < 0x22) - il++; - - /* initialize field */ - for (count = 0; count < F_SECT_PER_TRACK; ++count) { - here[count].track = format_req.track; - here[count].head = format_req.head; - here[count].sect = 0; - here[count].size = F_SIZECODE; - } - /* place logical sectors */ - for (count = 1; count <= F_SECT_PER_TRACK; ++count) { - here[n].sect = count; - n = (n+il) % F_SECT_PER_TRACK; - if (here[n].sect) { /* sector busy, find next free sector */ - ++n; - if (n>= F_SECT_PER_TRACK) { - n-=F_SECT_PER_TRACK; - while (here[n].sect) ++n; - } - } - } -} - -static void redo_format(void) -{ - buffer_track = -1; - setup_format_params(format_req.track << STRETCH(_floppy)); - floppy_start(); -#ifdef DEBUGT - debugt("queue format request"); -#endif -} - -static struct cont_t format_cont={ - format_interrupt, - redo_format, - bad_flp_intr, - generic_done }; - -static int do_format(int drive, struct format_descr *tmp_format_req) -{ - int ret; - - LOCK_FDC(drive,1); - set_floppy(drive); - if (!_floppy || - _floppy->track > DP->tracks || - tmp_format_req->track >= _floppy->track || - tmp_format_req->head >= _floppy->head || - (_floppy->sect << 2) % (1 << FD_SIZECODE(_floppy)) || - !_floppy->fmt_gap) { - process_fd_request(); - return -EINVAL; - } - format_req = *tmp_format_req; - format_errors = 0; - cont = &format_cont; - errors = &format_errors; - IWAIT(redo_format); - process_fd_request(); - return ret; -} - -/* - * Buffer read/write and support - * ============================= - */ - -static void floppy_end_request(struct request *req, int uptodate) -{ - if (end_that_request_first(req, uptodate, current_count_sectors)) - return; - add_disk_randomness(req->rq_disk); - floppy_off((long)req->rq_disk->private_data); - blkdev_dequeue_request(req); - end_that_request_last(req); - - /* We're done with the request */ - current_req = NULL; -} - - -/* new request_done. Can handle physical sectors which are smaller than a - * logical buffer */ -static void request_done(int uptodate) -{ - struct request_queue *q = floppy_queue; - struct request *req = current_req; - unsigned long flags; - int block; - - probing = 0; - reschedule_timeout(MAXTIMEOUT, "request done %d", uptodate); - - if (!req) { - printk("floppy.c: no request in request_done\n"); - return; - } - - if (uptodate){ - /* maintain values for invalidation on geometry - * change */ - block = current_count_sectors + req->sector; - INFBOUND(DRS->maxblock, block); - if (block > _floppy->sect) - DRS->maxtrack = 1; - - /* unlock chained buffers */ - spin_lock_irqsave(q->queue_lock, flags); - floppy_end_request(req, 1); - spin_unlock_irqrestore(q->queue_lock, flags); - } else { - if (rq_data_dir(req) == WRITE) { - /* record write error information */ - DRWE->write_errors++; - if (DRWE->write_errors == 1) { - DRWE->first_error_sector = req->sector; - DRWE->first_error_generation = DRS->generation; - } - DRWE->last_error_sector = req->sector; - DRWE->last_error_generation = DRS->generation; - } - spin_lock_irqsave(q->queue_lock, flags); - floppy_end_request(req, 0); - spin_unlock_irqrestore(q->queue_lock, flags); - } -} - -/* Interrupt handler evaluating the result of the r/w operation */ -static void rw_interrupt(void) -{ - int nr_sectors, ssize, eoc, heads; - - if (R_HEAD >= 2) { - /* some Toshiba floppy controllers occasionnally seem to - * return bogus interrupts after read/write operations, which - * can be recognized by a bad head number (>= 2) */ - return; - } - - if (!DRS->first_read_date) - DRS->first_read_date = jiffies; - - nr_sectors = 0; - CODE2SIZE; - - if (ST1 & ST1_EOC) - eoc = 1; - else - eoc = 0; - - if (COMMAND & 0x80) - heads = 2; - else - heads = 1; - - nr_sectors = (((R_TRACK-TRACK) * heads + - R_HEAD-HEAD) * SECT_PER_TRACK + - R_SECTOR-SECTOR + eoc) << SIZECODE >> 2; - -#ifdef FLOPPY_SANITY_CHECK - if (nr_sectors / ssize > - (in_sector_offset + current_count_sectors + ssize - 1) / ssize) { - DPRINT("long rw: %x instead of %lx\n", - nr_sectors, current_count_sectors); - printk("rs=%d s=%d\n", R_SECTOR, SECTOR); - printk("rh=%d h=%d\n", R_HEAD, HEAD); - printk("rt=%d t=%d\n", R_TRACK, TRACK); - printk("heads=%d eoc=%d\n", heads, eoc); - printk("spt=%d st=%d ss=%d\n", SECT_PER_TRACK, - fsector_t, ssize); - printk("in_sector_offset=%d\n", in_sector_offset); - } -#endif - - nr_sectors -= in_sector_offset; - INFBOUND(nr_sectors,0); - SUPBOUND(current_count_sectors, nr_sectors); - - switch (interpret_errors()){ - case 2: - cont->redo(); - return; - case 1: - if (!current_count_sectors){ - cont->error(); - cont->redo(); - return; - } - break; - case 0: - if (!current_count_sectors){ - cont->redo(); - return; - } - current_type[current_drive] = _floppy; - floppy_sizes[TOMINOR(current_drive) ]= _floppy->size; - break; - } - - if (probing) { - if (DP->flags & FTD_MSG) - DPRINT("Auto-detected floppy type %s in fd%d\n", - _floppy->name,current_drive); - current_type[current_drive] = _floppy; - floppy_sizes[TOMINOR(current_drive)] = _floppy->size; - probing = 0; - } - - if (CT(COMMAND) != FD_READ || - raw_cmd->kernel_data == current_req->buffer){ - /* transfer directly from buffer */ - cont->done(1); - } else if (CT(COMMAND) == FD_READ){ - buffer_track = raw_cmd->track; - buffer_drive = current_drive; - INFBOUND(buffer_max, nr_sectors + fsector_t); - } - cont->redo(); -} - -/* Compute maximal contiguous buffer size. */ -static int buffer_chain_size(void) -{ - struct bio *bio; - struct bio_vec *bv; - int size, i; - char *base; - - base = bio_data(current_req->bio); - size = 0; - - rq_for_each_bio(bio, current_req) { - bio_for_each_segment(bv, bio, i) { - if (page_address(bv->bv_page) + bv->bv_offset != base + size) - break; - - size += bv->bv_len; - } - } - - return size >> 9; -} - -/* Compute the maximal transfer size */ -static int transfer_size(int ssize, int max_sector, int max_size) -{ - SUPBOUND(max_sector, fsector_t + max_size); - - /* alignment */ - max_sector -= (max_sector % _floppy->sect) % ssize; - - /* transfer size, beginning not aligned */ - current_count_sectors = max_sector - fsector_t ; - - return max_sector; -} - -/* - * Move data from/to the track buffer to/from the buffer cache. - */ -static void copy_buffer(int ssize, int max_sector, int max_sector_2) -{ - int remaining; /* number of transferred 512-byte sectors */ - struct bio_vec *bv; - struct bio *bio; - char *buffer, *dma_buffer; - int size, i; - - max_sector = transfer_size(ssize, - minimum(max_sector, max_sector_2), - current_req->nr_sectors); - - if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE && - buffer_max > fsector_t + current_req->nr_sectors) - current_count_sectors = minimum(buffer_max - fsector_t, - current_req->nr_sectors); - - remaining = current_count_sectors << 9; -#ifdef FLOPPY_SANITY_CHECK - if ((remaining >> 9) > current_req->nr_sectors && - CT(COMMAND) == FD_WRITE){ - DPRINT("in copy buffer\n"); - printk("current_count_sectors=%ld\n", current_count_sectors); - printk("remaining=%d\n", remaining >> 9); - printk("current_req->nr_sectors=%ld\n",current_req->nr_sectors); - printk("current_req->current_nr_sectors=%u\n", - current_req->current_nr_sectors); - printk("max_sector=%d\n", max_sector); - printk("ssize=%d\n", ssize); - } -#endif - - buffer_max = maximum(max_sector, buffer_max); - - dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9); - - size = current_req->current_nr_sectors << 9; - - rq_for_each_bio(bio, current_req) { - bio_for_each_segment(bv, bio, i) { - if (!remaining) - break; - - size = bv->bv_len; - SUPBOUND(size, remaining); - - buffer = page_address(bv->bv_page) + bv->bv_offset; -#ifdef FLOPPY_SANITY_CHECK - if (dma_buffer + size > - floppy_track_buffer + (max_buffer_sectors << 10) || - dma_buffer < floppy_track_buffer){ - DPRINT("buffer overrun in copy buffer %d\n", - (int) ((floppy_track_buffer - dma_buffer) >>9)); - printk("fsector_t=%d buffer_min=%d\n", - fsector_t, buffer_min); - printk("current_count_sectors=%ld\n", - current_count_sectors); - if (CT(COMMAND) == FD_READ) - printk("read\n"); - if (CT(COMMAND) == FD_WRITE) - printk("write\n"); - break; - } - if (((unsigned long)buffer) % 512) - DPRINT("%p buffer not aligned\n", buffer); -#endif - if (CT(COMMAND) == FD_READ) - memcpy(buffer, dma_buffer, size); - else - memcpy(dma_buffer, buffer, size); - - remaining -= size; - dma_buffer += size; - } - } -#ifdef FLOPPY_SANITY_CHECK - if (remaining){ - if (remaining > 0) - max_sector -= remaining >> 9; - DPRINT("weirdness: remaining %d\n", remaining>>9); - } -#endif -} - -#if 0 -static inline int check_dma_crossing(char *start, - unsigned long length, char *message) -{ - if (CROSS_64KB(start, length)) { - printk("DMA xfer crosses 64KB boundary in %s %p-%p\n", - message, start, start+length); - return 1; - } else - return 0; -} -#endif - -/* work around a bug in pseudo DMA - * (on some FDCs) pseudo DMA does not stop when the CPU stops - * sending data. Hence we need a different way to signal the - * transfer length: We use SECT_PER_TRACK. Unfortunately, this - * does not work with MT, hence we can only transfer one head at - * a time - */ -static void virtualdmabug_workaround(void) -{ - int hard_sectors, end_sector; - - if(CT(COMMAND) == FD_WRITE) { - COMMAND &= ~0x80; /* switch off multiple track mode */ - - hard_sectors = raw_cmd->length >> (7 + SIZECODE); - end_sector = SECTOR + hard_sectors - 1; -#ifdef FLOPPY_SANITY_CHECK - if(end_sector > SECT_PER_TRACK) { - printk("too many sectors %d > %d\n", - end_sector, SECT_PER_TRACK); - return; - } -#endif - SECT_PER_TRACK = end_sector; /* make sure SECT_PER_TRACK points - * to end of transfer */ - } -} - -/* - * Formulate a read/write request. - * this routine decides where to load the data (directly to buffer, or to - * tmp floppy area), how much data to load (the size of the buffer, the whole - * track, or a single sector) - * All floppy_track_buffer handling goes in here. If we ever add track buffer - * allocation on the fly, it should be done here. No other part should need - * modification. - */ - -static int make_raw_rw_request(void) -{ - int aligned_sector_t; - int max_sector, max_size, tracksize, ssize; - - if(max_buffer_sectors == 0) { - printk("VFS: Block I/O scheduled on unopened device\n"); - return 0; - } - - set_fdc((long)current_req->rq_disk->private_data); - - raw_cmd = &default_raw_cmd; - raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_DISK | FD_RAW_NEED_DISK | - FD_RAW_NEED_SEEK; - raw_cmd->cmd_count = NR_RW; - if (rq_data_dir(current_req) == READ) { - raw_cmd->flags |= FD_RAW_READ; - COMMAND = FM_MODE(_floppy,FD_READ); - } else if (rq_data_dir(current_req) == WRITE){ - raw_cmd->flags |= FD_RAW_WRITE; - COMMAND = FM_MODE(_floppy,FD_WRITE); - } else { - DPRINT("make_raw_rw_request: unknown command\n"); - return 0; - } - - max_sector = _floppy->sect * _floppy->head; - - TRACK = (int)current_req->sector / max_sector; - fsector_t = (int)current_req->sector % max_sector; - if (_floppy->track && TRACK >= _floppy->track) { - if (current_req->current_nr_sectors & 1) { - current_count_sectors = 1; - return 1; - } else - return 0; - } - HEAD = fsector_t / _floppy->sect; - - if (((_floppy->stretch & FD_SWAPSIDES) || TESTF(FD_NEED_TWADDLE)) && - fsector_t < _floppy->sect) - max_sector = _floppy->sect; - - /* 2M disks have phantom sectors on the first track */ - if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){ - max_sector = 2 * _floppy->sect / 3; - if (fsector_t >= max_sector){ - current_count_sectors = minimum(_floppy->sect - fsector_t, - current_req->nr_sectors); - return 1; - } - SIZECODE = 2; - } else - SIZECODE = FD_SIZECODE(_floppy); - raw_cmd->rate = _floppy->rate & 0x43; - if ((_floppy->rate & FD_2M) && - (TRACK || HEAD) && - raw_cmd->rate == 2) - raw_cmd->rate = 1; - - if (SIZECODE) - SIZECODE2 = 0xff; - else - SIZECODE2 = 0x80; - raw_cmd->track = TRACK << STRETCH(_floppy); - DR_SELECT = UNIT(current_drive) + PH_HEAD(_floppy,HEAD); - GAP = _floppy->gap; - CODE2SIZE; - SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE; - SECTOR = ((fsector_t % _floppy->sect) << 2 >> SIZECODE) + 1; - - /* tracksize describes the size which can be filled up with sectors - * of size ssize. - */ - tracksize = _floppy->sect - _floppy->sect % ssize; - if (tracksize < _floppy->sect){ - SECT_PER_TRACK ++; - if (tracksize <= fsector_t % _floppy->sect) - SECTOR--; - - /* if we are beyond tracksize, fill up using smaller sectors */ - while (tracksize <= fsector_t % _floppy->sect){ - while(tracksize + ssize > _floppy->sect){ - SIZECODE--; - ssize >>= 1; - } - SECTOR++; SECT_PER_TRACK ++; - tracksize += ssize; - } - max_sector = HEAD * _floppy->sect + tracksize; - } else if (!TRACK && !HEAD && !(_floppy->rate & FD_2M) && probing) { - max_sector = _floppy->sect; - } else if (!HEAD && CT(COMMAND) == FD_WRITE) { - /* for virtual DMA bug workaround */ - max_sector = _floppy->sect; - } - - in_sector_offset = (fsector_t % _floppy->sect) % ssize; - aligned_sector_t = fsector_t - in_sector_offset; - max_size = current_req->nr_sectors; - if ((raw_cmd->track == buffer_track) && - (current_drive == buffer_drive) && - (fsector_t >= buffer_min) && (fsector_t < buffer_max)) { - /* data already in track buffer */ - if (CT(COMMAND) == FD_READ) { - copy_buffer(1, max_sector, buffer_max); - return 1; - } - } else if (in_sector_offset || current_req->nr_sectors < ssize){ - if (CT(COMMAND) == FD_WRITE){ - if (fsector_t + current_req->nr_sectors > ssize && - fsector_t + current_req->nr_sectors < ssize + ssize) - max_size = ssize + ssize; - else - max_size = ssize; - } - raw_cmd->flags &= ~FD_RAW_WRITE; - raw_cmd->flags |= FD_RAW_READ; - COMMAND = FM_MODE(_floppy,FD_READ); - } else if ((unsigned long)current_req->buffer < MAX_DMA_ADDRESS) { - unsigned long dma_limit; - int direct, indirect; - - indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) - - fsector_t; - - /* - * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide - * on a 64 bit machine! - */ - max_size = buffer_chain_size(); - dma_limit = (MAX_DMA_ADDRESS - ((unsigned long) current_req->buffer)) >> 9; - if ((unsigned long) max_size > dma_limit) { - max_size = dma_limit; - } - /* 64 kb boundaries */ - if (CROSS_64KB(current_req->buffer, max_size << 9)) - max_size = (K_64 - - ((unsigned long)current_req->buffer) % K_64)>>9; - direct = transfer_size(ssize,max_sector,max_size) - fsector_t; - /* - * We try to read tracks, but if we get too many errors, we - * go back to reading just one sector at a time. - * - * This means we should be able to read a sector even if there - * are other bad sectors on this track. - */ - if (!direct || - (indirect * 2 > direct * 3 && - *errors < DP->max_errors.read_track && - /*!TESTF(FD_NEED_TWADDLE) &&*/ - ((!probing || (DP->read_track&(1<probed_format)))))){ - max_size = current_req->nr_sectors; - } else { - raw_cmd->kernel_data = current_req->buffer; - raw_cmd->length = current_count_sectors << 9; - if (raw_cmd->length == 0){ - DPRINT("zero dma transfer attempted from make_raw_request\n"); - DPRINT("indirect=%d direct=%d fsector_t=%d", - indirect, direct, fsector_t); - return 0; - } -/* check_dma_crossing(raw_cmd->kernel_data, - raw_cmd->length, - "end of make_raw_request [1]");*/ - - virtualdmabug_workaround(); - return 2; - } - } - - if (CT(COMMAND) == FD_READ) - max_size = max_sector; /* unbounded */ - - /* claim buffer track if needed */ - if (buffer_track != raw_cmd->track || /* bad track */ - buffer_drive !=current_drive || /* bad drive */ - fsector_t > buffer_max || - fsector_t < buffer_min || - ((CT(COMMAND) == FD_READ || - (!in_sector_offset && current_req->nr_sectors >= ssize))&& - max_sector > 2 * max_buffer_sectors + buffer_min && - max_size + fsector_t > 2 * max_buffer_sectors + buffer_min) - /* not enough space */){ - buffer_track = -1; - buffer_drive = current_drive; - buffer_max = buffer_min = aligned_sector_t; - } - raw_cmd->kernel_data = floppy_track_buffer + - ((aligned_sector_t-buffer_min)<<9); - - if (CT(COMMAND) == FD_WRITE){ - /* copy write buffer to track buffer. - * if we get here, we know that the write - * is either aligned or the data already in the buffer - * (buffer will be overwritten) */ -#ifdef FLOPPY_SANITY_CHECK - if (in_sector_offset && buffer_track == -1) - DPRINT("internal error offset !=0 on write\n"); -#endif - buffer_track = raw_cmd->track; - buffer_drive = current_drive; - copy_buffer(ssize, max_sector, 2*max_buffer_sectors+buffer_min); - } else - transfer_size(ssize, max_sector, - 2*max_buffer_sectors+buffer_min-aligned_sector_t); - - /* round up current_count_sectors to get dma xfer size */ - raw_cmd->length = in_sector_offset+current_count_sectors; - raw_cmd->length = ((raw_cmd->length -1)|(ssize-1))+1; - raw_cmd->length <<= 9; -#ifdef FLOPPY_SANITY_CHECK - /*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length, - "end of make_raw_request");*/ - if ((raw_cmd->length < current_count_sectors << 9) || - (raw_cmd->kernel_data != current_req->buffer && - CT(COMMAND) == FD_WRITE && - (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max || - aligned_sector_t < buffer_min)) || - raw_cmd->length % (128 << SIZECODE) || - raw_cmd->length <= 0 || current_count_sectors <= 0){ - DPRINT("fractionary current count b=%lx s=%lx\n", - raw_cmd->length, current_count_sectors); - if (raw_cmd->kernel_data != current_req->buffer) - printk("addr=%d, length=%ld\n", - (int) ((raw_cmd->kernel_data - - floppy_track_buffer) >> 9), - current_count_sectors); - printk("st=%d ast=%d mse=%d msi=%d\n", - fsector_t, aligned_sector_t, max_sector, max_size); - printk("ssize=%x SIZECODE=%d\n", ssize, SIZECODE); - printk("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n", - COMMAND, SECTOR, HEAD, TRACK); - printk("buffer drive=%d\n", buffer_drive); - printk("buffer track=%d\n", buffer_track); - printk("buffer_min=%d\n", buffer_min); - printk("buffer_max=%d\n", buffer_max); - return 0; - } - - if (raw_cmd->kernel_data != current_req->buffer){ - if (raw_cmd->kernel_data < floppy_track_buffer || - current_count_sectors < 0 || - raw_cmd->length < 0 || - raw_cmd->kernel_data + raw_cmd->length > - floppy_track_buffer + (max_buffer_sectors << 10)){ - DPRINT("buffer overrun in schedule dma\n"); - printk("fsector_t=%d buffer_min=%d current_count=%ld\n", - fsector_t, buffer_min, - raw_cmd->length >> 9); - printk("current_count_sectors=%ld\n", - current_count_sectors); - if (CT(COMMAND) == FD_READ) - printk("read\n"); - if (CT(COMMAND) == FD_WRITE) - printk("write\n"); - return 0; - } - } else if (raw_cmd->length > current_req->nr_sectors << 9 || - current_count_sectors > current_req->nr_sectors){ - DPRINT("buffer overrun in direct transfer\n"); - return 0; - } else if (raw_cmd->length < current_count_sectors << 9){ - DPRINT("more sectors than bytes\n"); - printk("bytes=%ld\n", raw_cmd->length >> 9); - printk("sectors=%ld\n", current_count_sectors); - } - if (raw_cmd->length == 0){ - DPRINT("zero dma transfer attempted from make_raw_request\n"); - return 0; - } -#endif - - virtualdmabug_workaround(); - return 2; -} - -static void redo_fd_request(void) -{ -#define REPEAT {request_done(0); continue; } - int drive; - int tmp; - - lastredo = jiffies; - if (current_drive < N_DRIVE) - floppy_off(current_drive); - - for (;;) { - if (!current_req) { - struct request *req; - - spin_lock_irq(floppy_queue->queue_lock); - req = elv_next_request(floppy_queue); - spin_unlock_irq(floppy_queue->queue_lock); - if (!req) { - do_floppy = NULL; - unlock_fdc(); - return; - } - current_req = req; - } - drive = (long)current_req->rq_disk->private_data; - set_fdc(drive); - reschedule_timeout(current_reqD, "redo fd request", 0); - - set_floppy(drive); - raw_cmd = & default_raw_cmd; - raw_cmd->flags = 0; - if (start_motor(redo_fd_request)) return; - disk_change(current_drive); - if (test_bit(current_drive, &fake_change) || - TESTF(FD_DISK_CHANGED)){ - DPRINT("disk absent or changed during operation\n"); - REPEAT; - } - if (!_floppy) { /* Autodetection */ - if (!probing){ - DRS->probed_format = 0; - if (next_valid_format()){ - DPRINT("no autodetectable formats\n"); - _floppy = NULL; - REPEAT; - } - } - probing = 1; - _floppy = floppy_type+DP->autodetect[DRS->probed_format]; - } else - probing = 0; - errors = & (current_req->errors); - tmp = make_raw_rw_request(); - if (tmp < 2){ - request_done(tmp); - continue; - } - - if (TESTF(FD_NEED_TWADDLE)) - twaddle(); - schedule_bh( (void *)(void *) floppy_start); -#ifdef DEBUGT - debugt("queue fd request"); -#endif - return; - } -#undef REPEAT -} - -static struct cont_t rw_cont={ - rw_interrupt, - redo_fd_request, - bad_flp_intr, - request_done }; - -static void process_fd_request(void) -{ - cont = &rw_cont; - schedule_bh( (void *)(void *) redo_fd_request); -} - -static void do_fd_request(request_queue_t * q) -{ - if(max_buffer_sectors == 0) { - printk("VFS: do_fd_request called on non-open device\n"); - return; - } - - if (usage_count == 0) { - printk("warning: usage count=0, current_req=%p exiting\n", current_req); - printk("sect=%ld flags=%lx\n", (long)current_req->sector, current_req->flags); - return; - } - if (fdc_busy){ - /* fdc busy, this new request will be treated when the - current one is done */ - is_alive("do fd request, old request running"); - return; - } - lock_fdc(MAXTIMEOUT,0); - process_fd_request(); - is_alive("do fd request"); -} - -static struct cont_t poll_cont={ - success_and_wakeup, - floppy_ready, - generic_failure, - generic_done }; - -static int poll_drive(int interruptible, int flag) -{ - int ret; - /* no auto-sense, just clear dcl */ - raw_cmd = &default_raw_cmd; - raw_cmd->flags= flag; - raw_cmd->track=0; - raw_cmd->cmd_count=0; - cont = &poll_cont; -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("setting NEWCHANGE in poll_drive\n"); - } -#endif - SETF(FD_DISK_NEWCHANGE); - WAIT(floppy_ready); - return ret; -} - -/* - * User triggered reset - * ==================== - */ - -static void reset_intr(void) -{ - printk("weird, reset interrupt called\n"); -} - -static struct cont_t reset_cont={ - reset_intr, - success_and_wakeup, - generic_failure, - generic_done }; - -static int user_reset_fdc(int drive, int arg, int interruptible) -{ - int ret; - - ret=0; - LOCK_FDC(drive,interruptible); - if (arg == FD_RESET_ALWAYS) - FDCS->reset=1; - if (FDCS->reset){ - cont = &reset_cont; - WAIT(reset_fdc); - } - process_fd_request(); - return ret; -} - -/* - * Misc Ioctl's and support - * ======================== - */ -static inline int fd_copyout(void *param, const void *address, unsigned long size) -{ - return copy_to_user(param,address, size) ? -EFAULT : 0; -} - -static inline int fd_copyin(void *param, void *address, unsigned long size) -{ - return copy_from_user(address, param, size) ? -EFAULT : 0; -} - -#define _COPYOUT(x) (copy_to_user((void *)param, &(x), sizeof(x)) ? -EFAULT : 0) -#define _COPYIN(x) (copy_from_user(&(x), (void *)param, sizeof(x)) ? -EFAULT : 0) - -#define COPYOUT(x) ECALL(_COPYOUT(x)) -#define COPYIN(x) ECALL(_COPYIN(x)) - -static inline const char *drive_name(int type, int drive) -{ - struct floppy_struct *floppy; - - if (type) - floppy = floppy_type + type; - else { - if (UDP->native_format) - floppy = floppy_type + UDP->native_format; - else - return "(null)"; - } - if (floppy->name) - return floppy->name; - else - return "(null)"; -} - - -/* raw commands */ -static void raw_cmd_done(int flag) -{ - int i; - - if (!flag) { - raw_cmd->flags |= FD_RAW_FAILURE; - raw_cmd->flags |= FD_RAW_HARDFAILURE; - } else { - raw_cmd->reply_count = inr; - if (raw_cmd->reply_count > MAX_REPLIES) - raw_cmd->reply_count=0; - for (i=0; i< raw_cmd->reply_count; i++) - raw_cmd->reply[i] = reply_buffer[i]; - - if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE)) - { - unsigned long flags; - flags=claim_dma_lock(); - raw_cmd->length = fd_get_dma_residue(); - release_dma_lock(flags); - } - - if ((raw_cmd->flags & FD_RAW_SOFTFAILURE) && - (!raw_cmd->reply_count || (raw_cmd->reply[0] & 0xc0))) - raw_cmd->flags |= FD_RAW_FAILURE; - - if (disk_change(current_drive)) - raw_cmd->flags |= FD_RAW_DISK_CHANGE; - else - raw_cmd->flags &= ~FD_RAW_DISK_CHANGE; - if (raw_cmd->flags & FD_RAW_NO_MOTOR_AFTER) - motor_off_callback(current_drive); - - if (raw_cmd->next && - (!(raw_cmd->flags & FD_RAW_FAILURE) || - !(raw_cmd->flags & FD_RAW_STOP_IF_FAILURE)) && - ((raw_cmd->flags & FD_RAW_FAILURE) || - !(raw_cmd->flags &FD_RAW_STOP_IF_SUCCESS))) { - raw_cmd = raw_cmd->next; - return; - } - } - generic_done(flag); -} - - -static struct cont_t raw_cmd_cont={ - success_and_wakeup, - floppy_start, - generic_failure, - raw_cmd_done -}; - -static inline int raw_cmd_copyout(int cmd, char *param, - struct floppy_raw_cmd *ptr) -{ - int ret; - - while(ptr) { - COPYOUT(*ptr); - param += sizeof(struct floppy_raw_cmd); - if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length){ - if (ptr->length>=0 && ptr->length<=ptr->buffer_length) - ECALL(fd_copyout(ptr->data, - ptr->kernel_data, - ptr->buffer_length - - ptr->length)); - } - ptr = ptr->next; - } - return 0; -} - - -static void raw_cmd_free(struct floppy_raw_cmd **ptr) -{ - struct floppy_raw_cmd *next,*this; - - this = *ptr; - *ptr = 0; - while(this) { - if (this->buffer_length) { - fd_dma_mem_free((unsigned long)this->kernel_data, - this->buffer_length); - this->buffer_length = 0; - } - next = this->next; - kfree(this); - this = next; - } -} - - -static inline int raw_cmd_copyin(int cmd, char *param, - struct floppy_raw_cmd **rcmd) -{ - struct floppy_raw_cmd *ptr; - int ret; - int i; - - *rcmd = 0; - while(1) { - ptr = (struct floppy_raw_cmd *) - kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER); - if (!ptr) - return -ENOMEM; - *rcmd = ptr; - COPYIN(*ptr); - ptr->next = 0; - ptr->buffer_length = 0; - param += sizeof(struct floppy_raw_cmd); - if (ptr->cmd_count > 33) - /* the command may now also take up the space - * initially intended for the reply & the - * reply count. Needed for long 82078 commands - * such as RESTORE, which takes ... 17 command - * bytes. Murphy's law #137: When you reserve - * 16 bytes for a structure, you'll one day - * discover that you really need 17... - */ - return -EINVAL; - - for (i=0; i< 16; i++) - ptr->reply[i] = 0; - ptr->resultcode = 0; - ptr->kernel_data = 0; - - if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { - if (ptr->length <= 0) - return -EINVAL; - ptr->kernel_data =(char*)fd_dma_mem_alloc(ptr->length); - fallback_on_nodma_alloc(&ptr->kernel_data, - ptr->length); - if (!ptr->kernel_data) - return -ENOMEM; - ptr->buffer_length = ptr->length; - } - if (ptr->flags & FD_RAW_WRITE) - ECALL(fd_copyin(ptr->data, ptr->kernel_data, - ptr->length)); - rcmd = & (ptr->next); - if (!(ptr->flags & FD_RAW_MORE)) - return 0; - ptr->rate &= 0x43; - } -} - - -static int raw_cmd_ioctl(int cmd, void *param) -{ - int drive, ret, ret2; - struct floppy_raw_cmd *my_raw_cmd; - - if (FDCS->rawcmd <= 1) - FDCS->rawcmd = 1; - for (drive= 0; drive < N_DRIVE; drive++){ - if (FDC(drive) != fdc) - continue; - if (drive == current_drive){ - if (UDRS->fd_ref > 1){ - FDCS->rawcmd = 2; - break; - } - } else if (UDRS->fd_ref){ - FDCS->rawcmd = 2; - break; - } - } - - if (FDCS->reset) - return -EIO; - - ret = raw_cmd_copyin(cmd, param, &my_raw_cmd); - if (ret) { - raw_cmd_free(&my_raw_cmd); - return ret; - } - - raw_cmd = my_raw_cmd; - cont = &raw_cmd_cont; - ret=wait_til_done(floppy_start,1); -#ifdef DCL_DEBUG - if (DP->flags & FD_DEBUG){ - DPRINT("calling disk change from raw_cmd ioctl\n"); - } -#endif - - if (ret != -EINTR && FDCS->reset) - ret = -EIO; - - DRS->track = NO_TRACK; - - ret2 = raw_cmd_copyout(cmd, param, my_raw_cmd); - if (!ret) - ret = ret2; - raw_cmd_free(&my_raw_cmd); - return ret; -} - -static int invalidate_drive(struct block_device *bdev) -{ - /* invalidate the buffer track to force a reread */ - set_bit((long)bdev->bd_disk->private_data, &fake_change); - process_fd_request(); - check_disk_change(bdev); - return 0; -} - - -static inline void clear_write_error(int drive) -{ - CLEARSTRUCT(UDRWE); -} - -static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, - int drive, int type, struct block_device *bdev) -{ - int cnt; - - /* sanity checking for parameters.*/ - if (g->sect <= 0 || - g->head <= 0 || - g->track <= 0 || - g->track > UDP->tracks>>STRETCH(g) || - /* check if reserved bits are set */ - (g->stretch&~(FD_STRETCH|FD_SWAPSIDES)) != 0) - return -EINVAL; - if (type){ - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - down(&open_lock); - LOCK_FDC(drive,1); - floppy_type[type] = *g; - floppy_type[type].name="user format"; - for (cnt = type << 2; cnt < (type << 2) + 4; cnt++) - floppy_sizes[cnt]= floppy_sizes[cnt+0x80]= - floppy_type[type].size+1; - process_fd_request(); - for (cnt = 0; cnt < N_DRIVE; cnt++) { - struct block_device *bdev = opened_bdev[cnt]; - if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) - continue; - __invalidate_device(bdev, 0); - } - up(&open_lock); - } else { - LOCK_FDC(drive,1); - if (cmd != FDDEFPRM) - /* notice a disk change immediately, else - * we lose our settings immediately*/ - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - user_params[drive] = *g; - if (buffer_drive == drive) - SUPBOUND(buffer_max, user_params[drive].sect); - current_type[drive] = &user_params[drive]; - floppy_sizes[drive] = user_params[drive].size; - if (cmd == FDDEFPRM) - DRS->keep_data = -1; - else - DRS->keep_data = 1; - /* invalidation. Invalidate only when needed, i.e. - * when there are already sectors in the buffer cache - * whose number will change. This is useful, because - * mtools often changes the geometry of the disk after - * looking at the boot block */ - if (DRS->maxblock > user_params[drive].sect || DRS->maxtrack) - invalidate_drive(bdev); - else - process_fd_request(); - } - return 0; -} - -/* handle obsolete ioctl's */ -static int ioctl_table[]= { - FDCLRPRM, - FDSETPRM, - FDDEFPRM, - FDGETPRM, - FDMSGON, - FDMSGOFF, - FDFMTBEG, - FDFMTTRK, - FDFMTEND, - FDSETEMSGTRESH, - FDFLUSH, - FDSETMAXERRS, - FDGETMAXERRS, - FDGETDRVTYP, - FDSETDRVPRM, - FDGETDRVPRM, - FDGETDRVSTAT, - FDPOLLDRVSTAT, - FDRESET, - FDGETFDCSTAT, - FDWERRORCLR, - FDWERRORGET, - FDRAWCMD, - FDEJECT, - FDTWADDLE -}; - -static inline int normalize_ioctl(int *cmd, int *size) -{ - int i; - - for (i=0; i < ARRAY_SIZE(ioctl_table); i++) { - if ((*cmd & 0xffff) == (ioctl_table[i] & 0xffff)){ - *size = _IOC_SIZE(*cmd); - *cmd = ioctl_table[i]; - if (*size > _IOC_SIZE(*cmd)) { - printk("ioctl not yet supported\n"); - return -EFAULT; - } - return 0; - } - } - return -EINVAL; -} - -static int get_floppy_geometry(int drive, int type, struct floppy_struct **g) -{ - if (type) - *g = &floppy_type[type]; - else { - LOCK_FDC(drive,0); - CALL(poll_drive(0,0)); - process_fd_request(); - *g = current_type[drive]; - } - if (!*g) - return -ENODEV; - return 0; -} - -static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long param) -{ -#define FD_IOCTL_ALLOWED ((filp) && (filp)->private_data) -#define OUT(c,x) case c: outparam = (const char *) (x); break -#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 - - int drive = (long)inode->i_bdev->bd_disk->private_data; - int i, type = ITYPE(UDRS->fd_device); - int ret; - int size; - union inparam { - struct floppy_struct g; /* geometry */ - struct format_descr f; - struct floppy_max_errors max_errors; - struct floppy_drive_params dp; - } inparam; /* parameters coming from user space */ - const char *outparam; /* parameters passed back to user space */ - - /* convert compatibility eject ioctls into floppy eject ioctl. - * We do this in order to provide a means to eject floppy disks before - * installing the new fdutils package */ - if (cmd == CDROMEJECT || /* CD-ROM eject */ - cmd == 0x6470 /* SunOS floppy eject */) { - DPRINT("obsolete eject ioctl\n"); - DPRINT("please use floppycontrol --eject\n"); - cmd = FDEJECT; - } - - /* generic block device ioctls */ - switch(cmd) { - /* the following have been inspired by the corresponding - * code for other block devices. */ - struct floppy_struct *g; - case HDIO_GETGEO: - { - struct hd_geometry loc; - ECALL(get_floppy_geometry(drive, type, &g)); - loc.heads = g->head; - loc.sectors = g->sect; - loc.cylinders = g->track; - loc.start = 0; - return _COPYOUT(loc); - } - } - - /* convert the old style command into a new style command */ - if ((cmd & 0xff00) == 0x0200) { - ECALL(normalize_ioctl(&cmd, &size)); - } else - return -EINVAL; - - /* permission checks */ - if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) || - ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))) - return -EPERM; - - /* copyin */ - CLEARSTRUCT(&inparam); - if (_IOC_DIR(cmd) & _IOC_WRITE) - ECALL(fd_copyin((void *)param, &inparam, size)) - - switch (cmd) { - case FDEJECT: - if (UDRS->fd_ref != 1) - /* somebody else has this drive open */ - return -EBUSY; - LOCK_FDC(drive,1); - - /* do the actual eject. Fails on - * non-Sparc architectures */ - ret=fd_eject(UNIT(drive)); - - USETF(FD_DISK_CHANGED); - USETF(FD_VERIFY); - process_fd_request(); - return ret; - case FDCLRPRM: - LOCK_FDC(drive,1); - current_type[drive] = NULL; - floppy_sizes[drive] = MAX_DISK_SIZE << 1; - UDRS->keep_data = 0; - return invalidate_drive(inode->i_bdev); - case FDSETPRM: - case FDDEFPRM: - return set_geometry(cmd, & inparam.g, - drive, type, inode->i_bdev); - case FDGETPRM: - ECALL(get_floppy_geometry(drive, type, - (struct floppy_struct**) - &outparam)); - break; - - case FDMSGON: - UDP->flags |= FTD_MSG; - return 0; - case FDMSGOFF: - UDP->flags &= ~FTD_MSG; - return 0; - - case FDFMTBEG: - LOCK_FDC(drive,1); - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - if (ret & FD_VERIFY) { - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - } - - if (ret & FD_VERIFY) { - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - } - - if (ret & FD_VERIFY) { - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - } - - if (ret & FD_VERIFY) { - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - } - - if(ret & FD_VERIFY){ - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - ret = UDRS->flags; - } - process_fd_request(); - if (ret & FD_VERIFY) - return -ENODEV; - if (!(ret & FD_DISK_WRITABLE)) - return -EROFS; - return 0; - case FDFMTTRK: - if (UDRS->fd_ref != 1) - return -EBUSY; - return do_format(drive, &inparam.f); - case FDFMTEND: - case FDFLUSH: - LOCK_FDC(drive,1); - return invalidate_drive(inode->i_bdev); - - case FDSETEMSGTRESH: - UDP->max_errors.reporting = - (unsigned short) (param & 0x0f); - return 0; - OUT(FDGETMAXERRS, &UDP->max_errors); - IN(FDSETMAXERRS, &UDP->max_errors, max_errors); - - case FDGETDRVTYP: - outparam = drive_name(type,drive); - SUPBOUND(size,strlen(outparam)+1); - break; - - IN(FDSETDRVPRM, UDP, dp); - OUT(FDGETDRVPRM, UDP); - - case FDPOLLDRVSTAT: - LOCK_FDC(drive,1); - CALL(poll_drive(1, FD_RAW_NEED_DISK)); - process_fd_request(); - /* fall through */ - OUT(FDGETDRVSTAT, UDRS); - - case FDRESET: - return user_reset_fdc(drive, (int)param, 1); - - OUT(FDGETFDCSTAT,UFDCS); - - case FDWERRORCLR: - CLEARSTRUCT(UDRWE); - return 0; - OUT(FDWERRORGET,UDRWE); - - case FDRAWCMD: - if (type) - return -EINVAL; - LOCK_FDC(drive,1); - set_floppy(drive); - CALL(i = raw_cmd_ioctl(cmd,(void *) param)); - process_fd_request(); - return i; - - case FDTWADDLE: - LOCK_FDC(drive,1); - twaddle(); - process_fd_request(); - return 0; - - default: - return -EINVAL; - } - - if (_IOC_DIR(cmd) & _IOC_READ) - return fd_copyout((void *)param, outparam, size); - else - return 0; -#undef OUT -#undef IN -} - -static void __init config_types(void) -{ - int first=1; - int drive; - extern struct fd_info { - unsigned char dummy[4 * 6]; - unsigned char fd_types[8]; - } drive_info; - - for (drive = 0; drive < 4; drive++) - UDP->cmos = drive_info.fd_types[drive]; - - /* XXX */ - /* additional physical CMOS drive detection should go here */ - - for (drive=0; drive < N_DRIVE; drive++){ - unsigned int type = UDP->cmos; - struct floppy_drive_params *params; - const char *name = NULL; - static char temparea[32]; - - if (type < NUMBER(default_drive_params)) { - params = &default_drive_params[type].params; - if (type) { - name = default_drive_params[type].name; - allowed_drive_mask |= 1 << drive; - } - else - allowed_drive_mask &= ~(1 << drive); - } else { - params = &default_drive_params[0].params; - sprintf(temparea, "unknown type %d (usb?)", type); - name = temparea; - } - if (name) { - const char * prepend = ","; - if (first) { - prepend = KERN_INFO "Floppy drive(s):"; - first = 0; - } - printk("%s fd%d is %s", prepend, drive, name); - register_devfs_entries (drive); - } - *UDP = *params; - } - if (!first) - printk("\n"); -} - -static int floppy_release(struct inode * inode, struct file * filp) -{ - int drive = (long)inode->i_bdev->bd_disk->private_data; - - down(&open_lock); - if (UDRS->fd_ref < 0) - UDRS->fd_ref=0; - else if (!UDRS->fd_ref--) { - DPRINT("floppy_release with fd_ref == 0"); - UDRS->fd_ref = 0; - } - if (!UDRS->fd_ref) - opened_bdev[drive] = NULL; - floppy_release_irq_and_dma(); - up(&open_lock); - return 0; -} - -/* - * floppy_open check for aliasing (/dev/fd0 can be the same as - * /dev/PS0 etc), and disallows simultaneous access to the same - * drive with different device numbers. - */ -#define RETERR(x) do{floppy_release(inode,filp); return -(x);}while(0) - -static int floppy_open(struct inode * inode, struct file * filp) -{ - int drive = (long)inode->i_bdev->bd_disk->private_data; - int old_dev; - int try; - int res = -EBUSY; - char *tmp; - -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy open: start\n"); -#endif - filp->private_data = (void*) 0; - -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy open: drive=%d, current_drive=%d, UDP->cmos=%d\n" - "floppy open: FDCS={spec1=%d, spec2=%d, dtr=%d, version=%d, dor=%d, address=%lu}\n", - drive, current_drive, UDP->cmos, FDCS->spec1, FDCS->spec2, - FDCS->dtr, FDCS->version, FDCS->dor, FDCS->address); - if (_floppy) { - printk("floppy open: _floppy={size=%d, sect=%d, head=%d, track=%d, spec1=%d}\n", - _floppy->size, _floppy->sect, _floppy->head, - _floppy->track, _floppy->spec1); - } else { - printk("floppy open: _floppy=NULL\n"); - } -#endif /* PC9800_DEBUG_FLOPPY */ - - down(&open_lock); - old_dev = UDRS->fd_device; - if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) - goto out2; - - if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)){ - USETF(FD_DISK_CHANGED); - USETF(FD_VERIFY); - } - - if (UDRS->fd_ref == -1 || - (UDRS->fd_ref && (filp->f_flags & O_EXCL))) - goto out2; - - if (floppy_grab_irq_and_dma()) - goto out2; - - if (filp->f_flags & O_EXCL) - UDRS->fd_ref = -1; - else - UDRS->fd_ref++; - - opened_bdev[drive] = inode->i_bdev; - - res = -ENXIO; - - if (!floppy_track_buffer){ - /* if opening an ED drive, reserve a big buffer, - * else reserve a small one */ - if ((UDP->cmos == 6) || (UDP->cmos == 5)) - try = 64; /* Only 48 actually useful */ - else - try = 32; /* Only 24 actually useful */ - - tmp=(char *)fd_dma_mem_alloc(1024 * try); - if (!tmp && !floppy_track_buffer) { - try >>= 1; /* buffer only one side */ - INFBOUND(try, 16); - tmp= (char *)fd_dma_mem_alloc(1024*try); - } - if (!tmp && !floppy_track_buffer) { - fallback_on_nodma_alloc(&tmp, 2048 * try); - } - if (!tmp && !floppy_track_buffer) { - DPRINT("Unable to allocate DMA memory\n"); - goto out; - } - if (floppy_track_buffer) { - if (tmp) - fd_dma_mem_free((unsigned long)tmp,try*1024); - } else { - buffer_min = buffer_max = -1; - floppy_track_buffer = tmp; - max_buffer_sectors = try; - } - } - - UDRS->fd_device = iminor(inode); - set_capacity(disks[drive], floppy_sizes[iminor(inode)]); - if (old_dev != -1 && old_dev != iminor(inode)) { - if (buffer_drive == drive) - buffer_track = -1; - } - -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy open: floppy.c:%d passed\n", __LINE__); -#endif - - - /* Allow ioctls if we have write-permissions even if read-only open. - * Needed so that programs such as fdrawcmd still can work on write - * protected disks */ - if (filp->f_mode & 2 || permission(filp->f_dentry->d_inode,2,NULL) == 0) - filp->private_data = (void*) 8; - - if (UFDCS->rawcmd == 1) - UFDCS->rawcmd = 2; - -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy open: floppy.c:%d passed\n", __LINE__); -#endif - - if (!(filp->f_flags & O_NDELAY)) { - if (filp->f_mode & 3) { - UDRS->last_checked = 0; - check_disk_change(inode->i_bdev); - if (UTESTF(FD_DISK_CHANGED)) - goto out; - } - res = -EROFS; - if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE))) - goto out; -#ifdef PC9800_DEBUG_FLOPPY - printk("floppy open: end normally\n"); -#endif - } - up(&open_lock); - return 0; -out: - if (UDRS->fd_ref < 0) - UDRS->fd_ref=0; - else - UDRS->fd_ref--; - if (!UDRS->fd_ref) - opened_bdev[drive] = NULL; - floppy_release_irq_and_dma(); -out2: - up(&open_lock); - return res; -} - -/* - * Check if the disk has been changed or if a change has been faked. - */ -static int check_floppy_change(struct gendisk *disk) -{ - int drive = (long)disk->private_data; - -#ifdef PC9800_DEBUG_FLOPPY - printk("check_floppy_change: MINOR=%d\n", minor(dev)); -#endif - - if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) - return 1; - - if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) { - if(floppy_grab_irq_and_dma()) { - return 1; - } - - lock_fdc(drive,0); - poll_drive(0,0); - process_fd_request(); - floppy_release_irq_and_dma(); - } - - if (UTESTF(FD_DISK_CHANGED) || - UTESTF(FD_VERIFY) || - test_bit(drive, &fake_change) || - (!ITYPE(UDRS->fd_device) && !current_type[drive])) - return 1; - return 0; -} - -/* - * This implements "read block 0" for floppy_revalidate(). - * Needed for format autodetection, checking whether there is - * a disk in the drive, and whether that disk is writable. - */ - -static int floppy_rb0_complete(struct bio *bio, unsigned int bytes_done, int err) -{ - if (bio->bi_size) - return 1; - - complete((struct completion*)bio->bi_private); - return 0; -} - -static int __floppy_read_block_0(struct block_device *bdev) -{ - struct bio bio; - struct bio_vec bio_vec; - struct completion complete; - struct page *page; - size_t size; - - page = alloc_page(GFP_NOIO); - if (!page) { - process_fd_request(); - return -ENOMEM; - } - - size = bdev->bd_block_size; - if (!size) - size = 1024; - - bio_init(&bio); - bio.bi_io_vec = &bio_vec; - bio_vec.bv_page = page; - bio_vec.bv_len = size; - bio_vec.bv_offset = 0; - bio.bi_vcnt = 1; - bio.bi_idx = 0; - bio.bi_size = size; - bio.bi_bdev = bdev; - bio.bi_sector = 0; - init_completion(&complete); - bio.bi_private = &complete; - bio.bi_end_io = floppy_rb0_complete; - - submit_bio(READ, &bio); - generic_unplug_device(bdev_get_queue(bdev)); - process_fd_request(); - wait_for_completion(&complete); - - __free_page(page); - - return 0; -} - -/* revalidate the floppy disk, i.e. trigger format autodetection by reading - * the bootblock (block 0). "Autodetection" is also needed to check whether - * there is a disk in the drive at all... Thus we also do it for fixed - * geometry formats */ -static int floppy_revalidate(struct gendisk *disk) -{ - int drive=(long)disk->private_data; -#define NO_GEOM (!current_type[drive] && !ITYPE(UDRS->fd_device)) - int cf; - int res = 0; - - if (UTESTF(FD_DISK_CHANGED) || - UTESTF(FD_VERIFY) || - test_bit(drive, &fake_change) || - NO_GEOM){ - if(usage_count == 0) { - printk("VFS: revalidate called on non-open device.\n"); - return -EFAULT; - } - lock_fdc(drive,0); - cf = UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY); - if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)){ - process_fd_request(); /*already done by another thread*/ - return 0; - } - UDRS->maxblock = 0; - UDRS->maxtrack = 0; - if (buffer_drive == drive) - buffer_track = -1; - clear_bit(drive, &fake_change); - UCLEARF(FD_DISK_CHANGED); - if (cf) - UDRS->generation++; - if (NO_GEOM){ - /* auto-sensing */ - res = __floppy_read_block_0(opened_bdev[drive]); - } else { - if (cf) - poll_drive(0, FD_RAW_NEED_DISK); - process_fd_request(); - } - } - set_capacity(disk, floppy_sizes[UDRS->fd_device]); - return res; -} - -static struct block_device_operations floppy_fops = { - .owner = THIS_MODULE, - .open = floppy_open, - .release = floppy_release, - .ioctl = fd_ioctl, - .media_changed = check_floppy_change, - .revalidate_disk= floppy_revalidate, -}; - -static char *table[] = -{"", -#if 0 - "d360", -#else - "h1232", -#endif - "h1200", "u360", "u720", "h360", "h720", - "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", - "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", - "h880", "u1040", "u1120", "h1600", "u1760", "u1920", - "u3200", "u3520", "u3840", "u1840", "u800", "u1600", -NULL -}; - -static int t360[] = { - 1,0 -}; -static int t1200[] = { - 2,5,6,10,12,14,16,18,20,23,0 -}; -static int t3in[] = { - 8, 9,26,27,28, 7,11,15,19,24,25, - 29,31, 3, 4,13,17,21,22,30, 0 -}; - -static int *table_sup[] = { - NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in -}; - -static void __init register_devfs_entries (int drive) -{ - int base_minor = (drive < 4) ? drive : (124 + drive); - - if (UDP->cmos < NUMBER(default_drive_params)) { - int i = 0; - do { - int minor = base_minor + (table_sup[UDP->cmos][i] << 2); - - devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor), - S_IFBLK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, - "floppy/%d%s", - drive, table[table_sup[UDP->cmos][i]]); - } while (table_sup[UDP->cmos][i++]); - } -} - -/* - * Floppy Driver initialization - * ============================= - */ - -static inline char __init get_fdc_version(void) -{ - return FDC_8272A; -} - -/* lilo configuration */ - -static void __init floppy_set_flags(int *ints,int param, int param2) -{ - int i; - - for (i=0; i < ARRAY_SIZE(default_drive_params); i++){ - if (param) - default_drive_params[i].params.flags |= param2; - else - default_drive_params[i].params.flags &= ~param2; - } - DPRINT("%s flag 0x%x\n", param2 ? "Setting" : "Clearing", param); -} - -static void __init daring(int *ints,int param, int param2) -{ - int i; - - for (i=0; i < ARRAY_SIZE(default_drive_params); i++){ - if (param){ - default_drive_params[i].params.select_delay = 0; - default_drive_params[i].params.flags |= FD_SILENT_DCL_CLEAR; - } else { - default_drive_params[i].params.select_delay = 2*HZ/100; - default_drive_params[i].params.flags &= ~FD_SILENT_DCL_CLEAR; - } - } - DPRINT("Assuming %s floppy hardware\n", param ? "standard" : "broken"); -} - -static void __init set_cmos(int *ints, int dummy, int dummy2) -{ - int current_drive=0; - - if (ints[0] != 2){ - DPRINT("wrong number of parameters for CMOS\n"); - return; - } - current_drive = ints[1]; - if (current_drive < 0 || current_drive >= 8){ - DPRINT("bad drive for set_cmos\n"); - return; - } -#if N_FDC > 1 - if (current_drive >= 4 && !FDC2) - FDC2 = 0x370; -#endif - DP->cmos = ints[2]; - DPRINT("setting CMOS code to %d\n", ints[2]); -} - -static struct param_table { - const char *name; - void (*fn)(int *ints, int param, int param2); - int *var; - int def_param; - int param2; -} config_params[]={ - { "allowed_drive_mask", 0, &allowed_drive_mask, 0xff, 0}, /* obsolete */ - { "all_drives", 0, &allowed_drive_mask, 0xff, 0 }, /* obsolete */ - { "irq", 0, &FLOPPY_IRQ, DEFAULT_FLOPPY_IRQ, 0 }, - { "dma", 0, &FLOPPY_DMA, DEFAULT_FLOPPY_DMA, 0 }, - - { "daring", daring, 0, 1, 0}, -#if N_FDC > 1 - { "two_fdc", 0, &FDC2, 0x370, 0 }, - { "one_fdc", 0, &FDC2, 0, 0 }, -#endif - { "broken_dcl", floppy_set_flags, 0, 1, FD_BROKEN_DCL }, - { "messages", floppy_set_flags, 0, 1, FTD_MSG }, - { "silent_dcl_clear", floppy_set_flags, 0, 1, FD_SILENT_DCL_CLEAR }, - { "debug", floppy_set_flags, 0, 1, FD_DEBUG }, - - { "nodma", 0, &can_use_virtual_dma, 1, 0 }, - { "yesdma", 0, &can_use_virtual_dma, 0, 0 }, - - { "fifo_depth", 0, &fifo_depth, 0xa, 0 }, - { "nofifo", 0, &no_fifo, 0x20, 0 }, - { "usefifo", 0, &no_fifo, 0, 0 }, - - { "cmos", set_cmos, 0, 0, 0 }, - { "slow", 0, &slow_floppy, 1, 0 }, - - { "unexpected_interrupts", 0, &print_unex, 1, 0 }, - { "no_unexpected_interrupts", 0, &print_unex, 0, 0 }, - - EXTRA_FLOPPY_PARAMS -}; - -static int __init floppy_setup(char *str) -{ - int i; - int param; - int ints[11]; - - str = get_options(str,ARRAY_SIZE(ints),ints); - if (str) { - for (i=0; i< ARRAY_SIZE(config_params); i++){ - if (strcmp(str,config_params[i].name) == 0){ - if (ints[0]) - param = ints[1]; - else - param = config_params[i].def_param; - if (config_params[i].fn) - config_params[i]. - fn(ints,param, - config_params[i].param2); - if (config_params[i].var) { - DPRINT("%s=%d\n", str, param); - *config_params[i].var = param; - } - return 1; - } - } - } - if (str) { - DPRINT("unknown floppy option [%s]\n", str); - - DPRINT("allowed options are:"); - for (i=0; i< ARRAY_SIZE(config_params); i++) - printk(" %s",config_params[i].name); - printk("\n"); - } else - DPRINT("botched floppy option\n"); - DPRINT("Read linux/Documentation/floppy.txt\n"); - return 0; -} - -static int have_no_fdc= -ENODEV; - -static void floppy_device_release(struct device *dev) -{ - complete(&device_release); -} - -static struct platform_device floppy_device = { - .name = "floppy", - .id = 0, - .dev = { - .release = floppy_device_release, - }, -}; - -static struct kobject *floppy_find(dev_t dev, int *part, void *data) -{ - int drive = (*part&3) | ((*part&0x80) >> 5); - if (drive >= N_DRIVE || - !(allowed_drive_mask & (1 << drive)) || - fdc_state[FDC(drive)].version == FDC_NONE) - return NULL; - if (((*part>>2) & 0x1f) >= NUMBER(floppy_type)) - return NULL; - *part = 0; - return get_disk(disks[drive]); -} - -int __init floppy_init(void) -{ - int i,unit,drive; - int err; - - raw_cmd = NULL; - FDC1 = 0x90; - - for (i=0; imajor = FLOPPY_MAJOR; - disks[i]->first_minor = TOMINOR(i); - disks[i]->fops = &floppy_fops; - sprintf(disks[i]->disk_name, "fd%d", i); - } - - blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE, - floppy_find, NULL, NULL); - - for (i=0; i<256; i++) - if (ITYPE(i)) - floppy_sizes[i] = floppy_type[ITYPE(i)].size; - else - floppy_sizes[i] = MAX_DISK_SIZE << 1; - - floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); - if (!floppy_queue) - goto out_queue; - - reschedule_timeout(MAXTIMEOUT, "floppy init", MAXTIMEOUT); - config_types(); - - for (i = 0; i < N_FDC; i++) { - fdc = i; - CLEARSTRUCT(FDCS); - FDCS->dtr = -1; - FDCS->dor = 0; - } - - if ((fd_inb(FD_MODE_CHANGE) & 1) == 0) - FDC1 = 0xc8; - - use_virtual_dma = can_use_virtual_dma & 1; - fdc_state[0].address = FDC1; - if (fdc_state[0].address == -1) { - err = -ENODEV; - goto out1; - } -#if N_FDC > 1 - fdc_state[1].address = FDC2; -#endif - - fdc = 0; /* reset fdc in case of unexpected interrupt */ - if (floppy_grab_irq_and_dma()){ - err = -EBUSY; - goto out1; - } - - /* initialise drive state */ - for (drive = 0; drive < N_DRIVE; drive++) { - CLEARSTRUCT(UDRS); - CLEARSTRUCT(UDRWE); - USETF(FD_DISK_NEWCHANGE); - USETF(FD_DISK_CHANGED); - USETF(FD_VERIFY); - UDRS->fd_device = -1; - floppy_track_buffer = NULL; - max_buffer_sectors = 0; - } - - for (i = 0; i < N_FDC; i++) { - fdc = i; - FDCS->driver_version = FD_DRIVER_VERSION; - for (unit=0; unit<4; unit++) - FDCS->track[unit] = 0; - if (FDCS->address == -1) - continue; - FDCS->rawcmd = 2; - user_reset_fdc(-1, FD_RESET_ALWAYS, 0); - - /* Try to determine the floppy controller type */ - FDCS->version = get_fdc_version(); - if (FDCS->version == FDC_NONE){ - /* free ioports reserved by floppy_grab_irq_and_dma() */ - release_region(FDCS->address, 1); - release_region(FDCS->address + 2, 1); - release_region(FDCS->address + 4, 1); - release_region(0xbe, 1); - release_region(0x4be, 1); - FDCS->address = -1; - continue; - } - if (can_use_virtual_dma == 2 && FDCS->version < FDC_82072A) - can_use_virtual_dma = 0; - - have_no_fdc = 0; - /* Not all FDCs seem to be able to handle the version command - * properly, so force a reset for the standard FDC clones, - * to avoid interrupt garbage. - */ - user_reset_fdc(-1,FD_RESET_ALWAYS,0); - } - fdc=0; - del_timer(&fd_timeout); - current_drive = 0; - floppy_release_irq_and_dma(); -#if 0 /* no message */ - initialising=0; -#endif - if (have_no_fdc) { - DPRINT("no floppy controllers found\n"); - flush_scheduled_work(); - if (usage_count) - floppy_release_irq_and_dma(); - err = have_no_fdc; - goto out2; - } - - for (drive = 0; drive < N_DRIVE; drive++) { - init_timer(&motor_off_timer[drive]); - motor_off_timer[drive].data = drive; - motor_off_timer[drive].function = motor_off_callback; - if (!(allowed_drive_mask & (1 << drive))) - continue; - if (fdc_state[FDC(drive)].version == FDC_NONE) - continue; - /* to be cleaned up... */ - disks[drive]->private_data = (void*)(long)drive; - disks[drive]->queue = floppy_queue; - add_disk(disks[drive]); - } - - platform_device_register(&floppy_device); - return 0; - -out1: - del_timer_sync(&fd_timeout); -out2: - blk_cleanup_queue(floppy_queue); -out_queue: - blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); - unregister_blkdev(FLOPPY_MAJOR,"fd"); -out: - for (i=0; iaddress != -1){ - static char floppy[] = "floppy"; - if (!request_region(FDCS->address, 1, floppy)) - goto cleanup0; - - if (!request_region(FDCS->address + 2, 1, floppy)) { - release_region(FDCS->address, 1); - goto cleanup0; - } - - if (!request_region(FDCS->address + 4, 1, floppy)) { - release_region(FDCS->address, 1); - release_region(FDCS->address + 2, 1); - goto cleanup0; - } - - if (fdc == 0) { /* internal FDC */ - if (request_region(0xbe, 1, "floppy mode change")) { - if (request_region(0x4be, 1, "floppy ex. mode change")) - continue; - else - DPRINT("Floppy io-port 0x4be in use\n"); - - release_region(0xbe, 1); - } else - DPRINT("Floppy io-port 0xbe in use\n"); - - release_region(FDCS->address, 1); - release_region(FDCS->address + 2, 1); - release_region(FDCS->address + 4, 1); - } - - goto cleanup1; - } - } - for (fdc=0; fdc< N_FDC; fdc++){ - if (FDCS->address != -1){ - reset_fdc_info(1); - fd_outb(FDCS->dor, FD_MODE); - } - } - fdc = 0; - fd_outb((FDCS->dor & 8), FD_MODE); - - for (fdc = 0; fdc < N_FDC; fdc++) - if (FDCS->address != -1) - fd_outb(FDCS->dor, FD_MODE); - /* - * The driver will try and free resources and relies on us - * to know if they were allocated or not. - */ - fdc = 0; - irqdma_allocated = 1; - return 0; - -cleanup0: - DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address); -cleanup1: - fd_free_irq(); - fd_free_dma(); - while(--fdc >= 0) { - release_region(FDCS->address, 1); - release_region(FDCS->address + 2, 1); - release_region(FDCS->address + 4, 1); - if (fdc == 0) { - release_region(0x00be, 1); - release_region(0x04be, 1); - } - } - spin_lock_irqsave(&floppy_usage_lock, flags); - usage_count--; - spin_unlock_irqrestore(&floppy_usage_lock, flags); - return -1; -} - -static void floppy_release_irq_and_dma(void) -{ - int old_fdc; -#ifdef FLOPPY_SANITY_CHECK - int drive; -#endif - long tmpsize; - unsigned long tmpaddr; - unsigned long flags; - - spin_lock_irqsave(&floppy_usage_lock, flags); - if (--usage_count){ - spin_unlock_irqrestore(&floppy_usage_lock, flags); - return; - } - spin_unlock_irqrestore(&floppy_usage_lock, flags); - if(irqdma_allocated) - { - fd_disable_dma(); - fd_free_dma(); - fd_free_irq(); - irqdma_allocated=0; - } - fd_outb(0, FD_MODE); - floppy_enable_hlt(); - - if (floppy_track_buffer && max_buffer_sectors) { - tmpsize = max_buffer_sectors*1024; - tmpaddr = (unsigned long)floppy_track_buffer; - floppy_track_buffer = NULL; - max_buffer_sectors = 0; - buffer_min = buffer_max = -1; - fd_dma_mem_free(tmpaddr, tmpsize); - } - -#ifdef FLOPPY_SANITY_CHECK - for (drive=0; drive < N_FDC * 4; drive++) - if (timer_pending(motor_off_timer + drive)) - printk("motor off timer %d still active\n", drive); - - if (timer_pending(&fd_timeout)) - printk("floppy timer still active:%s\n", timeout_message); - if (timer_pending(&fd_timer)) - printk("auxiliary floppy timer still active\n"); - if (floppy_work.pending) - printk("work still pending\n"); -#endif - old_fdc = fdc; - for (fdc = 0; fdc < N_FDC; fdc++) - if (FDCS->address != -1) { - release_region(FDCS->address, 1); - release_region(FDCS->address + 2, 1); - release_region(FDCS->address + 4, 1); - if (fdc == 0) { - release_region(0xbe, 1); - release_region(0x4be, 1); - } - } - fdc = old_fdc; -} - - -#ifdef MODULE - -char *floppy; - -static void unregister_devfs_entries (int drive) -{ - int i; - - if (UDP->cmos < NUMBER(default_drive_params)) { - i = 0; - do { - devfs_remove("floppy/%d%s", drive, table[table_sup[UDP->cmos][i]]); - } while (table_sup[UDP->cmos][i++]); - } -} - -static void __init parse_floppy_cfg_string(char *cfg) -{ - char *ptr; - - while(*cfg) { - for(ptr = cfg;*cfg && *cfg != ' ' && *cfg != '\t'; cfg++); - if (*cfg) { - *cfg = '\0'; - cfg++; - } - if (*ptr) - floppy_setup(ptr); - } -} - -int init_module(void) -{ - printk(KERN_INFO "inserting floppy driver for " UTS_RELEASE "\n"); - - if (floppy) - parse_floppy_cfg_string(floppy); - return floppy_init(); -} - -void cleanup_module(void) -{ - int drive; - - init_completion(&device_release); - platform_device_unregister(&floppy_device); - blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); - unregister_blkdev(FLOPPY_MAJOR, "fd"); - - for (drive = 0; drive < N_DRIVE; drive++) { - del_timer_sync(&motor_off_timer[drive]); - - if ((allowed_drive_mask & (1 << drive)) && - fdc_state[FDC(drive)].version != FDC_NONE) { - del_gendisk(disks[drive]); - unregister_devfs_entries(drive); - } - put_disk(disks[drive]); - } - devfs_remove("floppy"); - - del_timer_sync(&fd_timeout); - del_timer_sync(&fd_timer); - blk_cleanup_queue(floppy_queue); - - if (usage_count) - floppy_release_irq_and_dma(); - - /* eject disk, if any */ - fd_eject(0); - - wait_for_completion(&device_release); -} - -MODULE_PARM(floppy,"s"); -MODULE_PARM(FLOPPY_IRQ,"i"); -MODULE_PARM(FLOPPY_DMA,"i"); -MODULE_AUTHOR("Osamu Tomita"); -MODULE_SUPPORTED_DEVICE("fd"); -MODULE_LICENSE("GPL"); - -#else - -__setup ("floppy=", floppy_setup); -module_init(floppy_init) -#endif 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/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/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/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/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_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/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 aa0fe2dbf..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); @@ -1648,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) { @@ -1671,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, @@ -3154,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 8a1fd40d5..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, @@ -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/lp_old98.c b/drivers/char/lp_old98.c deleted file mode 100644 index 895ca1daf..000000000 --- a/drivers/char/lp_old98.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - * linux/drivers/char/lp_old98.c - * - * printer port driver for ancient PC-9800s with no bidirectional port support - * - * Copyright (C) 1998,99 Kousuke Takai , - * Kyoto University Microcomputer Club - * - * This driver is based on and has compatibility with `lp.c', - * generic PC printer port driver. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -/* - * I/O port numbers - */ -#define LP_PORT_DATA 0x40 -#define LP_PORT_STATUS (LP_PORT_DATA + 2) -#define LP_PORT_STROBE (LP_PORT_DATA + 4) -#define LP_PORT_CONTROL (LP_PORT_DATA + 6) - -#define LP_PORT_H98MODE 0x0448 -#define LP_PORT_EXTMODE 0x0149 - -/* - * bit mask for I/O - */ -#define LP_MASK_nBUSY (1 << 2) -#define LP_MASK_nSTROBE (1 << 7) - -#define LP_CONTROL_ASSERT_STROBE (0x0e) -#define LP_CONTROL_NEGATE_STROBE (0x0f) - -/* - * Acceptable maximum value for non-privileged user for LPCHARS ioctl. - */ -#define LP_CHARS_NOPRIV_MAX 65535 - -#define DC1 '\x11' -#define DC3 '\x13' - -/* PC-9800s have at least and at most one old-style printer port. */ -static struct lp_struct lp = { - .flags = LP_EXIST | LP_ABORTOPEN, - .chars = LP_INIT_CHAR, - .time = LP_INIT_TIME, - .wait = LP_INIT_WAIT, -}; - -static int dc1_check; -static spinlock_t lp_old98_lock = SPIN_LOCK_UNLOCKED; - - -#undef LP_OLD98_DEBUG - -#ifdef CONFIG_PC9800_OLDLP_CONSOLE -static struct console lp_old98_console; /* defined later */ -static short saved_console_flags; -#endif - -static DECLARE_WAIT_QUEUE_HEAD (lp_old98_waitq); - -static void lp_old98_timer_function(unsigned long data) -{ - if (inb(LP_PORT_STATUS) & LP_MASK_nBUSY) - wake_up_interruptible(&lp_old98_waitq); - else { - struct timer_list *t = (struct timer_list *) data; - - t->expires = jiffies + 1; - add_timer(t); - } -} - -static inline int lp_old98_wait_ready(void) -{ - struct timer_list timer; - - init_timer(&timer); - timer.function = lp_old98_timer_function; - timer.expires = jiffies + 1; - timer.data = (unsigned long)&timer; - add_timer(&timer); - interruptible_sleep_on(&lp_old98_waitq); - del_timer(&timer); - return signal_pending(current); -} - -static inline int lp_old98_char(char lpchar) -{ - unsigned long count = 0; -#ifdef LP_STATS - int tmp; -#endif - - while (!(inb(LP_PORT_STATUS) & LP_MASK_nBUSY)) { - count++; - if (count >= lp.chars) - return 0; - } - - outb(lpchar, LP_PORT_DATA); - -#ifdef LP_STATS - /* - * Update lp statsistics here (and between next two outb()'s). - * Time to compute it is part of storobe delay. - */ - if (count > lp.stats.maxwait) { -#ifdef LP_OLD98_DEBUG - printk(KERN_DEBUG "lp_old98: success after %d counts.\n", - count); -#endif - lp.stats.maxwait = count; - } - count *= 256; - tmp = count - lp.stats.meanwait; - if (tmp < 0) - tmp = -tmp; -#endif - ndelay(lp.wait); - - /* negate PSTB# (activate strobe) */ - outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL); - -#ifdef LP_STATS - lp.stats.meanwait = (255 * lp.stats.meanwait + count + 128) / 256; - lp.stats.mdev = (127 * lp.stats.mdev + tmp + 64) / 128; - lp.stats.chars ++; -#endif - - ndelay(lp.wait); - - /* assert PSTB# (deactivate strobe) */ - outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL); - - return 1; -} - -static ssize_t lp_old98_write(struct file * file, - const char * buf, size_t count, - loff_t *dummy) -{ - unsigned long total_bytes_written = 0; - - if (!access_ok(VERIFY_READ, buf, count)) - return -EFAULT; - -#ifdef LP_STATS - if (jiffies - lp.lastcall > lp.time) - lp.runchars = 0; - lp.lastcall = jiffies; -#endif - - do { - unsigned long bytes_written = 0; - unsigned long copy_size - = (count < LP_BUFFER_SIZE ? count : LP_BUFFER_SIZE); - - if (__copy_from_user(lp.lp_buffer, buf, copy_size)) - return -EFAULT; - - while (bytes_written < copy_size) { - if (lp_old98_char(lp.lp_buffer[bytes_written])) - bytes_written ++; - else { -#ifdef LP_STATS - int rc = lp.runchars + bytes_written; - - if (rc > lp.stats.maxrun) - lp.stats.maxrun = rc; - - lp.stats.sleeps ++; -#endif -#ifdef LP_OLD98_DEBUG - printk(KERN_DEBUG - "lp_old98: sleeping at %d characters" - " for %d jiffies\n", - lp.runchars, lp.time); - lp.runchars = 0; -#endif - if (lp_old98_wait_ready()) - return ((total_bytes_written - + bytes_written) - ? : -EINTR); - } - } - total_bytes_written += bytes_written; - buf += bytes_written; -#ifdef LP_STATS - lp.runchars += bytes_written; -#endif - count -= bytes_written; - } while (count > 0); - - return total_bytes_written; -} - -static int lp_old98_open(struct inode * inode, struct file * file) -{ - if (iminor(inode) != 0) - return -ENXIO; - - if (lp.flags & LP_BUSY) - return -EBUSY; - - if (dc1_check && (lp.flags & LP_ABORTOPEN) - && !(file->f_flags & O_NONBLOCK)) { - /* - * Check whether printer is on-line. - * PC-9800's old style port have only BUSY# as status input, - * so that it is impossible to distinguish that the printer is - * ready and that the printer is off-line or not connected - * (in both case BUSY# is in the same state). So: - * - * (1) output DC1 (0x11) to printer port and do strobe. - * (2) watch BUSY# line for a while. If BUSY# is pulled - * down, the printer will be ready. Otherwise, - * it will be off-line (or not connected, or power-off, - * ...). - * - * The source of this procedure: - * Terumasa KODAKA, Kazufumi SHIMIZU, Yu HAYAMI: - * `PC-9801 Super Technique', Ascii, 1992. - */ - int count; - unsigned long flags; - - /* interrupts while check is fairly bad */ - spin_lock_irqsave(&lp_old98_lock, flags); - - if (!lp_old98_char(DC1)) { - spin_unlock_irqrestore(&lp_old98_lock, flags); - return -EBUSY; - } - count = (unsigned int)dc1_check > 10000 ? 10000 : dc1_check; - while (inb(LP_PORT_STATUS) & LP_MASK_nBUSY) { - if (--count == 0) { - spin_unlock_irqrestore(&lp_old98_lock, flags); - return -ENODEV; - } - } - spin_unlock_irqrestore(&lp_old98_lock, flags); - } - - if ((lp.lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL)) == NULL) - return -ENOMEM; - - lp.flags |= LP_BUSY; - -#ifdef CONFIG_PC9800_OLDLP_CONSOLE - saved_console_flags = lp_old98_console.flags; - lp_old98_console.flags &= ~CON_ENABLED; -#endif - return 0; -} - -static int lp_old98_release(struct inode * inode, struct file * file) -{ - kfree(lp.lp_buffer); - lp.lp_buffer = NULL; - lp.flags &= ~LP_BUSY; -#ifdef CONFIG_PC9800_OLDLP_CONSOLE - lp_old98_console.flags = saved_console_flags; -#endif - return 0; -} - -static int lp_old98_init_device(void) -{ - unsigned char data; - - if ((data = inb(LP_PORT_EXTMODE)) != 0xFF && (data & 0x10)) { - printk(KERN_INFO - "lp_old98: shutting down extended parallel port mode...\n"); - outb(data & ~0x10, LP_PORT_EXTMODE); - } -#ifdef PC98_HW_H98 - if ((pc98_hw_flags & PC98_HW_H98) - && ((data = inb(LP_PORT_H98MODE)) & 0x01)) { - printk(KERN_INFO - "lp_old98: shutting down H98 full centronics mode...\n"); - outb(data & ~0x01, LP_PORT_H98MODE); - } -#endif - return 0; -} - -static int lp_old98_ioctl(struct inode *inode, struct file *file, - unsigned int command, unsigned long arg) -{ - int retval = 0; - - switch (command) { - case LPTIME: - lp.time = arg * HZ/100; - break; - case LPCHAR: - lp.chars = arg; - break; - case LPABORT: - if (arg) - lp.flags |= LP_ABORT; - else - lp.flags &= ~LP_ABORT; - break; - case LPABORTOPEN: - if (arg) - lp.flags |= LP_ABORTOPEN; - else - lp.flags &= ~LP_ABORTOPEN; - break; - case LPCAREFUL: - /* do nothing */ - break; - case LPWAIT: - lp.wait = arg; - break; - case LPGETIRQ: - retval = put_user(0, (int *)arg); - break; - case LPGETSTATUS: - /* - * convert PC-9800's status to IBM PC's one, so that tunelp(8) - * works in the same way on this driver. - */ - retval = put_user((inb(LP_PORT_STATUS) & LP_MASK_nBUSY) - ? (LP_PBUSY | LP_PERRORP) : LP_PERRORP, - (int *)arg); - break; - case LPRESET: - retval = lp_old98_init_device(); - break; -#ifdef LP_STATS - case LPGETSTATS: - if (copy_to_user((struct lp_stats *)arg, &lp.stats, - sizeof(struct lp_stats))) - retval = -EFAULT; - else if (suser()) - memset(&lp.stats, 0, sizeof(struct lp_stats)); - break; -#endif - case LPGETFLAGS: - retval = put_user(lp.flags, (int *)arg); - break; - case LPSETIRQ: - default: - retval = -EINVAL; - } - return retval; -} - -static struct file_operations lp_old98_fops = { - .owner = THIS_MODULE, - .write = lp_old98_write, - .ioctl = lp_old98_ioctl, - .open = lp_old98_open, - .release = lp_old98_release, -}; - -/* - * Support for console on lp_old98 - */ -#ifdef CONFIG_PC9800_OLDLP_CONSOLE - -static inline void io_delay(void) -{ - unsigned char dummy; /* actually not output */ - - asm volatile ("out%B0 %0,%1" : "=a"(dummy) : "N"(0x5f)); -} - -static void lp_old98_console_write(struct console *console, - const char *s, unsigned int count) -{ - int i; - static unsigned int timeout_run = 0; - - while (count) { - /* wait approx 1.2 seconds */ - for (i = 2000000; !(inb(LP_PORT_STATUS) & LP_MASK_nBUSY); - io_delay()) - if (!--i) { - if (++timeout_run >= 10) - /* disable forever... */ - console->flags &= ~CON_ENABLED; - return; - } - - timeout_run = 0; - - if (*s == '\n') { - outb('\r', LP_PORT_DATA); - io_delay(); - io_delay(); - outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL); - io_delay(); - io_delay(); - outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL); - io_delay(); - io_delay(); - for (i = 1000000; - !(inb(LP_PORT_STATUS) & LP_MASK_nBUSY); - io_delay()) - if (!--i) - return; - } - - outb(*s++, LP_PORT_DATA); - io_delay(); - io_delay(); - outb(LP_CONTROL_ASSERT_STROBE, LP_PORT_CONTROL); - io_delay(); - io_delay(); - outb(LP_CONTROL_NEGATE_STROBE, LP_PORT_CONTROL); - io_delay(); - io_delay(); - - --count; - } -} - -static struct console lp_old98_console = { - .name = "lp_old98", - .write = lp_old98_console_write, - .flags = CON_PRINTBUFFER, - .index = -1, -}; - -#endif /* console on lp_old98 */ - -static int __init lp_old98_init(void) -{ - char *errmsg = "I/O ports already occupied, giving up."; - -#ifdef PC98_HW_H98 - if (pc98_hw_flags & PC98_HW_H98) - if (!request_region(LP_PORT_H98MODE, 1, "lp_old98") - goto err1; -#endif - if (!request_region(LP_PORT_DATA, 1, "lp_old98")) - goto err2; - if (!request_region(LP_PORT_STATUS, 1, "lp_old98")) - goto err3; - if (!request_region(LP_PORT_STROBE, 1, "lp_old98")) - goto err4; - if (!request_region(LP_PORT_EXTMODE, 1, "lp_old98")) - goto err5; - if (!register_chrdev(LP_MAJOR, "lp", &lp_old98_fops)) { -#ifdef CONFIG_PC9800_OLDLP_CONSOLE - register_console(&lp_old98_console); - printk(KERN_INFO "lp_old98: console ready\n"); -#endif - /* - * rest are not needed by this driver, - * but for locking out other printer drivers... - */ - lp_old98_init_device(); - return 0; - } else - errmsg = "unable to register device"; - - release_region(LP_PORT_EXTMODE, 1); -err5: - release_region(LP_PORT_STROBE, 1); -err4: - release_region(LP_PORT_STATUS, 1); -err3: - release_region(LP_PORT_DATA, 1); -err2: -#ifdef PC98_HW_H98 - if (pc98_hw_flags & PC98_HW_H98) - release_region(LP_PORT_H98MODE, 1); - -err1: -#endif - printk(KERN_ERR "lp_old98: %s\n", errmsg); - return -EBUSY; -} - -static void __exit lp_old98_exit(void) -{ -#ifdef CONFIG_PC9800_OLDLP_CONSOLE - unregister_console(&lp_old98_console); -#endif - unregister_chrdev(LP_MAJOR, "lp"); - - release_region(LP_PORT_DATA, 1); - release_region(LP_PORT_STATUS, 1); - release_region(LP_PORT_STROBE, 1); -#ifdef PC98_HW_H98 - if (pc98_hw_flags & PC98_HW_H98) - release_region(LP_PORT_H98MODE, 1); -#endif - release_region(LP_PORT_EXTMODE, 1); -} - -#ifndef MODULE -static int __init lp_old98_setup(char *str) -{ - int ints[4]; - - str = get_options(str, ARRAY_SIZE(ints), ints); - if (ints[0] > 0) - dc1_check = ints[1]; - return 1; -} -__setup("lp_old98_dc1_check=", lp_old98_setup); -#endif - -MODULE_PARM(dc1_check, "i"); -MODULE_AUTHOR("Kousuke Takai "); -MODULE_DESCRIPTION("PC-9800 old printer port driver"); -MODULE_LICENSE("GPL"); - -module_init(lp_old98_init); -module_exit(lp_old98_exit); 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/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/synclinkmp.c b/drivers/char/synclinkmp.c index e76454311..eec88152d 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -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; 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/upd4990a.c b/drivers/char/upd4990a.c deleted file mode 100644 index f06f509fb..000000000 --- a/drivers/char/upd4990a.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * NEC PC-9800 Real Time Clock interface for Linux - * - * Copyright (C) 1997-2001 Linux/98 project, - * Kyoto University Microcomputer Club. - * - * Based on: - * drivers/char/rtc.c by Paul Gortmaker - * - * Changes: - * 2001-02-09 Call check_region on rtc_init and do not request I/O 0033h. - * Call del_timer and release_region on rtc_exit. -- tak - * 2001-07-14 Rewrite and split to - * and . - * Introduce a lot of spin_lock/unlock (&rtc_lock). - */ - -#define RTC98_VERSION "1.2" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* - * We sponge a minor off of the misc major. No need slurping - * up another valuable major dev number for this. If you add - * an ioctl, make sure you don't conflict with SPARC's RTC - * ioctls. - */ - -static struct fasync_struct *rtc_async_queue; - -static DECLARE_WAIT_QUEUE_HEAD(rtc_wait); - -static struct timer_list rtc_uie_timer; -static u8 old_refclk; - -static int rtc_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg); - -static int rtc_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data); - -/* - * Bits in rtc_status. (5 bits of room for future expansion) - */ - -#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */ -#define RTC_TIMER_ON 0x02 /* not used */ -#define RTC_UIE_TIMER_ON 0x04 /* UIE emulation timer is active */ - -/* - * rtc_status is never changed by rtc_interrupt, and ioctl/open/close is - * protected by the big kernel lock. However, ioctl can still disable the timer - * in rtc_status and then with del_timer after the interrupt has read - * rtc_status but before mod_timer is called, which would then reenable the - * timer (but you would need to have an awful timing before you'd trip on it) - */ -static unsigned char rtc_status; /* bitmapped status byte. */ -static unsigned long rtc_irq_data; /* our output to the world */ - -static const unsigned char days_in_mo[] = -{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - -extern spinlock_t rtc_lock; /* defined in arch/i386/kernel/time.c */ - -static void rtc_uie_intr(unsigned long data) -{ - u8 refclk, tmp; - - /* Kernel timer does del_timer internally before calling - each timer entry, so this is unnecessary. - del_timer(&rtc_uie_timer); */ - spin_lock(&rtc_lock); - - /* Detect rising edge of 1Hz reference clock. */ - refclk = UPD4990A_READ_DATA(); - tmp = old_refclk & refclk; - old_refclk = ~refclk; - if (!(tmp & 1)) - rtc_irq_data += 0x100; - - spin_unlock(&rtc_lock); - - if (!(tmp & 1)) { - /* Now do the rest of the actions */ - wake_up_interruptible(&rtc_wait); - kill_fasync(&rtc_async_queue, SIGIO, POLL_IN); - } - - rtc_uie_timer.expires = jiffies + 1; - add_timer(&rtc_uie_timer); -} - -/* - * Now all the various file operations that we export. - */ - -static ssize_t rtc_read(struct file *file, char *buf, - size_t count, loff_t *ppos) -{ - DECLARE_WAITQUEUE(wait, current); - unsigned long data; - ssize_t retval = 0; - - if (count < sizeof(unsigned long)) - return -EINVAL; - - add_wait_queue(&rtc_wait, &wait); - - set_current_state(TASK_INTERRUPTIBLE); - - do { - /* First make it right. Then make it fast. Putting this whole - * block within the parentheses of a while would be too - * confusing. And no, xchg() is not the answer. */ - spin_lock_irq(&rtc_lock); - data = rtc_irq_data; - rtc_irq_data = 0; - spin_unlock_irq(&rtc_lock); - - if (data != 0) - break; - if (file->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - goto out; - } - if (signal_pending(current)) { - retval = -ERESTARTSYS; - goto out; - } - schedule(); - } while (1); - - retval = put_user(data, (unsigned long *)buf); - if (!retval) - retval = sizeof(unsigned long); - out: - set_current_state(TASK_RUNNING); - remove_wait_queue(&rtc_wait, &wait); - - return retval; -} - -static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) -{ - struct rtc_time wtime; - struct upd4990a_raw_data raw; - - switch (cmd) { - case RTC_UIE_OFF: /* Mask ints from RTC updates. */ - spin_lock_irq(&rtc_lock); - if (rtc_status & RTC_UIE_TIMER_ON) { - rtc_status &= ~RTC_UIE_TIMER_ON; - del_timer(&rtc_uie_timer); - } - spin_unlock_irq(&rtc_lock); - return 0; - - case RTC_UIE_ON: /* Allow ints for RTC updates. */ - spin_lock_irq(&rtc_lock); - rtc_irq_data = 0; - if (!(rtc_status & RTC_UIE_TIMER_ON)) { - rtc_status |= RTC_UIE_TIMER_ON; - rtc_uie_timer.expires = jiffies + 1; - add_timer(&rtc_uie_timer); - } - /* Just in case... */ - upd4990a_serial_command(UPD4990A_REGISTER_HOLD); - old_refclk = ~UPD4990A_READ_DATA(); - spin_unlock_irq(&rtc_lock); - return 0; - - case RTC_RD_TIME: /* Read the time/date from RTC */ - spin_lock_irq(&rtc_lock); - upd4990a_get_time(&raw, 0); - spin_unlock_irq(&rtc_lock); - - wtime.tm_sec = BCD2BIN(raw.sec); - wtime.tm_min = BCD2BIN(raw.min); - wtime.tm_hour = BCD2BIN(raw.hour); - wtime.tm_mday = BCD2BIN(raw.mday); - wtime.tm_mon = raw.mon - 1; /* convert to 0-base */ - wtime.tm_wday = raw.wday; - - /* - * Account for differences between how the RTC uses the values - * and how they are defined in a struct rtc_time; - */ - if ((wtime.tm_year = BCD2BIN(raw.year)) < 95) - wtime.tm_year += 100; - - wtime.tm_isdst = 0; - break; - - case RTC_SET_TIME: /* Set the RTC */ - { - int leap_yr; - - if (!capable(CAP_SYS_TIME)) - return -EACCES; - - if (copy_from_user(&wtime, (struct rtc_time *) arg, - sizeof (struct rtc_time))) - return -EFAULT; - - /* Valid year is 1995 - 2094, inclusive. */ - if (wtime.tm_year < 95 || wtime.tm_year > 194) - return -EINVAL; - - if (wtime.tm_mon > 11 || wtime.tm_mday == 0) - return -EINVAL; - - /* For acceptable year domain (1995 - 2094), - this IS sufficient. */ - leap_yr = !(wtime.tm_year % 4); - - if (wtime.tm_mday > (days_in_mo[wtime.tm_mon] - + (wtime.tm_mon == 2 && leap_yr))) - return -EINVAL; - - if (wtime.tm_hour >= 24 - || wtime.tm_min >= 60 || wtime.tm_sec >= 60) - return -EINVAL; - - if (wtime.tm_wday > 6) - return -EINVAL; - - raw.sec = BIN2BCD(wtime.tm_sec); - raw.min = BIN2BCD(wtime.tm_min); - raw.hour = BIN2BCD(wtime.tm_hour); - raw.mday = BIN2BCD(wtime.tm_mday); - raw.mon = wtime.tm_mon + 1; - raw.wday = wtime.tm_wday; - raw.year = BIN2BCD(wtime.tm_year % 100); - - spin_lock_irq(&rtc_lock); - upd4990a_set_time(&raw, 0); - spin_unlock_irq(&rtc_lock); - - return 0; - } - default: - return -EINVAL; - } - return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0; -} - -/* - * We enforce only one user at a time here with the open/close. - * Also clear the previous interrupt data on an open, and clean - * up things on a close. - */ - -static int rtc_open(struct inode *inode, struct file *file) -{ - spin_lock_irq(&rtc_lock); - - if(rtc_status & RTC_IS_OPEN) - goto out_busy; - - rtc_status |= RTC_IS_OPEN; - - rtc_irq_data = 0; - spin_unlock_irq(&rtc_lock); - return 0; - - out_busy: - spin_unlock_irq(&rtc_lock); - return -EBUSY; -} - -static int rtc_fasync(int fd, struct file *filp, int on) -{ - return fasync_helper(fd, filp, on, &rtc_async_queue); -} - -static int rtc_release(struct inode *inode, struct file *file) -{ - del_timer(&rtc_uie_timer); - - if (file->f_flags & FASYNC) - rtc_fasync(-1, file, 0); - - rtc_irq_data = 0; - - /* No need for locking -- nobody else can do anything until this rmw is - * committed, and no timer is running. */ - rtc_status &= ~(RTC_IS_OPEN | RTC_UIE_TIMER_ON); - return 0; -} - -static unsigned int rtc_poll(struct file *file, poll_table *wait) -{ - unsigned long l; - - poll_wait(file, &rtc_wait, wait); - - spin_lock_irq(&rtc_lock); - l = rtc_irq_data; - spin_unlock_irq(&rtc_lock); - - if (l != 0) - return POLLIN | POLLRDNORM; - return 0; -} - -/* - * The various file operations we support. - */ - -static struct file_operations rtc_fops = { - .owner = THIS_MODULE, - .read = rtc_read, - .poll = rtc_poll, - .ioctl = rtc_ioctl, - .open = rtc_open, - .release = rtc_release, - .fasync = rtc_fasync, -}; - -static struct miscdevice rtc_dev= -{ - .minor = RTC_MINOR, - .name = "rtc", - .fops = &rtc_fops, -}; - -static int __init rtc_init(void) -{ - int err = 0; - - if (!request_region(UPD4990A_IO, 1, "rtc")) { - printk(KERN_ERR "upd4990a: could not acquire I/O port %#x\n", - UPD4990A_IO); - return -EBUSY; - } - - err = misc_register(&rtc_dev); - if (err) { - printk(KERN_ERR "upd4990a: can't misc_register() on minor=%d\n", - RTC_MINOR); - release_region(UPD4990A_IO, 1); - return err; - } - -#if 0 - printk(KERN_INFO "\xB6\xDA\xDD\xC0\xDE \xC4\xDE\xB9\xB2 Driver\n"); /* Calender Clock Driver */ -#else - printk(KERN_INFO - "Real Time Clock driver for NEC PC-9800 v" RTC98_VERSION "\n"); -#endif - create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL); - - init_timer(&rtc_uie_timer); - rtc_uie_timer.function = rtc_uie_intr; - - return 0; -} - -module_init (rtc_init); - -static void __exit rtc_exit(void) -{ - del_timer(&rtc_uie_timer); - release_region(UPD4990A_IO, 1); - remove_proc_entry("driver/rtc", NULL); - misc_deregister(&rtc_dev); -} - -module_exit (rtc_exit); - -/* - * Info exported via "/proc/driver/rtc". - */ - -static inline int rtc_get_status(char *buf) -{ - char *p; - unsigned int year; - struct upd4990a_raw_data data; - - p = buf; - - upd4990a_get_time(&data, 0); - - /* - * There is no way to tell if the luser has the RTC set for local - * time or for Universal Standard Time (GMT). Probably local though. - */ - if ((year = BCD2BIN(data.year) + 1900) < 1995) - year += 100; - p += sprintf(p, - "rtc_time\t: %02d:%02d:%02d\n" - "rtc_date\t: %04d-%02d-%02d\n", - BCD2BIN(data.hour), BCD2BIN(data.min), - BCD2BIN(data.sec), - year, data.mon, BCD2BIN(data.mday)); - - return p - buf; -} - -static int rtc_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - int len = rtc_get_status(page); - - if (len <= off + count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} 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_pci.c b/drivers/char/watchdog/pcwd_pci.c index 0b3c727e5..ddfeee878 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c @@ -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; @@ -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; diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 0f4c1ca0c..50325530e 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c @@ -326,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 */ @@ -361,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 | @@ -371,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: { @@ -385,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: @@ -396,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) { @@ -416,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)) @@ -427,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; @@ -466,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; @@ -478,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; 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/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-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-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-tcq.c b/drivers/ide/ide-tcq.c deleted file mode 100644 index 4284fba2d..000000000 --- a/drivers/ide/ide-tcq.c +++ /dev/null @@ -1,808 +0,0 @@ -/* - * Copyright (C) 2001, 2002 Jens Axboe - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Support for the DMA queued protocol, which enables ATA disk drives to - * use tagged command queueing. - */ -#include -#include -#include -#include -#include - -#include -#include - -/* - * warning: it will be _very_ verbose if defined - */ -#undef IDE_TCQ_DEBUG - -#ifdef IDE_TCQ_DEBUG -#define TCQ_PRINTK printk -#else -#define TCQ_PRINTK(x...) -#endif - -/* - * use nIEN or not - */ -#undef IDE_TCQ_NIEN - -/* - * we are leaving the SERVICE interrupt alone, IBM drives have it - * on per default and it can't be turned off. Doesn't matter, this - * is the sane config. - */ -#undef IDE_TCQ_FIDDLE_SI - -/* - * bad drive blacklist, for drives that raport tcq capability but don't - * work reliably with the default config. initially from freebsd table. - */ -struct ide_tcq_blacklist { - char *model; - char works; - unsigned int max_sectors; -}; - -static struct ide_tcq_blacklist ide_tcq_blacklist[] = { - { - .model = "IBM-DTTA", - .works = 1, - .max_sectors = 128, - }, - { - .model = "IBM-DJNA", - .works = 0, - }, - { - .model = "WDC AC", - .works = 0, - }, - { - .model = NULL, - }, -}; - -ide_startstop_t ide_dmaq_intr(ide_drive_t *drive); -ide_startstop_t ide_service(ide_drive_t *drive); - -static struct ide_tcq_blacklist *ide_find_drive_blacklist(ide_drive_t *drive) -{ - struct ide_tcq_blacklist *itb; - int i = 0; - - do { - itb = &ide_tcq_blacklist[i]; - - if (!itb->model) - break; - - if (!strncmp(drive->id->model, itb->model, strlen(itb->model))) - return itb; - - i++; - } while (1); - - return NULL; -} - -static inline void drive_ctl_nien(ide_drive_t *drive, int set) -{ -#ifdef IDE_TCQ_NIEN - if (IDE_CONTROL_REG) { - int mask = set ? 0x02 : 0x00; - - hwif->OUTB(drive->ctl | mask, IDE_CONTROL_REG); - } -#endif -} - -static ide_startstop_t ide_tcq_nop_handler(ide_drive_t *drive) -{ - ide_task_t *args = HWGROUP(drive)->rq->special; - ide_hwif_t *hwif = HWIF(drive); - int auto_poll_check = 0; - u8 stat, err; - - if (args->tfRegister[IDE_FEATURE_OFFSET] & 0x01) - auto_poll_check = 1; - - local_irq_enable(); - - stat = hwif->INB(IDE_STATUS_REG); - err = hwif->INB(IDE_ERROR_REG); - ide_end_drive_cmd(drive, stat, err); - - /* - * do taskfile and check ABRT bit -- intelligent adapters will not - * pass NOP with sub-code 0x01 to device, so the command will not - * fail there - */ - if (auto_poll_check) { - if (!(args->tfRegister[IDE_FEATURE_OFFSET] & ABRT_ERR)) { - HWIF(drive)->auto_poll = 1; - printk("%s: NOP Auto-poll enabled\n",HWIF(drive)->name); - } - } - - kfree(args); - return ide_stopped; -} - -/* - * if we encounter _any_ error doing I/O to one of the tags, we must - * invalidate the pending queue. clear the software busy queue and requeue - * on the request queue for restart. issue a WIN_NOP to clear hardware queue - */ -static void ide_tcq_invalidate_queue(ide_drive_t *drive) -{ - ide_hwgroup_t *hwgroup = HWGROUP(drive); - request_queue_t *q = drive->queue; - struct request *rq; - unsigned long flags; - - printk("%s: invalidating tag queue (%d commands)\n", drive->name, ata_pending_commands(drive)); - - /* - * first kill timer and block queue - */ - spin_lock_irqsave(&ide_lock, flags); - - del_timer(&hwgroup->timer); - - if (HWIF(drive)->dma) - HWIF(drive)->ide_dma_end(drive); - - blk_queue_invalidate_tags(q); - - drive->using_tcq = 0; - drive->queue_depth = 1; - hwgroup->busy = 0; - hwgroup->handler = NULL; - - spin_unlock_irqrestore(&ide_lock, flags); - - /* - * now kill hardware queue with a NOP - */ - rq = &hwgroup->wrq; - ide_init_drive_cmd(rq); - rq->buffer = hwgroup->cmd_buf; - memset(rq->buffer, 0, sizeof(hwgroup->cmd_buf)); - rq->buffer[0] = WIN_NOP; - ide_do_drive_cmd(drive, rq, ide_preempt); -} - -void ide_tcq_intr_timeout(unsigned long data) -{ - ide_drive_t *drive = (ide_drive_t *) data; - ide_hwgroup_t *hwgroup = HWGROUP(drive); - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - - printk(KERN_ERR "ide_tcq_intr_timeout: timeout waiting for %s interrupt\n", hwgroup->rq ? "completion" : "service"); - - spin_lock_irqsave(&ide_lock, flags); - - if (!hwgroup->busy) - printk(KERN_ERR "ide_tcq_intr_timeout: hwgroup not busy\n"); - if (hwgroup->handler == NULL) - printk(KERN_ERR "ide_tcq_intr_timeout: missing isr!\n"); - - hwgroup->busy = 1; - spin_unlock_irqrestore(&ide_lock, flags); - - /* - * if pending commands, try service before giving up - */ - if (ata_pending_commands(drive)) { - u8 stat = hwif->INB(IDE_STATUS_REG); - - if ((stat & SRV_STAT) && (ide_service(drive) == ide_started)) - return; - } - - if (drive) - ide_tcq_invalidate_queue(drive); -} - -void __ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler) -{ - /* - * always just bump the timer for now, the timeout handling will - * have to be changed to be per-command - */ - hwgroup->timer.function = ide_tcq_intr_timeout; - hwgroup->timer.data = (unsigned long) hwgroup->drive; - mod_timer(&hwgroup->timer, jiffies + 5 * HZ); - - hwgroup->handler = handler; -} - -void ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler) -{ - unsigned long flags; - - spin_lock_irqsave(&ide_lock, flags); - __ide_tcq_set_intr(hwgroup, handler); - spin_unlock_irqrestore(&ide_lock, flags); -} - -/* - * wait 400ns, then poll for busy_mask to clear from alt status - */ -#define IDE_TCQ_WAIT (10000) -int ide_tcq_wait_altstat(ide_drive_t *drive, byte *stat, byte busy_mask) -{ - ide_hwif_t *hwif = HWIF(drive); - int i = 0; - - udelay(1); - - do { - *stat = hwif->INB(IDE_ALTSTATUS_REG); - - if (!(*stat & busy_mask)) - break; - - if (unlikely(i++ > IDE_TCQ_WAIT)) - return 1; - - udelay(10); - } while (1); - - return 0; -} - -/* - * issue SERVICE command to drive -- drive must have been selected first, - * and it must have reported a need for service (status has SRV_STAT set) - * - * Also, nIEN must be set as not to need protection against ide_dmaq_intr - */ -ide_startstop_t ide_service(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - struct request *rq; - byte feat, stat; - int tag; - - TCQ_PRINTK("%s: started service\n", drive->name); - - /* - * could be called with IDE_DMA in-progress from invalidate - * handler, refuse to do anything - */ - if (hwif->dma) - return ide_stopped; - - /* - * need to select the right drive first... - */ - if (drive != HWGROUP(drive)->drive) { - SELECT_DRIVE(drive); - udelay(10); - } - - drive_ctl_nien(drive, 1); - - /* - * send SERVICE, wait 400ns, wait for BUSY_STAT to clear - */ - hwif->OUTB(WIN_QUEUED_SERVICE, IDE_COMMAND_REG); - - if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) { - printk(KERN_ERR "ide_service: BUSY clear took too long\n"); - ide_dump_status(drive, "ide_service", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - drive_ctl_nien(drive, 0); - - /* - * FIXME, invalidate queue - */ - if (stat & ERR_STAT) { - ide_dump_status(drive, "ide_service", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - /* - * should not happen, a buggy device could introduce loop - */ - feat = hwif->INB(IDE_NSECTOR_REG); - if (feat & REL) { - HWGROUP(drive)->rq = NULL; - printk(KERN_ERR "%s: release in service\n", drive->name); - return ide_stopped; - } - - tag = feat >> 3; - - TCQ_PRINTK("ide_service: stat %x, feat %x\n", stat, feat); - - spin_lock_irqsave(&ide_lock, flags); - - if ((rq = blk_queue_find_tag(drive->queue, tag))) { - HWGROUP(drive)->rq = rq; - - /* - * we'll start a dma read or write, device will trigger - * interrupt to indicate end of transfer, release is not - * allowed - */ - TCQ_PRINTK("ide_service: starting command, stat=%x\n", stat); - spin_unlock_irqrestore(&ide_lock, flags); - return __ide_dma_queued_start(drive); - } - - printk(KERN_ERR "ide_service: missing request for tag %d\n", tag); - spin_unlock_irqrestore(&ide_lock, flags); - return ide_stopped; -} - -ide_startstop_t ide_check_service(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - byte stat; - - TCQ_PRINTK("%s: ide_check_service\n", drive->name); - - if (!ata_pending_commands(drive)) - return ide_stopped; - - stat = hwif->INB(IDE_STATUS_REG); - if (stat & SRV_STAT) - return ide_service(drive); - - /* - * we have pending commands, wait for interrupt - */ - TCQ_PRINTK("%s: wait for service interrupt\n", drive->name); - ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr); - return ide_started; -} - -ide_startstop_t ide_dmaq_complete(ide_drive_t *drive, struct request *rq, byte stat) -{ - byte dma_stat; - - /* - * transfer was in progress, stop DMA engine - */ - dma_stat = HWIF(drive)->ide_dma_end(drive); - - /* - * must be end of I/O, check status and complete as necessary - */ - if (unlikely(!OK_STAT(stat, READY_STAT, drive->bad_wstat | DRQ_STAT))) { - printk(KERN_ERR "ide_dmaq_intr: %s: error status %x\n",drive->name,stat); - ide_dump_status(drive, "ide_dmaq_complete", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; - } - - if (dma_stat) - printk(KERN_WARNING "%s: bad DMA status (dma_stat=%x)\n", drive->name, dma_stat); - - TCQ_PRINTK("ide_dmaq_complete: ending %p, tag %d\n", rq, rq->tag); - ide_end_request(drive, 1, rq->nr_sectors); - - /* - * we completed this command, check if we can service a new command - */ - return ide_check_service(drive); -} - -/* - * intr handler for queued dma operations. this can be entered for two - * reasons: - * - * 1) device has completed dma transfer - * 2) service request to start a command - * - * if the drive has an active tag, we first complete that request before - * processing any pending SERVICE. - */ -ide_startstop_t ide_dmaq_intr(ide_drive_t *drive) -{ - struct request *rq = HWGROUP(drive)->rq; - ide_hwif_t *hwif = HWIF(drive); - byte stat = hwif->INB(IDE_STATUS_REG); - - TCQ_PRINTK("ide_dmaq_intr: stat=%x\n", stat); - - /* - * if a command completion interrupt is pending, do that first and - * check service afterwards - */ - if (rq) { - TCQ_PRINTK("ide_dmaq_intr: completion\n"); - return ide_dmaq_complete(drive, rq, stat); - } - - /* - * service interrupt - */ - if (stat & SRV_STAT) { - TCQ_PRINTK("ide_dmaq_intr: SERV (stat=%x)\n", stat); - return ide_service(drive); - } - - printk("ide_dmaq_intr: stat=%x, not expected\n", stat); - return ide_check_service(drive); -} - -/* - * check if the ata adapter this drive is attached to supports the - * NOP auto-poll for multiple tcq enabled drives on one channel - */ -static int ide_tcq_check_autopoll(ide_drive_t *drive) -{ - ide_task_t *args; - int i, drives; - - /* - * only need to probe if both drives on a channel support tcq - */ - for (i = 0, drives = 0; i < MAX_DRIVES; i++) - if (HWIF(drive)->drives[i].present && drive->media == ide_disk) - drives++; - - if (drives <= 1) - return 0; - - /* - * what a mess... - */ - args = kmalloc(sizeof(*args), GFP_ATOMIC); - if (!args) - return 1; - - memset(args, 0, sizeof(*args)); - - args->tfRegister[IDE_FEATURE_OFFSET] = 0x01; - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_NOP; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = ide_tcq_nop_handler; - return ide_raw_taskfile(drive, args, NULL); -} - -/* - * configure the drive for tcq - */ -static int ide_tcq_configure(ide_drive_t *drive) -{ - int tcq_mask = 1 << 1 | 1 << 14; - int tcq_bits = tcq_mask | 1 << 15; - ide_task_t *args; - - /* - * bit 14 and 1 must be set in word 83 of the device id to indicate - * support for dma queued protocol, and bit 15 must be cleared - */ - if ((drive->id->command_set_2 & tcq_bits) ^ tcq_mask) { - printk(KERN_INFO "%s: TCQ not supported\n", drive->name); - return -EIO; - } - - args = kmalloc(sizeof(*args), GFP_ATOMIC); - if (!args) - return -ENOMEM; - - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_WCACHE; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_WARNING "%s: failed to enable write cache\n", drive->name); - goto err; - } - - /* - * disable RELease interrupt, it's quicker to poll this after - * having sent the command opcode - */ - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_DIS_RI; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_ERR "%s: disabling release interrupt fail\n", drive->name); - goto err; - } - -#ifdef IDE_TCQ_FIDDLE_SI - /* - * enable SERVICE interrupt - */ - memset(args, 0, sizeof(ide_task_t)); - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; - args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_SI; - args->command_type = IDE_DRIVE_TASK_NO_DATA; - args->handler = &task_no_data_intr; - - if (ide_raw_taskfile(drive, args, NULL)) { - printk(KERN_ERR "%s: enabling service interrupt fail\n", drive->name); - goto err; - } -#endif - - kfree(args); - return 0; -err: - kfree(args); - return -EIO; -} - -/* - * for now assume that command list is always as big as we need and don't - * attempt to shrink it on tcq disable - */ -static int ide_enable_queued(ide_drive_t *drive, int on) -{ - struct ide_tcq_blacklist *itb; - int depth = drive->using_tcq ? drive->queue_depth : 0; - - /* - * disable or adjust queue depth - */ - if (!on) { - if (drive->using_tcq) - printk(KERN_INFO "%s: TCQ disabled\n", drive->name); - - drive->using_tcq = 0; - return 0; - } - - if (ide_tcq_configure(drive)) { - drive->using_tcq = 0; - return 1; - } - - /* - * some drives need limited transfer size in tcq - */ - itb = ide_find_drive_blacklist(drive); - if (itb && itb->max_sectors) { - if (itb->max_sectors > HWIF(drive)->rqsize) - itb->max_sectors = HWIF(drive)->rqsize; - - blk_queue_max_sectors(drive->queue, itb->max_sectors); - } - - /* - * enable block tagging - */ - if (!blk_queue_tagged(drive->queue)) - blk_queue_init_tags(drive->queue, IDE_MAX_TAG, NULL); - - /* - * check auto-poll support - */ - ide_tcq_check_autopoll(drive); - - if (depth != drive->queue_depth) - printk(KERN_INFO "%s: tagged command queueing enabled, command queue depth %d\n", drive->name, drive->queue_depth); - - drive->using_tcq = 1; - return 0; -} - -int ide_tcq_wait_dataphase(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - byte stat; - int i; - - do { - stat = hwif->INB(IDE_STATUS_REG); - if (!(stat & BUSY_STAT)) - break; - - udelay(10); - } while (1); - - if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat)) - return 0; - - i = 0; - udelay(1); - do { - stat = hwif->INB(IDE_STATUS_REG); - - if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat)) - break; - - ++i; - if (unlikely(i >= IDE_TCQ_WAIT)) - return 1; - - udelay(10); - } while (1); - - return 0; -} - -static int ide_tcq_check_blacklist(ide_drive_t *drive) -{ - struct ide_tcq_blacklist *itb = ide_find_drive_blacklist(drive); - - if (!itb) - return 0; - - return !itb->works; -} - -int __ide_dma_queued_on(ide_drive_t *drive) -{ - ide_hwif_t *hwif = HWIF(drive); - - if (drive->media != ide_disk) - return 1; - if (!drive->using_dma) - return 1; - if (hwif->chipset == ide_pdc4030) - return 1; - if (ide_tcq_check_blacklist(drive)) { - printk(KERN_WARNING "%s: tcq forbidden by blacklist\n", - drive->name); - return 1; - } - if (hwif->drives[0].present && hwif->drives[1].present) { - printk(KERN_WARNING "%s: only one drive on a channel supported" - " for tcq\n", drive->name); - return 1; - } - if (ata_pending_commands(drive)) { - printk(KERN_WARNING "ide-tcq; can't toggle tcq feature on " - "busy drive\n"); - return 1; - } - - return ide_enable_queued(drive, 1); -} - -int __ide_dma_queued_off(ide_drive_t *drive) -{ - if (drive->media != ide_disk) - return 1; - if (ata_pending_commands(drive)) { - printk("ide-tcq; can't toggle tcq feature on busy drive\n"); - return 1; - } - - return ide_enable_queued(drive, 0); -} - -static ide_startstop_t ide_dma_queued_rw(ide_drive_t *drive, u8 command) -{ - ide_hwif_t *hwif = HWIF(drive); - unsigned long flags; - byte stat, feat; - - TCQ_PRINTK("%s: starting tag\n", drive->name); - - /* - * set nIEN, tag start operation will enable again when - * it is safe - */ - drive_ctl_nien(drive, 1); - - TCQ_PRINTK("%s: sending cmd=%x\n", drive->name, command); - hwif->OUTB(command, IDE_COMMAND_REG); - - if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) { - printk("%s: alt stat timeout\n", drive->name); - goto err; - } - - drive_ctl_nien(drive, 0); - - if (stat & ERR_STAT) - goto err; - - /* - * bus not released, start dma - */ - feat = hwif->INB(IDE_NSECTOR_REG); - if (!(feat & REL)) { - TCQ_PRINTK("IMMED in queued_start, feat=%x\n", feat); - return __ide_dma_queued_start(drive); - } - - /* - * drive released the bus, clear active request and check for service - */ - spin_lock_irqsave(&ide_lock, flags); - HWGROUP(drive)->rq = NULL; - __ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr); - spin_unlock_irqrestore(&ide_lock, flags); - - TCQ_PRINTK("REL in queued_start\n"); - - stat = hwif->INB(IDE_STATUS_REG); - if (stat & SRV_STAT) - return ide_service(drive); - - return ide_released; -err: - ide_dump_status(drive, "rw_queued", stat); - ide_tcq_invalidate_queue(drive); - return ide_stopped; -} - -ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive) -{ - u8 command = WIN_READDMA_QUEUED; - - if (drive->addressing == 1) - command = WIN_READDMA_QUEUED_EXT; - - return ide_dma_queued_rw(drive, command); -} - -ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive) -{ - u8 command = WIN_WRITEDMA_QUEUED; - - if (drive->addressing == 1) - command = WIN_WRITEDMA_QUEUED_EXT; - - return ide_dma_queued_rw(drive, command); -} - -ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive) -{ - ide_hwgroup_t *hwgroup = HWGROUP(drive); - struct request *rq = hwgroup->rq; - ide_hwif_t *hwif = HWIF(drive); - unsigned int reading = 0; - - TCQ_PRINTK("ide_dma: setting up queued tag=%d\n", rq->tag); - - if (!hwgroup->busy) - printk(KERN_ERR "queued_rw: hwgroup not busy\n"); - - if (ide_tcq_wait_dataphase(drive)) { - printk(KERN_WARNING "timeout waiting for data phase\n"); - return ide_stopped; - } - - if (rq_data_dir(rq) == READ) - reading = 1 << 3; - - if (ide_start_dma(hwif, drive, reading)) - return ide_stopped; - - ide_tcq_set_intr(hwgroup, ide_dmaq_intr); - - if (!hwif->ide_dma_begin(drive)) - return ide_started; - - return ide_stopped; -} 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/hd98.c b/drivers/ide/legacy/hd98.c deleted file mode 100644 index 8028b57e2..000000000 --- a/drivers/ide/legacy/hd98.c +++ /dev/null @@ -1,883 +0,0 @@ -/* - * Copyright (C) 1991, 1992 Linus Torvalds - * - * This is the low-level hd interrupt support. It traverses the - * request-list, using interrupts to jump between functions. As - * all the functions are called within interrupts, we may not - * sleep. Special care is recommended. - * - * modified by Drew Eckhardt to check nr of hd's from the CMOS. - * - * Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug - * in the early extended-partition checks and added DM partitions - * - * IRQ-unmask, drive-id, multiple-mode, support for ">16 heads", - * and general streamlining by Mark Lord. - * - * Removed 99% of above. Use Mark's ide driver for those options. - * This is now a lightweight ST-506 driver. (Paul Gortmaker) - * - * Modified 1995 Russell King for ARM processor. - * - * Bugfix: max_sectors must be <= 255 or the wheels tend to come - * off in a hurry once you queue things up - Paul G. 02/2001 - */ - -/* Uncomment the following if you want verbose error reports. */ -/* #define VERBOSE_ERRORS */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* CMOS defines */ -#include -#include -#include - -#define REALLY_SLOW_IO -#include -#include -#include - -#include "io_ports.h" - -#ifdef __arm__ -#undef HD_IRQ -#endif -#include -#ifdef __arm__ -#define HD_IRQ IRQ_HARDDISK -#endif - -/* Hd controller regster ports */ - -#define HD_DATA 0x640 /* _CTL when writing */ -#define HD_ERROR 0x642 /* see err-bits */ -#define HD_NSECTOR 0x644 /* nr of sectors to read/write */ -#define HD_SECTOR 0x646 /* starting sector */ -#define HD_LCYL 0x648 /* starting cylinder */ -#define HD_HCYL 0x64a /* high byte of starting cyl */ -#define HD_CURRENT 0x64c /* 101dhhhh , d=drive, hhhh=head */ -#define HD_STATUS 0x64e /* see status-bits */ -#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */ -#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */ -#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */ - -#define HD_CMD 0x74c /* used for resets */ -#define HD_ALTSTATUS 0x74c /* same as HD_STATUS but doesn't clear irq */ - -/* Bits of HD_STATUS */ -#define ERR_STAT 0x01 -#define INDEX_STAT 0x02 -#define ECC_STAT 0x04 /* Corrected error */ -#define DRQ_STAT 0x08 -#define SEEK_STAT 0x10 -#define SERVICE_STAT SEEK_STAT -#define WRERR_STAT 0x20 -#define READY_STAT 0x40 -#define BUSY_STAT 0x80 - -/* Bits for HD_ERROR */ -#define MARK_ERR 0x01 /* Bad address mark */ -#define TRK0_ERR 0x02 /* couldn't find track 0 */ -#define ABRT_ERR 0x04 /* Command aborted */ -#define MCR_ERR 0x08 /* media change request */ -#define ID_ERR 0x10 /* ID field not found */ -#define MC_ERR 0x20 /* media changed */ -#define ECC_ERR 0x40 /* Uncorrectable ECC error */ -#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ -#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ - -static spinlock_t hd_lock = SPIN_LOCK_UNLOCKED; -static struct request_queue *hd_queue; - -#define CURRENT elv_next_request(hd_queue) - -#define TIMEOUT_VALUE (6*HZ) -#define HD_DELAY 0 - -#define MAX_ERRORS 16 /* Max read/write errors/sector */ -#define RESET_FREQ 8 /* Reset controller every 8th retry */ -#define RECAL_FREQ 4 /* Recalibrate every 4th retry */ -#define MAX_HD 2 - -#define STAT_OK (READY_STAT|SEEK_STAT) -#define OK_STATUS(s) (((s)&(STAT_OK|(BUSY_STAT|WRERR_STAT|ERR_STAT)))==STAT_OK) - -static void recal_intr(void); -static void bad_rw_intr(void); - -static int reset; -static int hd_error; - -/* - * This struct defines the HD's and their types. - */ -struct hd_i_struct { - unsigned int head,sect,cyl,wpcom,lzone,ctl; - int unit; - int recalibrate; - int special_op; -}; - -#ifdef HD_TYPE -static struct hd_i_struct hd_info[] = { HD_TYPE }; -static int NR_HD = ((sizeof (hd_info))/(sizeof (struct hd_i_struct))); -#else -static struct hd_i_struct hd_info[MAX_HD]; -static int NR_HD; -#endif - -static struct gendisk *hd_gendisk[MAX_HD]; - -static struct timer_list device_timer; - -#define TIMEOUT_VALUE (6*HZ) - -#define SET_TIMER \ - do { \ - mod_timer(&device_timer, jiffies + TIMEOUT_VALUE); \ - } while (0) - -static void (*do_hd)(void) = NULL; -#define SET_HANDLER(x) \ -if ((do_hd = (x)) != NULL) \ - SET_TIMER; \ -else \ - del_timer(&device_timer); - - -#if (HD_DELAY > 0) -unsigned long last_req; - -unsigned long read_timer(void) -{ - extern spinlock_t i8253_lock; - unsigned long t, flags; - int i; - - spin_lock_irqsave(&i8253_lock, flags); - t = jiffies * 11932; - outb_p(0, PIT_MODE); - i = inb_p(PIT_CH0); - i |= inb(PIT_CH0) << 8; - spin_unlock_irqrestore(&i8253_lock, flags); - return(t - i); -} -#endif - -void __init hd_setup(char *str, int *ints) -{ - int hdind = 0; - - if (ints[0] != 3) - return; - if (hd_info[0].head != 0) - hdind=1; - hd_info[hdind].head = ints[2]; - hd_info[hdind].sect = ints[3]; - hd_info[hdind].cyl = ints[1]; - hd_info[hdind].wpcom = 0; - hd_info[hdind].lzone = ints[1]; - hd_info[hdind].ctl = (ints[2] > 8 ? 8 : 0); - NR_HD = hdind+1; -} - -static void dump_status (const char *msg, unsigned int stat) -{ - char *name = CURRENT ? - CURRENT->rq_dev->bd_disk->disk_name : - "hd?"; -#ifdef VERBOSE_ERRORS - printk("%s: %s: status=0x%02x { ", name, msg, stat & 0xff); - if (stat & BUSY_STAT) printk("Busy "); - if (stat & READY_STAT) printk("DriveReady "); - if (stat & WRERR_STAT) printk("WriteFault "); - if (stat & SEEK_STAT) printk("SeekComplete "); - if (stat & DRQ_STAT) printk("DataRequest "); - if (stat & ECC_STAT) printk("CorrectedError "); - if (stat & INDEX_STAT) printk("Index "); - if (stat & ERR_STAT) printk("Error "); - printk("}\n"); - if ((stat & ERR_STAT) == 0) { - hd_error = 0; - } else { - hd_error = inb(HD_ERROR); - printk("%s: %s: error=0x%02x { ", name, msg, hd_error & 0xff); - if (hd_error & BBD_ERR) printk("BadSector "); - if (hd_error & ECC_ERR) printk("UncorrectableError "); - if (hd_error & ID_ERR) printk("SectorIdNotFound "); - if (hd_error & ABRT_ERR) printk("DriveStatusError "); - if (hd_error & TRK0_ERR) printk("TrackZeroNotFound "); - if (hd_error & MARK_ERR) printk("AddrMarkNotFound "); - printk("}"); - if (hd_error & (BBD_ERR|ECC_ERR|ID_ERR|MARK_ERR)) { - printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL), - inb(HD_CURRENT) & 0xf, inb(HD_SECTOR)); - if (CURRENT) - printk(", sector=%ld", CURRENT->sector); - } - printk("\n"); - } -#else - printk("%s: %s: status=0x%02x.\n", name, msg, stat & 0xff); - if ((stat & ERR_STAT) == 0) { - hd_error = 0; - } else { - hd_error = inb(HD_ERROR); - printk("%s: %s: error=0x%02x.\n", name, msg, hd_error & 0xff); - } -#endif -} - -void check_status(void) -{ - int i = inb(HD_STATUS); - - if (!OK_STATUS(i)) { - dump_status("check_status", i); - bad_rw_intr(); - } -} - -static int controller_busy(void) -{ - int retries = 100000; - unsigned char status; - - do { - status = inb(HD_STATUS); - } while ((status & BUSY_STAT) && --retries); - return status; -} - -static int status_ok(void) -{ - unsigned char status = inb(HD_STATUS); - - if (status & BUSY_STAT) - return 1; /* Ancient, but does it make sense??? */ - if (status & WRERR_STAT) - return 0; - if (!(status & READY_STAT)) - return 0; - if (!(status & SEEK_STAT)) - return 0; - return 1; -} - -static int controller_ready(unsigned int drive, unsigned int head) -{ - int retry = 100; - - do { - if (controller_busy() & BUSY_STAT) - return 0; - outb(0xA0 | (drive<<4) | head, HD_CURRENT); - if (status_ok()) - return 1; - } while (--retry); - return 0; -} - -static void hd_out(struct hd_i_struct *disk, - unsigned int nsect, - unsigned int sect, - unsigned int head, - unsigned int cyl, - unsigned int cmd, - void (*intr_addr)(void)) -{ - unsigned short port; - -#if (HD_DELAY > 0) - while (read_timer() - last_req < HD_DELAY) - /* nothing */; -#endif - if (reset) - return; - if (!controller_ready(disk->unit, head)) { - reset = 1; - return; - } - SET_HANDLER(intr_addr); - outb(disk->ctl,HD_CMD); - port=HD_DATA + 2; - outb(disk->wpcom>>2, port); port += 2; - outb(nsect, port); port += 2; - outb(sect, port); port += 2; - outb(cyl, port); port += 2; - outb(cyl>>8, port); port += 2; - outb(0xA0|(disk->unit<<4)|head, port); port += 2; - outb(cmd, port); -} - -static void hd_request (void); - -static int drive_busy(void) -{ - unsigned int i; - unsigned char c; - - for (i = 0; i < 500000 ; i++) { - c = inb(HD_STATUS); - if ((c & (BUSY_STAT | READY_STAT | SEEK_STAT)) == STAT_OK) - return 0; - } - dump_status("reset timed out", c); - return 1; -} - -static void reset_controller(void) -{ - int i; - - outb(4,HD_CMD); - for(i = 0; i < 1000; i++) barrier(); - outb(hd_info[0].ctl & 0x0f,HD_CMD); - for(i = 0; i < 1000; i++) barrier(); - if (drive_busy()) - printk("hd: controller still busy\n"); - else if ((hd_error = inb(HD_ERROR)) != 1) - printk("hd: controller reset failed: %02x\n",hd_error); -} - -static void reset_hd(void) -{ - static int i; - -repeat: - if (reset) { - reset = 0; - i = -1; - reset_controller(); - } else { - check_status(); - if (reset) - goto repeat; - } - if (++i < NR_HD) { - struct hd_i_struct *disk = &hd_info[i]; - disk->special_op = disk->recalibrate = 1; - hd_out(disk, disk->sect, disk->sect, disk->head-1, - disk->cyl, WIN_SPECIFY, &reset_hd); - if (reset) - goto repeat; - } else - hd_request(); -} - -/* - * Ok, don't know what to do with the unexpected interrupts: on some machines - * doing a reset and a retry seems to result in an eternal loop. Right now I - * ignore it, and just set the timeout. - * - * On laptops (and "green" PCs), an unexpected interrupt occurs whenever the - * drive enters "idle", "standby", or "sleep" mode, so if the status looks - * "good", we just ignore the interrupt completely. - */ -void unexpected_hd_interrupt(void) -{ - unsigned int stat = inb(HD_STATUS); - - if (stat & (BUSY_STAT|DRQ_STAT|ECC_STAT|ERR_STAT)) { - dump_status ("unexpected interrupt", stat); - SET_TIMER; - } -} - -/* - * bad_rw_intr() now tries to be a bit smarter and does things - * according to the error returned by the controller. - * -Mika Liljeberg (liljeber@cs.Helsinki.FI) - */ -static void bad_rw_intr(void) -{ - struct request *req = CURRENT; - struct hd_i_struct *disk; - - if (!req) - return; - disk = req->rq_disk->private_data; - if (++req->errors >= MAX_ERRORS || (hd_error & BBD_ERR)) { - end_request(req, 0); - disk->special_op = disk->recalibrate = 1; - } else if (req->errors % RESET_FREQ == 0) - reset = 1; - else if ((hd_error & TRK0_ERR) || req->errors % RECAL_FREQ == 0) - disk->special_op = disk->recalibrate = 1; - /* Otherwise just retry */ -} - -static inline int wait_DRQ(void) -{ - int retries = 100000, stat; - - while (--retries > 0) - if ((stat = inb(HD_STATUS)) & DRQ_STAT) - return 0; - dump_status("wait_DRQ", stat); - return -1; -} - -static void read_intr(void) -{ - int i, retries = 100000; - struct request *req; - - do { - i = (unsigned) inb(HD_STATUS); - if (i & BUSY_STAT) - continue; - if (!OK_STATUS(i)) - break; - if (i & DRQ_STAT) - goto ok_to_read; - } while (--retries > 0); - dump_status("read_intr", i); - bad_rw_intr(); - hd_request(); - return; -ok_to_read: - req = CURRENT; - insw(HD_DATA,req->buffer,256); - req->sector++; - req->buffer += 512; - req->errors = 0; - i = --req->nr_sectors; - --req->current_nr_sectors; -#ifdef DEBUG - printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n", - req->rq_disk->disk_name, req->sector, req->nr_sectors, - req->buffer+512); -#endif - if (req->current_nr_sectors <= 0) - end_request(req, 1); - if (i > 0) { - SET_HANDLER(&read_intr); - return; - } - (void) inb(HD_STATUS); -#if (HD_DELAY > 0) - last_req = read_timer(); -#endif - if (CURRENT) - hd_request(); - return; -} - -static void write_intr(void) -{ - int i; - int retries = 100000; - struct request *req = CURRENT; - - do { - i = (unsigned) inb(HD_STATUS); - if (i & BUSY_STAT) - continue; - if (!OK_STATUS(i)) - break; - if ((req->nr_sectors <= 1) || (i & DRQ_STAT)) - goto ok_to_write; - } while (--retries > 0); - dump_status("write_intr", i); - bad_rw_intr(); - hd_request(); - return; -ok_to_write: - req->sector++; - i = --req->nr_sectors; - --req->current_nr_sectors; - req->buffer += 512; - if (!i || (req->bio && req->current_nr_sectors < 1)) - end_request(req, 1); - if (i > 0) { - SET_HANDLER(&write_intr); - outsw(HD_DATA,req->buffer,256); - local_irq_enable(); - } else { -#if (HD_DELAY > 0) - last_req = read_timer(); -#endif - hd_request(); - } - return; -} - -static void recal_intr(void) -{ - check_status(); -#if (HD_DELAY > 0) - last_req = read_timer(); -#endif - hd_request(); -} - -/* - * This is another of the error-routines I don't know what to do with. The - * best idea seems to just set reset, and start all over again. - */ -static void hd_times_out(unsigned long dummy) -{ - do_hd = NULL; - - if (!CURRENT) - return; - - disable_irq(HD_IRQ); - local_irq_enable(); - reset = 1; - printk("%s: timeout\n", CURRENT->rq_disk->disk_name); - if (++CURRENT->errors >= MAX_ERRORS) { -#ifdef DEBUG - printk("%s: too many errors\n", CURRENT->rq_disk->disk_name); -#endif - end_request(CURRENT, 0); - } - local_irq_disable(); - hd_request(); - enable_irq(HD_IRQ); -} - -int do_special_op(struct hd_i_struct *disk, struct request *req) -{ - if (disk->recalibrate) { - disk->recalibrate = 0; - hd_out(disk, disk->sect,0,0,0,WIN_RESTORE,&recal_intr); - return reset; - } - if (disk->head > 16) { - printk ("%s: cannot handle device with more than 16 heads - giving up\n", req->rq_disk->disk_name); - end_request(req, 0); - } - disk->special_op = 0; - return 1; -} - -/* - * The driver enables interrupts as much as possible. In order to do this, - * (a) the device-interrupt is disabled before entering hd_request(), - * and (b) the timeout-interrupt is disabled before the sti(). - * - * Interrupts are still masked (by default) whenever we are exchanging - * data/cmds with a drive, because some drives seem to have very poor - * tolerance for latency during I/O. The IDE driver has support to unmask - * interrupts for non-broken hardware, so use that driver if required. - */ -static void hd_request(void) -{ - unsigned int block, nsect, sec, track, head, cyl; - struct hd_i_struct *disk; - struct request *req; - - if (do_hd) - return; -repeat: - del_timer(&device_timer); - local_irq_enable(); - - if (!CURRENT) { - do_hd = NULL; - return; - } - req = CURRENT; - - if (reset) { - local_irq_disable(); - reset_hd(); - return; - } - disk = req->rq_disk->private_data; - block = req->sector; - nsect = req->nr_sectors; - if (block >= get_capacity(req->rq_disk) || - ((block+nsect) > get_capacity(req->rq_disk))) { - printk("%s: bad access: block=%d, count=%d\n", - req->rq_disk->disk_name, block, nsect); - end_request(req, 0); - goto repeat; - } - - if (disk->special_op) { - if (do_special_op(disk, req)) - goto repeat; - return; - } - sec = block % disk->sect + 1; - track = block / disk->sect; - head = track % disk->head; - cyl = track / disk->head; -#ifdef DEBUG - printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n", - req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ", - cyl, head, sec, nsect, req->buffer); -#endif - if (req->flags & REQ_CMD) { - switch (rq_data_dir(req)) { - case READ: - hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr); - if (reset) - goto repeat; - break; - case WRITE: - hd_out(disk,nsect,sec,head,cyl,WIN_WRITE,&write_intr); - if (reset) - goto repeat; - if (wait_DRQ()) { - bad_rw_intr(); - goto repeat; - } - outsw(HD_DATA,req->buffer,256); - break; - default: - printk("unknown hd-command\n"); - end_request(req, 0); - break; - } - } -} - -static void do_hd_request (request_queue_t * q) -{ - disable_irq(HD_IRQ); - hd_request(); - enable_irq(HD_IRQ); -} - -static int hd_ioctl(struct inode * inode, struct file * file, - unsigned int cmd, unsigned long arg) -{ - struct hd_i_struct *disk = inode->i_bdev->bd_disk->private_data; - struct hd_geometry *loc = (struct hd_geometry *) arg; - struct hd_geometry g; - - if (cmd != HDIO_GETGEO) - return -EINVAL; - if (!loc) - return -EINVAL; - g.heads = disk->head; - g.sectors = disk->sect; - g.cylinders = disk->cyl; - g.start = get_start_sect(inode->i_bdev); - return copy_to_user(loc, &g, sizeof g) ? -EFAULT : 0; -} - -/* - * Releasing a block device means we sync() it, so that it can safely - * be forgotten about... - */ - -static void hd_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - void (*handler)(void) = do_hd; - - do_hd = NULL; - del_timer(&device_timer); - if (!handler) - handler = unexpected_hd_interrupt; - handler(); - local_irq_enable(); -} - -static struct block_device_operations hd_fops = { - .ioctl = hd_ioctl, -}; - -/* - * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags - * means we run the IRQ-handler with interrupts disabled: this is bad for - * interrupt latency, but anything else has led to problems on some - * machines. - * - * We enable interrupts in some of the routines after making sure it's - * safe. - */ - -static int __init hd_init(void) -{ - int drive; - if (register_blkdev(HD_MAJOR,"hd")) { - printk("hd: unable to get major %d for hard disk\n",HD_MAJOR); - return -1; - } - hd_queue = blk_init_queue(do_hd_request, &hd_lock); - if (!hd_queue) { - unregister_blkdev(HD_MAJOR,"hd"); - return -1; - } - blk_queue_max_sectors(hd_queue, 255); - init_timer(&device_timer); - device_timer.function = hd_times_out; - blk_queue_hardsect_size(hd_queue, 512); - -#ifdef __i386__ - if (!NR_HD) { - extern struct drive_info drive_info; - unsigned char *BIOS = (unsigned char *) &drive_info; - unsigned long flags; -#ifndef CONFIG_X86_PC9800 - int cmos_disks; -#endif - - for (drive=0 ; drive<2 ; drive++) { - hd_info[drive].cyl = *(unsigned short *) BIOS; - hd_info[drive].head = *(3+BIOS); - hd_info[drive].sect = *(2+BIOS); - hd_info[drive].wpcom = 0; - hd_info[drive].ctl = *(3+BIOS) > 8 ? 8 : 0; - hd_info[drive].lzone = *(unsigned short *) BIOS; - if (hd_info[drive].cyl && NR_HD == drive) - NR_HD++; - BIOS += 6; - } - - } -#endif /* __i386__ */ -#ifdef __arm__ - if (!NR_HD) { - /* We don't know anything about the drive. This means - * that you *MUST* specify the drive parameters to the - * kernel yourself. - */ - printk("hd: no drives specified - use hd=cyl,head,sectors" - " on kernel command line\n"); - } -#endif - if (!NR_HD) - goto out; - - for (drive=0 ; drive < NR_HD ; drive++) { - struct gendisk *disk = alloc_disk(64); - struct hd_i_struct *p = &hd_info[drive]; - if (!disk) - goto Enomem; - disk->major = HD_MAJOR; - disk->first_minor = drive << 6; - disk->fops = &hd_fops; - sprintf(disk->disk_name, "hd%c", 'a'+drive); - disk->private_data = p; - set_capacity(disk, p->head * p->sect * p->cyl); - disk->queue = hd_queue; - p->unit = drive; - hd_gendisk[drive] = disk; - printk ("%s: %luMB, CHS=%d/%d/%d\n", - disk->disk_name, (unsigned long)get_capacity(disk)/2048, - p->cyl, p->head, p->sect); - } - - if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) { - printk("hd: unable to get IRQ%d for the hard disk driver\n", - HD_IRQ); - goto out1; - } - - if (!request_region(HD_DATA, 2, "hd(data)")) { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - NR_HD = 0; - free_irq(HD_IRQ, NULL); - return; - } - - if (!request_region(HD_DATA + 2, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out2; - } - - if (!request_region(HD_DATA + 4, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out3; - } - - if (!request_region(HD_DATA + 6, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out4; - } - - if (!request_region(HD_DATA + 8, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out5; - } - - if (!request_region(HD_DATA + 10, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out6; - } - - if (!request_region(HD_DATA + 12, 1, "hd")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_DATA); - goto out7; - } - - if (!request_region(HD_CMD, 1, "hd(cmd)")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_CMD); - goto out8; - } - - if (!request_region(HD_CMD + 2, 1, "hd(cmd)")) - { - printk(KERN_WARNING "hd: port 0x%x busy\n", HD_CMD); - goto out9; - } - - for(drive=0; drive < NR_HD; drive++) - add_disk(hd_gendisk[drive]); - return 0; - -out9: - release_region(HD_CMD, 1); -out8: - release_region(HD_DATA + 12, 1); -out7: - release_region(HD_DATA + 10, 1); -out6: - release_region(HD_DATA + 8, 1); -out5: - release_region(HD_DATA + 6, 1); -out4: - release_region(HD_DATA + 4, 1); -out3: - release_region(HD_DATA + 2, 1); -out2: - release_region(HD_DATA, 2); - free_irq(HD_IRQ, NULL); -out1: - for (drive = 0; drive < NR_HD; drive++) - put_disk(hd_gendisk[drive]); - NR_HD = 0; -out: - del_timer(&device_timer); - unregister_blkdev(HD_MAJOR,"hd"); - blk_cleanup_queue(hd_queue); - return -1; -Enomem: - while (drive--) - put_disk(hd_gendisk[drive]); - goto out; -} - -static int parse_hd_setup (char *line) { - int ints[6]; - - (void) get_options(line, ARRAY_SIZE(ints), ints); - hd_setup(NULL, ints); - - return 1; -} -__setup("hd=", parse_hd_setup); - -module_init(hd_init); diff --git a/drivers/ide/legacy/pc9800.c b/drivers/ide/legacy/pc9800.c deleted file mode 100644 index 6b91a1826..000000000 --- a/drivers/ide/legacy/pc9800.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ide_pc9800.c - * - * Copyright (C) 1997-2000 Linux/98 project, - * Kyoto University Microcomputer Club. - */ - -#include -#include -#include -#include -#include - -#include -#include - -#define PC9800_IDE_BANKSELECT 0x432 - -#undef PC9800_IDE_DEBUG - -static void pc9800_select(ide_drive_t *drive) -{ -#ifdef PC9800_IDE_DEBUG - byte old; - - /* Too noisy: */ - /* printk(KERN_DEBUG "pc9800_select(%s)\n", drive->name); */ - - outb(0x80, PC9800_IDE_BANKSELECT); - old = inb(PC9800_IDE_BANKSELECT); - if (old != HWIF(drive)->index) - printk(KERN_DEBUG "ide-pc9800: switching bank #%d -> #%d\n", - old, HWIF(drive)->index); -#endif - outb(HWIF(drive)->index, PC9800_IDE_BANKSELECT); -} - -void __init ide_probe_for_pc9800(void) -{ - u8 saved_bank; - - if (!PC9800_9821_P() /* || !PC9821_IDEIF_DOUBLE_P() */) - return; - - if (!request_region(PC9800_IDE_BANKSELECT, 1, "ide0/1 bank")) { - printk(KERN_ERR - "ide: bank select port (%#x) is already occupied!\n", - PC9800_IDE_BANKSELECT); - return; - } - - /* Do actual probing. */ - if ((saved_bank = inb(PC9800_IDE_BANKSELECT)) == (u8) ~0 - || (outb(saved_bank ^ 1, PC9800_IDE_BANKSELECT), - /* Next outb is dummy for reading status. */ - outb(0x80, PC9800_IDE_BANKSELECT), - inb(PC9800_IDE_BANKSELECT) != (saved_bank ^ 1))) { - printk(KERN_INFO - "ide: pc9800 type bank selecting port not found\n"); - release_region(PC9800_IDE_BANKSELECT, 1); - return; - } - - /* Restore original value, just in case. */ - outb(saved_bank, PC9800_IDE_BANKSELECT); - - /* These ports are reseved by IDE I/F. */ - if (!request_region(0x430, 1, "ide") || - !request_region(0x435, 1, "ide")) { - printk(KERN_WARNING - "ide: IO port 0x430 and 0x435 are reserved for IDE" - " the card using these ports may not work\n"); - } - - if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET] == HD_DATA && - ide_hwifs[1].io_ports[IDE_DATA_OFFSET] == HD_DATA) { - ide_hwifs[0].chipset = ide_pc9800; - ide_hwifs[0].mate = &ide_hwifs[1]; - ide_hwifs[0].selectproc = pc9800_select; - ide_hwifs[1].chipset = ide_pc9800; - ide_hwifs[1].mate = &ide_hwifs[0]; - ide_hwifs[1].selectproc = pc9800_select; - } -} 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.h b/drivers/ide/pci/alim15x3.h deleted file mode 100644 index 989bb9be2..000000000 --- a/drivers/ide/pci/alim15x3.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef ALI15X3_H -#define ALI15X3_H - -#include -#include -#include - -#define DISPLAY_ALI_TIMINGS - -static unsigned int init_chipset_ali15x3(struct pci_dev *, const char *); -static void init_hwif_common_ali15x3(ide_hwif_t *); -static void init_hwif_ali15x3(ide_hwif_t *); -static void init_dma_ali15x3(ide_hwif_t *, unsigned long); - -static ide_pci_device_t ali15x3_chipsets[] __devinitdata = { - { /* 0 */ - .name = "ALI15X3", - .init_chipset = init_chipset_ali15x3, - .init_hwif = init_hwif_ali15x3, - .init_dma = init_dma_ali15x3, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* ALI15X3 */ 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/cs5520.h b/drivers/ide/pci/cs5520.h deleted file mode 100644 index f2cdc5343..000000000 --- a/drivers/ide/pci/cs5520.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef CS5520_H -#define CS5520_H - -#include -#include -#include - -#define DISPLAY_CS5520_TIMINGS - -static unsigned int init_chipset_cs5520(struct pci_dev *, const char *); -static void init_hwif_cs5520(ide_hwif_t *); -static void cs5520_init_setup_dma(struct pci_dev *dev, struct ide_pci_device_s *d, ide_hwif_t *hwif); - -static ide_pci_device_t cyrix_chipsets[] __devinitdata = { - { - .name = "Cyrix 5510", - .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, - }, - { - .name = "Cyrix 5520", - .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, - } -}; - - -#endif /* CS5520_H */ - - 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/cs5530.h b/drivers/ide/pci/cs5530.h deleted file mode 100644 index 08fe18a09..000000000 --- a/drivers/ide/pci/cs5530.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CS5530_H -#define CS5530_H - -#include -#include -#include - -#define DISPLAY_CS5530_TIMINGS - -static unsigned int init_chipset_cs5530(struct pci_dev *, const char *); -static void init_hwif_cs5530(ide_hwif_t *); - -static ide_pci_device_t cs5530_chipsets[] __devinitdata = { - { /* 0 */ - .name = "CS5530", - .init_chipset = init_chipset_cs5530, - .init_hwif = init_hwif_cs5530, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - .flags = IDEPCI_FLAG_FORCE_MASTER, - } -}; - -#endif /* CS5530_H */ 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/ns87415.h b/drivers/ide/pci/ns87415.h deleted file mode 100644 index a2594c7fd..000000000 --- a/drivers/ide/pci/ns87415.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef NS87415_H -#define NS87415_H - -#include -#include -#include - -static void init_hwif_ns87415(ide_hwif_t *); - -static ide_pci_device_t ns87415_chipsets[] __devinitdata = { - { /* 0 */ - .name = "NS87415", - .init_hwif = init_hwif_ns87415, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* NS87415_H */ 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/rz1000.h b/drivers/ide/pci/rz1000.h deleted file mode 100644 index 5c7c611c5..000000000 --- a/drivers/ide/pci/rz1000.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RZ100X_H -#define RZ100X_H - -#include -#include -#include - -static void init_hwif_rz1000(ide_hwif_t *); - -static ide_pci_device_t rz1000_chipsets[] __devinitdata = { - { - .name = "RZ1000", - .init_hwif = init_hwif_rz1000, - .channels = 2, - .autodma = NODMA, - .bootable = ON_BOARD, - },{ - .name = "RZ1001", - .init_hwif = init_hwif_rz1000, - .channels = 2, - .autodma = NODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* RZ100X_H */ 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/sc1200.h b/drivers/ide/pci/sc1200.h deleted file mode 100644 index c58e68988..000000000 --- a/drivers/ide/pci/sc1200.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SC1200_H -#define SC1200_H - -#include -#include -#include - -#define DISPLAY_SC1200_TIMINGS - -static unsigned int init_chipset_sc1200(struct pci_dev *, const char *); -static void init_hwif_sc1200(ide_hwif_t *); - -static ide_pci_device_t sc1200_chipsets[] __devinitdata = { - { /* 0 */ - .name = "SC1200", - .init_chipset = init_chipset_sc1200, - .init_hwif = init_hwif_sc1200, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* SC1200_H */ 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/siimage.h b/drivers/ide/pci/siimage.h deleted file mode 100644 index b83b4c336..000000000 --- a/drivers/ide/pci/siimage.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef SIIMAGE_H -#define SIIMAGE_H - -#include -#include - -#include - -#undef SIIMAGE_VIRTUAL_DMAPIO -#undef SIIMAGE_BUFFERED_TASKFILE -#undef SIIMAGE_LARGE_DMA - -#define SII_DEBUG 0 - -#if SII_DEBUG -#define siiprintk(x...) printk(x) -#else -#define siiprintk(x...) -#endif - -static unsigned int init_chipset_siimage(struct pci_dev *, const char *); -static void init_iops_siimage(ide_hwif_t *); -static void init_hwif_siimage(ide_hwif_t *); - -static ide_pci_device_t siimage_chipsets[] __devinitdata = { - { /* 0 */ - .name = "SiI680", - .init_chipset = init_chipset_siimage, - .init_iops = init_iops_siimage, - .init_hwif = init_hwif_siimage, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - },{ /* 1 */ - .name = "SiI3112 Serial ATA", - .init_chipset = init_chipset_siimage, - .init_iops = init_iops_siimage, - .init_hwif = init_hwif_siimage, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - },{ /* 2 */ - .name = "Adaptec AAR-1210SA", - .init_chipset = init_chipset_siimage, - .init_iops = init_iops_siimage, - .init_hwif = init_hwif_siimage, - .channels = 2, - .autodma = AUTODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* SIIMAGE_H */ 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/sis5513.h b/drivers/ide/pci/sis5513.h deleted file mode 100644 index d66e9a74b..000000000 --- a/drivers/ide/pci/sis5513.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SIS5513_H -#define SIS5513_H - -#include -#include -#include - -#define DISPLAY_SIS_TIMINGS - -static unsigned int init_chipset_sis5513(struct pci_dev *, const char *); -static void init_hwif_sis5513(ide_hwif_t *); - -static ide_pci_device_t sis5513_chipsets[] __devinitdata = { - { /* 0 */ - .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, - } -}; - -#endif /* SIS5513_H */ 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/sl82c105.h b/drivers/ide/pci/sl82c105.h deleted file mode 100644 index f2d34a254..000000000 --- a/drivers/ide/pci/sl82c105.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef W82C105_H -#define W82C105_H - -#include -#include -#include - -static unsigned int init_chipset_sl82c105(struct pci_dev *, const char *); -static void init_hwif_sl82c105(ide_hwif_t *); -static void init_dma_sl82c105(ide_hwif_t *, unsigned long); - -static ide_pci_device_t sl82c105_chipsets[] __devinitdata = { - { /* 0 */ - .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, - } -}; - -#endif /* W82C105_H */ 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/slc90e66.h b/drivers/ide/pci/slc90e66.h deleted file mode 100644 index 57017958c..000000000 --- a/drivers/ide/pci/slc90e66.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SLC90E66_H -#define SLC90E66_H - -#include -#include -#include - -#define DISPLAY_SLC90E66_TIMINGS - -#define SLC90E66_DEBUG_DRIVE_INFO 0 - -static unsigned int init_chipset_slc90e66(struct pci_dev *, const char *); -static void init_hwif_slc90e66(ide_hwif_t *); - -static ide_pci_device_t slc90e66_chipsets[] __devinitdata = { - { /* 0 */ - .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, - } -}; - -#endif /* SLC90E66_H */ 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/triflex.h b/drivers/ide/pci/triflex.h deleted file mode 100644 index f826608f5..000000000 --- a/drivers/ide/pci/triflex.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * triflex.h - * - * Copyright (C) 2002 Hewlett-Packard Development Group, L.P. - * Author: Torben Mathiasen - * - */ -#ifndef TRIFLEX_H -#define TRIFLEX_H - -#include -#include -#include - -static unsigned int __devinit init_chipset_triflex(struct pci_dev *, const char *); -static void init_hwif_triflex(ide_hwif_t *); - -static ide_pci_device_t triflex_devices[] __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 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); - -#endif /* TRIFLEX_H */ 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/trm290.h b/drivers/ide/pci/trm290.h deleted file mode 100644 index 6c001d4d5..000000000 --- a/drivers/ide/pci/trm290.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TRM290_H -#define TRM290_H - -#include -#include -#include - -extern void init_hwif_trm290(ide_hwif_t *); - -static ide_pci_device_t trm290_chipsets[] __devinitdata = { - { /* 0 */ - .name = "TRM290", - .init_hwif = init_hwif_trm290, - .channels = 2, - .autodma = NOAUTODMA, - .bootable = ON_BOARD, - } -}; - -#endif /* TRM290_H */ 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/ide/pci/via82cxxx.h b/drivers/ide/pci/via82cxxx.h deleted file mode 100644 index 6504ca08a..000000000 --- a/drivers/ide/pci/via82cxxx.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef VIA82CXXX_H -#define VIA82CXXX_H - -#include -#include -#include - -#define DISPLAY_VIA_TIMINGS - -static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *); -static void init_hwif_via82cxxx(ide_hwif_t *); - -static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { - { /* 0 */ - .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, - } -}; - -#endif /* VIA82CXXX_H */ 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/eth1394.c b/drivers/ieee1394/eth1394.c index 48a7c5049..95ccc698e 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c @@ -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); 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/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/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/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/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/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/joydev.c b/drivers/input/joydev.c index 3cc849e03..5eb884656 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -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; } } 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/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/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/keyboard/98kbd.c b/drivers/input/keyboard/98kbd.c deleted file mode 100644 index 970a5ae1a..000000000 --- a/drivers/input/keyboard/98kbd.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * drivers/input/keyboard/98kbd.c - * - * PC-9801 keyboard driver for Linux - * - * Based on atkbd.c and xtkbd.c written by Vojtech Pavlik - * - * Copyright (c) 2002 Osamu Tomita - * Copyright (c) 1999-2001 Vojtech Pavlik - */ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -MODULE_AUTHOR("Osamu Tomita "); -MODULE_DESCRIPTION("PC-9801 keyboard driver"); -MODULE_LICENSE("GPL"); - -#define KBD98_KEY 0x7f -#define KBD98_RELEASE 0x80 - -static unsigned char kbd98_keycode[256] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 43, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 41, 26, 28, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 27, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 12, 57, 92,109,104,110,111,103,105,106,108,102,107, - 74, 98, 71, 72, 73, 55, 75, 76, 77, 78, 79, 80, 81,117, 82,121, - 83, 94, 87, 88,183,184,185, 0, 0, 0, 0, 0, 0, 0,102, 0, - 99,133, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, 0, 0, 0, - 54, 58, 42, 56, 29 -}; - -struct jis_kbd_conv { - unsigned char scancode; - struct { - unsigned char shift; - unsigned char keycode; - } emul[2]; -}; - -static struct jis_kbd_conv kbd98_jis[] = { - {0x02, {{0, 3}, {1, 40}}}, - {0x06, {{0, 7}, {1, 8}}}, - {0x07, {{0, 8}, {0, 40}}}, - {0x08, {{0, 9}, {1, 10}}}, - {0x09, {{0, 10}, {1, 11}}}, - {0x0a, {{0, 11}, {1, 255}}}, - {0x0b, {{0, 12}, {0, 13}}}, - {0x0c, {{1, 7}, {0, 41}}}, - {0x1a, {{1, 3}, {1, 41}}}, - {0x26, {{0, 39}, {1, 13}}}, - {0x27, {{1, 39}, {1, 9}}}, - {0x33, {{0, 255}, {1, 12}}}, - {0xff, {{0, 255}, {1, 255}}} /* terminater */ -}; - -#define KBD98_CMD_SETEXKEY 0x1095 /* Enable/Disable Windows, Appli key */ -#define KBD98_CMD_SETRATE 0x109c /* Set typematic rate */ -#define KBD98_CMD_SETLEDS 0x109d /* Set keyboard leds */ -#define KBD98_CMD_GETLEDS 0x119d /* Get keyboard leds */ -#define KBD98_CMD_GETID 0x019f - -#define KBD98_RET_ACK 0xfa -#define KBD98_RET_NAK 0xfc /* Command NACK, send the cmd again */ - -#define KBD98_KEY_JIS_EMUL 253 -#define KBD98_KEY_UNKNOWN 254 -#define KBD98_KEY_NULL 255 - -static char *kbd98_name = "PC-9801 Keyboard"; - -struct kbd98 { - unsigned char keycode[256]; - struct input_dev dev; - struct serio *serio; - char phys[32]; - unsigned char cmdbuf[4]; - unsigned char cmdcnt; - signed char ack; - unsigned char shift; - struct { - unsigned char scancode; - unsigned char keycode; - } emul; - struct jis_kbd_conv jis[16]; -}; - -irqreturn_t kbd98_interrupt(struct serio *serio, unsigned char data, - unsigned int flags, struct pt_regs *regs) -{ - struct kbd98 *kbd98 = serio->private; - unsigned char scancode, keycode; - int press, i; - - switch (data) { - case KBD98_RET_ACK: - kbd98->ack = 1; - goto out; - case KBD98_RET_NAK: - kbd98->ack = -1; - goto out; - } - - if (kbd98->cmdcnt) { - kbd98->cmdbuf[--kbd98->cmdcnt] = data; - goto out; - } - - scancode = data & KBD98_KEY; - keycode = kbd98->keycode[scancode]; - press = !(data & KBD98_RELEASE); - if (kbd98->emul.scancode != KBD98_KEY_UNKNOWN - && scancode != kbd98->emul.scancode) { - input_report_key(&kbd98->dev, kbd98->emul.keycode, 0); - kbd98->emul.scancode = KBD98_KEY_UNKNOWN; - } - - if (keycode == KEY_RIGHTSHIFT) - kbd98->shift = press; - - switch (keycode) { - case KEY_2: - case KEY_6: - case KEY_7: - case KEY_8: - case KEY_9: - case KEY_0: - case KEY_MINUS: - case KEY_EQUAL: - case KEY_GRAVE: - case KEY_SEMICOLON: - case KEY_APOSTROPHE: - /* emulation: JIS keyboard to US101 keyboard */ - i = 0; - while (kbd98->jis[i].scancode != 0xff) { - if (scancode == kbd98->jis[i].scancode) - break; - i ++; - } - - keycode = kbd98->jis[i].emul[kbd98->shift].keycode; - if (keycode == KBD98_KEY_NULL) - break; - - if (press) { - kbd98->emul.scancode = scancode; - kbd98->emul.keycode = keycode; - if (kbd98->jis[i].emul[kbd98->shift].shift - != kbd98->shift) - input_report_key(&kbd98->dev, - KEY_RIGHTSHIFT, - !(kbd98->shift)); - } - - input_report_key(&kbd98->dev, keycode, press); - if (!press) { - if (kbd98->jis[i].emul[kbd98->shift].shift - != kbd98->shift) - input_report_key(&kbd98->dev, - KEY_RIGHTSHIFT, - kbd98->shift); - kbd98->emul.scancode = KBD98_KEY_UNKNOWN; - } - - input_sync(&kbd98->dev); - break; - - case KEY_CAPSLOCK: - input_report_key(&kbd98->dev, keycode, 1); - input_sync(&kbd98->dev); - input_report_key(&kbd98->dev, keycode, 0); - input_sync(&kbd98->dev); - break; - - case KBD98_KEY_NULL: - break; - - case 0: - printk(KERN_WARNING "kbd98.c: Unknown key (scancode %#x) %s.\n", - data & KBD98_KEY, data & KBD98_RELEASE ? "released" : "pressed"); - break; - - default: - input_report_key(&kbd98->dev, keycode, press); - input_sync(&kbd98->dev); - break; - } - -out: - return IRQ_HANDLED; -} - -/* - * kbd98_sendbyte() sends a byte to the keyboard, and waits for - * acknowledge. It doesn't handle resends according to the keyboard - * protocol specs, because if these are needed, the keyboard needs - * replacement anyway, and they only make a mess in the protocol. - */ - -static int kbd98_sendbyte(struct kbd98 *kbd98, unsigned char byte) -{ - int timeout = 10000; /* 100 msec */ - kbd98->ack = 0; - - if (serio_write(kbd98->serio, byte)) - return -1; - - while (!kbd98->ack && timeout--) udelay(10); - - return -(kbd98->ack <= 0); -} - -/* - * kbd98_command() sends a command, and its parameters to the keyboard, - * then waits for the response and puts it in the param array. - */ - -static int kbd98_command(struct kbd98 *kbd98, unsigned char *param, int command) -{ - int timeout = 50000; /* 500 msec */ - int send = (command >> 12) & 0xf; - int receive = (command >> 8) & 0xf; - int i; - - kbd98->cmdcnt = receive; - - if (command & 0xff) - if (kbd98_sendbyte(kbd98, command & 0xff)) - return (kbd98->cmdcnt = 0) - 1; - - for (i = 0; i < send; i++) - if (kbd98_sendbyte(kbd98, param[i])) - return (kbd98->cmdcnt = 0) - 1; - - while (kbd98->cmdcnt && timeout--) udelay(10); - - if (param) - for (i = 0; i < receive; i++) - param[i] = kbd98->cmdbuf[(receive - 1) - i]; - - if (kbd98->cmdcnt) - return (kbd98->cmdcnt = 0) - 1; - - return 0; -} - -/* - * Event callback from the input module. Events that change the state of - * the hardware are processed here. - */ - -static int kbd98_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) -{ - struct kbd98 *kbd98 = dev->private; - char param[2]; - - switch (type) { - - case EV_LED: - - if (__PC9800SCA_TEST_BIT(0x481, 3)) { - /* 98note with Num Lock key */ - /* keep Num Lock status */ - *param = 0x60; - if (kbd98_command(kbd98, param, - KBD98_CMD_GETLEDS)) - printk(KERN_DEBUG - "kbd98: Get keyboard LED" - " status Error\n"); - - *param &= 1; - } else { - /* desktop PC-9801 */ - *param = 1; /* Always set Num Lock */ - } - - *param |= 0x70 - | (test_bit(LED_CAPSL, dev->led) ? 4 : 0) - | (test_bit(LED_KANA, dev->led) ? 8 : 0); - kbd98_command(kbd98, param, KBD98_CMD_SETLEDS); - - return 0; - } - - return -1; -} - -void kbd98_connect(struct serio *serio, struct serio_dev *dev) -{ - struct kbd98 *kbd98; - int i; - - if ((serio->type & SERIO_TYPE) != SERIO_PC9800) - return; - - if (!(kbd98 = kmalloc(sizeof(struct kbd98), GFP_KERNEL))) - return; - - memset(kbd98, 0, sizeof(struct kbd98)); - kbd98->emul.scancode = KBD98_KEY_UNKNOWN; - - kbd98->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); - kbd98->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_KANA); - - kbd98->serio = serio; - - init_input_dev(&kbd98->dev); - kbd98->dev.keycode = kbd98->keycode; - kbd98->dev.keycodesize = sizeof(unsigned char); - kbd98->dev.keycodemax = ARRAY_SIZE(kbd98_keycode); - kbd98->dev.event = kbd98_event; - kbd98->dev.private = kbd98; - - serio->private = kbd98; - - if (serio_open(serio, dev)) { - kfree(kbd98); - return; - } - - memcpy(kbd98->jis, kbd98_jis, sizeof(kbd98_jis)); - memcpy(kbd98->keycode, kbd98_keycode, sizeof(kbd98->keycode)); - for (i = 0; i < 255; i++) - set_bit(kbd98->keycode[i], kbd98->dev.keybit); - clear_bit(0, kbd98->dev.keybit); - - sprintf(kbd98->phys, "%s/input0", serio->phys); - - kbd98->dev.name = kbd98_name; - kbd98->dev.phys = kbd98->phys; - kbd98->dev.id.bustype = BUS_XTKBD; - kbd98->dev.id.vendor = 0x0002; - kbd98->dev.id.product = 0x0001; - kbd98->dev.id.version = 0x0100; - - input_register_device(&kbd98->dev); - - printk(KERN_INFO "input: %s on %s\n", kbd98_name, serio->phys); -} - -void kbd98_disconnect(struct serio *serio) -{ - struct kbd98 *kbd98 = serio->private; - input_unregister_device(&kbd98->dev); - serio_close(serio); - kfree(kbd98); -} - -struct serio_dev kbd98_dev = { - .interrupt = kbd98_interrupt, - .connect = kbd98_connect, - .disconnect = kbd98_disconnect -}; - -int __init kbd98_init(void) -{ - serio_register_device(&kbd98_dev); - return 0; -} - -void __exit kbd98_exit(void) -{ - serio_unregister_device(&kbd98_dev); -} - -module_init(kbd98_init); -module_exit(kbd98_exit); diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 45322b41a..b724190b2 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -96,15 +96,3 @@ config KEYBOARD_AMIGA 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 026fc13ea..00ec1f86a 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -288,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; } diff --git a/drivers/input/misc/98spkr.c b/drivers/input/misc/98spkr.c deleted file mode 100644 index 80fc6ee55..000000000 --- a/drivers/input/misc/98spkr.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * PC-9800 Speaker beeper driver for Linux - * - * Copyright (c) 2002 Osamu Tomita - * Copyright (c) 2002 Vojtech Pavlik - * Copyright (c) 1992 Orest Zborowski - * - */ - -/* - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation - */ - -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Osamu Tomita "); -MODULE_DESCRIPTION("PC-9800 Speaker beeper driver"); -MODULE_LICENSE("GPL"); - -static char spkr98_name[] = "PC-9801 Speaker"; -static char spkr98_phys[] = "isa3fdb/input0"; -static struct input_dev spkr98_dev; - -spinlock_t i8253_beep_lock = SPIN_LOCK_UNLOCKED; - -static int spkr98_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) -{ - unsigned int count = 0; - unsigned long flags; - - if (type != EV_SND) - return -1; - - switch (code) { - 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) { - outb(0x76, 0x3fdf); - outb(0, 0x5f); - outb(count & 0xff, 0x3fdb); - outb(0, 0x5f); - outb((count >> 8) & 0xff, 0x3fdb); - /* beep on */ - outb(6, 0x37); - } else { - /* beep off */ - outb(7, 0x37); - } - - spin_unlock_irqrestore(&i8253_beep_lock, flags); - - return 0; -} - -static int __init spkr98_init(void) -{ - spkr98_dev.evbit[0] = BIT(EV_SND); - spkr98_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); - spkr98_dev.event = spkr98_event; - - spkr98_dev.name = spkr98_name; - spkr98_dev.phys = spkr98_phys; - spkr98_dev.id.bustype = BUS_ISA; - spkr98_dev.id.vendor = 0x001f; - spkr98_dev.id.product = 0x0001; - spkr98_dev.id.version = 0x0100; - - input_register_device(&spkr98_dev); - - printk(KERN_INFO "input: %s\n", spkr98_name); - - return 0; -} - -static void __exit spkr98_exit(void) -{ - input_unregister_device(&spkr98_dev); -} - -module_init(spkr98_init); -module_exit(spkr98_exit); 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/uinput.c b/drivers/input/misc/uinput.c index 2e097dc66..b86acf04d 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -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; @@ -226,7 +226,7 @@ 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; @@ -243,7 +243,7 @@ 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; diff --git a/drivers/input/mouse/98busmouse.c b/drivers/input/mouse/98busmouse.c deleted file mode 100644 index fed160f4c..000000000 --- a/drivers/input/mouse/98busmouse.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * - * Copyright (c) 2002 Osamu Tomita - * - * Based on the work of: - * James Banks Matthew Dillon - * David Giller Nathan Laredo - * Linus Torvalds Johan Myreen - * Cliff Matthews Philip Blundell - * Russell King Vojtech Pavlik - */ - -/* - * NEC PC-9801 Bus Mouse Driver for Linux - */ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -MODULE_AUTHOR("Osamu Tomita "); -MODULE_DESCRIPTION("PC-9801 busmouse driver"); -MODULE_LICENSE("GPL"); - -#define PC98BM_BASE 0x7fd9 -#define PC98BM_DATA_PORT PC98BM_BASE + 0 -/* PC98BM_SIGNATURE_PORT does not exist */ -#define PC98BM_CONTROL_PORT PC98BM_BASE + 4 -/* PC98BM_INTERRUPT_PORT does not exist */ -#define PC98BM_CONFIG_PORT PC98BM_BASE + 6 - -#define PC98BM_ENABLE_IRQ 0x00 -#define PC98BM_DISABLE_IRQ 0x10 -#define PC98BM_READ_X_LOW 0x80 -#define PC98BM_READ_X_HIGH 0xa0 -#define PC98BM_READ_Y_LOW 0xc0 -#define PC98BM_READ_Y_HIGH 0xe0 - -#define PC98BM_DEFAULT_MODE 0x93 -/* PC98BM_CONFIG_BYTE is not used */ -/* PC98BM_SIGNATURE_BYTE is not used */ - -#define PC98BM_TIMER_PORT 0xbfdb -#define PC98BM_DEFAULT_TIMER_VAL 0x00 - -#define PC98BM_IRQ 13 - -static int pc98bm_irq = PC98BM_IRQ; -module_param_named(irq, pc98bm_irq, uint, 0); -MODULE_PARM_DESC(irq, "IRQ number (13=default)"); - -__obsolete_setup("pc98bm_irq="); - -static int pc98bm_used = 0; - -static irqreturn_t pc98bm_interrupt(int irq, void *dev_id, struct pt_regs *regs); - -static int pc98bm_open(struct input_dev *dev) -{ - if (pc98bm_used++) - return 0; - if (request_irq(pc98bm_irq, pc98bm_interrupt, 0, "98busmouse", NULL)) { - pc98bm_used--; - printk(KERN_ERR "98busmouse.c: Can't allocate irq %d\n", pc98bm_irq); - return -EBUSY; - } - outb(PC98BM_ENABLE_IRQ, PC98BM_CONTROL_PORT); - return 0; -} - -static void pc98bm_close(struct input_dev *dev) -{ - if (--pc98bm_used) - return; - outb(PC98BM_DISABLE_IRQ, PC98BM_CONTROL_PORT); - free_irq(pc98bm_irq, NULL); -} - -static struct input_dev pc98bm_dev = { - .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, - .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) }, - .relbit = { BIT(REL_X) | BIT(REL_Y) }, - .open = pc98bm_open, - .close = pc98bm_close, - .name = "PC-9801 bus mouse", - .phys = "isa7fd9/input0", - .id = { - .bustype = BUS_ISA, - .vendor = 0x0004, - .product = 0x0001, - .version = 0x0100, - }, -}; - -static irqreturn_t pc98bm_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - char dx, dy; - unsigned char buttons; - - outb(PC98BM_READ_X_LOW, PC98BM_CONTROL_PORT); - dx = (inb(PC98BM_DATA_PORT) & 0xf); - outb(PC98BM_READ_X_HIGH, PC98BM_CONTROL_PORT); - dx |= (inb(PC98BM_DATA_PORT) & 0xf) << 4; - outb(PC98BM_READ_Y_LOW, PC98BM_CONTROL_PORT); - dy = (inb(PC98BM_DATA_PORT) & 0xf); - outb(PC98BM_READ_Y_HIGH, PC98BM_CONTROL_PORT); - buttons = inb(PC98BM_DATA_PORT); - dy |= (buttons & 0xf) << 4; - buttons = ~buttons >> 5; - - input_report_rel(&pc98bm_dev, REL_X, dx); - input_report_rel(&pc98bm_dev, REL_Y, dy); - input_report_key(&pc98bm_dev, BTN_RIGHT, buttons & 1); - input_report_key(&pc98bm_dev, BTN_MIDDLE, buttons & 2); - input_report_key(&pc98bm_dev, BTN_LEFT, buttons & 4); - input_sync(&pc98bm_dev); - - outb(PC98BM_ENABLE_IRQ, PC98BM_CONTROL_PORT); - - return IRQ_HANDLED; -} - -static int __init pc98bm_init(void) -{ - int i; - - for (i = 0; i <= 6; i += 2) { - if (!request_region(PC98BM_BASE + i, 1, "98busmouse")) { - printk(KERN_ERR "98busmouse.c: Can't allocate ports at %#x\n", PC98BM_BASE + i); - while (i > 0) { - i -= 2; - release_region(PC98BM_BASE + i, 1); - } - - return -EBUSY; - } - - } - - if (!request_region(PC98BM_TIMER_PORT, 1, "98busmouse")) { - printk(KERN_ERR "98busmouse.c: Can't allocate ports at %#x\n", PC98BM_TIMER_PORT); - for (i = 0; i <= 6; i += 2) - release_region(PC98BM_BASE + i, 1); - - return -EBUSY; - } - - outb(PC98BM_DEFAULT_MODE, PC98BM_CONFIG_PORT); - outb(PC98BM_DISABLE_IRQ, PC98BM_CONTROL_PORT); - - outb(PC98BM_DEFAULT_TIMER_VAL, PC98BM_TIMER_PORT); - - input_register_device(&pc98bm_dev); - - printk(KERN_INFO "input: PC-9801 bus mouse at %#x irq %d\n", PC98BM_BASE, pc98bm_irq); - - return 0; -} - -static void __exit pc98bm_exit(void) -{ - int i; - - input_unregister_device(&pc98bm_dev); - for (i = 0; i <= 6; i += 2) - release_region(PC98BM_BASE + i, 1); - - release_region(PC98BM_TIMER_PORT, 1); -} - -module_init(pc98bm_init); -module_exit(pc98bm_exit); 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/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/serio/98kbd-io.c b/drivers/input/serio/98kbd-io.c deleted file mode 100644 index 32bd067a9..000000000 --- a/drivers/input/serio/98kbd-io.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * NEC PC-9801 keyboard controller driver for Linux - * - * Copyright (c) 1999-2002 Osamu Tomita - * Based on i8042.c written by Vojtech Pavlik - */ - -/* - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -MODULE_AUTHOR("Osamu Tomita "); -MODULE_DESCRIPTION("NEC PC-9801 keyboard controller driver"); -MODULE_LICENSE("GPL"); - -/* - * Names. - */ - -#define KBD98_PHYS_DESC "isa0041/serio0" - -/* - * IRQs. - */ - -#define KBD98_IRQ 1 - -/* - * Register numbers. - */ - -#define KBD98_COMMAND_REG 0x43 -#define KBD98_STATUS_REG 0x43 -#define KBD98_DATA_REG 0x41 - -spinlock_t kbd98io_lock = SPIN_LOCK_UNLOCKED; - -static struct serio kbd98_port; -extern struct pt_regs *kbd_pt_regs; - -static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs); - -/* - * kbd98_flush() flushes all data that may be in the keyboard buffers - */ - -static int kbd98_flush(void) -{ - unsigned long flags; - - spin_lock_irqsave(&kbd98io_lock, flags); - - while (inb(KBD98_STATUS_REG) & 0x02) /* RxRDY */ - inb(KBD98_DATA_REG); - - if (inb(KBD98_STATUS_REG) & 0x38) - printk("98kbd-io: Keyboard error!\n"); - - spin_unlock_irqrestore(&kbd98io_lock, flags); - - return 0; -} - -/* - * kbd98_write() sends a byte out through the keyboard interface. - */ - -static int kbd98_write(struct serio *port, unsigned char c) -{ - unsigned long flags; - - spin_lock_irqsave(&kbd98io_lock, flags); - - outb(0, 0x5f); /* wait */ - outb(0x17, KBD98_COMMAND_REG); /* enable send command */ - outb(0, 0x5f); /* wait */ - outb(c, KBD98_DATA_REG); - outb(0, 0x5f); /* wait */ - outb(0x16, KBD98_COMMAND_REG); /* disable send command */ - outb(0, 0x5f); /* wait */ - - spin_unlock_irqrestore(&kbd98io_lock, flags); - - return 0; -} - -/* - * kbd98_open() is called when a port is open by the higher layer. - * It allocates the interrupt and enables in in the chip. - */ - -static int kbd98_open(struct serio *port) -{ - kbd98_flush(); - - if (request_irq(KBD98_IRQ, kbd98io_interrupt, 0, "kbd98", NULL)) { - printk(KERN_ERR "98kbd-io.c: Can't get irq %d for %s, unregistering the port.\n", KBD98_IRQ, "KBD"); - serio_unregister_port(port); - return -1; - } - - return 0; -} - -static void kbd98_close(struct serio *port) -{ - free_irq(KBD98_IRQ, NULL); - - kbd98_flush(); -} - -/* - * Structures for registering the devices in the serio.c module. - */ - -static struct serio kbd98_port = -{ - .type = SERIO_PC9800, - .write = kbd98_write, - .open = kbd98_open, - .close = kbd98_close, - .driver = NULL, - .name = "PC-9801 Kbd Port", - .phys = KBD98_PHYS_DESC, -}; - -/* - * kbd98io_interrupt() is the most important function in this driver - - * it handles the interrupts from keyboard, and sends incoming bytes - * to the upper layers. - */ - -static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - unsigned long flags; - unsigned char data; - - spin_lock_irqsave(&kbd98io_lock, flags); - - data = inb(KBD98_DATA_REG); - spin_unlock_irqrestore(&kbd98io_lock, flags); - serio_interrupt(&kbd98_port, data, 0, regs); - - return IRQ_HANDLED; -} - -int __init kbd98io_init(void) -{ - serio_register_port(&kbd98_port); - - printk(KERN_INFO "serio: PC-9801 %s port at %#lx,%#lx irq %d\n", - "KBD", - (unsigned long) KBD98_DATA_REG, - (unsigned long) KBD98_COMMAND_REG, - KBD98_IRQ); - - return 0; -} - -void __exit kbd98io_exit(void) -{ - serio_unregister_port(&kbd98_port); -} - -module_init(kbd98io_init); -module_exit(kbd98io_exit); 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/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/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/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/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/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 ab7ee8837..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 @@ -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 a3b67aef2..c6f1995e0 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c @@ -435,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/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/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/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/at1700.c b/drivers/net/at1700.c index 9981968a8..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; @@ -246,15 +208,7 @@ static void cleanup_card(struct net_device *dev) 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. */ @@ -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,7 +473,7 @@ 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); @@ -557,12 +488,7 @@ err_mca: 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; } @@ -573,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) @@ -598,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/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/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/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 64e4aeb63..e81e0afda 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c @@ -1218,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, diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 816534011..9ab72741d 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -495,6 +495,8 @@ static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp) return -EFAULT; slave_dev = dev_get_by_name(sc.slave_name); + if (!slave_dev) + return -ENODEV; ret = -EINVAL; @@ -527,11 +529,13 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *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); 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 eb9f346d1..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); 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 503e8f6c9..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 @@ -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/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/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/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 8c45911fe..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, 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/ne2k_cbus.c b/drivers/net/ne2k_cbus.c deleted file mode 100644 index 4fc68d93a..000000000 --- a/drivers/net/ne2k_cbus.c +++ /dev/null @@ -1,887 +0,0 @@ -/* - - ne2k_cbus.c: A driver for the NE2000 like ethernet on NEC PC-9800. - - This is a copy of the 2.5.66 Linux ISA NE2000 driver "ne.c" - (Donald Becker/Paul Gortmaker) with the NEC PC-9800 specific - changes added by Osamu Tomita. - -From ne.c: ------------ - Copyright 1993 United States Government as represented by the - Director, National Security Agency. - - This software may be used and distributed according to the terms - of the GNU General Public License, incorporated herein by reference. ------------ - -*/ - -/* Routines for the NatSemi-based designs (NE[12]000). */ - -static const char version[] = -"ne2k_cbus.c:v1.0 3/24/03 Osamu Tomita\n"; - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "8390.h" - -/* Some defines that people can play with if so inclined. */ - -/* Do we support clones that don't adhere to 14,15 of the SAprom ? */ -#define SUPPORT_NE_BAD_CLONES - -/* Do we perform extra sanity checks on stuff ? */ -/* #define NE_SANITY_CHECK */ - -/* Do we implement the read before write bugfix ? */ -/* #define NE_RW_BUGFIX */ - -/* Do we have a non std. amount of memory? (in units of 256 byte pages) */ -/* #define PACKETBUF_MEMSIZE 0x40 */ - -#ifdef SUPPORT_NE_BAD_CLONES -/* A list of bad clones that we none-the-less recognize. */ -static struct { const char *name8, *name16; unsigned char SAprefix[4];} -bad_clone_list[] __initdata = { - {"LA/T-98?", "LA/T-98", {0x00, 0xa0, 0xb0}}, /* I/O Data */ - {"EGY-98?", "EGY-98", {0x00, 0x40, 0x26}}, /* Melco EGY98 */ - {"ICM?", "ICM-27xx-ET", {0x00, 0x80, 0xc8}}, /* ICM IF-27xx-ET */ - {"CNET-98/EL?", "CNET(98)E/L", {0x00, 0x80, 0x4C}}, /* Contec CNET-98/EL */ - {0,} -}; -#endif - -/* ---- No user-serviceable parts below ---- */ - -#define NE_BASE (dev->base_addr) -#define NE_CMD EI_SHIFT(0x00) -#define NE_DATAPORT EI_SHIFT(0x10) /* NatSemi-defined port window offset. */ -#define NE_RESET EI_SHIFT(0x1f) /* Issue a read to reset, a write to clear. */ -#define NE_IO_EXTENT 0x20 - -#define NE1SM_START_PG 0x20 /* First page of TX buffer */ -#define NE1SM_STOP_PG 0x40 /* Last page +1 of RX ring */ -#define NESM_START_PG 0x40 /* First page of TX buffer */ -#define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ - -#include "ne2k_cbus.h" - -static int ne_probe1(struct net_device *dev, int ioaddr); -static int ne_open(struct net_device *dev); -static int ne_close(struct net_device *dev); - -static void ne_reset_8390(struct net_device *dev); -static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, - int ring_page); -static void ne_block_input(struct net_device *dev, int count, - struct sk_buff *skb, int ring_offset); -static void ne_block_output(struct net_device *dev, const int count, - const unsigned char *buf, const int start_page); - - -/* Probe for various non-shared-memory ethercards. - - NEx000-clone boards have a Station Address PROM (SAPROM) in the packet - buffer memory space. NE2000 clones have 0x57,0x57 in bytes 0x0e,0x0f of - the SAPROM, while other supposed NE2000 clones must be detected by their - SA prefix. - - Reading the SAPROM from a word-wide card with the 8390 set in byte-wide - mode results in doubled values, which can be detected and compensated for. - - The probe is also responsible for initializing the card and filling - in the 'dev' and 'ei_status' structures. - - We use the minimum memory size for some ethercard product lines, iff we can't - distinguish models. You can increase the packet buffer size by setting - PACKETBUF_MEMSIZE. Reported Cabletron packet buffer locations are: - E1010 starts at 0x100 and ends at 0x2000. - E1010-x starts at 0x100 and ends at 0x8000. ("-x" means "more memory") - E2010 starts at 0x100 and ends at 0x4000. - E2010-x starts at 0x100 and ends at 0xffff. */ - -static int __init do_ne_probe(struct net_device *dev) -{ - unsigned int base_addr = dev->base_addr; - int irq = dev->irq; - - SET_MODULE_OWNER(dev); - - if (ei_debug > 2) - printk(KERN_DEBUG "ne_probe(): entered.\n"); - - /* If CONFIG_NET_CBUS, - we need dev->priv->reg_offset BEFORE to probe */ - if (ne2k_cbus_init(dev) != 0) - return -ENOMEM; - - /* First check any supplied i/o locations. User knows best. */ - if (base_addr > 0) { - int result; - const struct ne2k_cbus_hwinfo *hw = ne2k_cbus_get_hwinfo((int)(dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK)); - - if (ei_debug > 2) - printk(KERN_DEBUG "ne_probe(): call ne_probe_cbus(base_addr=0x%x)\n", base_addr); - - result = ne_probe_cbus(dev, hw, base_addr, irq); - if (result != 0) - ne2k_cbus_destroy(dev); - - return result; - } - - if (ei_debug > 2) - printk(KERN_DEBUG "ne_probe(): base_addr is not specified.\n"); - -#ifndef MODULE - /* Last resort. The semi-risky C-Bus auto-probe. */ - if (ei_debug > 2) - printk(KERN_DEBUG "ne_probe(): auto-probe start.\n"); - - { - const struct ne2k_cbus_hwinfo *hw = ne2k_cbus_get_hwinfo((int)(dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK)); - - if (hw && hw->hwtype) { - const unsigned short *plist; - for (plist = hw->portlist; *plist; plist++) - if (ne_probe_cbus(dev, hw, *plist, irq) == 0) - return 0; - } else { - for (hw = &ne2k_cbus_hwinfo_list[0]; hw->hwtype; hw++) { - const unsigned short *plist; - for (plist = hw->portlist; *plist; plist++) - if (ne_probe_cbus(dev, hw, *plist, irq) == 0) - return 0; - } - } - } -#endif - - ne2k_cbus_destroy(dev); - - return -ENODEV; -} - -static void cleanup_card(struct net_device *dev) -{ - const struct ne2k_cbus_region *rlist; - const struct ne2k_cbus_hwinfo *hw = ne2k_cbus_get_hwinfo((int)(dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK)); - - free_irq(dev->irq, dev); - for (rlist = hw->regionlist; rlist->range; rlist++) { - release_region(dev->base_addr + rlist->start, - rlist->range); - } - ne2k_cbus_destroy(dev); -} - -struct net_device * __init ne_probe(int unit) -{ - struct net_device *dev = alloc_ei_netdev(); - int err; - - if (!dev) - return ERR_PTR(-ENOMEM); - - sprintf(dev->name, "eth%d", unit); - netdev_boot_setup_check(dev); - - err = do_ne_probe(dev); - if (err) - goto out; - err = register_netdev(dev); - if (err) - goto out1; - return dev; -out1: - cleanup_card(dev); -out: - free_netdev(dev); - return ERR_PTR(err); -} - -static int __init ne_probe_cbus(struct net_device *dev, const struct ne2k_cbus_hwinfo *hw, int ioaddr, int irq) -{ - if (ei_debug > 2) - printk(KERN_DEBUG "ne_probe_cbus(): entered. (called from %p)\n", - __builtin_return_address(0)); - - if (hw && hw->hwtype) { - ne2k_cbus_set_hwtype(dev, hw, ioaddr); - dev->irq = irq; - return ne_probe1(dev, ioaddr); - } else { - /* auto detect */ - - printk(KERN_DEBUG "ne_probe_cbus(): try to determine hardware types.\n"); - for (hw = &ne2k_cbus_hwinfo_list[0]; hw->hwtype; hw++) { - ne2k_cbus_set_hwtype(dev, hw, ioaddr); - dev->irq = irq; - if (ne_probe1(dev, ioaddr) == 0) - return 0; - } - } - return -ENODEV; -} - -static int __init ne_probe1(struct net_device *dev, int ioaddr) -{ - int i; - unsigned char SA_prom[32]; - int wordlength = 2; - const char *name = NULL; - int start_page, stop_page; - int neX000, bad_card; - int reg0, ret; - static unsigned version_printed; - const struct ne2k_cbus_region *rlist; - const struct ne2k_cbus_hwinfo *hw = ne2k_cbus_get_hwinfo((int)(dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK)); - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - -#ifdef CONFIG_NE2K_CBUS_CNET98EL - if (hw->hwtype == NE2K_CBUS_HARDWARE_TYPE_CNET98EL) { - outb_p(0, CONFIG_NE2K_CBUS_CNET98EL_IO_BASE); - /* udelay(5000); */ - outb_p(1, CONFIG_NE2K_CBUS_CNET98EL_IO_BASE); - /* udelay(5000); */ - outb_p((ioaddr & 0xf000) >> 8 | 0x08 | 0x01, CONFIG_NE2K_CBUS_CNET98EL_IO_BASE + 2); - /* udelay(5000); */ - } -#endif - - for (rlist = hw->regionlist; rlist->range; rlist++) - if (!request_region(ioaddr + rlist->start, - rlist->range, dev->name)) { - ret = -EBUSY; - goto err_out; - } - - reg0 = inb_p(ioaddr + EI_SHIFT(0)); - if (reg0 == 0xFF) { - ret = -ENODEV; - goto err_out; - } - - /* Do a preliminary verification that we have a 8390. */ -#ifdef CONFIG_NE2K_CBUS_CNET98EL - if (hw->hwtype != NE2K_CBUS_HARDWARE_TYPE_CNET98EL) -#endif - { - int regd; - outb_p(E8390_NODMA+E8390_PAGE1+E8390_STOP, ioaddr + E8390_CMD); - regd = inb_p(ioaddr + EI_SHIFT(0x0d)); - outb_p(0xff, ioaddr + EI_SHIFT(0x0d)); - outb_p(E8390_NODMA+E8390_PAGE0, ioaddr + E8390_CMD); - inb_p(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */ - if (inb_p(ioaddr + EN0_COUNTER0) != 0) { - outb_p(reg0, ioaddr); - outb_p(regd, ioaddr + EI_SHIFT(0x0d)); /* Restore the old values. */ - ret = -ENODEV; - goto err_out; - } - } - - if (ei_debug && version_printed++ == 0) - printk(KERN_INFO "%s", version); - - printk(KERN_INFO "NE*000 ethercard probe at %#3x:", ioaddr); - - /* A user with a poor card that fails to ack the reset, or that - does not have a valid 0x57,0x57 signature can still use this - without having to recompile. Specifying an i/o address along - with an otherwise unused dev->mem_end value of "0xBAD" will - cause the driver to skip these parts of the probe. */ - - bad_card = ((dev->base_addr != 0) && (dev->mem_end == 0xbad)); - - /* Reset card. Who knows what dain-bramaged state it was left in. */ - - { - unsigned long reset_start_time = jiffies; - - /* derived from CNET98EL-patch for bad clones */ - outb_p(E8390_NODMA | E8390_STOP, ioaddr + E8390_CMD); - - /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ - outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); - - while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { - if (bad_card) { - printk(" (warning: no reset ack)"); - break; - } else { - printk(" not found (no reset ack).\n"); - ret = -ENODEV; - goto err_out; - } - } - - outb_p(0xff, ioaddr + EN0_ISR); /* Ack all intr. */ - } - -#ifdef CONFIG_NE2K_CBUS_CNET98EL - if (hw->hwtype == NE2K_CBUS_HARDWARE_TYPE_CNET98EL) { - static const char pat[32] ="AbcdeFghijKlmnoPqrstUvwxyZ789012"; - char buf[32]; - int maxwait = 200; - - if (ei_debug > 2) - printk(" [CNET98EL-specific initialize..."); - outb_p(E8390_NODMA | E8390_STOP, ioaddr + E8390_CMD); /* 0x20|0x1 */ - ret = -ENODEV; - i = inb(ioaddr); - if ((i & ~0x2) != (0x20 | 0x01)) - goto err_out; - if ((inb(ioaddr + 0x7) & 0x80) != 0x80) - goto err_out; - outb_p(E8390_RXOFF, ioaddr + EN0_RXCR); /* out(ioaddr+0xc, 0x20) */ - /* outb_p(ENDCFG_WTS|ENDCFG_FT1|ENDCFG_LS, ioaddr+EN0_DCFG); */ - outb_p(ENDCFG_WTS | 0x48, ioaddr + EN0_DCFG); /* 0x49 */ - outb_p(CNET98EL_START_PG, ioaddr + EN0_STARTPG); - outb_p(CNET98EL_STOP_PG, ioaddr + EN0_STOPPG); - if (ei_debug > 2) - printk("memory check"); - for (i = 0; i < 65536; i += 1024) { - if (ei_debug > 2) - printk(" %04x", i); - ne2k_cbus_writemem(dev, ioaddr, i, pat, 32); - while (((inb(ioaddr + EN0_ISR) & ENISR_RDC) != ENISR_RDC) && --maxwait) - ; - ne2k_cbus_readmem(dev, ioaddr, i, buf, 32); - if (memcmp(pat, buf, 32)) { - if (ei_debug > 2) - printk(" failed."); - break; - } - } - if (i != 16384) { - if (ei_debug > 2) - printk("] "); - printk("memory failure at %x\n", i); - goto err_out; - } - if (ei_debug > 2) - printk(" good..."); - if (!dev->irq) { - if (ei_debug > 2) - printk("] "); - printk("IRQ must be specified for C-NET(98)E/L. probe failed.\n"); - goto err_out; - } - outb((dev->irq > 5) ? (dev->irq & 4):(dev->irq >> 1), ioaddr + (0x2 | 0x400)); - outb(0x7e, ioaddr + (0x4 | 0x400)); - ne2k_cbus_readmem(dev, ioaddr, 16384, SA_prom, 32); - outb(0xff, ioaddr + EN0_ISR); - if (ei_debug > 2) - printk("done]"); - } else -#endif /* CONFIG_NE2K_CBUS_CNET98EL */ - /* Read the 16 bytes of station address PROM. - We must first initialize registers, similar to NS8390_init(eifdev, 0). - We can't reliably read the SAPROM address without this. - (I learned the hard way!). */ - { - struct {unsigned char value; unsigned short offset;} program_seq[] = - { - {E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, /* Select page 0*/ - /* NEC PC-9800: some board can only handle word-wide access? */ - {0x48 | ENDCFG_WTS, EN0_DCFG}, /* Set word-wide (0x48) access. */ - {16384 / 256, EN0_STARTPG}, - {32768 / 256, EN0_STOPPG}, - {0x00, EN0_RCNTLO}, /* Clear the count regs. */ - {0x00, EN0_RCNTHI}, - {0x00, EN0_IMR}, /* Mask completion irq. */ - {0xFF, EN0_ISR}, - {E8390_RXOFF, EN0_RXCR}, /* 0x20 Set to monitor */ - {E8390_TXOFF, EN0_TXCR}, /* 0x02 and loopback mode. */ - {32, EN0_RCNTLO}, - {0x00, EN0_RCNTHI}, - {0x00, EN0_RSARLO}, /* DMA starting at 0x0000. */ - {0x00, EN0_RSARHI}, - {E8390_RREAD+E8390_START, E8390_CMD}, - }; - - for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++) - outb_p(program_seq[i].value, ioaddr + program_seq[i].offset); - insw(ioaddr + NE_DATAPORT, SA_prom, 32 >> 1); - - } - - if (wordlength == 2) - { - for (i = 0; i < 16; i++) - SA_prom[i] = SA_prom[i+i]; - start_page = NESM_START_PG; - stop_page = NESM_STOP_PG; -#ifdef CONFIG_NE2K_CBUS_CNET98EL - if (hw->hwtype == NE2K_CBUS_HARDWARE_TYPE_CNET98EL) { - start_page = CNET98EL_START_PG; - stop_page = CNET98EL_STOP_PG; - } -#endif - } else { - start_page = NE1SM_START_PG; - stop_page = NE1SM_STOP_PG; - } - - neX000 = (SA_prom[14] == 0x57 && SA_prom[15] == 0x57); - if (neX000) { - name = "C-Bus-NE2K-compat"; - } - else - { -#ifdef SUPPORT_NE_BAD_CLONES - /* Ack! Well, there might be a *bad* NE*000 clone there. - Check for total bogus addresses. */ - for (i = 0; bad_clone_list[i].name8; i++) - { - if (SA_prom[0] == bad_clone_list[i].SAprefix[0] && - SA_prom[1] == bad_clone_list[i].SAprefix[1] && - SA_prom[2] == bad_clone_list[i].SAprefix[2]) - { - if (wordlength == 2) - { - name = bad_clone_list[i].name16; - } else { - name = bad_clone_list[i].name8; - } - break; - } - } - if (bad_clone_list[i].name8 == NULL) - { - printk(" not found (invalid signature %2.2x %2.2x).\n", - SA_prom[14], SA_prom[15]); - ret = -ENXIO; - goto err_out; - } -#else - printk(" not found.\n"); - ret = -ENXIO; - goto err_out; -#endif - } - - if (dev->irq < 2) - { - unsigned long cookie = probe_irq_on(); - outb_p(0x50, ioaddr + EN0_IMR); /* Enable one interrupt. */ - outb_p(0x00, ioaddr + EN0_RCNTLO); - outb_p(0x00, ioaddr + EN0_RCNTHI); - outb_p(E8390_RREAD+E8390_START, ioaddr); /* Trigger it... */ - mdelay(10); /* wait 10ms for interrupt to propagate */ - outb_p(0x00, ioaddr + EN0_IMR); /* Mask it again. */ - dev->irq = probe_irq_off(cookie); - if (ei_debug > 2) - printk(" autoirq is %d\n", dev->irq); - } else if (dev->irq == 7) - /* Fixup for users that don't know that IRQ 7 is really IRQ 11, - or don't know which one to set. */ - dev->irq = 11; - - if (! dev->irq) { - printk(" failed to detect IRQ line.\n"); - ret = -EAGAIN; - goto err_out; - } - - /* Snarf the interrupt now. There's no point in waiting since we cannot - share and the board will usually be enabled. */ - ret = request_irq(dev->irq, ei_interrupt, 0, name, dev); - if (ret) { - printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret); - goto err_out_kfree; - } - - dev->base_addr = ioaddr; - - for(i = 0; i < ETHER_ADDR_LEN; i++) { - printk(" %2.2x", SA_prom[i]); - dev->dev_addr[i] = SA_prom[i]; - } - - printk("\n%s: %s found at %#x, hardware type %d(%s), using IRQ %d.\n", - dev->name, name, ioaddr, hw->hwtype, hw->hwident, dev->irq); - - ei_status.name = name; - ei_status.tx_start_page = start_page; - ei_status.stop_page = stop_page; - ei_status.word16 = (wordlength == 2); - - ei_status.rx_start_page = start_page + TX_PAGES; -#ifdef PACKETBUF_MEMSIZE - /* Allow the packet buffer size to be overridden by know-it-alls. */ - ei_status.stop_page = ei_status.tx_start_page + PACKETBUF_MEMSIZE; -#endif - - ei_status.reset_8390 = &ne_reset_8390; - ei_status.block_input = &ne_block_input; - ei_status.block_output = &ne_block_output; - ei_status.get_8390_hdr = &ne_get_8390_hdr; - ei_status.priv = 0; - dev->open = &ne_open; - dev->stop = &ne_close; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ei_poll; -#endif - NS8390_init(dev, 0); - return 0; - -err_out_kfree: - ne2k_cbus_destroy(dev); -err_out: - while (rlist > hw->regionlist) { - rlist --; - release_region(ioaddr + rlist->start, rlist->range); - } - return ret; -} - -static int ne_open(struct net_device *dev) -{ - ei_open(dev); - return 0; -} - -static int ne_close(struct net_device *dev) -{ - if (ei_debug > 1) - printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name); - ei_close(dev); - return 0; -} - -/* Hard reset the card. This used to pause for the same period that a - 8390 reset command required, but that shouldn't be necessary. */ - -static void ne_reset_8390(struct net_device *dev) -{ - unsigned long reset_start_time = jiffies; - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - - if (ei_debug > 1) - printk(KERN_DEBUG "resetting the 8390 t=%ld...", jiffies); - - /* derived from CNET98EL-patch for bad clones... */ - outb_p(E8390_NODMA | E8390_STOP, NE_BASE + E8390_CMD); /* 0x20 | 0x1 */ - - /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ - outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET); - - ei_status.txing = 0; - ei_status.dmaing = 0; - - /* This check _should_not_ be necessary, omit eventually. */ - while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { - printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); - break; - } - outb_p(ENISR_RESET, NE_BASE + EN0_ISR); /* Ack intr. */ -} - -/* Grab the 8390 specific header. Similar to the block_input routine, but - we don't need to be concerned with ring wrap as the header will be at - the start of a page, so we optimize accordingly. */ - -static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) -{ - int nic_base = dev->base_addr; - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - - /* This *shouldn't* happen. If it does, it's the last thing you'll see */ - - if (ei_status.dmaing) - { - printk(KERN_EMERG "%s: DMAing conflict in ne_get_8390_hdr " - "[DMAstat:%d][irqlock:%d].\n", - dev->name, ei_status.dmaing, ei_status.irqlock); - return; - } - - ei_status.dmaing |= 0x01; - outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base+ NE_CMD); - outb_p(sizeof(struct e8390_pkt_hdr), nic_base + EN0_RCNTLO); - outb_p(0, nic_base + EN0_RCNTHI); - outb_p(0, nic_base + EN0_RSARLO); /* On page boundary */ - outb_p(ring_page, nic_base + EN0_RSARHI); - outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD); - - if (ei_status.word16) - insw(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)>>1); - else - insb(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); - - outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ - ei_status.dmaing &= ~0x01; - - le16_to_cpus(&hdr->count); -} - -/* Block input and output, similar to the Crynwr packet driver. If you - are porting to a new ethercard, look at the packet driver source for hints. - The NEx000 doesn't share the on-board packet memory -- you have to put - the packet out through the "remote DMA" dataport using outb. */ - -static void ne_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) -{ -#ifdef NE_SANITY_CHECK - int xfer_count = count; -#endif - int nic_base = dev->base_addr; - char *buf = skb->data; - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - - /* This *shouldn't* happen. If it does, it's the last thing you'll see */ - if (ei_status.dmaing) - { - printk(KERN_EMERG "%s: DMAing conflict in ne_block_input " - "[DMAstat:%d][irqlock:%d].\n", - dev->name, ei_status.dmaing, ei_status.irqlock); - return; - } - ei_status.dmaing |= 0x01; - - /* round up count to a word (derived from ICM-patch) */ - count = (count + 1) & ~1; - - outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base+ NE_CMD); - outb_p(count & 0xff, nic_base + EN0_RCNTLO); - outb_p(count >> 8, nic_base + EN0_RCNTHI); - outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); - outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); - outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD); - if (ei_status.word16) - { - insw(NE_BASE + NE_DATAPORT,buf,count>>1); - if (count & 0x01) - { - buf[count-1] = inb(NE_BASE + NE_DATAPORT); -#ifdef NE_SANITY_CHECK - xfer_count++; -#endif - } - } else { - insb(NE_BASE + NE_DATAPORT, buf, count); - } - -#ifdef NE_SANITY_CHECK - /* This was for the ALPHA version only, but enough people have - been encountering problems so it is still here. If you see - this message you either 1) have a slightly incompatible clone - or 2) have noise/speed problems with your bus. */ - - if (ei_debug > 1) - { - /* DMA termination address check... */ - int addr, tries = 20; - do { - /* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here - -- it's broken for Rx on some cards! */ - int high = inb_p(nic_base + EN0_RSARHI); - int low = inb_p(nic_base + EN0_RSARLO); - addr = (high << 8) + low; - if (((ring_offset + xfer_count) & 0xff) == low) - break; - } while (--tries > 0); - if (tries <= 0) - printk(KERN_WARNING "%s: RX transfer address mismatch," - "%#4.4x (expected) vs. %#4.4x (actual).\n", - dev->name, ring_offset + xfer_count, addr); - } -#endif - outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ - ei_status.dmaing &= ~0x01; -} - -static void ne_block_output(struct net_device *dev, int count, - const unsigned char *buf, const int start_page) -{ - int nic_base = NE_BASE; - unsigned long dma_start; -#ifdef NE_SANITY_CHECK - int retries = 0; -#endif - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - - /* Round the count up for word writes. Do we need to do this? - What effect will an odd byte count have on the 8390? - I should check someday. */ - - if (ei_status.word16 && (count & 0x01)) - count++; - - /* This *shouldn't* happen. If it does, it's the last thing you'll see */ - if (ei_status.dmaing) - { - printk(KERN_EMERG "%s: DMAing conflict in ne_block_output." - "[DMAstat:%d][irqlock:%d]\n", - dev->name, ei_status.dmaing, ei_status.irqlock); - return; - } - ei_status.dmaing |= 0x01; - /* We should already be in page 0, but to be safe... */ - outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base + NE_CMD); - -#ifdef NE_SANITY_CHECK -retry: -#endif - -#ifdef NE8390_RW_BUGFIX - /* Handle the read-before-write bug the same way as the - Crynwr packet driver -- the NatSemi method doesn't work. - Actually this doesn't always work either, but if you have - problems with your NEx000 this is better than nothing! */ - - outb_p(0x42, nic_base + EN0_RCNTLO); - outb_p(0x00, nic_base + EN0_RCNTHI); - outb_p(0x42, nic_base + EN0_RSARLO); - outb_p(0x00, nic_base + EN0_RSARHI); - outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD); - /* Make certain that the dummy read has occurred. */ - udelay(6); -#endif - - outb_p(ENISR_RDC, nic_base + EN0_ISR); - - /* Now the normal output. */ - outb_p(count & 0xff, nic_base + EN0_RCNTLO); - outb_p(count >> 8, nic_base + EN0_RCNTHI); - outb_p(0x00, nic_base + EN0_RSARLO); - outb_p(start_page, nic_base + EN0_RSARHI); - - outb_p(E8390_RWRITE+E8390_START, nic_base + NE_CMD); - if (ei_status.word16) { - outsw(NE_BASE + NE_DATAPORT, buf, count>>1); - } else { - outsb(NE_BASE + NE_DATAPORT, buf, count); - } - - dma_start = jiffies; - -#ifdef NE_SANITY_CHECK - /* This was for the ALPHA version only, but enough people have - been encountering problems so it is still here. */ - - if (ei_debug > 1) - { - /* DMA termination address check... */ - int addr, tries = 20; - do { - int high = inb_p(nic_base + EN0_RSARHI); - int low = inb_p(nic_base + EN0_RSARLO); - addr = (high << 8) + low; - if ((start_page << 8) + count == addr) - break; - } while (--tries > 0); - - if (tries <= 0) - { - printk(KERN_WARNING "%s: Tx packet transfer address mismatch," - "%#4.4x (expected) vs. %#4.4x (actual).\n", - dev->name, (start_page << 8) + count, addr); - if (retries++ == 0) - goto retry; - } - } -#endif - - while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) - if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ - printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); - ne_reset_8390(dev); - NS8390_init(dev,1); - break; - } - - outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ - ei_status.dmaing &= ~0x01; - return; -} - - -#ifdef MODULE -#define MAX_NE_CARDS 4 /* Max number of NE cards per module */ -static struct net_device *dev_ne[MAX_NE_CARDS]; -static int io[MAX_NE_CARDS]; -static int irq[MAX_NE_CARDS]; -static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ -static int hwtype[MAX_NE_CARDS] = { 0, }; /* board type */ - -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM(hwtype, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM_DESC(io, "I/O base address(es),required"); -MODULE_PARM_DESC(irq, "IRQ number(s)"); -MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures"); -MODULE_PARM_DESC(hwtype, "Board type of PC-9800 C-Bus NIC"); -MODULE_DESCRIPTION("NE1000/NE2000 PC-9800 C-bus Ethernet driver"); -MODULE_LICENSE("GPL"); - -/* This is set up so that no ISA autoprobe takes place. We can't guarantee -that the ne2k probe is the last 8390 based probe to take place (as it -is at boot) and so the probe will get confused by any other 8390 cards. -ISA device autoprobes on a running machine are not recommended anyway. */ - -int init_module(void) -{ - int this_dev, found = 0; - - for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { - struct net_device *dev = alloc_ei_netdev(); - if (!dev) - break; - dev->irq = irq[this_dev]; - dev->mem_end = bad[this_dev]; - dev->base_addr = io[this_dev]; - dev->mem_start = hwtype[this_dev]; - if (do_ne_probe(dev) == 0) { - if (register_netdev(dev) == 0) { - dev_ne[found++] = dev; - continue; - } - cleanup_card(dev); - } - free_netdev(dev); - if (found) - break; - if (io[this_dev] != 0) - printk(KERN_WARNING "ne2k_cbus: No NE*000 card found at i/o = %#x\n", io[this_dev]); - else - printk(KERN_NOTICE "ne.c: You must supply \"io=0xNNN\" value(s) for ISA cards.\n"); - return -ENXIO; - } - if (found) - return 0; - return -ENODEV; -} - -void cleanup_module(void) -{ - int this_dev; - - for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { - struct net_device *dev = dev_ne[this_dev]; - if (dev) { - unregister_netdev(dev); - cleanup_card(dev); - free_netdev(dev); - } - } -} -#endif /* MODULE */ - diff --git a/drivers/net/ne2k_cbus.h b/drivers/net/ne2k_cbus.h deleted file mode 100644 index adf2cbc03..000000000 --- a/drivers/net/ne2k_cbus.h +++ /dev/null @@ -1,481 +0,0 @@ -/* ne2k_cbus.h: - vender-specific information definition for NEC PC-9800 - C-bus Ethernet Cards - Used in ne.c - - (C)1998,1999 KITAGWA Takurou & Linux/98 project -*/ - -#include - -#undef NE_RESET -#define NE_RESET EI_SHIFT(0x11) /* Issue a read to reset, a write to clear. */ - -#ifdef CONFIG_NE2K_CBUS_CNET98EL -#ifndef CONFIG_NE2K_CBUS_CNET98EL_IO_BASE -#warning CONFIG_NE2K_CBUS_CNET98EL_IO_BASE is not defined(config error?) -#warning use 0xaaed as default -#define CONFIG_NE2K_CBUS_CNET98EL_IO_BASE 0xaaed /* or 0x55ed */ -#endif -#define CNET98EL_START_PG 0x00 -#define CNET98EL_STOP_PG 0x40 -#endif - -/* Hardware type definition (derived from *BSD) */ -#define NE2K_CBUS_HARDWARE_TYPE_MASK 0xff - -/* 0: reserved for auto-detect */ -/* 1: (not tested) - Allied Telesis CentreCom LA-98-T */ -#define NE2K_CBUS_HARDWARE_TYPE_ATLA98 1 -/* 2: (not tested) - ELECOM Laneed - LD-BDN[123]A - PLANET SMART COM 98 EN-2298-C - MACNICA ME98 */ -#define NE2K_CBUS_HARDWARE_TYPE_BDN 2 -/* 3: - Melco EGY-98 - Contec C-NET(98)E*A/L*A,C-NET(98)P */ -#define NE2K_CBUS_HARDWARE_TYPE_EGY98 3 -/* 4: - Melco LGY-98,IND-SP,IND-SS - MACNICA NE2098 */ -#define NE2K_CBUS_HARDWARE_TYPE_LGY98 4 -/* 5: - ICM DT-ET-25,DT-ET-T5,IF-2766ET,IF-2771ET - PLANET SMART COM 98 EN-2298-T,EN-2298P-T - D-Link DE-298PT,DE-298PCAT - ELECOM Laneed LD-98P */ -#define NE2K_CBUS_HARDWARE_TYPE_ICM 5 -/* 6: (reserved for SIC-98, which is not supported in this driver.) */ -/* 7: (unused in *BSD?) - - -*/ -#define NE2K_CBUS_HARDWARE_TYPE_NE2K 7 -/* 8: - NEC PC-9801-108 */ -#define NE2K_CBUS_HARDWARE_TYPE_NEC108 8 -/* 9: - I-O DATA LA-98,LA/T-98 */ -#define NE2K_CBUS_HARDWARE_TYPE_IOLA98 9 -/* 10: (reserved for C-NET(98), which is not supported in this driver.) */ -/* 11: - Contec C-NET(98)E,L */ -#define NE2K_CBUS_HARDWARE_TYPE_CNET98EL 11 - -#define NE2K_CBUS_HARDWARE_TYPE_MAX 11 - -/* HARDWARE TYPE ID 12-31: reserved */ - -struct ne2k_cbus_offsetinfo { - unsigned short skip; - unsigned short offset8; /* +0x8 - +0xf */ - unsigned short offset10; /* +0x10 */ - unsigned short offset1f; /* +0x1f */ -}; - -struct ne2k_cbus_region { - unsigned short start; - short range; -}; - -struct ne2k_cbus_hwinfo { - const unsigned short hwtype; - const unsigned char *hwident; -#ifndef MODULE - const unsigned short *portlist; -#endif - const struct ne2k_cbus_offsetinfo *offsetinfo; - const struct ne2k_cbus_region *regionlist; -}; - -#ifdef CONFIG_NE2K_CBUS_ATLA98 -#ifndef MODULE -static unsigned short atla98_portlist[] __initdata = { - 0xd0, - 0 -}; -#endif -#define atla98_offsetinfo ne2k_offsetinfo -#define atla98_regionlist ne2k_regionlist -#endif /* CONFIG_NE2K_CBUS_ATLA98 */ - -#ifdef CONFIG_NE2K_CBUS_BDN -#ifndef MODULE -static unsigned short bdn_portlist[] __initdata = { - 0xd0, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo bdn_offsetinfo __initdata = { -#if 0 - /* comes from FreeBSD(98) ed98.h */ - 0x1000, 0x8000, 0x100, 0xc200 /* ??? */ -#else - /* comes from NetBSD/pc98 if_ne_isa.c */ - 0x1000, 0x8000, 0x100, 0x7f00 /* ??? */ -#endif -}; -static struct ne2k_cbus_region bdn_regionlist[] __initdata = { - {0x0, 1}, {0x1000, 1}, {0x2000, 1}, {0x3000,1}, - {0x4000, 1}, {0x5000, 1}, {0x6000, 1}, {0x7000, 1}, - {0x8000, 1}, {0x9000, 1}, {0xa000, 1}, {0xb000, 1}, - {0xc000, 1}, {0xd000, 1}, {0xe000, 1}, {0xf000, 1}, - {0x100, 1}, {0x7f00, 1}, - {0x0, 0} -}; -#endif /* CONFIG_NE2K_CBUS_BDN */ - -#ifdef CONFIG_NE2K_CBUS_EGY98 -#ifndef MODULE -static unsigned short egy98_portlist[] __initdata = { - 0xd0, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo egy98_offsetinfo __initdata = { - 0x02, 0x100, 0x200, 0x300 -}; -static struct ne2k_cbus_region egy98_regionlist[] __initdata = { - {0x0, 1}, {0x2, 1}, {0x4, 1}, {0x6, 1}, - {0x8, 1}, {0xa, 1}, {0xc, 1}, {0xe, 1}, - {0x100, 1}, {0x102, 1}, {0x104, 1}, {0x106, 1}, - {0x108, 1}, {0x10a, 1}, {0x10c, 1}, {0x10e, 1}, - {0x200, 1}, {0x300, 1}, - {0x0, 0} -}; -#endif /* CONFIG_NE2K_CBUS_EGY98 */ - -#ifdef CONFIG_NE2K_CBUS_LGY98 -#ifndef MODULE -static unsigned short lgy98_portlist[] __initdata = { - 0xd0, 0x10d0, 0x20d0, 0x30d0, 0x40d0, 0x50d0, 0x60d0, 0x70d0, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo lgy98_offsetinfo __initdata = { - 0x01, 0x08, 0x200, 0x300 -}; -static struct ne2k_cbus_region lgy98_regionlist[] __initdata = { - {0x0, 16}, {0x200, 1}, {0x300, 1}, - {0x0, 0} -}; -#endif /* CONFIG_NE2K_CBUS_LGY98 */ - -#ifdef CONFIG_NE2K_CBUS_ICM -#ifndef MODULE -static unsigned short icm_portlist[] __initdata = { - /* ICM */ - 0x56d0, - /* LD-98PT */ - 0x46d0, 0x66d0, 0x76d0, 0x86d0, 0x96d0, 0xa6d0, 0xb6d0, 0xc6d0, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo icm_offsetinfo __initdata = { - 0x01, 0x08, 0x100, 0x10f -}; -static struct ne2k_cbus_region icm_regionlist[] __initdata = { - {0x0, 16}, {0x100, 16}, - {0x0, 0} -}; -#endif /* CONFIG_NE2K_CBUS_ICM */ - -#if defined(CONFIG_NE2K_CBUS_NE2K) && !defined(MODULE) -static unsigned short ne2k_portlist[] __initdata = { - 0xd0, 0x300, 0x280, 0x320, 0x340, 0x360, 0x380, - 0 -}; -#endif -#if defined(CONFIG_NE2K_CBUS_NE2K) || defined(CONFIG_NE2K_CBUS_ATLA98) -static struct ne2k_cbus_offsetinfo ne2k_offsetinfo __initdata = { - 0x01, 0x08, 0x10, 0x1f -}; -static struct ne2k_cbus_region ne2k_regionlist[] __initdata = { - {0x0, 32}, - {0x0, 0} -}; -#endif - -#ifdef CONFIG_NE2K_CBUS_NEC108 -#ifndef MODULE -static unsigned short nec108_portlist[] __initdata = { - 0x770, 0x2770, 0x4770, 0x6770, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo nec108_offsetinfo __initdata = { - 0x02, 0x1000, 0x888, 0x88a -}; -static struct ne2k_cbus_region nec108_regionlist[] __initdata = { - {0x0, 1}, {0x2, 1}, {0x4, 1}, {0x6, 1}, - {0x8, 1}, {0xa, 1}, {0xc, 1}, {0xe, 1}, - {0x1000, 1}, {0x1002, 1}, {0x1004, 1}, {0x1006, 1}, - {0x1008, 1}, {0x100a, 1}, {0x100c, 1}, {0x100e, 1}, - {0x888, 1}, {0x88a, 1}, {0x88c, 1}, {0x88e, 1}, - {0x0, 0} -}; -#endif - -#ifdef CONFIG_NE2K_CBUS_IOLA98 -#ifndef MODULE -static unsigned short iola98_portlist[] __initdata = { - 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo iola98_offsetinfo __initdata = { - 0x1000, 0x8000, 0x100, 0xf100 -}; -static struct ne2k_cbus_region iola98_regionlist[] __initdata = { - {0x0, 1}, {0x1000, 1}, {0x2000, 1}, {0x3000, 1}, - {0x4000, 1}, {0x5000, 1}, {0x6000, 1}, {0x7000, 1}, - {0x8000, 1}, {0x9000, 1}, {0xa000, 1}, {0xb000, 1}, - {0xc000, 1}, {0xd000, 1}, {0xe000, 1}, {0xf000, 1}, - {0x100, 1}, {0xf100, 1}, - {0x0,0} -}; -#endif /* CONFIG_NE2K_CBUS_IOLA98 */ - -#ifdef CONFIG_NE2K_CBUS_CNET98EL -#ifndef MODULE -static unsigned short cnet98el_portlist[] __initdata = { - 0x3d0, 0x13d0, 0x23d0, 0x33d0, 0x43d0, 0x53d0, 0x60d0, 0x70d0, - 0 -}; -#endif -static struct ne2k_cbus_offsetinfo cnet98el_offsetinfo __initdata = { - 0x01, 0x08, 0x40e, 0x400 -}; -static struct ne2k_cbus_region cnet98el_regionlist[] __initdata = { - {0x0, 16}, {0x400, 16}, - {0x0, 0} -}; -#endif - - -/* port information table (for ne.c initialize/probe process) */ - -static struct ne2k_cbus_hwinfo ne2k_cbus_hwinfo_list[] __initdata = { -#ifdef CONFIG_NE2K_CBUS_ATLA98 -/* NOT TESTED */ - { - NE2K_CBUS_HARDWARE_TYPE_ATLA98, - "LA-98-T", -#ifndef MODULE - atla98_portlist, -#endif - &atla98_offsetinfo, atla98_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_BDN -/* NOT TESTED */ - { - NE2K_CBUS_HARDWARE_TYPE_BDN, - "LD-BDN[123]A", -#ifndef MODULE - bdn_portlist, -#endif - &bdn_offsetinfo, bdn_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_ICM - { - NE2K_CBUS_HARDWARE_TYPE_ICM, - "IF-27xxET", -#ifndef MODULE - icm_portlist, -#endif - &icm_offsetinfo, icm_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_NE2K - { - NE2K_CBUS_HARDWARE_TYPE_NE2K, - "NE2000 compat.", -#ifndef MODULE - ne2k_portlist, -#endif - &ne2k_offsetinfo, ne2k_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_NEC108 - { - NE2K_CBUS_HARDWARE_TYPE_NEC108, - "PC-9801-108", -#ifndef MODULE - nec108_portlist, -#endif - &nec108_offsetinfo, nec108_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_IOLA98 - { - NE2K_CBUS_HARDWARE_TYPE_IOLA98, - "LA-98", -#ifndef MODULE - iola98_portlist, -#endif - &iola98_offsetinfo, iola98_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_CNET98EL - { - NE2K_CBUS_HARDWARE_TYPE_CNET98EL, - "C-NET(98)E/L", -#ifndef MODULE - cnet98el_portlist, -#endif - &cnet98el_offsetinfo, cnet98el_regionlist - }, -#endif -/* NOTE: LGY98 must be probed before EGY98, or system stalled!? */ -#ifdef CONFIG_NE2K_CBUS_LGY98 - { - NE2K_CBUS_HARDWARE_TYPE_LGY98, - "LGY-98", -#ifndef MODULE - lgy98_portlist, -#endif - &lgy98_offsetinfo, lgy98_regionlist - }, -#endif -#ifdef CONFIG_NE2K_CBUS_EGY98 - { - NE2K_CBUS_HARDWARE_TYPE_EGY98, - "EGY-98", -#ifndef MODULE - egy98_portlist, -#endif - &egy98_offsetinfo, egy98_regionlist - }, -#endif - { - 0, - "unsupported hardware", -#ifndef MODULE - NULL, -#endif - NULL, NULL - } -}; - -static int __init ne2k_cbus_init(struct net_device *dev) -{ - struct ei_device *ei_local; - if (dev->priv == NULL) { - ei_local = kmalloc(sizeof(struct ei_device), GFP_KERNEL); - if (ei_local == NULL) - return -ENOMEM; - memset(ei_local, 0, sizeof(struct ei_device)); - ei_local->reg_offset = kmalloc(sizeof(typeof(*ei_local->reg_offset))*18, GFP_KERNEL); - if (ei_local->reg_offset == NULL) { - kfree(ei_local); - return -ENOMEM; - } - spin_lock_init(&ei_local->page_lock); - dev->priv = ei_local; - } - return 0; -} - -static void ne2k_cbus_destroy(struct net_device *dev) -{ - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - if (ei_local != NULL) { - if (ei_local->reg_offset) - kfree(ei_local->reg_offset); - kfree(dev->priv); - dev->priv = NULL; - } -} - -static const struct ne2k_cbus_hwinfo * __init ne2k_cbus_get_hwinfo(int hwtype) -{ - const struct ne2k_cbus_hwinfo *hw; - - for (hw = &ne2k_cbus_hwinfo_list[0]; hw->hwtype; hw++) { - if (hw->hwtype == hwtype) break; - } - return hw; -} - -static void __init ne2k_cbus_set_hwtype(struct net_device *dev, const struct ne2k_cbus_hwinfo *hw, int ioaddr) -{ - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - int i; - int hwtype_old = dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK; - - if (!ei_local) - panic("Gieee! ei_local == NULL!! (from %p)", - __builtin_return_address(0)); - - dev->mem_start &= ~NE2K_CBUS_HARDWARE_TYPE_MASK; - dev->mem_start |= hw->hwtype & NE2K_CBUS_HARDWARE_TYPE_MASK; - - if (ei_debug > 2) { - printk(KERN_DEBUG "hwtype changed: %d -> %d\n",hwtype_old,(int)(dev->mem_start & NE2K_CBUS_HARDWARE_TYPE_MASK)); - } - - if (hw->offsetinfo) { - for (i = 0; i < 8; i++) { - ei_local->reg_offset[i] = hw->offsetinfo->skip * i; - } - for (i = 8; i < 16; i++) { - ei_local->reg_offset[i] = - hw->offsetinfo->skip*(i-8) + hw->offsetinfo->offset8; - } -#ifdef CONFIG_NE2K_CBUS_NEC108 - if (hw->hwtype == NE2K_CBUS_HARDWARE_TYPE_NEC108) { - int adj = (ioaddr & 0xf000) /2; - ei_local->reg_offset[16] = - (hw->offsetinfo->offset10 | adj) - ioaddr; - ei_local->reg_offset[17] = - (hw->offsetinfo->offset1f | adj) - ioaddr; - } else { -#endif /* CONFIG_NE2K_CBUS_NEC108 */ - ei_local->reg_offset[16] = hw->offsetinfo->offset10; - ei_local->reg_offset[17] = hw->offsetinfo->offset1f; -#ifdef CONFIG_NE2K_CBUS_NEC108 - } -#endif - } else { - /* make dummmy offset list */ - for (i = 0; i < 16; i++) { - ei_local->reg_offset[i] = i; - } - ei_local->reg_offset[16] = 0x10; - ei_local->reg_offset[17] = 0x1f; - } -} - -#if defined(CONFIG_NE2K_CBUS_ICM) || defined(CONFIG_NE2K_CBUS_CNET98EL) -static void __init ne2k_cbus_readmem(struct net_device *dev, int ioaddr, unsigned short memaddr, char *buf, unsigned short len) -{ - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - outb_p(E8390_NODMA | E8390_START, ioaddr+E8390_CMD); - outb_p(len & 0xff, ioaddr+EN0_RCNTLO); - outb_p(len >> 8, ioaddr+EN0_RCNTHI); - outb_p(memaddr & 0xff, ioaddr+EN0_RSARLO); - outb_p(memaddr >> 8, ioaddr+EN0_RSARHI); - outb_p(E8390_RREAD | E8390_START, ioaddr+E8390_CMD); - insw(ioaddr+NE_DATAPORT, buf, len >> 1); -} -static void __init ne2k_cbus_writemem(struct net_device *dev, int ioaddr, unsigned short memaddr, const char *buf, unsigned short len) -{ - struct ei_device *ei_local = (struct ei_device *)(dev->priv); - outb_p(E8390_NODMA | E8390_START, ioaddr+E8390_CMD); - outb_p(ENISR_RDC, ioaddr+EN0_ISR); - outb_p(len & 0xff, ioaddr+EN0_RCNTLO); - outb_p(len >> 8, ioaddr+EN0_RCNTHI); - outb_p(memaddr & 0xff, ioaddr+EN0_RSARLO); - outb_p(memaddr >> 8, ioaddr+EN0_RSARHI); - outb_p(E8390_RWRITE | E8390_START, ioaddr+E8390_CMD); - outsw(ioaddr+NE_DATAPORT, buf, len >> 1); -} -#endif - -static int ne_probe_cbus(struct net_device *dev, const struct ne2k_cbus_hwinfo *hw, int ioaddr, int irq); -/* End of ne2k_cbus.h */ 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 0ff2d4223..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; @@ -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/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/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/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/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/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 0eb660aa7..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; } 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/sungem.c b/drivers/net/sungem.c index cb890cd3e..b831eef1b 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -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/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/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/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/yellowfin.c b/drivers/net/yellowfin.c index 81e97947c..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); 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/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/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/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_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/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/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/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/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/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/pc980155.c b/drivers/scsi/pc980155.c deleted file mode 100644 index 62b2852fb..000000000 --- a/drivers/scsi/pc980155.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * - * drivers/scsi/pc980155.c - * - * PC-9801-55 SCSI host adapter driver - * - * Copyright (C) 1997-2003 Kyoto University Microcomputer Club - * (Linux/98 project) - * Tomoharu Ugawa - * - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include "scsi.h" -#include -#include "wd33c93.h" -#include "pc980155.h" - -extern int pc98_bios_param(struct scsi_device *, struct block_device *, - sector_t, int *); -static int scsi_pc980155_detect(Scsi_Host_Template *); -static int scsi_pc980155_release(struct Scsi_Host *); - -#ifndef CMD_PER_LUN -#define CMD_PER_LUN 2 -#endif - -#ifndef CAN_QUEUE -#define CAN_QUEUE 16 -#endif - -#undef PC_9801_55_DEBUG -#undef PC_9801_55_DEBUG_VERBOSE - -#define NR_BASE_IOS 4 -static int nr_base_ios = NR_BASE_IOS; -static unsigned int base_ios[NR_BASE_IOS] = {0xcc0, 0xcd0, 0xce0, 0xcf0}; -static wd33c93_regs init_regs; -static int io; - -static struct Scsi_Host *pc980155_host = NULL; - -static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp); - -static inline void pc980155_dma_enable(unsigned int base_io) -{ - outb(0x01, REG_CWRITE); -} - -static inline void pc980155_dma_disable(unsigned int base_io) -{ - outb(0x02, REG_CWRITE); -} - - -static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp) -{ - wd33c93_intr(pc980155_host); -} - -static int dma_setup(Scsi_Cmnd *sc, int dir_in) -{ - /* - * sc->SCp.this_residual : transfer count - * sc->SCp.ptr : distination address (virtual address) - * dir_in : data direction (DATA_OUT_DIR:0 or DATA_IN_DIR:1) - * - * if success return 0 - */ - - /* - * DMA WRITE MODE - * bit 7,6 01b single mode (this mode only) - * bit 5 inc/dec (default:0 = inc) - * bit 4 auto initialize (normaly:0 = off) - * bit 3,2 01b memory -> io - * 10b io -> memory - * 00b verify - * bit 1,0 channel - */ - disable_dma(sc->device->host->dma_channel); - set_dma_mode(sc->device->host->dma_channel, - 0x40 | (dir_in ? 0x04 : 0x08)); - clear_dma_ff(sc->device->host->dma_channel); - set_dma_addr(sc->device->host->dma_channel, virt_to_phys(sc->SCp.ptr)); - set_dma_count(sc->device->host->dma_channel, sc->SCp.this_residual); -#ifdef PC_9801_55_DEBUG - printk("D%d(%x)D", sc->device->host->dma_channel, - sc->SCp.this_residual); -#endif - enable_dma(sc->device->host->dma_channel); - pc980155_dma_enable(sc->device->host->io_port); - return 0; -} - -static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *sc, int status) -{ - /* - * instance: Hostadapter's instance - * sc: scsi command - * status: True if success - */ - pc980155_dma_disable(sc->device->host->io_port); - disable_dma(sc->device->host->dma_channel); -} - -/* return non-zero on detection */ -static inline int pc980155_test_port(wd33c93_regs regs) -{ - /* Quick and dirty test for presence of the card. */ - if (inb(regs.SASR) == 0xff) - return 0; - - return 1; -} - -static inline int pc980155_getconfig(unsigned int base_io, wd33c93_regs regs, - unsigned char* irq, unsigned char* dma, - unsigned char* scsi_id) -{ - static unsigned char irqs[] = {3, 5, 6, 9, 12, 13}; - unsigned char result; - - printk(KERN_DEBUG "PC-9801-55: base_io=%x SASR=%x SCMD=%x\n", - base_io, regs.SASR, regs.SCMD); - result = read_pc980155_resetint(regs); - printk(KERN_DEBUG "PC-9801-55: getting config (%x)\n", result); - *scsi_id = result & 0x07; - *irq = (result >> 3) & 0x07; - if (*irq > 5) { - printk(KERN_ERR "PC-9801-55 (base %#x): impossible IRQ (%d)" - " - other device here?\n", base_io, *irq); - return 0; - } - - *irq = irqs[*irq]; - result = inb(REG_STATRD); - *dma = result & 0x03; - if (*dma == 1) { - printk(KERN_ERR - "PC-9801-55 (base %#x): impossible DMA channl (%d)" - " - other device here?\n", base_io, *dma); - return 0; - } -#ifdef PC_9801_55_DEBUG - printk("PC-9801-55: end of getconfig\n"); -#endif - return 1; -} - -/* return non-zero on detection */ -static int scsi_pc980155_detect(Scsi_Host_Template* tpnt) -{ - unsigned int base_io; - unsigned char irq, dma, scsi_id; - int i; -#ifdef PC_9801_55_DEBUG - unsigned char debug; -#endif - - if (io) { - base_ios[0] = io; - nr_base_ios = 1; - } - - for (i = 0; i < nr_base_ios; i++) { - base_io = base_ios[i]; - init_regs.SASR = REG_ADDRST; - init_regs.SCMD = REG_CONTRL; -#ifdef PC_9801_55_DEBUG - printk("PC-9801-55: SASR(%x = %x)\n", SASR, REG_ADDRST); -#endif - if (!request_region(base_io, 6, "PC-9801-55")) - continue; - - if (pc980155_test_port(init_regs) && - pc980155_getconfig(base_io, init_regs, - &irq, &dma, &scsi_id)) - goto found; - - release_region(base_io, 6); - } - - printk("PC-9801-55: not found\n"); - return 0; - - found: -#ifdef PC_9801_55_DEBUG - printk("PC-9801-55: config: base io = %x, irq = %d, dma channel = %d, scsi id = %d\n", base_io, irq, dma, scsi_id); -#endif - if (request_irq(irq, pc980155_intr_handle, 0, "PC-9801-55", NULL)) { - printk(KERN_ERR "PC-9801-55: unable to allocate IRQ %d\n", irq); - goto err1; - } - - if (request_dma(dma, "PC-9801-55")) { - printk(KERN_ERR "PC-9801-55: unable to allocate DMA channel %d\n", dma); - goto err2; - } - - pc980155_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (pc980155_host) { - pc980155_host->this_id = scsi_id; - pc980155_host->io_port = base_io; - pc980155_host->n_io_port = 6; - pc980155_host->irq = irq; - pc980155_host->dma_channel = dma; - printk("PC-9801-55: scsi host found at %x irq = %d, use dma channel %d.\n", base_io, irq, dma); - pc980155_int_enable(init_regs); - wd33c93_init(pc980155_host, init_regs, dma_setup, dma_stop, - WD33C93_FS_12_15); - return 1; - } - - printk(KERN_ERR "PC-9801-55: failed to register device\n"); - -err2: - free_irq(irq, NULL); -err1: - release_region(base_io, 6); - return 0; -} - -static int scsi_pc980155_release(struct Scsi_Host *shost) -{ - struct WD33C93_hostdata *hostdata - = (struct WD33C93_hostdata *)shost->hostdata; - - pc980155_int_disable(hostdata->regs); - release_region(shost->io_port, shost->n_io_port); - free_irq(shost->irq, NULL); - free_dma(shost->dma_channel); - wd33c93_release(); - return 1; -} - -static int pc980155_bus_reset(Scsi_Cmnd *cmd) -{ - struct WD33C93_hostdata *hostdata - = (struct WD33C93_hostdata *)cmd->device->host->hostdata; - - pc980155_int_disable(hostdata->regs); - pc980155_assert_bus_reset(hostdata->regs); - udelay(50); - pc980155_negate_bus_reset(hostdata->regs); - (void) inb(hostdata->regs.SASR); - (void) read_pc980155(hostdata->regs, WD_SCSI_STATUS); - pc980155_int_enable(hostdata->regs); - wd33c93_host_reset(cmd); - return SUCCESS; -} - - -#ifndef MODULE -static int __init pc980155_setup(char *str) -{ - int ints[4]; - - str = get_options(str, ARRAY_SIZE(ints), ints); - if (ints[0] > 0) - io = ints[1]; - return 1; -} -__setup("pc980155_io=", pc980155_setup); -#endif - -MODULE_PARM(io, "i"); -MODULE_AUTHOR("Tomoharu Ugawa "); -MODULE_DESCRIPTION("PC-9801-55 SCSI host adapter driver"); -MODULE_LICENSE("GPL"); - -static Scsi_Host_Template driver_template = { - .proc_info = wd33c93_proc_info, - .name = "SCSI PC-9801-55", - .detect = scsi_pc980155_detect, - .release = scsi_pc980155_release, - .queuecommand = wd33c93_queuecommand, - .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = pc980155_bus_reset, - .eh_host_reset_handler = wd33c93_host_reset, - .bios_param = pc98_bios_param, - .can_queue = CAN_QUEUE, - .this_id = 7, - .sg_tablesize = SG_ALL, - .cmd_per_lun = CMD_PER_LUN, /* dont use link command */ - .unchecked_isa_dma = 1, /* use dma **XXXX***/ - .use_clustering = ENABLE_CLUSTERING, - .proc_name = "PC_9801_55", -}; - -#include "scsi_module.c" diff --git a/drivers/scsi/pc980155.h b/drivers/scsi/pc980155.h deleted file mode 100644 index eef4a8004..000000000 --- a/drivers/scsi/pc980155.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * drivers/scsi/pc980155.h - * - * PC-9801-55 SCSI host adapter driver - * - * Copyright (C) 1997-2003 Kyoto University Microcomputer Club - * (Linux/98 project) - * Tomoharu Ugawa - * - */ - -#ifndef __PC980155_H -#define __PC980155_H - -#include "wd33c93.h" - -#define REG_ADDRST (base_io) -#define REG_CONTRL (base_io + 2) -#define REG_CWRITE (base_io + 4) -#define REG_STATRD (base_io + 4) - -#define WD_MEMORYBANK 0x30 -#define WD_RESETINT 0x33 - -static inline uchar read_pc980155(const wd33c93_regs regs, uchar reg_num) -{ - outb(reg_num, regs.SASR); - return (uchar)inb(regs.SCMD); -} - -static inline void write_memorybank(const wd33c93_regs regs, uchar value) -{ - outb(WD_MEMORYBANK, regs.SASR); - outb(value, regs.SCMD); -} - -#define read_pc980155_resetint(regs) \ - read_pc980155((regs), WD_RESETINT) -#define pc980155_int_enable(regs) \ - write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x04) - -#define pc980155_int_disable(regs) \ - write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x04) - -#define pc980155_assert_bus_reset(regs) \ - write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x02) - -#define pc980155_negate_bus_reset(regs) \ - write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x02) - -#endif /* __PC980155_H */ 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_pc98.c b/drivers/scsi/scsi_pc98.c deleted file mode 100644 index 319df013a..000000000 --- a/drivers/scsi/scsi_pc98.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2003 Osamu Tomita - * - * PC9801 BIOS geometry handling. - */ - -#include -#include -#include -#include -#include -#include - -#include "scsi.h" -#include - - -static int pc98_first_bios_param(struct scsi_device *sdev, int *ip) -{ - const u8 *p = (&__PC9800SCA(u8, PC9800SCA_SCSI_PARAMS) + sdev->id * 4); - - ip[0] = p[1]; /* # of heads */ - ip[1] = p[0]; /* # of sectors/track */ - ip[2] = *(u16 *)&p[2] & 0x0fff; /* # of cylinders */ - if (p[3] & (1 << 6)) { /* #-of-cylinders is 16-bit */ - ip[2] |= (ip[0] & 0xf0) << 8; - ip[0] &= 0x0f; - } - - return 0; -} - -int pc98_bios_param(struct scsi_device *sdev, struct block_device *bdev, - sector_t capacity, int *ip) -{ - struct Scsi_Host *first_real = first_real_host(); - - /* - * XXX - * XXX This needs to become a sysfs attribute that's set - * XXX by code that knows which host is the first one. - * XXX - * XXX Currently we support only one host on with a - * XXX PC98ish HBA. - * XXX - */ - if (1 || sdev->host == first_real && sdev->id < 7 && - __PC9800SCA_TEST_BIT(PC9800SCA_DISK_EQUIPS, sdev->id)) - return pc98_first_bios_param(sdev, ip); - - /* Assume PC-9801-92 compatible parameters for HAs without BIOS. */ - ip[0] = 8; - ip[1] = 32; - ip[2] = capacity / (8 * 32); - if (ip[2] > 65535) { /* if capacity >= 8GB */ - /* Recent on-board adapters seem to use this parameter. */ - ip[1] = 128; - ip[2] = capacity / (8 * 128); - if (ip[2] > 65535) { /* if capacity >= 32GB */ - /* Clip the number of cylinders. Currently - this is the limit that we deal with. */ - ip[2] = 65535; - } - } - - return 0; -} - -EXPORT_SYMBOL(pc98_bios_param); 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 abbbe3fc3..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; } diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8e6060f42..e5ce98eb0 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -518,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/serial98.c b/drivers/serial/serial98.c deleted file mode 100644 index c34f89968..000000000 --- a/drivers/serial/serial98.c +++ /dev/null @@ -1,1120 +0,0 @@ -/* - * linux/drivers/serial/serial98.c - * - * Driver for NEC PC-9801/PC-9821 standard serial ports - * - * Based on drivers/serial/8250.c, by Russell King. - * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. - * - * Copyright (C) 2002 Osamu Tomita - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#if defined(CONFIG_SERIAL98_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -#define SUPPORT_SYSRQ -#endif - -#include - -#define SERIAL98_NR 1 -#define SERIAL98_ISR_PASS_LIMIT 256 -#define SERIAL98_EXT 0x434 - -//#define RX_8251F 0x130 /* In: Receive buffer */ -//#define TX_8251F 0x130 /* Out: Transmit buffer */ -//#define LSR_8251F 0x132 /* In: Line Status Register */ -//#define MSR_8251F 0x134 /* In: Modem Status Register */ -#define IIR_8251F 0x136 /* In: Interrupt ID Register */ -#define FCR_8251F 0x138 /* I/O: FIFO Control Register */ -#define VFAST_8251F 0x13a /* I/O: VFAST mode Register */ - -#define CMD_8251F 0x32 /* Out: 8251 Command Resister */ -#define IER2_8251F 0x34 /* I/O: Interrupt Enable Register */ -#define IER1_8251F 0x35 /* I/O: Interrupt Enable Register */ -#define IER1_CTL 0x37 /* Out: Interrupt Enable Register */ -#define DIS_RXR_INT 0x00 /* disable RxRDY Interrupt */ -#define ENA_RXR_INT 0x01 /* enable RxRDY Interrupt */ -#define DIS_TXE_INT 0x02 /* disable TxEMPTY Interrupt */ -#define ENA_TXE_INT 0x03 /* enable TxEMPTY Interrupt */ -#define DIS_TXR_INT 0x04 /* disable TxRDY Interrupt */ -#define ENA_TXR_INT 0x05 /* enable TxRDY Interrupt */ - -#define CMD_RESET 0x40 /* Reset Command */ -#define CMD_RTS 0x20 /* Set RTS line */ -#define CMD_CLR_ERR 0x10 /* Clear error flag */ -#define CMD_BREAK 0x08 /* Send Break */ -#define CMD_RXE 0x04 /* Enable receive */ -#define CMD_DTR 0x02 /* Set DTR line */ -#define CMD_TXE 0x01 /* Enable send */ -#define CMD_DUMMY 0x00 /* Dummy Command */ - -#define VFAST_ENABLE 0x80 /* V.Fast mode Enable */ - -/* Interrupt masks */ -#define INTR_8251_TXRE 0x04 -#define INTR_8251_TXEE 0x02 -#define INTR_8251_RXRE 0x01 -/* I/O Port */ -//#define PORT_8251_DATA 0 -//#define PORT_8251_CMD 2 -//#define PORT_8251_MOD 2 -//#define PORT_8251_STS 2 -/* status read */ -#define STAT_8251_TXRDY 0x01 -#define STAT_8251_RXRDY 0x02 -#define STAT_8251_TXEMP 0x04 -#define STAT_8251_PER 0x08 -#define STAT_8251_OER 0x10 -#define STAT_8251_FER 0x20 -#define STAT_8251_BRK 0x40 -#define STAT_8251_DSR 0x80 -#if 1 -#define STAT_8251F_TXEMP 0x01 -#define STAT_8251F_TXRDY 0x02 -#define STAT_8251F_RXRDY 0x04 -#define STAT_8251F_DSR 0x08 -#define STAT_8251F_OER 0x10 -#define STAT_8251F_PER 0x20 -#define STAT_8251F_FER 0x40 -#define STAT_8251F_BRK 0x80 -#else -#define STAT_8251F_TXEMP 0x01 -#define STAT_8251F_TEMT 0x01 -#define STAT_8251F_TXRDY 0x02 -#define STAT_8251F_THRE 0x02 -#define STAT_8251F_RXRDY 0x04 -#define STAT_8251F_DSR 0x04 -#define STAT_8251F_PER 0x08 -#define STAT_8251F_OER 0x10 -#define STAT_8251F_FER 0x20 -#define STAT_8251F_BRK 0x40 -#endif - -/* - * We wrap our port structure around the generic uart_port. - */ -struct serial98_port { - struct uart_port port; - unsigned int type; - unsigned int ext; - unsigned int lsr_break_flag; - unsigned char cmd; - unsigned char mode; - unsigned char msr; - unsigned char ier; - unsigned char rxchk; - unsigned char txemp; - unsigned char txrdy; - unsigned char rxrdy; - unsigned char brk; - unsigned char fe; - unsigned char oe; - unsigned char pe; - unsigned char dr; -}; - -#ifdef CONFIG_SERIAL98_CONSOLE -static void -serial98_console_write(struct console *co, const char *s, unsigned int count); -static int __init serial98_console_setup(struct console *co, char *options); - -extern struct uart_driver serial98_reg; -static struct console serial98_console = { - .name = "ttyS", - .write = serial98_console_write, - .device = uart_console_device, - .setup = serial98_console_setup, - .flags = CON_PRINTBUFFER, - .index = -1, - .data = &serial98_reg, -}; - -#define SERIAL98_CONSOLE &serial98_console -#else -#define SERIAL98_CONSOLE NULL -#endif - -static struct uart_driver serial98_reg = { - .owner = THIS_MODULE, - .driver_name = "serial98", - .dev_name = "ttyS", - .major = TTY_MAJOR, - .minor = 64, - .nr = SERIAL98_NR, - .cons = SERIAL98_CONSOLE, -}; - -static int serial98_clk; -static char type_str[48]; - -#define PORT98 ((struct serial98_port *)port) -#define PORT (PORT98->port) - -static void serial98_fifo_enable(struct uart_port *port, int enable) -{ - unsigned char fcr; - - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - fcr = inb(FCR_8251F); - if (enable) - fcr |= UART_FCR_ENABLE_FIFO; - else - fcr &= ~UART_FCR_ENABLE_FIFO; - outb(fcr, FCR_8251F); - } - - if (!enable) - return; - - outb(0, 0x5f); /* wait */ - outb(0, 0x5f); - outb(0, 0x5f); - outb(0, 0x5f); -} - -static void serial98_cmd_out(struct uart_port *port, unsigned char cmd) -{ - serial98_fifo_enable(port, 0); - outb(cmd, CMD_8251F); - serial98_fifo_enable(port, 1); -} - -static void serial98_mode_set(struct uart_port *port) -{ - serial98_cmd_out(port, CMD_DUMMY); - serial98_cmd_out(port, CMD_DUMMY); - serial98_cmd_out(port, CMD_DUMMY); - serial98_cmd_out(port, CMD_RESET); - serial98_cmd_out(port, PORT98->mode); -} - -static unsigned char serial98_msr_in(struct uart_port *port) -{ - unsigned long flags; - unsigned int ms, st; - unsigned int tmp; - - spin_lock_irqsave(&PORT.lock, flags); - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - PORT98->msr = inb(PORT.iobase + 4); - } else { - ms = inb(0x33); - st = inb(0x32); - tmp = 0; - if(!(ms & 0x20)) - tmp |= UART_MSR_DCD; - if(!(ms & 0x80)) { - tmp |= UART_MSR_RI; - PORT98->msr |= UART_MSR_RI; - } - if(!(ms & 0x40)) - tmp |= UART_MSR_CTS; - if(st & 0x80) - tmp |= UART_MSR_DSR; - PORT98->msr = ((PORT98->msr ^ tmp) >> 4) | tmp; - } - - spin_unlock_irqrestore(&PORT.lock, flags); - return PORT98->msr; -} - -static void serial98_stop_tx(struct uart_port *port, unsigned int tty_stop) -{ - unsigned int ier = inb(IER1_8251F); - - ier &= ~(INTR_8251_TXRE | INTR_8251_TXEE); - outb(ier, IER1_8251F); -} - -static void serial98_start_tx(struct uart_port *port, unsigned int tty_start) -{ - unsigned int ier = inb(IER1_8251F); - - ier |= INTR_8251_TXRE | INTR_8251_TXEE; - outb(ier, IER1_8251F); -} - -static void serial98_stop_rx(struct uart_port *port) -{ - PORT.read_status_mask &= ~PORT98->dr; - outb(DIS_RXR_INT, IER1_CTL); -} - -static void serial98_enable_ms(struct uart_port *port) -{ - outb(PORT98->ier | 0x80, IER2_8251F); -} - -static void serial98_rx_chars(struct uart_port *port, int *status, - struct pt_regs *regs) -{ - struct tty_struct *tty = PORT.info->tty; - unsigned char ch; - int max_count = 256; - - do { - if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { - tty->flip.work.func((void *)tty); - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; // if TTY_DONT_FLIP is set - } - ch = inb(PORT.iobase); - *tty->flip.char_buf_ptr = ch; - *tty->flip.flag_buf_ptr = TTY_NORMAL; - PORT.icount.rx++; - - if (unlikely(*status & (PORT98->brk | PORT98->pe | - PORT98->fe | PORT98->oe))) { - /* - * For statistics only - */ - if (*status & PORT98->brk) { - *status &= ~(PORT98->fe | PORT98->pe); - PORT.icount.brk++; - /* - * We do the SysRQ and SAK checking - * here because otherwise the break - * may get masked by ignore_status_mask - * or read_status_mask. - */ - if (uart_handle_break(&PORT)) - goto ignore_char; - } else if (*status & PORT98->pe) - PORT.icount.parity++; - else if (*status & PORT98->fe) - PORT.icount.frame++; - if (*status & PORT98->oe) - PORT.icount.overrun++; - - /* - * Mask off conditions which should be ingored. - */ - *status &= PORT.read_status_mask; - -#ifdef CONFIG_SERIAL98_CONSOLE - if (PORT.line == PORT.cons->index) { - /* Recover the break flag from console xmit */ - *status |= PORT98->lsr_break_flag; - PORT98->lsr_break_flag = 0; - } -#endif - if (*status & PORT98->brk) { - *tty->flip.flag_buf_ptr = TTY_BREAK; - } else if (*status & PORT98->pe) - *tty->flip.flag_buf_ptr = TTY_PARITY; - else if (*status & PORT98->fe) - *tty->flip.flag_buf_ptr = TTY_FRAME; - } - if (uart_handle_sysrq_char(&PORT, ch, regs)) - goto ignore_char; - if ((*status & PORT.ignore_status_mask) == 0) { - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - tty->flip.count++; - } - if ((*status & PORT98->oe) && - tty->flip.count < TTY_FLIPBUF_SIZE) { - /* - * Overrun is special, since it's reported - * immediately, and doesn't affect the current - * character. - */ - *tty->flip.flag_buf_ptr = TTY_OVERRUN; - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - tty->flip.count++; - } - ignore_char: - *status = inb(PORT.iobase + 2); - } while ((*status & PORT98->rxchk) && (max_count-- > 0)); - tty_flip_buffer_push(tty); -} - -static void serial98_tx_chars(struct uart_port *port) -{ - struct circ_buf *xmit = &PORT.info->xmit; - int count; - - if (PORT.x_char) { - outb(PORT.x_char, PORT.iobase); - PORT.icount.tx++; - PORT.x_char = 0; - return; - } - if (uart_circ_empty(xmit) || uart_tx_stopped(&PORT)) { - serial98_stop_tx(port, 0); - return; - } - - count = PORT.fifosize; - do { - outb(xmit->buf[xmit->tail], PORT.iobase); - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - PORT.icount.tx++; - if (uart_circ_empty(xmit)) - break; - } while (--count > 0); - - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) - uart_write_wakeup(&PORT); - - if (uart_circ_empty(xmit)) - serial98_stop_tx(&PORT, 0); -} - -static void serial98_modem_status(struct uart_port *port) -{ - int status; - - status = serial98_msr_in(port); - - if ((status & UART_MSR_ANY_DELTA) == 0) - return; - - if (status & UART_MSR_TERI) - PORT.icount.rng++; - if (status & UART_MSR_DDSR) - PORT.icount.dsr++; - if (status & UART_MSR_DDCD) - uart_handle_dcd_change(&PORT, status & UART_MSR_DCD); - if (status & UART_MSR_DCTS) - uart_handle_cts_change(&PORT, status & UART_MSR_CTS); - - wake_up_interruptible(&PORT.info->delta_msr_wait); -} - -static void serial98_int(int irq, void *port, struct pt_regs *regs) -{ - unsigned int status; - - spin_lock(&PORT.lock); - status = inb(PORT.iobase + 2); - if (status & PORT98->rxrdy) { - serial98_rx_chars(port, &status, regs); - } - serial98_modem_status(port); - if (status & PORT98->txrdy) { - serial98_tx_chars(port); - } - spin_unlock(&PORT.lock); -} - -static unsigned int serial98_tx_empty(struct uart_port *port) -{ - unsigned long flags; - unsigned int ret = 0; - - spin_lock_irqsave(&PORT.lock, flags); - if (inb(PORT.iobase + 2) & PORT98->txemp) - ret = TIOCSER_TEMT; - - spin_unlock_irqrestore(&PORT.lock, flags); - return ret; -} - -static unsigned int serial98_get_mctrl(struct uart_port *port) -{ - unsigned char status; - unsigned int ret = 0; - - status = serial98_msr_in(port); - if (status & UART_MSR_DCD) - ret |= TIOCM_CAR; - if (status & UART_MSR_RI) - ret |= TIOCM_RNG; - if (status & UART_MSR_DSR) - ret |= TIOCM_DSR; - if (status & UART_MSR_CTS) - ret |= TIOCM_CTS; - return ret; -} - -static void serial98_set_mctrl(struct uart_port *port, unsigned int mctrl) -{ - PORT98->cmd &= 0xdd; - if (mctrl & TIOCM_RTS) - PORT98->cmd |= CMD_RTS; - - if (mctrl & TIOCM_DTR) - PORT98->cmd |= CMD_DTR; - - serial98_cmd_out(port, PORT98->cmd); -} - -static void serial98_break_ctl(struct uart_port *port, int break_state) -{ - unsigned long flags; - - spin_lock_irqsave(&PORT.lock, flags); - if (break_state == -1) - PORT98->cmd |= CMD_BREAK; - else - PORT98->cmd &= ~CMD_BREAK; - - serial98_cmd_out(port, PORT98->cmd); - spin_unlock_irqrestore(&PORT.lock, flags); -} - -static int serial98_startup(struct uart_port *port) -{ - int retval; - - if (PORT.type == PORT_8251_PC98) { - /* Wake up UART */ - PORT98->mode = 0xfc; - serial98_mode_set(port); - outb(DIS_RXR_INT, IER1_CTL); - outb(DIS_TXE_INT, IER1_CTL); - outb(DIS_TXR_INT, IER1_CTL); - PORT98->mode = 0; - serial98_mode_set(port); - } - - /* - * Clear the FIFO buffers and disable them. - * (they will be reeanbled in set_termios()) - */ - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - outb(UART_FCR_ENABLE_FIFO, FCR_8251F); - outb((UART_FCR_ENABLE_FIFO - | UART_FCR_CLEAR_RCVR - | UART_FCR_CLEAR_XMIT), FCR_8251F); - outb(0, FCR_8251F); - } - - /* Clear the interrupt registers. */ - inb(0x30); - inb(0x32); - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - inb(PORT.iobase); - inb(PORT.iobase + 2); - inb(PORT.iobase + 4); - inb(PORT.iobase + 6); - } - - /* Allocate the IRQ */ - retval = request_irq(PORT.irq, serial98_int, 0, - serial98_reg.driver_name, port); - if (retval) - return retval; - - /* - * Now, initialize the UART - */ - PORT98->mode = 0x4e; - serial98_mode_set(port); - PORT98->cmd = 0x15; - serial98_cmd_out(port, PORT98->cmd); - PORT98->cmd = 0x05; - - /* - * Finally, enable interrupts - */ - outb(0x00, IER2_8251F); - outb(ENA_RXR_INT, IER1_CTL); - - /* - * And clear the interrupt registers again for luck. - */ - inb(0x30); - inb(0x32); - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - inb(PORT.iobase); - inb(PORT.iobase + 2); - inb(PORT.iobase + 4); - inb(PORT.iobase + 6); - } - - return 0; -} - -static void serial98_shutdown(struct uart_port *port) -{ - unsigned long flags; - - /* - * disable all interrupts - */ - spin_lock_irqsave(&PORT.lock, flags); - if (PORT.type == PORT_VFAST_PC98) - outb(0, VFAST_8251F); /* V.FAST mode off */ - - /* disnable all modem status interrupt */ - outb(0x80, IER2_8251F); - - /* disnable TX/RX interrupt */ - outb(0x00, IER2_8251F); - outb(DIS_RXR_INT, IER1_CTL); - outb(DIS_TXE_INT, IER1_CTL); - outb(DIS_TXR_INT, IER1_CTL); - PORT98->ier = 0; - - spin_unlock_irqrestore(&PORT.lock, flags); - - /* - * Free the interrupt - */ - free_irq(PORT.irq, port); - - /* disable break condition and disable the port */ - serial98_mode_set(port); - - /* disable FIFO's */ - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - outb((UART_FCR_ENABLE_FIFO - | UART_FCR_CLEAR_RCVR - | UART_FCR_CLEAR_XMIT), FCR_8251F); - outb(0, FCR_8251F); - } - - inb(PORT.iobase); -} - -static void -serial98_set_termios(struct uart_port *port, struct termios *termios, - struct termios *old) -{ - unsigned char stopbit, cval, fcr = 0, ier = 0; - unsigned long flags; - unsigned int baud, quot; - - stopbit = 0x80; - switch (termios->c_cflag & CSIZE) { - case CS5: - cval = 0x42; - stopbit = 0xc0; - break; - case CS6: - cval = 0x46; - break; - case CS7: - cval = 0x4a; - break; - default: - case CS8: - cval = 0x4e; - break; - } - - if (termios->c_cflag & CSTOPB) - cval ^= stopbit; - if (termios->c_cflag & PARENB) - cval |= 0x10; - if (!(termios->c_cflag & PARODD)) - cval |= 0x20; - - /* - * Ask the core to calculate the divisor for us. - */ - baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); - quot = uart_get_divisor(port, baud); - - if (PORT.type == PORT_FIFO_PC98 || PORT.type == PORT_VFAST_PC98) { - if ((PORT.uartclk / quot) < (2400 * 16)) - fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1; - else - fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_8; - } - - /* - * Ok, we're now changing the port state. Do it with - * interrupts disabled. - */ - spin_lock_irqsave(&PORT.lock, flags); - - /* - * Update the per-port timeout. - */ - uart_update_timeout(port, termios->c_cflag, baud); - - PORT.read_status_mask = PORT98->oe | PORT98->txemp | PORT98->dr; - if (termios->c_iflag & INPCK) - PORT.read_status_mask |= PORT98->fe | PORT98->pe; - - if (termios->c_iflag & (BRKINT | PARMRK)) - PORT.read_status_mask |= PORT98->brk; - /* - * Characters to ignore - */ - PORT.ignore_status_mask = 0; - if (termios->c_iflag & IGNPAR) - PORT.ignore_status_mask |= PORT98->fe | PORT98->pe; - - if (termios->c_iflag & IGNBRK) { - PORT.ignore_status_mask |= PORT98->brk; - /* - * If we're ignoring parity and break indicators, - * ignore overruns too (for real raw support). - */ - if (termios->c_iflag & IGNPAR) - PORT.ignore_status_mask |= PORT98->oe; - } - - /* - * ignore all characters if CREAD is not set - */ - if ((termios->c_cflag & CREAD) == 0) - PORT.ignore_status_mask |= PORT98->dr; - - /* - * CTS flow control flag and modem status interrupts - */ - if (PORT.flags & UPF_HARDPPS_CD) - ier |= 0x80; /* enable modem status interrupt */ - if (termios->c_cflag & CRTSCTS) { - ier |= 0x08; /* enable CTS interrupt */ - ier |= 0x80; /* enable modem status interrupt */ - } - if (!(termios->c_cflag & CLOCAL)) { - ier |= 0x20; /* enable CD interrupt */ - ier |= 0x80; /* enable modem status interrupt */ - } - PORT98->ier = ier; - - PORT98->mode = cval; - serial98_mode_set(port); - if (PORT.type == PORT_VFAST_PC98 && quot <= 48) { - quot /= 4; - if (quot < 1) - quot = 1; - outb(quot | VFAST_ENABLE, VFAST_8251F); - } else { - quot /= 3; - if (quot < 1) - quot = 1; - if (PORT.type == PORT_VFAST_PC98) - outb(0, VFAST_8251F); /* V.FAST mode off */ - outb(0xb6, 0x77); - outb(quot & 0xff, 0x75); /* LS of divisor */ - outb(quot >> 8, 0x75); /* MS of divisor */ - } - - if (fcr & UART_FCR_ENABLE_FIFO) { - outb(UART_FCR_ENABLE_FIFO, FCR_8251F); - outb(fcr, FCR_8251F); - } - - /* enable RX/TX */ - PORT98->cmd = 0x15; - serial98_cmd_out(port, PORT98->cmd); - PORT98->cmd = 0x05; - /* enable interrupts */ - outb(0x00, IER2_8251F); - outb(ENA_RXR_INT, IER1_CTL); - spin_unlock_irqrestore(&PORT.lock, flags); -} - -static const char *serial98_type(struct uart_port *port) -{ - char *p; - - switch (PORT.type) { - case PORT_8251_PC98: - p = "PC98 onboard legacy 8251"; - break; - case PORT_19K_PC98: - p = "PC98 onboard max 19200bps"; - break; - case PORT_FIFO_PC98: - p = "PC98 onboard with FIFO"; - break; - case PORT_VFAST_PC98: - p = "PC98 onboard V.FAST"; - break; - case PORT_PC9861: - p = "PC-9861K RS-232C ext. board"; - break; - case PORT_PC9801_101: - p = "PC-9801-101 RS-232C ext. board"; - break; - default: - return NULL; - } - - sprintf(type_str, "%s Clock %dMHz", p, serial98_clk); - return type_str; -} - -/* Release the region(s) being used by 'port' */ -static void serial98_release_port(struct uart_port *port) -{ - switch (PORT.type) { - case PORT_VFAST_PC98: - release_region(PORT.iobase + 0xa, 1); - case PORT_FIFO_PC98: - release_region(PORT.iobase + 8, 1); - release_region(PORT.iobase + 6, 1); - release_region(PORT.iobase + 4, 1); - release_region(PORT.iobase + 2, 1); - release_region(PORT.iobase, 1); - case PORT_19K_PC98: - release_region(SERIAL98_EXT, 1); - release_region(0x34, 1); - case PORT_8251_PC98: - release_region(0x32, 1); - release_region(0x30, 1); - } -} - -/* Request the region(s) being used by 'port' */ -#define REQ_REGION98(base) (request_region((base), 1, serial98_reg.driver_name)) -static int serial98_request_region(unsigned int type) -{ - if (!REQ_REGION98(0x30)) - return -EBUSY; - if (REQ_REGION98(0x32)) { - if (type == PORT_8251_PC98) - return 0; - if (REQ_REGION98(0x34)) { - if (REQ_REGION98(SERIAL98_EXT)) { - unsigned long base; - - if (type == PORT_19K_PC98) - return 0; - for (base = 0x130; base <= 0x138; base += 2) { - if (!REQ_REGION98(base)) { - base -= 2; - goto err; - } - } - if (type == PORT_FIFO_PC98) - return 0; - if (type == PORT_VFAST_PC98) { - if (REQ_REGION98(0x13a)) - return 0; - } - err: - while (base >= 0x130) { - release_region(base, 1); - base -= 2; - } - release_region(SERIAL98_EXT, 1); - } - release_region(0x34, 1); - } - release_region(0x32, 1); - } - release_region(0x30, 1); - return -EBUSY; -} - -static int serial98_request_port(struct uart_port *port) -{ - return serial98_request_region(PORT.type); -} - -/* - * Configure/autoconfigure the port. - */ -static void serial98_config_port(struct uart_port *port, int flags) -{ - if (flags & UART_CONFIG_TYPE) - PORT.type = PORT98->type; -} - -/* - * verify the new serial_struct (for TIOCSSERIAL). - */ -static int serial98_verify_port(struct uart_port *port, struct serial_struct *ser) -{ - switch (ser->type) { - case PORT_VFAST_PC98: - case PORT_FIFO_PC98: - case PORT_19K_PC98: - case PORT_8251_PC98: - /* not implemented yet - case PORT_PC9861: - case PORT_PC9801_101: - */ - case PORT_UNKNOWN: - break; - default: - return -EINVAL; - } - if (ser->irq < 0 || ser->irq >= NR_IRQS) - return -EINVAL; - if (ser->baud_base < 9600) - return -EINVAL; - return 0; -} - -static struct uart_ops serial98_ops = { - .tx_empty = serial98_tx_empty, - .set_mctrl = serial98_set_mctrl, - .get_mctrl = serial98_get_mctrl, - .stop_tx = serial98_stop_tx, - .start_tx = serial98_start_tx, - .stop_rx = serial98_stop_rx, - .enable_ms = serial98_enable_ms, - .break_ctl = serial98_break_ctl, - .startup = serial98_startup, - .shutdown = serial98_shutdown, - .set_termios = serial98_set_termios, - .type = serial98_type, - .release_port = serial98_release_port, - .request_port = serial98_request_port, - .config_port = serial98_config_port, - .verify_port = serial98_verify_port, -}; - -static struct serial98_port serial98_ports[SERIAL98_NR] = { - { - .port = { - .iobase = 0x30, - .iotype = SERIAL_IO_PORT, - .irq = 4, - .fifosize = 1, - .ops = &serial98_ops, - .flags = ASYNC_BOOT_AUTOCONF, - .line = 0, - }, - .rxchk = STAT_8251_RXRDY, - .txemp = STAT_8251_TXEMP, - .txrdy = STAT_8251_TXRDY, - .rxrdy = STAT_8251_RXRDY, - .brk = STAT_8251_BRK, - .fe = STAT_8251_FER, - .oe = STAT_8251_OER, - .pe = STAT_8251_PER, - .dr = STAT_8251_DSR, - }, -}; - -#ifdef CONFIG_SERIAL98_CONSOLE - -#define BOTH_EMPTY (PORT98->txemp | PORT98->txrdy) - -/* - * Wait for transmitter & holding register to empty - */ -static inline void wait_for_xmitr(struct uart_port *port) -{ - unsigned int status, tmout = 10000; - - /* Wait up to 10ms for the character(s) to be sent. */ - do { - status = inb(PORT.iobase + 2); - - if (status & PORT98->brk) - PORT98->lsr_break_flag = PORT98->brk; - - if (--tmout == 0) - break; - udelay(1); - } while ((status & BOTH_EMPTY) != BOTH_EMPTY); - - /* Wait up to 1s for flow control if necessary */ - if (PORT.flags & UPF_CONS_FLOW) { - tmout = 1000000; - while (--tmout && - ((serial98_msr_in(port) & UART_MSR_CTS) == 0)) - udelay(1); - } -} - -/* - * Print a string to the serial port trying not to disturb - * any possible real use of the port... - * - * The console_lock must be held when we get here. - */ -static void -serial98_console_write(struct console *co, const char *s, unsigned int count) -{ - struct uart_port *port = (struct uart_port *)&serial98_ports[co->index]; - unsigned int ier1, ier2; - int i; - - /* - * First save the UER then disable the interrupts - */ - ier1 = inb(IER1_8251F); - ier2 = inb(IER2_8251F); - /* disnable all modem status interrupt */ - outb(0x80, IER2_8251F); - - /* disnable TX/RX interrupt */ - outb(0x00, IER2_8251F); - outb(DIS_RXR_INT, IER1_CTL); - outb(DIS_TXE_INT, IER1_CTL); - outb(DIS_TXR_INT, IER1_CTL); - - /* - * Now, do each character - */ - for (i = 0; i < count; i++, s++) { - wait_for_xmitr(port); - - /* - * Send the character out. - * If a LF, also do CR... - */ - outb(*s, PORT.iobase); - if (*s == 10) { - wait_for_xmitr(port); - outb(13, PORT.iobase); - } - } - - /* - * Finally, wait for transmitter to become empty - * and restore the IER - */ - wait_for_xmitr(port); - - /* restore TX/RX interrupt */ - outb(0x00, IER2_8251F); - if (ier1 & 0x01) - outb(ENA_RXR_INT, IER1_CTL); - if (ier1 & 0x02) - outb(ENA_TXE_INT, IER1_CTL); - if (ier1 & 0x04) - outb(ENA_TXR_INT, IER1_CTL); - - /* restore modem status interrupt */ - outb(ier2, IER2_8251F); -} - -static int __init serial98_console_setup(struct console *co, char *options) -{ - struct uart_port *port; - int baud = 9600; - int bits = 8; - int parity = 'n'; - int flow = 'n'; - - /* - * Check whether an invalid uart number has been specified, and - * if so, search for the first available port that does have - * console support. - */ - if (co->index >= SERIAL98_NR) - co->index = 0; - port = &serial98_ports[co->index].port; - - /* - * Temporary fix. - */ - spin_lock_init(&port->lock); - - if (options) - uart_parse_options(options, &baud, &parity, &bits, &flow); - - return uart_set_options(port, co, baud, parity, bits, flow); -} - -void __init serial98_console_init(void) -{ - register_console(&serial98_console); -} - -#endif /* CONFIG_SERIAL98_CONSOLE */ - - -static int __init serial98_init(void) -{ - int ret; - unsigned char iir1, iir2; - - if (PC9800_8MHz_P()) { - serial98_clk = 8; - serial98_ports[0].port.uartclk = 374400 * 16; - } else { - serial98_clk = 5; - serial98_ports[0].port.uartclk = 460800 * 16; - } - - printk(KERN_INFO "serial98: PC-9801 standard serial port driver Version 0.1alpha\n"); - serial98_ports[0].type = PORT_8251_PC98; - /* Check FIFO exist */ - iir1 = inb(IIR_8251F); - iir2 = inb(IIR_8251F); - if ((iir1 & 0x40) != (iir2 & 0x40) && (iir1 & 0x20) == (iir2 & 0x20)) { - serial98_ports[0].port.iobase = 0x130; - serial98_ports[0].port.fifosize = 16; - serial98_ports[0].rxchk = STAT_8251F_DSR; - serial98_ports[0].txemp = STAT_8251F_TXEMP; - serial98_ports[0].txrdy = STAT_8251F_TXRDY; - serial98_ports[0].rxrdy = STAT_8251F_RXRDY; - serial98_ports[0].brk = STAT_8251F_BRK; - serial98_ports[0].fe = STAT_8251F_FER; - serial98_ports[0].oe = STAT_8251F_OER; - serial98_ports[0].pe = STAT_8251F_PER; - serial98_ports[0].dr = STAT_8251F_DSR; - - if (*(unsigned char*)__va(PC9821SCA_RSFLAGS) & 0x10) - serial98_ports[0].type = PORT_VFAST_PC98; - else { - outb(serial98_ports[0].ext | 0x40, SERIAL98_EXT); - serial98_ports[0].port.uartclk *= 4; - serial98_ports[0].type = PORT_FIFO_PC98; - } - } else if ((serial98_ports[0].ext = inb(SERIAL98_EXT)) != 0xff) { - outb(serial98_ports[0].ext | 0x40, SERIAL98_EXT); - if (inb(SERIAL98_EXT) == (serial98_ports[0].ext | 0x40)) { - serial98_ports[0].port.uartclk *= 4; - serial98_ports[0].type = PORT_19K_PC98; - } else { - serial98_ops.enable_ms = NULL; - outb(serial98_ports[0].ext, SERIAL98_EXT); - } - } - - if (serial98_request_region(serial98_ports[0].type)) - return -EBUSY; - - ret = uart_register_driver(&serial98_reg); - if (ret == 0) { - int i; - - for (i = 0; i < SERIAL98_NR; i++) { - uart_add_one_port(&serial98_reg, - (struct uart_port *)&serial98_ports[i]); - } - } - - return ret; -} - -static void __exit serial98_exit(void) -{ - int i; - - if (serial98_ports[0].type == PORT_19K_PC98 - || serial98_ports[0].type == PORT_FIFO_PC98) - outb(serial98_ports[0].ext, SERIAL98_EXT); - - for (i = 0; i < SERIAL98_NR; i++) { - uart_remove_one_port(&serial98_reg, - (struct uart_port *)&serial98_ports[i]); - } - - uart_unregister_driver(&serial98_reg); -} - -module_init(serial98_init); -module_exit(serial98_exit); - -MODULE_AUTHOR("Osamu Tomita "); -MODULE_DESCRIPTION("PC-9801 standard serial port driver Version 0.1alpha"); -MODULE_LICENSE("GPL"); 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/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 00bf32230..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 + 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/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/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/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